@deriv-com/analytics 1.32.6 → 1.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Analytics=t():e.Analytics=t()}(this,()=>(()=>{var e={25(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.URL=t.DNS=void 0,t.default=function(e,t,r){function n(e,n,o,a){var l;if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));for(var t=[],r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t}(e)),"string"==typeof n&&(n=(0,s.default)(n)),16!==(null===(l=n)||void 0===l?void 0:l.length))throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var u=new Uint8Array(16+e.length);if(u.set(n),u.set(e,n.length),(u=r(u))[6]=15&u[6]|t,u[8]=63&u[8]|128,o){a=a||0;for(var c=0;c<16;++c)o[a+c]=u[c];return o}return(0,i.unsafeStringify)(u)}try{n.name=e}catch(e){}return n.DNS=o,n.URL=a,n};var n,i=r(910),s=(n=r(792))&&n.__esModule?n:{default:n},o=t.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",a=t.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8"},37(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n,i=(n=r(656))&&n.__esModule?n:{default:n};t.default=function(e){return"string"==typeof e&&i.default.test(e)}},42(e,t){"use strict";function r(e,t,r,n){switch(e){case 0:return t&r^~t&n;case 1:case 3:return t^r^n;case 2:return t&r^t&n^r&n}}function n(e,t){return e<<t|e>>>32-t}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.default=function(e){var t=[1518500249,1859775393,2400959708,3395469782],i=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof e){var s=unescape(encodeURIComponent(e));e=[];for(var o=0;o<s.length;++o)e.push(s.charCodeAt(o))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);for(var a=e.length/4+2,l=Math.ceil(a/16),u=new Array(l),c=0;c<l;++c){for(var d=new Uint32Array(16),h=0;h<16;++h)d[h]=e[64*c+4*h]<<24|e[64*c+4*h+1]<<16|e[64*c+4*h+2]<<8|e[64*c+4*h+3];u[c]=d}u[l-1][14]=8*(e.length-1)/Math.pow(2,32),u[l-1][14]=Math.floor(u[l-1][14]),u[l-1][15]=8*(e.length-1)&4294967295;for(var g=0;g<l;++g){for(var f=new Uint32Array(80),p=0;p<16;++p)f[p]=u[g][p];for(var v=16;v<80;++v)f[v]=n(f[v-3]^f[v-8]^f[v-14]^f[v-16],1);for(var y=i[0],m=i[1],b=i[2],k=i[3],S=i[4],_=0;_<80;++_){var w=Math.floor(_/20),A=n(y,5)+r(w,m,b,k)+S+t[w]+f[_]>>>0;S=k,k=b,b=n(m,30)>>>0,m=y,y=A}i[0]=i[0]+y>>>0,i[1]=i[1]+m>>>0,i[2]=i[2]+b>>>0,i[3]=i[3]+k>>>0,i[4]=i[4]+S>>>0}return[i[0]>>24&255,i[0]>>16&255,i[0]>>8&255,255&i[0],i[1]>>24&255,i[1]>>16&255,i[1]>>8&255,255&i[1],i[2]>>24&255,i[2]>>16&255,i[2]>>8&255,255&i[2],i[3]>>24&255,i[3]>>16&255,i[3]>>8&255,255&i[3],i[4]>>24&255,i[4]>>16&255,i[4]>>8&255,255&i[4]]}},73(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=o(r(140)),i=o(r(858)),s=r(910);function o(e){return e&&e.__esModule?e:{default:e}}t.default=function(e,t,r){if(n.default.randomUUID&&!t&&!e)return n.default.randomUUID();var o=(e=e||{}).random||(e.rng||i.default)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t){r=r||0;for(var a=0;a<16;++a)t[r+a]=o[a];return t}return(0,s.unsafeStringify)(o)}},106(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.chooseVariation=function(e,t){for(let r=0;r<t.length;r++)if(o(e,t[r]))return r;return-1},t.decrypt=async function(e,t,n){if(t=t||"",!(n=n||globalThis.crypto&&globalThis.crypto.subtle||r.SubtleCrypto))throw new Error("No SubtleCrypto implementation found");try{const r=await n.importKey("raw",u(t),{name:"AES-CBC",length:128},!0,["encrypt","decrypt"]),[i,s]=e.split("."),o=await n.decrypt({name:"AES-CBC",iv:u(i)},r,u(s));return(new TextDecoder).decode(o)}catch(e){throw new Error("Failed to decrypt")}},t.getAutoExperimentChangeType=function(e){return e.urlPatterns&&e.variations.some(e=>c(e)&&"urlRedirect"in e)?"redirect":e.variations.some(e=>c(e)&&(e.domMutations||"js"in e||"css"in e))?"visual":"unknown"},t.getBucketRanges=function(e,t,r){(t=void 0===t?1:t)<0?t=0:t>1&&(t=1);const n=s(e);(r=r||n).length!==e&&(r=n);const i=r.reduce((e,t)=>t+e,0);(i<.99||i>1.01)&&(r=n);let o=0;return r.map(e=>{const r=o;return o+=e,[r,r+t*e]})},t.getEqualWeights=s,t.getPolyfills=function(){return r},t.getQueryStringOverride=function(e,t,r){if(!t)return null;const n=t.split("?")[1];if(!n)return null;const i=n.replace(/#.*/,"").split("&").map(e=>e.split("=",2)).filter(t=>{let[r]=t;return r===e}).map(e=>{let[,t]=e;return parseInt(t)});return i.length>0&&i[0]>=0&&i[0]<r?i[0]:null},t.getUrlRegExp=a,t.hash=i,t.inNamespace=function(e,t){const r=i("__"+t[0],e,1);return null!==r&&r>=t[1]&&r<t[2]},t.inRange=o,t.isIncluded=function(e){try{return e()}catch(e){return console.error(e),!1}},t.isURLTargeted=function(e,t){if(!t.length)return!1;let r=!1,n=!1;for(let i=0;i<t.length;i++){const s=l(e,t[i].type,t[i].pattern);if(!1===t[i].include){if(s)return!1}else r=!0,s&&(n=!0)}return n||!r},t.loadSDKVersion=function(){let e;try{e="1.6.2"}catch(t){e=""}return e},t.mergeQueryStrings=function(e,t){let r,n;try{r=new URL(e),n=new URL(t)}catch(e){return console.error(`Unable to merge query strings: ${e}`),t}return r.searchParams.forEach((e,t)=>{n.searchParams.has(t)||n.searchParams.set(t,e)}),n.toString()},t.paddedVersionString=function(e){"number"==typeof e&&(e+=""),e&&"string"==typeof e||(e="0");const t=e.replace(/(^v|\+.*$)/g,"").split(/[-.]/);return 3===t.length&&t.push("~"),t.map(e=>e.match(/^[0-9]+$/)?e.padStart(5," "):e).join("-")},t.promiseTimeout=async function(e,t){return new Promise(r=>{let n,i=!1;const s=e=>{i||(i=!0,n&&clearTimeout(n),r(e||null))};t&&(n=setTimeout(()=>s(),t)),e.then(e=>s(e)).catch(()=>s())})},t.toString=function(e){return"string"==typeof e?e:JSON.stringify(e)};const r={fetch:globalThis.fetch?globalThis.fetch.bind(globalThis):void 0,SubtleCrypto:globalThis.crypto?globalThis.crypto.subtle:void 0,EventSource:globalThis.EventSource};function n(e){let t=2166136261;const r=e.length;for(let n=0;n<r;n++)t^=e.charCodeAt(n),t+=(t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24);return t>>>0}function i(e,t,r){return 2===r?n(n(e+t)+"")%1e4/1e4:1===r?n(t+e)%1e3/1e3:null}function s(e){return e<=0?[]:new Array(e).fill(1/e)}function o(e,t){return e>=t[0]&&e<t[1]}function a(e){try{const t=e.replace(/([^\\])\//g,"$1\\/");return new RegExp(t)}catch(e){return void console.error(e)}}function l(e,t,r){try{const n=new URL(e,"https://_");if("regex"===t){const e=a(r);return!!e&&(e.test(n.href)||e.test(n.href.substring(n.origin.length)))}return"simple"===t&&function(e,t){try{const r=new URL(t.replace(/^([^:/?]*)\./i,"https://$1.").replace(/\*/g,"_____"),"https://_____"),n=[[e.host,r.host,!1],[e.pathname,r.pathname,!0]];return r.hash&&n.push([e.hash,r.hash,!1]),r.searchParams.forEach((t,r)=>{n.push([e.searchParams.get(r)||"",t,!1])}),!n.some(e=>!function(e,t,r){try{let n=t.replace(/[*.+?^${}()|[\]\\]/g,"\\$&").replace(/_____/g,".*");return r&&(n="\\/?"+n.replace(/(^\/|\/$)/g,"")+"\\/?"),new RegExp("^"+n+"$","i").test(e)}catch(e){return!1}}(e[0],e[1],e[2]))}catch(e){return!1}}(n,r)}catch(e){return!1}}const u=e=>Uint8Array.from(atob(e),e=>e.charCodeAt(0));function c(e){return"object"==typeof e&&null!==e}},140(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r="undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);t.default={randomUUID:r}},154(e,t){!function(e){"use strict";const t={real:"green.derivws.com",demo:"blue.derivws.com"},r={"deriv.app":"16929","app.deriv.com":"16929","staging-app.deriv.com":"16303","app.deriv.me":"1411","staging-app.deriv.me":"1411","app.deriv.be":"30767","staging-app.deriv.be":"31186","binary.com":"1","test-app.deriv.com":"51072","p2p.deriv.com":"61859","p2p.deriv.be":"71265","p2p.deriv.me":"71263","staging-p2p.deriv.com":"62019","api.deriv.com":"36544","staging-api.deriv.com":"36545","smarttrader.deriv.com":"22168","staging-smarttrader.deriv.com":"22169","staging-dbot.deriv.com":"29934","staging-dbot.deriv.me":"29934","staging-dbot.deriv.be":"29934","dbot.deriv.com":"65555","dbot.deriv.be":"65556","dbot.deriv.me":"65557"},n="deriv",i=Object.freeze(Object.defineProperty({__proto__:null,appBrand:n,domainAppId:r,environments:t},Symbol.toStringTag,{value:"Module"})),s={AAD:2,AED:2,AFN:2,ALL:2,AMD:2,ANG:2,AOA:2,ARS:2,AUD:2,AWG:2,AZN:2,BAM:2,BBD:2,BCH:8,BDT:2,BGN:2,BHD:3,BIF:0,BMD:2,BND:2,BOB:2,BOV:2,BRL:2,BSD:2,BTC:8,BTN:2,BUSD:2,BWP:2,BYN:2,BZD:2,CAD:2,CDF:2,CHE:2,CHF:2,CHW:2,CLF:4,CLP:0,CNY:2,COP:2,COU:2,CRC:2,CUC:2,CUP:2,CVE:2,CZK:2,DAI:2,DJF:0,DKK:2,DOP:2,DZD:2,EGP:2,ERN:2,ETB:2,ETC:8,ETH:8,EUR:2,EURS:2,eUSDT:2,FJD:2,FKP:2,GBP:2,GEL:2,GHS:2,GIP:2,GMD:2,GNF:0,GTQ:2,GYD:2,HKD:2,HNL:2,HRK:2,HTG:2,HUF:2,IDK:0,IDR:2,ILS:2,INR:2,IQD:3,IRR:2,ISK:0,JMD:2,JOD:3,JPY:0,KES:2,KGS:2,KHR:2,KMF:0,KPW:2,KRW:0,KWD:3,KYD:2,KZT:2,LAK:2,LBP:2,LKR:2,LRD:2,LSL:2,LTC:8,LYD:3,MAD:2,MDL:2,MGA:2,MKD:2,MMK:2,MNT:2,MOP:2,MRU:2,MUR:2,MVR:2,MWK:2,MXN:2,MXV:2,MYR:2,MZN:2,NAD:2,NGN:2,NIO:2,NOK:2,NPR:2,NZD:2,OMR:3,PAB:2,PAX:2,PEN:2,PGK:2,PHP:2,PKR:2,PLN:2,PYG:0,QAR:2,RON:2,RSD:2,RUB:2,RWF:0,SAR:2,SBD:2,SCR:2,SDG:2,SEK:2,SGD:2,SHP:2,SLL:2,SOS:2,SRD:2,SSP:2,STN:2,SVC:2,SYP:2,SZL:2,THB:2,TJS:2,TMT:2,TND:3,TOP:2,TRY:2,TTD:2,TUSD:2,tUSDT:2,TWD:2,TZS:2,UAH:2,UGX:0,USB:2,USD:2,USDC:2,USDK:2,UST:2,USN:2,UYI:0,UYU:2,UYW:4,UZS:2,VES:2,VND:0,VUV:0,WST:2,XAF:0,XCD:2,XOF:0,XPF:0,YER:2,ZAR:2,ZMW:2,ZWL:2},o=Object.freeze(Object.defineProperty({__proto__:null,precision:s},Symbol.toStringTag,{value:"Module"})),a=["PNG","JPG","JPEG","GIF","PDF"],l=Object.freeze(Object.defineProperty({__proto__:null,supportedDocumentFormats:a},Symbol.toStringTag,{value:"Module"})),u="client.active_loginid",c="config.app_id",d="config.server_url",h="i18n_language",g=Object.freeze(Object.defineProperty({__proto__:null,accountList:"client.account_list",activeLoginid:u,configAppId:c,configServerURL:d,i18nLanguage:h,lastVerifyEmail:"client.verify_email",p2pArchiveMessage:"should_not_show_auto_archive_message_again",p2pOrderIds:"order_ids",p2pShowFollowUserGuide:"should_show_p2p_follow_user_guide",p2pShowGuide:"should_show_p2p_guide",traderLayout:"trader.layout",uiExpandAccountSwitcher:"ui.expand_account_switcher",uiShowReportsDrawer:"ui.show_report_drawer",uiTheme:"ui.theme"},Symbol.toStringTag,{value:"Module"})),f="deriv.com",p="deriv.me",v="deriv.be",y=[f,v,p],m=typeof window<"u"&&window.location.hostname.split("app.")[1],b=y.includes(m)?m:f,k=`https://bot.${b}`,S=`https://staging-bot.${b}`,_=`https://app.${b}`,w=`https://staging-app.${b}`,A=`https://${b}`,E=`https://eu.${b}`,I=`https://staging.${b}`,C=b,T=`https://smarttrader.${b}`,O=`https://staging-smarttrader.${b}`,P=`https://p2p.${b}`,D=`https://staging-p2p.${b}`,x="https://cloudflare.com/cdn-cgi/trace",R=Object.freeze(Object.defineProperty({__proto__:null,baseDomain:m,binaryBotProduction:k,binaryBotStaging:S,cloudflareTrace:x,deriv:f,derivAppProduction:_,derivAppStaging:w,derivBe:v,derivComProduction:A,derivComProductionEU:E,derivComStaging:I,derivHost:C,derivMe:p,derivP2pProduction:P,derivP2pStaging:D,domain:b,queryParameters:{lang:"lang",action:"action"},smartTraderProduction:T,smartTraderStaging:O,supportedDomains:y,whatsApp:"https://wa.me/35699578341"},Symbol.toStringTag,{value:"Module"})),B={address:/^[\p{L}\p{Nd}\s'’.,:;()\\x{b0}@#/-]{0,70}$/u,addressCity:new RegExp("^\\p{L}[\\p{L}\\s'.-]{0,49}$","u"),addressState:/^[\p{L}\p{Nd}\s'.,;\-\[\]\(\)]{0,100}$/u,barrier:/^(?=.{1,20}$)[+-]?[0-9]+\.?[0-9]*$/,decimal:/^\d*(\.\d+)?$/,integer:/^\d+$/,postalOfficeBoxNumber:/p[.\s]+o[.\s]+box/i,email:/^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,63}$/,password:/^(?=.*[a-z])(?=.*\d)(?=.*[A-Z])[!-~]{8,25}$/,affilliatePassword:/^(?=.*[a-z])(?=.*[0-9])(?=.*[A-Z])[ -~]{6,50}$/,paymentAgentEmail:/^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{1,255}$/,postalCode:/^([A-Za-z0-9][A-Za-z0-9\s-]{0,20})?$/,taxIdentificationNumber:/^(?!^$|\s+)[A-Za-z0-9.\/\s-]{0,25}$/,phoneNumber:/^\+((-|\s)*[0-9]){9,20}$/,fileType:/(image|application)\/(jpe?g|pdf|png)$/,formattedCardNumber:/(^\d{4})\s(\d{2}X{2})\s(X{4})\s(\d{4}$)/,invalidFormattedCardNumberCharacters:/[^\dX\s]/,tradingPlatformInvestorPassword:/^(?=.*[a-z])(?=.*[0-9])(?=.*[A-Z])(?=.*[!@#$%^&*()+\-=\[\]{};':\"|,\.<>\?_~])[ -~]{8,16}$/,letterSymbols:/^[A-Za-z]+([a-zA-Z.' -])*[a-zA-Z.' -]+$/,name:/^(?!.*\s{2,})(?!\s)[\p{L}\s'.-]{1,50}$/u,general:/[`~!@#$%^&*)(_=+[}{\]\\/";:?><|]+/,lowercase:/[a-z]/,number:/\d/,specialCharacter:/\W/,uppercase:/[A-Z]/,between8and16Characters:/^.{8,16}$/,between8and25Characters:/^.{8,25}$/},$=Object.freeze(Object.defineProperty({__proto__:null,messagesHints:{addressPermittedSpecialCharacters:". , ' : ; ( ) ° @ # / -"},patterns:B},Symbol.toStringTag,{value:"Module"})),M={brandName:"Deriv",domainName:"Deriv.com"},N={fx:"Deriv (FX) Ltd",maltainvest:"Deriv Investments (Europe) Limited",svg:"Deriv (SVG) LLC",v:"Deriv (V) Ltd"},L={trader:"Deriv Trader",dBot:"Deriv Bot",mt5:"Deriv MT5",cTrader:"Deriv cTrader",derivX:"Deriv X",smartTrader:"SmartTrader",bBot:"Binary Bot",go:"Deriv GO"},U=Object.freeze(Object.defineProperty({__proto__:null,brandConfig:M,landingCompanies:N,platforms:L},Symbol.toStringTag,{value:"Module"})),j=/(ALP-|AMN-|ANA-|ANE-|ANG-|AQM-|ARS-|ART-|ATU-|BAC-|BLA-|BRQ-|CAG-|CAM-|CAN-|CAZ-|CDL-|CDY-|CLT-|CRO-|CUN-|DIG-|DRA-|DUA-|DUB-|DVC-|ELE-|ELS-|EML-|EVA-|EVR-|FIG-|FLA-|FRL-|GLK-|HMA-|HW-|HWI-|INE-|JAT-|JEF-|JER-|JKM-|JNY-|JSC-|LDN-|LIO-|LON-|LUA-|LYA-|LYO-|MAR-|MED-|MHA-|MLA-|MRD-|MYA-|NCE-|NEO-|NOH-|NOP-|OCE-|PAR-|PIC-|POT-|PPA-|PRA-|RNE-|SEA-|SLA-|SNE-|SPN-|STK-|TAH-|TAS-|TET-|TRT-|VCE-|VIE-|VKY-|VNS-|VOG-|VTR-|WAS-|WKG-|WLZ-|JAD-|MLD-|RTE-|NAM-|NEN-|BAL-|JLN-|YAL-|MGA-|FGD-|XYAO-|BON-|ALN-|ALT-|BRA-|DBY2-|STG-|MAO-|LEM-|GOA-|FOA-|MNA-|LNA-)/,V=Object.freeze(Object.defineProperty({__proto__:null,huaweiDevicesRegex:j},Symbol.toStringTag,{value:"Module"})),F=Object.freeze(Object.defineProperty({__proto__:null,formatMoney:(e,t)=>{try{const{locale:r="en-US",currency:n,decimalPlaces:i}=t||{},o=i||s[n??"USD"];return new Intl.NumberFormat(r,{minimumFractionDigits:o,maximumFractionDigits:o}).format(e)}catch{return e.toString()}},getAdjustedDate:(e,t="days",r="add")=>{if(e<0)throw new Error("Amount must be a positive number.");const n=new Date,i="add"===r?e:-e;return"years"===t?n.setFullYear(n.getFullYear()+i):"days"===t&&n.setDate(n.getDate()+i),n},getFormattedDateString:(e,t)=>{let r;const{dateOptions:n={day:"2-digit",month:"2-digit",year:"numeric"},format:i="YYYY-MM-DD",unix:s=!1}=t||{},o={...n};if("number"==typeof e&&s)r=new Date(1e3*e);else{if(!("string"==typeof e||e instanceof Date))throw new Error("Invalid date input");if(r=new Date(e),isNaN(r.getTime()))throw new Error("Invalid date input")}switch(i){case"DD MMM YYYY":o.day="2-digit",o.month="short",o.year="numeric";break;case"MMM DD YYYY":return o.day="2-digit",o.month="short",o.year="numeric",r.toLocaleDateString("en-GB",o).replace(/(\d{2}) (\w{3}) (\d{4})/,"$2 $1 $3");case"DD-MM-YYYY":return o.day="2-digit",o.month="2-digit",o.year="numeric",r.toLocaleDateString("en-GB",o).replace(/(\d{2})\/(\d{2})\/(\d{4})/,"$1-$2-$3");default:o.year="numeric",o.month="2-digit",o.day="2-digit"}const a=r.toLocaleDateString("en-GB",o).replace(/(\d{2}) (\w{3,4}) (\d{4})/,(e,t,r,n)=>`${t} ${r.slice(0,3)} ${n}`);return"YYYY-MM-DD"===i?a.replace(/(\d{2})\/(\d{2})\/(\d{4})/,"$3-$2-$1"):a},getFormattedTimeString:(e,t=!1)=>{let r;if("number"==typeof e&&t)r=new Date(1e3*e);else{if(!("string"==typeof e||e instanceof Date))throw new Error("Invalid date input");if(r=new Date(e),isNaN(r.getTime()))throw new Error("Invalid date input")}return`${r.getUTCHours().toString().padStart(2,"0")}:${r.getUTCMinutes().toString().padStart(2,"0")}:${r.getUTCSeconds().toString().padStart(2,"0")} GMT`},parseCryptoLongcode:e=>{const t=e.split(/,\s/),r=/:\s([0-9a-zA-Z]+.{25,28})/gm.exec(t[0])?.[1],n=/:\s([0-9a-zA-Z]+.{25,34})/gm.exec(t[1])?.[1];return{addressHash:r,blockchainHash:n,splitLongcode:t}}},Symbol.toStringTag,{value:"Module"})),H=2560,G=.9,K=({src:e,filename:t,options:r})=>{const{maxWidth:n=H,quality:i=G}=r||{};return new Promise((r,s)=>{const o=new Image;o.src=e,o.onload=()=>{const e=document.createElement("canvas"),a=e.getContext("2d");if(!(a&&a instanceof CanvasRenderingContext2D))return s(new Error("Failed to get 2D context"));if(o.naturalWidth>n){const t=H,r=t/o.naturalWidth;e.width=t,e.height=o.naturalHeight*r}else e.width=o.naturalWidth,e.height=o.naturalHeight;a.fillStyle="transparent",a.fillRect(0,0,e.width,e.height),a.save(),a.drawImage(o,0,0,e.width,e.height),e.toBlob(e=>{if(!e)return;const n=t.replace(/\.[^/.]+$/,".jpg"),i=new Blob([e],{type:"image/jpeg"});i.lastModifiedDate=Date.now(),i.name=n,r(i)},"image/jpeg",i)}})},z=e=>new Promise(t=>{const r=new FileReader;r.readAsDataURL(e),r.onloadend=()=>{t({src:r.result?.toString()||"",filename:e.name})}}),J=e=>!!e&&a.some(t=>e.toUpperCase().endsWith(t));const q=Object.freeze(Object.defineProperty({__proto__:null,compressImage:K,compressImageFile:e=>new Promise(t=>{J(e.name)?z(e).then(e=>{K(e).then(t)}):t(e)}),convertToBase64:z,generateChunks:(e,{chunkSize:t=16384})=>{const r=[];for(let n=0;n<e.length;n++){const i=e[n];n%t===0?r.push([i]):r[r.length-1].push(i)}return r.map(e=>new Uint8Array(e)).concat(new Uint8Array([]))},isSupportedImageFormat:J,numToUint8Array:function(e,t=4){const r=new Uint8Array(t);return new DataView(r.buffer).setUint32(0,e),r},readFile:e=>{const t=new FileReader;return new Promise(r=>{t.onload=()=>{const n={filename:e.name,buffer:t.result,fileSize:e.size};r(n)},t.onerror=()=>{r({message:`Unable to read file ${e.name}`})},t.readAsArrayBuffer(e)})}},Symbol.toStringTag,{value:"Module"})),W=e=>{const t=localStorage.getItem(e);if("undefined"!==t){if(null===t||"null"===t)return null;try{return JSON.parse(t)}catch{return null}}},Q=Object.freeze(Object.defineProperty({__proto__:null,getValue:W,setValue:(e,t)=>{localStorage.setItem(e,JSON.stringify(t))}},Symbol.toStringTag,{value:"Module"})),Z=e=>Object.keys(e).sort().reduce((t,r)=>(t[r]=e[r],t),{}),Y=(e,t)=>Array.isArray(e)&&Array.isArray(t)?t.map((t,r)=>Y(e[r],t)):"object"==typeof e&&null!==e&&"object"==typeof t&&null!==t?X(e,t):t,X=(e,...t)=>{for(const r of t)for(const t in r)null===r[t]||void 0===r[t]||(e[t]=Y(e[t],r[t]));return e},ee=Object.freeze(Object.defineProperty({__proto__:null,hashObject:async e=>{const t=(new TextEncoder).encode(JSON.stringify(Z(e))),r=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(r)).map(e=>("00"+e.toString(16)).slice(-2)).join("")},merge:X,sortObjectByKeys:Z},Symbol.toStringTag,{value:"Module"}));const te=Object.freeze(Object.defineProperty({__proto__:null,createPromise:function(){let e,t;return{promise:new Promise((r,n)=>{e=r,t=n}),resolve:e,reject:t}}},Symbol.toStringTag,{value:"Module"})),re=()=>{const e=new URLSearchParams(window.location.search).get("acct1");return W(u)||e},ne=e=>e&&!/^VR/.test(e)?"real":"demo",ie=()=>{const e=W(c);if(e)return e;const t=window.location.hostname;return r[t]||"36300"},se=Object.freeze(Object.defineProperty({__proto__:null,getActiveLoginid:re,getAppId:ie,getEnvironmentFromLoginid:ne},Symbol.toStringTag,{value:"Module"})),oe=()=>{const e=W(d);if(e)return e;const r=re();return t[ne(r)]},ae=e=>e.replace(/(^\/|\/$|[^a-zA-Z0-9-_./()#])/g,""),le=Object.freeze(Object.defineProperty({__proto__:null,filterSearchParams:e=>{const t=new URLSearchParams(window.location.search);e.forEach(e=>t.delete(e));const r=`${window.location.pathname}${t.toString()?`?${t.toString()}`:""}`;window.history.pushState(null,"",r)},getDefaultActiveAccount:e=>{if(e?.length)return e.find(e=>/^VR/.test(e.loginid))||e[0]},getDerivStaticURL:(e,t)=>{const r=t?.isEU?E:A;let n=W(h)?.toLowerCase()??"en";return n="en"===n?"":`/${n.replace("_","-")}`,t?.isDocument?`${r}/${ae(e)}`:`${r}${n}/${ae(e)}`},getLoginInfoFromURL:()=>{const e=[],t=[],r=new URLSearchParams(window.location.search);for(const[n,i]of r.entries()){const r=n.match(/^acct(\d+)/),s=n.match(/^token(\d+)/),o=n.match(/^cur(\d+)/);r&&(e[+r[1]-1]={...e[+r[1]-1]||{},loginid:i}),s&&(e[+s[1]-1]={...e[+s[1]-1]||{},token:i}),o&&(e[+o[1]-1]={...e[+o[1]-1]||{},currency:i}),(/acct/.test(n)||/token/.test(n)||/cur/.test(n))&&t.push(n)}return{loginInfo:e.filter(e=>["loginid","token","currency"].every(t=>Object.keys(e).includes(t))),paramsToDelete:t}},getOauthURL:()=>{const e=W(h)??"EN";return`https://oauth.deriv.com/oauth2/authorize?app_id=${ie()}&l=${e}&brand=${n}`},getQueryParameter:e=>new URLSearchParams(window.location.search).get(e),getServerURL:oe,getWebsocketURL:()=>{const e=oe(),t=W(h)??"EN";return`wss://${e}/websockets/v3?app_id=${ie()}&l=${t}&brand=${n}`},isDomainAllowed:e=>/^(((.*)\.)?(localhost:8443|pages.dev|binary\.(sx|com)|deriv.(com|me|be|dev)))$/.test(e),normalizePath:ae},Symbol.toStringTag,{value:"Module"})),ue=Object.freeze(Object.defineProperty({__proto__:null,getBrandWebsiteName:()=>M.domainName,getLegalLandingCompany:e=>N[e],getPlatformName:e=>L[e]},Symbol.toStringTag,{value:"Module"})),ce=e=>j.test(e),de=Object.freeze(Object.defineProperty({__proto__:null,mobileOSDetectAsync:async()=>{const e=window,t=navigator,r=t.userAgent??e.opera??"";if(/windows phone/i.test(r))return"Windows Phone";if(/android/i.test(r)){if(t.userAgentData){const e=await t.userAgentData.getHighEntropyValues(["model"]);if(ce(e?.model||""))return"huawei"}else if(ce(r)||/huawei/i.test(r))return"huawei";return"Android"}return/iPad|iPhone|iPod/.test(r)&&!e.MSStream?"iOS":"unknown"}},Symbol.toStringTag,{value:"Module"}));function he(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)e[n]=r[n]}return e}var ge=function e(t,r){function n(e,n,i){if(!(typeof document>"u")){"number"==typeof(i=he({},r,i)).expires&&(i.expires=new Date(Date.now()+864e5*i.expires)),i.expires&&(i.expires=i.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var s="";for(var o in i)i[o]&&(s+="; "+o,!0!==i[o]&&(s+="="+i[o].split(";")[0]));return document.cookie=e+"="+t.write(n,e)+s}}return Object.create({set:n,get:function(e){if(!(typeof document>"u"||arguments.length&&!e)){for(var r=document.cookie?document.cookie.split("; "):[],n={},i=0;i<r.length;i++){var s=r[i].split("="),o=s.slice(1).join("=");try{var a=decodeURIComponent(s[0]);if(n[a]=t.read(o,a),e===a)break}catch{}}return e?n[e]:n}},remove:function(e,t){n(e,"",he({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,he({},this.attributes,t))},withConverter:function(t){return e(he({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(r)},converter:{value:Object.freeze(t)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"});let fe=null;const pe=Object.freeze(Object.defineProperty({__proto__:null,getCountry:async()=>{if(fe)return fe;const e=JSON.parse(ge.get("website_status")||"{}")?.clients_country;return fe=(async()=>{try{const t=await fetch(x).catch(()=>null);if(!t)return e||"";const r=await t.text().catch(()=>"");return r?Object.fromEntries(r.split("\n").map(e=>e.split("=",2))).loc?.toLowerCase()||e||"":e||""}catch{return e||""}})(),fe}},Symbol.toStringTag,{value:"Module"}));e.AppIDConstants=i,e.BrandConstants=U,e.BrandUtils=ue,e.CountryUtils=pe,e.CurrencyConstants=o,e.DocumentConstants=l,e.FormatUtils=F,e.ImageUtils=q,e.LocalStorageConstants=g,e.LocalStorageUtils=Q,e.MobileDevicesConstants=V,e.OSDetectionUtils=de,e.ObjectUtils=ee,e.PromiseUtils=te,e.URLConstants=R,e.URLUtils=le,e.ValidationConstants=$,e.WebSocketUtils=se,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}(t)},186(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=s(r(25)),i=s(r(42));function s(e){return e&&e.__esModule?e:{default:e}}var o=(0,n.default)("v5",80,i.default);t.default=o},200(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"BrowserCookieStickyBucketService",{enumerable:!0,get:function(){return o.BrowserCookieStickyBucketService}}),Object.defineProperty(t,"EVENT_EXPERIMENT_VIEWED",{enumerable:!0,get:function(){return u.EVENT_EXPERIMENT_VIEWED}}),Object.defineProperty(t,"EVENT_FEATURE_EVALUATED",{enumerable:!0,get:function(){return u.EVENT_FEATURE_EVALUATED}}),Object.defineProperty(t,"ExpressCookieStickyBucketService",{enumerable:!0,get:function(){return o.ExpressCookieStickyBucketService}}),Object.defineProperty(t,"GrowthBook",{enumerable:!0,get:function(){return i.GrowthBook}}),Object.defineProperty(t,"GrowthBookClient",{enumerable:!0,get:function(){return s.GrowthBookClient}}),Object.defineProperty(t,"GrowthBookMultiUser",{enumerable:!0,get:function(){return s.GrowthBookClient}}),Object.defineProperty(t,"LocalStorageStickyBucketService",{enumerable:!0,get:function(){return o.LocalStorageStickyBucketService}}),Object.defineProperty(t,"RedisStickyBucketService",{enumerable:!0,get:function(){return o.RedisStickyBucketService}}),Object.defineProperty(t,"StickyBucketService",{enumerable:!0,get:function(){return o.StickyBucketService}}),Object.defineProperty(t,"StickyBucketServiceSync",{enumerable:!0,get:function(){return o.StickyBucketServiceSync}}),Object.defineProperty(t,"UserScopedGrowthBook",{enumerable:!0,get:function(){return s.UserScopedGrowthBook}}),Object.defineProperty(t,"clearCache",{enumerable:!0,get:function(){return n.clearCache}}),Object.defineProperty(t,"configureCache",{enumerable:!0,get:function(){return n.configureCache}}),Object.defineProperty(t,"evalCondition",{enumerable:!0,get:function(){return a.evalCondition}}),Object.defineProperty(t,"getAutoExperimentChangeType",{enumerable:!0,get:function(){return l.getAutoExperimentChangeType}}),Object.defineProperty(t,"getPolyfills",{enumerable:!0,get:function(){return l.getPolyfills}}),Object.defineProperty(t,"helpers",{enumerable:!0,get:function(){return n.helpers}}),Object.defineProperty(t,"isURLTargeted",{enumerable:!0,get:function(){return l.isURLTargeted}}),Object.defineProperty(t,"onHidden",{enumerable:!0,get:function(){return n.onHidden}}),Object.defineProperty(t,"onVisible",{enumerable:!0,get:function(){return n.onVisible}}),Object.defineProperty(t,"paddedVersionString",{enumerable:!0,get:function(){return l.paddedVersionString}}),Object.defineProperty(t,"prefetchPayload",{enumerable:!0,get:function(){return i.prefetchPayload}}),Object.defineProperty(t,"setPolyfills",{enumerable:!0,get:function(){return n.setPolyfills}});var n=r(707),i=r(328),s=r(555),o=r(350),a=r(427),l=r(106),u=r(569)},213(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.default="ffffffff-ffff-ffff-ffff-ffffffffffff"},311(e,t){"use strict";function r(e){return 14+(e+64>>>9<<4)+1}function n(e,t){var r=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(r>>16)<<16|65535&r}function i(e,t,r,i,s,o){return n((a=n(n(t,e),n(i,o)))<<(l=s)|a>>>32-l,r);var a,l}function s(e,t,r,n,s,o,a){return i(t&r|~t&n,e,t,s,o,a)}function o(e,t,r,n,s,o,a){return i(t&n|r&~n,e,t,s,o,a)}function a(e,t,r,n,s,o,a){return i(t^r^n,e,t,s,o,a)}function l(e,t,r,n,s,o,a){return i(r^(t|~n),e,t,s,o,a)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.default=function(e){if("string"==typeof e){var t=unescape(encodeURIComponent(e));e=new Uint8Array(t.length);for(var i=0;i<t.length;++i)e[i]=t.charCodeAt(i)}return function(e){for(var t=[],r=32*e.length,n="0123456789abcdef",i=0;i<r;i+=8){var s=e[i>>5]>>>i%32&255,o=parseInt(n.charAt(s>>>4&15)+n.charAt(15&s),16);t.push(o)}return t}(function(e,t){e[t>>5]|=128<<t%32,e[r(t)-1]=t;for(var i=1732584193,u=-271733879,c=-1732584194,d=271733878,h=0;h<e.length;h+=16){var g=i,f=u,p=c,v=d;i=s(i,u,c,d,e[h],7,-680876936),d=s(d,i,u,c,e[h+1],12,-389564586),c=s(c,d,i,u,e[h+2],17,606105819),u=s(u,c,d,i,e[h+3],22,-1044525330),i=s(i,u,c,d,e[h+4],7,-176418897),d=s(d,i,u,c,e[h+5],12,1200080426),c=s(c,d,i,u,e[h+6],17,-1473231341),u=s(u,c,d,i,e[h+7],22,-45705983),i=s(i,u,c,d,e[h+8],7,1770035416),d=s(d,i,u,c,e[h+9],12,-1958414417),c=s(c,d,i,u,e[h+10],17,-42063),u=s(u,c,d,i,e[h+11],22,-1990404162),i=s(i,u,c,d,e[h+12],7,1804603682),d=s(d,i,u,c,e[h+13],12,-40341101),c=s(c,d,i,u,e[h+14],17,-1502002290),i=o(i,u=s(u,c,d,i,e[h+15],22,1236535329),c,d,e[h+1],5,-165796510),d=o(d,i,u,c,e[h+6],9,-1069501632),c=o(c,d,i,u,e[h+11],14,643717713),u=o(u,c,d,i,e[h],20,-373897302),i=o(i,u,c,d,e[h+5],5,-701558691),d=o(d,i,u,c,e[h+10],9,38016083),c=o(c,d,i,u,e[h+15],14,-660478335),u=o(u,c,d,i,e[h+4],20,-405537848),i=o(i,u,c,d,e[h+9],5,568446438),d=o(d,i,u,c,e[h+14],9,-1019803690),c=o(c,d,i,u,e[h+3],14,-187363961),u=o(u,c,d,i,e[h+8],20,1163531501),i=o(i,u,c,d,e[h+13],5,-1444681467),d=o(d,i,u,c,e[h+2],9,-51403784),c=o(c,d,i,u,e[h+7],14,1735328473),i=a(i,u=o(u,c,d,i,e[h+12],20,-1926607734),c,d,e[h+5],4,-378558),d=a(d,i,u,c,e[h+8],11,-2022574463),c=a(c,d,i,u,e[h+11],16,1839030562),u=a(u,c,d,i,e[h+14],23,-35309556),i=a(i,u,c,d,e[h+1],4,-1530992060),d=a(d,i,u,c,e[h+4],11,1272893353),c=a(c,d,i,u,e[h+7],16,-155497632),u=a(u,c,d,i,e[h+10],23,-1094730640),i=a(i,u,c,d,e[h+13],4,681279174),d=a(d,i,u,c,e[h],11,-358537222),c=a(c,d,i,u,e[h+3],16,-722521979),u=a(u,c,d,i,e[h+6],23,76029189),i=a(i,u,c,d,e[h+9],4,-640364487),d=a(d,i,u,c,e[h+12],11,-421815835),c=a(c,d,i,u,e[h+15],16,530742520),i=l(i,u=a(u,c,d,i,e[h+2],23,-995338651),c,d,e[h],6,-198630844),d=l(d,i,u,c,e[h+7],10,1126891415),c=l(c,d,i,u,e[h+14],15,-1416354905),u=l(u,c,d,i,e[h+5],21,-57434055),i=l(i,u,c,d,e[h+12],6,1700485571),d=l(d,i,u,c,e[h+3],10,-1894986606),c=l(c,d,i,u,e[h+10],15,-1051523),u=l(u,c,d,i,e[h+1],21,-2054922799),i=l(i,u,c,d,e[h+8],6,1873313359),d=l(d,i,u,c,e[h+15],10,-30611744),c=l(c,d,i,u,e[h+6],15,-1560198380),u=l(u,c,d,i,e[h+13],21,1309151649),i=l(i,u,c,d,e[h+4],6,-145523070),d=l(d,i,u,c,e[h+11],10,-1120210379),c=l(c,d,i,u,e[h+2],15,718787259),u=l(u,c,d,i,e[h+9],21,-343485551),i=n(i,g),u=n(u,f),c=n(c,p),d=n(d,v)}return[i,u,c,d]}(function(e){if(0===e.length)return[];for(var t=8*e.length,n=new Uint32Array(r(t)),i=0;i<t;i+=8)n[i>>5]|=(255&e[i/8])<<i%32;return n}(e),8*e.length))}},316(e,t,r){"use strict";var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},n.apply(this,arguments)},i=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})},s=this&&this.__generator||function(e,t){var r,n,i,s,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(l){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,n=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],n=0}finally{r=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.Growthbook=void 0;var o=r(200),a=r(720),l=function(){function e(e,t,r){void 0===r&&(r={});var l=this;this.analytics=new a.RudderAnalytics,this.isLoaded=!1,this.status=void 0,this.setAttributes=function(e){var t=e.id,r=e.country,i=e.user_language,s=e.device_language,o=e.device_type,a=e.utm_source,u=e.utm_medium,c=e.utm_campaign,d=e.is_authorised,h=e.url,g=e.domain,f=e.utm_content,p=e.residence_country,v=e.loggedIn,y=e.network_type,m=e.network_downlink,b=e.user_id,k=e.anonymous_id,S=e.account_mode,_=l.GrowthBook.getAttributes();l.GrowthBook.setAttributes(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n({},_),{id:t}),void 0!==b&&{user_id:b}),void 0!==k&&{anonymous_id:k}),void 0!==r&&{country:r}),void 0!==p&&{residence_country:p}),void 0!==i&&{user_language:i}),void 0!==s&&{device_language:s}),void 0!==o&&{device_type:o}),void 0!==a&&{utm_source:a}),void 0!==u&&{utm_medium:u}),void 0!==c&&{utm_campaign:c}),void 0!==d&&{is_authorised:d}),void 0!==h&&{url:h}),void 0!==g&&{domain:g}),void 0!==f&&{utm_content:f}),void 0!==v&&{loggedIn:v}),void 0!==y&&{network_type:y}),void 0!==m&&{network_downlink:m}),void 0!==S&&{account_mode:S}))},this.getFeatureValue=function(e,t){return l.GrowthBook.getFeatureValue(e,t)},this.getStatus=function(){return i(l,void 0,void 0,function(){return s(this,function(e){switch(e.label){case 0:return[4,this.waitForIsLoaded()];case 1:return e.sent(),[2,{isLoaded:this.isLoaded,status:this.status}]}})})},this.getFeatureState=function(e){return l.GrowthBook.evalFeature(e)},this.setUrl=function(e){return l.GrowthBook.setURL(e)},this.isOn=function(e){return l.GrowthBook.isOn(e)},this.init=function(){return i(l,void 0,void 0,function(){var e;return s(this,function(t){switch(t.label){case 0:return[4,this.GrowthBook.init({timeout:2e3,streaming:!0}).catch(function(e){console.error(e)})];case 1:return e=t.sent(),this.status=e,this.isLoaded=!0,[2]}})})},this.GrowthBook=new o.GrowthBook(n({apiHost:"https://cdn.growthbook.io",clientKey:e,decryptionKey:t,antiFlicker:!1,navigateDelay:0,antiFlickerTimeout:3500,subscribeToChanges:!0,enableDevMode:null===window||void 0===window?void 0:window.location.hostname.includes("localhost"),trackingCallback:function(e,t){window.dataLayer&&window.dataLayer.push({event:"experiment_viewed",event_category:"experiment",rudder_anonymous_id:l.analytics.getAnonymousId(),experiment_id:e.key,variation_id:t.variationId}),l.analytics.track("experiment_viewed",{experimentId:e.key,variationId:t.variationId})}},r)),this.init()}return e.prototype.reapplyExperiment=function(e){var t=null!=e?e:window.location.href;this.GrowthBook.setURL(t),console.log("Route changed, new URL:",t)},e.prototype.waitForIsLoaded=function(){var e=this;return new Promise(function(t){var r=setInterval(function(){e.isLoaded&&(clearInterval(r),t())},100)})},e.getGrowthBookInstance=function(t,r,n){return e._instance||(e._instance=new e(t,null!=r?r:"",n)),e._instance},e}();t.Growthbook=l},328(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GrowthBook=void 0,t.prefetchPayload=async function(e){const t=new c(e);await(0,o.refreshFeatures)({instance:t,skipCache:e.skipCache,allowStale:!1,backgroundSync:e.streaming}),t.destroy()};var n,i=(n=r(591))&&n.__esModule?n:{default:n},s=r(106),o=r(707),a=r(569);const l="undefined"!=typeof window&&"undefined"!=typeof document,u=(0,s.loadSDKVersion)();class c{constructor(e){if(e=e||{},this.version=u,this._options=this.context=e,this._renderer=e.renderer||null,this._trackedExperiments=new Set,this._completedChangeIds=new Set,this._trackedFeatures={},this.debug=!!e.debug,this._subscriptions=new Set,this.ready=!1,this._assigned=new Map,this._activeAutoExperiments=new Map,this._triggeredExpKeys=new Set,this._initialized=!1,this._redirectedUrl="",this._deferredTrackingCalls=new Map,this._autoExperimentsAllowed=!e.disableExperimentsOnLoad,this._destroyCallbacks=[],this.logs=[],this.log=this.log.bind(this),this._saveDeferredTrack=this._saveDeferredTrack.bind(this),this._onExperimentEval=this._onExperimentEval.bind(this),this._fireSubscriptions=this._fireSubscriptions.bind(this),this._recordChangedId=this._recordChangedId.bind(this),e.remoteEval){if(e.decryptionKey)throw new Error("Encryption is not available for remoteEval");if(!e.clientKey)throw new Error("Missing clientKey");let t=!1;try{t=!!new URL(e.apiHost||"").hostname.match(/growthbook\.io$/i)}catch(e){}if(t)throw new Error("Cannot use remoteEval on GrowthBook Cloud")}else if(e.cacheKeyAttributes)throw new Error("cacheKeyAttributes are only used for remoteEval");if(e.stickyBucketService){const t=e.stickyBucketService;this._saveStickyBucketAssignmentDoc=e=>t.saveAssignments(e)}if(e.plugins)for(const t of e.plugins)t(this);if(e.features&&(this.ready=!0),l&&e.enableDevMode&&(window._growthbook=this,document.dispatchEvent(new Event("gbloaded"))),e.experiments&&(this.ready=!0,this._updateAllAutoExperiments()),this._options.stickyBucketService&&this._options.stickyBucketAssignmentDocs)for(const e in this._options.stickyBucketAssignmentDocs){const t=this._options.stickyBucketAssignmentDocs[e];t&&this._options.stickyBucketService.saveAssignments(t).catch(()=>{})}this.ready&&this.refreshStickyBuckets(this.getPayload())}async setPayload(e){this._payload=e;const t=await(0,a.decryptPayload)(e,this._options.decryptionKey);this._decryptedPayload=t,await this.refreshStickyBuckets(t),t.features&&(this._options.features=t.features),t.savedGroups&&(this._options.savedGroups=t.savedGroups),t.experiments&&(this._options.experiments=t.experiments,this._updateAllAutoExperiments()),this.ready=!0,this._render()}initSync(e){this._initialized=!0;const t=e.payload;if(t.encryptedExperiments||t.encryptedFeatures)throw new Error("initSync does not support encrypted payloads");return this._options.stickyBucketService&&!this._options.stickyBucketAssignmentDocs&&(this._options.stickyBucketAssignmentDocs=this.generateStickyBucketAssignmentDocsSync(this._options.stickyBucketService,t)),this._payload=t,this._decryptedPayload=t,t.features&&(this._options.features=t.features),t.experiments&&(this._options.experiments=t.experiments,this._updateAllAutoExperiments()),this.ready=!0,(0,o.startStreaming)(this,e),this}async init(e){if(this._initialized=!0,(e=e||{}).cacheSettings&&(0,o.configureCache)(e.cacheSettings),e.payload)return await this.setPayload(e.payload),(0,o.startStreaming)(this,e),{success:!0,source:"init"};{const{data:t,...r}=await this._refresh({...e,allowStale:!0});return(0,o.startStreaming)(this,e),await this.setPayload(t||{}),r}}async loadFeatures(e){e=e||{},await this.init({skipCache:e.skipCache,timeout:e.timeout,streaming:(this._options.backgroundSync??!0)&&(e.autoRefresh||this._options.subscribeToChanges)})}async refreshFeatures(e){const t=await this._refresh({...e||{},allowStale:!1});t.data&&await this.setPayload(t.data)}getApiInfo(){return[this.getApiHosts().apiHost,this.getClientKey()]}getApiHosts(){return(0,a.getApiHosts)(this._options)}getClientKey(){return this._options.clientKey||""}getPayload(){return this._payload||{features:this.getFeatures(),experiments:this.getExperiments()}}getDecryptedPayload(){return this._decryptedPayload||this.getPayload()}isRemoteEval(){return this._options.remoteEval||!1}getCacheKeyAttributes(){return this._options.cacheKeyAttributes}async _refresh(e){let{timeout:t,skipCache:r,allowStale:n,streaming:i}=e;if(!this._options.clientKey)throw new Error("Missing clientKey");return(0,o.refreshFeatures)({instance:this,timeout:t,skipCache:r||this._options.disableCache,allowStale:n,backgroundSync:i??this._options.backgroundSync??!0})}_render(){if(this._renderer)try{this._renderer()}catch(e){console.error("Failed to render",e)}}setFeatures(e){this._options.features=e,this.ready=!0,this._render()}async setEncryptedFeatures(e,t,r){const n=await(0,s.decrypt)(e,t||this._options.decryptionKey,r);this.setFeatures(JSON.parse(n))}setExperiments(e){this._options.experiments=e,this.ready=!0,this._updateAllAutoExperiments()}async setEncryptedExperiments(e,t,r){const n=await(0,s.decrypt)(e,t||this._options.decryptionKey,r);this.setExperiments(JSON.parse(n))}async setAttributes(e){this._options.attributes=e,this._options.stickyBucketService&&await this.refreshStickyBuckets(),this._options.remoteEval?await this._refreshForRemoteEval():(this._render(),this._updateAllAutoExperiments())}async updateAttributes(e){return this.setAttributes({...this._options.attributes,...e})}async setAttributeOverrides(e){this._options.attributeOverrides=e,this._options.stickyBucketService&&await this.refreshStickyBuckets(),this._options.remoteEval?await this._refreshForRemoteEval():(this._render(),this._updateAllAutoExperiments())}async setForcedVariations(e){this._options.forcedVariations=e||{},this._options.remoteEval?await this._refreshForRemoteEval():(this._render(),this._updateAllAutoExperiments())}setForcedFeatures(e){this._options.forcedFeatureValues=e,this._render()}async setURL(e){if(e!==this._options.url){if(this._options.url=e,this._redirectedUrl="",this._options.remoteEval)return await this._refreshForRemoteEval(),void this._updateAllAutoExperiments(!0);this._updateAllAutoExperiments(!0)}}getAttributes(){return{...this._options.attributes,...this._options.attributeOverrides}}getForcedVariations(){return this._options.forcedVariations||{}}getForcedFeatures(){return this._options.forcedFeatureValues||new Map}getStickyBucketAssignmentDocs(){return this._options.stickyBucketAssignmentDocs||{}}getUrl(){return this._options.url||""}getFeatures(){return this._options.features||{}}getExperiments(){return this._options.experiments||[]}getCompletedChangeIds(){return Array.from(this._completedChangeIds)}subscribe(e){return this._subscriptions.add(e),()=>{this._subscriptions.delete(e)}}async _refreshForRemoteEval(){if(!this._options.remoteEval)return;if(!this._initialized)return;const e=await this._refresh({allowStale:!1});e.data&&await this.setPayload(e.data)}getAllResults(){return new Map(this._assigned)}onDestroy(e){this._destroyCallbacks.push(e)}isDestroyed(){return!!this._destroyed}destroy(e){e=e||{},this._destroyed=!0,this._destroyCallbacks.forEach(e=>{try{e()}catch(e){console.error(e)}}),this._subscriptions.clear(),this._assigned.clear(),this._trackedExperiments.clear(),this._completedChangeIds.clear(),this._deferredTrackingCalls.clear(),this._trackedFeatures={},this._destroyCallbacks=[],this._payload=void 0,this._saveStickyBucketAssignmentDoc=void 0,(0,o.unsubscribe)(this),e.destroyAllStreams&&(0,o.clearAutoRefresh)(),this.logs=[],l&&window._growthbook===this&&delete window._growthbook,this._activeAutoExperiments.forEach(e=>{e.undo()}),this._activeAutoExperiments.clear(),this._triggeredExpKeys.clear()}setRenderer(e){this._renderer=e}forceVariation(e,t){this._options.forcedVariations=this._options.forcedVariations||{},this._options.forcedVariations[e]=t,this._options.remoteEval?this._refreshForRemoteEval():(this._updateAllAutoExperiments(),this._render())}run(e){const{result:t}=(0,a.runExperiment)(e,null,this._getEvalContext());return this._onExperimentEval(e,t),t}triggerExperiment(e){return this._triggeredExpKeys.add(e),this._options.experiments?this._options.experiments.filter(t=>t.key===e).map(e=>this._runAutoExperiment(e)).filter(e=>null!==e):null}triggerAutoExperiments(){this._autoExperimentsAllowed=!0,this._updateAllAutoExperiments(!0)}_getEvalContext(){return{user:this._getUserContext(),global:this._getGlobalContext(),stack:{evaluatedFeatures:new Set}}}_getUserContext(){return{attributes:this._options.user?{...this._options.user,...this._options.attributes}:this._options.attributes,enableDevMode:this._options.enableDevMode,blockedChangeIds:this._options.blockedChangeIds,stickyBucketAssignmentDocs:this._options.stickyBucketAssignmentDocs,url:this._getContextUrl(),forcedVariations:this._options.forcedVariations,forcedFeatureValues:this._options.forcedFeatureValues,attributeOverrides:this._options.attributeOverrides,saveStickyBucketAssignmentDoc:this._saveStickyBucketAssignmentDoc,trackingCallback:this._options.trackingCallback,onFeatureUsage:this._options.onFeatureUsage,devLogs:this.logs,trackedExperiments:this._trackedExperiments,trackedFeatureUsage:this._trackedFeatures}}_getGlobalContext(){return{features:this._options.features,experiments:this._options.experiments,log:this.log,enabled:this._options.enabled,qaMode:this._options.qaMode,savedGroups:this._options.savedGroups,groups:this._options.groups,overrides:this._options.overrides,onExperimentEval:this._onExperimentEval,recordChangeId:this._recordChangedId,saveDeferredTrack:this._saveDeferredTrack,eventLogger:this._options.eventLogger}}_runAutoExperiment(e,t){const r=this._activeAutoExperiments.get(e);if(e.manual&&!this._triggeredExpKeys.has(e.key)&&!r)return null;let n,i;this._isAutoExperimentBlockedByContext(e)?n=(0,a.getExperimentResult)(this._getEvalContext(),e,-1,!1,""):(({result:n,trackingCall:i}=(0,a.runExperiment)(e,null,this._getEvalContext())),this._onExperimentEval(e,n));const o=JSON.stringify(n.value);if(!t&&n.inExperiment&&r&&r.valueHash===o)return n;if(r&&this._undoActiveAutoExperiment(e),n.inExperiment){const t=(0,s.getAutoExperimentChangeType)(e);if("redirect"===t&&n.value.urlRedirect&&e.urlPatterns){const t=e.persistQueryString?(0,s.mergeQueryStrings)(this._getContextUrl(),n.value.urlRedirect):n.value.urlRedirect;if((0,s.isURLTargeted)(t,e.urlPatterns))return this.log("Skipping redirect because original URL matches redirect URL",{id:e.key}),n;this._redirectedUrl=t;const{navigate:r,delay:o}=this._getNavigateFunction();if(r)if(l)Promise.all([...i?[(0,s.promiseTimeout)(i,this._options.maxNavigateDelay??1e3)]:[],new Promise(e=>window.setTimeout(e,this._options.navigateDelay??o))]).then(()=>{try{r(t)}catch(e){console.error(e)}});else try{r(t)}catch(e){console.error(e)}}else if("visual"===t){const t=this._options.applyDomChangesCallback?this._options.applyDomChangesCallback(n.value):this._applyDOMChanges(n.value);t&&this._activeAutoExperiments.set(e,{undo:t,valueHash:o})}}return n}_undoActiveAutoExperiment(e){const t=this._activeAutoExperiments.get(e);t&&(t.undo(),this._activeAutoExperiments.delete(e))}_updateAllAutoExperiments(e){if(!this._autoExperimentsAllowed)return;const t=this._options.experiments||[],r=new Set(t);this._activeAutoExperiments.forEach((e,t)=>{r.has(t)||(e.undo(),this._activeAutoExperiments.delete(t))});for(const r of t){const t=this._runAutoExperiment(r,e);if(t&&t.inExperiment&&"redirect"===(0,s.getAutoExperimentChangeType)(r))break}}_onExperimentEval(e,t){const r=this._assigned.get(e.key);this._assigned.set(e.key,{experiment:e,result:t}),this._subscriptions.size>0&&this._fireSubscriptions(e,t,r)}_fireSubscriptions(e,t,r){r&&r.result.inExperiment===t.inExperiment&&r.result.variationId===t.variationId||this._subscriptions.forEach(r=>{try{r(e,t)}catch(e){console.error(e)}})}_recordChangedId(e){this._completedChangeIds.add(e)}isOn(e){return this.evalFeature(e).on}isOff(e){return this.evalFeature(e).off}getFeatureValue(e,t){const r=this.evalFeature(e).value;return null===r?t:r}feature(e){return this.evalFeature(e)}evalFeature(e){return(0,a.evalFeature)(e,this._getEvalContext())}log(e,t){this.debug&&(this._options.log?this._options.log(e,t):console.log(e,t))}getDeferredTrackingCalls(){return Array.from(this._deferredTrackingCalls.values())}setDeferredTrackingCalls(e){this._deferredTrackingCalls=new Map(e.filter(e=>e&&e.experiment&&e.result).map(e=>[(0,a.getExperimentDedupeKey)(e.experiment,e.result),e]))}async fireDeferredTrackingCalls(){if(!this._options.trackingCallback)return;const e=[];this._deferredTrackingCalls.forEach(t=>{t&&t.experiment&&t.result?e.push(this._options.trackingCallback(t.experiment,t.result)):console.error("Invalid deferred tracking call",{call:t})}),this._deferredTrackingCalls.clear(),await Promise.all(e)}setTrackingCallback(e){this._options.trackingCallback=e,this.fireDeferredTrackingCalls()}setEventLogger(e){this._options.eventLogger=e}async logEvent(e,t){if(this._destroyed)console.error("Cannot log event to destroyed GrowthBook instance");else if(this._options.enableDevMode&&this.logs.push({eventName:e,properties:t,timestamp:Date.now().toString(),logType:"event"}),this._options.eventLogger)try{await this._options.eventLogger(e,t||{},this._getUserContext())}catch(e){console.error(e)}else console.error("No event logger configured")}_saveDeferredTrack(e){this._deferredTrackingCalls.set((0,a.getExperimentDedupeKey)(e.experiment,e.result),e)}_getContextUrl(){return this._options.url||(l?window.location.href:"")}_isAutoExperimentBlockedByContext(e){const t=(0,s.getAutoExperimentChangeType)(e);if("visual"===t){if(this._options.disableVisualExperiments)return!0;if(this._options.disableJsInjection&&e.variations.some(e=>e.js))return!0}else{if("redirect"!==t)return!0;if(this._options.disableUrlRedirectExperiments)return!0;try{const t=new URL(this._getContextUrl());for(const r of e.variations){if(!r||!r.urlRedirect)continue;const e=new URL(r.urlRedirect);if(this._options.disableCrossOriginUrlRedirectExperiments){if(e.protocol!==t.protocol)return!0;if(e.host!==t.host)return!0}}}catch(t){return this.log("Error parsing current or redirect URL",{id:e.key,error:t}),!0}}return!(!e.changeId||!(this._options.blockedChangeIds||[]).includes(e.changeId))}getRedirectUrl(){return this._redirectedUrl}_getNavigateFunction(){return this._options.navigate?{navigate:this._options.navigate,delay:0}:l?{navigate:e=>{window.location.replace(e)},delay:100}:{navigate:null,delay:0}}_applyDOMChanges(e){if(!l)return;const t=[];if(e.css){const r=document.createElement("style");r.innerHTML=e.css,document.head.appendChild(r),t.push(()=>r.remove())}if(e.js){const r=document.createElement("script");r.innerHTML=e.js,this._options.jsInjectionNonce&&(r.nonce=this._options.jsInjectionNonce),document.head.appendChild(r),t.push(()=>r.remove())}return e.domMutations&&e.domMutations.forEach(e=>{t.push(i.default.declarative(e).revert)}),()=>{t.forEach(e=>e())}}async refreshStickyBuckets(e){if(this._options.stickyBucketService){const t=this._getEvalContext(),r=await(0,a.getAllStickyBucketAssignmentDocs)(t,this._options.stickyBucketService,e);this._options.stickyBucketAssignmentDocs=r}}generateStickyBucketAssignmentDocsSync(e,t){if(!("getAllAssignmentsSync"in e))return void console.error("generating StickyBucketAssignmentDocs docs requires StickyBucketServiceSync");const r=this._getEvalContext(),n=(0,a.getStickyBucketAttributes)(r,t);return e.getAllAssignmentsSync(n)}inDevMode(){return!!this._options.enableDevMode}}t.GrowthBook=c},343(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t,r=(t="string"==typeof e?(0,i.default)(e):e,Uint8Array.of((15&t[6])<<4|t[7]>>4&15,(15&t[7])<<4|(240&t[4])>>4,(15&t[4])<<4|(240&t[5])>>4,(15&t[5])<<4|(240&t[0])>>4,(15&t[0])<<4|(240&t[1])>>4,(15&t[1])<<4|(240&t[2])>>4,96|15&t[2],t[3],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15]));return"string"==typeof e?(0,s.unsafeStringify)(r):r};var n,i=(n=r(792))&&n.__esModule?n:{default:n},s=r(910)},350(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StickyBucketServiceSync=t.StickyBucketService=t.RedisStickyBucketService=t.LocalStorageStickyBucketService=t.ExpressCookieStickyBucketService=t.BrowserCookieStickyBucketService=void 0;var n=r(106),i=r(569);class s{constructor(e){e=e||{},this.prefix=e.prefix||""}async getAllAssignments(e){const t={};return(await Promise.all(Object.entries(e).map(e=>{let[t,r]=e;return this.getAssignments(t,r)}))).forEach(e=>{if(e){const r=(0,i.getStickyBucketAttributeKey)(e.attributeName,e.attributeValue);t[r]=e}}),t}getKey(e,t){return`${this.prefix}${e}||${t}`}}t.StickyBucketService=s;class o extends s{async getAssignments(e,t){return this.getAssignmentsSync(e,t)}async saveAssignments(e){this.saveAssignmentsSync(e)}getAllAssignmentsSync(e){const t={};return Object.entries(e).map(e=>{let[t,r]=e;return this.getAssignmentsSync(t,r)}).forEach(e=>{if(e){const r=(0,i.getStickyBucketAttributeKey)(e.attributeName,e.attributeValue);t[r]=e}}),t}}t.StickyBucketServiceSync=o,t.LocalStorageStickyBucketService=class extends s{constructor(e){e=e||{},super(),this.prefix=e.prefix||"gbStickyBuckets__";try{this.localStorage=e.localStorage||globalThis.localStorage}catch(e){}}async getAssignments(e,t){const r=this.getKey(e,t);let n=null;if(!this.localStorage)return n;try{const e=await this.localStorage.getItem(r)||"{}",t=JSON.parse(e);t.attributeName&&t.attributeValue&&t.assignments&&(n=t)}catch(e){}return n}async saveAssignments(e){const t=this.getKey(e.attributeName,e.attributeValue);if(this.localStorage)try{await this.localStorage.setItem(t,JSON.stringify(e))}catch(e){}}},t.ExpressCookieStickyBucketService=class extends o{constructor(e){let{prefix:t="gbStickyBuckets__",req:r,res:n,cookieAttributes:i={maxAge:15552e6}}=e;super(),this.prefix=t,this.req=r,this.res=n,this.cookieAttributes=i}getAssignmentsSync(e,t){const r=this.getKey(e,t);let n=null;if(!this.req)return n;try{const e=this.req.cookies[r]||"{}",t=JSON.parse(e);t.attributeName&&t.attributeValue&&t.assignments&&(n=t)}catch(e){}return n}saveAssignmentsSync(e){const t=this.getKey(e.attributeName,e.attributeValue);if(!this.res)return;const r=JSON.stringify(e);this.res.cookie(encodeURIComponent(t),encodeURIComponent(r),this.cookieAttributes)}},t.BrowserCookieStickyBucketService=class extends o{constructor(e){let{prefix:t="gbStickyBuckets__",jsCookie:r,cookieAttributes:n={expires:180}}=e;super(),this.prefix=t,this.jsCookie=r,this.cookieAttributes=n}getAssignmentsSync(e,t){const r=this.getKey(e,t);let n=null;if(!this.jsCookie)return n;try{const e=this.jsCookie.get(r),t=JSON.parse(e||"{}");t.attributeName&&t.attributeValue&&t.assignments&&(n=t)}catch(e){}return n}async saveAssignmentsSync(e){const t=this.getKey(e.attributeName,e.attributeValue);if(!this.jsCookie)return;const r=JSON.stringify(e);this.jsCookie.set(t,r,this.cookieAttributes)}},t.RedisStickyBucketService=class extends s{constructor(e){let{redis:t}=e;super(),this.redis=t}async getAllAssignments(e){const t={},r=Object.entries(e).map(e=>{let[t,r]=e;return(0,i.getStickyBucketAttributeKey)(t,r)});return this.redis?(await this.redis.mget(...r).then(e=>{e.forEach(e=>{try{const r=JSON.parse(e||"{}");if(r.attributeName&&"attributeValue"in r&&r.assignments){const e=(0,i.getStickyBucketAttributeKey)(r.attributeName,(0,n.toString)(r.attributeValue));t[e]=r}}catch(e){}})}),t):t}async getAssignments(e,t){return null}async saveAssignments(e){const t=this.getKey(e.attributeName,e.attributeValue);this.redis&&await this.redis.set(t,JSON.stringify(e))}}},396(e,t,r){"use strict";var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},n.apply(this,arguments)},i=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})},s=this&&this.__generator||function(e,t){var r,n,i,s,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(l){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,n=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],n=0}finally{r=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Analytics=t.createAnalyticsInstance=void 0;var a=r(316),l=r(706),u=o(r(733)),c=r(154);function d(e){var t,r,o=this,d={},g={},f=[],p=[],v=function(e,r){return null==t?void 0:t.getFeatureValue(e,r)},y=function(){var e=(null==r?void 0:r.getUserId())||"";return e&&!h(e)?e:""},m={initialise:function(e){var f=e.growthbookKey,y=e.growthbookDecryptionKey,m=e.rudderstackKey,b=e.growthbookOptions,k=e.disableRudderstackAMD,S=void 0!==k&&k;return i(o,void 0,void 0,function(){var e,k,_,w,A,E,I,C,T,O,P,D,x,R,B,$,M,N,L,U,j,V,F,H,G,K,z;return s(this,function(J){switch(J.label){case 0:return J.trys.push([0,3,,4]),(k=null===(A=null==b?void 0:b.attributes)||void 0===A?void 0:A.country)?[3,2]:[4,i(o,void 0,void 0,function(){var e,t,r,n,i;return s(this,function(s){switch(s.label){case 0:return[4,c.CountryUtils.getCountry()];case 1:if(e=s.sent(),t=u.default.get("clients_country"),r=u.default.get("website_status"),n="",r)try{n=(null===(i=JSON.parse(r))||void 0===i?void 0:i.clients_country)||""}catch(e){console.error("Failed to parse cookie: ",e)}return[2,t||n||e]}})})];case 1:k=J.sent(),J.label=2;case 2:return e=k,r=l.RudderStack.getRudderStackInstance(m,S,function(){p.forEach(function(e){e&&(null==r||r.identifyEvent(e,{language:(null==d?void 0:d.user_language)||"en"}))}),p=[]}),(null==b?void 0:b.attributes)&&Object.keys(b.attributes).length>0&&(d=n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n({},d),{country:e}),(null===(E=null==b?void 0:b.attributes)||void 0===E?void 0:E.user_language)&&{user_language:null==b?void 0:b.attributes.user_language}),(null===(I=null==b?void 0:b.attributes)||void 0===I?void 0:I.account_type)&&{account_type:null==b?void 0:b.attributes.account_type}),(null===(C=null==b?void 0:b.attributes)||void 0===C?void 0:C.app_id)&&{app_id:null==b?void 0:b.attributes.app_id}),(null===(T=null==b?void 0:b.attributes)||void 0===T?void 0:T.residence_country)&&{residence_country:null===(O=null==b?void 0:b.attributes)||void 0===O?void 0:O.residence_country}),(null===(P=null==b?void 0:b.attributes)||void 0===P?void 0:P.device_type)&&{device_type:null==b?void 0:b.attributes.device_type}),(null===(D=null==b?void 0:b.attributes)||void 0===D?void 0:D.url)&&{url:null==b?void 0:b.attributes.url}),(null==b?void 0:b.attributes)&&{loggedIn:!!(null===(x=null==b?void 0:b.attributes)||void 0===x?void 0:x.loggedIn)}),(null===(R=null==b?void 0:b.attributes)||void 0===R?void 0:R.email_hash)&&{email_hash:null==b?void 0:b.attributes.email_hash}),(null===(B=null==b?void 0:b.attributes)||void 0===B?void 0:B.network_type)&&{network_type:null==b?void 0:b.attributes.network_type}),(null===($=null==b?void 0:b.attributes)||void 0===$?void 0:$.network_rtt)&&{network_rtt:null==b?void 0:b.attributes.network_rtt}),(null===(M=null==b?void 0:b.attributes)||void 0===M?void 0:M.network_downlink)&&{network_downlink:null==b?void 0:b.attributes.network_downlink}),(null===(N=null==b?void 0:b.attributes)||void 0===N?void 0:N.user_id)&&!h(null===(L=null==b?void 0:b.attributes)||void 0===L?void 0:L.user_id)&&{user_id:null===(U=null==b?void 0:b.attributes)||void 0===U?void 0:U.user_id}),(null==b?void 0:b.attributes)&&{anonymous_id:r.getAnonymousId()}),(null===(j=null==b?void 0:b.attributes)||void 0===j?void 0:j.account_currency)&&{account_currency:null==b?void 0:b.attributes.account_currency}),(null===(V=null==b?void 0:b.attributes)||void 0===V?void 0:V.account_mode)&&{account_mode:null==b?void 0:b.attributes.account_mode})),null!=b||(b={}),null!==(F=b.attributes)&&void 0!==F||(b.attributes={}),null!==(H=(K=b.attributes).id)&&void 0!==H||(K.id=r.getAnonymousId()),null!==(G=(z=b.attributes).country)&&void 0!==G||(z.country=e),f&&(t=a.Growthbook.getGrowthBookInstance(f,y,b),_=setInterval(function(){Object.keys(g).length>0?clearInterval(_):g=v("tracking-buttons-config",{})},1e3)),[3,4];case 3:return w=J.sent(),console.log("Error in initializing analytics",w),[3,4];case 4:return[2]}})})},setAttributes:function(e){var i=e.country,s=e.user_language,o=e.device_language,a=e.device_type,l=e.account_type,u=e.user_id,c=e.anonymous_id,g=e.app_id,f=e.utm_source,p=e.utm_medium,v=e.utm_campaign,m=e.is_authorised,b=e.residence_country,k=e.url,S=e.domain,_=e.geo_location,w=e.loggedIn,A=e.network_downlink,E=e.network_rtt,I=e.network_type,C=e.account_currency,T=e.account_mode;if(r){var O=null!=u?u:y();if(t){var P=n(n({country:i,residence_country:b,user_language:s,device_language:o,device_type:a,utm_source:f,utm_medium:p,utm_campaign:v,is_authorised:m,url:k,domain:S,loggedIn:w},u&&!h(u)&&{user_id:u}),{anonymous_id:c});O&&(P.id=O,P.user_id=O),t.setAttributes(P)}d=n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n({},d),void 0!==i&&{country:i}),void 0!==_&&{geo_location:_}),void 0!==s&&{user_language:s}),void 0!==l&&{account_type:l}),void 0!==g&&{app_id:g}),void 0!==b&&{residence_country:b}),void 0!==a&&{device_type:a}),void 0!==k&&{url:k}),void 0!==w&&{loggedIn:w}),void 0!==A&&{network_downlink:A}),void 0!==E&&{network_rtt:E}),void 0!==I&&{network_type:I}),void 0!==u&&!h(u)&&{user_id:u}),void 0!==c&&{anonymous_id:c}),void 0!==C&&{account_currency:C}),void 0!==T&&{account_mode:T})}},identifyEvent:function(e){var t=e||y();(null==r?void 0:r.has_initialized)&&t?null==r||r.identifyEvent(t,{language:(null==d?void 0:d.user_language)||"en"}):t&&p.push(t)},getFeatureState:function(e){var r,n;return null===(n=null===(r=null==t?void 0:t.getFeatureState(e))||void 0===r?void 0:r.experimentResult)||void 0===n?void 0:n.name},getFeatureValue:v,getGrowthbookStatus:function(){return i(o,void 0,void 0,function(){return s(this,function(e){switch(e.label){case 0:return[4,null==t?void 0:t.getStatus()];case 1:return[2,e.sent()]}})})},isFeatureOn:function(e){return null==t?void 0:t.isOn(e)},setUrl:function(e){return null==t?void 0:t.setUrl(e)},getId:y,trackEvent:function(e,t){var i,s=y(),o={};if("event_metadata"in(i=t)||"cta_information"in i||"error"in i){var a=t;o=n(n({},a),{event_metadata:n(n(n({},d),s&&{user_id:s}),a.event_metadata)})}else o=n(n(n({},d),t),s&&{user_id:s});navigator.onLine&&r?(f.length>0&&f.forEach(function(e,t){r.track(e.event,e.payload),delete f[t]}),e in g?g[e]&&(null==r||r.track(e,o)):null==r||r.track(e,o)):f.push({event:e,payload:o})},getInstances:function(){return{ab:t,tracking:r}},pageView:function(e,t,n){if(void 0===t&&(t="Deriv App"),r){var i=y();null==r||r.pageView(e,t,i,n)}},reset:function(){r&&(null==r||r.reset())}};return"undefined"!=typeof window&&(window.AnalyticsInstance=m),m}t.createAnalyticsInstance=d,t.Analytics=d();var h=function(e){return/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)}},427(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.evalCondition=s;var n=r(106);const i={};function s(e,t,r){r=r||{};for(const[n,i]of Object.entries(t))switch(n){case"$or":if(!d(e,i,r))return!1;break;case"$nor":if(d(e,i,r))return!1;break;case"$and":if(!h(e,i,r))return!1;break;case"$not":if(s(e,i,r))return!1;break;default:if(!a(i,o(e,n),r))return!1}return!0}function o(e,t){const r=t.split(".");let n=e;for(let e=0;e<r.length;e++){if(!n||"object"!=typeof n||!(r[e]in n))return null;n=n[r[e]]}return n}function a(e,t,r){if("string"==typeof e)return t+""===e;if("number"==typeof e)return 1*t===e;if("boolean"==typeof e)return null!==t&&!!t===e;if(null===e)return null===t;if(Array.isArray(e)||!l(e))return JSON.stringify(t)===JSON.stringify(e);for(const n in e)if(!c(n,t,e[n],r))return!1;return!0}function l(e){const t=Object.keys(e);return t.length>0&&t.filter(e=>"$"===e[0]).length===t.length}function u(e,t){return Array.isArray(e)?e.some(e=>t.includes(e)):t.includes(e)}function c(e,t,r,o){switch(e){case"$veq":return(0,n.paddedVersionString)(t)===(0,n.paddedVersionString)(r);case"$vne":return(0,n.paddedVersionString)(t)!==(0,n.paddedVersionString)(r);case"$vgt":return(0,n.paddedVersionString)(t)>(0,n.paddedVersionString)(r);case"$vgte":return(0,n.paddedVersionString)(t)>=(0,n.paddedVersionString)(r);case"$vlt":return(0,n.paddedVersionString)(t)<(0,n.paddedVersionString)(r);case"$vlte":return(0,n.paddedVersionString)(t)<=(0,n.paddedVersionString)(r);case"$eq":return t===r;case"$ne":return t!==r;case"$lt":return t<r;case"$lte":return t<=r;case"$gt":return t>r;case"$gte":return t>=r;case"$exists":return r?null!=t:null==t;case"$in":return!!Array.isArray(r)&&u(t,r);case"$inGroup":return u(t,o[r]||[]);case"$notInGroup":return!u(t,o[r]||[]);case"$nin":return!!Array.isArray(r)&&!u(t,r);case"$not":return!a(r,t,o);case"$size":return!!Array.isArray(t)&&a(r,t.length,o);case"$elemMatch":return function(e,t,r){if(!Array.isArray(e))return!1;const n=l(t)?e=>a(t,e,r):e=>s(e,t,r);for(let t=0;t<e.length;t++)if(e[t]&&n(e[t]))return!0;return!1}(t,r,o);case"$all":if(!Array.isArray(t))return!1;for(let e=0;e<r.length;e++){let n=!1;for(let i=0;i<t.length;i++)if(a(r[e],t[i],o)){n=!0;break}if(!n)return!1}return!0;case"$regex":try{return(c=r,i[c]||(i[c]=new RegExp(c.replace(/([^\\])\//g,"$1\\/"))),i[c]).test(t)}catch(e){return!1}case"$type":return function(e){if(null===e)return"null";if(Array.isArray(e))return"array";const t=typeof e;return["string","number","boolean","object","undefined"].includes(t)?t:"unknown"}(t)===r;default:return console.error("Unknown operator: "+e),!1}var c}function d(e,t,r){if(!t.length)return!0;for(let n=0;n<t.length;n++)if(s(e,t[n],r))return!0;return!1}function h(e,t,r){for(let n=0;n<t.length;n++)if(!s(e,t[n],r))return!1;return!0}},507(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t,r=(t="string"==typeof e?(0,i.default)(e):e,Uint8Array.of((15&t[3])<<4|t[4]>>4&15,(15&t[4])<<4|(240&t[5])>>4,(15&t[5])<<4|15&t[6],t[7],(15&t[1])<<4|(240&t[2])>>4,(15&t[2])<<4|(240&t[3])>>4,16|(240&t[0])>>4,(15&t[0])<<4|(240&t[1])>>4,t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15]));return"string"==typeof e?(0,s.unsafeStringify)(r):r};var n,i=(n=r(792))&&n.__esModule?n:{default:n},s=r(910)},518(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n,i,s,o=(n=r(858))&&n.__esModule?n:{default:n},a=r(910),l=0,u=0;t.default=function(e,t,r){var n=t&&r||0,c=t||new Array(16),d=(e=e||{}).node,h=e.clockseq;if(e._v6||(d||(d=i),null==h&&(h=s)),null==d||null==h){var g=e.random||(e.rng||o.default)();null==d&&(d=[g[0],g[1],g[2],g[3],g[4],g[5]],i||e._v6||(d[0]|=1,i=d)),null==h&&(h=16383&(g[6]<<8|g[7]),void 0!==s||e._v6||(s=h))}var f=void 0!==e.msecs?e.msecs:Date.now(),p=void 0!==e.nsecs?e.nsecs:u+1,v=f-l+(p-u)/1e4;if(v<0&&void 0===e.clockseq&&(h=h+1&16383),(v<0||f>l)&&void 0===e.nsecs&&(p=0),p>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");l=f,u=p,s=h;var y=(1e4*(268435455&(f+=122192928e5))+p)%4294967296;c[n++]=y>>>24&255,c[n++]=y>>>16&255,c[n++]=y>>>8&255,c[n++]=255&y;var m=f/4294967296*1e4&268435455;c[n++]=m>>>8&255,c[n++]=255&m,c[n++]=m>>>24&15|16,c[n++]=m>>>16&255,c[n++]=h>>>8|128,c[n++]=255&h;for(var b=0;b<6;++b)c[n+b]=d[b];return t||(0,a.unsafeStringify)(c)}},555(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UserScopedGrowthBook=t.GrowthBookClient=void 0;var n=r(106),i=r(707),s=r(569);const o=(0,n.loadSDKVersion)();t.GrowthBookClient=class{constructor(e){if(e=e||{},this.version=o,this._options=e,this.debug=!!e.debug,this.ready=!1,this._features={},this._experiments=[],this.log=this.log.bind(this),e.plugins)for(const t of e.plugins)t(this)}async setPayload(e){this._payload=e;const t=await(0,s.decryptPayload)(e,this._options.decryptionKey);this._decryptedPayload=t,t.features&&(this._features=t.features),t.experiments&&(this._experiments=t.experiments),t.savedGroups&&(this._options.savedGroups=t.savedGroups),this.ready=!0}initSync(e){const t=e.payload;if(t.encryptedExperiments||t.encryptedFeatures)throw new Error("initSync does not support encrypted payloads");return this._payload=t,this._decryptedPayload=t,t.features&&(this._features=t.features),t.experiments&&(this._experiments=t.experiments),this.ready=!0,(0,i.startStreaming)(this,e),this}async init(e){if((e=e||{}).cacheSettings&&(0,i.configureCache)(e.cacheSettings),e.payload)return await this.setPayload(e.payload),(0,i.startStreaming)(this,e),{success:!0,source:"init"};{const{data:t,...r}=await this._refresh({...e,allowStale:!0});return(0,i.startStreaming)(this,e),await this.setPayload(t||{}),r}}async refreshFeatures(e){const t=await this._refresh({...e||{},allowStale:!1});t.data&&await this.setPayload(t.data)}getApiInfo(){return[this.getApiHosts().apiHost,this.getClientKey()]}getApiHosts(){return(0,s.getApiHosts)(this._options)}getClientKey(){return this._options.clientKey||""}getPayload(){return this._payload||{features:this.getFeatures(),experiments:this._experiments||[]}}getDecryptedPayload(){return this._decryptedPayload||this.getPayload()}async _refresh(e){let{timeout:t,skipCache:r,allowStale:n,streaming:s}=e;if(!this._options.clientKey)throw new Error("Missing clientKey");return(0,i.refreshFeatures)({instance:this,timeout:t,skipCache:r||this._options.disableCache,allowStale:n,backgroundSync:s??!0})}getFeatures(){return this._features||{}}getGlobalAttributes(){return this._options.globalAttributes||{}}setGlobalAttributes(e){this._options.globalAttributes=e}destroy(e){e=e||{},this._destroyed=!0,(0,i.unsubscribe)(this),e.destroyAllStreams&&(0,i.clearAutoRefresh)(),this._features={},this._experiments=[],this._decryptedPayload=void 0,this._payload=void 0,this._options={}}isDestroyed(){return!!this._destroyed}setEventLogger(e){this._options.eventLogger=e}logEvent(e,t,r){if(this._options.eventLogger){const n=this._getEvalContext(r);this._options.eventLogger(e,t,n.user)}}runInlineExperiment(e,t){const{result:r}=(0,s.runExperiment)(e,null,this._getEvalContext(t));return r}_getEvalContext(e){return this._options.globalAttributes&&(e={...e,attributes:{...this._options.globalAttributes,...e.attributes}}),{user:e,global:this._getGlobalContext(),stack:{evaluatedFeatures:new Set}}}_getGlobalContext(){return{features:this._features,experiments:this._experiments,log:this.log,enabled:this._options.enabled,qaMode:this._options.qaMode,savedGroups:this._options.savedGroups,forcedFeatureValues:this._options.forcedFeatureValues,forcedVariations:this._options.forcedVariations,trackingCallback:this._options.trackingCallback,onFeatureUsage:this._options.onFeatureUsage}}isOn(e,t){return this.evalFeature(e,t).on}isOff(e,t){return this.evalFeature(e,t).off}getFeatureValue(e,t,r){const n=this.evalFeature(e,r).value;return null===n?t:n}evalFeature(e,t){return(0,s.evalFeature)(e,this._getEvalContext(t))}log(e,t){this.debug&&(this._options.log?this._options.log(e,t):console.log(e,t))}setTrackingCallback(e){this._options.trackingCallback=e}async applyStickyBuckets(e,t){const r=this._getEvalContext(e),n=await(0,s.getAllStickyBucketAssignmentDocs)(r,t);return{...e,stickyBucketAssignmentDocs:n,saveStickyBucketAssignmentDoc:e=>t.saveAssignments(e)}}createScopedInstance(e,t){return new a(this,e,[...this._options.plugins||[],...t||[]])}};class a{constructor(e,t,r){if(this._gb=e,this._userContext=t,this.logs=[],this._userContext.trackedExperiments=this._userContext.trackedExperiments||new Set,this._userContext.trackedFeatureUsage=this._userContext.trackedFeatureUsage||{},this._userContext.devLogs=this.logs,r)for(const e of r)e(this)}runInlineExperiment(e){return this._gb.runInlineExperiment(e,this._userContext)}isOn(e){return this._gb.isOn(e,this._userContext)}isOff(e){return this._gb.isOff(e,this._userContext)}getFeatureValue(e,t){return this._gb.getFeatureValue(e,t,this._userContext)}evalFeature(e){return this._gb.evalFeature(e,this._userContext)}logEvent(e,t){this._userContext.enableDevMode&&this.logs.push({eventName:e,properties:t,timestamp:Date.now().toString(),logType:"event"}),this._gb.logEvent(e,t||{},this._userContext)}setTrackingCallback(e){this._userContext.trackingCallback=e}getApiInfo(){return this._gb.getApiInfo()}getClientKey(){return this._gb.getClientKey()}setURL(e){this._userContext.url=e}updateAttributes(e){this._userContext.attributes={...this._userContext.attributes,...e}}setAttributeOverrides(e){this._userContext.attributeOverrides=e}async setForcedVariations(e){this._userContext.forcedVariations=e||{}}setForcedFeatures(e){this._userContext.forcedFeatureValues=e}getUserContext(){return this._userContext}getVersion(){return o}getDecryptedPayload(){return this._gb.getDecryptedPayload()}inDevMode(){return!!this._userContext.enableDevMode}}t.UserScopedGrowthBook=a},569(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EVENT_FEATURE_EVALUATED=t.EVENT_EXPERIMENT_VIEWED=void 0,t.decryptPayload=async function(e,t,r){if((e={...e}).encryptedFeatures){try{e.features=JSON.parse(await(0,i.decrypt)(e.encryptedFeatures,t,r))}catch(e){console.error(e)}delete e.encryptedFeatures}if(e.encryptedExperiments){try{e.experiments=JSON.parse(await(0,i.decrypt)(e.encryptedExperiments,t,r))}catch(e){console.error(e)}delete e.encryptedExperiments}if(e.encryptedSavedGroups){try{e.savedGroups=JSON.parse(await(0,i.decrypt)(e.encryptedSavedGroups,t,r))}catch(e){console.error(e)}delete e.encryptedSavedGroups}return e},t.evalFeature=u,t.getAllStickyBucketAssignmentDocs=async function(e,t,r){const n=k(e,r);return t.getAllAssignments(n)},t.getApiHosts=function(e){const t=e.apiHost||"https://cdn.growthbook.io";return{apiHost:t.replace(/\/*$/,""),streamingHost:(e.streamingHost||t).replace(/\/*$/,""),apiRequestHeaders:e.apiHostRequestHeaders,streamingHostRequestHeaders:e.streamingHostRequestHeaders}},t.getExperimentDedupeKey=S,t.getExperimentResult=v,t.getHashAttribute=y,t.getStickyBucketAttributeKey=b,t.getStickyBucketAttributes=k,t.runExperiment=c;var n=r(427),i=r(106);const s=t.EVENT_FEATURE_EVALUATED="Feature Evaluated",o=t.EVENT_EXPERIMENT_VIEWED="Experiment Viewed";async function a(e){try{await e()}catch(e){}}function l(e,t,r){if(e.user.trackedExperiments){const n=S(t,r);if(e.user.trackedExperiments.has(n))return[];e.user.trackedExperiments.add(n)}e.user.enableDevMode&&e.user.devLogs&&e.user.devLogs.push({experiment:t,result:r,timestamp:Date.now().toString(),logType:"experiment"});const n=[];if(e.global.trackingCallback){const i=e.global.trackingCallback;n.push(a(()=>i(t,r,e.user)))}if(e.user.trackingCallback){const i=e.user.trackingCallback;n.push(a(()=>i(t,r)))}if(e.global.eventLogger){const i=e.global.eventLogger;n.push(a(()=>i(o,{experimentId:t.key,variationId:r.key,hashAttribute:r.hashAttribute,hashValue:r.hashValue},e.user)))}return n}function u(e,t){if(t.stack.evaluatedFeatures.has(e))return d(t,e,null,"cyclicPrerequisite");t.stack.evaluatedFeatures.add(e),t.stack.id=e;const r=function(e){const t=new Map;return e.global.forcedFeatureValues&&e.global.forcedFeatureValues.forEach((e,r)=>t.set(r,e)),e.user.forcedFeatureValues&&e.user.forcedFeatureValues.forEach((e,r)=>t.set(r,e)),t}(t);if(r.has(e))return d(t,e,r.get(e),"override");if(!t.global.features||!t.global.features[e])return d(t,e,null,"unknownFeature");const i=t.global.features[e];if(i.rules){const r=new Set(t.stack.evaluatedFeatures);e:for(const s of i.rules){if(s.parentConditions)for(const i of s.parentConditions){t.stack.evaluatedFeatures=new Set(r);const s=u(i.id,t);if("cyclicPrerequisite"===s.source)return d(t,e,null,"cyclicPrerequisite");const o={value:s.value};if(!(0,n.evalCondition)(o,i.condition||{})){if(i.gate)return d(t,e,null,"prerequisite");continue e}}if(s.filters&&f(s.filters,t))continue;if("force"in s){if(s.condition&&!g(s.condition,t))continue;if(!p(t,s.seed||e,s.hashAttribute,t.user.saveStickyBucketAssignmentDoc&&!s.disableStickyBucketing?s.fallbackAttribute:void 0,s.range,s.coverage,s.hashVersion))continue;return s.tracks&&s.tracks.forEach(e=>{!l(t,e.experiment,e.result).length&&t.global.saveDeferredTrack&&t.global.saveDeferredTrack({experiment:e.experiment,result:e.result})}),d(t,e,s.force,"force",s.id)}if(!s.variations)continue;const i={variations:s.variations,key:s.key||e};"coverage"in s&&(i.coverage=s.coverage),s.weights&&(i.weights=s.weights),s.hashAttribute&&(i.hashAttribute=s.hashAttribute),s.fallbackAttribute&&(i.fallbackAttribute=s.fallbackAttribute),s.disableStickyBucketing&&(i.disableStickyBucketing=s.disableStickyBucketing),void 0!==s.bucketVersion&&(i.bucketVersion=s.bucketVersion),void 0!==s.minBucketVersion&&(i.minBucketVersion=s.minBucketVersion),s.namespace&&(i.namespace=s.namespace),s.meta&&(i.meta=s.meta),s.ranges&&(i.ranges=s.ranges),s.name&&(i.name=s.name),s.phase&&(i.phase=s.phase),s.seed&&(i.seed=s.seed),s.hashVersion&&(i.hashVersion=s.hashVersion),s.filters&&(i.filters=s.filters),s.condition&&(i.condition=s.condition);const{result:o}=c(i,e,t);if(t.global.onExperimentEval&&t.global.onExperimentEval(i,o),o.inExperiment&&!o.passthrough)return d(t,e,o.value,"experiment",s.id,i,o)}}return d(t,e,void 0===i.defaultValue?null:i.defaultValue,"defaultValue")}function c(e,t,r){const s=e.key,o=e.variations.length;if(o<2)return{result:v(r,e,-1,!1,t)};if(!1===r.global.enabled||!1===r.user.enabled)return{result:v(r,e,-1,!1,t)};if(e=function(e,t){const r=e.key,n=t.global.overrides;return n&&n[r]&&"string"==typeof(e=Object.assign({},e,n[r])).url&&(e.url=(0,i.getUrlRegExp)(e.url)),e}(e,r),e.urlPatterns&&!(0,i.isURLTargeted)(r.user.url||"",e.urlPatterns))return{result:v(r,e,-1,!1,t)};const a=(0,i.getQueryStringOverride)(s,r.user.url||"",o);if(null!==a)return{result:v(r,e,a,!1,t)};const c=function(e){return e.global.forcedVariations&&e.user.forcedVariations?{...e.global.forcedVariations,...e.user.forcedVariations}:e.global.forcedVariations?e.global.forcedVariations:e.user.forcedVariations?e.user.forcedVariations:{}}(r);if(s in c)return{result:v(r,e,c[s],!1,t)};if("draft"===e.status||!1===e.active)return{result:v(r,e,-1,!1,t)};const{hashAttribute:d,hashValue:h}=y(r,e.hashAttribute,r.user.saveStickyBucketAssignmentDoc&&!e.disableStickyBucketing?e.fallbackAttribute:void 0);if(!h)return{result:v(r,e,-1,!1,t)};let p=-1,k=!1,S=!1;if(r.user.saveStickyBucketAssignmentDoc&&!e.disableStickyBucketing){const{variation:t,versionIsBlocked:n}=function(e){let{ctx:t,expKey:r,expBucketVersion:n,expHashAttribute:s,expFallbackAttribute:o,expMinBucketVersion:a,expMeta:l}=e;n=n||0,a=a||0,s=s||"id",l=l||[];const u=m(r,n),c=function(e,t,r){if(!e.user.stickyBucketAssignmentDocs)return{};const{hashAttribute:n,hashValue:s}=y(e,t),o=b(n,(0,i.toString)(s)),{hashAttribute:a,hashValue:l}=y(e,r),u=l?b(a,(0,i.toString)(l)):null,c={};return u&&e.user.stickyBucketAssignmentDocs[u]&&Object.assign(c,e.user.stickyBucketAssignmentDocs[u].assignments||{}),e.user.stickyBucketAssignmentDocs[o]&&Object.assign(c,e.user.stickyBucketAssignmentDocs[o].assignments||{}),c}(t,s,o);if(a>0)for(let e=0;e<a;e++)if(void 0!==c[m(r,e)])return{variation:-1,versionIsBlocked:!0};const d=c[u];if(void 0===d)return{variation:-1};const h=l.findIndex(e=>e.key===d);return h<0?{variation:-1}:{variation:h}}({ctx:r,expKey:e.key,expBucketVersion:e.bucketVersion,expHashAttribute:e.hashAttribute,expFallbackAttribute:e.fallbackAttribute,expMinBucketVersion:e.minBucketVersion,expMeta:e.meta});k=t>=0,p=t,S=!!n}if(!k){if(e.filters){if(f(e.filters,r))return{result:v(r,e,-1,!1,t)}}else if(e.namespace&&!(0,i.inNamespace)(h,e.namespace))return{result:v(r,e,-1,!1,t)};if(e.include&&!(0,i.isIncluded)(e.include))return{result:v(r,e,-1,!1,t)};if(e.condition&&!g(e.condition,r))return{result:v(r,e,-1,!1,t)};if(e.parentConditions){const i=new Set(r.stack.evaluatedFeatures);for(const s of e.parentConditions){r.stack.evaluatedFeatures=new Set(i);const o=u(s.id,r);if("cyclicPrerequisite"===o.source)return{result:v(r,e,-1,!1,t)};const a={value:o.value};if(!(0,n.evalCondition)(a,s.condition||{}))return{result:v(r,e,-1,!1,t)}}}if(e.groups&&!function(e,t){const r=t.global.groups||{};for(let t=0;t<e.length;t++)if(r[e[t]])return!0;return!1}(e.groups,r))return{result:v(r,e,-1,!1,t)}}if(e.url&&!function(e,t){const r=t.user.url;if(!r)return!1;const n=r.replace(/^https?:\/\//,"").replace(/^[^/]*\//,"/");return!!e.test(r)||!!e.test(n)}(e.url,r))return{result:v(r,e,-1,!1,t)};const _=(0,i.hash)(e.seed||s,h,e.hashVersion||1);if(null===_)return{result:v(r,e,-1,!1,t)};if(!k){const t=e.ranges||(0,i.getBucketRanges)(o,void 0===e.coverage?1:e.coverage,e.weights);p=(0,i.chooseVariation)(_,t)}if(S)return{result:v(r,e,-1,!1,t,void 0,!0)};if(p<0)return{result:v(r,e,-1,!1,t)};if("force"in e)return{result:v(r,e,void 0===e.force?-1:e.force,!1,t)};if(r.global.qaMode||r.user.qaMode)return{result:v(r,e,-1,!1,t)};if("stopped"===e.status)return{result:v(r,e,-1,!1,t)};const w=v(r,e,p,!0,t,_,k);if(r.user.saveStickyBucketAssignmentDoc&&!e.disableStickyBucketing){const{changed:t,key:n,doc:s}=function(e,t,r,n){const i=b(t,r),s=e.user.stickyBucketAssignmentDocs&&e.user.stickyBucketAssignmentDocs[i]&&e.user.stickyBucketAssignmentDocs[i].assignments||{},o={...s,...n};return{key:i,doc:{attributeName:t,attributeValue:r,assignments:o},changed:JSON.stringify(s)!==JSON.stringify(o)}}(r,d,(0,i.toString)(h),{[m(e.key,e.bucketVersion)]:w.key});t&&(r.user.stickyBucketAssignmentDocs=r.user.stickyBucketAssignmentDocs||{},r.user.stickyBucketAssignmentDocs[n]=s,r.user.saveStickyBucketAssignmentDoc(s))}const A=l(r,e,w);0===A.length&&r.global.saveDeferredTrack&&r.global.saveDeferredTrack({experiment:e,result:w});const E=A.length?1===A.length?A[0]:Promise.all(A).then(()=>{}):void 0;return"changeId"in e&&e.changeId&&r.global.recordChangeId&&r.global.recordChangeId(e.changeId),{result:w,trackingCall:E}}function d(e,t,r,n,i,o,l){const u={value:r,on:!!r,off:!r,source:n,ruleId:i||""};return o&&(u.experiment=o),l&&(u.experimentResult=l),"override"!==n&&function(e,t,r){if(e.user.trackedFeatureUsage){const n=JSON.stringify(r.value);if(e.user.trackedFeatureUsage[t]===n)return;e.user.trackedFeatureUsage[t]=n,e.user.enableDevMode&&e.user.devLogs&&e.user.devLogs.push({featureKey:t,result:r,timestamp:Date.now().toString(),logType:"feature"})}if(e.global.onFeatureUsage){const n=e.global.onFeatureUsage;a(()=>n(t,r,e.user))}if(e.user.onFeatureUsage){const n=e.user.onFeatureUsage;a(()=>n(t,r))}if(e.global.eventLogger){const n=e.global.eventLogger;a(()=>n(s,{feature:t,source:r.source,value:r.value,ruleId:"defaultValue"===r.source?"$default":r.ruleId||"",variationId:r.experimentResult?r.experimentResult.key:""},e.user))}}(e,t,u),u}function h(e){return{...e.user.attributes,...e.user.attributeOverrides}}function g(e,t){return(0,n.evalCondition)(h(t),e,t.global.savedGroups||{})}function f(e,t){return e.some(e=>{const{hashValue:r}=y(t,e.attribute);if(!r)return!0;const n=(0,i.hash)(e.seed,r,e.hashVersion||2);return null===n||!e.ranges.some(e=>(0,i.inRange)(n,e))})}function p(e,t,r,n,s,o,a){if(!s&&void 0===o)return!0;if(!s&&0===o)return!1;const{hashValue:l}=y(e,r,n);if(!l)return!1;const u=(0,i.hash)(t,l,a||1);return null!==u&&(s?(0,i.inRange)(u,s):void 0===o||u<=o)}function v(e,t,r,n,i,s,o){let a=!0;(r<0||r>=t.variations.length)&&(r=0,a=!1);const{hashAttribute:l,hashValue:u}=y(e,t.hashAttribute,e.user.saveStickyBucketAssignmentDoc&&!t.disableStickyBucketing?t.fallbackAttribute:void 0),c=t.meta?t.meta[r]:{},d={key:c.key||""+r,featureId:i,inExperiment:a,hashUsed:n,variationId:r,value:t.variations[r],hashAttribute:l,hashValue:u,stickyBucketUsed:!!o};return c.name&&(d.name=c.name),void 0!==s&&(d.bucket=s),c.passthrough&&(d.passthrough=c.passthrough),d}function y(e,t,r){let n=t||"id",i="";const s=h(e);return s[n]&&(i=s[n]),!i&&r&&(s[r]&&(i=s[r]),i&&(n=r)),{hashAttribute:n,hashValue:i}}function m(e,t){return`${e}__${t=t||0}`}function b(e,t){return`${e}||${t}`}function k(e,t){const r={},n=function(e,t){const r=new Set,n=t&&t.features?t.features:e.global.features||{},i=t&&t.experiments?t.experiments:e.global.experiments||[];return Object.keys(n).forEach(e=>{const t=n[e];if(t.rules)for(const e of t.rules)e.variations&&(r.add(e.hashAttribute||"id"),e.fallbackAttribute&&r.add(e.fallbackAttribute))}),i.map(e=>{r.add(e.hashAttribute||"id"),e.fallbackAttribute&&r.add(e.fallbackAttribute)}),Array.from(r)}(e,t);return n.forEach(t=>{const{hashValue:n}=y(e,t);r[t]=(0,i.toString)(n)}),r}function S(e,t){return t.hashAttribute+t.hashValue+e.key+t.variationId}},591(e,t,r){"use strict";r.r(t),r.d(t,{connectGlobalObserver:()=>x,default:()=>L,disconnectGlobalObserver:()=>D,validAttributeName:()=>n});var n=/^[a-zA-Z:_][a-zA-Z0-9:_.-]*$/,i={revert:function(){}},s=new Map,o=new Set;function a(e){var t=s.get(e);return t||(t={element:e,attributes:{}},s.set(e,t)),t}function l(e,t,r,n,i){var s=r(e),o={isDirty:!1,originalValue:s,virtualValue:s,mutations:[],el:e,_positionTimeout:null,observer:new MutationObserver(function(){if("position"!==t||!o._positionTimeout){"position"===t&&(o._positionTimeout=setTimeout(function(){o._positionTimeout=null},1e3));var n=r(e);"position"===t&&n.parentNode===o.virtualValue.parentNode&&n.insertBeforeNode===o.virtualValue.insertBeforeNode||n!==o.virtualValue&&(o.originalValue=n,i(o))}}),mutationRunner:i,setValue:n,getCurrentValue:r};return"position"===t&&e.parentNode?o.observer.observe(e.parentNode,{childList:!0,subtree:!0,attributes:!1,characterData:!1}):o.observer.observe(e,function(e){return"html"===e?{childList:!0,subtree:!0,attributes:!0,characterData:!0}:{childList:!1,subtree:!1,attributes:!0,attributeFilter:[e]}}(t)),o}function u(e,t){var r=t.getCurrentValue(t.el);t.virtualValue=e,e&&"string"!=typeof e?r&&e.parentNode===r.parentNode&&e.insertBeforeNode===r.insertBeforeNode||(t.isDirty=!0,T()):e!==r&&(t.isDirty=!0,T())}function c(e){var t=e.originalValue;e.mutations.forEach(function(e){return t=e.mutate(t)}),u(function(e){return k||(k=document.createElement("div")),k.innerHTML=e,k.innerHTML}(t),e)}function d(e){var t=new Set(e.originalValue.split(/\s+/).filter(Boolean));e.mutations.forEach(function(e){return e.mutate(t)}),u(Array.from(t).filter(Boolean).join(" "),e)}function h(e){var t=e.originalValue;e.mutations.forEach(function(e){return t=e.mutate(t)}),u(t,e)}function g(e){var t=e.originalValue;e.mutations.forEach(function(e){var r=function(e){var t=e.parentSelector,r=e.insertBeforeSelector,n=document.querySelector(t);if(!n)return null;var i=r?document.querySelector(r):null;return r&&!i?null:{parentNode:n,insertBeforeNode:i}}(e.mutate());t=r||t}),u(t,e)}var f=function(e){return e.innerHTML},p=function(e,t){return e.innerHTML=t};function v(e){var t=a(e);return t.html||(t.html=l(e,"html",f,p,c)),t.html}var y=function(e){return{parentNode:e.parentElement,insertBeforeNode:e.nextElementSibling}},m=function(e,t){t.insertBeforeNode&&!t.parentNode.contains(t.insertBeforeNode)||t.parentNode.insertBefore(e,t.insertBeforeNode)};function b(e){var t=a(e);return t.position||(t.position=l(e,"position",y,m,g)),t.position}var k,S,_=function(e,t){return t?e.className=t:e.removeAttribute("class")},w=function(e){return e.className};function A(e){var t=a(e);return t.classes||(t.classes=l(e,"class",w,_,d)),t.classes}function E(e,t){var r,n=a(e);return n.attributes[t]||(n.attributes[t]=l(e,t,(r=t,function(e){var t;return null!=(t=e.getAttribute(r))?t:null}),function(e){return function(t,r){return null!==r?t.setAttribute(e,r):t.removeAttribute(e)}}(t),h)),n.attributes[t]}function I(e,t,r){if(r.isDirty){r.isDirty=!1;var n=r.virtualValue;r.mutations.length||function(e,t){var r,n,i=s.get(e);if(i)if("html"===t)null==(r=i.html)||null==(n=r.observer)||n.disconnect(),delete i.html;else if("class"===t){var o,a;null==(o=i.classes)||null==(a=o.observer)||a.disconnect(),delete i.classes}else if("position"===t){var l,u;null==(l=i.position)||null==(u=l.observer)||u.disconnect(),delete i.position}else{var c,d,h;null==(c=i.attributes)||null==(d=c[t])||null==(h=d.observer)||h.disconnect(),delete i.attributes[t]}}(e,t),r.setValue(e,n)}}function C(e,t){e.html&&I(t,"html",e.html),e.classes&&I(t,"class",e.classes),e.position&&I(t,"position",e.position),Object.keys(e.attributes).forEach(function(r){I(t,r,e.attributes[r])})}function T(){s.forEach(C)}function O(e){if("position"!==e.kind||1!==e.elements.size){var t=new Set(e.elements);document.querySelectorAll(e.selector).forEach(function(r){t.has(r)||(e.elements.add(r),function(e,t){var r=null;"html"===e.kind?r=v(t):"class"===e.kind?r=A(t):"attribute"===e.kind?r=E(t,e.attribute):"position"===e.kind&&(r=b(t)),r&&(r.mutations.push(e),r.mutationRunner(r))}(e,r))})}}function P(){o.forEach(O)}function D(){S&&S.disconnect()}function x(){"undefined"!=typeof document&&(S||(S=new MutationObserver(function(){P()})),P(),S.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!1,characterData:!1}))}function R(e){return"undefined"==typeof document?i:(o.add(e),O(e),{revert:function(){var t;(t=e).elements.forEach(function(e){return function(e,t){var r=null;if("html"===e.kind?r=v(t):"class"===e.kind?r=A(t):"attribute"===e.kind?r=E(t,e.attribute):"position"===e.kind&&(r=b(t)),r){var n=r.mutations.indexOf(e);-1!==n&&r.mutations.splice(n,1),r.mutationRunner(r)}}(t,e)}),t.elements.clear(),o.delete(t)}})}function B(e,t){return R({kind:"html",elements:new Set,mutate:t,selector:e})}function $(e,t){return R({kind:"position",elements:new Set,mutate:t,selector:e})}function M(e,t){return R({kind:"class",elements:new Set,mutate:t,selector:e})}function N(e,t,r){return n.test(t)?"class"===t||"className"===t?M(e,function(e){var t=r(Array.from(e).join(" "));e.clear(),t&&t.split(/\s+/g).filter(Boolean).forEach(function(t){return e.add(t)})}):R({kind:"attribute",attribute:t,elements:new Set,mutate:r,selector:e}):i}x();const L={html:B,classes:M,attribute:N,position:$,declarative:function(e){var t=e.selector,r=e.action,n=e.value,s=e.attribute,o=e.parentSelector,a=e.insertBeforeSelector;if("html"===s){if("append"===r)return B(t,function(e){return e+(null!=n?n:"")});if("set"===r)return B(t,function(){return null!=n?n:""})}else if("class"===s){if("append"===r)return M(t,function(e){n&&e.add(n)});if("remove"===r)return M(t,function(e){n&&e.delete(n)});if("set"===r)return M(t,function(e){e.clear(),n&&e.add(n)})}else if("position"===s){if("set"===r&&o)return $(t,function(){return{insertBeforeSelector:a,parentSelector:o}})}else{if("append"===r)return N(t,s,function(e){return null!==e?e+(null!=n?n:""):null!=n?n:""});if("set"===r)return N(t,s,function(){return null!=n?n:""});if("remove"===r)return N(t,s,function(){return null})}return i}}},656(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.default=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i},671(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e={},t,r=0){var o=(0,i.default)(l(l({},e),{},{_v6:!0}),new Uint8Array(16));if(o=(0,s.default)(o),t){for(var a=0;a<16;a++)t[r+a]=o[a];return t}return(0,n.unsafeStringify)(o)};var n=r(910),i=o(r(518)),s=o(r(343));function o(e){return e&&e.__esModule?e:{default:e}}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function l(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach(function(t){u(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function u(e,t,r){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}},706(e,t,r){"use strict";var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},n.apply(this,arguments)},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.RudderStack=void 0;var s=r(720),o=r(831),a=i(r(733)),l=function(){function e(e,t,r){void 0===t&&(t=!1);var i=this;this.analytics=new s.RudderAnalytics,this.has_identified=!1,this.has_initialized=!1,this.current_page="",this.rudderstack_anonymous_cookie_key="rudder_anonymous_id",this.getAnonymousId=function(){var e;return null===(e=document.cookie.match("(^|;)\\s*"+i.rudderstack_anonymous_cookie_key+"\\s*=\\s*([^;]+)"))||void 0===e?void 0:e.pop()},this.setCookieIfNotExists=function(){if(!i.getAnonymousId()){var e=window.location.hostname,t=["webflow.io"].some(function(t){return e.endsWith(t)})?e:e.split(".").slice(-2).join(".");document.cookie="".concat(i.rudderstack_anonymous_cookie_key,"=").concat((0,o.v6)(),"; path=/; Domain=").concat(t,"; max-age=").concat(63072e3)}},this.getUserId=function(){return i.analytics.getUserId()},this.handleCachedEvents=function(){var e=["deriv.com","deriv.team","deriv.ae"],t=e.some(function(e){return window.location.hostname.includes(e)})?".".concat(e.find(function(e){return window.location.hostname.includes(e)})):".".concat(e[0]),r=a.default.get("cached_analytics_events"),n=a.default.get("cached_analytics_page_views");try{if(r){var s=JSON.parse(r);Array.isArray(s)&&s.length>0&&(s.forEach(function(e){i.analytics.track(e.name,e.properties)}),a.default.remove("cached_analytics_events",{domain:t}))}if(n){var o=JSON.parse(n);Array.isArray(o)&&o.length>0&&(o.forEach(function(e){i.analytics.page(null==e?void 0:e.name,null==e?void 0:e.properties)}),a.default.remove("cached_analytics_page_views",{domain:t}))}}catch(e){console.log(e)}},this.init=function(e,t){var r;void 0===t&&(t=!1),e&&(t&&(r=window.define,window.define=void 0),i.setCookieIfNotExists(),i.analytics.load(e,"https://deriv-dataplane.rudderstack.com",{externalAnonymousIdCookieName:i.rudderstack_anonymous_cookie_key,onLoaded:function(){var e;t&&(window.define=r),i.has_initialized=!0,i.has_identified=!!i.getUserId(),i.handleCachedEvents(),null===(e=i.onLoadedCallback)||void 0===e||e.call(i)}}))},this.identifyEvent=function(e,t){i.getUserId()||i.analytics.identify(e,t),i.has_identified=!0},this.pageView=function(e,t,r,s){if(void 0===t&&(t="Deriv App"),i.has_initialized&&e!==i.current_page){var o=r?n({user_id:r},s):s;i.analytics.page(t,e,o),i.current_page=e}},this.reset=function(){i.has_initialized&&(i.analytics.reset(),i.has_identified=!1)},this.track=function(e,t){var r=Object.fromEntries(Object.entries(t).filter(function(e){return e[0],void 0!==e[1]}));if(i.has_initialized)try{i.analytics.track(e,r)}catch(e){console.error(e)}},this.onLoadedCallback=r,this.init(e,t)}return e.getRudderStackInstance=function(t,r,n){return void 0===r&&(r=!1),e._instance||(e._instance=new e(t,r,n)),e._instance},e}();t.RudderStack=l},707(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.clearAutoRefresh=I,t.clearCache=async function(){u.clear(),c.clear(),I(),l=!1,await p()},t.configureCache=function(e){Object.assign(i,e),i.backgroundSync||I()},t.helpers=void 0,t.onHidden=g,t.onVisible=f,t.refreshFeatures=async function(e){let{instance:t,timeout:r,skipCache:a,allowStale:c,backgroundSync:d}=e;return d||(i.backgroundSync=!1),async function(e){let{instance:t,allowStale:r,timeout:a,skipCache:c}=e;const d=v(t),g=y(t),f=new Date,p=new Date(f.getTime()-i.maxAge+i.staleTTL);await async function(){if(!l){l=!0;try{if(s.localStorage){const e=await s.localStorage.getItem(i.cacheKey);if(!i.disableCache&&e){const t=JSON.parse(e);t&&Array.isArray(t)&&t.forEach(e=>{let[t,r]=e;u.set(t,{...r,staleAt:new Date(r.staleAt)})}),m()}}}catch(e){}if(!i.disableIdleStreams){const e=o.startIdleListener();e&&(o.stopIdleListener=e)}}}();const b=i.disableCache||c?void 0:u.get(g);return b&&(r||b.staleAt>f)&&b.staleAt>p?(b.sse&&h.add(d),b.staleAt<f?k(t):S(t),{data:b.data,success:!0,source:"cache"}):await(0,n.promiseTimeout)(k(t),a)||{data:null,success:!1,source:"timeout",error:new Error("Timeout")}}({instance:t,allowStale:c,timeout:r,skipCache:a})},t.setPolyfills=function(e){Object.assign(s,e)},t.startStreaming=function(e,t){if(t.streaming){if(!e.getClientKey())throw new Error("Must specify clientKey to enable streaming");t.payload&&S(e,!0),function(e){const t=v(e),r=a.get(t)||new Set;r.add(e),a.set(t,r)}(e)}},t.unsubscribe=function(e){a.forEach(t=>t.delete(e))};var n=r(106);const i={staleTTL:6e4,maxAge:144e5,cacheKey:"gbFeaturesCache",backgroundSync:!0,maxEntries:10,disableIdleStreams:!1,idleStreamInterval:2e4,disableCache:!1},s=(0,n.getPolyfills)(),o=t.helpers={fetchFeaturesCall:e=>{let{host:t,clientKey:r,headers:n}=e;return s.fetch(`${t}/api/features/${r}`,{headers:n})},fetchRemoteEvalCall:e=>{let{host:t,clientKey:r,payload:n,headers:i}=e;const o={method:"POST",headers:{"Content-Type":"application/json",...i},body:JSON.stringify(n)};return s.fetch(`${t}/api/eval/${r}`,o)},eventSourceCall:e=>{let{host:t,clientKey:r,headers:n}=e;return n?new s.EventSource(`${t}/sub/${r}`,{headers:n}):new s.EventSource(`${t}/sub/${r}`)},startIdleListener:()=>{let e;if("undefined"==typeof window||"undefined"==typeof document)return;const t=()=>{"visible"===document.visibilityState?(window.clearTimeout(e),f()):"hidden"===document.visibilityState&&(e=window.setTimeout(g,i.idleStreamInterval))};return document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},stopIdleListener:()=>{}};try{globalThis.localStorage&&(s.localStorage=globalThis.localStorage)}catch(e){}const a=new Map;let l=!1;const u=new Map,c=new Map,d=new Map,h=new Set;function g(){d.forEach(e=>{e&&(e.state="idle",w(e))})}function f(){d.forEach(e=>{e&&"idle"===e.state&&A(e)})}async function p(){try{if(!s.localStorage)return;await s.localStorage.setItem(i.cacheKey,JSON.stringify(Array.from(u.entries())))}catch(e){}}function v(e){const[t,r]=e.getApiInfo();return`${t}||${r}`}function y(e){const t=v(e);if(!("isRemoteEval"in e)||!e.isRemoteEval())return t;const r=e.getAttributes(),n=e.getCacheKeyAttributes()||Object.keys(e.getAttributes()),i={};n.forEach(e=>{i[e]=r[e]});const s=e.getForcedVariations(),o=e.getUrl();return`${t}||${JSON.stringify({ca:i,fv:s,url:o})}`}function m(){const e=Array.from(u.entries()).map(e=>{let[t,r]=e;return{key:t,staleAt:r.staleAt.getTime()}}).sort((e,t)=>e.staleAt-t.staleAt),t=Math.min(Math.max(0,u.size-i.maxEntries),u.size);for(let r=0;r<t;r++)u.delete(e[r].key)}function b(e,t,r){const n=r.dateUpdated||"",s=new Date(Date.now()+i.staleTTL),o=i.disableCache?void 0:u.get(t);if(o&&n&&o.version===n)return o.staleAt=s,void p();i.disableCache||(u.set(t,{data:r,version:n,staleAt:s,sse:h.has(e)}),m()),p();const l=a.get(e);l&&l.forEach(e=>async function(e,t){await e.setPayload(t||e.getPayload())}(e,r))}async function k(e){const{apiHost:t,apiRequestHeaders:r}=e.getApiHosts(),n=e.getClientKey(),i="isRemoteEval"in e&&e.isRemoteEval(),s=v(e),a=y(e);let l=c.get(a);return l||(l=(i?o.fetchRemoteEvalCall({host:t,clientKey:n,payload:{attributes:e.getAttributes(),forcedVariations:e.getForcedVariations(),forcedFeatures:Array.from(e.getForcedFeatures().entries()),url:e.getUrl()},headers:r}):o.fetchFeaturesCall({host:t,clientKey:n,headers:r})).then(e=>{if(!e.ok)throw new Error(`HTTP error: ${e.status}`);return"enabled"===e.headers.get("x-sse-support")&&h.add(s),e.json()}).then(t=>(b(s,a,t),S(e),c.delete(a),{data:t,success:!0,source:"network"})).catch(e=>(c.delete(a),{data:null,source:"error",success:!1,error:e})),c.set(a,l)),l}function S(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const r=v(e),n=y(e),{streamingHost:o,streamingHostRequestHeaders:l}=e.getApiHosts(),u=e.getClientKey();if(t&&h.add(r),i.backgroundSync&&h.has(r)&&s.EventSource){if(d.has(r))return;const e={src:null,host:o,clientKey:u,headers:l,cb:t=>{try{if("features-updated"===t.type){const e=a.get(r);e&&e.forEach(e=>{k(e)})}else if("features"===t.type){const e=JSON.parse(t.data);b(r,n,e)}e.errors=0}catch(t){_(e)}},errors:0,state:"active"};d.set(r,e),A(e)}}function _(e){if("idle"!==e.state&&(e.errors++,e.errors>3||e.src&&2===e.src.readyState)){const t=Math.pow(3,e.errors-3)*(1e3+1e3*Math.random());w(e),setTimeout(()=>{["idle","active"].includes(e.state)||A(e)},Math.min(t,3e5))}}function w(e){e.src&&(e.src.onopen=null,e.src.onerror=null,e.src.close(),e.src=null,"active"===e.state&&(e.state="disabled"))}function A(e){e.src=o.eventSourceCall({host:e.host,clientKey:e.clientKey,headers:e.headers}),e.state="active",e.src.addEventListener("features",e.cb),e.src.addEventListener("features-updated",e.cb),e.src.onerror=()=>_(e),e.src.onopen=()=>{e.errors=0}}function E(e,t){w(e),d.delete(t)}function I(){h.clear(),d.forEach(E),a.clear(),o.stopIdleListener()}},720(e,t){"use strict";function r(e){return null!=e&&"object"==typeof e&&!0===e["@@functional/placeholder"]}function n(e){return function t(n){return 0===arguments.length||r(n)?t:e.apply(this,arguments)}}function i(e){return function t(i,s){switch(arguments.length){case 0:return t;case 1:return r(i)?t:n(function(t){return e(i,t)});default:return r(i)&&r(s)?t:r(i)?n(function(t){return e(t,s)}):r(s)?n(function(t){return e(i,t)}):e(i,s)}}}function s(e){return function t(s,o,a){switch(arguments.length){case 0:return t;case 1:return r(s)?t:i(function(t,r){return e(s,t,r)});case 2:return r(s)&&r(o)?t:r(s)?i(function(t,r){return e(t,o,r)}):r(o)?i(function(t,r){return e(s,t,r)}):n(function(t){return e(s,o,t)});default:return r(s)&&r(o)&&r(a)?t:r(s)&&r(o)?i(function(t,r){return e(t,r,a)}):r(s)&&r(a)?i(function(t,r){return e(t,o,r)}):r(o)&&r(a)?i(function(t,r){return e(s,t,r)}):r(s)?n(function(t){return e(t,o,a)}):r(o)?n(function(t){return e(s,t,a)}):r(a)?n(function(t){return e(s,o,t)}):e(s,o,a)}}}function o(e,t){return Object.prototype.hasOwnProperty.call(t,e)}Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});var a=n(function(e){return null===e?"Null":void 0===e?"Undefined":Object.prototype.toString.call(e).slice(8,-1)});function l(e){return"[object Object]"===Object.prototype.toString.call(e)}const u=Number.isInteger||function(e){return(0|e)===e};function c(e,t){return t[e<0?t.length+e:e]}function d(e,t,r){if(r||(r=new h),function(e){var t=typeof e;return null==e||"object"!=t&&"function"!=t}(e))return e;var n,i=function(t){var n=r.get(e);if(n)return n;for(var i in r.set(e,t),e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=d(e[i],0,r));return t};switch(a(e)){case"Object":return i(Object.create(Object.getPrototypeOf(e)));case"Array":return i(Array(e.length));case"Date":return new Date(e.valueOf());case"RegExp":return n=e,new RegExp(n.source,n.flags?n.flags:(n.global?"g":"")+(n.ignoreCase?"i":"")+(n.multiline?"m":"")+(n.sticky?"y":"")+(n.unicode?"u":"")+(n.dotAll?"s":""));case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"BigInt64Array":case"BigUint64Array":return e.slice();default:return e}}var h=function(){function e(){this.map={},this.length=0}return e.prototype.set=function(e,t){var r=this.hash(e),n=this.map[r];n||(this.map[r]=n=[]),n.push([e,t]),this.length+=1},e.prototype.hash=function(e){var t=[];for(var r in e)t.push(Object.prototype.toString.call(e[r]));return t.join()},e.prototype.get=function(e){if(this.length<=180){for(var t in this.map)for(var r=this.map[t],n=0;n<r.length;n+=1)if((s=r[n])[0]===e)return s[1]}else{var i=this.hash(e);if(r=this.map[i])for(n=0;n<r.length;n+=1){var s;if((s=r[n])[0]===e)return s[1]}}},e}(),g=n(function(e){return null!=e&&"function"==typeof e.clone?e.clone():d(e)});function f(e,t){for(var r=t,n=0;n<e.length;n+=1){if(null==r)return;var i=e[n];r=u(i)?c(i,r):r[i]}return r}var p=s(function(e,t,r){var n,i={};for(n in r=r||{},t=t||{})o(n,t)&&(i[n]=o(n,r)?e(n,t[n],r[n]):t[n]);for(n in r)o(n,r)&&!o(n,i)&&(i[n]=r[n]);return i}),v=s(function e(t,r,n){return p(function(r,n,i){return l(n)&&l(i)?e(t,n,i):t(r,n,i)},r,n)}),y=s(function(e,t,r){return v(function(t,r,n){return e(r,n)},t,r)}),m=i(f),b=i(function(e,t){var r={};for(var n in t)e(t[n],n,t)&&(r[n]=t[n]);return r});const k=e=>"function"==typeof e&&Boolean(e.constructor&&e.call&&e.apply),S=e=>"string"==typeof e,_=e=>null===e,w=e=>void 0===e,A=e=>_(e)||w(e),E=e=>!w(e),I=e=>!A(e),C=e=>{switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return e instanceof Error}},T=(e,t)=>{const r=t.split(".");return m(r,e)},O=e=>!_(e)&&"[object Object]"===Object.prototype.toString.call(e),P=(e,t)=>{if(!Array.isArray(e)||!Array.isArray(t))return g(t);const r=g(e);return t.forEach((e,t)=>{r[t]=Array.isArray(e)||(e=>!_(e)&&(e=>"object"==typeof e)(e)&&!Array.isArray(e))(e)?D(r[t],e):e}),r},D=(e,t)=>y(P,e,t),x=e=>O(e)&&Object.keys(e).length>0,R=e=>{const t=b(E,e);return Object.keys(t).forEach(e=>{const r=t[e];O(r)&&(t[e]=R(r))}),t},B=e=>{const t=b(I,e);return Object.keys(t).forEach(e=>{const r=t[e];O(r)&&(t[e]=B(r))}),t},$=e=>{if(x(e))return B(e)},M=(e,t)=>"boolean"==typeof e?e:t,N=e=>(Object.getOwnPropertyNames(e).forEach(function(t){e[t]&&"object"==typeof e[t]&&N(e[t])}),Object.freeze(e)),L=e=>e.replace(/^\.+/,""),U=e=>{let t=e;if(!S(e)&&!A(e))try{t=JSON.stringify(e)}catch(e){t=null}return t},j=(e,t,r,n,i)=>{const s={category:e,name:t,properties:r,options:n,callback:void 0};k(i)&&(s.callback=i),k(n)&&(s.category=e,s.name=t,s.properties=r,s.options=void 0,s.callback=n),k(r)&&(s.category=e,s.name=t,s.properties=void 0,s.options=void 0,s.callback=r),k(t)&&(s.category=e,s.name=void 0,s.properties=void 0,s.options=void 0,s.callback=t),k(e)&&(s.category=void 0,s.name=void 0,s.properties=void 0,s.options=void 0,s.callback=e),O(e)?(s.name=void 0,s.category=void 0,s.properties=e,k(t)?s.options=void 0:s.options=t):O(t)&&(s.name=void 0,s.properties=t,k(r)?s.options=void 0:s.options=r),S(e)&&!S(t)&&(s.category=void 0,s.name=e),E(s.category)||(s.category=void 0),E(s.name)||(s.name=void 0),s.properties=s.properties?g(s.properties):{},E(s.options)?s.options=g(s.options):s.options=void 0;const o=S(s.name)?s.name:s.properties.name,a=S(s.category)?s.category:s.properties.category;return s.properties=D(O(s.properties)?s.properties:{},{...o&&{name:o},...a&&{category:a}}),s},V=(e,t,r,n)=>{const i={name:e,properties:t,options:r,callback:void 0};return k(n)&&(i.callback=n),k(r)&&(i.properties=t,i.options=void 0,i.callback=r),k(t)&&(i.properties=void 0,i.options=void 0,i.callback=t),i.properties=I(i.properties)?g(i.properties):{},E(i.options)?i.options=g(i.options):i.options=void 0,i},F=(e,t,r,n)=>{const i={userId:e,traits:t,options:r,callback:void 0};return k(n)&&(i.callback=n),k(r)&&(i.userId=e,i.traits=t,i.options=void 0,i.callback=r),k(t)&&(i.userId=e,i.traits=void 0,i.options=void 0,i.callback=t),(O(e)||_(e))&&(i.userId=null,i.traits=e,k(t)?i.options=void 0:i.options=t),i.userId=U(i.userId),O(i.traits)?i.traits=g(i.traits):i.traits=void 0,E(i.options)?i.options=g(i.options):i.options=void 0,i},H=(e,t,r,n)=>{const i={to:e,from:t,options:r,callback:void 0};return k(n)&&(i.callback=n),k(r)&&(i.to=e,i.from=t,i.options=void 0,i.callback=r),k(t)?(i.to=e,i.from=void 0,i.options=void 0,i.callback=t):(O(t)||_(t))&&(i.to=e,i.from=void 0,i.options=t),E(i.to)&&(i.to=U(i.to)),E(i.from)?i.from=U(i.from):i.from=void 0,E(i.options)?i.options=g(i.options):i.options=void 0,i},G=(e,t,r,n)=>{const i={groupId:e,traits:t,options:r,callback:void 0};return k(n)&&(i.callback=n),k(r)&&(i.groupId=e,i.traits=t,i.options=void 0,i.callback=r),k(t)&&(i.groupId=e,i.traits=void 0,i.options=void 0,i.callback=t),(O(e)||_(e))&&(i.groupId=null,i.traits=e,k(t)?i.options=void 0:i.options=t),i.groupId=U(i.groupId),O(i.traits)?i.traits=g(i.traits):i.traits=void 0,E(i.options)?i.options=g(i.options):i.options=void 0,i};let K=function(e){return e.UNLOADED="Page Unloaded",e}({});const z="API",J="CapabilitiesManager",q="ConfigManager",W="EventManager",Q="PluginsManager",Z="UserSessionManager",Y="ErrorHandler",X="PluginEngine",ee=`Ready${z}`,te=`Load${z}`,re="AnalyticsCore";for(var ne,ie=[],se=0;se<256;se++)ie[se]=(se+256).toString(16).substring(1);for(var oe,ae=256,le=[];ae--;)le[ae]=(ae+256).toString(16).substring(1);const ue=()=>!A(globalThis.crypto)&&k(globalThis.crypto.getRandomValues)?function(){(!ne||se+16>4096)&&(ne=crypto.getRandomValues(new Uint8Array(4096)),se=0);for(var e,t=0,r="";t<16;t++)e=ne[se+t],r+=6==t?ie[15&e|64]:8==t?ie[63&e|128]:ie[e],1&t&&t>1&&t<11&&(r+="-");return se+=16,r}():function(){var e,t=0,r="";if(!oe||ae+16>256){for(oe=Array(t=256);t--;)oe[t]=256*Math.random()|0;t=ae=0}for(;t<16;t++)e=oe[ae+t],r+=6==t?le[15&e|64]:8==t?le[63&e|128]:le[e],1&t&&t>1&&t<11&&(r+="-");return ae++,r}(),ce=()=>S(globalThis.navigator.userAgent)&&/Trident.*rv:11\./.test(globalThis.navigator.userAgent),de=e=>e.toISOString(),he=":: ",ge=(e,t,r)=>`Unable to load (${S(r)?r:r.type}) the script with the id "${e}" from URL "${t}"`,fe="[Circular Reference]",pe=(e,t,r)=>{const n=[];return function(i,s){if(!(t?.includes(i)||e&&A(s))){if("object"!=typeof s||_(s))return s;for(;n.length>0&&n[n.length-1]!==this;)n.pop();return n.includes(s)?(r?.warn(((e,t)=>`JSONStringify${he}A circular reference has been detected in the object and the property "${t}" has been dropped from the output.`)(0,i)),fe):(n.push(s),s)}}},ve=(e,t,r,n)=>{try{return JSON.stringify(e,pe(t,r,n))}catch(e){return n?.warn("Failed to convert the value to a JSON string.",e),null}},ye=e=>{const t=[];return function(e,r){if((e=>"bigint"==typeof e)(r))return"[BigInt]";for(;t.length>0&&t[t.length-1]!==this;)t.pop();return t.includes(r)?fe:(t.push(r),r)}},me=(e,t)=>{const r=Array.isArray(e)?[]:{};for(const n in e)if(Object.hasOwnProperty.call(e,n)){const i=e[n],s=t.call(e,n,i);O(s)||Array.isArray(s)?r[n]=me(s,t):r[n]=s}return r},be=(e,t)=>{const r=ye(),n=r.call(e,"",e);return O(e)||Array.isArray(e)?me(e,r):n},ke="[SDK DISPATCHED ERROR]",Se=e=>{const{stack:t,stacktrace:r,"opera#sourceloc":n}=e,i=t??r??n;if(i&&"string"==typeof i)return i},_e=(e,t)=>{if(!C(e))return new Error(`${t}: ${ve(e)}`);try{const r=new(0,e.constructor)(`${t}: ${e.message}`),n=Se(e);return n&&(r.stack=n),Object.getOwnPropertyNames(e).forEach(t=>{if("message"!==t&&"stack"!==t&&"name"!==t)try{r[t]=e[t]}catch{}}),r}catch{return new Error(`${t}: ${ve(e)}`)}},we=e=>{if(C(e)){const t=Se(e);if(t){const{stack:r,stacktrace:n,"opera#sourceloc":i}=e;switch(t){case r:e.stack=`${r}\n${ke}`;break;case n:e.stacktrace=`${n}\n${ke}`;break;default:e["opera#sourceloc"]=`${i}\n${ke}`}}}globalThis.dispatchEvent(new ErrorEvent("error",{error:e,bubbles:!0,cancelable:!0,composed:!0}))},Ae="RudderLabs JavaScript SDK",Ee="3.26.0",Ie="RudderJS-Initiated",Ce="preloadedEventsBuffer",Te="ajs_aid",Oe="ajs_event",Pe=432e5,De=18e5,xe=(e="app")=>{globalThis.RudderStackGlobals||(globalThis.RudderStackGlobals={}),globalThis.RudderStackGlobals[e]||(globalThis.RudderStackGlobals[e]={})},Re=(e,t,r="app")=>{xe(r),globalThis.RudderStackGlobals[r][e]=t},Be=(e,t="app")=>(xe(t),globalThis.RudderStackGlobals[t][e]),$e=(e,t)=>{const r={};return e.forEach((n,i)=>{if(i.startsWith(t)){const n=i.substring(t.length);r[n]=e.get(i)}}),r},Me=(e,t)=>{const r=e.shift();let n;if(k(t[r])){switch(r){case"page":n=j(...e);break;case"track":n=V(...e);break;case"identify":n=F(...e);break;case"alias":n=H(...e);break;case"group":n=G(...e);break;default:t[r](...e)}n&&t[r](n)}};class Ne{constructor(e,t=1e4){this.logger=e,this.timeout=t}loadJSFile(e){const{url:t,id:r,timeout:n,async:i,callback:s,extraAttributes:o}=e,a=!k(s);((e,t,r,n=!0,i)=>new Promise((s,o)=>{document.getElementById(t)&&o(new Error((e=>`A script with the id "${e}" is already loaded. Skipping the loading of this script to prevent conflicts`)(t)));try{let a;(e=>{const t=document.getElementsByTagName("head");if(t.length>0)return void t[0]?.insertBefore(e,t[0]?.firstChild);const r=document.getElementsByTagName("script");if(r.length>0&&r[0]?.parentNode)return void r[0]?.parentNode.insertBefore(e,r[0]);const n=document.createElement("head");n.appendChild(e);const i=document.getElementsByTagName("html")[0];i?.insertBefore(n,i.firstChild)})(((e,t,r=!0,n=null,i=null,s={})=>{const o=document.createElement("script");return o.type="text/javascript",o.onload=n,o.onerror=i,o.src=e,o.id=t,o.async=r,Object.keys(s).forEach(e=>{o.setAttribute(e,s[e])}),o.setAttribute("data-loader","RS_JS_SDK"),o})(e,t,n,()=>{globalThis.clearTimeout(a),s(t)},r=>{globalThis.clearTimeout(a),o(new Error(ge(t,e,r)))},i)),a=globalThis.setTimeout(()=>{o(new Error(((e,t,r)=>`A timeout of ${r} ms occurred while trying to load the script with id "${e}" from URL "${t}"`)(t,e,r)))},r)}catch(r){o(_e(r,ge(t,e,"unknown")))}}))(t,r,n||this.timeout,i,o).then(e=>{a||s(e)}).catch(e=>{a||s(r,e)})}}var Le=Symbol.for("preact-signals");function Ue(){if(Ge>1)Ge--;else{for(var e,t=!1;void 0!==He;){var r=He;for(He=void 0,Ke++;void 0!==r;){var n=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&Qe(r))try{r.c()}catch(r){t||(e=r,t=!0)}r=n}}if(Ke=0,Ge--,t)throw e}}function je(e){if(Ge>0)return e();Ge++;try{return e()}finally{Ue()}}var Ve=void 0;function Fe(e){var t=Ve;Ve=void 0;try{return e()}finally{Ve=t}}var He=void 0,Ge=0,Ke=0,ze=0;function Je(e){if(void 0!==Ve){var t=e.n;if(void 0===t||t.t!==Ve)return t={i:0,S:e,p:Ve.s,n:void 0,t:Ve,e:void 0,x:void 0,r:t},void 0!==Ve.s&&(Ve.s.n=t),Ve.s=t,e.n=t,32&Ve.f&&e.S(t),t;if(-1===t.i)return t.i=0,void 0!==t.n&&(t.n.p=t.p,void 0!==t.p&&(t.p.n=t.n),t.p=Ve.s,t.n=void 0,Ve.s.n=t,Ve.s=t),t}}function qe(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.W=null==t?void 0:t.watched,this.Z=null==t?void 0:t.unwatched,this.name=null==t?void 0:t.name}function We(e,t){return new qe(e,t)}function Qe(e){for(var t=e.s;void 0!==t;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function Ze(e){for(var t=e.s;void 0!==t;t=t.n){var r=t.S.n;if(void 0!==r&&(t.r=r),t.S.n=t,t.i=-1,void 0===t.n){e.s=t;break}}}function Ye(e){for(var t=e.s,r=void 0;void 0!==t;){var n=t.p;-1===t.i?(t.S.U(t),void 0!==n&&(n.n=t.n),void 0!==t.n&&(t.n.p=n)):r=t,t.S.n=t.r,void 0!==t.r&&(t.r=void 0),t=n}e.s=r}function Xe(e,t){qe.call(this,void 0),this.x=e,this.s=void 0,this.g=ze-1,this.f=4,this.W=null==t?void 0:t.watched,this.Z=null==t?void 0:t.unwatched,this.name=null==t?void 0:t.name}function et(e){var t=e.u;if(e.u=void 0,"function"==typeof t){Ge++;var r=Ve;Ve=void 0;try{t()}catch(t){throw e.f&=-2,e.f|=8,tt(e),t}finally{Ve=r,Ue()}}}function tt(e){for(var t=e.s;void 0!==t;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,et(e)}function rt(e){if(Ve!==this)throw new Error("Out-of-order effect");Ye(this),Ve=e,this.f&=-2,8&this.f&&tt(this),Ue()}function nt(e,t){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32,this.name=null==t?void 0:t.name}function it(e,t){var r=new nt(e,t);try{r.c()}catch(e){throw r.d(),e}var n=r.d.bind(r);return n[Symbol.dispose]=n,n}qe.prototype.brand=Le,qe.prototype.h=function(){return!0},qe.prototype.S=function(e){var t=this,r=this.t;r!==e&&void 0===e.e&&(e.x=r,this.t=e,void 0!==r?r.e=e:Fe(function(){var e;null==(e=t.W)||e.call(t)}))},qe.prototype.U=function(e){var t=this;if(void 0!==this.t){var r=e.e,n=e.x;void 0!==r&&(r.x=n,e.e=void 0),void 0!==n&&(n.e=r,e.x=void 0),e===this.t&&(this.t=n,void 0===n&&Fe(function(){var e;null==(e=t.Z)||e.call(t)}))}},qe.prototype.subscribe=function(e){var t=this;return it(function(){var r=t.value,n=Ve;Ve=void 0;try{e(r)}finally{Ve=n}},{name:"sub"})},qe.prototype.valueOf=function(){return this.value},qe.prototype.toString=function(){return this.value+""},qe.prototype.toJSON=function(){return this.value},qe.prototype.peek=function(){var e=Ve;Ve=void 0;try{return this.value}finally{Ve=e}},Object.defineProperty(qe.prototype,"value",{get:function(){var e=Je(this);return void 0!==e&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(Ke>100)throw new Error("Cycle detected");this.v=e,this.i++,ze++,Ge++;try{for(var t=this.t;void 0!==t;t=t.x)t.t.N()}finally{Ue()}}}}),Xe.prototype=new qe,Xe.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if(32==(36&this.f))return!0;if(this.f&=-5,this.g===ze)return!0;if(this.g=ze,this.f|=1,this.i>0&&!Qe(this))return this.f&=-2,!0;var e=Ve;try{Ze(this),Ve=this;var t=this.x();(16&this.f||this.v!==t||0===this.i)&&(this.v=t,this.f&=-17,this.i++)}catch(e){this.v=e,this.f|=16,this.i++}return Ve=e,Ye(this),this.f&=-2,!0},Xe.prototype.S=function(e){if(void 0===this.t){this.f|=36;for(var t=this.s;void 0!==t;t=t.n)t.S.S(t)}qe.prototype.S.call(this,e)},Xe.prototype.U=function(e){if(void 0!==this.t&&(qe.prototype.U.call(this,e),void 0===this.t)){this.f&=-33;for(var t=this.s;void 0!==t;t=t.n)t.S.U(t)}},Xe.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;void 0!==e;e=e.x)e.t.N()}},Object.defineProperty(Xe.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=Je(this);if(this.h(),void 0!==e&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),nt.prototype.c=function(){var e=this.S();try{if(8&this.f)return;if(void 0===this.x)return;var t=this.x();"function"==typeof t&&(this.u=t)}finally{e()}},nt.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,et(this),Ze(this),Ge++;var e=Ve;return Ve=this,rt.bind(this,e)},nt.prototype.N=function(){2&this.f||(this.f|=2,this.o=He,He=this)},nt.prototype.d=function(){this.f|=8,1&this.f||tt(this)},nt.prototype.dispose=function(){this.d()};class st{constructor(){this.items=[]}enqueue(e){this.items.push(e)}dequeue(){return 0===this.items.length?null:this.items.shift()}isEmpty(){return 0===this.items.length}size(){return this.items.length}clear(){this.items=[]}}const ot={LOG:0,INFO:1,DEBUG:2,WARN:3,ERROR:4,NONE:5},at="ERROR",lt=new class{constructor(e="LOG",t="",r=console){this.minLogLevel=ot[e],this.scope=t,this.logProvider=r}log(...e){this.outputLog("LOG",e)}info(...e){this.outputLog("INFO",e)}debug(...e){this.outputLog("DEBUG",e)}warn(...e){this.outputLog("WARN",e)}error(...e){this.outputLog("ERROR",e)}outputLog(e,t){this.minLogLevel<=ot[e]&&this.logProvider[e.toLowerCase()]?.(...this.formatLogData(t))}setScope(e){this.scope=e||this.scope}setMinLogLevel(e){this.minLogLevel=ot[e],w(this.minLogLevel)&&(this.minLogLevel=ot.LOG)}formatLogData(e){if(Array.isArray(e)&&e.length>0){let t="%c RS SDK";this.scope&&(t=`${t} - ${this.scope}`),t=`${t} %c ${S(e[0])?e[0].trim():""}`;const r=[t,"font-weight: bold; background: black; color: white;","font-weight: normal;"];return S(e[0])||r.push(e[0]),r.push(...e.slice(1)),r}return e}};let ut=function(e){return e.HANDLEDEXCEPTION="handledException",e.UNHANDLEDEXCEPTION="unhandledException",e.UNHANDLEDREJECTION="unhandledPromiseRejection",e}({});const ct=["localStorage","memoryStorage","cookieStorage","sessionStorage","none"],dt="cookieStorage",ht="Unable to process/parse source configuration response",gt="Failed to log breadcrumb",ft="Failed to fetch the source config",pt=e=>`${e}${he}The provided callback parameter is not a function.`,vt=(e,t,r)=>`${e} due to timeout or no connection (${t?t.type:""}) at the client side for URL: ${r}`,yt="Failed to set/remove cookies via server. As a fallback, the cookies will be managed client side.",mt={All:!0},bt="js-integrations",kt="plugins",St=new RegExp("^(https?:\\/\\/)(((([a-zA-Z\\d]([a-zA-Z\\d-]*[a-zA-Z\\d])*)\\.)+[a-zA-Z]{2,}|localhost|((25[0-5]|2[0-4][0-9]|[0-1]?[0-9]?[0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[0-1]?[0-9]?[0-9]?)))(\\:\\d+)?(\\/[-a-zA-Z\\d%_.~+]*)*(\\?[;&a-zA-Z\\d%_.~+=-]*)?(\\#[-a-zA-Z\\d_]*)?$"),_t="modern",wt="https://cdn.rudderlabs.com",At="v3",Et=`${wt}/${At}/${_t}/${bt}`,It=`${wt}/${At}/${_t}/${kt}`,Ct="https://api.rudderstack.com",Tt="v3",Ot="xhr",Pt={iubenda:"IubendaConsentManager",oneTrust:"OneTrustConsentManager",ketch:"KetchConsentManager",custom:"CustomConsentManager"},Dt={[Tt]:"StorageEncryption",legacy:"StorageEncryptionLegacy"},xt={[Ot]:"XhrQueue",beacon:"BeaconQueue"},Rt=We(g({configUrl:Ct,loadIntegration:!0,sessions:{autoTrack:!0,timeout:De,cutOff:{enabled:!1}},sameSiteCookie:"Lax",polyfillIfRequired:!0,integrations:mt,useBeacon:!1,beaconQueueOptions:{},destinationsQueueOptions:{},queueOptions:{},lockIntegrationsVersion:!0,lockPluginsVersion:!0,uaChTrackLevel:"none",plugins:[],useGlobalIntegrationsConfigInEvents:!1,bufferDataPlaneEventsUntilReady:!1,dataPlaneEventsBufferTimeout:1e4,storage:{encryption:{version:Tt},migrate:!0,cookie:{}},sendAdblockPage:!1,sameDomainCookiesOnly:!1,secureCookie:!1,sendAdblockPageOptions:{},useServerSideCookies:!1})),Bt=N({userId:"",userTraits:{},anonymousId:"",groupId:"",groupTraits:{},initialReferrer:"",initialReferringDomain:"",sessionInfo:{},authToken:null}),$t=N({entries:{userId:!0,userTraits:!0,groupId:!0,groupTraits:!0,sessionInfo:!0,authToken:!0,anonymousId:!1,initialReferrer:!1,initialReferringDomain:!1}}),Mt={userId:We(Bt.userId),userTraits:We(Bt.userTraits),anonymousId:We(Bt.anonymousId),groupId:We(Bt.groupId),groupTraits:We(Bt.groupTraits),initialReferrer:We(Bt.initialReferrer),initialReferringDomain:We(Bt.initialReferringDomain),sessionInfo:We(Bt.sessionInfo),authToken:We(Bt.authToken)},Nt={isOnline:We(!0),storage:{isLocalStorageAvailable:We(!1),isCookieStorageAvailable:We(!1),isSessionStorageAvailable:We(!1)},isBeaconAvailable:We(!1),isLegacyDOM:We(!1),isUaCHAvailable:We(!1),isCryptoAvailable:We(!1),isIE11:We(!1),isAdBlockerDetectionInProgress:We(!1),isAdBlocked:We(void 0),cspBlockedURLs:We([])},Lt={isErrorReportingEnabled:We(!1),isMetricsReportingEnabled:We(!1),breadcrumbs:We([])},Ut=We(void 0),jt={activeDataplaneUrl:We(void 0),integrationsCDNPath:We(Et),pluginsCDNPath:We(It),sourceConfigUrl:We(void 0),status:We(void 0),initialized:We(!1),logLevel:We(at),loaded:We(!1),readyCallbacks:We([]),writeKey:We(void 0),dataPlaneUrl:We(void 0),safeAnalyticsInstance:We(void 0)},Vt={enabled:We(!1),initialized:We(!1),data:We({}),activeConsentManagerPluginName:We(void 0),preConsent:We({enabled:!1}),postConsent:We({}),resolutionStrategy:We("and"),provider:We(void 0),metadata:We(void 0)},Ft={retries:We(0),dropped:We(0),sent:We(0),queued:We(0),triggered:We(0),metricsServiceUrl:We(void 0)},Ht={app:We({name:Ae,namespace:"com.rudderlabs.javascript",version:Ee,installType:"npm"}),traits:We(null),library:We({name:Ae,version:Ee,snippetVersion:globalThis.RudderSnippetVersion}),userAgent:We(null),device:We(null),network:We(null),os:We({name:"",version:""}),locale:We(null),screen:We({density:0,width:0,height:0,innerWidth:0,innerHeight:0}),"ua-ch":We(void 0),timezone:We(void 0)},Gt={configuredDestinations:We([]),activeDestinations:We([]),loadOnlyIntegrations:We({}),failedDestinations:We([]),loadIntegration:We(!0),initializedDestinations:We([]),clientDestinationsReady:We(!1),integrationsConfig:We({})},Kt={toBeProcessedArray:We([]),readyCallbacksArray:We([])},zt={ready:We(!1),loadedPlugins:We([]),failedPlugins:We([]),pluginsToLoadFromConfig:We([]),activePlugins:We([]),totalPluginsToLoad:We(0)},Jt={encryptionPluginName:We(void 0),migrate:We(!1),type:We(void 0),cookie:We(void 0),entries:We({}),trulyAnonymousTracking:We(!1)},qt={isEnabledServerSideCookies:We(!1),dataServiceUrl:We(void 0)},Wt={eventsQueuePluginName:We(void 0),deliveryEnabled:We(!0)},Qt={enabled:We(!1),pageLifecycle:{enabled:We(!1),pageViewId:We(void 0),pageLoadedTimestamp:We(void 0)}},Zt={...g({capabilities:Nt,consents:Vt,context:Ht,eventBuffer:Kt,lifecycle:jt,loadOptions:Rt,metrics:Ft,nativeDestinations:Gt,plugins:zt,reporting:Lt,session:Mt,source:Ut,storage:Jt,serverCookies:qt,dataPlaneEvents:Wt,autoTrack:Qt})};function Yt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Xt,er,tr={exports:{}},rr={exports:{}};var nr=(er||(er=1,function(e){var t,r,n,i;e.exports=(Xt||(Xt=1,function(e){e.exports=function(){function e(e){return!isNaN(parseFloat(e))&&isFinite(e)}function t(e){return e.charAt(0).toUpperCase()+e.substring(1)}function r(e){return function(){return this[e]}}var n=["isConstructor","isEval","isNative","isToplevel"],i=["columnNumber","lineNumber"],s=["fileName","functionName","source"],o=n.concat(i,s,["args"],["evalOrigin"]);function a(e){if(e)for(var r=0;r<o.length;r++)void 0!==e[o[r]]&&this["set"+t(o[r])](e[o[r]])}a.prototype={getArgs:function(){return this.args},setArgs:function(e){if("[object Array]"!==Object.prototype.toString.call(e))throw new TypeError("Args must be an Array");this.args=e},getEvalOrigin:function(){return this.evalOrigin},setEvalOrigin:function(e){if(e instanceof a)this.evalOrigin=e;else{if(!(e instanceof Object))throw new TypeError("Eval Origin must be an Object or StackFrame");this.evalOrigin=new a(e)}},toString:function(){var e=this.getFileName()||"",t=this.getLineNumber()||"",r=this.getColumnNumber()||"",n=this.getFunctionName()||"";return this.getIsEval()?e?"[eval] ("+e+":"+t+":"+r+")":"[eval]:"+t+":"+r:n?n+" ("+e+":"+t+":"+r+")":e+":"+t+":"+r}},a.fromString=function(e){var t=e.indexOf("("),r=e.lastIndexOf(")"),n=e.substring(0,t),i=e.substring(t+1,r).split(","),s=e.substring(r+1);if(0===s.indexOf("@"))var o=/@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(s,""),l=o[1],u=o[2],c=o[3];return new a({functionName:n,args:i||void 0,fileName:l,lineNumber:u||void 0,columnNumber:c||void 0})};for(var l=0;l<n.length;l++)a.prototype["get"+t(n[l])]=r(n[l]),a.prototype["set"+t(n[l])]=function(e){return function(t){this[e]=Boolean(t)}}(n[l]);for(var u=0;u<i.length;u++)a.prototype["get"+t(i[u])]=r(i[u]),a.prototype["set"+t(i[u])]=function(t){return function(r){if(!e(r))throw new TypeError(t+" must be a Number");this[t]=Number(r)}}(i[u]);for(var c=0;c<s.length;c++)a.prototype["get"+t(s[c])]=r(s[c]),a.prototype["set"+t(s[c])]=function(e){return function(t){this[e]=String(t)}}(s[c]);return a}()}(rr)),t=rr.exports,r=/(^|@)\S+:\d+/,n=/^\s*at .*(\S+:\d+|\(native\))/m,i=/^(eval@)?(\[native code])?$/,{parse:function(e){if(void 0!==e.stacktrace||void 0!==e["opera#sourceloc"])return this.parseOpera(e);if(e.stack&&e.stack.match(n))return this.parseV8OrIE(e);if(e.stack)return this.parseFFOrSafari(e);throw new Error("Cannot parse given Error object")},extractLocation:function(e){if(-1===e.indexOf(":"))return[e];var t=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));return[t[1],t[2]||void 0,t[3]||void 0]},parseV8OrIE:function(e){return e.stack.split("\n").filter(function(e){return!!e.match(n)},this).map(function(e){e.indexOf("(eval ")>-1&&(e=e.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(,.*$)/g,""));var r=e.replace(/^\s+/,"").replace(/\(eval code/g,"(").replace(/^.*?\s+/,""),n=r.match(/ (\(.+\)$)/);r=n?r.replace(n[0],""):r;var i=this.extractLocation(n?n[1]:r),s=n&&r||void 0,o=["eval","<anonymous>"].indexOf(i[0])>-1?void 0:i[0];return new t({functionName:s,fileName:o,lineNumber:i[1],columnNumber:i[2],source:e})},this)},parseFFOrSafari:function(e){return e.stack.split("\n").filter(function(e){return!e.match(i)},this).map(function(e){if(e.indexOf(" > eval")>-1&&(e=e.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),-1===e.indexOf("@")&&-1===e.indexOf(":"))return new t({functionName:e});var r=/((.*".+"[^@]*)?[^@]*)(?:@)/,n=e.match(r),i=n&&n[1]?n[1]:void 0,s=this.extractLocation(e.replace(r,""));return new t({functionName:i,fileName:s[0],lineNumber:s[1],columnNumber:s[2],source:e})},this)},parseOpera:function(e){return!e.stacktrace||e.message.indexOf("\n")>-1&&e.message.split("\n").length>e.stacktrace.split("\n").length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9:function(e){for(var r=/Line (\d+).*script (?:in )?(\S+)/i,n=e.message.split("\n"),i=[],s=2,o=n.length;s<o;s+=2){var a=r.exec(n[s]);a&&i.push(new t({fileName:a[2],lineNumber:a[1],source:n[s]}))}return i},parseOpera10:function(e){for(var r=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,n=e.stacktrace.split("\n"),i=[],s=0,o=n.length;s<o;s+=2){var a=r.exec(n[s]);a&&i.push(new t({functionName:a[3]||void 0,fileName:a[2],lineNumber:a[1],source:n[s]}))}return i},parseOpera11:function(e){return e.stack.split("\n").filter(function(e){return!!e.match(r)&&!e.match(/^Error created at/)},this).map(function(e){var r,n=e.split("@"),i=this.extractLocation(n.pop()),s=n.shift()||"",o=s.replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0;s.match(/\(([^)]*)\)/)&&(r=s.replace(/^[^(]+\(([^)]*)\)$/,"$1"));var a=void 0===r||"[arguments not available]"===r?void 0:r.split(",");return new t({functionName:o,args:a,fileName:i[0],lineNumber:i[1],columnNumber:i[2],source:e})},this)}})}(tr)),tr.exports);const ir=Yt(nr),sr="global code",or=e=>S(e)?e:"";function ar(e,t,r,n){return{errorClass:or(e),message:`${r}${or(t)}`,type:"browserjs",stacktrace:n.reduce((e,t)=>{const r=(e=>{const t={file:e.fileName,method:(r=e.functionName,E(r)&&/^global code$/i.test(r)?sr:r),lineNumber:e.lineNumber,columnNumber:e.columnNumber};var r;return t.lineNumber&&t.lineNumber>-1&&!t.file&&!t.method&&(t.file=sr),t})(t);try{return"{}"===JSON.stringify(r)?e:e.concat(r)}catch{return e}},[])}}const lr=(e,t)=>{let r;var n,i;return C(e)&&S(Se(e))?r=e:(t.warn((n=Y,i=ve(e),`${n}${he}Ignoring a non-error: ${i}.`)),r=void 0),r},ur=(e,t)=>{try{return JSON.parse(e||"")}catch(e){t(_e(e,"Failed to parse response data"))}},cr="The request failed",dr=[new RegExp(`${cr}.*`),/A script with the id .* is already loaded\./],hr=[/Failed to fetch dynamically imported module: .*/,/Unable to load \(.*\) the script with the id .*/,/A timeout of \d+ ms occurred while trying to load the script with id .*/],gr={headers:{Accept:"application/json","Content-Type":"application/json;charset=UTF-8"},method:"GET"},fr=(e,t,r)=>{const n=D(gr,t||{});return r&&(n.headers=D(n.headers,{Authorization:r})),n.url=e,n},pr=(e,t=1e4,r)=>new Promise((n,i)=>{let s;if(!0===e.sendRawData)s=e.data;else if(s=ve(e.data,!1,[],r),_(s))return void i({error:new Error("Failed to prepare data for the request."),undefined:void 0,options:e});const o=new XMLHttpRequest,a=t=>{i({error:new Error(vt(cr,t,e.url)),xhr:o,options:e,..."timeout"===t?.type?{timedOut:!0}:{}})};o.ontimeout=a,o.onerror=a,o.onload=()=>{var t,r,s,a,l;o.status>=200&&o.status<400?n({response:o.responseText,xhr:o,options:e}):i({error:new Error((t=cr,r=o.status,s=o.statusText,a=e.url,l=o.responseText,`${t} with status ${r} (${s}) for URL: ${a}. Response: ${l.trim()}`)),xhr:o,options:e})},o.open(e.method,e.url,!0),!0===e.withCredentials&&(o.withCredentials=!0),o.timeout=t,Object.keys(e.headers).forEach(t=>{e.headers[t]&&o.setRequestHeader(t,e.headers[t])});try{o.send(s)}catch(t){i({error:_e(t,(l=cr,u=e.url,`${l} for URL: ${u}`)),xhr:o,options:e})}var l,u}),vr=new class{constructor(e){this.logger=e,this.onError=this.onError.bind(this)}init(e){this.errorHandler=e}async getData(e){const{url:t,options:r,timeout:n,isRawResponse:i}=e;try{const e=await pr(fr(t,r,this.basicAuthHeader),n,this.logger);return{data:i?e.response:ur(e.response,this.onError),details:e}}catch(e){return{data:void 0,details:e}}}getAsyncData(e){const{callback:t,url:r,options:n,timeout:i,isRawResponse:s}=e,o=!k(t);pr(fr(r,n,this.basicAuthHeader),i,this.logger).then(e=>{o||t(s?e.response:ur(e.response,this.onError),e)}).catch(e=>{o||t(void 0,e)})}onError(e,t){this.errorHandler?.onError({error:e,context:"HttpClient",groupingHash:t})}setAuthHeader(e,t=!1){const r=t?e:(e=>(e=>{const t=Array.from(e,e=>String.fromCodePoint(e)).join("");return globalThis.btoa(t)})((new TextEncoder).encode(e)))(`${e}:`);this.basicAuthHeader=`Basic ${r}`}resetAuthHeader(){this.basicAuthHeader=void 0}}(lt),yr=["www.test-host.com","localhost","127.0.0.1","[::1]"],mr=["userId","userTraits","groupId","groupTraits","anonymousId","config","integration","eventBuffer","traits","authToken"],br=e=>{Zt.capabilities.isAdBlockerDetectionInProgress.value=!0;try{const t=new URL(Zt.lifecycle.sourceConfigUrl.value),r=`${t.origin}${t.pathname}?view=ad`;e.getAsyncData({url:r,options:{method:"HEAD",headers:{"Content-Type":void 0}},isRawResponse:!0,callback:(e,t)=>{Zt.capabilities.isAdBlockerDetectionInProgress.value=!1,Zt.capabilities.isAdBlocked.value=void 0!==t?.error||t?.xhr?.responseURL!==r}})}catch(e){throw Zt.capabilities.isAdBlockerDetectionInProgress.value=!1,e}},kr=(e=()=>window.location.hostname)=>{const t=e();return!t||t&&yr.includes(t)?"development":"production"},Sr=e=>{const t=ve(e,!1,mr);return null!==t?JSON.parse(t):{}},_r=(e,t,r,n)=>({id:`${e.value?.id??r.writeKey.value}..${t.sessionInfo.value.id??"NA"}..${n.pageLifecycle.pageViewId.value??"NA"}`,name:e.value?.name??"NA"}),wr=(e,t)=>({locale:e.value??"NA",userAgent:t.value??"NA",time:new Date}),Ar=(e,t,r)=>{const n={version:"1",message_id:ue(),source:{name:"js",sdk_version:t.context.app.value.version,write_key:t.lifecycle.writeKey.value,install_type:t.context.app.value.installType,category:r??"sdk"},errors:e};return ve(n)},Er=new class{initialized=!1;constructor(e,t){this.httpClient=e,this.logger=t}init(){this.initialized||(this.attachErrorListeners(),this.initialized=!0)}attachErrorListeners(){globalThis.addEventListener("error",e=>{this.onError({error:e,context:Y,errorType:ut.UNHANDLEDEXCEPTION})}),globalThis.addEventListener("unhandledrejection",e=>{this.onError({error:e,context:Y,errorType:ut.UNHANDLEDREJECTION})}),document.addEventListener("securitypolicyviolation",e=>{const t=S(e.blockedURI)?e.blockedURI:"";"enforce"===e.disposition&&t.startsWith(wt)&&!Zt.capabilities.cspBlockedURLs.value.includes(t)&&(Zt.capabilities.cspBlockedURLs.value=[...Zt.capabilities.cspBlockedURLs.value,t])})}async onError(e){try{const{error:t,context:r,customMessage:n,groupingHash:i,category:s}=e,o=e.errorType??ut.HANDLEDEXCEPTION,a=((e,t)=>{switch(t){case ut.UNHANDLEDEXCEPTION:{const{error:t}=e;return t||e}case ut.UNHANDLEDREJECTION:return e.reason;case ut.HANDLEDEXCEPTION:default:return e}})(t,o),l=lr(a,this.logger);if(w(l))return;const u=((e,t)=>{try{const r=ir.parse(e);return ar(e.name,e.message,t,r)}catch{return ar(e.name,e.message,t,[])}})(l,`${r}${he}${n?`${n} - `:""}`),c=Se(l).includes(ke);if(!c&&!(e=>{const t=e.stacktrace[0]?.file;if(!t||"string"!=typeof t)return!1;const r=t.substring(t.lastIndexOf("/")+1),n=t.split("/");return n[n.length-2]===bt||["rsa"].some(e=>r.startsWith(e)&&r.endsWith(".js"))})(u)&&o!==ut.HANDLEDEXCEPTION)return;if(Zt.reporting.isErrorReportingEnabled.value&&await((e,t,r)=>{const n=e.message;return new Promise(e=>{if(hr.some(e=>e.test(n))){const i=/https?:\/\/[^\s"'(),;<>[\]{}]+/.exec(n)?.[0];S(i)?i.startsWith(wt)?t.capabilities.cspBlockedURLs.value.includes(i)?e(!1):((e,t,r)=>{if(w(e.capabilities.isAdBlocked.value)){!1===e.capabilities.isAdBlockerDetectionInProgress.value&&br(t);const n=it(()=>{E(e.capabilities.isAdBlocked.value)&&(r(!1===e.capabilities.isAdBlocked.value),n())})}else r(!1===e.capabilities.isAdBlocked.value)})(t,r,e):e(!1):e(!0)}else e(!dr.some(e=>e.test(n)))})})(u,Zt,this.httpClient)){const e={severity:"error",unhandled:o!==ut.HANDLEDEXCEPTION,severityReason:{type:o}},t=((e,t,r,n)=>{let i;if("cdn"!==r.context.app.value.installType)return i;if(E(e))if(S(e))i=e;else{const r=lr(e,n);i=E(r)?r.message:t}else i=t;return i})(i,u.message,Zt,this.logger),r=((e,t,r,n)=>{const{context:i,lifecycle:s,session:o,source:a,reporting:l,autoTrack:u}=r,{app:c,locale:d,userAgent:h,timezone:f,screen:p,library:v}=i;return{payloadVersion:"5",notifier:{name:"RudderStack JavaScript SDK",version:c.value.version,url:"git+https://github.com/rudderlabs/rudder-sdk-js.git"},events:[{exceptions:[g(e)],severity:t.severity,unhandled:t.unhandled,severityReason:t.severityReason,app:{version:c.value.version,releaseStage:kr(),type:c.value.installType},device:wr(d,h),request:{url:globalThis.location.href.split("?")[0],clientIp:"[NOT COLLECTED]"},breadcrumbs:g(l.breadcrumbs.value),context:e.message,groupingHash:n,metaData:{app:{snippetVersion:v.value.snippetVersion},device:{...p.value,timezone:f.value},...Sr(r)},user:_r(a,o,s,u)}]}})(u,e,Zt,t);this.httpClient.getAsyncData({url:Zt.metrics.metricsServiceUrl.value,options:{method:"POST",data:Ar(r,Zt,s),sendRawData:!0},isRawResponse:!0})}(o===ut.HANDLEDEXCEPTION||c)&&this.logger.error(u.message)}catch(e){this.logger.error(`${Y}${he}Failed to handle the error.`,e)}}leaveBreadcrumb(e){try{Zt.reporting.breadcrumbs.value=[...Zt.reporting.breadcrumbs.value,(t=e,{type:"manual",name:t,timestamp:new Date,metaData:{}})]}catch(e){this.onError({error:e,context:Y,customMessage:gt,groupingHash:gt})}var t}}(vr,lt),Ir=new class{plugins=[];byName={};cache={};config={throws:!0};constructor(e,t={}){this.config={throws:!0,...t},this.logger=e}register(e,t){if(!e.name){const t=`${X}${he}Plugin name is missing.`;if(this.config.throws)throw new Error(t);return void this.logger.error(t,e)}if(this.byName[e.name]){const t=(r=X,n=e.name,`${r}${he}Plugin "${n}" already exists.`);if(this.config.throws)throw new Error(t);return void this.logger.error(t)}var r,n;this.cache={},this.plugins=this.plugins.slice();let i=this.plugins.length;this.plugins.forEach((t,r)=>{t.deps?.includes(e.name)&&(i=Math.min(i,r))}),this.plugins.splice(i,0,e),this.byName[e.name]=e,k(e.initialize)&&e.initialize(t)}unregister(e){const t=this.byName[e];if(!t){const t=`${X}${he}Plugin "${e}" not found.`;if(this.config.throws)throw new Error(t);return void this.logger.error(t)}const r=this.plugins.indexOf(t);if(-1===r){const t=`${X}${he}Plugin "${e}" not found in plugins but found in byName. This indicates a bug in the plugin engine. Please report this issue to the development team.`;if(this.config.throws)throw new Error(t);return void this.logger.error(t)}this.cache={},delete this.byName[e],this.plugins=this.plugins.slice(),this.plugins.splice(r,1)}getPlugin(e){return this.byName[e]}getPlugins(e){const t=e??".";return this.cache[t]||(this.cache[t]=this.plugins.filter(e=>{if(e.deps?.some(e=>!this.byName[e])){const t=e.deps.filter(e=>!this.byName[e]);return this.logger.error(((e,t,r)=>`${e}${he}Plugin "${t}" could not be loaded because some of its dependencies "${r}" do not exist.`)(X,e.name,t)),!1}return"."===t||((e,t)=>Boolean(T(e,t)))(e,t)})),this.cache[t]}processRawPlugins(e){e(this.plugins),this.cache={}}invoke(e,t=!0,...r){let n=e;if(!n)throw new Error("Failed to invoke plugin because the extension point name is missing.");const i=n.startsWith("!"),s=this.config.throws??n.endsWith("!");if(n=n.replace(/(^!|!$)/g,""),!n)throw new Error("Failed to invoke plugin because the extension point name is invalid.");const o=n.split(".");o.pop();const a=o.join(".");return(t?this.getPlugins(n):[this.getPlugins(n)[0]]).map(e=>{const t=T(e,n);if(!k(t)||i)return t;try{return t.apply(T(e,a),r)}catch(t){if(s)throw t;this.logger.error(((e,t,r)=>`${e}${he}Failed to invoke the "${t}" extension point of plugin "${r}".`)(X,n,e.name),t)}return null})}invokeSingle(e,...t){return this.invoke(e,!1,...t)[0]}invokeMultiple(e,...t){return this.invoke(e,!0,...t)}}(lt,{throws:!0}),Cr=e=>Boolean("cloud"!==e.config.connectionMode||!0===e.config.useNativeSDKToSend||!0===e.config.useNativeSDK),Tr=e=>e.filter(Cr),Or=["BeaconQueue","CustomConsentManager","DeviceModeDestinations","DeviceModeTransformation","ExternalAnonymousId","GoogleLinker","IubendaConsentManager","KetchConsentManager","NativeDestinationQueue","OneTrustConsentManager","StorageEncryption","StorageEncryptionLegacy","StorageMigrator","XhrQueue"],Pr=["Bugsnag","ErrorReporting"],Dr={rudderAnalyticsRemotePlugins:{url:()=>Promise.resolve(window.RudderStackGlobals&&window.RudderStackGlobals.app&&window.RudderStackGlobals.app.pluginsCDNPath?`${window.RudderStackGlobals.app.pluginsCDNPath}/rsa-plugins.js`:"https://cdn.rudderlabs.com/v3/modern/plugins//rsa-plugins.js"),format:"esm",from:"vite"}};function xr(e,t){const r=Object.assign(e,t);for(const e of Object.keys(r))"object"==typeof r[e]&&"object"==typeof t[e]&&(r[e]=xr(r[e],t[e]));return r}const Rr=e=>xr({},(globalThis.__federation_shared__||{}).default||{});function Br(e,t){if(!e?.default&&t){let t=Object.create(null);return t.default=e,t.__esModule=!0,t}return e}function $r(e,t){return async function(e){const t=Dr[e];return t.inited?t.lib:["esm","systemjs"].includes(t.format)?new Promise((e,r)=>{("function"==typeof t.url?t.url:()=>Promise.resolve(t.url))().then(n=>{import(n).then(r=>{if(!t.inited){const e=Rr();r.init(e),t.lib=r,t.lib.init(e),t.inited=!0}e(t.lib)}).catch(r)})}):void 0}(e).then(e=>e.get(t).then(e=>e()))}const Mr=e=>(e=>{const t={};return e.forEach(e=>{if(Or.includes(e)){const r=(e=>{switch(e){case"BeaconQueue":return()=>$r("rudderAnalyticsRemotePlugins","./BeaconQueue").then(e=>Br(e,!0));case"CustomConsentManager":return()=>$r("rudderAnalyticsRemotePlugins","./CustomConsentManager").then(e=>Br(e,!0));case"DeviceModeDestinations":return()=>$r("rudderAnalyticsRemotePlugins","./DeviceModeDestinations").then(e=>Br(e,!0));case"DeviceModeTransformation":return()=>$r("rudderAnalyticsRemotePlugins","./DeviceModeTransformation").then(e=>Br(e,!0));case"ExternalAnonymousId":return()=>$r("rudderAnalyticsRemotePlugins","./ExternalAnonymousId").then(e=>Br(e,!0));case"GoogleLinker":return()=>$r("rudderAnalyticsRemotePlugins","./GoogleLinker").then(e=>Br(e,!0));case"KetchConsentManager":return()=>$r("rudderAnalyticsRemotePlugins","./KetchConsentManager").then(e=>Br(e,!0));case"IubendaConsentManager":return()=>$r("rudderAnalyticsRemotePlugins","./IubendaConsentManager").then(e=>Br(e,!0));case"NativeDestinationQueue":return()=>$r("rudderAnalyticsRemotePlugins","./NativeDestinationQueue").then(e=>Br(e,!0));case"OneTrustConsentManager":return()=>$r("rudderAnalyticsRemotePlugins","./OneTrustConsentManager").then(e=>Br(e,!0));case"StorageEncryption":return()=>$r("rudderAnalyticsRemotePlugins","./StorageEncryption").then(e=>Br(e,!0));case"StorageEncryptionLegacy":return()=>$r("rudderAnalyticsRemotePlugins","./StorageEncryptionLegacy").then(e=>Br(e,!0));case"StorageMigrator":return()=>$r("rudderAnalyticsRemotePlugins","./StorageMigrator").then(e=>Br(e,!0));case"XhrQueue":return()=>$r("rudderAnalyticsRemotePlugins","./XhrQueue").then(e=>Br(e,!0));default:return}})(e);r&&(t[e]=r)}}),t})?.(e)||{},Nr={};class Lr{constructor(e,t,r){this.engine=e,this.errorHandler=t,this.logger=r,this.onError=this.onError.bind(this)}init(){Zt.lifecycle.status.value="pluginsLoading",Re("pluginsCDNPath",Zt.lifecycle.pluginsCDNPath.value),this.setActivePlugins(),this.registerLocalPlugins(),this.registerRemotePlugins(),this.attachEffects()}attachEffects(){it(()=>{(0===Zt.plugins.activePlugins.value.length||Zt.plugins.loadedPlugins.value.length+Zt.plugins.failedPlugins.value.length===Zt.plugins.totalPluginsToLoad.value)&&je(()=>{Zt.plugins.ready.value=!0,Zt.lifecycle.status.value="pluginsReady"})})}getPluginsToLoadBasedOnConfig(){let e=Zt.plugins.pluginsToLoadFromConfig.value;if(!e)return[];e=e.filter(e=>!Pr.includes(e)||(this.logger.warn(((e,t)=>`${e}${he}${t} plugin is deprecated. Please exclude it from the load API options.`)(Q,e)),!1));return[{configurationStatus:()=>E(Zt.dataPlaneEvents.eventsQueuePluginName.value),configurationStatusStr:"Data plane events delivery is enabled",activePluginName:Zt.dataPlaneEvents.eventsQueuePluginName.value,supportedPlugins:Object.values(xt),shouldAddMissingPlugins:!0},{configurationStatus:()=>Tr(Zt.nativeDestinations.configuredDestinations.value).length>0,configurationStatusStr:"Device mode destinations are connected to the source",supportedPlugins:["DeviceModeDestinations","NativeDestinationQueue"]},{configurationStatus:()=>Tr(Zt.nativeDestinations.configuredDestinations.value).some(e=>e.shouldApplyDeviceModeTransformation),configurationStatusStr:"Device mode transformations are enabled for at least one destination",supportedPlugins:["DeviceModeTransformation"]},{configurationStatus:()=>E(Zt.consents.activeConsentManagerPluginName.value),configurationStatusStr:"Consent management is enabled",activePluginName:Zt.consents.activeConsentManagerPluginName.value,supportedPlugins:Object.values(Pt)},{configurationStatus:()=>E(Zt.storage.encryptionPluginName.value),configurationStatusStr:"Storage encryption is enabled",activePluginName:Zt.storage.encryptionPluginName.value,supportedPlugins:Object.values(Dt)},{configurationStatus:()=>Zt.storage.migrate.value,configurationStatusStr:"Storage migration is enabled",supportedPlugins:["StorageMigrator"]}].forEach(t=>{t.configurationStatus()?(e=e.filter(t.activePluginName?e=>!(e!==t.activePluginName&&t.supportedPlugins.includes(e)):e=>E(e)),this.addMissingPlugins(t,!1,e)):e=e.filter(void 0!==t.basePlugins?e=>!(t.basePlugins.includes(e)||t.supportedPlugins.includes(e)):e=>!t.supportedPlugins.includes(e))}),[...Object.keys({}),...e]}addMissingPlugins(e,t,r){const n=e.shouldAddMissingPlugins||t;let i;i=e.activePluginName?[...e.basePlugins||[],e.activePluginName]:[...e.supportedPlugins];const s=i.filter(e=>!r.includes(e));s.length>0&&(n&&r.push(...s),this.logger.warn(((e,t,r,n)=>{const i=1===r.length,s=i?` '${r[0]}' plugin was`:` ['${r.join("', '")}'] plugins were`,o=`${e}${he}${t}, but${s} not configured to load.`;return n?`${o} So, ${i?"the plugin":"those plugins"} will be loaded automatically.`:`${o} Ignore if this was intentional. Otherwise, consider adding ${i?"it":"them"} to the 'plugins' load API option.`})(Q,e.configurationStatusStr,s,n)))}setActivePlugins(){const e=this.getPluginsToLoadBasedOnConfig(),t=[...Object.keys(Nr),...Or],r=[],n=[];e.forEach(e=>{t.includes(e)?r.push(e):n.push(e)}),n.length>0&&this.logger.warn(`${Q}${he}Ignoring unknown plugins: ${n.join(", ")}.`),je(()=>{Zt.plugins.totalPluginsToLoad.value=e.length,Zt.plugins.activePlugins.value=r,Zt.plugins.failedPlugins.value=n})}registerLocalPlugins(){Object.values(Nr).forEach(e=>{k(e)&&Zt.plugins.activePlugins.value.includes(e().name)&&this.register([e()])})}registerRemotePlugins(){const e=(t=Zt.plugins.activePlugins.value,{...Mr(t)});var t;Promise.all(Object.keys(e).map(async t=>{await e[t]().then(e=>this.register([e.default()])).catch(e=>{Zt.plugins.failedPlugins.value=[...Zt.plugins.failedPlugins.value,t],this.onError(e,`Failed to load plugin "${t}"`,e)})})).catch(e=>{this.onError(e)})}invokeMultiple(e,...t){try{return this.engine.invokeMultiple(e,...t)}catch(t){return this.onError(t,e),[]}}invokeSingle(e,...t){try{return this.engine.invokeSingle(e,...t)}catch(t){return this.onError(t,e),null}}register(e){e.forEach(e=>{try{this.engine.register(e,Zt)}catch(t){Zt.plugins.failedPlugins.value=[...Zt.plugins.failedPlugins.value,e.name],this.onError(t,`Failed to register plugin "${e.name}"`)}})}unregisterLocalPlugins(){Object.values(Nr).forEach(e=>{try{this.engine.unregister(e().name)}catch(t){this.onError(t,`Failed to unregister plugin "${e().name}"`)}})}onError(e,t,r){this.errorHandler.onError({error:e,context:Q,customMessage:t,groupingHash:r})}}const Ur="cookieStorage",jr="localStorage",Vr="sessionStorage",Fr="memoryStorage",Hr="none",Gr={userId:"rl_user_id",userTraits:"rl_trait",anonymousId:"rl_anonymous_id",groupId:"rl_group_id",groupTraits:"rl_group_trait",initialReferrer:"rl_page_init_referrer",initialReferringDomain:"rl_page_init_referring_domain",sessionInfo:"rl_session",authToken:"rl_auth_token"},Kr="clientDataInCookie",zr="clientDataInLocalStorage",Jr="clientDataInSessionStorage",qr=["userId","userTraits","anonymousId","groupId","groupTraits","initialReferrer","initialReferringDomain","sessionInfo","authToken"],Wr={[Ur]:Kr,[jr]:zr,[Fr]:"clientDataInMemory",[Vr]:Jr},Qr=(e,t)=>{try{return encodeURIComponent(e)}catch(e){return void t?.error("Failed to encode the cookie data.",e)}},Zr=e=>{try{return decodeURIComponent(e)}catch(e){return}},Yr=()=>(e=>{const t={},r=e.split(/\s*;\s*/);let n;return r[0]?(r.forEach(e=>{n=e.split("=");const r=n[0]?Zr(n[0]):void 0;r&&(t[r]=n[1]?Zr(n[1]):void 0)}),t):t})(globalThis.document.cookie),Xr=function(e,t,r,n){switch(arguments.length){case 4:case 3:case 2:return((e,t,r,n)=>{const i={...r||{}};let s=`${Qr(e,n)}=${Qr(t,n)}`;_(t)&&(i.maxage=-1),i.maxage&&(i.expires=new Date(+new Date+i.maxage)),i.path&&(s+=`; path=${i.path}`),i.domain&&(s+=`; domain=${i.domain}`),i.expires&&(s+=`; expires=${i.expires.toUTCString()}`),i.samesite&&(s+=`; samesite=${i.samesite}`),i.secure&&(s+="; secure"),globalThis.document.cookie=s})(e,t,r,n);case 1:return e?(e=>Yr()[e])(e):Yr();default:return Yr()}},en=()=>{const e=`.${(()=>{const e=(e=>{const t="function"!=typeof globalThis.URL?(e=>{const t=document.createElement("a");return t.href=e,t.hostname})(e):new URL(e).hostname,r=t?.split(".")??[],n=r[r.length-1],i=[];if(4===r.length&&n&&n===parseInt(n,10).toString())return i;if(r.length<=1)return r[0]&&-1!==r[0].indexOf("localhost")?["localhost"]:i;for(let e=r.length-2;e>=0;e-=1)i.push(r.slice(e).join("."));return i})(globalThis.location.href);for(let t=0;t<e.length;t+=1){const r=e[t],n="__tld__",i={domain:`${-1!==r.indexOf("localhost")?"":"."}${r}`};try{if(Xr(n,1,i),Xr(n))return Xr(n,null,i),r}catch{try{Xr(n,null,i)}catch{}}}return""})()}`;return{maxage:31536e6,path:"/",domain:e&&"."!==e?e:void 0,samesite:"Lax",enabled:!0}},tn=new class{isEnabled=!0;length=0;data={};constructor(e){this.options={enabled:!0},this.logger=e}configure(e){return this.options=D(this.options,e??{}),this.isEnabled=Boolean(this.options.enabled),this.options}setItem(e,t){return this.data[e]=t,this.length=Object.keys(this.data).length,t}getItem(e){return e in this.data?this.data[e]:null}removeItem(e){return e in this.data&&delete this.data[e],this.length=Object.keys(this.data).length,null}clear(){this.data={},this.length=0}key(e){return this.keys()[e]??null}keys(){return Object.keys(this.data)}}(lt);var rn,nn={exports:{}},sn=(rn||(rn=1,function(e){e.exports=function(){function e(e){return e=JSON.stringify(e),!!/^\{[\s\S]*\}$/.test(e)}function t(e){if("string"==typeof e)try{return JSON.parse(e)}catch(t){return e}}function r(e){return"[object Function]"==={}.toString.call(e)}var n=function(e){var t="_Is_Incognit";try{e||(e=window.localStorage),e.setItem(t,"yes"),e.removeItem(t)}catch(t){var r={_data:{},setItem:function(e,t){return r._data[e]=String(t)},getItem:function(e){return r._data.hasOwnProperty(e)?r._data[e]:void 0},removeItem:function(e){return delete r._data[e]},clear:function(){return r._data={}}};e=r}finally{"yes"===e.getItem(t)&&e.removeItem(t)}return e}();function i(){if(!(this instanceof i))return new i}i.prototype={set:function(t,r){if(t&&!e(t))n.setItem(t,function(e){return void 0===e||"function"==typeof e?e+"":JSON.stringify(e)}(r));else if(e(t))for(var i in t)this.set(i,t[i]);return this},get:function(e){if(void 0===e){var r={};return this.forEach(function(e,t){return r[e]=t}),r}if("?"===e.charAt(0))return this.has(e.substr(1));var i=arguments;if(i.length>1){for(var s={},o=0,a=i.length;o<a;o++){var l=t(n.getItem(i[o]));this.has(i[o])&&(s[i[o]]=l)}return s}return t(n.getItem(e))},clear:function(){return n.clear(),this},remove:function(e){var t=this.get(e);return n.removeItem(e),t},has:function(e){return{}.hasOwnProperty.call(this.get(),e)},keys:function(){var e=[];return this.forEach(function(t){e.push(t)}),e},forEach:function(e){for(var t=0,r=n.length;t<r;t++){var i=n.key(t);e(i,this.get(i))}return this},search:function(e){for(var t=this.keys(),r={},n=0,i=t.length;n<i;n++)t[n].indexOf(e)>-1&&(r[t[n]]=this.get(t[n]));return r},len:function(){return n.length}};var s=null;function o(t,n){var a,l=arguments,u=null;if(s||(s=i()),0===l.length)return s.get();if(1===l.length){if("string"==typeof t)return s.get(t);if(e(t))return s.set(t)}if(2===l.length&&"string"==typeof t){if(!n)return s.remove(t);if(n&&"string"==typeof n)return s.set(t,n);n&&r(n)&&(u=null,u=n(t,s.get(t)),o.set(t,u))}if(2===l.length&&(a=t,"[object Array]"===Object.prototype.toString.call(a))&&r(n))for(var c=0,d=t.length;c<d;c++)u=n(t[c],s.get(t[c])),o.set(t[c],u);return o}for(var a in i.prototype)o[a]=i.prototype[a];return o}()}(nn)),nn.exports);const on=Yt(sn),an=e=>e instanceof DOMException&&(["QuotaExceededError","NS_ERROR_DOM_QUOTA_REACHED"].includes(e.name)||[22,1014].includes(e.code)),ln=(e=jr,t,r)=>{let n,i;const s=`${J}${he}The "${e}" storage type is `;let o,a="unavailable",l=!0;try{switch(e){case Fr:return!0;case Ur:n=t,i="test_rudder_cookie";break;case jr:n=t??globalThis.localStorage,i="test_rudder_ls";break;case Vr:n=t??globalThis.sessionStorage,i="test_rudder_ss";break;default:return!1}if(n&&(n.setItem(i,"true"),n.getItem(i)))return n.removeItem(i),!0;l=!1}catch(e){l=!1,o=e,an(e)&&(a="full")}return l||r?.warn(`${s}${a}.`,o),!1},un=new class{isSupportAvailable=!0;isEnabled=!0;length=0;constructor(e){this.options={enabled:!0},this.logger=e}configure(e){return this.options=D(this.options,e??{}),this.isSupportAvailable=ln(jr),this.isEnabled=Boolean(this.options.enabled&&this.isSupportAvailable),this.options}setItem(e,t){on.set(e,t),this.length=on.len()}getItem(e){const t=on.get(e);return w(t)?null:t}removeItem(e){on.remove(e),this.length=on.len()}clear(){on.clear(),this.length=0}key(e){return this.keys()[e]??null}keys(){return on.keys()}}(lt),cn=new class{isSupportAvailable=!0;isEnabled=!0;length=0;constructor(e){this.options={enabled:!0},this.logger=e}configure(e){return this.options=D(this.options,e??{}),this.isSupportAvailable=ln(Vr),this.isSupportAvailable&&(this.store=globalThis.sessionStorage),this.isEnabled=Boolean(this.options.enabled&&this.isSupportAvailable),this.options}setItem(e,t){this.store&&(this.store.setItem(e,t),this.length=this.store.length)}getItem(e){if(!this.store)return null;const t=this.store.getItem(e);return w(t)?null:t}removeItem(e){this.store&&(this.store.removeItem(e),this.length=this.store.length)}clear(){this.store?.clear(),this.length=0}key(e){return this.store?.key(e)??null}keys(){const e=[];if(!this.store)return e;for(let t=0;t<this.store.length;t+=1){const r=this.store.key(t);null!==r&&e.push(r)}return e}}(lt),dn=new class{isSupportAvailable=!0;isEnabled=!0;length=0;constructor(e){this.logger=e}configure(e){return this.options||(this.options=en()),this.options=D(this.options,e??{}),this.options.sameDomainCookiesOnly&&delete this.options.domain,this.isSupportAvailable=ln(Ur,this),this.isEnabled=Boolean(this.options.enabled&&this.isSupportAvailable),this.options}setItem(e,t){return Xr(e,t,this.options,this.logger),this.length=Object.keys(Xr()).length,!0}getItem(e){const t=Xr(e);return w(t)?null:t}removeItem(e){const t=this.setItem(e,null);return this.length=Object.keys(Xr()).length,t}clear(){}key(e){return this.keys()[e]??null}keys(){return Object.keys(Xr())}}(lt),hn=e=>{switch(e){case jr:return un;case Vr:return cn;case Fr:return tn;case Ur:return dn;default:return tn}};class gn{constructor(e,t,r){this.id=e.id,this.name=e.name,this.isEncrypted=e.isEncrypted??!1,this.validKeys=e.validKeys??{},this.engine=t,this.noKeyValidation=0===Object.keys(this.validKeys).length,this.noCompoundKey=e.noCompoundKey,this.originalEngine=this.engine,this.errorHandler=e.errorHandler,this.logger=e.logger,this.pluginsManager=r}createValidKey(e){const{name:t,id:r,validKeys:n,noKeyValidation:i,noCompoundKey:s}=this;if(i)return s?e:[t,r,e].join(".");let o;return Object.values(n).forEach(n=>{n===e&&(o=s?e:[t,r,e].join("."))}),o}swapQueueStoreToInMemoryEngine(){const{name:e,id:t,validKeys:r,noCompoundKey:n}=this,i=hn(Fr);Object.keys(r).forEach(s=>{const o=this.get(r[s]),a=n?s:[e,t,s].join(".");i.setItem(a,o),this.remove(s)}),this.engine=i}set(e,t){const r=this.createValidKey(e);if(r)try{this.engine.setItem(r,this.encrypt(ve(t,!1,[],this.logger)))}catch(r){if(an(r))this.logger.warn(`Store ${this.id}${he}The storage is either full or unavailable, so the data will not be persisted. Switching to in-memory storage.`),this.swapQueueStoreToInMemoryEngine(),this.set(e,t);else{const t=(e=>`Failed to save the value for "${e}" to storage`)(e);this.onError(r,t,t)}}}get(e){const t=this.createValidKey(e);let r;try{return t?(r=this.decrypt(this.engine.getItem(t)),A(r)||""===r?null:JSON.parse(r)):null}catch(t){const r=(e=>`Failed to retrieve or parse data for "${e}" from storage`)(e);return this.onError(t,r,r),null}}remove(e){const t=this.createValidKey(e);t&&this.engine.removeItem(t)}getOriginalEngine(){return this.originalEngine}decrypt(e){return A(e)?null:this.crypto(e,"decrypt")}encrypt(e){return this.crypto(e,"encrypt")}crypto(e,t){const r=!this.isEncrypted||!e||"string"!=typeof e||""===(e=>e.replace(/^\s+|\s+$/gm,""))(e);if(r)return e;const n=`storage.${t}`,i=this.pluginsManager?this.pluginsManager.invokeSingle(n,e):e;return void 0===i?e:i??""}onError(e,t,r){this.errorHandler.onError({error:e,context:`Store ${this.id}`,customMessage:t,groupingHash:r})}}class fn{stores={};isInitialized=!1;constructor(e,t,r){this.errorHandler=t,this.logger=r,this.pluginsManager=e}init(){if(this.isInitialized)return;const e=Zt.loadOptions.value,t={cookieStorageOptions:{samesite:e.sameSiteCookie,secure:e.secureCookie,domain:e.setCookieDomain,sameDomainCookiesOnly:e.sameDomainCookiesOnly},localStorageOptions:{},inMemoryStorageOptions:{},sessionStorageOptions:{}};((e={},t={},r={},n={})=>{var i;(e=>{const t=dn.configure(e);Zt.storage.cookie.value={maxage:t.maxage,path:t.path,domain:t.domain,samesite:t.samesite,expires:t.expires,secure:t.secure}})(e),i=t,un.configure(i),(e=>{tn.configure(e)})(r),(e=>{cn.configure(e)})(n)})(R(D(t.cookieStorageOptions??{},Zt.storage.cookie?.value??{})),R(t.localStorageOptions),R(t.inMemoryStorageOptions),R(t.sessionStorageOptions)),this.initClientDataStores(),this.isInitialized=!0}initClientDataStores(){this.initializeStorageState(),[Fr,jr,Ur,Vr].forEach(e=>{hn(e)?.isEnabled&&this.setStore({id:Wr[e],name:Wr[e],isEncrypted:!0,noCompoundKey:!0,type:e,errorHandler:this.errorHandler,logger:this.logger})})}initializeStorageState(){let e=Zt.storage.type.value,t=Zt.loadOptions.value.storage?.entries;const r=Zt.consents.postConsent.value.storage;(E(r?.type)||E(r?.entries))&&(e=r?.type,t=r?.entries);let n=!0,i={};qr.forEach(r=>{const s=r,o=r,a=t?.[s]?.type,l=((e,t)=>{let r;if(e.consents.preConsent.value.enabled)switch(e.consents.preConsent.value.storage?.strategy){case"none":r=Hr;break;case"session":"sessionInfo"!==t&&(r=Hr);break;case"anonymousId":"anonymousId"!==t&&(r=Hr)}return r})(Zt,r),u=l??a??e??dt,c=this.getResolvedStorageTypeForEntry(u,r);c!==Hr&&(n=!1),i={...i,[r]:{type:c,key:Gr[o]}}}),je(()=>{Zt.storage.type.value=e,Zt.storage.entries.value=i,Zt.storage.trulyAnonymousTracking.value=n})}getResolvedStorageTypeForEntry(e,t){let r=e;switch(e){case jr:hn(jr)?.isEnabled||(r=Fr);break;case Vr:hn(Vr)?.isEnabled||(r=Fr);break;case Fr:case Hr:break;default:r=hn(Ur)?.isEnabled?Ur:hn(jr)?.isEnabled?jr:hn(Vr)?.isEnabled?Vr:Fr}return r!==e&&this.logger.warn(((e,t,r,n)=>`StoreManager${he}The storage type "${r}" is not available for entry "${t}". The SDK will initialize the entry with "${n}" storage type instead.`)(0,t,e,r)),r}setStore(e){const t=hn(e.type);return this.stores[e.id]=new gn(e,t,this.pluginsManager),this.stores[e.id]}getStore(e){return this.stores[e]}}const pn=e=>{const t=new URL(e),{host:r,protocol:n}=t,i=r.split(".");let s;return s=i.length>2?`${i[i.length-2]}.${i[i.length-1]}`:r,{topDomain:s,protocol:n}},vn=e=>e?.endsWith("/")?vn(e.substring(0,e.length-1)):e,yn=e=>{try{return new URL(e).host}catch(e){return null}},mn=e=>yn(e)??"",bn=e=>{const t={};try{const r=new URL(e),n="utm_";r.searchParams.forEach((e,r)=>{if(r.startsWith(n)){let i=r.substring(n.length);"campaign"===i&&(i="name"),t[i]=e}})}catch(e){}return t},kn=e=>{if(!S(e))return!1;try{return k(globalThis.URL)&&new URL(e),St.test(e)}catch(e){return!1}},Sn="none",_n="immediate",wn=e=>x(e)||Array.isArray(e),An=(e,t)=>{let r,n,i=[],s=[],o=!1,a=!0===e?.enabled;x(e)&&a&&(({provider:n,consentManagerPluginName:r}=((e,t)=>{let{provider:r}=e;const n=r?Pt[r]:void 0;var i;return r&&!n&&(t.error((i=Pt,`${q}${he}The consent manager "${r}" is not supported. Please choose one of the following supported consent managers: "${Object.keys(i)}".`)),r=void 0),{provider:r,consentManagerPluginName:n}})(e,t)),wn(e.allowedConsentIds)&&(i=e.allowedConsentIds,o=!0),wn(e.deniedConsentIds)&&(s=e.deniedConsentIds,o=!0));const l={allowedConsentIds:i,deniedConsentIds:s};return a=a&&Boolean(r),{provider:n,consentManagerPluginName:r,initialized:o,enabled:a,consentsData:l}},En=e=>{const{useServerSideCookies:t,dataServiceEndpoint:r,storage:n,setCookieDomain:i,sameDomainCookiesOnly:s}=Zt.loadOptions.value;let o,a=n?.cookie,l=!1;if(t){l=t;const n=a.domain??i,u=E(n)&&!(e=>{const{topDomain:t}=pn(window.location.href);return t===e})(L(n))||s,c=((e,t)=>`${t?window.location.origin:(e=>{const{topDomain:t,protocol:r}=pn(e);return`${r}//${t}`})(window.location.href)}/${e.startsWith("/")?e.substring(1):e}`)(r??"rsaRequest",u);if(kn(c)){o=vn(c);const t=yn(window.location.href),r=yn(c);t!==r&&(a={...a,samesite:"None",secure:!0}),!s&&u&&r!==L(n)&&(l=!1,e.warn(((e,t,r)=>`${e}${he}The provided cookie domain (${t}) does not match the current webpage's domain (${r}). Hence, the cookies will be set client-side.`)(q,n,r)))}else l=!1}return{sscEnabled:l,cookieOptions:a,finalDataServiceUrl:o}},In=(e,t,r,n,i,s,o)=>{let a;if(s){if(!kn(s))return o.error(`${q}${he}The base URL "${s}" for ${e} is not valid.`),null;a=vn(s)}else if(a=r,"cdn"===Zt.context.app.value.installType){const e=(()=>{const e=document.querySelector("script[data-rsa-write-key]");if(e&&e.dataset.rsaWriteKey===Zt.lifecycle.writeKey.value)return e.src;const t=document.getElementsByTagName("script"),r=/(?:^|\/)rsa(\.min)?\.js$/;for(const e of t){const t=e.getAttribute("src");if(t&&r.test(t))return t}})();e&&(a=e.split("/").slice(0,-1).concat(t).join("/"))}return i&&(a=a.replace(new RegExp(`/${At}/${_t}/${t}$`),`/${n}/${_t}/${t}`)),a};class Cn{constructor(e,t,r){this.errorHandler=t,this.logger=r,this.httpClient=e,this.onError=this.onError.bind(this),this.processConfig=this.processConfig.bind(this)}attachEffects(){it(()=>{this.logger.setMinLogLevel(Zt.lifecycle.logLevel.value)})}init(){const{logLevel:e,configUrl:t,lockIntegrationsVersion:r,lockPluginsVersion:n,destSDKBaseURL:i,pluginsSDKBaseURL:s,integrations:o}=Zt.loadOptions.value,a=((e,t,r,n)=>In("integrations",bt,Et,e,t,r,n))(Ee,r,i,this.logger);if(_(a))return;let l;l=((e,t,r,n)=>In("plugins",kt,It,e,t,r,n))(Ee,n,s,this.logger),null!==l&&(this.attachEffects(),Zt.lifecycle.activeDataplaneUrl.value=vn(Zt.lifecycle.dataPlaneUrl.value),(e=>{const{storage:t}=Zt.loadOptions.value;let r=t?.type;E(r)&&!(e=>"string"==typeof e&&ct.includes(e))(r)&&(e.warn(((e,t,r)=>`${e}${he}The storage type "${t}" is not supported. Please choose one of the following supported types: "${ct}". The default type "${r}" will be used instead.`)(q,r,dt)),r=dt);let n=t?.encryption?.version;const i=n&&Dt[n];var s,o;!w(n)&&w(i)?(e.warn((s=Dt,o=Tt,`${q}${he}The storage encryption version "${n}" is not supported. Please choose one of the following supported versions: "${Object.keys(s)}". The default version "${o}" will be used instead.`)),n=Tt):w(n)&&(n=Tt);const a=t?.migrate,l=a&&n===Tt;!0===a&&l!==a&&e.warn(((e,t,r)=>`${e}${he}The storage data migration has been disabled because the configured storage encryption version (${t}) is not the latest (${r}). To enable storage data migration, please update the storage encryption version to the latest version.`)(q,n,Tt));const{sscEnabled:u,finalDataServiceUrl:c,cookieOptions:d}=En(e);je(()=>{Zt.storage.type.value=r,Zt.storage.cookie.value=d,Zt.serverCookies.isEnabledServerSideCookies.value=u,Zt.serverCookies.dataServiceUrl.value=c,Zt.storage.encryptionPluginName.value=Dt[n],Zt.storage.migrate.value=l})})(this.logger),(e=>{const{provider:t,consentManagerPluginName:r,initialized:n,enabled:i,consentsData:s}=An(Zt.loadOptions.value.consentManagement,e),o=Zt.loadOptions.value.preConsent;let a=o?.storage?.strategy??Sn;var l,u;E(a)&&!["none","session","anonymousId"].includes(a)&&(a=Sn,e.warn((l=q,u=o?.storage?.strategy,`${l}${he}The pre-consent storage strategy "${u}" is not supported. Please choose one of the following supported strategies: "none, session, anonymousId". The default strategy "${Sn}" will be used instead.`)));let c=o?.events?.delivery??_n;E(c)&&!["immediate","buffer"].includes(c)&&(c=_n,e.warn(((e,t,r)=>`${e}${he}The pre-consent events delivery type "${t}" is not supported. Please choose one of the following supported types: "immediate, buffer". The default type "${r}" will be used instead.`)(q,o?.events?.delivery,_n))),je(()=>{Zt.consents.activeConsentManagerPluginName.value=r,Zt.consents.initialized.value=n,Zt.consents.enabled.value=i,Zt.consents.data.value=s,Zt.consents.provider.value=t,Zt.consents.preConsent.value={enabled:!0===Zt.loadOptions.value.preConsent?.enabled&&!1===n&&!0===i,storage:{strategy:a},events:{delivery:c}}})})(this.logger),(e=>{if(Zt.dataPlaneEvents.deliveryEnabled.value){const t="XhrQueue";let r=t;Zt.loadOptions.value.useBeacon&&(Zt.capabilities.isBeaconAvailable.value?r="BeaconQueue":(r=t,e.warn(`${q}${he}The Beacon API is not supported by your browser. The events will be sent using XHR instead.`))),je(()=>{Zt.dataPlaneEvents.eventsQueuePluginName.value=r})}})(this.logger),je(()=>{Zt.lifecycle.integrationsCDNPath.value=a,Zt.lifecycle.pluginsCDNPath.value=l,e&&(Zt.lifecycle.logLevel.value=e),Zt.lifecycle.sourceConfigUrl.value=((e,t,r,n,i)=>{const s=new URLSearchParams({p:"npm",v:Ee,build:_t,writeKey:t,lockIntegrationsVersion:r.toString(),lockPluginsVersion:n.toString()});let o=Ct,a=s,l="/sourceConfig/",u="";if(kn(e)){const t=new URL(e);vn(t.pathname).endsWith("/sourceConfig")||(t.pathname=`${vn(t.pathname)}/sourceConfig/`),t.pathname=t.pathname.replace(/\/{2,}/g,"/"),s.forEach((e,r)=>{null===t.searchParams.get(r)&&t.searchParams.set(r,e)}),o=t.origin,l=t.pathname,a=t.searchParams,u=t.hash}else i.warn(((e,t)=>`${e}${he}The provided source config URL "${t}" is invalid. Using the default source config URL instead.`)(q,e));return`${o}${l}?${a}${u}`})(t,Zt.lifecycle.writeKey.value,r,n,this.logger),Zt.metrics.metricsServiceUrl.value=`${Zt.lifecycle.activeDataplaneUrl.value}/rsaMetrics`,Zt.nativeDestinations.loadOnlyIntegrations.value=o}),this.getConfig())}onError(e,t,r){this.errorHandler.onError({error:e,context:q,customMessage:t,groupingHash:r})}processConfig(e,t){if(!E(e))return void(E(t)?this.onError(t.error,ft):this.onError(new Error(ft)));let r;try{r=S(e)?JSON.parse(e):e}catch(e){return void this.onError(e,ht)}if(!(e=>O(e)&&O(e.source)&&!A(e.source.id)&&O(e.source.config)&&Array.isArray(e.source.destinations))(r))return void this.onError(new Error(ht));if(!1===r.source.enabled)return void this.logger.error("The source is disabled. Please enable the source in the dashboard to send events.");(e=>{var t;Zt.reporting.isErrorReportingEnabled.value=(t=e.source.config,!0===t?.statsCollection?.errors?.enabled&&!window.chrome?.runtime?.id),Zt.reporting.isMetricsReportingEnabled.value=(e=>!0===e?.statsCollection?.metrics?.enabled)(e.source.config)})(r);const n=r.source.destinations.length>0?r.source.destinations.map(e=>{return{id:e.id,displayName:e.destinationDefinition.displayName,enabled:e.enabled,config:e.config,shouldApplyDeviceModeTransformation:e.shouldApplyDeviceModeTransformation??!1,propagateEventsUntransformedOnError:e.propagateEventsUntransformedOnError??!1,userFriendlyId:(t=e.destinationDefinition.displayName,r=e.id,`${t.replaceAll(" ","-")}___${r}`),isCustomIntegration:"Custom Device Mode"===e.destinationDefinition.displayName};var t,r}):[];je(()=>{Zt.source.value={config:r.source.config,name:r.source.name,id:r.source.id,workspaceId:r.source.workspaceId},Zt.nativeDestinations.configuredDestinations.value=n,Zt.plugins.pluginsToLoadFromConfig.value=Zt.loadOptions.value.plugins??[],(e=>{let t,r=Zt.consents.resolutionStrategy.value;O(e.consentManagementMetadata)&&(Zt.consents.provider.value&&(r=e.consentManagementMetadata.providers.find(e=>e.provider===Zt.consents.provider.value)?.resolutionStrategy??Zt.consents.resolutionStrategy.value),t=e.consentManagementMetadata),"custom"===Zt.consents.provider.value&&(r=void 0),je(()=>{Zt.consents.metadata.value=g(t),Zt.consents.resolutionStrategy.value=r})})(r),Zt.lifecycle.status.value="configured"})}getConfig(){const e=Zt.loadOptions.value.getSourceConfig;if(e){if(!k(e))return void this.logger.error((t=q,`${t}${he}The "getSourceConfig" load API option must be a function that returns valid source configuration data.`));const r=e();r instanceof Promise?r.then(e=>this.processConfig(e)).catch(e=>{this.onError(e,"SourceConfig")}):this.processConfig(r)}else this.httpClient.getAsyncData({url:Zt.lifecycle.sourceConfigUrl.value,options:{headers:{"Content-Type":void 0}},callback:this.processConfig});var t}}const Tn=(e=()=>document)=>e()?.referrer||"$direct",On=(e=()=>globalThis.location,t=()=>document)=>{const r=e(),n=((e=()=>document)=>{const t=e().getElementsByTagName("link");let r="";for(let e=0;t[e];e+=1){const n=t[e];if("canonical"===n.getAttribute("rel")&&!r){r=n.getAttribute("href")??"";break}}return r})(t);let i=r.pathname;const{href:s}=r;let o=s;const{search:a}=r;if(n)try{const e=new URL(n);o=""===e.search?n+a:n,i=e.pathname}catch(e){}const l=(e=>{let t=e;try{const r=new URL(e);t=r.origin+r.pathname+r.search}catch(e){}return t})(o),{title:u}=t(),c=Tn(t);return{path:i,referrer:c,referring_domain:mn(c),search:a,title:u,url:l,tab_url:s}},Pn={URL:()=>!k(globalThis.URL)||!k(globalThis.URLSearchParams),Promise:()=>!k(globalThis.Promise),"Number.isNaN":()=>!k(globalThis.Number.isNaN),"Number.isInteger":()=>!k(globalThis.Number.isInteger),"Array.from":()=>!k(globalThis.Array.from),"Array.prototype.find":()=>!k(globalThis.Array.prototype.find),"Array.prototype.includes":()=>!k(globalThis.Array.prototype.includes),"String.prototype.endsWith":()=>!k(globalThis.String.prototype.endsWith),"String.prototype.startsWith":()=>!k(globalThis.String.prototype.startsWith),"String.prototype.includes":()=>!k(globalThis.String.prototype.includes),"String.prototype.replaceAll":()=>!k(globalThis.String.prototype.replaceAll),"String.fromCodePoint":()=>!k(globalThis.String.fromCodePoint),"Object.entries":()=>!k(globalThis.Object.entries),"Object.values":()=>!k(globalThis.Object.values),"Object.assign":()=>!k(globalThis.Object.assign),"Object.fromEntries":()=>!k(globalThis.Object.fromEntries),"Element.prototype.dataset":()=>!(()=>{const e=globalThis.document.createElement("div");return e.setAttribute("data-a-b","c"),!!e.dataset&&"c"===e.dataset.aB})(),TextEncoder:()=>!k(globalThis.TextEncoder)||!k(globalThis.TextDecoder),requestAnimationFrame:()=>!k(globalThis.requestAnimationFrame)||!k(globalThis.cancelAnimationFrame),CustomEvent:()=>!k(globalThis.CustomEvent),"navigator.sendBeacon":()=>!k(globalThis.navigator.sendBeacon),ArrayBuffer:()=>!k(globalThis.Uint8Array),Set:()=>!k(globalThis.Set),atob:()=>!k(globalThis.atob)},Dn=`https://polyfill-fastly.io/v3/polyfill.min.js?version=3.111.0&features=${Object.keys(Pn).join("%2C")}`,xn="rudderstackPolyfill",Rn=()=>!A(globalThis.navigator.userAgentData),Bn=()=>{let e={density:0,width:0,height:0,innerWidth:0,innerHeight:0};return e={width:globalThis.screen.width,height:globalThis.screen.height,density:globalThis.devicePixelRatio,innerWidth:globalThis.innerWidth,innerHeight:globalThis.innerHeight},e};class $n{constructor(e,t,r){this.httpClient=e,this.errorHandler=t,this.logger=r,this.externalSrcLoader=new Ne(this.logger),this.onError=this.onError.bind(this),this.onReady=this.onReady.bind(this)}init(){this.prepareBrowserCapabilities(),this.attachWindowListeners()}detectBrowserCapabilities(){je(()=>{Zt.capabilities.storage.isCookieStorageAvailable.value=ln(Ur,hn(Ur),this.logger),Zt.capabilities.storage.isLocalStorageAvailable.value=ln(jr,void 0,this.logger),Zt.capabilities.storage.isSessionStorageAvailable.value=ln(Vr,void 0,this.logger),Zt.capabilities.isBeaconAvailable.value=!A(globalThis.navigator.sendBeacon)&&k(globalThis.navigator.sendBeacon),Zt.capabilities.isUaCHAvailable.value=Rn(),Zt.capabilities.isCryptoAvailable.value=!A(globalThis.crypto)&&k(globalThis.crypto.getRandomValues),Zt.capabilities.isIE11.value=ce(),Zt.capabilities.isOnline.value=globalThis.navigator.onLine,Zt.context.userAgent.value=((e=()=>globalThis.navigator)=>{const t=e();if(w(t))return null;let{userAgent:r}=t;const{brave:n}=t;if(n&&Object.getPrototypeOf(n).isBrave){const e=r.match(/(chrome)\/([\w.]+)/i);e&&(r=`${r} Brave/${e[2]}`)}return r})(),Zt.context.locale.value=((e=()=>globalThis.navigator)=>{const t=e();return w(t)?null:t.language??t.browserLanguage})(),Zt.context.screen.value=Bn(),Zt.context.timezone.value=(()=>{const e=/([A-Z]+[+-]\d+)/.exec((new Date).toString());return e?.[1]?e[1]:"NA"})(),Rn()&&((e,t="none")=>{"none"===t&&e(void 0),"default"===t&&e(navigator.userAgentData),"full"===t&&navigator.userAgentData?.getHighEntropyValues(["architecture","bitness","brands","mobile","model","platform","platformVersion","uaFullVersion","fullVersionList","wow64"]).then(t=>{e(t)}).catch(()=>{e()})})(e=>{Zt.context["ua-ch"].value=e},Zt.loadOptions.value.uaChTrackLevel)}),it(()=>{!0===Zt.loadOptions.value.sendAdblockPage&&void 0!==Zt.lifecycle.sourceConfigUrl.value&&br(this.httpClient)})}prepareBrowserCapabilities(){Zt.capabilities.isLegacyDOM.value=(()=>{const e=Object.keys(Pn);let t=!1;for(let r=0;r<e.length;r++){const n=Pn[e[r]];if(k(n)&&n()){t=!0;break}}return t})();const e=Zt.loadOptions.value.polyfillURL;let t=Dn;if(I(e)&&(kn(e)?t=e:this.logger.warn(((e,t)=>`${e}${he}The provided polyfill URL "${t}" is invalid. The default polyfill URL will be used instead.`)(J,e))),Zt.loadOptions.value.polyfillIfRequired&&Zt.capabilities.isLegacyDOM.value&&kn(t)){const e=t!==Zt.loadOptions.value.polyfillURL;if(e){const e=`RS_polyfillCallback_${Zt.lifecycle.writeKey.value}`,r=()=>{this.onReady(),delete globalThis[e]};globalThis[e]=r,t=`${t}&callback=${e}`}this.externalSrcLoader.loadJSFile({url:t,id:xn,async:!0,timeout:1e4,callback:r=>{r?e||this.onReady():this.onError(new Error(((e,t)=>`Failed to load the polyfill script with ID "${e}" from URL ${t}.`)(xn,t)))}})}else this.onReady()}attachWindowListeners(){globalThis.addEventListener("offline",()=>{Zt.capabilities.isOnline.value=!1}),globalThis.addEventListener("online",()=>{Zt.capabilities.isOnline.value=!0}),globalThis.addEventListener("resize",function(e,t,r=250){let n;return(...i)=>{globalThis.clearTimeout(n),n=globalThis.setTimeout(()=>{e.apply(t,i)},r)}}(()=>{Zt.context.screen.value=Bn()},this))}onReady(){this.detectBrowserCapabilities(),Zt.lifecycle.status.value="browserCapabilitiesReady"}onError(e,t){this.errorHandler.onError({error:e,context:J,groupingHash:t})}}const Mn=["integrations","anonymousId","originalTimestamp"],Nn=["library","consentManagement","userAgent","ua-ch","screen"],Ln=["id","anonymous_id","user_id","sent_at","timestamp","received_at","original_timestamp","event","event_text","channel","context_ip","context_request_ip","context_passed_ip","group_id","previous_id"],Un=e=>"number"==typeof e&&!Number.isNaN(e),jn=e=>Un(e)&&e>=0&&Number.isInteger(e),Vn=e=>{const{cutOff:t}=e,r=Date.now();return Boolean(t?.enabled&&t.expiresAt&&r>t.expiresAt)},Fn=e=>Boolean(!e.expiresAt||Date.now()>e.expiresAt)||Vn(e),Hn=(e,t)=>{return!!(e&&jn(e)&&(r=e,r.toString().length>=10))||(t.warn(((e,t)=>`${e}${he}The provided session ID (${t}) is either invalid, not a positive integer, or not at least "10" digits long. A new session ID will be auto-generated instead.`)(Z,e)),!1);var r},Gn=e=>Boolean(e===Ur||e===jr||e===Vr||e===Fr),Kn=()=>ue(),zn=e=>{const t=On(),r={};return Object.keys(t).forEach(n=>{r[n]=e?.[n]||t[n]}),r.initial_referrer=e?.initial_referrer||Zt.session.initialReferrer.value,r.initial_referring_domain=e?.initial_referring_domain||Zt.session.initialReferringDomain.value,r},Jn=(e,t,r)=>{O(e)&&Object.keys(e).forEach(e=>{(Ln.includes(e)||Ln.includes(e.toLowerCase()))&&r.warn(((e,t,r,n)=>`${e}${he}The "${t}" property defined under "${r}" is a reserved keyword. Please choose a different property name to avoid conflicts with reserved keywords (${n}).`)(W,e,t,Ln))})},qn=(e,t,r)=>{O(t)&&(((e,t)=>{t.anonymousId&&S(t.anonymousId)&&(e.anonymousId=t.anonymousId),x(t.integrations)&&(e.integrations=t.integrations),t.originalTimestamp&&S(t.originalTimestamp)&&(e.originalTimestamp=t.originalTimestamp)})(e,t),e.context=((e,t,r)=>{let n=e;return Object.keys(t).forEach(e=>{if(!Mn.includes(e)&&!Nn.includes(e))if("context"!==e)n=D(n,{[e]:t[e]});else if(!w(t[e])&&O(t[e])){const r={};Object.keys(t[e]).forEach(n=>{Nn.includes(n)||(r[n]=t[e][n])}),n=D(n,{...r})}else r.warn(`${W}${he}Please make sure that the "context" property in the event API's "options" argument is a valid object literal with key-value pairs.`)}),n})(e.context,t,r))},Wn=(e,t,r,n)=>{const i={channel:"web",context:{traits:g(Zt.session.userTraits.value),sessionId:Zt.session.sessionInfo.value.id||void 0,sessionStart:Zt.session.sessionInfo.value.sessionStart||void 0,...Zt.consents.enabled.value&&{consentManagement:{deniedConsentIds:g(Zt.consents.data.value.deniedConsentIds),allowedConsentIds:g(Zt.consents.data.value.allowedConsentIds),provider:Zt.consents.provider.value,resolutionStrategy:Zt.consents.resolutionStrategy.value}},"ua-ch":Zt.context["ua-ch"].value,app:Zt.context.app.value,library:Zt.context.library.value,userAgent:Zt.context.userAgent.value,os:Zt.context.os.value,locale:Zt.context.locale.value,screen:Zt.context.screen.value,campaign:bn(globalThis.location.href),page:zn(r),timezone:Zt.context.timezone.value,...Zt.autoTrack.enabled.value&&{autoTrack:{...Zt.autoTrack.pageLifecycle.enabled.value&&{page:{pageViewId:Zt.autoTrack.pageLifecycle.pageViewId.value}}}}},originalTimestamp:de(new Date),messageId:ue(),userId:e.userId||Zt.session.userId.value};Gn(Zt.storage.entries.value.anonymousId?.type)?i.anonymousId=Zt.session.anonymousId.value:i.anonymousId=Kn(),Zt.storage.trulyAnonymousTracking.value&&(i.context.trulyAnonymousTracking=!0),"identify"===e.type&&(i.context.traits=Zt.storage.entries.value.userTraits?.type!==Hr?g(Zt.session.userTraits.value):e.context.traits),"group"===e.type&&((e.groupId||Zt.session.groupId.value)&&(i.groupId=e.groupId||Zt.session.groupId.value),(e.traits||Zt.session.groupTraits.value)&&(i.traits=Zt.storage.entries.value.groupTraits?.type!==Hr?g(Zt.session.groupTraits.value):e.traits));const s=D(e,i);return void 0===s.event&&(s.event=null),void 0===s.properties&&(s.properties=null),qn(s,t,n),((e,t)=>{const{properties:r,traits:n,context:i}=e,{traits:s}=i;Jn(r,"properties",t),Jn(n,"traits",t),Jn(s,"context.traits",t)})(s,n),s.integrations=(e=>{let t;return t=Zt.loadOptions.value.useGlobalIntegrationsConfigInEvents?Zt.consents.postConsent.value.integrations??Zt.nativeDestinations.loadOnlyIntegrations.value:e||mt,g(t)})(s.integrations),s};class Qn{constructor(e){this.logger=e}generatePageEvent(e,t,r,n){let i=r??{};return i=((e,t)=>{const r=t?.page||{},n=e,i=On();return Object.keys(i).forEach(e=>{w(n[e])&&(n[e]=r[e]||i[e])}),w(n.initial_referrer)&&(n.initial_referrer=r.initial_referrer||Zt.session.initialReferrer.value),w(n.initial_referring_domain)&&(n.initial_referring_domain=r.initial_referring_domain||Zt.session.initialReferringDomain.value),n})(i,n),Wn({properties:i,name:t,category:e,type:"page"},n,i,this.logger)}generateTrackEvent(e,t,r){return Wn({properties:t,event:e,type:"track"},r,void 0,this.logger)}generateIdentifyEvent(e,t,r){return Wn({userId:e,type:"identify",context:{traits:t}},r,void 0,this.logger)}generateAliasEvent(e,t,r){const n=Wn({previousId:t,type:"alias"},r,void 0,this.logger);return n.userId=e??n.userId,n}generateGroupEvent(e,t,r){const n={type:"group"};return e&&(n.groupId=e),t&&(n.traits=t),Wn(n,r,void 0,this.logger)}create(e){let t;switch(e.type){case"page":t=this.generatePageEvent(e.category,e.name,e.properties,e.options);break;case"track":t=this.generateTrackEvent(e.name,e.properties,e.options);break;case"identify":t=this.generateIdentifyEvent(e.userId,e.traits,e.options);break;case"alias":t=this.generateAliasEvent(e.to,e.from,e.options);break;default:t=this.generateGroupEvent(e.groupId,e.traits,e.options)}return t}}class Zn{constructor(e,t,r,n){this.eventRepository=e,this.userSessionManager=t,this.errorHandler=r,this.logger=n,this.eventFactory=new Qn(this.logger)}init(){this.eventRepository.init()}resume(){this.eventRepository.resume()}addEvent(e){this.userSessionManager.refreshSession();const t=this.eventFactory.create(e);this.eventRepository.enqueue(t,e.callback)}}class Yn{constructor(e,t,r,n,i){this.storeManager=t,this.pluginsManager=e,this.logger=i,this.errorHandler=n,this.httpClient=r,this.onError=this.onError.bind(this),this.serverSideCookieDebounceFuncs={},this.serverSideCookiesRequestInProgress={}}init(){this.syncStorageDataToState(),this.registerEffects()}syncStorageDataToState(){this.migrateStorageIfNeeded(),this.migrateDataFromPreviousStorage(),this.setUserId(this.getUserId()),this.setUserTraits(this.getUserTraits()),this.setGroupId(this.getGroupId()),this.setGroupTraits(this.getGroupTraits());const{externalAnonymousIdCookieName:e,anonymousIdOptions:t}=Zt.loadOptions.value;let r;I(e)&&"string"==typeof e&&(r=this.getExternalAnonymousIdByCookieName(e)),this.setAnonymousId(r??this.getAnonymousId(t)),this.setAuthToken(this.getAuthToken()),this.setInitialReferrerInfo(),this.configureSessionTracking()}configureSessionTracking(){let e;if(this.isPersistenceEnabledForStorageEntry("sessionInfo")){const t=this.getConfiguredSessionTrackingInfo(),r=this.getSessionInfo()??Bt.sessionInfo;e={autoTrack:t.autoTrack&&!0!==r.manualTrack,timeout:t.timeout,manualTrack:r.manualTrack,expiresAt:r.expiresAt,id:r.id,sessionStart:r.sessionStart},e.autoTrack||!0===e.manualTrack?!0===t.cutOff?.enabled&&(e.cutOff={enabled:!0,duration:t.cutOff.duration,expiresAt:r.cutOff?.expiresAt}):e=Bt.sessionInfo}else e=Bt.sessionInfo;Zt.session.sessionInfo.value=e,Zt.session.sessionInfo.value.autoTrack&&this.startOrRenewAutoTracking(Zt.session.sessionInfo.value)}setInitialReferrerInfo(){const e=this.getInitialReferrer(),t=this.getInitialReferringDomain();if(e&&t)this.setInitialReferrer(e),this.setInitialReferringDomain(t);else{const t=e||Tn();this.setInitialReferrer(t),this.setInitialReferringDomain(mn(t))}}isPersistenceEnabledForStorageEntry(e){return Gn(Zt.storage.entries.value[e]?.type)}migrateDataFromPreviousStorage(){const e=Zt.storage.entries.value,t=[Ur,jr,Vr];Object.keys(e).forEach(r=>{const n=r,i=e[n]?.type,s=this.storeManager?.getStore(Wr[i]);s&&t.forEach(e=>{const t=this.storeManager?.getStore(Wr[e]);if(t&&e!==i){const e=t.get(Gr[n]);(e=>I(e)&&""!==e)(e)&&s.set(Gr[n],e),t.remove(Gr[n])}})})}migrateStorageIfNeeded(e,t){if(!Zt.storage.migrate.value)return;let r=e??[];0===r.length&&[Kr,zr,Jr].forEach(e=>{const t=this.storeManager?.getStore(e);t&&r.push(t)}),(t??Object.keys(Gr)).forEach(e=>{const t=Gr[e];r.forEach(e=>{const r=this.pluginsManager?.invokeSingle("storage.migrate",t,e.engine,this.errorHandler,this.logger);A(r)||e.set(t,r)})})}getConfiguredSessionTrackingInfo(){let e,t=!1!==Zt.loadOptions.value.sessions.autoTrack;if(!t)return{autoTrack:t};const r=Zt.loadOptions.value.sessions?.timeout;return jn(r)?e=r:(this.logger.warn(((e,t)=>`${e}${he}The session timeout value "${t}" is not a number. The default timeout of 1800000 ms will be used instead.`)(Z,r)),e=De),0===e&&(this.logger.warn(`${Z}${he}The session timeout value is 0, which disables the automatic session tracking feature. If you want to enable session tracking, please provide a positive integer value for the timeout.`),t=!1),e>0&&e<1e4&&this.logger.warn(((e,t)=>`${e}${he}The session timeout value ${t} ms is less than the recommended minimum of 10000 ms. Please consider increasing the timeout value to ensure optimal performance and reliability.`)(Z,e)),{timeout:e,autoTrack:t,cutOff:this.getCutOffInfo(e)}}getCutOffInfo(e){const t=Zt.loadOptions.value.sessions.cutOff;let r,n=!1;return!0===t.enabled&&(r=t.duration,n=!0,jn(r)?r<e&&(this.logger.warn(((e,t,r)=>`${e}${he}The session cut off duration value "${t}" ms is less than the session timeout value "${r}" ms. The cut off functionality will be disabled.`)(Z,r,e)),n=!1):(this.logger.warn(((e,t)=>`${e}${he}The session cut off duration value "${t}" is not a number. The default cut off duration of 43200000 ms will be used instead.`)(Z,r)),r=Pe)),{enabled:n,duration:r}}onError(e,t,r){this.errorHandler.onError({error:e,context:Z,customMessage:t,groupingHash:r})}getEncryptedCookieData(e,t){const r=[];return e.forEach(e=>{const n=t?.encrypt(ve(e.value,!1,[],this.logger));I(n)&&r.push({name:e.name,value:n})}),r}makeRequestToSetCookie(e,t){this.httpClient?.getAsyncData({url:Zt.serverCookies.dataServiceUrl.value,options:{method:"POST",data:ve({reqType:"setCookies",workspaceId:Zt.source.value?.workspaceId,data:{options:{maxAge:Zt.storage.cookie.value?.maxage,path:Zt.storage.cookie.value?.path,domain:Zt.storage.cookie.value?.domain,sameSite:Zt.storage.cookie.value?.samesite,secure:Zt.storage.cookie.value?.secure,expires:Zt.storage.cookie.value?.expires},cookies:e}}),sendRawData:!0,withCredentials:!0},isRawResponse:!0,callback:t})}setServerSideCookies(e,t,r){const n=Object.keys(e),i=()=>n.map(t=>({name:e[t].name,value:Zt.session[t].value})),s={};n.forEach(t=>{s[e[t].name]=r?.get(e[t].name)});const o=()=>{n.forEach(e=>{this.serverSideCookiesRequestInProgress[e]=!1})},a=()=>{i().forEach(e=>{t&&t(e.name,e.value)})};try{const l={};n.forEach(t=>{l[e[t].name]=Zt.session[t].value});const u=this.getEncryptedCookieData(i(),r);u.length>0?this.makeRequestToSetCookie(u,(e,n)=>{var u;o(),200===n?.xhr?.status?i().forEach(e=>{const n=s[e.name],i=r?.get(e.name);ve(l[e.name],!1,[])!==ve(i,!1,[])&&(_(n)&&_(i)&&this.logger.error(`The server failed to set the ${e.name} cookie. As a fallback, the cookies will be set client side.`),t&&t(e.name,e.value))}):(this.logger.error((u=n?.xhr?.status,`The server responded with status ${u} while setting the cookies. As a fallback, the cookies will be set client side.`)),a())}):(a(),o())}catch(e){this.onError(e,yt,yt),a(),o()}}syncValueToStorage(e){const t=Zt.storage.entries.value,r=t[e]?.type;if(Gn(r)){const n=this.storeManager.getStore(Wr[r]),i=t[e]?.key,s=Zt.session[e].value;s&&(S(s)||x(s))?Zt.serverCookies.isEnabledServerSideCookies.value&&r===Ur?(this.serverSideCookiesRequestInProgress[e]=!0,this.serverSideCookieDebounceFuncs[e]&&globalThis.clearTimeout(this.serverSideCookieDebounceFuncs[e]),this.serverSideCookieDebounceFuncs[e]=globalThis.setTimeout(()=>{const t={[e]:{name:i}};this.setServerSideCookies(t,(e,t)=>{n?.set(e,t)},n)},10)):n?.set(i,s):n?.remove(i)}}registerEffects(){qr.forEach(e=>{it(()=>{this.syncValueToStorage(e)})})}setAnonymousId(e,t){let r=e;if(S(e)&&r||(r=void 0),this.isPersistenceEnabledForStorageEntry("anonymousId")){if(!r&&t){const e=this.pluginsManager?.invokeSingle("userSession.anonymousIdGoogleLinker",t);r=e}r=r||Kn()}else r=Bt.anonymousId;Zt.session.anonymousId.value=r}getAnonymousId(e){const t=Zt.storage.entries.value.anonymousId?.type;if(Gn(t)){let t=Zt.session.anonymousId.value;if(t&&t!==Bt.anonymousId||(t=this.getEntryValue("anonymousId")),!t&&e){const r=this.pluginsManager?.invokeSingle("storage.getAnonymousId",hn,e);t=r}Zt.session.anonymousId.value=t||Kn()}return Zt.session.anonymousId.value}getEntryValue(e){const t=Zt.storage.entries.value,r=t[e]?.type;if(Gn(r)){const n=this.storeManager?.getStore(Wr[r]);this.migrateStorageIfNeeded([n],[e]);const i=t[e]?.key;return n?.get(i)??null}return null}getExternalAnonymousIdByCookieName(e){const t=hn(Ur);return t?.isEnabled?t.getItem(e)??null:null}getUserSessionValue(e){return this.serverSideCookiesRequestInProgress[e]?Zt.session[e].value:this.getEntryValue(e)}getUserId(){return this.getUserSessionValue("userId")}getUserTraits(){return this.getUserSessionValue("userTraits")}getGroupId(){return this.getUserSessionValue("groupId")}getGroupTraits(){return this.getUserSessionValue("groupTraits")}getInitialReferrer(){return this.getUserSessionValue("initialReferrer")}getInitialReferringDomain(){return this.getUserSessionValue("initialReferringDomain")}getSessionInfo(){return this.getUserSessionValue("sessionInfo")}getAuthToken(){return this.getUserSessionValue("authToken")}getSessionId(){const e=this.getSessionInfo()??Bt.sessionInfo;return e.autoTrack&&!Fn(e)||e.manualTrack?e.id??null:null}refreshSession(){let e=this.getSessionInfo()??Bt.sessionInfo;(e.autoTrack||e.manualTrack)&&(e.autoTrack&&(this.startOrRenewAutoTracking(e),e=Zt.session.sessionInfo.value),void 0===e.sessionStart?e={...e,sessionStart:!0}:e.sessionStart&&(e={...e,sessionStart:!1})),Zt.session.sessionInfo.value=e,"readyExecuted"!==Zt.lifecycle.status.value&&this.syncValueToStorage("sessionInfo")}resetAndStartNewSession(){const e=Zt.session,{manualTrack:t,autoTrack:r,timeout:n,cutOff:i}=e.sessionInfo.value;if(r){const t={...Bt.sessionInfo,timeout:n};i&&(t.cutOff={enabled:i.enabled,duration:i.duration}),e.sessionInfo.value=t,this.startOrRenewAutoTracking(e.sessionInfo.value)}else t&&this.startManualTrackingInternal()}reset(e){const{session:t}=Zt,r=(e=>{if("boolean"==typeof e){const{entries:t,...r}=$t;return{...r,entries:{...t,anonymousId:e}}}return O(e)&&O(e.entries)?D($t,e):{...$t}})(e);je(()=>{Object.keys(Bt).forEach(e=>{const n=e;if(!0===r.entries[n])switch(e){case"anonymousId":this.setAnonymousId();break;case"sessionInfo":this.resetAndStartNewSession();break;default:t[n].value=Bt[n]}})})}setUserId(e){Zt.session.userId.value=this.isPersistenceEnabledForStorageEntry("userId")&&e?e:Bt.userId}setUserTraits(e){Zt.session.userTraits.value=this.isPersistenceEnabledForStorageEntry("userTraits")&&O(e)?D(Zt.session.userTraits.value??Bt.userTraits,e):Bt.userTraits}setGroupId(e){Zt.session.groupId.value=this.isPersistenceEnabledForStorageEntry("groupId")&&e?e:Bt.groupId}setGroupTraits(e){Zt.session.groupTraits.value=this.isPersistenceEnabledForStorageEntry("groupTraits")&&O(e)?D(Zt.session.groupTraits.value??Bt.groupTraits,e):Bt.groupTraits}setInitialReferrer(e){Zt.session.initialReferrer.value=this.isPersistenceEnabledForStorageEntry("initialReferrer")&&e?e:Bt.initialReferrer}setInitialReferringDomain(e){Zt.session.initialReferringDomain.value=this.isPersistenceEnabledForStorageEntry("initialReferringDomain")&&e?e:Bt.initialReferringDomain}startOrRenewAutoTracking(e){let t=e;if(Fn(e))t=(e=>{const{timeout:t,cutOff:r}=e,n=Date.now();return{id:n,expiresAt:n+t,timeout:t,autoTrack:!0,...r&&{cutOff:r}}})(e);else{const r=Date.now(),n=e.timeout;t.expiresAt=r+n}if(Vn(t)&&(t.cutOff.expiresAt=void 0),t.cutOff){const e=(e=>{if(e?.enabled)return e.expiresAt??(jn(e.duration)?Date.now()+e.duration:void 0)})(t.cutOff);t.cutOff.expiresAt=e}Zt.session.sessionInfo.value=t}start(e){Zt.session.sessionInfo.value=((e,t)=>({id:Hn(e,t)?e:Date.now(),sessionStart:void 0,manualTrack:!0}))(e,this.logger)}startManualTrackingInternal(){this.start(Date.now())}end(){Zt.session.sessionInfo.value=Bt.sessionInfo}setAuthToken(e){Zt.session.authToken.value=this.isPersistenceEnabledForStorageEntry("authToken")&&e?e:Bt.authToken}}const Xn=["BeaconQueue","CustomConsentManager","DeviceModeDestinations","DeviceModeTransformation","ExternalAnonymousId","GoogleLinker","IubendaConsentManager","KetchConsentManager","NativeDestinationQueue","OneTrustConsentManager","StorageEncryption","StorageEncryptionLegacy","StorageMigrator","XhrQueue"],ei="dataplaneEventsQueue",ti="destinationsEventsQueue",ri=(e,t,r,n)=>{if(E(e))if(k(e))try{e(...t)}catch(e){n.error(`${r}${he}The callback threw an exception`,e)}else n.error(pt(r))};class ni{constructor(e,t,r,n,i){this.pluginsManager=e,this.errorHandler=n,this.httpClient=r,this.logger=i,this.storeManager=t}init(){this.dataplaneEventsQueue=this.pluginsManager.invokeSingle(`${ei}.init`,Zt,this.httpClient,this.storeManager,this.errorHandler,this.logger),this.dmtEventsQueue=this.pluginsManager.invokeSingle("transformEvent.init",Zt,this.pluginsManager,this.httpClient,this.storeManager,this.errorHandler,this.logger),this.destinationsEventsQueue=this.pluginsManager.invokeSingle(`${ti}.init`,Zt,this.pluginsManager,this.storeManager,this.dmtEventsQueue,this.errorHandler,this.logger),it(()=>{!0===Zt.nativeDestinations.clientDestinationsReady.value&&(this.destinationsEventsQueue?.start(),this.dmtEventsQueue?.start())});const e=(e=>e.consents.preConsent.value.enabled&&"buffer"===e.consents.preConsent.value.events?.delivery)(Zt);let t;it(()=>{const r=!0===Zt.loadOptions.value.bufferDataPlaneEventsUntilReady&&!1===Zt.nativeDestinations.clientDestinationsReady.value;!1!==Zt.nativeDestinations.activeDestinations.value.some(e=>{return t=e,Boolean("hybrid"===t.config.connectionMode||!0===t.config.useNativeSDKToSend);var t})&&!1!==r||e||!0===this.dataplaneEventsQueue?.scheduleTimeoutActive||(globalThis.clearTimeout(t),this.dataplaneEventsQueue?.start())}),!0===Zt.loadOptions.value.bufferDataPlaneEventsUntilReady&&(t=globalThis.setTimeout(()=>{!0!==this.dataplaneEventsQueue?.scheduleTimeoutActive&&this.dataplaneEventsQueue?.start()},Zt.loadOptions.value.dataPlaneEventsBufferTimeout))}resume(){!0!==this.dataplaneEventsQueue?.scheduleTimeoutActive&&(Zt.consents.postConsent.value.discardPreConsentEvents&&(this.dataplaneEventsQueue?.clear(),this.destinationsEventsQueue?.clear()),this.dataplaneEventsQueue?.start())}enqueue(e,t){const r=((e,t)=>{const r=g(e),n=t.nativeDestinations.integrationsConfig.value,i=((e,t)=>Object.keys(e).filter(r=>!0!==e[r]||!t[r]).reduce((t,r)=>{const n=g(t);return n[r]=e[r],n},{}))(e.integrations,n);return r.integrations=D(n,i),r})(e,Zt);this.pluginsManager.invokeSingle(`${ei}.enqueue`,Zt,this.dataplaneEventsQueue,r,this.errorHandler,this.logger);const n=g(e);this.pluginsManager.invokeSingle(`${ti}.enqueue`,Zt,this.destinationsEventsQueue,n,this.errorHandler,this.logger);const i=`${e.type.charAt(0).toUpperCase()}${e.type.slice(1)}${z}`;ri(t,[r],i,this.logger)}}const ii=e=>{const t=new CustomEvent(e,{detail:{analyticsInstance:globalThis.rudderanalytics},bubbles:!0,cancelable:!0,composed:!0});globalThis.document.dispatchEvent(t)};class si{constructor(){this.preloadBuffer=new st,this.initialized=!1,this.errorHandler=Er,this.logger=lt,this.externalSrcLoader=new Ne(this.logger),this.httpClient=vr,this.httpClient.init(this.errorHandler),this.capabilitiesManager=new $n(this.httpClient,this.errorHandler,this.logger)}load(e,t,r={}){Zt.lifecycle.status.value||((e=>S(e)&&e.trim().length>0)(e)?(e=>kn(e))(t)?(je(()=>{Zt.lifecycle.writeKey.value=g(e),Zt.lifecycle.dataPlaneUrl.value=g(t),Zt.loadOptions.value=((e,t)=>{const r=g(t);return S(r.setCookieDomain)||(r.setCookieDomain=void 0),["Strict","Lax","None"].includes(r.sameSiteCookie)||(r.sameSiteCookie=void 0),r.secureCookie=M(r.secureCookie,e.secureCookie),r.sameDomainCookiesOnly=M(r.sameDomainCookiesOnly,e.sameDomainCookiesOnly),["none","default","full"].includes(r.uaChTrackLevel)||(r.uaChTrackLevel=void 0),r.integrations=$(r.integrations),Array.isArray(r.plugins)||(r.plugins=Xn),r.useGlobalIntegrationsConfigInEvents=M(r.useGlobalIntegrationsConfigInEvents,e.useGlobalIntegrationsConfigInEvents),r.bufferDataPlaneEventsUntilReady=M(r.bufferDataPlaneEventsUntilReady,e.bufferDataPlaneEventsUntilReady),r.sendAdblockPage=M(r.sendAdblockPage,e.sendAdblockPage),r.useServerSideCookies=M(r.useServerSideCookies,e.useServerSideCookies),S(r.dataServiceEndpoint)||(r.dataServiceEndpoint=void 0),r.sendAdblockPageOptions=$(r.sendAdblockPageOptions),r.loadIntegration=M(r.loadIntegration,e.loadIntegration),x(r.storage)?(r.storage.migrate=M(r.storage.migrate,e.storage?.migrate),r.storage.cookie=$(r.storage.cookie),r.storage.encryption=$(r.storage.encryption),r.storage=B(r.storage)):r.storage=void 0,r.destinationsQueueOptions=$(r.destinationsQueueOptions),r.queueOptions=$(r.queueOptions),r.lockIntegrationsVersion=M(r.lockIntegrationsVersion,e.lockIntegrationsVersion),r.lockPluginsVersion=M(r.lockPluginsVersion,e.lockPluginsVersion),Un(r.dataPlaneEventsBufferTimeout)||(r.dataPlaneEventsBufferTimeout=void 0),r.beaconQueueOptions=$(r.beaconQueueOptions),r.preConsent=$(r.preConsent),r.sourceConfigurationOverride=$(r.sourceConfigurationOverride),D(e,B(r))})(Zt.loadOptions.value,r),Zt.lifecycle.status.value="mounted"}),this.logger.setMinLogLevel(Zt.loadOptions.value.logLevel??at),Re("state",Zt,e),this.startLifecycle()):this.logger.error(((e,t)=>`${e}${he}The data plane URL "${t}" is invalid. It must be a valid URL string. Please check that the data plane URL is correct and try again.`)(re,t)):this.logger.error(((e,t)=>`${e}${he}The write key "${t}" is invalid. It must be a non-empty string. Please check that the write key is correct and try again.`)(re,e)))}startLifecycle(){it(()=>{try{switch(Zt.lifecycle.status.value){case"mounted":this.onMounted();break;case"browserCapabilitiesReady":this.onBrowserCapabilitiesReady();break;case"configured":this.onConfigured();break;case"pluginsLoading":case"destinationsLoading":case"readyExecuted":default:break;case"pluginsReady":this.onPluginsReady();break;case"initialized":this.onInitialized();break;case"loaded":this.onLoaded();break;case"destinationsReady":this.onDestinationsReady();break;case"ready":this.onReady()}}catch(e){const t="Failed to load the SDK";this.errorHandler.onError({error:e,context:re,customMessage:t,groupingHash:t})}})}onBrowserCapabilitiesReady(){(e=>{const t=Be(Ce)||[];((e=[])=>{const t=new URLSearchParams(globalThis.location.search);t.get(Oe)&&e.unshift(["track",t.get(Oe),$e(t,"ajs_prop_")]);const r=t.get("ajs_uid"),n=$e(t,"ajs_trait_");if(r||x(n)){const t=[...r?[r]:[],n];e.unshift(["identify",...t])}t.get(Te)&&e.unshift(["setAnonymousId",t.get(Te)])})(t),t.length>0&&(e.enqueuePreloadBufferEvents(t),Re(Ce,[]))})(this),this.prepareInternalServices(),this.loadConfig()}onLoaded(){this.processBufferedEvents(),!0===Zt.consents.preConsent.value.enabled?Zt.lifecycle.status.value="ready":this.loadDestinations()}onMounted(){this.capabilitiesManager.init()}enqueuePreloadBufferEvents(e){Array.isArray(e)&&e.forEach(e=>this.preloadBuffer.enqueue(g(e)))}processDataInPreloadBuffer(){for(;this.preloadBuffer.size()>0;){const e=this.preloadBuffer.dequeue();e&&Me([...e],this)}}prepareInternalServices(){this.pluginsManager=new Lr(Ir,this.errorHandler,this.logger),this.storeManager=new fn(this.pluginsManager,this.errorHandler,this.logger),this.configManager=new Cn(this.httpClient,this.errorHandler,this.logger),this.userSessionManager=new Yn(this.pluginsManager,this.storeManager,this.httpClient,this.errorHandler,this.logger),this.eventRepository=new ni(this.pluginsManager,this.storeManager,this.httpClient,this.errorHandler,this.logger),this.eventManager=new Zn(this.eventRepository,this.userSessionManager,this.errorHandler,this.logger)}loadConfig(){Zt.lifecycle.writeKey.value&&this.httpClient.setAuthHeader(Zt.lifecycle.writeKey.value),this.configManager?.init()}onPluginsReady(){this.storeManager?.init(),this.userSessionManager?.init(),Zt.consents.enabled.value&&!Zt.consents.initialized.value&&(this.pluginsManager?.invokeSingle("consentManager.init",Zt,this.logger),!1===Zt.consents.preConsent.value.enabled&&this.pluginsManager?.invokeSingle("consentManager.updateConsentsInfo",Zt,this.storeManager,this.logger)),this.eventManager?.init(),Zt.lifecycle.status.value="initialized"}onConfigured(){this.pluginsManager?.init()}onInitialized(){this.processDataInPreloadBuffer(),je(()=>{Zt.lifecycle.loaded.value=!0,Zt.lifecycle.status.value="loaded"}),this.initialized=!0;const e=Zt.loadOptions.value.onLoaded;ri(e,[globalThis.rudderanalytics],te,this.logger),ii("RSA_Initialised")}onReady(){Zt.lifecycle.status.value="readyExecuted",Zt.eventBuffer.readyCallbacksArray.value.forEach(e=>{ri(e,[],ee,this.logger)}),ii("RSA_Ready")}processBufferedEvents(){let e=Zt.eventBuffer.toBeProcessedArray.value;for(;e.length>0;){const t=e.shift();if(Zt.eventBuffer.toBeProcessedArray.value=e,t){const e=t[0];k(this[e])&&this[e](...t.slice(1),!0)}e=Zt.eventBuffer.toBeProcessedArray.value}}loadDestinations(){if("destinationsLoading"===Zt.lifecycle.status.value||"destinationsReady"===Zt.lifecycle.status.value)return;this.pluginsManager?.invokeSingle("nativeDestinations.setActiveDestinations",Zt,this.pluginsManager,this.errorHandler,this.logger);const e=Zt.nativeDestinations.activeDestinations.value.length;0!==e?(Zt.lifecycle.status.value="destinationsLoading",this.pluginsManager?.invokeSingle("nativeDestinations.load",Zt,this.externalSrcLoader,this.errorHandler,this.logger),it(()=>{(0===e||Zt.nativeDestinations.initializedDestinations.value.length+Zt.nativeDestinations.failedDestinations.value.length===e)&&je(()=>{Zt.lifecycle.status.value="destinationsReady",Zt.nativeDestinations.clientDestinationsReady.value=!0})})):Zt.lifecycle.status.value="destinationsReady"}onDestinationsReady(){"ready"!==Zt.lifecycle.status.value&&(Zt.lifecycle.status.value="ready")}ready(e,t=!1){const r="ready";Zt.lifecycle.loaded.value?(this.errorHandler.leaveBreadcrumb(`New ${r} invocation`),k(e)?"readyExecuted"===Zt.lifecycle.status.value?ri(e,[],ee,this.logger):Zt.eventBuffer.readyCallbacksArray.value=[...Zt.eventBuffer.readyCallbacksArray.value,e]:this.logger.error(pt(ee))):Zt.eventBuffer.toBeProcessedArray.value=[...Zt.eventBuffer.toBeProcessedArray.value,[r,e]]}page(e,t=!1){const r="page";Zt.lifecycle.loaded.value?(this.errorHandler.leaveBreadcrumb(`New ${r} event`),Zt.metrics.triggered.value+=1,this.eventManager?.addEvent({type:"page",category:e.category,name:e.name,properties:e.properties,options:e.options,callback:e.callback}),!0===Zt.capabilities.isAdBlocked.value&&e.category!==Ie&&this.page(j(Ie,"ad-block page request",{path:"/ad-blocked"},Zt.loadOptions.value.sendAdblockPageOptions))):Zt.eventBuffer.toBeProcessedArray.value=[...Zt.eventBuffer.toBeProcessedArray.value,[r,e]]}track(e,t=!1){const r="track";Zt.lifecycle.loaded.value?(this.errorHandler.leaveBreadcrumb(`New ${r} event - ${e.name}`),Zt.metrics.triggered.value+=1,this.eventManager?.addEvent({type:r,name:e.name||void 0,properties:e.properties,options:e.options,callback:e.callback})):Zt.eventBuffer.toBeProcessedArray.value=[...Zt.eventBuffer.toBeProcessedArray.value,[r,e]]}identify(e,t=!1){const r="identify";Zt.lifecycle.loaded.value?(this.errorHandler.leaveBreadcrumb(`New ${r} event`),Zt.metrics.triggered.value+=1,Boolean(e.userId&&Zt.session.userId.value&&e.userId!==Zt.session.userId.value)&&this.reset(),_(e.userId)||this.userSessionManager?.setUserId(e.userId),this.userSessionManager?.setUserTraits(e.traits),this.eventManager?.addEvent({type:r,userId:e.userId,traits:e.traits,options:e.options,callback:e.callback})):Zt.eventBuffer.toBeProcessedArray.value=[...Zt.eventBuffer.toBeProcessedArray.value,[r,e]]}alias(e,t=!1){const r="alias";if(!Zt.lifecycle.loaded.value)return void(Zt.eventBuffer.toBeProcessedArray.value=[...Zt.eventBuffer.toBeProcessedArray.value,[r,e]]);this.errorHandler.leaveBreadcrumb(`New ${r} event`),Zt.metrics.triggered.value+=1;const n=e.from??(this.getUserId()||this.userSessionManager?.getAnonymousId());this.eventManager?.addEvent({type:r,to:e.to,from:n,options:e.options,callback:e.callback})}group(e,t=!1){const r="group";Zt.lifecycle.loaded.value?(this.errorHandler.leaveBreadcrumb(`New ${r} event`),Zt.metrics.triggered.value+=1,_(e.groupId)||this.userSessionManager?.setGroupId(e.groupId),this.userSessionManager?.setGroupTraits(e.traits),this.eventManager?.addEvent({type:r,groupId:e.groupId,traits:e.traits,options:e.options,callback:e.callback})):Zt.eventBuffer.toBeProcessedArray.value=[...Zt.eventBuffer.toBeProcessedArray.value,[r,e]]}reset(e,t=!1){const r="reset";Zt.lifecycle.loaded.value?(this.errorHandler.leaveBreadcrumb(`New ${r} invocation`),this.userSessionManager?.reset(e)):Zt.eventBuffer.toBeProcessedArray.value=[...Zt.eventBuffer.toBeProcessedArray.value,[r,e]]}getAnonymousId(e){return this.userSessionManager?.getAnonymousId(e)}setAnonymousId(e,t,r=!1){const n="setAnonymousId";Zt.lifecycle.loaded.value?(this.errorHandler.leaveBreadcrumb(`New ${n} invocation`),this.userSessionManager?.setAnonymousId(e,t)):Zt.eventBuffer.toBeProcessedArray.value=[...Zt.eventBuffer.toBeProcessedArray.value,[n,e,t]]}getUserId(){return Zt.session.userId.value}getUserTraits(){return Zt.session.userTraits.value}getGroupId(){return Zt.session.groupId.value}getGroupTraits(){return Zt.session.groupTraits.value}startSession(e,t=!1){const r="startSession";Zt.lifecycle.loaded.value?(this.errorHandler.leaveBreadcrumb(`New ${r} invocation`),this.userSessionManager?.start(e)):Zt.eventBuffer.toBeProcessedArray.value=[...Zt.eventBuffer.toBeProcessedArray.value,[r,e]]}endSession(e=!1){const t="endSession";Zt.lifecycle.loaded.value?(this.errorHandler.leaveBreadcrumb(`New ${t} invocation`),this.userSessionManager?.end()):Zt.eventBuffer.toBeProcessedArray.value=[...Zt.eventBuffer.toBeProcessedArray.value,[t]]}getSessionId(){const e=this.userSessionManager?.getSessionId();return e??null}consent(e,t=!1){Zt.lifecycle.loaded.value?(this.errorHandler.leaveBreadcrumb("New consent invocation"),je(()=>{Zt.consents.preConsent.value={...Zt.consents.preConsent.value,enabled:!1},Zt.consents.postConsent.value=(e=>{const t={sendPageEvent:!1,trackConsent:!1,discardPreConsentEvents:!1};if(O(e)){const r=g(e);t.storage=r.storage,x(r.integrations)&&(t.integrations=r.integrations),t.discardPreConsentEvents=!0===r.discardPreConsentEvents,t.sendPageEvent=!0===r.sendPageEvent,t.trackConsent=!0===r.trackConsent,x(r.consentManagement)&&(t.consentManagement=D(r.consentManagement,{enabled:Zt.consents.enabled.value}))}return t})(e);const{initialized:t,consentsData:r}=An(Zt.consents.postConsent.value.consentManagement,this.logger);Zt.consents.initialized.value=t,Zt.consents.data.value=r}),Zt.consents.enabled.value&&!Zt.consents.initialized.value&&this.pluginsManager?.invokeSingle("consentManager.updateConsentsInfo",Zt,this.storeManager,this.logger),this.storeManager?.initializeStorageState(),this.userSessionManager?.syncStorageDataToState(),this.eventManager?.resume(),this.loadDestinations(),this.sendTrackingEvents(t)):Zt.eventBuffer.toBeProcessedArray.value=[...Zt.eventBuffer.toBeProcessedArray.value,["consent",e]]}sendTrackingEvents(e){if(Zt.consents.postConsent.value.trackConsent){const t=V("Consent Management Interaction");e?Zt.eventBuffer.toBeProcessedArray.value=[...Zt.eventBuffer.toBeProcessedArray.value,["track",t]]:this.track(t)}if(Zt.consents.postConsent.value.sendPageEvent){const t=j();e?Zt.eventBuffer.toBeProcessedArray.value=[...Zt.eventBuffer.toBeProcessedArray.value,["page",t]]:this.page(t)}}setAuthToken(e){this.userSessionManager?.setAuthToken(e)}addCustomIntegration(e,t,r=!1){const n="addCustomIntegration";if(r)this.errorHandler.leaveBreadcrumb(`New ${n} invocation`),this.pluginsManager?.invokeSingle("nativeDestinations.addCustomIntegration",e,t,Zt,this.logger);else{if(Zt.lifecycle.loaded.value)return void this.logger.error(((e,t)=>`${e}${he}Cannot add custom integration for destination ID "${t}" after the SDK is loaded.`)(re,e));Zt.eventBuffer.toBeProcessedArray.value=[...Zt.eventBuffer.toBeProcessedArray.value,[n,e,t]]}}}class oi{static globalSingleton=null;analyticsInstances={};defaultAnalyticsKey="";logger=lt;constructor(){try{if(oi.globalSingleton)return oi.globalSingleton;oi.initializeGlobalResources(),this.setDefaultInstanceKey=this.setDefaultInstanceKey.bind(this),this.getAnalyticsInstance=this.getAnalyticsInstance.bind(this),this.load=this.load.bind(this),this.ready=this.ready.bind(this),this.triggerBufferedLoadEvent=this.triggerBufferedLoadEvent.bind(this),this.page=this.page.bind(this),this.track=this.track.bind(this),this.identify=this.identify.bind(this),this.alias=this.alias.bind(this),this.group=this.group.bind(this),this.reset=this.reset.bind(this),this.getAnonymousId=this.getAnonymousId.bind(this),this.setAnonymousId=this.setAnonymousId.bind(this),this.getUserId=this.getUserId.bind(this),this.getUserTraits=this.getUserTraits.bind(this),this.getGroupId=this.getGroupId.bind(this),this.getGroupTraits=this.getGroupTraits.bind(this),this.startSession=this.startSession.bind(this),this.endSession=this.endSession.bind(this),this.getSessionId=this.getSessionId.bind(this),this.setAuthToken=this.setAuthToken.bind(this),this.consent=this.consent.bind(this),this.addCustomIntegration=this.addCustomIntegration.bind(this),this.createSafeAnalyticsInstance(),oi.globalSingleton=this,Zt.autoTrack.pageLifecycle.pageViewId.value=ue(),Zt.autoTrack.pageLifecycle.pageLoadedTimestamp.value=Date.now(),this.triggerBufferedLoadEvent(),globalThis.rudderanalytics=this}catch(e){we(e)}}createSafeAnalyticsInstance(){Zt.lifecycle.safeAnalyticsInstance.value={page:this.page.bind(this),track:this.track.bind(this),identify:this.identify.bind(this),alias:this.alias.bind(this),group:this.group.bind(this),getAnonymousId:this.getAnonymousId.bind(this),getUserId:this.getUserId.bind(this),getUserTraits:this.getUserTraits.bind(this),getGroupId:this.getGroupId.bind(this),getGroupTraits:this.getGroupTraits.bind(this),getSessionId:this.getSessionId.bind(this)}}static initializeGlobalResources(){Er.init(),dn.configure(),un.configure(),cn.configure(),tn.configure()}setDefaultInstanceKey(e){S(e)&&e&&(this.defaultAnalyticsKey=e)}getAnalyticsInstance(e){try{let t=e;return S(t)&&t||(t=this.defaultAnalyticsKey),Boolean(this.analyticsInstances[t])||(this.analyticsInstances[t]=new si),this.analyticsInstances[t]}catch(e){return void we(e)}}load(e,t,r){try{if(this.analyticsInstances[e])return;this.setDefaultInstanceKey(e),this.trackPageLifecycleEvents(r);const n=Be(Ce);(e=>{const t="consent",r=e.filter(e=>e[0]===t),n=e.filter(e=>e[0]!==t);e.splice(0,e.length,...r,...n)})(n),Re(Ce,g(n)),this.getAnalyticsInstance(e)?.load(e,t,be(r))}catch(e){we(e)}}trackPageLifecycleEvents(e){const{autoTrack:t,useBeacon:r}=e??{},{enabled:n=!1,options:i={},pageLifecycle:s}=t??{},{events:o=[K.UNLOADED],enabled:a=n,options:l=i}=s??{};Zt.autoTrack.pageLifecycle.enabled.value=a,Zt.autoTrack.enabled.value=n||a,a&&this.setupPageUnloadTracking(o,r,l)}setupPageUnloadTracking(e,t,r){(0===e.length||e.includes(K.UNLOADED))&&(!0===t?((e,t=!1)=>{let r=!1,n=!1;function i(){r||(r=!0,e(n),setTimeout(()=>{r=!1},0))}(t||ce())&&globalThis.addEventListener("beforeunload",()=>{n=!1,i()}),globalThis.addEventListener("blur",()=>{n=!0,i()}),globalThis.addEventListener("focus",()=>{r=!1}),document.addEventListener("pagehide",()=>{n="hidden"===document.visibilityState,i()}),document.addEventListener("visibilitychange",()=>{n=!0,"hidden"===document.visibilityState?i():r=!1})})(e=>{if(!1===e&&Zt.lifecycle.loaded.value){const e=Date.now(),t=e-Zt.autoTrack.pageLifecycle.pageLoadedTimestamp.value;this.track(K.UNLOADED,{timeOnPage:t},{...r,originalTimestamp:de(new Date(e))})}},!0):this.logger.warn(`RudderStackAnalytics${he}Page Unloaded event can only be tracked when the Beacon transport is active. Please enable "useBeacon" load API option.`))}triggerBufferedLoadEvent(){const e=Array.isArray(globalThis.rudderanalytics)?globalThis.rudderanalytics:[],t=(e=>{let t=[],r=0;for(;r<e.length;){if(e[r]&&"load"===e[r][0]){t=g(e[r]),e.splice(r,1);break}r+=1}return t})(e);Re(Ce,g([...e])),t.length>0&&(t.shift(),this.load.apply(null,t))}ready(e){try{this.getAnalyticsInstance()?.ready(be(e))}catch(e){we(e)}}page(e,t,r,n,i){try{this.getAnalyticsInstance()?.page(j(be(e),be(t),be(r),be(n),be(i)))}catch(e){we(e)}}track(e,t,r,n){try{this.getAnalyticsInstance()?.track(V(be(e),be(t),be(r),be(n)))}catch(e){we(e)}}identify(e,t,r,n){try{this.getAnalyticsInstance()?.identify(F(be(e),be(t),be(r),be(n)))}catch(e){we(e)}}alias(e,t,r,n){try{this.getAnalyticsInstance()?.alias(H(be(e),be(t),be(r),be(n)))}catch(e){we(e)}}group(e,t,r,n){try{this.getAnalyticsInstance()?.group(G(be(e),be(t),be(r),be(n)))}catch(e){we(e)}}reset(e){try{this.getAnalyticsInstance()?.reset(be(e))}catch(e){we(e)}}getAnonymousId(e){try{return this.getAnalyticsInstance()?.getAnonymousId(be(e))}catch(e){return void we(e)}}setAnonymousId(e,t){try{this.getAnalyticsInstance()?.setAnonymousId(be(e),be(t))}catch(e){we(e)}}getUserId(){try{return this.getAnalyticsInstance()?.getUserId()}catch(e){return void we(e)}}getUserTraits(){try{return this.getAnalyticsInstance()?.getUserTraits()}catch(e){return void we(e)}}getGroupId(){try{return this.getAnalyticsInstance()?.getGroupId()}catch(e){return void we(e)}}getGroupTraits(){try{return this.getAnalyticsInstance()?.getGroupTraits()}catch(e){return void we(e)}}startSession(e){try{this.getAnalyticsInstance()?.startSession(be(e))}catch(e){we(e)}}endSession(){try{this.getAnalyticsInstance()?.endSession()}catch(e){we(e)}}getSessionId(){try{return this.getAnalyticsInstance()?.getSessionId()}catch(e){return void we(e)}}setAuthToken(e){try{this.getAnalyticsInstance()?.setAuthToken(be(e))}catch(e){we(e)}}consent(e){try{this.getAnalyticsInstance()?.consent(be(e))}catch(e){we(e)}}addCustomIntegration(e,t){try{this.getAnalyticsInstance()?.addCustomIntegration(be(e),be(t))}catch(e){we(e)}}}t.RudderAnalytics=oi},733(e){e.exports=function(){"use strict";function e(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)e[n]=r[n]}return e}return function t(r,n){function i(t,i,s){if("undefined"!=typeof document){"number"==typeof(s=e({},n,s)).expires&&(s.expires=new Date(Date.now()+864e5*s.expires)),s.expires&&(s.expires=s.expires.toUTCString()),t=encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var o="";for(var a in s)s[a]&&(o+="; "+a,!0!==s[a]&&(o+="="+s[a].split(";")[0]));return document.cookie=t+"="+r.write(i,t)+o}}return Object.create({set:i,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var t=document.cookie?document.cookie.split("; "):[],n={},i=0;i<t.length;i++){var s=t[i].split("="),o=s.slice(1).join("=");try{var a=decodeURIComponent(s[0]);if(n[a]=r.read(o,a),e===a)break}catch(e){}}return e?n[e]:n}},remove:function(t,r){i(t,"",e({},r,{expires:-1}))},withAttributes:function(r){return t(this.converter,e({},this.attributes,r))},withConverter:function(r){return t(e({},this.converter,r),this.attributes)}},{attributes:{value:Object.freeze(n)},converter:{value:Object.freeze(r)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"})}()},744(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n,i=(n=r(858))&&n.__esModule?n:{default:n},s=r(910),o=null,a=null,l=0;t.default=function(e,t,r){e=e||{};var n=t&&r||0,u=t||new Uint8Array(16),c=e.random||(e.rng||i.default)(),d=void 0!==e.msecs?e.msecs:Date.now(),h=void 0!==e.seq?e.seq:null,g=a,f=o;return d>l&&void 0===e.msecs&&(l=d,null!==h&&(g=null,f=null)),null!==h&&(h>2147483647&&(h=2147483647),g=h>>>19&4095,f=524287&h),null!==g&&null!==f||(g=(g=127&c[6])<<8|c[7],f=(f=(f=63&c[8])<<8|c[9])<<5|c[10]>>>3),d+1e4>l&&null===h?++f>524287&&(f=0,++g>4095&&(g=0,l++)):l=d,a=g,o=f,u[n++]=l/1099511627776&255,u[n++]=l/4294967296&255,u[n++]=l/16777216&255,u[n++]=l/65536&255,u[n++]=l/256&255,u[n++]=255&l,u[n++]=g>>>4&15|112,u[n++]=255&g,u[n++]=f>>>13&63|128,u[n++]=f>>>5&255,u[n++]=f<<3&255|7&c[10],u[n++]=c[11],u[n++]=c[12],u[n++]=c[13],u[n++]=c[14],u[n++]=c[15],t||(0,s.unsafeStringify)(u)}},775(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n,i=(n=r(37))&&n.__esModule?n:{default:n};t.default=function(e){if(!(0,i.default)(e))throw TypeError("Invalid UUID");return parseInt(e.slice(14,15),16)}},792(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n,i=(n=r(37))&&n.__esModule?n:{default:n};t.default=function(e){if(!(0,i.default)(e))throw TypeError("Invalid UUID");var t,r=new Uint8Array(16);return r[0]=(t=parseInt(e.slice(0,8),16))>>>24,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=255&t,r[4]=(t=parseInt(e.slice(9,13),16))>>>8,r[5]=255&t,r[6]=(t=parseInt(e.slice(14,18),16))>>>8,r[7]=255&t,r[8]=(t=parseInt(e.slice(19,23),16))>>>8,r[9]=255&t,r[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,r[11]=t/4294967296&255,r[12]=t>>>24&255,r[13]=t>>>16&255,r[14]=t>>>8&255,r[15]=255&t,r}},808(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.default="00000000-0000-0000-0000-000000000000"},831(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"MAX",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(t,"NIL",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(t,"parse",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(t,"v1",{enumerable:!0,get:function(){return a.default}}),Object.defineProperty(t,"v1ToV6",{enumerable:!0,get:function(){return l.default}}),Object.defineProperty(t,"v3",{enumerable:!0,get:function(){return u.default}}),Object.defineProperty(t,"v4",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(t,"v5",{enumerable:!0,get:function(){return d.default}}),Object.defineProperty(t,"v6",{enumerable:!0,get:function(){return h.default}}),Object.defineProperty(t,"v6ToV1",{enumerable:!0,get:function(){return g.default}}),Object.defineProperty(t,"v7",{enumerable:!0,get:function(){return f.default}}),Object.defineProperty(t,"validate",{enumerable:!0,get:function(){return p.default}}),Object.defineProperty(t,"version",{enumerable:!0,get:function(){return v.default}});var n=y(r(213)),i=y(r(808)),s=y(r(792)),o=y(r(910)),a=y(r(518)),l=y(r(343)),u=y(r(948)),c=y(r(73)),d=y(r(186)),h=y(r(671)),g=y(r(507)),f=y(r(744)),p=y(r(37)),v=y(r(775));function y(e){return e&&e.__esModule?e:{default:e}}},858(e,t){"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){if(!r&&!(r="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return r(n)};var n=new Uint8Array(16)},910(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.unsafeStringify=a;for(var n,i=(n=r(37))&&n.__esModule?n:{default:n},s=[],o=0;o<256;++o)s.push((o+256).toString(16).slice(1));function a(e,t=0){return(s[e[t+0]]+s[e[t+1]]+s[e[t+2]]+s[e[t+3]]+"-"+s[e[t+4]]+s[e[t+5]]+"-"+s[e[t+6]]+s[e[t+7]]+"-"+s[e[t+8]]+s[e[t+9]]+"-"+s[e[t+10]]+s[e[t+11]]+s[e[t+12]]+s[e[t+13]]+s[e[t+14]]+s[e[t+15]]).toLowerCase()}t.default=function(e,t=0){var r=a(e,t);if(!(0,i.default)(r))throw TypeError("Stringified UUID is invalid");return r}},948(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=s(r(25)),i=s(r(311));function s(e){return e&&e.__esModule?e:{default:e}}var o=(0,n.default)("v3",48,i.default);t.default=o}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var s=t[n]={exports:{}};return e[n].call(s.exports,s,s.exports,r),s.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{"use strict";var e=n;Object.defineProperty(e,"__esModule",{value:!0}),e.Analytics=void 0;var t=r(396);Object.defineProperty(e,"Analytics",{enumerable:!0,get:function(){return t.Analytics}})})(),n})());
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Analytics=t():e.Analytics=t()}(this,()=>(()=>{var e={25(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.URL=t.DNS=void 0,t.default=function(e,t,i){function r(e,r,o,a){var l;if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));for(var t=[],i=0;i<e.length;++i)t.push(e.charCodeAt(i));return t}(e)),"string"==typeof r&&(r=(0,s.default)(r)),16!==(null===(l=r)||void 0===l?void 0:l.length))throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var u=new Uint8Array(16+e.length);if(u.set(r),u.set(e,r.length),(u=i(u))[6]=15&u[6]|t,u[8]=63&u[8]|128,o){a=a||0;for(var c=0;c<16;++c)o[a+c]=u[c];return o}return(0,n.unsafeStringify)(u)}try{r.name=e}catch(e){}return r.DNS=o,r.URL=a,r};var r,n=i(910),s=(r=i(792))&&r.__esModule?r:{default:r},o=t.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",a=t.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8"},37(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r,n=(r=i(656))&&r.__esModule?r:{default:r};t.default=function(e){return"string"==typeof e&&n.default.test(e)}},42(e,t){"use strict";function i(e,t,i,r){switch(e){case 0:return t&i^~t&r;case 1:case 3:return t^i^r;case 2:return t&i^t&r^i&r}}function r(e,t){return e<<t|e>>>32-t}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.default=function(e){var t=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof e){var s=unescape(encodeURIComponent(e));e=[];for(var o=0;o<s.length;++o)e.push(s.charCodeAt(o))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);for(var a=e.length/4+2,l=Math.ceil(a/16),u=new Array(l),c=0;c<l;++c){for(var d=new Uint32Array(16),h=0;h<16;++h)d[h]=e[64*c+4*h]<<24|e[64*c+4*h+1]<<16|e[64*c+4*h+2]<<8|e[64*c+4*h+3];u[c]=d}u[l-1][14]=8*(e.length-1)/Math.pow(2,32),u[l-1][14]=Math.floor(u[l-1][14]),u[l-1][15]=8*(e.length-1)&4294967295;for(var g=0;g<l;++g){for(var p=new Uint32Array(80),f=0;f<16;++f)p[f]=u[g][f];for(var v=16;v<80;++v)p[v]=r(p[v-3]^p[v-8]^p[v-14]^p[v-16],1);for(var _=n[0],m=n[1],y=n[2],b=n[3],w=n[4],k=0;k<80;++k){var E=Math.floor(k/20),S=r(_,5)+i(E,m,y,b)+w+t[E]+p[k]>>>0;w=b,b=y,y=r(m,30)>>>0,m=_,_=S}n[0]=n[0]+_>>>0,n[1]=n[1]+m>>>0,n[2]=n[2]+y>>>0,n[3]=n[3]+b>>>0,n[4]=n[4]+w>>>0}return[n[0]>>24&255,n[0]>>16&255,n[0]>>8&255,255&n[0],n[1]>>24&255,n[1]>>16&255,n[1]>>8&255,255&n[1],n[2]>>24&255,n[2]>>16&255,n[2]>>8&255,255&n[2],n[3]>>24&255,n[3]>>16&255,n[3]>>8&255,255&n[3],n[4]>>24&255,n[4]>>16&255,n[4]>>8&255,255&n[4]]}},73(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=o(i(140)),n=o(i(858)),s=i(910);function o(e){return e&&e.__esModule?e:{default:e}}t.default=function(e,t,i){if(r.default.randomUUID&&!t&&!e)return r.default.randomUUID();var o=(e=e||{}).random||(e.rng||n.default)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t){i=i||0;for(var a=0;a<16;++a)t[i+a]=o[a];return t}return(0,s.unsafeStringify)(o)}},106(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.chooseVariation=function(e,t){for(let i=0;i<t.length;i++)if(o(e,t[i]))return i;return-1},t.decrypt=async function(e,t,r){if(t=t||"",!(r=r||globalThis.crypto&&globalThis.crypto.subtle||i.SubtleCrypto))throw new Error("No SubtleCrypto implementation found");try{const i=await r.importKey("raw",u(t),{name:"AES-CBC",length:128},!0,["encrypt","decrypt"]),[n,s]=e.split("."),o=await r.decrypt({name:"AES-CBC",iv:u(n)},i,u(s));return(new TextDecoder).decode(o)}catch(e){throw new Error("Failed to decrypt")}},t.getAutoExperimentChangeType=function(e){return e.urlPatterns&&e.variations.some(e=>c(e)&&"urlRedirect"in e)?"redirect":e.variations.some(e=>c(e)&&(e.domMutations||"js"in e||"css"in e))?"visual":"unknown"},t.getBucketRanges=function(e,t,i){(t=void 0===t?1:t)<0?t=0:t>1&&(t=1);const r=s(e);(i=i||r).length!==e&&(i=r);const n=i.reduce((e,t)=>t+e,0);(n<.99||n>1.01)&&(i=r);let o=0;return i.map(e=>{const i=o;return o+=e,[i,i+t*e]})},t.getEqualWeights=s,t.getPolyfills=function(){return i},t.getQueryStringOverride=function(e,t,i){if(!t)return null;const r=t.split("?")[1];if(!r)return null;const n=r.replace(/#.*/,"").split("&").map(e=>e.split("=",2)).filter(t=>{let[i]=t;return i===e}).map(e=>{let[,t]=e;return parseInt(t)});return n.length>0&&n[0]>=0&&n[0]<i?n[0]:null},t.getUrlRegExp=a,t.hash=n,t.inNamespace=function(e,t){const i=n("__"+t[0],e,1);return null!==i&&i>=t[1]&&i<t[2]},t.inRange=o,t.isIncluded=function(e){try{return e()}catch(e){return console.error(e),!1}},t.isURLTargeted=function(e,t){if(!t.length)return!1;let i=!1,r=!1;for(let n=0;n<t.length;n++){const s=l(e,t[n].type,t[n].pattern);if(!1===t[n].include){if(s)return!1}else i=!0,s&&(r=!0)}return r||!i},t.loadSDKVersion=function(){let e;try{e="1.6.2"}catch(t){e=""}return e},t.mergeQueryStrings=function(e,t){let i,r;try{i=new URL(e),r=new URL(t)}catch(e){return console.error(`Unable to merge query strings: ${e}`),t}return i.searchParams.forEach((e,t)=>{r.searchParams.has(t)||r.searchParams.set(t,e)}),r.toString()},t.paddedVersionString=function(e){"number"==typeof e&&(e+=""),e&&"string"==typeof e||(e="0");const t=e.replace(/(^v|\+.*$)/g,"").split(/[-.]/);return 3===t.length&&t.push("~"),t.map(e=>e.match(/^[0-9]+$/)?e.padStart(5," "):e).join("-")},t.promiseTimeout=async function(e,t){return new Promise(i=>{let r,n=!1;const s=e=>{n||(n=!0,r&&clearTimeout(r),i(e||null))};t&&(r=setTimeout(()=>s(),t)),e.then(e=>s(e)).catch(()=>s())})},t.toString=function(e){return"string"==typeof e?e:JSON.stringify(e)};const i={fetch:globalThis.fetch?globalThis.fetch.bind(globalThis):void 0,SubtleCrypto:globalThis.crypto?globalThis.crypto.subtle:void 0,EventSource:globalThis.EventSource};function r(e){let t=2166136261;const i=e.length;for(let r=0;r<i;r++)t^=e.charCodeAt(r),t+=(t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24);return t>>>0}function n(e,t,i){return 2===i?r(r(e+t)+"")%1e4/1e4:1===i?r(t+e)%1e3/1e3:null}function s(e){return e<=0?[]:new Array(e).fill(1/e)}function o(e,t){return e>=t[0]&&e<t[1]}function a(e){try{const t=e.replace(/([^\\])\//g,"$1\\/");return new RegExp(t)}catch(e){return void console.error(e)}}function l(e,t,i){try{const r=new URL(e,"https://_");if("regex"===t){const e=a(i);return!!e&&(e.test(r.href)||e.test(r.href.substring(r.origin.length)))}return"simple"===t&&function(e,t){try{const i=new URL(t.replace(/^([^:/?]*)\./i,"https://$1.").replace(/\*/g,"_____"),"https://_____"),r=[[e.host,i.host,!1],[e.pathname,i.pathname,!0]];return i.hash&&r.push([e.hash,i.hash,!1]),i.searchParams.forEach((t,i)=>{r.push([e.searchParams.get(i)||"",t,!1])}),!r.some(e=>!function(e,t,i){try{let r=t.replace(/[*.+?^${}()|[\]\\]/g,"\\$&").replace(/_____/g,".*");return i&&(r="\\/?"+r.replace(/(^\/|\/$)/g,"")+"\\/?"),new RegExp("^"+r+"$","i").test(e)}catch(e){return!1}}(e[0],e[1],e[2]))}catch(e){return!1}}(r,i)}catch(e){return!1}}const u=e=>Uint8Array.from(atob(e),e=>e.charCodeAt(0));function c(e){return"object"==typeof e&&null!==e}},140(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i="undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);t.default={randomUUID:i}},154(e,t){!function(e){"use strict";const t={real:"green.derivws.com",demo:"blue.derivws.com"},i={"deriv.app":"16929","app.deriv.com":"16929","staging-app.deriv.com":"16303","app.deriv.me":"1411","staging-app.deriv.me":"1411","app.deriv.be":"30767","staging-app.deriv.be":"31186","binary.com":"1","test-app.deriv.com":"51072","p2p.deriv.com":"61859","p2p.deriv.be":"71265","p2p.deriv.me":"71263","staging-p2p.deriv.com":"62019","api.deriv.com":"36544","staging-api.deriv.com":"36545","smarttrader.deriv.com":"22168","staging-smarttrader.deriv.com":"22169","staging-dbot.deriv.com":"29934","staging-dbot.deriv.me":"29934","staging-dbot.deriv.be":"29934","dbot.deriv.com":"65555","dbot.deriv.be":"65556","dbot.deriv.me":"65557"},r="deriv",n=Object.freeze(Object.defineProperty({__proto__:null,appBrand:r,domainAppId:i,environments:t},Symbol.toStringTag,{value:"Module"})),s={AAD:2,AED:2,AFN:2,ALL:2,AMD:2,ANG:2,AOA:2,ARS:2,AUD:2,AWG:2,AZN:2,BAM:2,BBD:2,BCH:8,BDT:2,BGN:2,BHD:3,BIF:0,BMD:2,BND:2,BOB:2,BOV:2,BRL:2,BSD:2,BTC:8,BTN:2,BUSD:2,BWP:2,BYN:2,BZD:2,CAD:2,CDF:2,CHE:2,CHF:2,CHW:2,CLF:4,CLP:0,CNY:2,COP:2,COU:2,CRC:2,CUC:2,CUP:2,CVE:2,CZK:2,DAI:2,DJF:0,DKK:2,DOP:2,DZD:2,EGP:2,ERN:2,ETB:2,ETC:8,ETH:8,EUR:2,EURS:2,eUSDT:2,FJD:2,FKP:2,GBP:2,GEL:2,GHS:2,GIP:2,GMD:2,GNF:0,GTQ:2,GYD:2,HKD:2,HNL:2,HRK:2,HTG:2,HUF:2,IDK:0,IDR:2,ILS:2,INR:2,IQD:3,IRR:2,ISK:0,JMD:2,JOD:3,JPY:0,KES:2,KGS:2,KHR:2,KMF:0,KPW:2,KRW:0,KWD:3,KYD:2,KZT:2,LAK:2,LBP:2,LKR:2,LRD:2,LSL:2,LTC:8,LYD:3,MAD:2,MDL:2,MGA:2,MKD:2,MMK:2,MNT:2,MOP:2,MRU:2,MUR:2,MVR:2,MWK:2,MXN:2,MXV:2,MYR:2,MZN:2,NAD:2,NGN:2,NIO:2,NOK:2,NPR:2,NZD:2,OMR:3,PAB:2,PAX:2,PEN:2,PGK:2,PHP:2,PKR:2,PLN:2,PYG:0,QAR:2,RON:2,RSD:2,RUB:2,RWF:0,SAR:2,SBD:2,SCR:2,SDG:2,SEK:2,SGD:2,SHP:2,SLL:2,SOS:2,SRD:2,SSP:2,STN:2,SVC:2,SYP:2,SZL:2,THB:2,TJS:2,TMT:2,TND:3,TOP:2,TRY:2,TTD:2,TUSD:2,tUSDT:2,TWD:2,TZS:2,UAH:2,UGX:0,USB:2,USD:2,USDC:2,USDK:2,UST:2,USN:2,UYI:0,UYU:2,UYW:4,UZS:2,VES:2,VND:0,VUV:0,WST:2,XAF:0,XCD:2,XOF:0,XPF:0,YER:2,ZAR:2,ZMW:2,ZWL:2},o=Object.freeze(Object.defineProperty({__proto__:null,precision:s},Symbol.toStringTag,{value:"Module"})),a=["PNG","JPG","JPEG","GIF","PDF"],l=Object.freeze(Object.defineProperty({__proto__:null,supportedDocumentFormats:a},Symbol.toStringTag,{value:"Module"})),u="client.active_loginid",c="config.app_id",d="config.server_url",h="i18n_language",g=Object.freeze(Object.defineProperty({__proto__:null,accountList:"client.account_list",activeLoginid:u,configAppId:c,configServerURL:d,i18nLanguage:h,lastVerifyEmail:"client.verify_email",p2pArchiveMessage:"should_not_show_auto_archive_message_again",p2pOrderIds:"order_ids",p2pShowFollowUserGuide:"should_show_p2p_follow_user_guide",p2pShowGuide:"should_show_p2p_guide",traderLayout:"trader.layout",uiExpandAccountSwitcher:"ui.expand_account_switcher",uiShowReportsDrawer:"ui.show_report_drawer",uiTheme:"ui.theme"},Symbol.toStringTag,{value:"Module"})),p="deriv.com",f="deriv.me",v="deriv.be",_=[p,v,f],m=typeof window<"u"&&window.location.hostname.split("app.")[1],y=_.includes(m)?m:p,b=`https://bot.${y}`,w=`https://staging-bot.${y}`,k=`https://app.${y}`,E=`https://staging-app.${y}`,S=`https://${y}`,A=`https://eu.${y}`,x=`https://staging.${y}`,I=y,P=`https://smarttrader.${y}`,C=`https://staging-smarttrader.${y}`,T=`https://p2p.${y}`,O=`https://staging-p2p.${y}`,R="https://cloudflare.com/cdn-cgi/trace",$=Object.freeze(Object.defineProperty({__proto__:null,baseDomain:m,binaryBotProduction:b,binaryBotStaging:w,cloudflareTrace:R,deriv:p,derivAppProduction:k,derivAppStaging:E,derivBe:v,derivComProduction:S,derivComProductionEU:A,derivComStaging:x,derivHost:I,derivMe:f,derivP2pProduction:T,derivP2pStaging:O,domain:y,queryParameters:{lang:"lang",action:"action"},smartTraderProduction:P,smartTraderStaging:C,supportedDomains:_,whatsApp:"https://wa.me/35699578341"},Symbol.toStringTag,{value:"Module"})),D={address:/^[\p{L}\p{Nd}\s'’.,:;()\\x{b0}@#/-]{0,70}$/u,addressCity:new RegExp("^\\p{L}[\\p{L}\\s'.-]{0,49}$","u"),addressState:/^[\p{L}\p{Nd}\s'.,;\-\[\]\(\)]{0,100}$/u,barrier:/^(?=.{1,20}$)[+-]?[0-9]+\.?[0-9]*$/,decimal:/^\d*(\.\d+)?$/,integer:/^\d+$/,postalOfficeBoxNumber:/p[.\s]+o[.\s]+box/i,email:/^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,63}$/,password:/^(?=.*[a-z])(?=.*\d)(?=.*[A-Z])[!-~]{8,25}$/,affilliatePassword:/^(?=.*[a-z])(?=.*[0-9])(?=.*[A-Z])[ -~]{6,50}$/,paymentAgentEmail:/^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{1,255}$/,postalCode:/^([A-Za-z0-9][A-Za-z0-9\s-]{0,20})?$/,taxIdentificationNumber:/^(?!^$|\s+)[A-Za-z0-9.\/\s-]{0,25}$/,phoneNumber:/^\+((-|\s)*[0-9]){9,20}$/,fileType:/(image|application)\/(jpe?g|pdf|png)$/,formattedCardNumber:/(^\d{4})\s(\d{2}X{2})\s(X{4})\s(\d{4}$)/,invalidFormattedCardNumberCharacters:/[^\dX\s]/,tradingPlatformInvestorPassword:/^(?=.*[a-z])(?=.*[0-9])(?=.*[A-Z])(?=.*[!@#$%^&*()+\-=\[\]{};':\"|,\.<>\?_~])[ -~]{8,16}$/,letterSymbols:/^[A-Za-z]+([a-zA-Z.' -])*[a-zA-Z.' -]+$/,name:/^(?!.*\s{2,})(?!\s)[\p{L}\s'.-]{1,50}$/u,general:/[`~!@#$%^&*)(_=+[}{\]\\/";:?><|]+/,lowercase:/[a-z]/,number:/\d/,specialCharacter:/\W/,uppercase:/[A-Z]/,between8and16Characters:/^.{8,16}$/,between8and25Characters:/^.{8,25}$/},M=Object.freeze(Object.defineProperty({__proto__:null,messagesHints:{addressPermittedSpecialCharacters:". , ' : ; ( ) ° @ # / -"},patterns:D},Symbol.toStringTag,{value:"Module"})),L={brandName:"Deriv",domainName:"Deriv.com"},N={fx:"Deriv (FX) Ltd",maltainvest:"Deriv Investments (Europe) Limited",svg:"Deriv (SVG) LLC",v:"Deriv (V) Ltd"},F={trader:"Deriv Trader",dBot:"Deriv Bot",mt5:"Deriv MT5",cTrader:"Deriv cTrader",derivX:"Deriv X",smartTrader:"SmartTrader",bBot:"Binary Bot",go:"Deriv GO"},B=Object.freeze(Object.defineProperty({__proto__:null,brandConfig:L,landingCompanies:N,platforms:F},Symbol.toStringTag,{value:"Module"})),U=/(ALP-|AMN-|ANA-|ANE-|ANG-|AQM-|ARS-|ART-|ATU-|BAC-|BLA-|BRQ-|CAG-|CAM-|CAN-|CAZ-|CDL-|CDY-|CLT-|CRO-|CUN-|DIG-|DRA-|DUA-|DUB-|DVC-|ELE-|ELS-|EML-|EVA-|EVR-|FIG-|FLA-|FRL-|GLK-|HMA-|HW-|HWI-|INE-|JAT-|JEF-|JER-|JKM-|JNY-|JSC-|LDN-|LIO-|LON-|LUA-|LYA-|LYO-|MAR-|MED-|MHA-|MLA-|MRD-|MYA-|NCE-|NEO-|NOH-|NOP-|OCE-|PAR-|PIC-|POT-|PPA-|PRA-|RNE-|SEA-|SLA-|SNE-|SPN-|STK-|TAH-|TAS-|TET-|TRT-|VCE-|VIE-|VKY-|VNS-|VOG-|VTR-|WAS-|WKG-|WLZ-|JAD-|MLD-|RTE-|NAM-|NEN-|BAL-|JLN-|YAL-|MGA-|FGD-|XYAO-|BON-|ALN-|ALT-|BRA-|DBY2-|STG-|MAO-|LEM-|GOA-|FOA-|MNA-|LNA-)/,j=Object.freeze(Object.defineProperty({__proto__:null,huaweiDevicesRegex:U},Symbol.toStringTag,{value:"Module"})),V=Object.freeze(Object.defineProperty({__proto__:null,formatMoney:(e,t)=>{try{const{locale:i="en-US",currency:r,decimalPlaces:n}=t||{},o=n||s[r??"USD"];return new Intl.NumberFormat(i,{minimumFractionDigits:o,maximumFractionDigits:o}).format(e)}catch{return e.toString()}},getAdjustedDate:(e,t="days",i="add")=>{if(e<0)throw new Error("Amount must be a positive number.");const r=new Date,n="add"===i?e:-e;return"years"===t?r.setFullYear(r.getFullYear()+n):"days"===t&&r.setDate(r.getDate()+n),r},getFormattedDateString:(e,t)=>{let i;const{dateOptions:r={day:"2-digit",month:"2-digit",year:"numeric"},format:n="YYYY-MM-DD",unix:s=!1}=t||{},o={...r};if("number"==typeof e&&s)i=new Date(1e3*e);else{if(!("string"==typeof e||e instanceof Date))throw new Error("Invalid date input");if(i=new Date(e),isNaN(i.getTime()))throw new Error("Invalid date input")}switch(n){case"DD MMM YYYY":o.day="2-digit",o.month="short",o.year="numeric";break;case"MMM DD YYYY":return o.day="2-digit",o.month="short",o.year="numeric",i.toLocaleDateString("en-GB",o).replace(/(\d{2}) (\w{3}) (\d{4})/,"$2 $1 $3");case"DD-MM-YYYY":return o.day="2-digit",o.month="2-digit",o.year="numeric",i.toLocaleDateString("en-GB",o).replace(/(\d{2})\/(\d{2})\/(\d{4})/,"$1-$2-$3");default:o.year="numeric",o.month="2-digit",o.day="2-digit"}const a=i.toLocaleDateString("en-GB",o).replace(/(\d{2}) (\w{3,4}) (\d{4})/,(e,t,i,r)=>`${t} ${i.slice(0,3)} ${r}`);return"YYYY-MM-DD"===n?a.replace(/(\d{2})\/(\d{2})\/(\d{4})/,"$3-$2-$1"):a},getFormattedTimeString:(e,t=!1)=>{let i;if("number"==typeof e&&t)i=new Date(1e3*e);else{if(!("string"==typeof e||e instanceof Date))throw new Error("Invalid date input");if(i=new Date(e),isNaN(i.getTime()))throw new Error("Invalid date input")}return`${i.getUTCHours().toString().padStart(2,"0")}:${i.getUTCMinutes().toString().padStart(2,"0")}:${i.getUTCSeconds().toString().padStart(2,"0")} GMT`},parseCryptoLongcode:e=>{const t=e.split(/,\s/),i=/:\s([0-9a-zA-Z]+.{25,28})/gm.exec(t[0])?.[1],r=/:\s([0-9a-zA-Z]+.{25,34})/gm.exec(t[1])?.[1];return{addressHash:i,blockchainHash:r,splitLongcode:t}}},Symbol.toStringTag,{value:"Module"})),H=2560,G=.9,q=({src:e,filename:t,options:i})=>{const{maxWidth:r=H,quality:n=G}=i||{};return new Promise((i,s)=>{const o=new Image;o.src=e,o.onload=()=>{const e=document.createElement("canvas"),a=e.getContext("2d");if(!(a&&a instanceof CanvasRenderingContext2D))return s(new Error("Failed to get 2D context"));if(o.naturalWidth>r){const t=H,i=t/o.naturalWidth;e.width=t,e.height=o.naturalHeight*i}else e.width=o.naturalWidth,e.height=o.naturalHeight;a.fillStyle="transparent",a.fillRect(0,0,e.width,e.height),a.save(),a.drawImage(o,0,0,e.width,e.height),e.toBlob(e=>{if(!e)return;const r=t.replace(/\.[^/.]+$/,".jpg"),n=new Blob([e],{type:"image/jpeg"});n.lastModifiedDate=Date.now(),n.name=r,i(n)},"image/jpeg",n)}})},z=e=>new Promise(t=>{const i=new FileReader;i.readAsDataURL(e),i.onloadend=()=>{t({src:i.result?.toString()||"",filename:e.name})}}),K=e=>!!e&&a.some(t=>e.toUpperCase().endsWith(t));const W=Object.freeze(Object.defineProperty({__proto__:null,compressImage:q,compressImageFile:e=>new Promise(t=>{K(e.name)?z(e).then(e=>{q(e).then(t)}):t(e)}),convertToBase64:z,generateChunks:(e,{chunkSize:t=16384})=>{const i=[];for(let r=0;r<e.length;r++){const n=e[r];r%t===0?i.push([n]):i[i.length-1].push(n)}return i.map(e=>new Uint8Array(e)).concat(new Uint8Array([]))},isSupportedImageFormat:K,numToUint8Array:function(e,t=4){const i=new Uint8Array(t);return new DataView(i.buffer).setUint32(0,e),i},readFile:e=>{const t=new FileReader;return new Promise(i=>{t.onload=()=>{const r={filename:e.name,buffer:t.result,fileSize:e.size};i(r)},t.onerror=()=>{i({message:`Unable to read file ${e.name}`})},t.readAsArrayBuffer(e)})}},Symbol.toStringTag,{value:"Module"})),J=e=>{const t=localStorage.getItem(e);if("undefined"!==t){if(null===t||"null"===t)return null;try{return JSON.parse(t)}catch{return null}}},Y=Object.freeze(Object.defineProperty({__proto__:null,getValue:J,setValue:(e,t)=>{localStorage.setItem(e,JSON.stringify(t))}},Symbol.toStringTag,{value:"Module"})),Q=e=>Object.keys(e).sort().reduce((t,i)=>(t[i]=e[i],t),{}),Z=(e,t)=>Array.isArray(e)&&Array.isArray(t)?t.map((t,i)=>Z(e[i],t)):"object"==typeof e&&null!==e&&"object"==typeof t&&null!==t?X(e,t):t,X=(e,...t)=>{for(const i of t)for(const t in i)null===i[t]||void 0===i[t]||(e[t]=Z(e[t],i[t]));return e},ee=Object.freeze(Object.defineProperty({__proto__:null,hashObject:async e=>{const t=(new TextEncoder).encode(JSON.stringify(Q(e))),i=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(i)).map(e=>("00"+e.toString(16)).slice(-2)).join("")},merge:X,sortObjectByKeys:Q},Symbol.toStringTag,{value:"Module"}));const te=Object.freeze(Object.defineProperty({__proto__:null,createPromise:function(){let e,t;return{promise:new Promise((i,r)=>{e=i,t=r}),resolve:e,reject:t}}},Symbol.toStringTag,{value:"Module"})),ie=()=>{const e=new URLSearchParams(window.location.search).get("acct1");return J(u)||e},re=e=>e&&!/^VR/.test(e)?"real":"demo",ne=()=>{const e=J(c);if(e)return e;const t=window.location.hostname;return i[t]||"36300"},se=Object.freeze(Object.defineProperty({__proto__:null,getActiveLoginid:ie,getAppId:ne,getEnvironmentFromLoginid:re},Symbol.toStringTag,{value:"Module"})),oe=()=>{const e=J(d);if(e)return e;const i=ie();return t[re(i)]},ae=e=>e.replace(/(^\/|\/$|[^a-zA-Z0-9-_./()#])/g,""),le=Object.freeze(Object.defineProperty({__proto__:null,filterSearchParams:e=>{const t=new URLSearchParams(window.location.search);e.forEach(e=>t.delete(e));const i=`${window.location.pathname}${t.toString()?`?${t.toString()}`:""}`;window.history.pushState(null,"",i)},getDefaultActiveAccount:e=>{if(e?.length)return e.find(e=>/^VR/.test(e.loginid))||e[0]},getDerivStaticURL:(e,t)=>{const i=t?.isEU?A:S;let r=J(h)?.toLowerCase()??"en";return r="en"===r?"":`/${r.replace("_","-")}`,t?.isDocument?`${i}/${ae(e)}`:`${i}${r}/${ae(e)}`},getLoginInfoFromURL:()=>{const e=[],t=[],i=new URLSearchParams(window.location.search);for(const[r,n]of i.entries()){const i=r.match(/^acct(\d+)/),s=r.match(/^token(\d+)/),o=r.match(/^cur(\d+)/);i&&(e[+i[1]-1]={...e[+i[1]-1]||{},loginid:n}),s&&(e[+s[1]-1]={...e[+s[1]-1]||{},token:n}),o&&(e[+o[1]-1]={...e[+o[1]-1]||{},currency:n}),(/acct/.test(r)||/token/.test(r)||/cur/.test(r))&&t.push(r)}return{loginInfo:e.filter(e=>["loginid","token","currency"].every(t=>Object.keys(e).includes(t))),paramsToDelete:t}},getOauthURL:()=>{const e=J(h)??"EN";return`https://oauth.deriv.com/oauth2/authorize?app_id=${ne()}&l=${e}&brand=${r}`},getQueryParameter:e=>new URLSearchParams(window.location.search).get(e),getServerURL:oe,getWebsocketURL:()=>{const e=oe(),t=J(h)??"EN";return`wss://${e}/websockets/v3?app_id=${ne()}&l=${t}&brand=${r}`},isDomainAllowed:e=>/^(((.*)\.)?(localhost:8443|pages.dev|binary\.(sx|com)|deriv.(com|me|be|dev)))$/.test(e),normalizePath:ae},Symbol.toStringTag,{value:"Module"})),ue=Object.freeze(Object.defineProperty({__proto__:null,getBrandWebsiteName:()=>L.domainName,getLegalLandingCompany:e=>N[e],getPlatformName:e=>F[e]},Symbol.toStringTag,{value:"Module"})),ce=e=>U.test(e),de=Object.freeze(Object.defineProperty({__proto__:null,mobileOSDetectAsync:async()=>{const e=window,t=navigator,i=t.userAgent??e.opera??"";if(/windows phone/i.test(i))return"Windows Phone";if(/android/i.test(i)){if(t.userAgentData){const e=await t.userAgentData.getHighEntropyValues(["model"]);if(ce(e?.model||""))return"huawei"}else if(ce(i)||/huawei/i.test(i))return"huawei";return"Android"}return/iPad|iPhone|iPod/.test(i)&&!e.MSStream?"iOS":"unknown"}},Symbol.toStringTag,{value:"Module"}));function he(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var r in i)e[r]=i[r]}return e}var ge=function e(t,i){function r(e,r,n){if(!(typeof document>"u")){"number"==typeof(n=he({},i,n)).expires&&(n.expires=new Date(Date.now()+864e5*n.expires)),n.expires&&(n.expires=n.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var s="";for(var o in n)n[o]&&(s+="; "+o,!0!==n[o]&&(s+="="+n[o].split(";")[0]));return document.cookie=e+"="+t.write(r,e)+s}}return Object.create({set:r,get:function(e){if(!(typeof document>"u"||arguments.length&&!e)){for(var i=document.cookie?document.cookie.split("; "):[],r={},n=0;n<i.length;n++){var s=i[n].split("="),o=s.slice(1).join("=");try{var a=decodeURIComponent(s[0]);if(r[a]=t.read(o,a),e===a)break}catch{}}return e?r[e]:r}},remove:function(e,t){r(e,"",he({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,he({},this.attributes,t))},withConverter:function(t){return e(he({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(i)},converter:{value:Object.freeze(t)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"});let pe=null;const fe=Object.freeze(Object.defineProperty({__proto__:null,getCountry:async()=>{if(pe)return pe;const e=JSON.parse(ge.get("website_status")||"{}")?.clients_country;return pe=(async()=>{try{const t=await fetch(R).catch(()=>null);if(!t)return e||"";const i=await t.text().catch(()=>"");return i?Object.fromEntries(i.split("\n").map(e=>e.split("=",2))).loc?.toLowerCase()||e||"":e||""}catch{return e||""}})(),pe}},Symbol.toStringTag,{value:"Module"}));e.AppIDConstants=n,e.BrandConstants=B,e.BrandUtils=ue,e.CountryUtils=fe,e.CurrencyConstants=o,e.DocumentConstants=l,e.FormatUtils=V,e.ImageUtils=W,e.LocalStorageConstants=g,e.LocalStorageUtils=Y,e.MobileDevicesConstants=j,e.OSDetectionUtils=de,e.ObjectUtils=ee,e.PromiseUtils=te,e.URLConstants=$,e.URLUtils=le,e.ValidationConstants=M,e.WebSocketUtils=se,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}(t)},186(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=s(i(25)),n=s(i(42));function s(e){return e&&e.__esModule?e:{default:e}}var o=(0,r.default)("v5",80,n.default);t.default=o},200(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"BrowserCookieStickyBucketService",{enumerable:!0,get:function(){return o.BrowserCookieStickyBucketService}}),Object.defineProperty(t,"EVENT_EXPERIMENT_VIEWED",{enumerable:!0,get:function(){return u.EVENT_EXPERIMENT_VIEWED}}),Object.defineProperty(t,"EVENT_FEATURE_EVALUATED",{enumerable:!0,get:function(){return u.EVENT_FEATURE_EVALUATED}}),Object.defineProperty(t,"ExpressCookieStickyBucketService",{enumerable:!0,get:function(){return o.ExpressCookieStickyBucketService}}),Object.defineProperty(t,"GrowthBook",{enumerable:!0,get:function(){return n.GrowthBook}}),Object.defineProperty(t,"GrowthBookClient",{enumerable:!0,get:function(){return s.GrowthBookClient}}),Object.defineProperty(t,"GrowthBookMultiUser",{enumerable:!0,get:function(){return s.GrowthBookClient}}),Object.defineProperty(t,"LocalStorageStickyBucketService",{enumerable:!0,get:function(){return o.LocalStorageStickyBucketService}}),Object.defineProperty(t,"RedisStickyBucketService",{enumerable:!0,get:function(){return o.RedisStickyBucketService}}),Object.defineProperty(t,"StickyBucketService",{enumerable:!0,get:function(){return o.StickyBucketService}}),Object.defineProperty(t,"StickyBucketServiceSync",{enumerable:!0,get:function(){return o.StickyBucketServiceSync}}),Object.defineProperty(t,"UserScopedGrowthBook",{enumerable:!0,get:function(){return s.UserScopedGrowthBook}}),Object.defineProperty(t,"clearCache",{enumerable:!0,get:function(){return r.clearCache}}),Object.defineProperty(t,"configureCache",{enumerable:!0,get:function(){return r.configureCache}}),Object.defineProperty(t,"evalCondition",{enumerable:!0,get:function(){return a.evalCondition}}),Object.defineProperty(t,"getAutoExperimentChangeType",{enumerable:!0,get:function(){return l.getAutoExperimentChangeType}}),Object.defineProperty(t,"getPolyfills",{enumerable:!0,get:function(){return l.getPolyfills}}),Object.defineProperty(t,"helpers",{enumerable:!0,get:function(){return r.helpers}}),Object.defineProperty(t,"isURLTargeted",{enumerable:!0,get:function(){return l.isURLTargeted}}),Object.defineProperty(t,"onHidden",{enumerable:!0,get:function(){return r.onHidden}}),Object.defineProperty(t,"onVisible",{enumerable:!0,get:function(){return r.onVisible}}),Object.defineProperty(t,"paddedVersionString",{enumerable:!0,get:function(){return l.paddedVersionString}}),Object.defineProperty(t,"prefetchPayload",{enumerable:!0,get:function(){return n.prefetchPayload}}),Object.defineProperty(t,"setPolyfills",{enumerable:!0,get:function(){return r.setPolyfills}});var r=i(707),n=i(328),s=i(555),o=i(350),a=i(427),l=i(106),u=i(569)},213(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.default="ffffffff-ffff-ffff-ffff-ffffffffffff"},311(e,t){"use strict";function i(e){return 14+(e+64>>>9<<4)+1}function r(e,t){var i=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(i>>16)<<16|65535&i}function n(e,t,i,n,s,o){return r((a=r(r(t,e),r(n,o)))<<(l=s)|a>>>32-l,i);var a,l}function s(e,t,i,r,s,o,a){return n(t&i|~t&r,e,t,s,o,a)}function o(e,t,i,r,s,o,a){return n(t&r|i&~r,e,t,s,o,a)}function a(e,t,i,r,s,o,a){return n(t^i^r,e,t,s,o,a)}function l(e,t,i,r,s,o,a){return n(i^(t|~r),e,t,s,o,a)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.default=function(e){if("string"==typeof e){var t=unescape(encodeURIComponent(e));e=new Uint8Array(t.length);for(var n=0;n<t.length;++n)e[n]=t.charCodeAt(n)}return function(e){for(var t=[],i=32*e.length,r="0123456789abcdef",n=0;n<i;n+=8){var s=e[n>>5]>>>n%32&255,o=parseInt(r.charAt(s>>>4&15)+r.charAt(15&s),16);t.push(o)}return t}(function(e,t){e[t>>5]|=128<<t%32,e[i(t)-1]=t;for(var n=1732584193,u=-271733879,c=-1732584194,d=271733878,h=0;h<e.length;h+=16){var g=n,p=u,f=c,v=d;n=s(n,u,c,d,e[h],7,-680876936),d=s(d,n,u,c,e[h+1],12,-389564586),c=s(c,d,n,u,e[h+2],17,606105819),u=s(u,c,d,n,e[h+3],22,-1044525330),n=s(n,u,c,d,e[h+4],7,-176418897),d=s(d,n,u,c,e[h+5],12,1200080426),c=s(c,d,n,u,e[h+6],17,-1473231341),u=s(u,c,d,n,e[h+7],22,-45705983),n=s(n,u,c,d,e[h+8],7,1770035416),d=s(d,n,u,c,e[h+9],12,-1958414417),c=s(c,d,n,u,e[h+10],17,-42063),u=s(u,c,d,n,e[h+11],22,-1990404162),n=s(n,u,c,d,e[h+12],7,1804603682),d=s(d,n,u,c,e[h+13],12,-40341101),c=s(c,d,n,u,e[h+14],17,-1502002290),n=o(n,u=s(u,c,d,n,e[h+15],22,1236535329),c,d,e[h+1],5,-165796510),d=o(d,n,u,c,e[h+6],9,-1069501632),c=o(c,d,n,u,e[h+11],14,643717713),u=o(u,c,d,n,e[h],20,-373897302),n=o(n,u,c,d,e[h+5],5,-701558691),d=o(d,n,u,c,e[h+10],9,38016083),c=o(c,d,n,u,e[h+15],14,-660478335),u=o(u,c,d,n,e[h+4],20,-405537848),n=o(n,u,c,d,e[h+9],5,568446438),d=o(d,n,u,c,e[h+14],9,-1019803690),c=o(c,d,n,u,e[h+3],14,-187363961),u=o(u,c,d,n,e[h+8],20,1163531501),n=o(n,u,c,d,e[h+13],5,-1444681467),d=o(d,n,u,c,e[h+2],9,-51403784),c=o(c,d,n,u,e[h+7],14,1735328473),n=a(n,u=o(u,c,d,n,e[h+12],20,-1926607734),c,d,e[h+5],4,-378558),d=a(d,n,u,c,e[h+8],11,-2022574463),c=a(c,d,n,u,e[h+11],16,1839030562),u=a(u,c,d,n,e[h+14],23,-35309556),n=a(n,u,c,d,e[h+1],4,-1530992060),d=a(d,n,u,c,e[h+4],11,1272893353),c=a(c,d,n,u,e[h+7],16,-155497632),u=a(u,c,d,n,e[h+10],23,-1094730640),n=a(n,u,c,d,e[h+13],4,681279174),d=a(d,n,u,c,e[h],11,-358537222),c=a(c,d,n,u,e[h+3],16,-722521979),u=a(u,c,d,n,e[h+6],23,76029189),n=a(n,u,c,d,e[h+9],4,-640364487),d=a(d,n,u,c,e[h+12],11,-421815835),c=a(c,d,n,u,e[h+15],16,530742520),n=l(n,u=a(u,c,d,n,e[h+2],23,-995338651),c,d,e[h],6,-198630844),d=l(d,n,u,c,e[h+7],10,1126891415),c=l(c,d,n,u,e[h+14],15,-1416354905),u=l(u,c,d,n,e[h+5],21,-57434055),n=l(n,u,c,d,e[h+12],6,1700485571),d=l(d,n,u,c,e[h+3],10,-1894986606),c=l(c,d,n,u,e[h+10],15,-1051523),u=l(u,c,d,n,e[h+1],21,-2054922799),n=l(n,u,c,d,e[h+8],6,1873313359),d=l(d,n,u,c,e[h+15],10,-30611744),c=l(c,d,n,u,e[h+6],15,-1560198380),u=l(u,c,d,n,e[h+13],21,1309151649),n=l(n,u,c,d,e[h+4],6,-145523070),d=l(d,n,u,c,e[h+11],10,-1120210379),c=l(c,d,n,u,e[h+2],15,718787259),u=l(u,c,d,n,e[h+9],21,-343485551),n=r(n,g),u=r(u,p),c=r(c,f),d=r(d,v)}return[n,u,c,d]}(function(e){if(0===e.length)return[];for(var t=8*e.length,r=new Uint32Array(i(t)),n=0;n<t;n+=8)r[n>>5]|=(255&e[n/8])<<n%32;return r}(e),8*e.length))}},316(e,t,i){"use strict";var r=this&&this.__assign||function(){return r=Object.assign||function(e){for(var t,i=1,r=arguments.length;i<r;i++)for(var n in t=arguments[i])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},r.apply(this,arguments)},n=this&&this.__awaiter||function(e,t,i,r){return new(i||(i=Promise))(function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((r=r.apply(e,t||[])).next())})},s=this&&this.__generator||function(e,t){var i,r,n,s,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(l){return function(a){if(i)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(i=1,r&&(n=2&a[0]?r.return:a[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,a[1])).done)return n;switch(r=0,n&&(a=[2&a[0],n.value]),a[0]){case 0:case 1:n=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((n=(n=o.trys).length>0&&n[n.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!n||a[1]>n[0]&&a[1]<n[3])){o.label=a[1];break}if(6===a[0]&&o.label<n[1]){o.label=n[1],n=a;break}if(n&&o.label<n[2]){o.label=n[2],o.ops.push(a);break}n[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],r=0}finally{i=n=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.Growthbook=void 0;var o=i(200),a=i(720),l=function(){function e(e,t,i){void 0===i&&(i={});var l=this;this.analytics=new a.RudderAnalytics,this.isLoaded=!1,this.status=void 0,this.setAttributes=function(e){var t=e.id,i=e.country,n=e.user_language,s=e.device_language,o=e.device_type,a=e.utm_source,u=e.utm_medium,c=e.utm_campaign,d=e.is_authorised,h=e.url,g=e.domain,p=e.utm_content,f=e.residence_country,v=e.loggedIn,_=e.network_type,m=e.network_downlink,y=e.user_id,b=e.anonymous_id,w=e.account_mode,k=l.GrowthBook.getAttributes();l.GrowthBook.setAttributes(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r({},k),{id:t}),void 0!==y&&{user_id:y}),void 0!==b&&{anonymous_id:b}),void 0!==i&&{country:i}),void 0!==f&&{residence_country:f}),void 0!==n&&{user_language:n}),void 0!==s&&{device_language:s}),void 0!==o&&{device_type:o}),void 0!==a&&{utm_source:a}),void 0!==u&&{utm_medium:u}),void 0!==c&&{utm_campaign:c}),void 0!==d&&{is_authorised:d}),void 0!==h&&{url:h}),void 0!==g&&{domain:g}),void 0!==p&&{utm_content:p}),void 0!==v&&{loggedIn:v}),void 0!==_&&{network_type:_}),void 0!==m&&{network_downlink:m}),void 0!==w&&{account_mode:w}))},this.getFeatureValue=function(e,t){return l.GrowthBook.getFeatureValue(e,t)},this.getStatus=function(){return n(l,void 0,void 0,function(){return s(this,function(e){switch(e.label){case 0:return[4,this.waitForIsLoaded()];case 1:return e.sent(),[2,{isLoaded:this.isLoaded,status:this.status}]}})})},this.getFeatureState=function(e){return l.GrowthBook.evalFeature(e)},this.setUrl=function(e){return l.GrowthBook.setURL(e)},this.isOn=function(e){return l.GrowthBook.isOn(e)},this.init=function(){return n(l,void 0,void 0,function(){var e;return s(this,function(t){switch(t.label){case 0:return[4,this.GrowthBook.init({timeout:2e3,streaming:!0}).catch(function(e){console.error(e)})];case 1:return e=t.sent(),this.status=e,this.isLoaded=!0,[2]}})})},this.GrowthBook=new o.GrowthBook(r({apiHost:"https://cdn.growthbook.io",clientKey:e,decryptionKey:t,antiFlicker:!1,navigateDelay:0,antiFlickerTimeout:3500,subscribeToChanges:!0,enableDevMode:null===window||void 0===window?void 0:window.location.hostname.includes("localhost"),trackingCallback:function(e,t){window.dataLayer&&window.dataLayer.push({event:"experiment_viewed",event_category:"experiment",rudder_anonymous_id:l.analytics.getAnonymousId(),experiment_id:e.key,variation_id:t.variationId}),l.analytics.track("experiment_viewed",{experimentId:e.key,variationId:t.variationId})}},i)),this.init()}return e.prototype.reapplyExperiment=function(e){var t=null!=e?e:window.location.href;this.GrowthBook.setURL(t),console.log("Route changed, new URL:",t)},e.prototype.waitForIsLoaded=function(){var e=this;return new Promise(function(t){var i=setInterval(function(){e.isLoaded&&(clearInterval(i),t())},100)})},e.getGrowthBookInstance=function(t,i,r){return e._instance||(e._instance=new e(t,null!=i?i:"",r)),e._instance},e}();t.Growthbook=l},328(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GrowthBook=void 0,t.prefetchPayload=async function(e){const t=new c(e);await(0,o.refreshFeatures)({instance:t,skipCache:e.skipCache,allowStale:!1,backgroundSync:e.streaming}),t.destroy()};var r,n=(r=i(591))&&r.__esModule?r:{default:r},s=i(106),o=i(707),a=i(569);const l="undefined"!=typeof window&&"undefined"!=typeof document,u=(0,s.loadSDKVersion)();class c{constructor(e){if(e=e||{},this.version=u,this._options=this.context=e,this._renderer=e.renderer||null,this._trackedExperiments=new Set,this._completedChangeIds=new Set,this._trackedFeatures={},this.debug=!!e.debug,this._subscriptions=new Set,this.ready=!1,this._assigned=new Map,this._activeAutoExperiments=new Map,this._triggeredExpKeys=new Set,this._initialized=!1,this._redirectedUrl="",this._deferredTrackingCalls=new Map,this._autoExperimentsAllowed=!e.disableExperimentsOnLoad,this._destroyCallbacks=[],this.logs=[],this.log=this.log.bind(this),this._saveDeferredTrack=this._saveDeferredTrack.bind(this),this._onExperimentEval=this._onExperimentEval.bind(this),this._fireSubscriptions=this._fireSubscriptions.bind(this),this._recordChangedId=this._recordChangedId.bind(this),e.remoteEval){if(e.decryptionKey)throw new Error("Encryption is not available for remoteEval");if(!e.clientKey)throw new Error("Missing clientKey");let t=!1;try{t=!!new URL(e.apiHost||"").hostname.match(/growthbook\.io$/i)}catch(e){}if(t)throw new Error("Cannot use remoteEval on GrowthBook Cloud")}else if(e.cacheKeyAttributes)throw new Error("cacheKeyAttributes are only used for remoteEval");if(e.stickyBucketService){const t=e.stickyBucketService;this._saveStickyBucketAssignmentDoc=e=>t.saveAssignments(e)}if(e.plugins)for(const t of e.plugins)t(this);if(e.features&&(this.ready=!0),l&&e.enableDevMode&&(window._growthbook=this,document.dispatchEvent(new Event("gbloaded"))),e.experiments&&(this.ready=!0,this._updateAllAutoExperiments()),this._options.stickyBucketService&&this._options.stickyBucketAssignmentDocs)for(const e in this._options.stickyBucketAssignmentDocs){const t=this._options.stickyBucketAssignmentDocs[e];t&&this._options.stickyBucketService.saveAssignments(t).catch(()=>{})}this.ready&&this.refreshStickyBuckets(this.getPayload())}async setPayload(e){this._payload=e;const t=await(0,a.decryptPayload)(e,this._options.decryptionKey);this._decryptedPayload=t,await this.refreshStickyBuckets(t),t.features&&(this._options.features=t.features),t.savedGroups&&(this._options.savedGroups=t.savedGroups),t.experiments&&(this._options.experiments=t.experiments,this._updateAllAutoExperiments()),this.ready=!0,this._render()}initSync(e){this._initialized=!0;const t=e.payload;if(t.encryptedExperiments||t.encryptedFeatures)throw new Error("initSync does not support encrypted payloads");return this._options.stickyBucketService&&!this._options.stickyBucketAssignmentDocs&&(this._options.stickyBucketAssignmentDocs=this.generateStickyBucketAssignmentDocsSync(this._options.stickyBucketService,t)),this._payload=t,this._decryptedPayload=t,t.features&&(this._options.features=t.features),t.experiments&&(this._options.experiments=t.experiments,this._updateAllAutoExperiments()),this.ready=!0,(0,o.startStreaming)(this,e),this}async init(e){if(this._initialized=!0,(e=e||{}).cacheSettings&&(0,o.configureCache)(e.cacheSettings),e.payload)return await this.setPayload(e.payload),(0,o.startStreaming)(this,e),{success:!0,source:"init"};{const{data:t,...i}=await this._refresh({...e,allowStale:!0});return(0,o.startStreaming)(this,e),await this.setPayload(t||{}),i}}async loadFeatures(e){e=e||{},await this.init({skipCache:e.skipCache,timeout:e.timeout,streaming:(this._options.backgroundSync??!0)&&(e.autoRefresh||this._options.subscribeToChanges)})}async refreshFeatures(e){const t=await this._refresh({...e||{},allowStale:!1});t.data&&await this.setPayload(t.data)}getApiInfo(){return[this.getApiHosts().apiHost,this.getClientKey()]}getApiHosts(){return(0,a.getApiHosts)(this._options)}getClientKey(){return this._options.clientKey||""}getPayload(){return this._payload||{features:this.getFeatures(),experiments:this.getExperiments()}}getDecryptedPayload(){return this._decryptedPayload||this.getPayload()}isRemoteEval(){return this._options.remoteEval||!1}getCacheKeyAttributes(){return this._options.cacheKeyAttributes}async _refresh(e){let{timeout:t,skipCache:i,allowStale:r,streaming:n}=e;if(!this._options.clientKey)throw new Error("Missing clientKey");return(0,o.refreshFeatures)({instance:this,timeout:t,skipCache:i||this._options.disableCache,allowStale:r,backgroundSync:n??this._options.backgroundSync??!0})}_render(){if(this._renderer)try{this._renderer()}catch(e){console.error("Failed to render",e)}}setFeatures(e){this._options.features=e,this.ready=!0,this._render()}async setEncryptedFeatures(e,t,i){const r=await(0,s.decrypt)(e,t||this._options.decryptionKey,i);this.setFeatures(JSON.parse(r))}setExperiments(e){this._options.experiments=e,this.ready=!0,this._updateAllAutoExperiments()}async setEncryptedExperiments(e,t,i){const r=await(0,s.decrypt)(e,t||this._options.decryptionKey,i);this.setExperiments(JSON.parse(r))}async setAttributes(e){this._options.attributes=e,this._options.stickyBucketService&&await this.refreshStickyBuckets(),this._options.remoteEval?await this._refreshForRemoteEval():(this._render(),this._updateAllAutoExperiments())}async updateAttributes(e){return this.setAttributes({...this._options.attributes,...e})}async setAttributeOverrides(e){this._options.attributeOverrides=e,this._options.stickyBucketService&&await this.refreshStickyBuckets(),this._options.remoteEval?await this._refreshForRemoteEval():(this._render(),this._updateAllAutoExperiments())}async setForcedVariations(e){this._options.forcedVariations=e||{},this._options.remoteEval?await this._refreshForRemoteEval():(this._render(),this._updateAllAutoExperiments())}setForcedFeatures(e){this._options.forcedFeatureValues=e,this._render()}async setURL(e){if(e!==this._options.url){if(this._options.url=e,this._redirectedUrl="",this._options.remoteEval)return await this._refreshForRemoteEval(),void this._updateAllAutoExperiments(!0);this._updateAllAutoExperiments(!0)}}getAttributes(){return{...this._options.attributes,...this._options.attributeOverrides}}getForcedVariations(){return this._options.forcedVariations||{}}getForcedFeatures(){return this._options.forcedFeatureValues||new Map}getStickyBucketAssignmentDocs(){return this._options.stickyBucketAssignmentDocs||{}}getUrl(){return this._options.url||""}getFeatures(){return this._options.features||{}}getExperiments(){return this._options.experiments||[]}getCompletedChangeIds(){return Array.from(this._completedChangeIds)}subscribe(e){return this._subscriptions.add(e),()=>{this._subscriptions.delete(e)}}async _refreshForRemoteEval(){if(!this._options.remoteEval)return;if(!this._initialized)return;const e=await this._refresh({allowStale:!1});e.data&&await this.setPayload(e.data)}getAllResults(){return new Map(this._assigned)}onDestroy(e){this._destroyCallbacks.push(e)}isDestroyed(){return!!this._destroyed}destroy(e){e=e||{},this._destroyed=!0,this._destroyCallbacks.forEach(e=>{try{e()}catch(e){console.error(e)}}),this._subscriptions.clear(),this._assigned.clear(),this._trackedExperiments.clear(),this._completedChangeIds.clear(),this._deferredTrackingCalls.clear(),this._trackedFeatures={},this._destroyCallbacks=[],this._payload=void 0,this._saveStickyBucketAssignmentDoc=void 0,(0,o.unsubscribe)(this),e.destroyAllStreams&&(0,o.clearAutoRefresh)(),this.logs=[],l&&window._growthbook===this&&delete window._growthbook,this._activeAutoExperiments.forEach(e=>{e.undo()}),this._activeAutoExperiments.clear(),this._triggeredExpKeys.clear()}setRenderer(e){this._renderer=e}forceVariation(e,t){this._options.forcedVariations=this._options.forcedVariations||{},this._options.forcedVariations[e]=t,this._options.remoteEval?this._refreshForRemoteEval():(this._updateAllAutoExperiments(),this._render())}run(e){const{result:t}=(0,a.runExperiment)(e,null,this._getEvalContext());return this._onExperimentEval(e,t),t}triggerExperiment(e){return this._triggeredExpKeys.add(e),this._options.experiments?this._options.experiments.filter(t=>t.key===e).map(e=>this._runAutoExperiment(e)).filter(e=>null!==e):null}triggerAutoExperiments(){this._autoExperimentsAllowed=!0,this._updateAllAutoExperiments(!0)}_getEvalContext(){return{user:this._getUserContext(),global:this._getGlobalContext(),stack:{evaluatedFeatures:new Set}}}_getUserContext(){return{attributes:this._options.user?{...this._options.user,...this._options.attributes}:this._options.attributes,enableDevMode:this._options.enableDevMode,blockedChangeIds:this._options.blockedChangeIds,stickyBucketAssignmentDocs:this._options.stickyBucketAssignmentDocs,url:this._getContextUrl(),forcedVariations:this._options.forcedVariations,forcedFeatureValues:this._options.forcedFeatureValues,attributeOverrides:this._options.attributeOverrides,saveStickyBucketAssignmentDoc:this._saveStickyBucketAssignmentDoc,trackingCallback:this._options.trackingCallback,onFeatureUsage:this._options.onFeatureUsage,devLogs:this.logs,trackedExperiments:this._trackedExperiments,trackedFeatureUsage:this._trackedFeatures}}_getGlobalContext(){return{features:this._options.features,experiments:this._options.experiments,log:this.log,enabled:this._options.enabled,qaMode:this._options.qaMode,savedGroups:this._options.savedGroups,groups:this._options.groups,overrides:this._options.overrides,onExperimentEval:this._onExperimentEval,recordChangeId:this._recordChangedId,saveDeferredTrack:this._saveDeferredTrack,eventLogger:this._options.eventLogger}}_runAutoExperiment(e,t){const i=this._activeAutoExperiments.get(e);if(e.manual&&!this._triggeredExpKeys.has(e.key)&&!i)return null;let r,n;this._isAutoExperimentBlockedByContext(e)?r=(0,a.getExperimentResult)(this._getEvalContext(),e,-1,!1,""):(({result:r,trackingCall:n}=(0,a.runExperiment)(e,null,this._getEvalContext())),this._onExperimentEval(e,r));const o=JSON.stringify(r.value);if(!t&&r.inExperiment&&i&&i.valueHash===o)return r;if(i&&this._undoActiveAutoExperiment(e),r.inExperiment){const t=(0,s.getAutoExperimentChangeType)(e);if("redirect"===t&&r.value.urlRedirect&&e.urlPatterns){const t=e.persistQueryString?(0,s.mergeQueryStrings)(this._getContextUrl(),r.value.urlRedirect):r.value.urlRedirect;if((0,s.isURLTargeted)(t,e.urlPatterns))return this.log("Skipping redirect because original URL matches redirect URL",{id:e.key}),r;this._redirectedUrl=t;const{navigate:i,delay:o}=this._getNavigateFunction();if(i)if(l)Promise.all([...n?[(0,s.promiseTimeout)(n,this._options.maxNavigateDelay??1e3)]:[],new Promise(e=>window.setTimeout(e,this._options.navigateDelay??o))]).then(()=>{try{i(t)}catch(e){console.error(e)}});else try{i(t)}catch(e){console.error(e)}}else if("visual"===t){const t=this._options.applyDomChangesCallback?this._options.applyDomChangesCallback(r.value):this._applyDOMChanges(r.value);t&&this._activeAutoExperiments.set(e,{undo:t,valueHash:o})}}return r}_undoActiveAutoExperiment(e){const t=this._activeAutoExperiments.get(e);t&&(t.undo(),this._activeAutoExperiments.delete(e))}_updateAllAutoExperiments(e){if(!this._autoExperimentsAllowed)return;const t=this._options.experiments||[],i=new Set(t);this._activeAutoExperiments.forEach((e,t)=>{i.has(t)||(e.undo(),this._activeAutoExperiments.delete(t))});for(const i of t){const t=this._runAutoExperiment(i,e);if(t&&t.inExperiment&&"redirect"===(0,s.getAutoExperimentChangeType)(i))break}}_onExperimentEval(e,t){const i=this._assigned.get(e.key);this._assigned.set(e.key,{experiment:e,result:t}),this._subscriptions.size>0&&this._fireSubscriptions(e,t,i)}_fireSubscriptions(e,t,i){i&&i.result.inExperiment===t.inExperiment&&i.result.variationId===t.variationId||this._subscriptions.forEach(i=>{try{i(e,t)}catch(e){console.error(e)}})}_recordChangedId(e){this._completedChangeIds.add(e)}isOn(e){return this.evalFeature(e).on}isOff(e){return this.evalFeature(e).off}getFeatureValue(e,t){const i=this.evalFeature(e).value;return null===i?t:i}feature(e){return this.evalFeature(e)}evalFeature(e){return(0,a.evalFeature)(e,this._getEvalContext())}log(e,t){this.debug&&(this._options.log?this._options.log(e,t):console.log(e,t))}getDeferredTrackingCalls(){return Array.from(this._deferredTrackingCalls.values())}setDeferredTrackingCalls(e){this._deferredTrackingCalls=new Map(e.filter(e=>e&&e.experiment&&e.result).map(e=>[(0,a.getExperimentDedupeKey)(e.experiment,e.result),e]))}async fireDeferredTrackingCalls(){if(!this._options.trackingCallback)return;const e=[];this._deferredTrackingCalls.forEach(t=>{t&&t.experiment&&t.result?e.push(this._options.trackingCallback(t.experiment,t.result)):console.error("Invalid deferred tracking call",{call:t})}),this._deferredTrackingCalls.clear(),await Promise.all(e)}setTrackingCallback(e){this._options.trackingCallback=e,this.fireDeferredTrackingCalls()}setEventLogger(e){this._options.eventLogger=e}async logEvent(e,t){if(this._destroyed)console.error("Cannot log event to destroyed GrowthBook instance");else if(this._options.enableDevMode&&this.logs.push({eventName:e,properties:t,timestamp:Date.now().toString(),logType:"event"}),this._options.eventLogger)try{await this._options.eventLogger(e,t||{},this._getUserContext())}catch(e){console.error(e)}else console.error("No event logger configured")}_saveDeferredTrack(e){this._deferredTrackingCalls.set((0,a.getExperimentDedupeKey)(e.experiment,e.result),e)}_getContextUrl(){return this._options.url||(l?window.location.href:"")}_isAutoExperimentBlockedByContext(e){const t=(0,s.getAutoExperimentChangeType)(e);if("visual"===t){if(this._options.disableVisualExperiments)return!0;if(this._options.disableJsInjection&&e.variations.some(e=>e.js))return!0}else{if("redirect"!==t)return!0;if(this._options.disableUrlRedirectExperiments)return!0;try{const t=new URL(this._getContextUrl());for(const i of e.variations){if(!i||!i.urlRedirect)continue;const e=new URL(i.urlRedirect);if(this._options.disableCrossOriginUrlRedirectExperiments){if(e.protocol!==t.protocol)return!0;if(e.host!==t.host)return!0}}}catch(t){return this.log("Error parsing current or redirect URL",{id:e.key,error:t}),!0}}return!(!e.changeId||!(this._options.blockedChangeIds||[]).includes(e.changeId))}getRedirectUrl(){return this._redirectedUrl}_getNavigateFunction(){return this._options.navigate?{navigate:this._options.navigate,delay:0}:l?{navigate:e=>{window.location.replace(e)},delay:100}:{navigate:null,delay:0}}_applyDOMChanges(e){if(!l)return;const t=[];if(e.css){const i=document.createElement("style");i.innerHTML=e.css,document.head.appendChild(i),t.push(()=>i.remove())}if(e.js){const i=document.createElement("script");i.innerHTML=e.js,this._options.jsInjectionNonce&&(i.nonce=this._options.jsInjectionNonce),document.head.appendChild(i),t.push(()=>i.remove())}return e.domMutations&&e.domMutations.forEach(e=>{t.push(n.default.declarative(e).revert)}),()=>{t.forEach(e=>e())}}async refreshStickyBuckets(e){if(this._options.stickyBucketService){const t=this._getEvalContext(),i=await(0,a.getAllStickyBucketAssignmentDocs)(t,this._options.stickyBucketService,e);this._options.stickyBucketAssignmentDocs=i}}generateStickyBucketAssignmentDocsSync(e,t){if(!("getAllAssignmentsSync"in e))return void console.error("generating StickyBucketAssignmentDocs docs requires StickyBucketServiceSync");const i=this._getEvalContext(),r=(0,a.getStickyBucketAttributes)(i,t);return e.getAllAssignmentsSync(r)}inDevMode(){return!!this._options.enableDevMode}}t.GrowthBook=c},343(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t,i=(t="string"==typeof e?(0,n.default)(e):e,Uint8Array.of((15&t[6])<<4|t[7]>>4&15,(15&t[7])<<4|(240&t[4])>>4,(15&t[4])<<4|(240&t[5])>>4,(15&t[5])<<4|(240&t[0])>>4,(15&t[0])<<4|(240&t[1])>>4,(15&t[1])<<4|(240&t[2])>>4,96|15&t[2],t[3],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15]));return"string"==typeof e?(0,s.unsafeStringify)(i):i};var r,n=(r=i(792))&&r.__esModule?r:{default:r},s=i(910)},350(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StickyBucketServiceSync=t.StickyBucketService=t.RedisStickyBucketService=t.LocalStorageStickyBucketService=t.ExpressCookieStickyBucketService=t.BrowserCookieStickyBucketService=void 0;var r=i(106),n=i(569);class s{constructor(e){e=e||{},this.prefix=e.prefix||""}async getAllAssignments(e){const t={};return(await Promise.all(Object.entries(e).map(e=>{let[t,i]=e;return this.getAssignments(t,i)}))).forEach(e=>{if(e){const i=(0,n.getStickyBucketAttributeKey)(e.attributeName,e.attributeValue);t[i]=e}}),t}getKey(e,t){return`${this.prefix}${e}||${t}`}}t.StickyBucketService=s;class o extends s{async getAssignments(e,t){return this.getAssignmentsSync(e,t)}async saveAssignments(e){this.saveAssignmentsSync(e)}getAllAssignmentsSync(e){const t={};return Object.entries(e).map(e=>{let[t,i]=e;return this.getAssignmentsSync(t,i)}).forEach(e=>{if(e){const i=(0,n.getStickyBucketAttributeKey)(e.attributeName,e.attributeValue);t[i]=e}}),t}}t.StickyBucketServiceSync=o,t.LocalStorageStickyBucketService=class extends s{constructor(e){e=e||{},super(),this.prefix=e.prefix||"gbStickyBuckets__";try{this.localStorage=e.localStorage||globalThis.localStorage}catch(e){}}async getAssignments(e,t){const i=this.getKey(e,t);let r=null;if(!this.localStorage)return r;try{const e=await this.localStorage.getItem(i)||"{}",t=JSON.parse(e);t.attributeName&&t.attributeValue&&t.assignments&&(r=t)}catch(e){}return r}async saveAssignments(e){const t=this.getKey(e.attributeName,e.attributeValue);if(this.localStorage)try{await this.localStorage.setItem(t,JSON.stringify(e))}catch(e){}}},t.ExpressCookieStickyBucketService=class extends o{constructor(e){let{prefix:t="gbStickyBuckets__",req:i,res:r,cookieAttributes:n={maxAge:15552e6}}=e;super(),this.prefix=t,this.req=i,this.res=r,this.cookieAttributes=n}getAssignmentsSync(e,t){const i=this.getKey(e,t);let r=null;if(!this.req)return r;try{const e=this.req.cookies[i]||"{}",t=JSON.parse(e);t.attributeName&&t.attributeValue&&t.assignments&&(r=t)}catch(e){}return r}saveAssignmentsSync(e){const t=this.getKey(e.attributeName,e.attributeValue);if(!this.res)return;const i=JSON.stringify(e);this.res.cookie(encodeURIComponent(t),encodeURIComponent(i),this.cookieAttributes)}},t.BrowserCookieStickyBucketService=class extends o{constructor(e){let{prefix:t="gbStickyBuckets__",jsCookie:i,cookieAttributes:r={expires:180}}=e;super(),this.prefix=t,this.jsCookie=i,this.cookieAttributes=r}getAssignmentsSync(e,t){const i=this.getKey(e,t);let r=null;if(!this.jsCookie)return r;try{const e=this.jsCookie.get(i),t=JSON.parse(e||"{}");t.attributeName&&t.attributeValue&&t.assignments&&(r=t)}catch(e){}return r}async saveAssignmentsSync(e){const t=this.getKey(e.attributeName,e.attributeValue);if(!this.jsCookie)return;const i=JSON.stringify(e);this.jsCookie.set(t,i,this.cookieAttributes)}},t.RedisStickyBucketService=class extends s{constructor(e){let{redis:t}=e;super(),this.redis=t}async getAllAssignments(e){const t={},i=Object.entries(e).map(e=>{let[t,i]=e;return(0,n.getStickyBucketAttributeKey)(t,i)});return this.redis?(await this.redis.mget(...i).then(e=>{e.forEach(e=>{try{const i=JSON.parse(e||"{}");if(i.attributeName&&"attributeValue"in i&&i.assignments){const e=(0,n.getStickyBucketAttributeKey)(i.attributeName,(0,r.toString)(i.attributeValue));t[e]=i}}catch(e){}})}),t):t}async getAssignments(e,t){return null}async saveAssignments(e){const t=this.getKey(e.attributeName,e.attributeValue);this.redis&&await this.redis.set(t,JSON.stringify(e))}}},396(e,t,i){"use strict";var r=this&&this.__assign||function(){return r=Object.assign||function(e){for(var t,i=1,r=arguments.length;i<r;i++)for(var n in t=arguments[i])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},r.apply(this,arguments)},n=this&&this.__awaiter||function(e,t,i,r){return new(i||(i=Promise))(function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((r=r.apply(e,t||[])).next())})},s=this&&this.__generator||function(e,t){var i,r,n,s,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(l){return function(a){if(i)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(i=1,r&&(n=2&a[0]?r.return:a[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,a[1])).done)return n;switch(r=0,n&&(a=[2&a[0],n.value]),a[0]){case 0:case 1:n=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((n=(n=o.trys).length>0&&n[n.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!n||a[1]>n[0]&&a[1]<n[3])){o.label=a[1];break}if(6===a[0]&&o.label<n[1]){o.label=n[1],n=a;break}if(n&&o.label<n[2]){o.label=n[2],o.ops.push(a);break}n[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],r=0}finally{i=n=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Analytics=t.createAnalyticsInstance=void 0;var a=i(316),l=i(706),u=i(488),c=o(i(733)),d=i(154);function h(e){var t,i,o,h=this,p={},f={},v=[],_=[],m=function(e,i){return null==t?void 0:t.getFeatureValue(e,i)},y=function(){var e=(null==i?void 0:i.getUserId())||"";return e&&!g(e)?e:""},b={initialise:function(e){var v=e.growthbookKey,y=e.growthbookDecryptionKey,b=e.rudderstackKey,w=e.posthogKey,k=e.posthogHost,E=e.growthbookOptions,S=e.disableRudderstackAMD,A=void 0!==S&&S;return n(h,void 0,void 0,function(){var e,S,x,I,P,C,T,O,R,$,D,M,L,N,F,B,U,j,V,H,G,q,z,K,W,J,Y;return s(this,function(Q){switch(Q.label){case 0:return Q.trys.push([0,3,,4]),(S=null===(P=null==E?void 0:E.attributes)||void 0===P?void 0:P.country)?[3,2]:[4,n(h,void 0,void 0,function(){var e,t,i,r,n;return s(this,function(s){switch(s.label){case 0:return[4,d.CountryUtils.getCountry()];case 1:if(e=s.sent(),t=c.default.get("clients_country"),i=c.default.get("website_status"),r="",i)try{r=(null===(n=JSON.parse(i))||void 0===n?void 0:n.clients_country)||""}catch(e){console.error("Failed to parse cookie: ",e)}return[2,t||r||e]}})})];case 1:S=Q.sent(),Q.label=2;case 2:return e=S,i=l.RudderStack.getRudderStackInstance(b,A,function(){_.forEach(function(e){e&&(null==i||i.identifyEvent(e,{language:(null==p?void 0:p.user_language)||"en"}),(null==o?void 0:o.has_initialized)&&(null==o||o.identifyEvent(e,{language:(null==p?void 0:p.user_language)||"en"})))}),_=[]}),w&&(o=u.PostHogAnalytics.getPostHogInstance(w,k||"https://ph.deriv.com",A,function(){_.forEach(function(e){e&&(null==o||o.identifyEvent(e,{language:(null==p?void 0:p.user_language)||"en"}))})})),(null==E?void 0:E.attributes)&&Object.keys(E.attributes).length>0&&(p=r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r({},p),{country:e}),(null===(C=null==E?void 0:E.attributes)||void 0===C?void 0:C.user_language)&&{user_language:null==E?void 0:E.attributes.user_language}),(null===(T=null==E?void 0:E.attributes)||void 0===T?void 0:T.account_type)&&{account_type:null==E?void 0:E.attributes.account_type}),(null===(O=null==E?void 0:E.attributes)||void 0===O?void 0:O.app_id)&&{app_id:null==E?void 0:E.attributes.app_id}),(null===(R=null==E?void 0:E.attributes)||void 0===R?void 0:R.residence_country)&&{residence_country:null===($=null==E?void 0:E.attributes)||void 0===$?void 0:$.residence_country}),(null===(D=null==E?void 0:E.attributes)||void 0===D?void 0:D.device_type)&&{device_type:null==E?void 0:E.attributes.device_type}),(null===(M=null==E?void 0:E.attributes)||void 0===M?void 0:M.url)&&{url:null==E?void 0:E.attributes.url}),(null==E?void 0:E.attributes)&&{loggedIn:!!(null===(L=null==E?void 0:E.attributes)||void 0===L?void 0:L.loggedIn)}),(null===(N=null==E?void 0:E.attributes)||void 0===N?void 0:N.email_hash)&&{email_hash:null==E?void 0:E.attributes.email_hash}),(null===(F=null==E?void 0:E.attributes)||void 0===F?void 0:F.network_type)&&{network_type:null==E?void 0:E.attributes.network_type}),(null===(B=null==E?void 0:E.attributes)||void 0===B?void 0:B.network_rtt)&&{network_rtt:null==E?void 0:E.attributes.network_rtt}),(null===(U=null==E?void 0:E.attributes)||void 0===U?void 0:U.network_downlink)&&{network_downlink:null==E?void 0:E.attributes.network_downlink}),(null===(j=null==E?void 0:E.attributes)||void 0===j?void 0:j.user_id)&&!g(null===(V=null==E?void 0:E.attributes)||void 0===V?void 0:V.user_id)&&{user_id:null===(H=null==E?void 0:E.attributes)||void 0===H?void 0:H.user_id}),(null==E?void 0:E.attributes)&&{anonymous_id:i.getAnonymousId()}),(null===(G=null==E?void 0:E.attributes)||void 0===G?void 0:G.account_currency)&&{account_currency:null==E?void 0:E.attributes.account_currency}),(null===(q=null==E?void 0:E.attributes)||void 0===q?void 0:q.account_mode)&&{account_mode:null==E?void 0:E.attributes.account_mode})),null!=E||(E={}),null!==(z=E.attributes)&&void 0!==z||(E.attributes={}),null!==(K=(J=E.attributes).id)&&void 0!==K||(J.id=i.getAnonymousId()),null!==(W=(Y=E.attributes).country)&&void 0!==W||(Y.country=e),v&&(t=a.Growthbook.getGrowthBookInstance(v,y,E),x=setInterval(function(){Object.keys(f).length>0?clearInterval(x):f=m("tracking-buttons-config",{})},1e3)),[3,4];case 3:return I=Q.sent(),console.log("Error in initializing analytics",I),[3,4];case 4:return[2]}})})},setAttributes:function(e){var n=e.country,s=e.user_language,o=e.device_language,a=e.device_type,l=e.account_type,u=e.user_id,c=e.anonymous_id,d=e.app_id,h=e.utm_source,f=e.utm_medium,v=e.utm_campaign,_=e.is_authorised,m=e.residence_country,b=e.url,w=e.domain,k=e.geo_location,E=e.loggedIn,S=e.network_downlink,A=e.network_rtt,x=e.network_type,I=e.account_currency,P=e.account_mode;if(i){var C=null!=u?u:y();if(t){var T=r(r({country:n,residence_country:m,user_language:s,device_language:o,device_type:a,utm_source:h,utm_medium:f,utm_campaign:v,is_authorised:_,url:b,domain:w,loggedIn:E},u&&!g(u)&&{user_id:u}),{anonymous_id:c});C&&(T.id=C,T.user_id=C),t.setAttributes(T)}p=r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r({},p),void 0!==n&&{country:n}),void 0!==k&&{geo_location:k}),void 0!==s&&{user_language:s}),void 0!==l&&{account_type:l}),void 0!==d&&{app_id:d}),void 0!==m&&{residence_country:m}),void 0!==a&&{device_type:a}),void 0!==b&&{url:b}),void 0!==E&&{loggedIn:E}),void 0!==S&&{network_downlink:S}),void 0!==A&&{network_rtt:A}),void 0!==x&&{network_type:x}),void 0!==u&&!g(u)&&{user_id:u}),void 0!==c&&{anonymous_id:c}),void 0!==I&&{account_currency:I}),void 0!==P&&{account_mode:P})}},identifyEvent:function(e){var t=e||y();if(((null==i?void 0:i.has_initialized)||(null==o?void 0:o.has_initialized))&&t)return(null==i?void 0:i.has_initialized)&&(null==i||i.identifyEvent(t,{language:(null==p?void 0:p.user_language)||"en"})),void((null==o?void 0:o.has_initialized)&&(null==o||o.identifyEvent(t,{language:(null==p?void 0:p.user_language)||"en"})));t&&_.push(t)},getFeatureState:function(e){var i,r;return null===(r=null===(i=null==t?void 0:t.getFeatureState(e))||void 0===i?void 0:i.experimentResult)||void 0===r?void 0:r.name},getFeatureValue:m,getGrowthbookStatus:function(){return n(h,void 0,void 0,function(){return s(this,function(e){switch(e.label){case 0:return[4,null==t?void 0:t.getStatus()];case 1:return[2,e.sent()]}})})},isFeatureOn:function(e){return null==t?void 0:t.isOn(e)},setUrl:function(e){return null==t?void 0:t.setUrl(e)},getId:y,trackEvent:function(e,t){var n,s=y(),a={};if("event_metadata"in(n=t)||"cta_information"in n||"error"in n){var l=t;a=r(r({},l),{event_metadata:r(r(r({},p),s&&{user_id:s}),l.event_metadata)})}else a=r(r(r({},p),t),s&&{user_id:s});navigator.onLine&&(i||o)?(v.length>0&&v.forEach(function(e,t){null==i||i.track(e.event,e.payload),null==o||o.track(e.event,e.payload),delete v[t]}),e in f?f[e]&&(null==i||i.track(e,a),null==o||o.track(e,a)):(null==i||i.track(e,a),null==o||o.track(e,a))):v.push({event:e,payload:a})},getInstances:function(){return{ab:t,tracking:i,posthog:o}},pageView:function(e,t,r){if(void 0===t&&(t="Deriv App"),i){var n=y();null==i||i.pageView(e,t,n,r),null==o||o.pageView(e,t,n,r)}},reset:function(){(i||o)&&(null==i||i.reset(),null==o||o.reset())}};return"undefined"!=typeof window&&(window.AnalyticsInstance=b),b}t.createAnalyticsInstance=h,t.Analytics=h();var g=function(e){return/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)}},427(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.evalCondition=s;var r=i(106);const n={};function s(e,t,i){i=i||{};for(const[r,n]of Object.entries(t))switch(r){case"$or":if(!d(e,n,i))return!1;break;case"$nor":if(d(e,n,i))return!1;break;case"$and":if(!h(e,n,i))return!1;break;case"$not":if(s(e,n,i))return!1;break;default:if(!a(n,o(e,r),i))return!1}return!0}function o(e,t){const i=t.split(".");let r=e;for(let e=0;e<i.length;e++){if(!r||"object"!=typeof r||!(i[e]in r))return null;r=r[i[e]]}return r}function a(e,t,i){if("string"==typeof e)return t+""===e;if("number"==typeof e)return 1*t===e;if("boolean"==typeof e)return null!==t&&!!t===e;if(null===e)return null===t;if(Array.isArray(e)||!l(e))return JSON.stringify(t)===JSON.stringify(e);for(const r in e)if(!c(r,t,e[r],i))return!1;return!0}function l(e){const t=Object.keys(e);return t.length>0&&t.filter(e=>"$"===e[0]).length===t.length}function u(e,t){return Array.isArray(e)?e.some(e=>t.includes(e)):t.includes(e)}function c(e,t,i,o){switch(e){case"$veq":return(0,r.paddedVersionString)(t)===(0,r.paddedVersionString)(i);case"$vne":return(0,r.paddedVersionString)(t)!==(0,r.paddedVersionString)(i);case"$vgt":return(0,r.paddedVersionString)(t)>(0,r.paddedVersionString)(i);case"$vgte":return(0,r.paddedVersionString)(t)>=(0,r.paddedVersionString)(i);case"$vlt":return(0,r.paddedVersionString)(t)<(0,r.paddedVersionString)(i);case"$vlte":return(0,r.paddedVersionString)(t)<=(0,r.paddedVersionString)(i);case"$eq":return t===i;case"$ne":return t!==i;case"$lt":return t<i;case"$lte":return t<=i;case"$gt":return t>i;case"$gte":return t>=i;case"$exists":return i?null!=t:null==t;case"$in":return!!Array.isArray(i)&&u(t,i);case"$inGroup":return u(t,o[i]||[]);case"$notInGroup":return!u(t,o[i]||[]);case"$nin":return!!Array.isArray(i)&&!u(t,i);case"$not":return!a(i,t,o);case"$size":return!!Array.isArray(t)&&a(i,t.length,o);case"$elemMatch":return function(e,t,i){if(!Array.isArray(e))return!1;const r=l(t)?e=>a(t,e,i):e=>s(e,t,i);for(let t=0;t<e.length;t++)if(e[t]&&r(e[t]))return!0;return!1}(t,i,o);case"$all":if(!Array.isArray(t))return!1;for(let e=0;e<i.length;e++){let r=!1;for(let n=0;n<t.length;n++)if(a(i[e],t[n],o)){r=!0;break}if(!r)return!1}return!0;case"$regex":try{return(c=i,n[c]||(n[c]=new RegExp(c.replace(/([^\\])\//g,"$1\\/"))),n[c]).test(t)}catch(e){return!1}case"$type":return function(e){if(null===e)return"null";if(Array.isArray(e))return"array";const t=typeof e;return["string","number","boolean","object","undefined"].includes(t)?t:"unknown"}(t)===i;default:return console.error("Unknown operator: "+e),!1}var c}function d(e,t,i){if(!t.length)return!0;for(let r=0;r<t.length;r++)if(s(e,t[r],i))return!0;return!1}function h(e,t,i){for(let r=0;r<t.length;r++)if(!s(e,t[r],i))return!1;return!0}},476(e,t,i){"use strict";i.r(t),i.d(t,{COPY_AUTOCAPTURE_EVENT:()=>Ji,Compression:()=>Yi,DEFAULT_PRODUCT_TOUR_APPEARANCE:()=>To,DisplaySurveyType:()=>Os,PostHog:()=>Po,SurveyEventName:()=>Cs,SurveyEventProperties:()=>Ts,SurveyEventType:()=>ws,SurveyPosition:()=>Es,SurveyQuestionBranchingType:()=>Is,SurveyQuestionType:()=>xs,SurveySchedule:()=>Ps,SurveyTabPosition:()=>Ss,SurveyType:()=>As,SurveyWidgetType:()=>ks,default:()=>Oo,posthog:()=>Oo,severityLevels:()=>Qi});var r="undefined"!=typeof window?window:void 0,n="undefined"!=typeof globalThis?globalThis:r;"undefined"==typeof self&&(n.self=n),"undefined"==typeof File&&(n.File=function(){});var s=Array.prototype,o=s.forEach,a=s.indexOf,l=null==n?void 0:n.navigator,u=null==n?void 0:n.document,c=null==n?void 0:n.location,d=null==n?void 0:n.fetch,h=null!=n&&n.XMLHttpRequest&&"withCredentials"in new n.XMLHttpRequest?n.XMLHttpRequest:void 0,g=null==n?void 0:n.AbortController,p=null==l?void 0:l.userAgent,f=null!=r?r:{},v={DEBUG:!1,LIB_VERSION:"1.313.0"};function _(e,t,i,r,n,s,o){try{var a=e[s](o),l=a.value}catch(e){return void i(e)}a.done?t(l):Promise.resolve(l).then(r,n)}function m(e){return function(){var t=this,i=arguments;return new Promise(function(r,n){var s=e.apply(t,i);function o(e){_(s,r,n,o,a,"next",e)}function a(e){_(s,r,n,o,a,"throw",e)}o(void 0)})}}function y(){return y=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},y.apply(null,arguments)}function b(e,t){if(null==e)return{};var i={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;i[r]=e[r]}return i}var w=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],k=function(e,t){if(void 0===t&&(t=[]),!e)return!1;var i=e.toLowerCase();return w.concat(t).some(e=>{var t=e.toLowerCase();return-1!==i.indexOf(t)})},E=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"];function S(e,t){return-1!==e.indexOf(t)}var A=function(e){return e.trim()},x=function(e){return e.replace(/^\$/,"")},I=Array.isArray,P=Object.prototype,C=P.hasOwnProperty,T=P.toString,O=I||function(e){return"[object Array]"===T.call(e)},R=e=>"function"==typeof e,$=e=>e===Object(e)&&!O(e),D=e=>{if($(e)){for(var t in e)if(C.call(e,t))return!1;return!0}return!1},M=e=>void 0===e,L=e=>"[object String]"==T.call(e),N=e=>L(e)&&0===e.trim().length,F=e=>null===e,B=e=>M(e)||F(e),U=e=>"[object Number]"==T.call(e),j=e=>"[object Boolean]"===T.call(e),V=e=>S(E,e);function H(e){return null===e||"object"!=typeof e}function G(e,t){return Object.prototype.toString.call(e)==="[object "+t+"]"}function q(e){return!M(Event)&&function(e,t){try{return e instanceof t}catch(e){return!1}}(e,Event)}var z=[!0,"true",1,"1","yes"],K=e=>S(z,e),W=[!1,"false",0,"0","no"];function J(e,t,i,r,n){return t>i&&(r.warn("min cannot be greater than max."),t=i),U(e)?e>i?(r.warn(" cannot be greater than max: "+i+". Using max value instead."),i):e<t?(r.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(r.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+n),J(n||i,t,i,r))}class Y{constructor(e){this.t={},this.i=e.i,this.o=J(e.bucketSize,0,100,e.h),this.m=J(e.refillRate,0,this.o,e.h),this.$=J(e.refillInterval,0,864e5,e.h)}S(e,t){var i=t-e.lastAccess,r=Math.floor(i/this.$);if(r>0){var n=r*this.m;e.tokens=Math.min(e.tokens+n,this.o),e.lastAccess=e.lastAccess+r*this.$}}consumeRateLimit(e){var t,i=Date.now(),r=String(e),n=this.t[r];return n?this.S(n,i):(n={tokens:this.o,lastAccess:i},this.t[r]=n),0===n.tokens||(n.tokens--,0===n.tokens&&(null==(t=this.i)||t.call(this,e)),0===n.tokens)}stop(){this.t={}}}var Q,Z,X,ee="Mobile",te="iOS",ie="Android",re="Tablet",ne=ie+" "+re,se="iPad",oe="Apple",ae=oe+" Watch",le="Safari",ue="BlackBerry",ce="Samsung",de=ce+"Browser",he=ce+" Internet",ge="Chrome",pe=ge+" OS",fe=ge+" "+te,ve="Internet Explorer",_e=ve+" "+ee,me="Opera",ye=me+" Mini",be="Edge",we="Microsoft "+be,ke="Firefox",Ee=ke+" "+te,Se="Nintendo",Ae="PlayStation",xe="Xbox",Ie=ie+" "+ee,Pe=ee+" "+le,Ce="Windows",Te=Ce+" Phone",Oe="Nokia",Re="Ouya",$e="Generic",De=$e+" "+ee.toLowerCase(),Me=$e+" "+re.toLowerCase(),Le="Konqueror",Ne="(\\d+(\\.\\d+)?)",Fe=new RegExp("Version/"+Ne),Be=new RegExp(xe,"i"),Ue=new RegExp(Ae+" \\w+","i"),je=new RegExp(Se+" \\w+","i"),Ve=new RegExp(ue+"|PlayBook|BB10","i"),He={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},Ge=function(e,t){return t=t||"",S(e," OPR/")&&S(e,"Mini")?ye:S(e," OPR/")?me:Ve.test(e)?ue:S(e,"IE"+ee)||S(e,"WPDesktop")?_e:S(e,de)?he:S(e,be)||S(e,"Edg/")?we:S(e,"FBIOS")?"Facebook "+ee:S(e,"UCWEB")||S(e,"UCBrowser")?"UC Browser":S(e,"CriOS")?fe:S(e,"CrMo")||S(e,ge)?ge:S(e,ie)&&S(e,le)?Ie:S(e,"FxiOS")?Ee:S(e.toLowerCase(),Le.toLowerCase())?Le:((e,t)=>t&&S(t,oe)||function(e){return S(e,le)&&!S(e,ge)&&!S(e,ie)}(e))(e,t)?S(e,ee)?Pe:le:S(e,ke)?ke:S(e,"MSIE")||S(e,"Trident/")?ve:S(e,"Gecko")?ke:""},qe={[_e]:[new RegExp("rv:"+Ne)],[we]:[new RegExp(be+"?\\/"+Ne)],[ge]:[new RegExp("("+ge+"|CrMo)\\/"+Ne)],[fe]:[new RegExp("CriOS\\/"+Ne)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Ne)],[le]:[Fe],[Pe]:[Fe],[me]:[new RegExp("(Opera|OPR)\\/"+Ne)],[ke]:[new RegExp(ke+"\\/"+Ne)],[Ee]:[new RegExp("FxiOS\\/"+Ne)],[Le]:[new RegExp("Konqueror[:/]?"+Ne,"i")],[ue]:[new RegExp(ue+" "+Ne),Fe],[Ie]:[new RegExp("android\\s"+Ne,"i")],[he]:[new RegExp(de+"\\/"+Ne)],[ve]:[new RegExp("(rv:|MSIE )"+Ne)],Mozilla:[new RegExp("rv:"+Ne)]},ze=function(e,t){var i=Ge(e,t),r=qe[i];if(M(r))return null;for(var n=0;n<r.length;n++){var s=r[n],o=e.match(s);if(o)return parseFloat(o[o.length-2])}return null},Ke=[[new RegExp(xe+"; "+xe+" (.*?)[);]","i"),e=>[xe,e&&e[1]||""]],[new RegExp(Se,"i"),[Se,""]],[new RegExp(Ae,"i"),[Ae,""]],[Ve,[ue,""]],[new RegExp(Ce,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[Te,""];if(new RegExp(ee).test(t)&&!/IEMobile\b/.test(t))return[Ce+" "+ee,""];var i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){var r=i[1],n=He[r]||"";return/arm/i.test(t)&&(n="RT"),[Ce,n]}return[Ce,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>{if(e&&e[3]){var t=[e[3],e[4],e[5]||"0"];return[te,t.join(".")]}return[te,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=M(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+ie+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+ie+")","i"),e=>{if(e&&e[2]){var t=[e[2],e[3],e[4]||"0"];return[ie,t.join(".")]}return[ie,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];if(e&&e[1]){var i=[e[1],e[2],e[3]||"0"];t[1]=i.join(".")}return t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[pe,""]],[/Linux|debian/i,["Linux",""]]],We=function(e){return je.test(e)?Se:Ue.test(e)?Ae:Be.test(e)?xe:new RegExp(Re,"i").test(e)?Re:new RegExp("("+Te+"|WPDesktop)","i").test(e)?Te:/iPad/.test(e)?se:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?ae:Ve.test(e)?ue:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(Oe,"i").test(e)?Oe:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(ee).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?ie:ne:new RegExp("(pda|"+ee+")","i").test(e)?De:new RegExp(re,"i").test(e)&&!new RegExp(re+" pc","i").test(e)?Me:""},Je=e=>e instanceof Error;function Ye(e){var t=globalThis._posthogChunkIds;if(t){var i=Object.keys(t);return X&&i.length===Z||(Z=i.length,X=i.reduce((i,r)=>{Q||(Q={});var n=Q[r];if(n)i[n[0]]=n[1];else for(var s=e(r),o=s.length-1;o>=0;o--){var a=s[o],l=null==a?void 0:a.filename,u=t[r];if(l&&u){i[l]=u,Q[r]=[l,u];break}}return i},{})),X}}class Qe{constructor(e,t,i){void 0===i&&(i=[]),this.coercers=e,this.stackParser=t,this.modifiers=i}buildFromUnknown(e,t){void 0===t&&(t={});var i=t&&t.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(i,t,0).apply(e),n=this.buildParsingContext(),s=this.parseStacktrace(r,n);return{$exception_list:this.convertToExceptionList(s,i),$exception_level:"error"}}modifyFrames(e){var t=this;return m(function*(){for(var i of e)i.stacktrace&&i.stacktrace.frames&&O(i.stacktrace.frames)&&(i.stacktrace.frames=yield t.applyModifiers(i.stacktrace.frames));return e})()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:null==(t=e.syntheticException)?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var i,r;return null!=e.cause&&(i=this.parseStacktrace(e.cause,t)),""!=e.stack&&null!=e.stack&&(r=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?1:0),t.chunkIdMap)),y({},e,{cause:i,stack:r})}applyChunkIds(e,t){return e.map(e=>(e.filename&&t&&(e.chunk_id=t[e.filename]),e))}applyCoercers(e,t){for(var i of this.coercers)if(i.match(e))return i.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return m(function*(){var i=e;for(var r of t.modifiers)i=yield r(i);return i})()}convertToExceptionList(e,t){var i,r,n,s={type:e.type,value:e.value,mechanism:{type:null!==(i=t.type)&&void 0!==i?i:"generic",handled:null===(r=t.handled)||void 0===r||r,synthetic:null!==(n=e.synthetic)&&void 0!==n&&n}};e.stack&&(s.stacktrace={type:"raw",frames:e.stack});var o=[s];return null!=e.cause&&o.push(...this.convertToExceptionList(e.cause,y({},t,{handled:!0}))),o}buildParsingContext(){return{chunkIdMap:Ye(this.stackParser)}}buildCoercingContext(e,t,i){void 0===i&&(i=0);var r=(i,r)=>{if(r<=4){var n=this.buildCoercingContext(e,t,r);return this.applyCoercers(i,n)}};return y({},t,{syntheticException:0==i?t.syntheticException:void 0,mechanism:e,apply:e=>r(e,i),next:e=>r(e,i+1)})}}var Ze="?";function Xe(e,t,i,r,n){var s={platform:e,filename:t,function:"<anonymous>"===i?Ze:i,in_app:!0};return M(r)||(s.lineno=r),M(n)||(s.colno=n),s}var et=(e,t)=>{var i=-1!==e.indexOf("safari-extension"),r=-1!==e.indexOf("safari-web-extension");return i||r?[-1!==e.indexOf("@")?e.split("@")[0]:Ze,i?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},tt=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,it=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,rt=/\((\S*)(?::(\d+))(?::(\d+))\)/,nt=(e,t)=>{var i=tt.exec(e);if(i){var[,r,n,s]=i;return Xe(t,r,Ze,+n,+s)}var o=it.exec(e);if(o){if(o[2]&&0===o[2].indexOf("eval")){var a=rt.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,u]=et(o[1]||Ze,o[2]);return Xe(t,u,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},st=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,ot=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,at=(e,t)=>{var i=st.exec(e);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){var r=ot.exec(i[3]);r&&(i[1]=i[1]||"eval",i[3]=r[1],i[4]=r[2],i[5]="")}var n=i[3],s=i[1]||Ze;return[s,n]=et(s,n),Xe(t,n,s,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},lt=/\(error: (.*)\)/;class ut{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var i=L(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:i?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?t+": "+e.message:t}isDOMException(e){return G(e,"DOMException")}isDOMError(e){return G(e,"DOMError")}}class ct{match(e){return(e=>e instanceof Error)(e)}coerce(e,t){return{type:this.getType(e),value:this.getMessage(e,t),stack:this.getStack(e),cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,t){var i=e.message;return i.error&&"string"==typeof i.error.message?String(i.error.message):String(i)}getStack(e){return e.stacktrace||e.stack||void 0}}class dt{constructor(){}match(e){return G(e,"ErrorEvent")&&null!=e.error}coerce(e,t){var i;return t.apply(e.error)||{type:"ErrorEvent",value:e.message,stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}}var ht=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class gt{match(e){return"string"==typeof e}coerce(e,t){var i,[r,n]=this.getInfos(e);return{type:null!=r?r:"Error",value:null!=n?n:e,stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}getInfos(e){var t="Error",i=e,r=e.match(ht);return r&&(t=r[1],i=r[2]),[t,i]}}var pt=["fatal","error","warning","log","info","debug"];function ft(e,t){void 0===t&&(t=40);var i=Object.keys(e);if(i.sort(),!i.length)return"[object has no keys]";for(var r=i.length;r>0;r--){var n=i.slice(0,r).join(", ");if(!(n.length>t))return r===i.length||n.length<=t?n:n.slice(0,t)+"..."}return""}class vt{match(e){return"object"==typeof e&&null!==e}coerce(e,t){var i,r=this.getErrorPropertyFromObject(e);return r?t.apply(r):{type:this.getType(e),value:this.getValue(e),stack:null==(i=t.syntheticException)?void 0:i.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return q(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&"string"==typeof e.name){var t="'"+e.name+"' captured as exception";return"message"in e&&"string"==typeof e.message&&(t+=" with message: '"+e.message+"'"),t}if("message"in e&&"string"==typeof e.message)return e.message;var i=this.getObjectClassName(e);return(i&&"Object"!==i?"'"+i+"'":"Object")+" captured as exception with keys: "+ft(e)}isSeverityLevel(e){return L(e)&&!N(e)&&pt.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var i=e[t];if(Je(i))return i}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(e){return}}}class _t{match(e){return q(e)}coerce(e,t){var i,r=e.constructor.name;return{type:r,value:r+" captured as exception with keys: "+ft(e),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}}class mt{match(e){return H(e)}coerce(e,t){var i;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}}class yt{match(e){return G(e,"PromiseRejectionEvent")}coerce(e,t){var i,r=this.getUnhandledRejectionReason(e);return H(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}:t.apply(r)}getUnhandledRejectionReason(e){if(H(e))return e;try{if("reason"in e)return e.reason;if("detail"in e&&"reason"in e.detail)return e.detail.reason}catch(e){}return e}}var bt=function(e,t){var{debugEnabled:i}=void 0===t?{}:t,n={k:function(t){if(r&&(v.DEBUG||f.POSTHOG_DEBUG||i)&&!M(r.console)&&r.console){for(var n=("__rrweb_original__"in r.console[t]?r.console[t].__rrweb_original__:r.console[t]),s=arguments.length,o=new Array(s>1?s-1:0),a=1;a<s;a++)o[a-1]=arguments[a];n(e,...o)}},info:function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];n.k("log",...t)},warn:function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];n.k("warn",...t)},error:function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];n.k("error",...t)},critical:function(){for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];console.error(e,...i)},uninitializedWarning:e=>{n.error("You must initialize PostHog before calling "+e)},createLogger:(t,i)=>bt(e+" "+t,i)};return n},wt=bt("[PostHog.js]"),kt=wt.createLogger,Et=kt("[ExternalScriptsLoader]"),St=(e,t,i)=>{if(e.config.disable_external_dependency_loading)return Et.warn(t+" was requested but loading of external scripts is disabled."),i("Loading of external scripts is disabled");var r=null==u?void 0:u.querySelectorAll("script");if(r)for(var n,s=function(){if(r[o].src===t){var e=r[o];return e.__posthog_loading_callback_fired?{v:i()}:(e.addEventListener("load",t=>{e.__posthog_loading_callback_fired=!0,i(void 0,t)}),e.onerror=e=>i(e),{v:void 0})}},o=0;o<r.length;o++)if(n=s())return n.v;var a=()=>{if(!u)return i("document not found");var r=u.createElement("script");if(r.type="text/javascript",r.crossOrigin="anonymous",r.src=t,r.onload=e=>{r.__posthog_loading_callback_fired=!0,i(void 0,e)},r.onerror=e=>i(e),e.config.prepare_external_dependency_script&&(r=e.config.prepare_external_dependency_script(r)),!r)return i("prepare_external_dependency_script returned null");var n,s=u.querySelectorAll("body > script");s.length>0?null==(n=s[0].parentNode)||n.insertBefore(r,s[0]):u.body.appendChild(r)};null!=u&&u.body?a():null==u||u.addEventListener("DOMContentLoaded",a)};f.__PosthogExtensions__=f.__PosthogExtensions__||{},f.__PosthogExtensions__.loadExternalDependency=(e,t,i)=>{var r="/static/"+t+".js?v="+e.version;if("remote-config"===t&&(r="/array/"+e.config.token+"/config.js"),"toolbar"===t){var n=3e5;r=r+"&t="+Math.floor(Date.now()/n)*n}var s=e.requestRouter.endpointFor("assets",r);St(e,s,i)},f.__PosthogExtensions__.loadSiteApp=(e,t,i)=>{var r=e.requestRouter.endpointFor("api",t);St(e,r,i)};var At={};function xt(e,t,i){if(O(e))if(o&&e.forEach===o)e.forEach(t,i);else if("length"in e&&e.length===+e.length)for(var r=0,n=e.length;r<n;r++)if(r in e&&t.call(i,e[r],r)===At)return}function It(e,t,i){if(!B(e)){if(O(e))return xt(e,t,i);if((e=>e instanceof FormData)(e)){for(var r of e.entries())if(t.call(i,r[1],r[0])===At)return}else for(var n in e)if(C.call(e,n)&&t.call(i,e[n],n)===At)return}}var Pt=function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];return xt(i,function(t){for(var i in t)void 0!==t[i]&&(e[i]=t[i])}),e},Ct=function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];return xt(i,function(t){xt(t,function(t){e.push(t)})}),e};function Tt(e){for(var t=Object.keys(e),i=t.length,r=new Array(i);i--;)r[i]=[t[i],e[t[i]]];return r}var Ot=function(e){try{return e()}catch(e){return}},Rt=function(e){return function(){try{for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return e.apply(this,i)}catch(e){wt.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),wt.critical(e)}}},$t=function(e){var t={};return It(e,function(e,i){(L(e)&&e.length>0||U(e))&&(t[i]=e)}),t},Dt=["herokuapp.com","vercel.app","netlify.app"];function Mt(e){var t=null==e?void 0:e.hostname;if(!L(t))return!1;var i=t.split(".").slice(-2).join(".");for(var r of Dt)if(i===r)return!1;return!0}function Lt(e,t){for(var i=0;i<e.length;i++)if(t(e[i]))return e[i]}function Nt(e,t,i,r){var{capture:n=!1,passive:s=!0}=null!=r?r:{};null==e||e.addEventListener(t,i,{capture:n,passive:s})}var Ft="$people_distinct_id",Bt="__alias",Ut="__timers",jt="$autocapture_disabled_server_side",Vt="$heatmaps_enabled_server_side",Ht="$exception_capture_enabled_server_side",Gt="$error_tracking_suppression_rules",qt="$error_tracking_capture_extension_exceptions",zt="$web_vitals_enabled_server_side",Kt="$dead_clicks_enabled_server_side",Wt="$product_tours_enabled_server_side",Jt="$web_vitals_allowed_metrics",Yt="$session_recording_remote_config",Qt="$sesid",Zt="$session_is_sampled",Xt="$enabled_feature_flags",ei="$early_access_features",ti="$feature_flag_details",ii="$stored_person_properties",ri="$stored_group_properties",ni="$surveys",si="$flag_call_reported",oi="$user_state",ai="$client_session_props",li="$capture_rate_limit",ui="$initial_campaign_params",ci="$initial_referrer_info",di="$initial_person_info",hi="$epp",gi="__POSTHOG_TOOLBAR__",pi="$posthog_cookieless",fi=[Ft,Bt,"__cmpns",Ut,"$session_recording_enabled_server_side",Vt,Qt,Xt,Gt,oi,ei,ti,ri,ii,ni,si,ai,li,ui,ci,hi,di,"$conversations_widget_session_id","$conversations_ticket_id","$conversations_widget_state","$conversations_user_traits"];function vi(e){return e instanceof Element&&(e.id===gi||!(null==e.closest||!e.closest(".toolbar-global-fade-container")))}function _i(e){return!!e&&1===e.nodeType}function mi(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function yi(e){return!!e&&3===e.nodeType}function bi(e){return!!e&&11===e.nodeType}function wi(e){return e?A(e).split(/\s+/):[]}function ki(e){var t=null==r?void 0:r.location.href;return!!(t&&e&&e.some(e=>t.match(e)))}function Ei(e){var t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return wi(t)}function Si(e){return B(e)?null:A(e).split(/(\s+)/).filter(e=>Vi(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Ai(e){var t="";return Di(e)&&!Mi(e)&&e.childNodes&&e.childNodes.length&&It(e.childNodes,function(e){var i;yi(e)&&e.textContent&&(t+=null!==(i=Si(e.textContent))&&void 0!==i?i:"")}),A(t)}function xi(e){return M(e.target)?e.srcElement||null:null!=(t=e.target)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var Ii=["a","button","form","input","select","textarea","label"];function Pi(e,t){if(M(t))return!0;var i,r=function(e){if(t.some(t=>e.matches(t)))return{v:!0}};for(var n of e)if(i=r(n))return i.v;return!1}function Ci(e){var t=e.parentNode;return!(!t||!_i(t))&&t}var Ti=["next","previous","prev",">","<"],Oi=[".ph-no-rageclick",".ph-no-capture"],Ri=e=>!e||mi(e,"html")||!_i(e),$i=(e,t)=>{if(!r||Ri(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var i=!1,n=[e],s=e;s.parentNode&&!mi(s,"body");)if(bi(s.parentNode))n.push(s.parentNode.host),s=s.parentNode.host;else{var o=Ci(s);if(!o)break;if(t||Ii.indexOf(o.tagName.toLowerCase())>-1)i=!0;else{var a=r.getComputedStyle(o);a&&"pointer"===a.getPropertyValue("cursor")&&(i=!0)}n.push(o),s=o}return{parentIsUsefulElement:i,targetElementList:n}};function Di(e){for(var t=e;t.parentNode&&!mi(t,"body");t=t.parentNode){var i=Ei(t);if(S(i,"ph-sensitive")||S(i,"ph-no-capture"))return!1}if(S(Ei(e),"ph-include"))return!0;var r=e.type||"";if(L(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var n=e.name||e.id||"";return!L(n)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(n.replace(/[^a-zA-Z0-9]/g,""))}function Mi(e){return!!(mi(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||mi(e,"select")||mi(e,"textarea")||"true"===e.getAttribute("contenteditable"))}var Li="(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})",Ni=new RegExp("^(?:"+Li+")$"),Fi=new RegExp(Li),Bi="\\d{3}-?\\d{2}-?\\d{4}",Ui=new RegExp("^("+Bi+")$"),ji=new RegExp("("+Bi+")");function Vi(e,t){if(void 0===t&&(t=!0),B(e))return!1;if(L(e)){if(e=A(e),(t?Ni:Fi).test((e||"").replace(/[- ]/g,"")))return!1;if((t?Ui:ji).test(e))return!1}return!0}function Hi(e){var t=Ai(e);return Vi(t=(t+" "+Gi(e)).trim())?t:""}function Gi(e){var t="";return e&&e.childNodes&&e.childNodes.length&&It(e.childNodes,function(e){var i;if(e&&"span"===(null==(i=e.tagName)?void 0:i.toLowerCase()))try{var r=Ai(e);t=(t+" "+r).trim(),e.childNodes&&e.childNodes.length&&(t=(t+" "+Gi(e)).trim())}catch(e){wt.error("[AutoCapture]",e)}}),t}function qi(e){return function(e){var t=e.map(e=>{var t,i,r="";if(e.tag_name&&(r+=e.tag_name),e.attr_class)for(var n of(e.attr_class.sort(),e.attr_class))r+="."+n.replace(/"/g,"");var s=y({},e.text?{text:e.text}:{},{"nth-child":null!==(t=e.nth_child)&&void 0!==t?t:0,"nth-of-type":null!==(i=e.nth_of_type)&&void 0!==i?i:0},e.href?{href:e.href}:{},e.attr_id?{attr_id:e.attr_id}:{},e.attributes),o={};return Tt(s).sort((e,t)=>{var[i]=e,[r]=t;return i.localeCompare(r)}).forEach(e=>{var[t,i]=e;return o[zi(t.toString())]=zi(i.toString())}),(r+=":")+Tt(o).map(e=>{var[t,i]=e;return t+'="'+i+'"'}).join("")});return t.join(";")}(function(e){return e.map(e=>{var t,i,r={text:null==(t=e.$el_text)?void 0:t.slice(0,400),tag_name:e.tag_name,href:null==(i=e.attr__href)?void 0:i.slice(0,2048),attr_class:Ki(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return Tt(e).filter(e=>{var[t]=e;return 0===t.indexOf("attr__")}).forEach(e=>{var[t,i]=e;return r.attributes[t]=i}),r})}(e))}function zi(e){return e.replace(/"|\\"/g,'\\"')}function Ki(e){var t=e.attr__class;return t?O(t)?t:wi(t):void 0}class Wi{constructor(e){this.disabled=!1===e;var t=$(e)?e:{};this.thresholdPx=t.threshold_px||30,this.timeoutMs=t.timeout_ms||1e3,this.clickCount=t.click_count||3,this.clicks=[]}isRageClick(e,t,i){if(this.disabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(e-r.x)+Math.abs(t-r.y)<this.thresholdPx&&i-r.timestamp<this.timeoutMs){if(this.clicks.push({x:e,y:t,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:i}];return!1}}var Ji="$copy_autocapture",Yi=function(e){return e.GZipJS="gzip-js",e.Base64="base64",e}({}),Qi=["fatal","error","warning","log","info","debug"],Zi=e=>{var t=null==u?void 0:u.createElement("a");return M(t)?null:(t.href=e,t)},Xi=function(e,t){for(var i,r=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),n=0;n<r.length;n++){var s=r[n].split("=");if(s[0]===t){i=s;break}}if(!O(i)||i.length<2)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(e){wt.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},er=function(e,t,i){if(!e||!t||!t.length)return e;for(var r=e.split("#"),n=r[0]||"",s=r[1],o=n.split("?"),a=o[1],l=o[0],u=(a||"").split("&"),c=[],d=0;d<u.length;d++){var h=u[d].split("=");O(h)&&(t.includes(h[0])?c.push(h[0]+"="+i):c.push(u[d]))}var g=l;return null!=a&&(g+="?"+c.join("&")),null!=s&&(g+="#"+s),g},tr=function(e,t){var i=e.match(new RegExp(t+"=([^&]*)"));return i?i[1]:null},ir=kt("[AutoCapture]");function rr(e,t){return t.length>e?t.slice(0,e)+"...":t}function nr(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do{t=t.previousSibling}while(t&&!_i(t));return t}class sr{constructor(e){this.P=!1,this.T=null,this.I=!1,this.instance=e,this.rageclicks=new Wi(e.config.rageclick),this.C=null}get R(){var e,t,i=$(this.instance.config.autocapture)?this.instance.config.autocapture:{};return i.url_allowlist=null==(e=i.url_allowlist)?void 0:e.map(e=>new RegExp(e)),i.url_ignorelist=null==(t=i.url_ignorelist)?void 0:t.map(e=>new RegExp(e)),i}F(){if(this.isBrowserSupported()){if(r&&u){var e=e=>{e=e||(null==r?void 0:r.event);try{this.M(e)}catch(e){ir.error("Failed to capture event",e)}};if(Nt(u,"submit",e,{capture:!0}),Nt(u,"change",e,{capture:!0}),Nt(u,"click",e,{capture:!0}),this.R.capture_copied_text){var t=e=>{e=e||(null==r?void 0:r.event),this.M(e,Ji)};Nt(u,"copy",t,{capture:!0}),Nt(u,"cut",t,{capture:!0})}}}else ir.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.P&&(this.F(),this.P=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this.I=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[jt]:!!e.autocapture_opt_out}),this.T=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this.C=e}getElementSelectors(e){var t,i=[];return null==(t=this.C)||t.forEach(t=>{var r=null==u?void 0:u.querySelectorAll(t);null==r||r.forEach(r=>{e===r&&i.push(t)})}),i}get isEnabled(){var e,t,i=null==(e=this.instance.persistence)?void 0:e.props[jt],r=this.T;if(F(r)&&!j(i)&&!this.instance.O())return!1;var n=null!==(t=this.T)&&void 0!==t?t:!!i;return!!this.instance.config.autocapture&&!n}M(e,t){if(void 0===t&&(t="$autocapture"),this.isEnabled){var i,n=xi(e);yi(n)&&(n=n.parentNode||null),"$autocapture"===t&&"click"===e.type&&e instanceof MouseEvent&&this.instance.config.rageclick&&null!=(i=this.rageclicks)&&i.isRageClick(e.clientX,e.clientY,e.timeStamp||(new Date).getTime())&&function(e,t){if(!r||Ri(e))return!1;var i,n,s;if(j(t)?(i=!!t&&Oi,n=void 0):(i=null!==(s=null==t?void 0:t.css_selector_ignorelist)&&void 0!==s?s:Oi,n=null==t?void 0:t.content_ignorelist),!1===i)return!1;var{targetElementList:o}=$i(e,!1);return!function(e,t){if(!1===e||M(e))return!1;var i;if(!0===e)i=Ti;else{if(!O(e))return!1;if(e.length>10)return wt.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;i=e.map(e=>e.toLowerCase())}return t.some(e=>{var{safeText:t,ariaLabel:r}=e;return i.some(e=>t.includes(e)||r.includes(e))})}(n,o.map(e=>{var t;return{safeText:Ai(e).toLowerCase(),ariaLabel:(null==(t=e.getAttribute("aria-label"))?void 0:t.toLowerCase().trim())||""}}))&&!Pi(o,i)}(n,this.instance.config.rageclick)&&this.M(e,"$rageclick");var s=t===Ji;if(n&&function(e,t,i,n,s){var o,a,l,u;if(void 0===i&&(i=void 0),!r||Ri(e))return!1;if(null!=(o=i)&&o.url_allowlist&&!ki(i.url_allowlist))return!1;if(null!=(a=i)&&a.url_ignorelist&&ki(i.url_ignorelist))return!1;if(null!=(l=i)&&l.dom_event_allowlist){var c=i.dom_event_allowlist;if(c&&!c.some(e=>t.type===e))return!1}var{parentIsUsefulElement:d,targetElementList:h}=$i(e,n);if(!function(e,t){var i=null==t?void 0:t.element_allowlist;if(M(i))return!0;var r,n=function(e){if(i.some(t=>e.tagName.toLowerCase()===t))return{v:!0}};for(var s of e)if(r=n(s))return r.v;return!1}(h,i))return!1;if(!Pi(h,null==(u=i)?void 0:u.css_selector_allowlist))return!1;var g=r.getComputedStyle(e);if(g&&"pointer"===g.getPropertyValue("cursor")&&"click"===t.type)return!0;var p=e.tagName.toLowerCase();switch(p){case"html":return!1;case"form":return(s||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(s||["change","click"]).indexOf(t.type)>=0;default:return d?(s||["click"]).indexOf(t.type)>=0:(s||["click"]).indexOf(t.type)>=0&&(Ii.indexOf(p)>-1||"true"===e.getAttribute("contenteditable"))}}(n,e,this.R,s,s?["copy","cut"]:void 0)){var{props:o,explicitNoCapture:a}=function(e,t){for(var i,n,{e:s,maskAllElementAttributes:o,maskAllText:a,elementAttributeIgnoreList:l,elementsChainAsString:u}=t,c=[e],d=e;d.parentNode&&!mi(d,"body");)bi(d.parentNode)?(c.push(d.parentNode.host),d=d.parentNode.host):(c.push(d.parentNode),d=d.parentNode);var h,g=[],p={},f=!1,v=!1;if(It(c,e=>{var t=Di(e);"a"===e.tagName.toLowerCase()&&(f=e.getAttribute("href"),f=t&&f&&Vi(f)&&f),S(Ei(e),"ph-no-capture")&&(v=!0),g.push(function(e,t,i,r){var n=e.tagName.toLowerCase(),s={tag_name:n};Ii.indexOf(n)>-1&&!i&&("a"===n.toLowerCase()||"button"===n.toLowerCase()?s.$el_text=rr(1024,Hi(e)):s.$el_text=rr(1024,Ai(e)));var o=Ei(e);o.length>0&&(s.classes=o.filter(function(e){return""!==e})),It(e.attributes,function(i){var n;if((!Mi(e)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&(null==r||!r.includes(i.name))&&!t&&Vi(i.value)&&(n=i.name,!L(n)||"_ngcontent"!==n.substring(0,10)&&"_nghost"!==n.substring(0,7))){var o=i.value;"class"===i.name&&(o=wi(o).join(" ")),s["attr__"+i.name]=rr(1024,o)}});for(var a=1,l=1,u=e;u=nr(u);)a++,u.tagName===e.tagName&&l++;return s.nth_child=a,s.nth_of_type=l,s}(e,o,a,l));var i=function(e){if(!Di(e))return{};var t={};return It(e.attributes,function(e){if(e.name&&0===e.name.indexOf("data-ph-capture-attribute")){var i=e.name.replace("data-ph-capture-attribute-",""),r=e.value;i&&r&&Vi(r)&&(t[i]=r)}}),t}(e);Pt(p,i)}),v)return{props:{},explicitNoCapture:v};if(a||("a"===e.tagName.toLowerCase()||"button"===e.tagName.toLowerCase()?g[0].$el_text=Hi(e):g[0].$el_text=Ai(e)),f){var _,m;g[0].attr__href=f;var y=null==(_=Zi(f))?void 0:_.host,b=null==r||null==(m=r.location)?void 0:m.host;y&&b&&y!==b&&(h=f)}return{props:Pt({$event_type:s.type,$ce_version:1},u?{}:{$elements:g},{$elements_chain:qi(g)},null!=(i=g[0])&&i.$el_text?{$el_text:null==(n=g[0])?void 0:n.$el_text}:{},h&&"click"===s.type?{$external_click_url:h}:{},p)}}(n,{e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.R.element_attribute_ignorelist,elementsChainAsString:this.I});if(a)return!1;var l=this.getElementSelectors(n);if(l&&l.length>0&&(o.$element_selectors=l),t===Ji){var u,c=Si(null==r||null==(u=r.getSelection())?void 0:u.toString()),d=e.type||"clipboard";if(!c)return!1;o.$selected_content=c,o.$copy_type=d}return this.instance.capture(t,o),!0}}}isBrowserSupported(){return R(null==u?void 0:u.querySelectorAll)}}Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return U(e)&&isFinite(e)&&Math.floor(e)===e});var or="0123456789abcdef";class ar{constructor(e){if(this.bytes=e,16!==e.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,i,r){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(r)||e<0||t<0||i<0||r<0||e>0xffffffffffff||t>4095||i>1073741823||r>4294967295)throw new RangeError("invalid field value");var n=new Uint8Array(16);return n[0]=e/Math.pow(2,40),n[1]=e/Math.pow(2,32),n[2]=e/Math.pow(2,24),n[3]=e/Math.pow(2,16),n[4]=e/Math.pow(2,8),n[5]=e,n[6]=112|t>>>8,n[7]=t,n[8]=128|i>>>24,n[9]=i>>>16,n[10]=i>>>8,n[11]=i,n[12]=r>>>24,n[13]=r>>>16,n[14]=r>>>8,n[15]=r,new ar(n)}toString(){for(var e="",t=0;t<this.bytes.length;t++)e=e+or.charAt(this.bytes[t]>>>4)+or.charAt(15&this.bytes[t]),3!==t&&5!==t&&7!==t&&9!==t||(e+="-");if(36!==e.length)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new ar(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(var t=0;t<16;t++){var i=this.bytes[t]-e.bytes[t];if(0!==i)return Math.sign(i)}return 0}}class lr{constructor(){this.A=0,this.D=0,this.j=new dr}generate(){var e=this.generateOrAbort();if(M(e)){this.A=0;var t=this.generateOrAbort();if(M(t))throw new Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){var e=Date.now();if(e>this.A)this.A=e,this.L();else{if(!(e+1e4>this.A))return;this.D++,this.D>4398046511103&&(this.A++,this.L())}return ar.fromFieldsV7(this.A,Math.trunc(this.D/Math.pow(2,30)),this.D&Math.pow(2,30)-1,this.j.nextUint32())}L(){this.D=1024*this.j.nextUint32()+(1023&this.j.nextUint32())}}var ur,cr=e=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;t<e.length;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};r&&!M(r.crypto)&&crypto.getRandomValues&&(cr=e=>crypto.getRandomValues(e));class dr{constructor(){this.N=new Uint32Array(8),this.U=1/0}nextUint32(){return this.U>=this.N.length&&(cr(this.N),this.U=0),this.N[this.U++]}}var hr=()=>gr().toString(),gr=()=>(ur||(ur=new lr)).generate(),pr="",fr=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,vr={H:()=>!!u,B:function(e){wt.error("cookieStore error: "+e)},q:function(e){if(u){try{for(var t=e+"=",i=u.cookie.split(";").filter(e=>e.length),r=0;r<i.length;r++){for(var n=i[r];" "==n.charAt(0);)n=n.substring(1,n.length);if(0===n.indexOf(t))return decodeURIComponent(n.substring(t.length,n.length))}}catch(e){}return null}},W:function(e){var t;try{t=JSON.parse(vr.q(e))||{}}catch(e){}return t},G:function(e,t,i,r,n){if(u)try{var s="",o="",a=function(e,t){if(t){var i=function(e,t){if(void 0===t&&(t=u),pr)return pr;if(!t)return"";if(["localhost","127.0.0.1"].includes(e))return"";for(var i=e.split("."),r=Math.min(i.length,8),n="dmn_chk_"+hr();!pr&&r--;){var s=i.slice(r).join("."),o=n+"=1;domain=."+s+";path=/";t.cookie=o+";max-age=3",t.cookie.includes(n)&&(t.cookie=o+";max-age=0",pr=s)}return pr}(e);if(!i){var r=(e=>{var t=e.match(fr);return t?t[0]:""})(e);r!==i&&wt.info("Warning: cookie subdomain discovery mismatch",r,i),i=r}return i?"; domain=."+i:""}return""}(u.location.hostname,r);if(i){var l=new Date;l.setTime(l.getTime()+24*i*60*60*1e3),s="; expires="+l.toUTCString()}n&&(o="; secure");var c=e+"="+encodeURIComponent(JSON.stringify(t))+s+"; SameSite=Lax; path=/"+a+o;return c.length>3686.4&&wt.warn("cookieStore warning: large cookie, len="+c.length),u.cookie=c,c}catch(e){return}},V:function(e,t){if(null!=u&&u.cookie)try{vr.G(e,"",-1,t)}catch(e){return}}},_r=null,mr={H:function(){if(!F(_r))return _r;var e=!0;if(M(r))e=!1;else try{var t="__mplssupport__";mr.G(t,"xyz"),'"xyz"'!==mr.q(t)&&(e=!1),mr.V(t)}catch(t){e=!1}return e||wt.error("localStorage unsupported; falling back to cookie store"),_r=e,e},B:function(e){wt.error("localStorage error: "+e)},q:function(e){try{return null==r?void 0:r.localStorage.getItem(e)}catch(e){mr.B(e)}return null},W:function(e){try{return JSON.parse(mr.q(e))||{}}catch(e){}return null},G:function(e,t){try{null==r||r.localStorage.setItem(e,JSON.stringify(t))}catch(e){mr.B(e)}},V:function(e){try{null==r||r.localStorage.removeItem(e)}catch(e){mr.B(e)}}},yr=["$device_id","distinct_id",Qt,Zt,hi,di],br={},wr={H:function(){return!0},B:function(e){wt.error("memoryStorage error: "+e)},q:function(e){return br[e]||null},W:function(e){return br[e]||null},G:function(e,t){br[e]=t},V:function(e){delete br[e]}},kr=null,Er={H:function(){if(!F(kr))return kr;if(kr=!0,M(r))kr=!1;else try{var e="__support__";Er.G(e,"xyz"),'"xyz"'!==Er.q(e)&&(kr=!1),Er.V(e)}catch(e){kr=!1}return kr},B:function(e){wt.error("sessionStorage error: ",e)},q:function(e){try{return null==r?void 0:r.sessionStorage.getItem(e)}catch(e){Er.B(e)}return null},W:function(e){try{return JSON.parse(Er.q(e))||null}catch(e){}return null},G:function(e,t){try{null==r||r.sessionStorage.setItem(e,JSON.stringify(t))}catch(e){Er.B(e)}},V:function(e){try{null==r||r.sessionStorage.removeItem(e)}catch(e){Er.B(e)}}},Sr=function(e){return e[e.PENDING=-1]="PENDING",e[e.DENIED=0]="DENIED",e[e.GRANTED=1]="GRANTED",e}({});class Ar{constructor(e){this._instance=e}get R(){return this._instance.config}get consent(){return this.J()?Sr.DENIED:this.K}isOptedOut(){return"always"===this.R.cookieless_mode||this.consent===Sr.DENIED||this.consent===Sr.PENDING&&(this.R.opt_out_capturing_by_default||"on_reject"===this.R.cookieless_mode)}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===Sr.DENIED}optInOut(e){this.Y.G(this.X,e?1:0,this.R.cookie_expiration,this.R.cross_subdomain_cookie,this.R.secure_cookie)}reset(){this.Y.V(this.X,this.R.cross_subdomain_cookie)}get X(){var{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:i}=this._instance.config;return i||(t?t+e:"__ph_opt_in_out_"+e)}get K(){var e=this.Y.q(this.X);return K(e)?Sr.GRANTED:S(W,e)?Sr.DENIED:Sr.PENDING}get Y(){if(!this.Z){var e=this.R.opt_out_capturing_persistence_type;this.Z="localStorage"===e?mr:vr;var t="localStorage"===e?vr:mr;t.q(this.X)&&(this.Z.q(this.X)||this.optInOut(K(t.q(this.X))),t.V(this.X,this.R.cross_subdomain_cookie))}return this.Z}J(){return!!this.R.respect_dnt&&!!Lt([null==l?void 0:l.doNotTrack,null==l?void 0:l.msDoNotTrack,f.doNotTrack],e=>K(e))}}var xr=kt("[Dead Clicks]"),Ir=()=>!0,Pr=e=>{var t,i=!(null==(t=e.instance.persistence)||!t.get_property(Kt)),r=e.instance.config.capture_dead_clicks;return j(r)?r:!!$(r)||i};class Cr{get lazyLoadedDeadClicksAutocapture(){return this.tt}constructor(e,t,i){this.instance=e,this.isEnabled=t,this.onCapture=i,this.startIfEnabled()}onRemoteConfig(e){this.instance.persistence&&this.instance.persistence.register({[Kt]:null==e?void 0:e.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.it(()=>{this.et()})}it(e){var t,i;null!=(t=f.__PosthogExtensions__)&&t.initDeadClicksAutocapture&&e(),null==(i=f.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",t=>{t?xr.error("failed to load script",t):e()})}et(){var e;if(u){if(!this.tt&&null!=(e=f.__PosthogExtensions__)&&e.initDeadClicksAutocapture){var t=$(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.tt=f.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.tt.start(u),xr.info("starting...")}}else xr.error("`document` not found. Cannot start.")}stop(){this.tt&&(this.tt.stop(),this.tt=void 0,xr.info("stopping..."))}}var Tr=kt("[ExceptionAutocapture]");class Or{constructor(e){var t,i,n;this.rt=()=>{var e;if(r&&this.isEnabled&&null!=(e=f.__PosthogExtensions__)&&e.errorWrappingFunctions){var t=f.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=f.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,n=f.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.st&&this.R.capture_unhandled_errors&&(this.st=t(this.captureException.bind(this))),!this.nt&&this.R.capture_unhandled_rejections&&(this.nt=i(this.captureException.bind(this))),!this.ot&&this.R.capture_console_errors&&(this.ot=n(this.captureException.bind(this)))}catch(e){Tr.error("failed to start",e),this.ut()}}},this._instance=e,this.ht=!(null==(t=this._instance.persistence)||!t.props[Ht]),this.dt=new Y({refillRate:null!==(i=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)&&void 0!==i?i:1,bucketSize:null!==(n=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)&&void 0!==n?n:10,refillInterval:1e4,h:Tr}),this.R=this.vt(),this.startIfEnabledOrStop()}vt(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return $(e)?t=y({},t,e):(M(e)?this.ht:e)&&(t=y({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.R.capture_console_errors||this.R.capture_unhandled_errors||this.R.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Tr.info("enabled"),this.ut(),this.it(this.rt)):this.ut()}it(e){var t,i;null!=(t=f.__PosthogExtensions__)&&t.errorWrappingFunctions&&e(),null==(i=f.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"exception-autocapture",t=>{if(t)return Tr.error("failed to load script",t);e()})}ut(){var e,t,i;null==(e=this.st)||e.call(this),this.st=void 0,null==(t=this.nt)||t.call(this),this.nt=void 0,null==(i=this.ot)||i.call(this),this.ot=void 0}onRemoteConfig(e){var t=e.autocaptureExceptions;this.ht=!!t||!1,this._instance.persistence&&this._instance.persistence.register({[Ht]:this.ht}),this.R=this.vt(),this.startIfEnabledOrStop()}onConfigChange(){this.R=this.vt()}captureException(e){var t,i,r=null!==(t=null==e||null==(i=e.$exception_list)||null==(i=i[0])?void 0:i.type)&&void 0!==t?t:"Exception";this.dt.consumeRateLimit(r)?Tr.info("Skipping exception capture because of client rate limiting.",{exception:r}):this._instance.exceptions.sendExceptionEvent(e)}}function Rr(e,t,i){try{if(!(t in e))return()=>{};var r=e[t],n=i(r);return R(n)&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__posthog_wrapped__:{enumerable:!1,value:!0}})),e[t]=n,()=>{e[t]=r}}catch(e){return()=>{}}}class $r{constructor(e){var t;this._instance=e,this.ct=(null==r||null==(t=r.location)?void 0:t.pathname)||""}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(wt.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.ft&&this.ft(),this.ft=void 0,wt.info("History API monitoring stopped")}monitorHistoryChanges(){var e,t;if(r&&r.history){var i=this;null!=(e=r.history.pushState)&&e.__posthog_wrapped__||Rr(r.history,"pushState",e=>function(t,r,n){e.call(this,t,r,n),i._t("pushState")}),null!=(t=r.history.replaceState)&&t.__posthog_wrapped__||Rr(r.history,"replaceState",e=>function(t,r,n){e.call(this,t,r,n),i._t("replaceState")}),this.yt()}}_t(e){try{var t,i=null==r||null==(t=r.location)?void 0:t.pathname;if(!i)return;i!==this.ct&&this.isEnabled&&this._instance.capture("$pageview",{navigation_type:e}),this.ct=i}catch(t){wt.error("Error capturing "+e+" pageview",t)}}yt(){if(!this.ft){var e=()=>{this._t("popstate")};Nt(r,"popstate",e),this.ft=()=>{r&&r.removeEventListener("popstate",e)}}}}var Dr=kt("[SegmentIntegration]"),Mr="posthog-js";function Lr(e,t){var{organization:i,projectId:r,prefix:n,severityAllowList:s=["error"],sendExceptionsToPostHog:o=!0}=void 0===t?{}:t;return t=>{var a,l,u,c,d;if("*"!==s&&!s.includes(t.level)||!e.__loaded)return t;t.tags||(t.tags={});var h=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());t.tags["PostHog Person URL"]=h,e.sessionRecordingStarted()&&(t.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var g=(null==(a=t.exception)?void 0:a.values)||[],p=g.map(e=>y({},e,{stacktrace:e.stacktrace?y({},e.stacktrace,{type:"raw",frames:(e.stacktrace.frames||[]).map(e=>y({},e,{platform:"web:javascript"}))}):void 0})),f={$exception_message:(null==(l=g[0])?void 0:l.value)||t.message,$exception_type:null==(u=g[0])?void 0:u.type,$exception_level:t.level,$exception_list:p,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:(null==(c=g[0])?void 0:c.value)||t.message,$sentry_exception_type:null==(d=g[0])?void 0:d.type,$sentry_tags:t.tags};return i&&r&&(f.$sentry_url=(n||"https://sentry.io/organizations/")+i+"/issues/?project="+r+"&query="+t.event_id),o&&e.exceptions.sendExceptionEvent(f),t}}class Nr{constructor(e,t,i,r,n,s){this.name=Mr,this.setupOnce=function(o){o(Lr(e,{organization:t,projectId:i,prefix:r,severityAllowList:n,sendExceptionsToPostHog:null==s||s}))}}}var Fr=null!=r&&r.location?tr(r.location.hash,"__posthog")||tr(location.hash,"state"):null,Br="_postHogToolbarParams",Ur=kt("[Toolbar]"),jr=function(e){return e[e.UNINITIALIZED=0]="UNINITIALIZED",e[e.LOADING=1]="LOADING",e[e.LOADED=2]="LOADED",e}(jr||{});class Vr{constructor(e){this.instance=e}bt(e){f.ph_toolbar_state=e}wt(){var e;return null!==(e=f.ph_toolbar_state)&&void 0!==e?e:jr.UNINITIALIZED}maybeLoadToolbar(e,t,i){if(void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===i&&(i=void 0),!r||!u)return!1;e=null!=e?e:r.location,i=null!=i?i:r.history;try{if(!t){try{r.localStorage.setItem("test","test"),r.localStorage.removeItem("test")}catch(e){return!1}t=null==r?void 0:r.localStorage}var n,s=Fr||tr(e.hash,"__posthog")||tr(e.hash,"state"),o=s?Ot(()=>JSON.parse(atob(decodeURIComponent(s))))||Ot(()=>JSON.parse(decodeURIComponent(s))):null;return o&&"ph_authorize"===o.action?((n=o).source="url",n&&Object.keys(n).length>0&&(o.desiredHash?e.hash=o.desiredHash:i?i.replaceState(i.state,"",e.pathname+e.search):e.hash="")):((n=JSON.parse(t.getItem(Br)||"{}")).source="localstorage",delete n.userIntent),!(!n.token||this.instance.config.token!==n.token||(this.loadToolbar(n),0))}catch(e){return!1}}xt(e){var t=f.ph_load_toolbar||f.ph_load_editor;!B(t)&&R(t)?t(e,this.instance):Ur.warn("No toolbar load function found")}loadToolbar(e){var t=!(null==u||!u.getElementById(gi));if(!r||t)return!1;var i="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,n=y({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},i?{instrument:!1}:{});if(r.localStorage.setItem(Br,JSON.stringify(y({},n,{source:void 0}))),this.wt()===jr.LOADED)this.xt(n);else if(this.wt()===jr.UNINITIALIZED){var s;this.bt(jr.LOADING),null==(s=f.__PosthogExtensions__)||null==s.loadExternalDependency||s.loadExternalDependency(this.instance,"toolbar",e=>{if(e)return Ur.error("[Toolbar] Failed to load",e),void this.bt(jr.UNINITIALIZED);this.bt(jr.LOADED),this.xt(n)}),Nt(r,"turbolinks:load",()=>{this.bt(jr.UNINITIALIZED),this.loadToolbar(n)})}return!0}Et(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,i){return void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===i&&(i=void 0),this.maybeLoadToolbar(e,t,i)}}var Hr=kt("[TracingHeaders]");class Gr{constructor(e){this.$t=void 0,this.St=void 0,this.rt=()=>{var e,t;M(this.$t)&&(null==(e=f.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)||e._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),M(this.St)&&(null==(t=f.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)||t._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=e}it(e){var t,i;null!=(t=f.__PosthogExtensions__)&&t.tracingHeadersPatchFns&&e(),null==(i=f.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"tracing-headers",t=>{if(t)return Hr.error("failed to load script",t);e()})}startIfEnabledOrStop(){var e,t;this._instance.config.__add_tracing_headers?this.it(this.rt):(null==(e=this.$t)||e.call(this),null==(t=this.St)||t.call(this),this.$t=void 0,this.St=void 0)}}var qr="https?://(.*)",zr=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Kr=Ct(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],zr),Wr="<masked>",Jr=["li_fat_id"];function Yr(e,t,i){if(!u)return{};var r,n=t?Ct([],zr,i||[]):[],s=Qr(er(u.URL,n,Wr),e),o=(r={},It(Jr,function(e){var t=vr.q(e);r[e]=t||null}),r);return Pt(o,s)}function Qr(e,t){var i=Kr.concat(t||[]),r={};return It(i,function(t){var i=Xi(e,t);r[t]=i||null}),r}function Zr(e){var t=function(e){return e?0===e.search(qr+"google.([^/?]*)")?"google":0===e.search(qr+"bing.com")?"bing":0===e.search(qr+"yahoo.com")?"yahoo":0===e.search(qr+"duckduckgo.com")?"duckduckgo":null:null}(e),i="yahoo"!=t?"q":"p",r={};if(!F(t)){r.$search_engine=t;var n=u?Xi(u.referrer,i):"";n.length&&(r.ph_keyword=n)}return r}function Xr(){return navigator.language||navigator.userLanguage}function en(){return(null==u?void 0:u.referrer)||"$direct"}function tn(e,t){var i=e?Ct([],zr,t||[]):[],r=null==c?void 0:c.href.substring(0,1e3);return{r:en().substring(0,1e3),u:r?er(r,i,Wr):void 0}}function rn(e){var t,{r:i,u:r}=e,n={$referrer:i,$referring_domain:null==i?void 0:"$direct"==i?"$direct":null==(t=Zi(i))?void 0:t.host};if(r){n.$current_url=r;var s=Zi(r);n.$host=null==s?void 0:s.host,n.$pathname=null==s?void 0:s.pathname;var o=Qr(r);Pt(n,o)}if(i){var a=Zr(i);Pt(n,a)}return n}function nn(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}function sn(){try{return(new Date).getTimezoneOffset()}catch(e){return}}function on(e,t){if(!p)return{};var i,n,s,o=e?Ct([],zr,t||[]):[],[a,l]=function(e){for(var t=0;t<Ke.length;t++){var[i,r]=Ke[t],n=i.exec(e),s=n&&(R(r)?r(n,e):r);if(s)return s}return["",""]}(p);return Pt($t({$os:a,$os_version:l,$browser:Ge(p,navigator.vendor),$device:We(p),$device_type:(n=p,s=We(n),s===se||s===ne||"Kobo"===s||"Kindle Fire"===s||s===Me?re:s===Se||s===xe||s===Ae||s===Re?"Console":s===ae?"Wearable":s?ee:"Desktop"),$timezone:nn(),$timezone_offset:sn()}),{$current_url:er(null==c?void 0:c.href,o,Wr),$host:null==c?void 0:c.host,$pathname:null==c?void 0:c.pathname,$raw_user_agent:p.length>1e3?p.substring(0,997)+"...":p,$browser_version:ze(p,navigator.vendor),$browser_language:Xr(),$browser_language_prefix:(i=Xr(),"string"==typeof i?i.split("-")[0]:void 0),$screen_height:null==r?void 0:r.screen.height,$screen_width:null==r?void 0:r.screen.width,$viewport_height:null==r?void 0:r.innerHeight,$viewport_width:null==r?void 0:r.innerWidth,$lib:"web",$lib_version:v.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var an=kt("[Web Vitals]"),ln=9e5;class un{constructor(e){var t;this.kt=!1,this.P=!1,this.N={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Pt=()=>{clearTimeout(this.Tt),0!==this.N.metrics.length&&(this._instance.capture("$web_vitals",this.N.metrics.reduce((e,t)=>y({},e,{["$web_vitals_"+t.name+"_event"]:y({},t),["$web_vitals_"+t.name+"_value"]:t.value}),{})),this.N={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.It=e=>{var t,i=null==(t=this._instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0);if(M(i))an.error("Could not read session ID. Dropping metrics!");else{this.N=this.N||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var r=this.Ct();M(r)||(B(null==e?void 0:e.name)||B(null==e?void 0:e.value)?an.error("Invalid metric received",e):this.Rt&&e.value>=this.Rt?an.error("Ignoring metric with value >= "+this.Rt,e):(this.N.url!==r&&(this.Pt(),this.Tt=setTimeout(this.Pt,this.flushToCaptureTimeoutMs)),M(this.N.url)&&(this.N.url=r),this.N.firstMetricTimestamp=M(this.N.firstMetricTimestamp)?Date.now():this.N.firstMetricTimestamp,e.attribution&&e.attribution.interactionTargetElement&&(e.attribution.interactionTargetElement=void 0),this.N.metrics.push(y({},e,{$current_url:r,$session_id:i.sessionId,$window_id:i.windowId,timestamp:Date.now()})),this.N.metrics.length===this.allowedMetrics.length&&this.Pt()))}},this.rt=()=>{var e,t,i,r,n=f.__PosthogExtensions__;M(n)||M(n.postHogWebVitalsCallbacks)||({onLCP:e,onCLS:t,onFCP:i,onINP:r}=n.postHogWebVitalsCallbacks),e&&t&&i&&r?(this.allowedMetrics.indexOf("LCP")>-1&&e(this.It.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&t(this.It.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&i(this.It.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&r(this.It.bind(this)),this.P=!0):an.error("web vitals callbacks not loaded - not starting")},this._instance=e,this.kt=!(null==(t=this._instance.persistence)||!t.props[zt]),this.startIfEnabled()}get allowedMetrics(){var e,t,i=$(this._instance.config.capture_performance)?null==(e=this._instance.config.capture_performance)?void 0:e.web_vitals_allowed_metrics:void 0;return M(i)?(null==(t=this._instance.persistence)?void 0:t.props[Jt])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return($(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get Rt(){var e=$(this._instance.config.capture_performance)&&U(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:ln;return 0<e&&e<=6e4?ln:e}get isEnabled(){var e=null==c?void 0:c.protocol;if("http:"!==e&&"https:"!==e)return an.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=$(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals:j(this._instance.config.capture_performance)?this._instance.config.capture_performance:void 0;return j(t)?t:this.kt}startIfEnabled(){this.isEnabled&&!this.P&&(an.info("enabled, starting..."),this.it(this.rt))}onRemoteConfig(e){var t=$(e.capturePerformance)&&!!e.capturePerformance.web_vitals,i=$(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[zt]:t}),this._instance.persistence.register({[Jt]:i})),this.kt=t,this.startIfEnabled()}it(e){var t,i;null!=(t=f.__PosthogExtensions__)&&t.postHogWebVitalsCallbacks&&e(),null==(i=f.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"web-vitals",t=>{t?an.error("failed to load script",t):e()})}Ct(){var e=r?r.location.href:void 0;if(e){var t=this._instance.config.mask_personal_data_properties,i=this._instance.config.custom_personal_data_properties,n=t?Ct([],zr,i||[]):[];return er(e,n,Wr)}an.error("Could not determine current URL")}}var cn=kt("[Heatmaps]");function dn(e){return $(e)&&"clientX"in e&&"clientY"in e&&U(e.clientX)&&U(e.clientY)}class hn{constructor(e){var t;this.kt=!1,this.P=!1,this.Ft=null,this.instance=e,this.kt=!(null==(t=this.instance.persistence)||!t.props[Vt]),this.rageclicks=new Wi(e.config.rageclick)}get flushIntervalMilliseconds(){var e=5e3;return $(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(e=this.instance.config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return M(this.instance.config.capture_heatmaps)?M(this.instance.config.enable_heatmaps)?this.kt:this.instance.config.enable_heatmaps:!1!==this.instance.config.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.P)return;cn.info("starting..."),this.Mt(),this.Ot()}else{var e;clearInterval(null!==(e=this.Ft)&&void 0!==e?e:void 0),this.At(),this.getAndClearBuffer()}}onRemoteConfig(e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Vt]:t}),this.kt=t,this.startIfEnabled()}getAndClearBuffer(){var e=this.N;return this.N=void 0,e}Dt(e){this.jt(e.originalEvent,"deadclick")}Ot(){this.Ft&&clearInterval(this.Ft),this.Ft=function(e){return"visible"===(null==e?void 0:e.visibilityState)}(u)?setInterval(this.Lt.bind(this),this.flushIntervalMilliseconds):null}Mt(){r&&u&&(this.Nt=this.Lt.bind(this),Nt(r,"beforeunload",this.Nt),this.Ut=e=>this.jt(e||(null==r?void 0:r.event)),Nt(u,"click",this.Ut,{capture:!0}),this.zt=e=>this.Ht(e||(null==r?void 0:r.event)),Nt(u,"mousemove",this.zt,{capture:!0}),this.Bt=new Cr(this.instance,Ir,this.Dt.bind(this)),this.Bt.startIfEnabled(),this.qt=this.Ot.bind(this),Nt(u,"visibilitychange",this.qt),this.P=!0)}At(){var e;r&&u&&(this.Nt&&r.removeEventListener("beforeunload",this.Nt),this.Ut&&u.removeEventListener("click",this.Ut,{capture:!0}),this.zt&&u.removeEventListener("mousemove",this.zt,{capture:!0}),this.qt&&u.removeEventListener("visibilitychange",this.qt),clearTimeout(this.Wt),null==(e=this.Bt)||e.stop(),this.P=!1)}Gt(e,t){var i=this.instance.scrollManager.scrollY(),n=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),o=function(e,t,i){for(var n=e;n&&_i(n)&&!mi(n,"body");){if(n===i)return!1;if(S(t,null==r?void 0:r.getComputedStyle(n).position))return!0;n=Ci(n)}return!1}(xi(e),["fixed","sticky"],s);return{x:e.clientX+(o?0:n),y:e.clientY+(o?0:i),target_fixed:o,type:t}}jt(e,t){var i;if(void 0===t&&(t="click"),!vi(e.target)&&dn(e)){var r=this.Gt(e,t);null!=(i=this.rageclicks)&&i.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&this.Vt(y({},r,{type:"rageclick"})),this.Vt(r)}}Ht(e){!vi(e.target)&&dn(e)&&(clearTimeout(this.Wt),this.Wt=setTimeout(()=>{this.Vt(this.Gt(e,"mousemove"))},500))}Vt(e){if(r){var t=r.location.href,i=this.instance.config.mask_personal_data_properties,n=this.instance.config.custom_personal_data_properties,s=i?Ct([],zr,n||[]):[],o=er(t,s,Wr);this.N=this.N||{},this.N[o]||(this.N[o]=[]),this.N[o].push(e)}}Lt(){this.N&&!D(this.N)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}class gn{constructor(e){this.Jt=(e,t,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength)&&(wt.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:e,changeReason:i}),this.Kt=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.Yt()}Yt(){var e;this.Xt=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(this.Jt)}destroy(){var e;null==(e=this.Xt)||e.call(this),this.Xt=void 0}doPageView(e,t){var i,n=this.Qt(e,t);return this.Kt={pathname:null!==(i=null==r?void 0:r.location.pathname)&&void 0!==i?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),n}doPageLeave(e){var t;return this.Qt(e,null==(t=this.Kt)?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:null==(e=this.Kt)?void 0:e.pageViewId}}Qt(e,t){var i=this.Kt;if(!i)return{$pageview_id:t};var r={$pageview_id:t,$prev_pageview_id:i.pageViewId},n=this._instance.scrollManager.getContext();if(n&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:s,lastScrollY:o,maxScrollY:a,maxContentHeight:l,lastContentY:u,maxContentY:c}=n;if(!(M(s)||M(o)||M(a)||M(l)||M(u)||M(c))){s=Math.ceil(s),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),c=Math.ceil(c);var d=s<=1?1:J(o/s,0,1,wt),h=s<=1?1:J(a/s,0,1,wt),g=l<=1?1:J(u/l,0,1,wt),p=l<=1?1:J(c/l,0,1,wt);r=Pt(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:h,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:g,$prev_pageview_max_content:c,$prev_pageview_max_content_percentage:p})}}return i.pathname&&(r.$prev_pageview_pathname=i.pathname),i.timestamp&&(r.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),r}}var pn=Uint8Array,fn=Uint16Array,vn=Uint32Array,_n=new pn([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),mn=new pn([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),yn=new pn([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),bn=function(e,t){for(var i=new fn(31),r=0;r<31;++r)i[r]=t+=1<<e[r-1];var n=new vn(i[30]);for(r=1;r<30;++r)for(var s=i[r];s<i[r+1];++s)n[s]=s-i[r]<<5|r;return[i,n]},wn=bn(_n,2),kn=wn[0],En=wn[1];kn[28]=258,En[258]=28;for(var Sn=bn(mn,0)[1],An=new fn(32768),xn=0;xn<32768;++xn){var In=(43690&xn)>>>1|(21845&xn)<<1;In=(61680&(In=(52428&In)>>>2|(13107&In)<<2))>>>4|(3855&In)<<4,An[xn]=((65280&In)>>>8|(255&In)<<8)>>>1}var Pn=function(e,t,i){for(var r=e.length,n=0,s=new fn(t);n<r;++n)++s[e[n]-1];var o,a=new fn(t);for(n=0;n<t;++n)a[n]=a[n-1]+s[n-1]<<1;if(i){o=new fn(1<<t);var l=15-t;for(n=0;n<r;++n)if(e[n])for(var u=n<<4|e[n],c=t-e[n],d=a[e[n]-1]++<<c,h=d|(1<<c)-1;d<=h;++d)o[An[d]>>>l]=u}else for(o=new fn(r),n=0;n<r;++n)o[n]=An[a[e[n]-1]++]>>>15-e[n];return o},Cn=new pn(288);for(xn=0;xn<144;++xn)Cn[xn]=8;for(xn=144;xn<256;++xn)Cn[xn]=9;for(xn=256;xn<280;++xn)Cn[xn]=7;for(xn=280;xn<288;++xn)Cn[xn]=8;var Tn=new pn(32);for(xn=0;xn<32;++xn)Tn[xn]=5;var On=Pn(Cn,9,0),Rn=Pn(Tn,5,0),$n=function(e){return(e/8|0)+(7&e&&1)},Dn=function(e,t,i){(null==i||i>e.length)&&(i=e.length);var r=new(e instanceof fn?fn:e instanceof vn?vn:pn)(i-t);return r.set(e.subarray(t,i)),r},Mn=function(e,t,i){i<<=7&t;var r=t/8|0;e[r]|=i,e[r+1]|=i>>>8},Ln=function(e,t,i){i<<=7&t;var r=t/8|0;e[r]|=i,e[r+1]|=i>>>8,e[r+2]|=i>>>16},Nn=function(e,t){for(var i=[],r=0;r<e.length;++r)e[r]&&i.push({s:r,f:e[r]});var n=i.length,s=i.slice();if(!n)return[new pn(0),0];if(1==n){var o=new pn(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort(function(e,t){return e.f-t.f}),i.push({s:-1,f:25001});var a=i[0],l=i[1],u=0,c=1,d=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};c!=n-1;)a=i[i[u].f<i[d].f?u++:d++],l=i[u!=c&&i[u].f<i[d].f?u++:d++],i[c++]={s:-1,f:a.f+l.f,l:a,r:l};var h=s[0].s;for(r=1;r<n;++r)s[r].s>h&&(h=s[r].s);var g=new fn(h+1),p=Fn(i[c-1],g,0);if(p>t){r=0;var f=0,v=p-t,_=1<<v;for(s.sort(function(e,t){return g[t.s]-g[e.s]||e.f-t.f});r<n;++r){var m=s[r].s;if(!(g[m]>t))break;f+=_-(1<<p-g[m]),g[m]=t}for(f>>>=v;f>0;){var y=s[r].s;g[y]<t?f-=1<<t-g[y]++-1:++r}for(;r>=0&&f;--r){var b=s[r].s;g[b]==t&&(--g[b],++f)}p=t}return[new pn(g),p]},Fn=function(e,t,i){return-1==e.s?Math.max(Fn(e.l,t,i+1),Fn(e.r,t,i+1)):t[e.s]=i},Bn=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new fn(++t),r=0,n=e[0],s=1,o=function(e){i[r++]=e},a=1;a<=t;++a)if(e[a]==n&&a!=t)++s;else{if(!n&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(n),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(n);s=1,n=e[a]}return[i.subarray(0,r),t]},Un=function(e,t){for(var i=0,r=0;r<t.length;++r)i+=e[r]*t[r];return i},jn=function(e,t,i){var r=i.length,n=$n(t+2);e[n]=255&r,e[n+1]=r>>>8,e[n+2]=255^e[n],e[n+3]=255^e[n+1];for(var s=0;s<r;++s)e[n+s+4]=i[s];return 8*(n+4+r)},Vn=function(e,t,i,r,n,s,o,a,l,u,c){Mn(t,c++,i),++n[256];for(var d=Nn(n,15),h=d[0],g=d[1],p=Nn(s,15),f=p[0],v=p[1],_=Bn(h),m=_[0],y=_[1],b=Bn(f),w=b[0],k=b[1],E=new fn(19),S=0;S<m.length;++S)E[31&m[S]]++;for(S=0;S<w.length;++S)E[31&w[S]]++;for(var A=Nn(E,7),x=A[0],I=A[1],P=19;P>4&&!x[yn[P-1]];--P);var C,T,O,R,$=u+5<<3,D=Un(n,Cn)+Un(s,Tn)+o,M=Un(n,h)+Un(s,f)+o+14+3*P+Un(E,x)+(2*E[16]+3*E[17]+7*E[18]);if($<=D&&$<=M)return jn(t,c,e.subarray(l,l+u));if(Mn(t,c,1+(M<D)),c+=2,M<D){C=Pn(h,g,0),T=h,O=Pn(f,v,0),R=f;var L=Pn(x,I,0);for(Mn(t,c,y-257),Mn(t,c+5,k-1),Mn(t,c+10,P-4),c+=14,S=0;S<P;++S)Mn(t,c+3*S,x[yn[S]]);c+=3*P;for(var N=[m,w],F=0;F<2;++F){var B=N[F];for(S=0;S<B.length;++S){var U=31&B[S];Mn(t,c,L[U]),c+=x[U],U>15&&(Mn(t,c,B[S]>>>5&127),c+=B[S]>>>12)}}}else C=On,T=Cn,O=Rn,R=Tn;for(S=0;S<a;++S)if(r[S]>255){U=r[S]>>>18&31,Ln(t,c,C[U+257]),c+=T[U+257],U>7&&(Mn(t,c,r[S]>>>23&31),c+=_n[U]);var j=31&r[S];Ln(t,c,O[j]),c+=R[j],j>3&&(Ln(t,c,r[S]>>>5&8191),c+=mn[j])}else Ln(t,c,C[r[S]]),c+=T[r[S]];return Ln(t,c,C[256]),c+T[256]},Hn=new vn([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Gn=function(){for(var e=new vn(256),t=0;t<256;++t){for(var i=t,r=9;--r;)i=(1&i&&3988292384)^i>>>1;e[t]=i}return e}(),qn=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};var zn=!!h||!!d,Kn="text/plain",Wn=function(e,t,i){var r;void 0===i&&(i=!0);var[n,s]=e.split("?"),o=y({},t),a=null!==(r=null==s?void 0:s.split("&").map(e=>{var t,[r,n]=e.split("="),s=i&&null!==(t=o[r])&&void 0!==t?t:n;return delete o[r],r+"="+s}))&&void 0!==r?r:[],l=function(e,t){var i,r;void 0===t&&(t="&");var n=[];return It(e,function(e,t){M(e)||M(t)||"undefined"===t||(i=encodeURIComponent((e=>e instanceof File)(e)?e.name:e.toString()),r=encodeURIComponent(t),n[n.length]=r+"="+i)}),n.join(t)}(o);return l&&a.push(l),n+"?"+a.join("&")},Jn=(e,t)=>JSON.stringify(e,(e,t)=>"bigint"==typeof t?t.toString():t,t),Yn=e=>{var{data:t,compression:i}=e;if(t){if(i===Yi.GZipJS){var r=function(e,t){void 0===t&&(t={});var i=function(){var e=4294967295;return{p:function(t){for(var i=e,r=0;r<t.length;++r)i=Gn[255&i^t[r]]^i>>>8;e=i},d:function(){return 4294967295^e}}}(),r=e.length;i.p(e);var n,s=function(e,t,i){return function(e,t,i,r,n,s){var o=e.length,a=new pn(r+o+5*(1+Math.floor(o/7e3))+8),l=a.subarray(r,a.length-8),u=0;if(!t||o<8)for(var c=0;c<=o;c+=65535){var d=c+65535;d<o?u=jn(l,u,e.subarray(c,d)):(l[c]=s,u=jn(l,u,e.subarray(c,o)))}else{for(var h=Hn[t-1],g=h>>>13,p=8191&h,f=(1<<i)-1,v=new fn(32768),_=new fn(f+1),m=Math.ceil(i/3),y=2*m,b=function(t){return(e[t]^e[t+1]<<m^e[t+2]<<y)&f},w=new vn(25e3),k=new fn(288),E=new fn(32),S=0,A=0,x=(c=0,0),I=0,P=0;c<o;++c){var C=b(c),T=32767&c,O=_[C];if(v[T]=O,_[C]=T,I<=c){var R=o-c;if((S>7e3||x>24576)&&R>423){u=Vn(e,l,0,w,k,E,A,x,P,c-P,u),x=S=A=0,P=c;for(var $=0;$<286;++$)k[$]=0;for($=0;$<30;++$)E[$]=0}var D=2,M=0,L=p,N=T-O&32767;if(R>2&&C==b(c-N))for(var F=Math.min(g,R)-1,B=Math.min(32767,c),U=Math.min(258,R);N<=B&&--L&&T!=O;){if(e[c+D]==e[c+D-N]){for(var j=0;j<U&&e[c+j]==e[c+j-N];++j);if(j>D){if(D=j,M=N,j>F)break;var V=Math.min(N,j-2),H=0;for($=0;$<V;++$){var G=c-N+$+32768&32767,q=G-v[G]+32768&32767;q>H&&(H=q,O=G)}}}N+=(T=O)-(O=v[T])+32768&32767}if(M){w[x++]=268435456|En[D]<<18|Sn[M];var z=31&En[D],K=31&Sn[M];A+=_n[z]+mn[K],++k[257+z],++E[K],I=c+D,++S}else w[x++]=e[c],++k[e[c]]}}u=Vn(e,l,s,w,k,E,A,x,P,c-P,u)}return Dn(a,0,r+$n(u)+8)}(e,null==t.level?6:t.level,null==t.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,i,0,!0)}(e,t,10+((n=t).filename&&n.filename.length+1||0)),o=s.length;return function(e,t){var i=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&qn(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),i){e[3]=8;for(var r=0;r<=i.length;++r)e[r+10]=i.charCodeAt(r)}}(s,t),qn(s,o-8,i.d()),qn(s,o-4,r),s}(function(e){var t=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var i=new pn(e.length+(e.length>>>1)),r=0,n=function(e){i[r++]=e},s=0;s<t;++s){if(r+5>i.length){var o=new pn(r+8+(t-s<<1));o.set(i),i=o}var a=e.charCodeAt(s);a<128?n(a):a<2048?(n(192|a>>>6),n(128|63&a)):a>55295&&a<57344?(n(240|(a=65536+(1047552&a)|1023&e.charCodeAt(++s))>>>18),n(128|a>>>12&63),n(128|a>>>6&63),n(128|63&a)):(n(224|a>>>12),n(128|a>>>6&63),n(128|63&a))}return Dn(i,0,r)}(Jn(t)),{mtime:0}),n=new Blob([r],{type:Kn});return{contentType:Kn,body:n,estimatedSize:n.size}}if(i===Yi.Base64){var s=function(e){var t,i,r,n,s,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",a=0,l=0,u="",c=[];if(!e)return e;e=function(e){var t,i,r,n,s="";for(t=i=0,r=(e=(e+"").replace(/\r\n/g,"\n").replace(/\r/g,"\n")).length,n=0;n<r;n++){var o=e.charCodeAt(n),a=null;o<128?i++:a=o>127&&o<2048?String.fromCharCode(o>>6|192,63&o|128):String.fromCharCode(o>>12|224,o>>6&63|128,63&o|128),F(a)||(i>t&&(s+=e.substring(t,i)),s+=a,t=i=n+1)}return i>t&&(s+=e.substring(t,e.length)),s}(e);do{t=(s=e.charCodeAt(a++)<<16|e.charCodeAt(a++)<<8|e.charCodeAt(a++))>>18&63,i=s>>12&63,r=s>>6&63,n=63&s,c[l++]=o.charAt(t)+o.charAt(i)+o.charAt(r)+o.charAt(n)}while(a<e.length);switch(u=c.join(""),e.length%3){case 1:u=u.slice(0,-2)+"==";break;case 2:u=u.slice(0,-1)+"="}return u}(Jn(t)),o=(e=>"data="+encodeURIComponent("string"==typeof e?e:Jn(e)))(s);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}var a=Jn(t);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},Qn=[];d&&Qn.push({transport:"fetch",method:e=>{var t,i,{contentType:r,body:n,estimatedSize:s}=null!==(t=Yn(e))&&void 0!==t?t:{},o=new Headers;It(e.headers,function(e,t){o.append(t,e)}),r&&o.append("Content-Type",r);var a=e.url,l=null;if(g){var u=new g;l={signal:u.signal,timeout:setTimeout(()=>u.abort(),e.timeout)}}d(a,y({method:(null==e?void 0:e.method)||"GET",headers:o,keepalive:"POST"===e.method&&(s||0)<52428.8,body:n,signal:null==(i=l)?void 0:i.signal},e.fetchOptions)).then(t=>t.text().then(i=>{var r={statusCode:t.status,text:i};if(200===t.status)try{r.json=JSON.parse(i)}catch(e){wt.error(e)}null==e.callback||e.callback(r)})).catch(t=>{wt.error(t),null==e.callback||e.callback({statusCode:0,text:t})}).finally(()=>l?clearTimeout(l.timeout):null)}}),h&&Qn.push({transport:"XHR",method:e=>{var t,i=new h;i.open(e.method||"GET",e.url,!0);var{contentType:r,body:n}=null!==(t=Yn(e))&&void 0!==t?t:{};It(e.headers,function(e,t){i.setRequestHeader(t,e)}),r&&i.setRequestHeader("Content-Type",r),e.timeout&&(i.timeout=e.timeout),e.disableXHRCredentials||(i.withCredentials=!0),i.onreadystatechange=()=>{if(4===i.readyState){var t={statusCode:i.status,text:i.responseText};if(200===i.status)try{t.json=JSON.parse(i.responseText)}catch(e){}null==e.callback||e.callback(t)}},i.send(n)}}),null!=l&&l.sendBeacon&&Qn.push({transport:"sendBeacon",method:e=>{var t=Wn(e.url,{beacon:"1"});try{var i,{contentType:r,body:n}=null!==(i=Yn(e))&&void 0!==i?i:{},s="string"==typeof n?new Blob([n],{type:r}):n;l.sendBeacon(t,s)}catch(e){}}});var Zn=function(e,t){if(!function(e){try{new RegExp(e)}catch(e){return!1}return!0}(t))return!1;try{return new RegExp(t).test(e)}catch(e){return!1}};function Xn(e,t,i){return Jn({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}var es={exact:(e,t)=>t.some(t=>e.some(e=>t===e)),is_not:(e,t)=>t.every(t=>e.every(e=>t!==e)),regex:(e,t)=>t.some(t=>e.some(e=>Zn(t,e))),not_regex:(e,t)=>t.every(t=>e.every(e=>!Zn(t,e))),icontains:(e,t)=>t.map(ts).some(t=>e.map(ts).some(e=>t.includes(e))),not_icontains:(e,t)=>t.map(ts).every(t=>e.map(ts).every(e=>!t.includes(e))),gt:(e,t)=>t.some(t=>{var i=parseFloat(t);return!isNaN(i)&&e.some(e=>i>parseFloat(e))}),lt:(e,t)=>t.some(t=>{var i=parseFloat(t);return!isNaN(i)&&e.some(e=>i<parseFloat(e))})},ts=e=>e.toLowerCase();function is(e,t){return!e||Object.entries(e).every(e=>{var[i,r]=e,n=null==t?void 0:t[i];if(M(n)||F(n))return!1;var s=[String(n)],o=es[r.operator];return!!o&&o(r.values,s)})}var rs=kt("[Error tracking]");class ns{constructor(e){var t,i;this.Zt=[],this.ti=new Qe([new ut,new yt,new dt,new ct,new _t,new vt,new gt,new mt],function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];return function(t,r){void 0===r&&(r=0);for(var n=[],s=t.split("\n"),o=r;o<s.length;o++){var a=s[o];if(!(a.length>1024)){var l=lt.test(a)?a.replace(lt,"$1"):a;if(!l.match(/\S*Error: /)){for(var u of i){var c=u(l,e);if(c){n.push(c);break}}if(n.length>=50)break}}}return function(e){if(!e.length)return[];var t=Array.from(e);return t.reverse(),t.slice(0,50).map(e=>{return y({},e,{filename:e.filename||(i=t,i[i.length-1]||{}).filename,function:e.function||Ze});var i})}(n)}}("web:javascript",nt,at)),this._instance=e,this.Zt=null!==(t=null==(i=this._instance.persistence)?void 0:i.get_property(Gt))&&void 0!==t?t:[]}onRemoteConfig(e){var t,i,r,n=null!==(t=null==(i=e.errorTracking)?void 0:i.suppressionRules)&&void 0!==t?t:[],s=null==(r=e.errorTracking)?void 0:r.captureExtensionExceptions;this.Zt=n,this._instance.persistence&&this._instance.persistence.register({[Gt]:this.Zt,[qt]:s})}get ii(){var e,t=!!this._instance.get_property(qt),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(e=null!=i?i:t)&&void 0!==e&&e}buildProperties(e,t){return this.ti.buildFromUnknown(e,{syntheticException:null==t?void 0:t.syntheticException,mechanism:{handled:null==t?void 0:t.handled}})}sendExceptionEvent(e){var t=e.$exception_list;if(this.ei(t)){if(this.ri(t))return void rs.info("Skipping exception capture because a suppression rule matched");if(!this.ii&&this.si(t))return void rs.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ni(t))return void rs.info("Skipping exception capture because it was thrown by the PostHog SDK")}return this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent"})}ri(e){if(0===e.length)return!1;var t=e.reduce((e,t)=>{var{type:i,value:r}=t;return L(i)&&i.length>0&&e.$exception_types.push(i),L(r)&&r.length>0&&e.$exception_values.push(r),e},{$exception_types:[],$exception_values:[]});return this.Zt.some(e=>{var i=e.values.map(e=>{var i,r=es[e.operator],n=O(e.value)?e.value:[e.value],s=null!==(i=t[e.key])&&void 0!==i?i:[];return n.length>0&&r(n,s)});return"OR"===e.type?i.some(Boolean):i.every(Boolean)})}si(e){return e.flatMap(e=>{var t,i;return null!==(t=null==(i=e.stacktrace)?void 0:i.frames)&&void 0!==t?t:[]}).some(e=>e.filename&&e.filename.startsWith("chrome-extension://"))}ni(e){if(e.length>0){var t,i,r,n,s=null!==(t=null==(i=e[0].stacktrace)?void 0:i.frames)&&void 0!==t?t:[],o=s[s.length-1];return null!==(r=null==o||null==(n=o.filename)?void 0:n.includes("posthog.com/static"))&&void 0!==r&&r}return!1}ei(e){return!B(e)&&O(e)}}var ss=kt("[FeatureFlags]"),os=kt("[FeatureFlags]",{debugEnabled:!0}),as="$active_feature_flags",ls="$override_feature_flags",us="$feature_flag_payloads",cs="$override_feature_flag_payloads",ds="$feature_flag_request_id",hs="$feature_flag_evaluated_at",gs=e=>{var t={};for(var[i,r]of Tt(e||{}))r&&(t[i]=r);return t},ps=function(e){return e.FeatureFlags="feature_flags",e.Recordings="recordings",e}({});class fs{constructor(e){this.oi=!1,this.ai=!1,this.li=!1,this.ui=!1,this.hi=!1,this.di=!1,this.vi=!1,this._instance=e,this.featureFlagEventHandlers=[]}ci(){var e=this._instance.config.evaluation_environments;return null!=e&&e.length?e.filter(e=>{var t=e&&"string"==typeof e&&e.trim().length>0;return t||ss.error("Invalid evaluation environment found:",e,"Expected non-empty string"),t}):[]}fi(){return this.ci().length>0}flags(){if(this._instance.config.__preview_remote_config)this.di=!0;else{var e=!this.pi&&(this._instance.config.advanced_disable_feature_flags||this._instance.config.advanced_disable_feature_flags_on_first_load);this.gi({disableFlags:e})}}get hasLoadedFlags(){return this.ai}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this._instance.get_property(ti),t=this._instance.get_property(ls),i=this._instance.get_property(cs);if(!i&&!t)return e||{};var r=Pt({},e||{}),n=[...new Set([...Object.keys(i||{}),...Object.keys(t||{})])];for(var s of n){var o,a,l=r[s],u=null==t?void 0:t[s],c=M(u)?null!==(o=null==l?void 0:l.enabled)&&void 0!==o&&o:!!u,d=M(u)?l.variant:"string"==typeof u?u:void 0,h=null==i?void 0:i[s],g=y({},l,{enabled:c,variant:c?null!=d?d:null==l?void 0:l.variant:void 0});c!==(null==l?void 0:l.enabled)&&(g.original_enabled=null==l?void 0:l.enabled),d!==(null==l?void 0:l.variant)&&(g.original_variant=null==l?void 0:l.variant),h&&(g.metadata=y({},null==l?void 0:l.metadata,{payload:h,original_payload:null==l||null==(a=l.metadata)?void 0:a.payload})),r[s]=g}return this.oi||(ss.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:i,finalDetails:r}),this.oi=!0),r}getFlagVariants(){var e=this._instance.get_property(Xt),t=this._instance.get_property(ls);if(!t)return e||{};for(var i=Pt({},e),r=Object.keys(t),n=0;n<r.length;n++)i[r[n]]=t[r[n]];return this.oi||(ss.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this.oi=!0),i}getFlagPayloads(){var e=this._instance.get_property(us),t=this._instance.get_property(cs);if(!t)return e||{};for(var i=Pt({},e||{}),r=Object.keys(t),n=0;n<r.length;n++)i[r[n]]=t[r[n]];return this.oi||(ss.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:i}),this.oi=!0),i}reloadFeatureFlags(){this.ui||this._instance.config.advanced_disable_feature_flags||this.pi||(this.pi=setTimeout(()=>{this.gi()},5))}mi(){clearTimeout(this.pi),this.pi=void 0}ensureFlagsLoaded(){this.ai||this.li||this.pi||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.ui=e}gi(e){var t;if(this.mi(),!this._instance.O())if(this.li)this.hi=!0;else{var i=this._instance.config.token,r=this._instance.get_property("$device_id"),n={token:i,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:y({},(null==(t=this._instance.persistence)?void 0:t.get_initial_props())||{},this._instance.get_property(ii)||{}),group_properties:this._instance.get_property(ri)};F(r)||M(r)||(n.$device_id=r),(null!=e&&e.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(n.disable_flags=!0),this.fi()&&(n.evaluation_environments=this.ci());var s=this._instance.config.__preview_remote_config,o=s?"/flags/?v=2":"/flags/?v=2&config=true",a=this._instance.config.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":"",l=this._instance.requestRouter.endpointFor("flags",o+a);s&&(n.timezone=nn()),this.li=!0,this._instance._send_request({method:"POST",url:l,data:n,compression:this._instance.config.disable_compression?void 0:Yi.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:e=>{var t,i,r=!0;if(200===e.statusCode&&(this.hi||(this.$anon_distinct_id=void 0),r=!1),this.li=!1,this.di||(this.di=!0,this._instance.yi(null!==(i=e.json)&&void 0!==i?i:{})),!n.disable_flags||this.hi)if(this.vi=!r,e.json&&null!=(t=e.json.quotaLimited)&&t.includes(ps.FeatureFlags))ss.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more.");else{var s;n.disable_flags||this.receivedFeatureFlags(null!==(s=e.json)&&void 0!==s?s:{},r),this.hi&&(this.hi=!1,this.gi())}}})}}getFeatureFlag(e,t){if(void 0===t&&(t={}),this.ai||this.getFlags()&&this.getFlags().length>0){var i=this.getFlagVariants()[e],r=""+i,n=this._instance.get_property(ds)||void 0,s=this._instance.get_property(hs)||void 0,o=this._instance.get_property(si)||{};if((t.send_event||!("send_event"in t))&&(!(e in o)||!o[e].includes(r))){var a,l,u,c,d,h,g,p,f;O(o[e])?o[e].push(r):o[e]=[r],null==(a=this._instance.persistence)||a.register({[si]:o});var v=this.getFeatureFlagDetails(e),_={$feature_flag:e,$feature_flag_response:i,$feature_flag_payload:this.getFeatureFlagPayload(e)||null,$feature_flag_request_id:n,$feature_flag_evaluated_at:s,$feature_flag_bootstrapped_response:(null==(l=this._instance.config.bootstrap)||null==(l=l.featureFlags)?void 0:l[e])||null,$feature_flag_bootstrapped_payload:(null==(u=this._instance.config.bootstrap)||null==(u=u.featureFlagPayloads)?void 0:u[e])||null,$used_bootstrap_value:!this.vi};M(null==v||null==(c=v.metadata)?void 0:c.version)||(_.$feature_flag_version=v.metadata.version);var m,y=null!==(d=null==v||null==(h=v.reason)?void 0:h.description)&&void 0!==d?d:null==v||null==(g=v.reason)?void 0:g.code;y&&(_.$feature_flag_reason=y),null!=v&&null!=(p=v.metadata)&&p.id&&(_.$feature_flag_id=v.metadata.id),M(null==v?void 0:v.original_variant)&&M(null==v?void 0:v.original_enabled)||(_.$feature_flag_original_response=M(v.original_variant)?v.original_enabled:v.original_variant),null!=v&&null!=(f=v.metadata)&&f.original_payload&&(_.$feature_flag_original_payload=null==v||null==(m=v.metadata)?void 0:m.original_payload),this._instance.capture("$feature_flag_called",_)}return i}ss.warn('getFeatureFlag for key "'+e+"\" failed. Feature flags didn't load in time.")}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){return this.getFlagPayloads()[e]}getRemoteConfigPayload(e,t){var i=this._instance.config.token,r={distinct_id:this._instance.get_distinct_id(),token:i};this.fi()&&(r.evaluation_environments=this.ci()),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2&config=true"),data:r,compression:this._instance.config.disable_compression?void 0:Yi.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:i=>{var r,n=null==(r=i.json)?void 0:r.featureFlagPayloads;t((null==n?void 0:n[e])||void 0)}})}isFeatureEnabled(e,t){if(void 0===t&&(t={}),this.ai||this.getFlags()&&this.getFlags().length>0){var i=this.getFeatureFlag(e,t);return M(i)?void 0:!!i}ss.warn('isFeatureEnabled for key "'+e+"\" failed. Feature flags didn't load in time.")}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(t=>t!==e)}receivedFeatureFlags(e,t){if(this._instance.persistence){this.ai=!0;var i=this.getFlagVariants(),r=this.getFlagPayloads(),n=this.getFlagsWithDetails();!function(e,t,i,r,n){void 0===i&&(i={}),void 0===r&&(r={}),void 0===n&&(n={});var s=(e=>{var t=e.flags;return t?(e.featureFlags=Object.fromEntries(Object.keys(t).map(e=>{var i;return[e,null!==(i=t[e].variant)&&void 0!==i?i:t[e].enabled]})),e.featureFlagPayloads=Object.fromEntries(Object.keys(t).filter(e=>t[e].enabled).filter(e=>{var i;return null==(i=t[e].metadata)?void 0:i.payload}).map(e=>{var i;return[e,null==(i=t[e].metadata)?void 0:i.payload]}))):ss.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),e})(e),o=s.flags,a=s.featureFlags,l=s.featureFlagPayloads;if(a){var u=e.requestId,c=e.evaluatedAt;if(O(a)){ss.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var d={};if(a)for(var h=0;h<a.length;h++)d[a[h]]=!0;t&&t.register({[as]:a,[Xt]:d})}else{var g=a,p=l,f=o;e.errorsWhileComputingFlags&&(g=y({},i,g),p=y({},r,p),f=y({},n,f)),t&&t.register(y({[as]:Object.keys(gs(g)),[Xt]:g||{},[us]:p||{},[ti]:f||{}},u?{[ds]:u}:{},c?{[hs]:c}:{}))}}}(e,this._instance.persistence,i,r,n),this.bi(t)}}override(e,t){void 0===t&&(t=!1),ss.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._instance.persistence)return ss.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===e)return this._instance.persistence.unregister(ls),this._instance.persistence.unregister(cs),this.bi(),os.info("All overrides cleared");if(e&&"object"==typeof e&&("flags"in e||"payloads"in e)){var t,i=e;if(this.oi=Boolean(null!==(t=i.suppressWarning)&&void 0!==t&&t),"flags"in i)if(!1===i.flags)this._instance.persistence.unregister(ls),os.info("Flag overrides cleared");else if(i.flags){if(O(i.flags)){for(var r={},n=0;n<i.flags.length;n++)r[i.flags[n]]=!0;this._instance.persistence.register({[ls]:r})}else this._instance.persistence.register({[ls]:i.flags});os.info("Flag overrides set",{flags:i.flags})}return"payloads"in i&&(!1===i.payloads?(this._instance.persistence.unregister(cs),os.info("Payload overrides cleared")):i.payloads&&(this._instance.persistence.register({[cs]:i.payloads}),os.info("Payload overrides set",{payloads:i.payloads}))),void this.bi()}this.bi()}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.ai){var{flags:t,flagVariants:i}=this.wi();e(t,i)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,i){var r,n=(this._instance.get_property(ei)||[]).find(t=>t.flagKey===e),s={["$feature_enrollment/"+e]:t},o={$feature_flag:e,$feature_enrollment:t,$set:s};n&&(o.$early_access_feature_name=n.name),i&&(o.$feature_enrollment_stage=i),this._instance.capture("$feature_enrollment_update",o),this.setPersonPropertiesForFlags(s,!1);var a=y({},this.getFlagVariants(),{[e]:t});null==(r=this._instance.persistence)||r.register({[as]:Object.keys(gs(a)),[Xt]:a}),this.bi()}getEarlyAccessFeatures(e,t,i){void 0===t&&(t=!1);var r=this._instance.get_property(ei),n=i?"&"+i.map(e=>"stage="+e).join("&"):"";if(r&&!t)return e(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this._instance.config.token+n),method:"GET",callback:t=>{var i,r;if(t.json){var n=t.json.earlyAccessFeatures;return null==(i=this._instance.persistence)||i.unregister(ei),null==(r=this._instance.persistence)||r.register({[ei]:n}),e(n)}}})}wi(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(e=>t[e]),flagVariants:Object.keys(t).filter(e=>t[e]).reduce((e,i)=>(e[i]=t[i],e),{})}}bi(e){var{flags:t,flagVariants:i}=this.wi();this.featureFlagEventHandlers.forEach(r=>r(t,i,{errorsLoading:e}))}setPersonPropertiesForFlags(e,t){void 0===t&&(t=!0);var i=this._instance.get_property(ii)||{};this._instance.register({[ii]:y({},i,e)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(ii)}setGroupPropertiesForFlags(e,t){void 0===t&&(t=!0);var i=this._instance.get_property(ri)||{};0!==Object.keys(i).length&&Object.keys(i).forEach(t=>{i[t]=y({},i[t],e[t]),delete e[t]}),this._instance.register({[ri]:y({},i,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._instance.get_property(ri)||{};this._instance.register({[ri]:y({},t,{[e]:{}})})}else this._instance.unregister(ri)}reset(){this.ai=!1,this.li=!1,this.ui=!1,this.hi=!1,this.di=!1,this.vi=!1,this.$anon_distinct_id=void 0,this.mi(),this.oi=!1}}var vs=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class _s{constructor(e,t){this.R=e,this.props={},this.xi=!1,this.Ei=(e=>{var t="";return e.token&&(t=e.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),e.persistence_name?"ph_"+e.persistence_name:"ph_"+t+"_posthog"})(e),this.Y=this.$i(e),this.load(),e.debug&&wt.info("Persistence loaded",e.persistence,y({},this.props)),this.update_config(e,e,t),this.save()}isDisabled(){return!!this.Si}$i(e){-1===vs.indexOf(e.persistence.toLowerCase())&&(wt.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=function(e){void 0===e&&(e=[]);var t=[...yr,...e];return y({},mr,{W:function(e){try{var t={};try{t=vr.W(e)||{}}catch(e){}var i=Pt(t,JSON.parse(mr.q(e)||"{}"));return mr.G(e,i),i}catch(e){}return null},G:function(e,i,r,n,s,o){try{mr.G(e,i,void 0,void 0,o);var a={};t.forEach(e=>{i[e]&&(a[e]=i[e])}),Object.keys(a).length&&vr.G(e,a,r,n,s,o)}catch(e){mr.B(e)}},V:function(e,t){try{null==r||r.localStorage.removeItem(e),vr.V(e,t)}catch(e){mr.B(e)}}})}(e.cookie_persisted_properties||[]),i=e.persistence.toLowerCase();return"localstorage"===i&&mr.H()?mr:"localstorage+cookie"===i&&t.H()?t:"sessionstorage"===i&&Er.H()?Er:"memory"===i?wr:"cookie"===i?vr:t.H()?t:vr}properties(){var e={};return It(this.props,function(t,i){if(i===Xt&&$(t))for(var r=Object.keys(t),n=0;n<r.length;n++)e["$feature/"+r[n]]=t[r[n]];else o=i,l=!1,(F(s=fi)?l:a&&s.indexOf===a?-1!=s.indexOf(o):(It(s,function(e){if(l||(l=e===o))return At}),l))||(e[i]=t);var s,o,l}),e}load(){if(!this.Si){var e=this.Y.W(this.Ei);e&&(this.props=Pt({},e))}}save(){this.Si||this.Y.G(this.Ei,this.props,this.ki,this.Pi,this.Ti,this.R.debug)}remove(){this.Y.V(this.Ei,!1),this.Y.V(this.Ei,!0)}clear(){this.remove(),this.props={}}register_once(e,t,i){if($(e)){M(t)&&(t="None"),this.ki=M(i)?this.Ii:i;var r=!1;if(It(e,(e,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==t||(this.props[i]=e,r=!0)}),r)return this.save(),!0}return!1}register(e,t){if($(e)){this.ki=M(t)?this.Ii:t;var i=!1;if(It(e,(t,r)=>{e.hasOwnProperty(r)&&this.props[r]!==t&&(this.props[r]=t,i=!0)}),i)return this.save(),!0}return!1}unregister(e){e in this.props&&(delete this.props[e],this.save())}update_campaign_params(){if(!this.xi){var e=Yr(this.R.custom_campaign_params,this.R.mask_personal_data_properties,this.R.custom_personal_data_properties);D($t(e))||this.register(e),this.xi=!0}}update_search_keyword(){var e;this.register((e=null==u?void 0:u.referrer)?Zr(e):{})}update_referrer_info(){var e;this.register_once({$referrer:en(),$referring_domain:null!=u&&u.referrer&&(null==(e=Zi(u.referrer))?void 0:e.host)||"$direct"},void 0)}set_initial_person_info(){this.props[ui]||this.props[ci]||this.register_once({[di]:tn(this.R.mask_personal_data_properties,this.R.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};It([ci,ui],t=>{var i=this.props[t];i&&It(i,function(t,i){e["$initial_"+x(i)]=t})});var t,i,r=this.props[di];if(r){var n=(t=rn(r),i={},It(t,function(e,t){i["$initial_"+x(t)]=e}),i);Pt(e,n)}return e}safe_merge(e){return It(this.props,function(t,i){i in e||(e[i]=t)}),e}update_config(e,t,i){if(this.Ii=this.ki=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!i),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==t.persistence||!((e,t)=>{if(e.length!==t.length)return!1;var i=[...e].sort(),r=[...t].sort();return i.every((e,t)=>e===r[t])})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[])){var r=this.$i(e),n=this.props;this.clear(),this.Y=r,this.props=n,this.save()}}set_disabled(e){this.Si=e,this.Si?this.remove():this.save()}set_cross_subdomain(e){e!==this.Pi&&(this.Pi=e,this.remove(),this.save())}set_secure(e){e!==this.Ti&&(this.Ti=e,this.remove(),this.save())}set_event_timer(e,t){var i=this.props[Ut]||{};i[e]=t,this.props[Ut]=i,this.save()}remove_event_timer(e){var t=(this.props[Ut]||{})[e];return M(t)||(delete this.props[Ut][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}}var ms=kt("[Product Tours]"),ys="ph_product_tours";class bs{constructor(e){this.Ci=null,this.Ri=null,this._instance=e}onRemoteConfig(e){this._instance.persistence&&this._instance.persistence.register({[Wt]:!(null==e||!e.productTours)}),this.loadIfEnabled()}loadIfEnabled(){var e,t;this.Ci||(e=this._instance).config.disable_product_tours||null==(t=e.persistence)||!t.get_property(Wt)||this.it(()=>this.Fi())}it(e){var t,i;null!=(t=f.__PosthogExtensions__)&&t.generateProductTours?e():null==(i=f.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"product-tours",t=>{t?ms.error("Could not load product tours script",t):e()})}Fi(){var e;!this.Ci&&null!=(e=f.__PosthogExtensions__)&&e.generateProductTours&&(this.Ci=f.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(void 0===t&&(t=!1),!O(this.Ri)||t){var i=this._instance.persistence;if(i){var r=i.props[ys];if(O(r)&&!t)return this.Ri=r,void e(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:t=>{var r=t.statusCode;if(200!==r||!t.json){var n="Product Tours API could not be loaded, status: "+r;return ms.error(n),void e([],{isLoaded:!1,error:n})}var s=O(t.json.product_tours)?t.json.product_tours:[];this.Ri=s,i&&i.register({[ys]:s}),e(s,{isLoaded:!0})}})}else e(this.Ri,{isLoaded:!0})}getActiveProductTours(e){B(this.Ci)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.Ci.getActiveProductTours(e)}showProductTour(e){var t;null==(t=this.Ci)||t.showTourById(e)}previewTour(e){this.Ci?this.Ci.previewTour(e):this.it(()=>{var t;this.Fi(),null==(t=this.Ci)||t.previewTour(e)})}dismissProductTour(){var e;null==(e=this.Ci)||e.dismissTour("user_clicked_skip")}nextStep(){var e;null==(e=this.Ci)||e.nextStep()}previousStep(){var e;null==(e=this.Ci)||e.previousStep()}clearCache(){var e;this.Ri=null,null==(e=this._instance.persistence)||e.unregister(ys)}resetTour(e){var t;null==(t=this.Ci)||t.resetTour(e)}resetAllTours(){var e;null==(e=this.Ci)||e.resetAllTours()}cancelPendingTour(e){var t;null==(t=this.Ci)||t.cancelPendingTour(e)}}var ws=function(e){return e.Activation="events",e.Cancellation="cancelEvents",e}({}),ks=function(e){return e.Button="button",e.Tab="tab",e.Selector="selector",e}({}),Es=function(e){return e.TopLeft="top_left",e.TopRight="top_right",e.TopCenter="top_center",e.MiddleLeft="middle_left",e.MiddleRight="middle_right",e.MiddleCenter="middle_center",e.Left="left",e.Center="center",e.Right="right",e.NextToTrigger="next_to_trigger",e}({}),Ss=function(e){return e.Top="top",e.Left="left",e.Right="right",e.Bottom="bottom",e}({}),As=function(e){return e.Popover="popover",e.API="api",e.Widget="widget",e.ExternalSurvey="external_survey",e}({}),xs=function(e){return e.Open="open",e.MultipleChoice="multiple_choice",e.SingleChoice="single_choice",e.Rating="rating",e.Link="link",e}({}),Is=function(e){return e.NextQuestion="next_question",e.End="end",e.ResponseBased="response_based",e.SpecificQuestion="specific_question",e}({}),Ps=function(e){return e.Once="once",e.Recurring="recurring",e.Always="always",e}({}),Cs=function(e){return e.SHOWN="survey shown",e.DISMISSED="survey dismissed",e.SENT="survey sent",e.ABANDONED="survey abandoned",e}({}),Ts=function(e){return e.SURVEY_ID="$survey_id",e.SURVEY_NAME="$survey_name",e.SURVEY_RESPONSE="$survey_response",e.SURVEY_ITERATION="$survey_iteration",e.SURVEY_ITERATION_START_DATE="$survey_iteration_start_date",e.SURVEY_PARTIALLY_COMPLETED="$survey_partially_completed",e.SURVEY_SUBMISSION_ID="$survey_submission_id",e.SURVEY_QUESTIONS="$survey_questions",e.SURVEY_COMPLETED="$survey_completed",e.PRODUCT_TOUR_ID="$product_tour_id",e}({}),Os=function(e){return e.Popover="popover",e.Inline="inline",e}({}),Rs=kt("[Surveys]"),$s="seenSurvey_",Ds=(e,t)=>{var i="$survey_"+t+"/"+e.id;return e.current_iteration&&e.current_iteration>0&&(i="$survey_"+t+"/"+e.id+"/"+e.current_iteration),i},Ms=e=>((e,t)=>{var i=""+e+t.id;return t.current_iteration&&t.current_iteration>0&&(i=""+e+t.id+"_"+t.current_iteration),i})($s,e),Ls=[As.Popover,As.Widget,As.API],Ns={ignoreConditions:!1,ignoreDelay:!1,displayType:Os.Popover};class Fs{constructor(){this.Mi={},this.Mi={}}on(e,t){return this.Mi[e]||(this.Mi[e]=[]),this.Mi[e].push(t),()=>{this.Mi[e]=this.Mi[e].filter(e=>e!==t)}}emit(e,t){for(var i of this.Mi[e]||[])i(t);for(var r of this.Mi["*"]||[])r(e,t)}}function Bs(e,t,i){if(B(e))return!1;switch(i){case"exact":return e===t;case"contains":var r=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(e);case"regex":try{return new RegExp(t).test(e)}catch(e){return!1}default:return!1}}class Us{constructor(e){this.Oi=new Fs,this.Ai=(e,t)=>this.Di(e,t)&&this.ji(e,t)&&this.Li(e,t)&&this.Ni(e,t),this.Di=(e,t)=>null==t||!t.event||(null==e?void 0:e.event)===(null==t?void 0:t.event),this._instance=e,this.Ui=new Set,this.zi=new Set}init(){var e,t;M(null==(e=this._instance)?void 0:e.Hi)||null==(t=this._instance)||t.Hi((e,t)=>{this.on(e,t)})}register(e){var t,i;if(!M(null==(t=this._instance)?void 0:t.Hi)&&(e.forEach(e=>{var t,i;null==(t=this.zi)||t.add(e),null==(i=e.steps)||i.forEach(e=>{var t;null==(t=this.Ui)||t.add((null==e?void 0:e.event)||"")})}),null!=(i=this._instance)&&i.autocapture)){var r,n=new Set;e.forEach(e=>{var t;null==(t=e.steps)||t.forEach(e=>{null!=e&&e.selector&&n.add(null==e?void 0:e.selector)})}),null==(r=this._instance)||r.autocapture.setElementSelectors(n)}}on(e,t){var i;null!=t&&0!=e.length&&(this.Ui.has(e)||this.Ui.has(null==t?void 0:t.event))&&this.zi&&(null==(i=this.zi)?void 0:i.size)>0&&this.zi.forEach(e=>{this.Bi(t,e)&&this.Oi.emit("actionCaptured",e.name)})}qi(e){this.onAction("actionCaptured",t=>e(t))}Bi(e,t){if(null==(null==t?void 0:t.steps))return!1;for(var i of t.steps)if(this.Ai(e,i))return!0;return!1}onAction(e,t){return this.Oi.on(e,t)}ji(e,t){if(null!=t&&t.url){var i,r=null==e||null==(i=e.properties)?void 0:i.$current_url;if(!r||"string"!=typeof r)return!1;if(!Bs(r,t.url,t.url_matching||"contains"))return!1}return!0}Li(e,t){return!!this.Wi(e,t)&&!!this.Gi(e,t)&&!!this.Vi(e,t)}Wi(e,t){var i;if(null==t||!t.href)return!0;var r=this.Ji(e);if(r.length>0)return r.some(e=>Bs(e.href,t.href,t.href_matching||"exact"));var n,s=(null==e||null==(i=e.properties)?void 0:i.$elements_chain)||"";return!!s&&Bs((n=s.match(/(?::|")href="(.*?)"/))?n[1]:"",t.href,t.href_matching||"exact")}Gi(e,t){var i;if(null==t||!t.text)return!0;var r=this.Ji(e);if(r.length>0)return r.some(e=>Bs(e.text,t.text,t.text_matching||"exact")||Bs(e.$el_text,t.text,t.text_matching||"exact"));var n,s,o,a=(null==e||null==(i=e.properties)?void 0:i.$elements_chain)||"";return!!a&&(n=function(e){for(var t,i=[],r=/(?::|")text="(.*?)"/g;!B(t=r.exec(e));)i.includes(t[1])||i.push(t[1]);return i}(a),s=t.text,o=t.text_matching||"exact",n.some(e=>Bs(e,s,o)))}Vi(e,t){var i,r;if(null==t||!t.selector)return!0;var n=null==e||null==(i=e.properties)?void 0:i.$element_selectors;if(null!=n&&n.includes(t.selector))return!0;var s=(null==e||null==(r=e.properties)?void 0:r.$elements_chain)||"";if(t.selector_regex&&s)try{return new RegExp(t.selector_regex).test(s)}catch(e){return!1}return!1}Ji(e){var t;return null==(null==e||null==(t=e.properties)?void 0:t.$elements)?[]:null==e?void 0:e.properties.$elements}Ni(e,t){return null==t||!t.properties||0===t.properties.length||is(t.properties.reduce((e,t)=>{var i=O(t.value)?t.value.map(String):null!=t.value?[String(t.value)]:[];return e[t.key]={values:i,operator:t.operator||"exact"},e},{}),null==e?void 0:e.properties)}}class js{constructor(e){this._instance=e,this.Ki=new Map,this.Yi=new Map,this.Xi=new Map}Qi(e,t){return!!e&&is(e.propertyFilters,null==t?void 0:t.properties)}Zi(e,t){var i=new Map;return e.forEach(e=>{var r;null==(r=e.conditions)||null==(r=r[t])||null==(r=r.values)||r.forEach(t=>{if(null!=t&&t.name){var r=i.get(t.name)||[];r.push(e.id),i.set(t.name,r)}})}),i}te(e,t,i){var r=(i===ws.Activation?this.Ki:this.Yi).get(e),n=[];return this.ie(e=>{n=e.filter(e=>null==r?void 0:r.includes(e.id))}),n.filter(r=>{var n,s=null==(n=r.conditions)||null==(n=n[i])||null==(n=n.values)?void 0:n.find(t=>t.name===e);return this.Qi(s,t)})}register(e){var t;M(null==(t=this._instance)?void 0:t.Hi)||(this.ee(e),this.re(e))}re(e){var t=e.filter(e=>{var t,i;return(null==(t=e.conditions)?void 0:t.actions)&&(null==(i=e.conditions)||null==(i=i.actions)||null==(i=i.values)?void 0:i.length)>0});0!==t.length&&(null==this.se&&(this.se=new Us(this._instance),this.se.init(),this.se.qi(e=>{this.onAction(e)})),t.forEach(e=>{var t,i,r,n,s;e.conditions&&null!=(t=e.conditions)&&t.actions&&null!=(i=e.conditions)&&null!=(i=i.actions)&&i.values&&(null==(r=e.conditions)||null==(r=r.actions)||null==(r=r.values)?void 0:r.length)>0&&(null==(n=this.se)||n.register(e.conditions.actions.values),null==(s=e.conditions)||null==(s=s.actions)||null==(s=s.values)||s.forEach(t=>{if(t&&t.name){var i=this.Xi.get(t.name);i&&i.push(e.id),this.Xi.set(t.name,i||[e.id])}}))}))}ee(e){var t,i=e.filter(e=>{var t,i;return(null==(t=e.conditions)?void 0:t.events)&&(null==(i=e.conditions)||null==(i=i.events)||null==(i=i.values)?void 0:i.length)>0}),r=e.filter(e=>{var t,i;return(null==(t=e.conditions)?void 0:t.cancelEvents)&&(null==(i=e.conditions)||null==(i=i.cancelEvents)||null==(i=i.values)?void 0:i.length)>0});0===i.length&&0===r.length||(null==(t=this._instance)||t.Hi((e,t)=>{this.onEvent(e,t)}),this.Ki=this.Zi(e,ws.Activation),this.Yi=this.Zi(e,ws.Cancellation))}onEvent(e,t){var i,r=this.ne(),n=this.oe(),s=this.ae(),o=(null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[n])||[];if(s===e&&t&&o.length>0){var a,l;r.info("event matched, removing item from activated items",{event:e,eventPayload:t,existingActivatedItems:o});var u=(null==t||null==(a=t.properties)?void 0:a.$survey_id)||(null==t||null==(l=t.properties)?void 0:l.$product_tour_id);if(u){var c=o.indexOf(u);c>=0&&(o.splice(c,1),this.le(o))}}else{if(this.Yi.has(e)){var d=this.te(e,t,ws.Cancellation);d.length>0&&(r.info("cancel event matched, cancelling items",{event:e,itemsToCancel:d.map(e=>e.id)}),d.forEach(e=>{var t=o.indexOf(e.id);t>=0&&o.splice(t,1),this.ue(e.id)}),this.le(o))}if(this.Ki.has(e)){r.info("event name matched",{event:e,eventPayload:t,items:this.Ki.get(e)});var h=this.te(e,t,ws.Activation);this.le(o.concat(h.map(e=>e.id)||[]))}}}onAction(e){var t,i=this.oe(),r=(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[i])||[];this.Xi.has(e)&&this.le(r.concat(this.Xi.get(e)||[]))}le(e){var t,i=this.ne(),r=this.oe(),n=[...new Set(e)].filter(e=>!this.he(e));i.info("updating activated items",{activatedItems:n}),null==(t=this._instance)||null==(t=t.persistence)||t.register({[r]:n})}getActivatedIds(){var e,t=this.oe();return(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[t])||[]}getEventToItemsMap(){return this.Ki}de(){return this.se}}class Vs extends js{constructor(e){super(e)}oe(){return"$surveys_activated"}ae(){return Cs.SHOWN}ie(e){var t;null==(t=this._instance)||t.getSurveys(e)}ue(e){var t;null==(t=this._instance)||t.cancelPendingSurvey(e)}ne(){return Rs}he(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}class Hs{constructor(e){this.ve=void 0,this._surveyManager=null,this.ce=!1,this.fe=[],this.pe=null,this._instance=e,this._surveyEventReceiver=null}onRemoteConfig(e){if(!this._instance.config.disable_surveys){var t=e.surveys;if(B(t))return Rs.warn("Flags not loaded yet. Not loading surveys.");var i=O(t);this.ve=i?t.length>0:t,Rs.info("flags response received, isSurveysEnabled: "+this.ve),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;t<localStorage.length;t++){var i=localStorage.key(t);(null!=i&&i.startsWith($s)||null!=i&&i.startsWith("inProgressSurvey_"))&&e.push(i)}e.forEach(e=>localStorage.removeItem(e))}loadIfEnabled(){if(!this._surveyManager)if(this.ce)Rs.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)Rs.info("Disabled. Not loading surveys.");else if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())Rs.info("Not loading surveys in cookieless mode without consent.");else{var e=null==f?void 0:f.__PosthogExtensions__;if(e){if(!M(this.ve)||this._instance.config.advanced_enable_surveys){var t=this.ve||this._instance.config.advanced_enable_surveys;this.ce=!0;try{var i=e.generateSurveys;if(i)return void this.ge(i,t);var r=e.loadExternalDependency;if(!r)return void this._e("PostHog loadExternalDependency extension not found.");r(this._instance,"surveys",i=>{i||!e.generateSurveys?this._e("Could not load surveys script",i):this.ge(e.generateSurveys,t)})}catch(e){throw this._e("Error initializing surveys",e),e}finally{this.ce=!1}}}else Rs.error("PostHog Extensions not found.")}}ge(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new Vs(this._instance),Rs.info("Surveys loaded successfully"),this.me({isLoaded:!0})}_e(e,t){Rs.error(e,t),this.me({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.fe.push(e),this._surveyManager&&this.me({isLoaded:!0}),()=>{this.fe=this.fe.filter(t=>t!==e)}}getSurveys(e,t){if(void 0===t&&(t=!1),this._instance.config.disable_surveys)return Rs.info("Disabled. Not loading surveys."),e([]);var i,r=this._instance.get_property(ni);if(r&&!t)return e(r,{isLoaded:!0});"undefined"!=typeof Promise&&this.pe?this.pe.then(t=>{var{surveys:i,context:r}=t;return e(i,r)}):("undefined"!=typeof Promise&&(this.pe=new Promise(e=>{i=e})),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this._instance.config.token),method:"GET",timeout:this._instance.config.surveys_request_timeout_ms,callback:t=>{var r;this.pe=null;var n=t.statusCode;if(200!==n||!t.json){var s="Surveys API could not be loaded, status: "+n;Rs.error(s);var o={isLoaded:!1,error:s};return e([],o),void(null==i||i({surveys:[],context:o}))}var a,l=t.json.surveys||[],u=l.filter(e=>function(e){return!(!e.start_date||e.end_date)}(e)&&(function(e){var t;return!(null==(t=e.conditions)||null==(t=t.events)||null==(t=t.values)||!t.length)}(e)||function(e){var t;return!(null==(t=e.conditions)||null==(t=t.actions)||null==(t=t.values)||!t.length)}(e)));u.length>0&&(null==(a=this._surveyEventReceiver)||a.register(u)),null==(r=this._instance.persistence)||r.register({[ni]:l});var c={isLoaded:!0};e(l,c),null==i||i({surveys:l,context:c})}}))}me(e){for(var t of this.fe)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(e){Rs.error("Error in survey callback",e)}}getActiveMatchingSurveys(e,t){if(void 0===t&&(t=!1),!B(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);Rs.warn("init was not called")}ye(e){var t=null;return this.getSurveys(i=>{var r;t=null!==(r=i.find(t=>t.id===e))&&void 0!==r?r:null}),t}be(e){if(B(this._surveyManager))return{eligible:!1,reason:"SDK is not enabled or survey functionality is not yet loaded"};var t="string"==typeof e?this.ye(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(B(this._surveyManager))return Rs.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var t=this.be(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return B(this._surveyManager)?(Rs.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"})):new Promise(i=>{this.getSurveys(t=>{var r,n=null!==(r=t.find(t=>t.id===e))&&void 0!==r?r:null;if(n){var s=this.be(n);i({visible:s.eligible,disabledReason:s.reason})}else i({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t){var i;if(B(this._surveyManager))Rs.warn("init was not called");else{var r="string"==typeof e?this.ye(e):e;if(null!=r&&r.id)if(Ls.includes(r.type)){var n=null==u?void 0:u.querySelector(t);if(n)return null!=(i=r.appearance)&&i.surveyPopupDelaySeconds?(Rs.info("Rendering survey "+r.id+" with delay of "+r.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout(()=>{var e,t;Rs.info("Rendering survey "+r.id+" with delay of "+(null==(e=r.appearance)?void 0:e.surveyPopupDelaySeconds)+" seconds"),null==(t=this._surveyManager)||t.renderSurvey(r,n),Rs.info("Survey "+r.id+" rendered")},1e3*r.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(r,n);Rs.warn("Survey element not found")}else Rs.warn("Surveys of type "+r.type+" cannot be rendered in the app");else Rs.warn("Survey not found")}}displaySurvey(e,t){var i;if(B(this._surveyManager))Rs.warn("init was not called");else{var r=this.ye(e);if(r){var n=r;if(null!=(i=r.appearance)&&i.surveyPopupDelaySeconds&&t.ignoreDelay&&(n=y({},r,{appearance:y({},r.appearance,{surveyPopupDelaySeconds:0})})),!1===t.ignoreConditions){var s=this.canRenderSurvey(r);if(!s.visible)return void Rs.warn("Survey is not eligible to be displayed: ",s.disabledReason)}t.displayType!==Os.Inline?this._surveyManager.handlePopoverSurvey(n):this.renderSurvey(n,t.selector)}else Rs.warn("Survey not found")}}cancelPendingSurvey(e){B(this._surveyManager)?Rs.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;null==(e=this._surveyManager)||e.handlePageUnload()}}var Gs=kt("[Conversations]");class qs{constructor(e){this.we=void 0,this._conversationsManager=null,this.xe=!1,this.Ee=null,this._instance=e}onRemoteConfig(e){if(!this._instance.config.disable_conversations){var t=e.conversations;B(t)||(j(t)?this.we=t:(this.we=t.enabled,this.Ee=t),this.loadIfEnabled())}}reset(){var e;null==(e=this._conversationsManager)||e.reset(),this._conversationsManager=null,this.we=void 0,this.Ee=null}loadIfEnabled(){if(!this._conversationsManager&&!this.xe&&!(this._instance.config.disable_conversations||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=null==f?void 0:f.__PosthogExtensions__;if(e&&!M(this.we)&&this.we)if(this.Ee&&this.Ee.token){if(function(e){var t;if(!e||0===e.length)return!0;var i=null==r||null==(t=r.location)?void 0:t.hostname;return!i||e.some(e=>{var t=function(e){var t=e.replace(/^https?:\/\//,"");return(t=t.split("/")[0].split("?")[0].split(":")[0])||null}(e);if(!t)return!1;if(t.startsWith("*.")){var r=t.slice(2);return i.endsWith("."+r)||i===r}return i===t})}(this.Ee.domains)){this.xe=!0;try{var t=e.initConversations;if(t)return this.$e(t),void(this.xe=!1);var i=e.loadExternalDependency;if(!i)return void this.Se("PostHog loadExternalDependency extension not found.");i(this._instance,"conversations",t=>{t||!e.initConversations?this.Se("Could not load conversations script",t):this.$e(e.initConversations),this.xe=!1})}catch(e){this.Se("Error initializing conversations",e),this.xe=!1}}}else Gs.error("Conversations enabled but missing token in remote config.")}}$e(e){if(this.Ee)try{this._conversationsManager=e(this.Ee,this._instance),Gs.info("Conversations loaded successfully")}catch(e){this.Se("Error completing conversations initialization",e)}else Gs.error("Cannot complete initialization: remote config is null")}Se(e,t){Gs.error(e,t),this._conversationsManager=null,this.xe=!1}enable(){this._conversationsManager?this._conversationsManager.enable():Gs.warn("Conversations not loaded yet.")}disable(){this._conversationsManager&&this._conversationsManager.disable()}isLoaded(){return!F(this._conversationsManager)}isEnabled(){return!0===this.we}}var zs=kt("[RateLimiter]");class Ks{constructor(e){var t,i;this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{var t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach(e=>{zs.info((e||"events")+" is quota limited."),this.serverLimits[e]=(new Date).getTime()+6e4})}catch(e){return void zs.warn('could not rate limit - continuing. Error: "'+(null==e?void 0:e.message)+'"',{text:t})}},this.instance=e,this.captureEventsPerSecond=(null==(t=e.config.rate_limiting)?void 0:t.events_per_second)||10,this.captureEventsBurstLimit=Math.max((null==(i=e.config.rate_limiting)?void 0:i.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}clientRateLimitContext(e){var t,i,r;void 0===e&&(e=!1);var n=(new Date).getTime(),s=null!==(t=null==(i=this.instance.persistence)?void 0:i.get_property(li))&&void 0!==t?t:{tokens:this.captureEventsBurstLimit,last:n};s.tokens+=(n-s.last)/1e3*this.captureEventsPerSecond,s.last=n,s.tokens>this.captureEventsBurstLimit&&(s.tokens=this.captureEventsBurstLimit);var o=s.tokens<1;return o||e||(s.tokens=Math.max(0,s.tokens-1)),!o||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+this.captureEventsPerSecond+" events per second and "+this.captureEventsBurstLimit+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=o,null==(r=this.instance.persistence)||r.set_property(li,s),{isRateLimited:o,remainingTokens:s.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}}var Ws=kt("[RemoteConfig]");class Js{constructor(e){this._instance=e}get remoteConfig(){var e;return null==(e=f._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.config}ke(e){var t,i;null!=(t=f.__PosthogExtensions__)&&t.loadExternalDependency?null==(i=f.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",()=>e(this.remoteConfig)):(Ws.error("PostHog Extensions not found. Cannot load remote config."),e())}Pe(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:t=>{e(t.json)}})}load(){try{if(this.remoteConfig)return Ws.info("Using preloaded remote config",this.remoteConfig),void this.yi(this.remoteConfig);if(this._instance.O())return void Ws.warn("Remote config is disabled. Falling back to local config.");this.ke(e=>{if(!e)return Ws.info("No config found after loading remote JS config. Falling back to JSON."),void this.Pe(e=>{this.yi(e)});this.yi(e)})}catch(e){Ws.error("Error loading remote config",e)}}yi(e){e?this._instance.config.__preview_remote_config?(this._instance.yi(e),!1!==e.hasFeatureFlags&&this._instance.featureFlags.ensureFlagsLoaded()):Ws.info("__preview_remote_config is disabled. Logging config instead",e):Ws.error("Failed to fetch remote config from PostHog.")}}var Ys=3e3;class Qs{constructor(e,t){this.Te=!0,this.Ie=[],this.Ce=J((null==t?void 0:t.flush_interval_ms)||Ys,250,5e3,wt.createLogger("flush interval"),Ys),this.Re=e}enqueue(e){this.Ie.push(e),this.Fe||this.Me()}unload(){this.Oe();var e=this.Ie.length>0?this.Ae():{},t=Object.values(e);[...t.filter(e=>0===e.url.indexOf("/e")),...t.filter(e=>0!==e.url.indexOf("/e"))].map(e=>{this.Re(y({},e,{transport:"sendBeacon"}))})}enable(){this.Te=!1,this.Me()}Me(){var e=this;this.Te||(this.Fe=setTimeout(()=>{if(this.Oe(),this.Ie.length>0){var t=this.Ae(),i=function(){var i=t[r],n=(new Date).getTime();i.data&&O(i.data)&&It(i.data,e=>{e.offset=Math.abs(e.timestamp-n),delete e.timestamp}),e.Re(i)};for(var r in t)i()}},this.Ce))}Oe(){clearTimeout(this.Fe),this.Fe=void 0}Ae(){var e={};return It(this.Ie,t=>{var i,r=t,n=(r?r.batchKey:null)||r.url;M(e[n])&&(e[n]=y({},r,{data:[]})),null==(i=e[n].data)||i.push(r.data)}),this.Ie=[],e}}var Zs=["retriesPerformedSoFar"];class Xs{constructor(e){this.De=!1,this.je=3e3,this.Ie=[],this._instance=e,this.Ie=[],this.Le=!0,!M(r)&&"onLine"in r.navigator&&(this.Le=r.navigator.onLine,this.Ne=()=>{this.Le=!0,this.Lt()},this.Ue=()=>{this.Le=!1},Nt(r,"online",this.Ne),Nt(r,"offline",this.Ue))}get length(){return this.Ie.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,i=b(e,Zs);U(t)&&t>0&&(i.url=Wn(i.url,{retry_count:t})),this._instance._send_request(y({},i,{callback:e=>{200!==e.statusCode&&(e.statusCode<400||e.statusCode>=500)&&(null!=t?t:0)<10?this.ze(y({retriesPerformedSoFar:t},i)):null==i.callback||i.callback(e)}}))}ze(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var i=function(e){var t=3e3*Math.pow(2,e),i=t/2,r=Math.min(18e5,t),n=(Math.random()-.5)*(r-i);return Math.ceil(r+n)}(t),r=Date.now()+i;this.Ie.push({retryAt:r,requestOptions:e});var n="Enqueued failed request for retry in "+i;navigator.onLine||(n+=" (Browser is offline)"),wt.warn(n),this.De||(this.De=!0,this.He())}He(){if(this.Be&&clearTimeout(this.Be),0===this.Ie.length)return this.De=!1,void(this.Be=void 0);this.Be=setTimeout(()=>{this.Le&&this.Ie.length>0&&this.Lt(),this.He()},this.je)}Lt(){var e=Date.now(),t=[],i=this.Ie.filter(i=>i.retryAt<e||(t.push(i),!1));if(this.Ie=t,i.length>0)for(var{requestOptions:r}of i)this.retriableRequest(r)}unload(){for(var{requestOptions:e}of(this.Be&&(clearTimeout(this.Be),this.Be=void 0),this.De=!1,M(r)||(this.Ne&&(r.removeEventListener("online",this.Ne),this.Ne=void 0),this.Ue&&(r.removeEventListener("offline",this.Ue),this.Ue=void 0)),this.Ie))try{this._instance._send_request(y({},e,{transport:"sendBeacon"}))}catch(e){wt.error(e)}this.Ie=[]}}class eo{constructor(e){this.qe=()=>{var e,t,i,r;this.We||(this.We={});var n=this.scrollElement(),s=this.scrollY(),o=n?Math.max(0,n.scrollHeight-n.clientHeight):0,a=s+((null==n?void 0:n.clientHeight)||0),l=(null==n?void 0:n.scrollHeight)||0;this.We.lastScrollY=Math.ceil(s),this.We.maxScrollY=Math.max(s,null!==(e=this.We.maxScrollY)&&void 0!==e?e:0),this.We.maxScrollHeight=Math.max(o,null!==(t=this.We.maxScrollHeight)&&void 0!==t?t:0),this.We.lastContentY=a,this.We.maxContentY=Math.max(a,null!==(i=this.We.maxContentY)&&void 0!==i?i:0),this.We.maxContentHeight=Math.max(l,null!==(r=this.We.maxContentHeight)&&void 0!==r?r:0)},this._instance=e}getContext(){return this.We}resetContext(){var e=this.We;return setTimeout(this.qe,0),e}startMeasuringScrollPosition(){Nt(r,"scroll",this.qe,{capture:!0}),Nt(r,"scrollend",this.qe,{capture:!0}),Nt(r,"resize",this.qe)}scrollElement(){if(!this._instance.config.scroll_root_selector)return null==r?void 0:r.document.documentElement;var e=O(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector];for(var t of e){var i=null==r?void 0:r.document.querySelector(t);if(i)return i}}scrollY(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollTop||0}return r&&(r.scrollY||r.pageYOffset||r.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollLeft||0}return r&&(r.scrollX||r.pageXOffset||r.document.documentElement.scrollLeft)||0}}var to=e=>tn(null==e?void 0:e.config.mask_personal_data_properties,null==e?void 0:e.config.custom_personal_data_properties);class io{constructor(e,t,i,r){this.Ge=e=>{var t=this.Ve();if(!t||t.sessionId!==e){var i={sessionId:e,props:this.Je(this._instance)};this.Ke.register({[ai]:i})}},this._instance=e,this.Ye=t,this.Ke=i,this.Je=r||to,this.Ye.onSessionId(this.Ge)}Ve(){return this.Ke.props[ai]}getSetOnceProps(){var e,t=null==(e=this.Ve())?void 0:e.props;return t?"r"in t?rn(t):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){var e={};return It($t(this.getSetOnceProps()),(t,i)=>{"$current_url"===i&&(i="url"),e["$session_entry_"+x(i)]=t}),e}}var ro=kt("[SessionId]");class no{on(e,t){return this.Xe.on(e,t)}constructor(e,t,i){var r;if(this.Qe=[],this.Ze=void 0,this.Xe=new Fs,this.tr=(e,t)=>Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if("always"===e.config.cookieless_mode)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.R=e.config,this.Ke=e.persistence,this.ir=void 0,this.er=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.rr=t||hr,this.sr=i||hr;var n=this.R.persistence_name||this.R.token,s=this.R.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*J(s,60,36e3,ro.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.nr(),this.ar="ph_"+n+"_window_id",this.lr="ph_"+n+"_primary_window_exists",this.ur()){var o=Er.W(this.ar),a=Er.W(this.lr);o&&!a?this.ir=o:Er.V(this.ar),Er.G(this.lr,!0)}if(null!=(r=this.R.bootstrap)&&r.sessionID)try{var l=(()=>{var e=this.R.bootstrap.sessionID.replace(/-/g,"");if(32!==e.length)throw new Error("Not a valid UUID");if("7"!==e[12])throw new Error("Not a UUIDv7");return parseInt(e.substring(0,12),16)})();this.hr(this.R.bootstrap.sessionID,(new Date).getTime(),l)}catch(e){ro.error("Invalid sessionID in bootstrap",e)}this.dr()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return M(this.Qe)&&(this.Qe=[]),this.Qe.push(e),this.er&&e(this.er,this.ir),()=>{this.Qe=this.Qe.filter(t=>t!==e)}}ur(){return"memory"!==this.R.persistence&&!this.Ke.Si&&Er.H()}vr(e){e!==this.ir&&(this.ir=e,this.ur()&&Er.G(this.ar,e))}cr(){return this.ir?this.ir:this.ur()?Er.W(this.ar):null}hr(e,t,i){e===this.er&&t===this._sessionActivityTimestamp&&i===this._sessionStartTimestamp||(this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this.er=e,this.Ke.register({[Qt]:[t,e,i]}))}pr(){var e=this.Ke.props[Qt];return O(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.hr(null,null,null)}destroy(){clearTimeout(this.gr),this.gr=void 0,this.Ze&&r&&(r.removeEventListener("beforeunload",this.Ze,{capture:!1}),this.Ze=void 0),this.Qe=[]}dr(){this.Ze=()=>{this.ur()&&Er.V(this.lr)},Nt(r,"beforeunload",this.Ze,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=null),"always"===this.R.cookieless_mode)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=t||(new Date).getTime(),[r,n,s]=this.pr(),o=this.cr(),a=U(s)&&s>0&&Math.abs(i-s)>864e5,l=!1,u=!n,c=!u&&!e&&this.tr(i,r);u||c||a?(n=this.rr(),o=this.sr(),ro.info("new session ID generated",{sessionId:n,windowId:o,changeReason:{noSessionId:u,activityTimeout:c,sessionPastMaximumLength:a}}),s=i,l=!0):o||(o=this.sr(),l=!0);var d=0===r||!e||a?i:r,h=0===s?(new Date).getTime():s;return this.vr(o),this.hr(n,d,h),e||this.nr(),l&&this.Qe.forEach(e=>e(n,o,l?{noSessionId:u,activityTimeout:c,sessionPastMaximumLength:a}:void 0)),{sessionId:n,windowId:o,sessionStartTimestamp:h,changeReason:l?{noSessionId:u,activityTimeout:c,sessionPastMaximumLength:a}:void 0,lastActivityTimestamp:r}}nr(){clearTimeout(this.gr),this.gr=setTimeout(()=>{var[e]=this.pr();if(this.tr((new Date).getTime(),e)){var t=this.er;this.resetSessionId(),this.Xe.emit("forcedIdleReset",{idleSessionId:t})}},1.1*this.sessionTimeoutMs)}}var so=["$set_once","$set"],oo=kt("[SiteApps]");class ao{constructor(e){this._instance=e,this._r=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}mr(e,t){if(t){var i=this.globalsForEvent(t);this._r.push(i),this._r.length>1e3&&(this._r=this._r.slice(10))}}get siteAppLoaders(){var e;return null==(e=f._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.siteApps}init(){if(this.isEnabled){var e=this._instance.Hi(this.mr.bind(this));this.yr=()=>{e(),this._r=[],this.yr=void 0}}}globalsForEvent(e){var t,i,r,n,s,o,a;if(!e)throw new Error("Event payload is required");var l={},u=this._instance.get_property("$groups")||[],c=this._instance.get_property("$stored_group_properties")||{};for(var[d,h]of Object.entries(c))l[d]={id:u[d],type:d,properties:h};var{$set_once:g,$set:p}=e;return{event:y({},b(e,so),{properties:y({},e.properties,p?{$set:y({},null!==(t=null==(i=e.properties)?void 0:i.$set)&&void 0!==t?t:{},p)}:{},g?{$set_once:y({},null!==(r=null==(n=e.properties)?void 0:n.$set_once)&&void 0!==r?r:{},g)}:{}),elements_chain:null!==(s=null==(o=e.properties)?void 0:o.$elements_chain)&&void 0!==s?s:"",distinct_id:null==(a=e.properties)?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}setupSiteApp(e){var t=this.apps[e.id],i=()=>{var i;!t.errored&&this._r.length&&(oo.info("Processing "+this._r.length+" events for site app with id "+e.id),this._r.forEach(e=>null==t.processEvent?void 0:t.processEvent(e)),t.processedBuffer=!0),Object.values(this.apps).every(e=>e.processedBuffer||e.errored)&&(null==(i=this.yr)||i.call(this))},r=!1,n=n=>{t.errored=!n,t.loaded=!0,oo.info("Site app with id "+e.id+" "+(n?"loaded":"errored")),r&&i()};try{var{processEvent:s}=e.init({posthog:this._instance,callback:e=>{n(e)}});s&&(t.processEvent=s),r=!0}catch(t){oo.error("Error while initializing PostHog app with config id "+e.id,t),n(!1)}if(r&&t.loaded)try{i()}catch(i){oo.error("Error while processing buffered events PostHog app with config id "+e.id,i),t.errored=!0}}br(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var i of e)this.setupSiteApp(i)}wr(e){if(0!==Object.keys(this.apps).length){var t=this.globalsForEvent(e);for(var i of Object.values(this.apps))try{null==i.processEvent||i.processEvent(t)}catch(t){oo.error("Error while processing event "+e.event+" for site app "+i.id,t)}}}onRemoteConfig(e){var t,i,r,n=this;if(null!=(t=this.siteAppLoaders)&&t.length)return this.isEnabled?(this.br(),void this._instance.on("eventCaptured",e=>this.wr(e))):void oo.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(i=this.yr)||i.call(this),null!=(r=e.siteApps)&&r.length)if(this.isEnabled){var s=function(e){var t;f["__$$ph_site_app_"+e]=n._instance,null==(t=f.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(n._instance,a,t=>{if(t)return oo.error("Error while initializing PostHog app with config id "+e,t)})};for(var{id:o,url:a}of e.siteApps)s(o)}else oo.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}var lo=function(e,t){if(!e)return!1;var i=e.userAgent;if(i&&k(i,t))return!0;try{var r=null==e?void 0:e.userAgentData;if(null!=r&&r.brands&&r.brands.some(e=>k(null==e?void 0:e.brand,t)))return!0}catch(e){}return!!e.webdriver},uo=function(e){return e.US="us",e.EU="eu",e.CUSTOM="custom",e}({}),co="i.posthog.com";class ho{constructor(e){this.Er={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===e?"https://us.i.posthog.com":e}get flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,t=null==(e=this.instance.config.ui_host)?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+co,".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}get region(){return this.Er[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.Er[this.apiHost]=uo.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.Er[this.apiHost]=uo.EU:this.Er[this.apiHost]=uo.CUSTOM),this.Er[this.apiHost]}endpointFor(e,t){if(void 0===t&&(t=""),t&&(t="/"===t[0]?t:"/"+t),"ui"===e)return this.uiHost+t;if("flags"===e)return this.flagsApiHost+t;if(this.region===uo.CUSTOM)return this.apiHost+t;var i=co+t;switch(e){case"assets":return"https://"+this.region+"-assets."+i;case"api":return"https://"+this.region+"."+i}}}var go={icontains:(e,t)=>!!r&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>!!r&&-1===t.href.toLowerCase().indexOf(e.toLowerCase()),regex:(e,t)=>!!r&&Zn(t.href,e),not_regex:(e,t)=>!!r&&!Zn(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e};class po{constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(e){void 0===e&&(e=!1),t.getWebExperiments(e=>{po.$r("retrieved web experiments from the server"),t.Sr=new Map,e.forEach(e=>{if(e.feature_flag_key){var i;t.Sr&&(po.$r("setting flag key ",e.feature_flag_key," to web experiment ",e),null==(i=t.Sr)||i.set(e.feature_flag_key,e));var r=t._instance.getFeatureFlag(e.feature_flag_key);L(r)&&e.variants[r]&&t.kr(e.name,r,e.variants[r].transforms)}else if(e.variants)for(var n in e.variants){var s=e.variants[n];po.Pr(s)&&t.kr(e.name,n,s.transforms)}})},e)},this._instance=e,this._instance.onFeatureFlags(e=>{this.onFeatureFlags(e)})}onFeatureFlags(e){if(this._is_bot())po.$r("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(B(this.Sr))return this.Sr=new Map,this.loadIfEnabled(),void this.previewWebExperiment();po.$r("applying feature flags",e),e.forEach(e=>{var t;if(this.Sr&&null!=(t=this.Sr)&&t.has(e)){var i,r=this._instance.getFeatureFlag(e),n=null==(i=this.Sr)?void 0:i.get(e);r&&null!=n&&n.variants[r]&&this.kr(n.name,r,n.variants[r].transforms)}})}}previewWebExperiment(){var e=po.getWindowLocation();if(null!=e&&e.search){var t=Xi(null==e?void 0:e.search,"__experiment_id"),i=Xi(null==e?void 0:e.search,"__experiment_variant");t&&i&&(po.$r("previewing web experiments "+t+" && "+i),this.getWebExperiments(e=>{this.Tr(parseInt(t),i,e)},!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,i){if(this._instance.config.disable_web_experiments&&!i)return e([]);var r=this._instance.get_property("$web_experiments");if(r&&!t)return e(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._instance.config.token),method:"GET",callback:t=>{if(200!==t.statusCode||!t.json)return e([]);var i=t.json.experiments||[];return e(i)}})}Tr(e,t,i){var r=i.filter(t=>t.id===e);r&&r.length>0&&(po.$r("Previewing web experiment ["+r[0].name+"] with variant ["+t+"]"),this.kr(r[0].name,t,r[0].variants[t].transforms))}static Pr(e){return!B(e.conditions)&&po.Ir(e)&&po.Cr(e)}static Ir(e){var t;if(B(e.conditions)||B(null==(t=e.conditions)?void 0:t.url))return!0;var i,r,n,s=po.getWindowLocation();return!!s&&(null==(i=e.conditions)||!i.url||go[null!==(r=null==(n=e.conditions)?void 0:n.urlMatchType)&&void 0!==r?r:"icontains"](e.conditions.url,s))}static getWindowLocation(){return null==r?void 0:r.location}static Cr(e){var t;if(B(e.conditions)||B(null==(t=e.conditions)?void 0:t.utm))return!0;var i=Yr();if(i.utm_source){var r,n,s,o,a,l,u,c,d=null==(r=e.conditions)||null==(r=r.utm)||!r.utm_campaign||(null==(n=e.conditions)||null==(n=n.utm)?void 0:n.utm_campaign)==i.utm_campaign,h=null==(s=e.conditions)||null==(s=s.utm)||!s.utm_source||(null==(o=e.conditions)||null==(o=o.utm)?void 0:o.utm_source)==i.utm_source,g=null==(a=e.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(l=e.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==i.utm_medium,p=null==(u=e.conditions)||null==(u=u.utm)||!u.utm_term||(null==(c=e.conditions)||null==(c=c.utm)?void 0:c.utm_term)==i.utm_term;return d&&g&&p&&h}return!1}static $r(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];wt.info("[WebExperiments] "+e,i)}kr(e,t,i){this._is_bot()?po.$r("Refusing to render web experiment since the viewer is a likely bot"):"control"!==t?i.forEach(i=>{if(i.selector){var r;po.$r("applying transform of variant "+t+" for experiment "+e+" ",i);var n=null==(r=document)?void 0:r.querySelectorAll(i.selector);null==n||n.forEach(e=>{var t=e;i.html&&(t.innerHTML=i.html),i.css&&t.setAttribute("style",i.css)})}}):po.$r("Control variants leave the page unmodified.")}_is_bot(){return l&&this._instance?lo(l,this._instance.config.custom_blocked_useragents):void 0}}var fo=kt("[PostHog ExternalIntegrations]"),vo={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class _o{constructor(e){this._instance=e}it(e,t){var i;null==(i=f.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,e,e=>{if(e)return fo.error("failed to load script",e);t()})}startIfEnabledOrStop(){var e=this,t=function(t){var i,n,s;!r||null!=(i=f.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[t]||e.it(vo[t],()=>{var i;null==(i=f.__PosthogExtensions__)||null==(i=i.integrations)||null==(i=i[t])||i.start(e._instance)}),!r&&null!=(n=f.__PosthogExtensions__)&&null!=(n=n.integrations)&&n[t]&&(null==(s=f.__PosthogExtensions__)||null==(s=s.integrations)||null==(s=s[t])||s.stop())};for(var[i,r]of Object.entries(null!==(n=this._instance.config.integrations)&&void 0!==n?n:{})){var n;t(i)}}}var mo="[SessionRecording]",yo=kt(mo);class bo{get started(){var e;return!(null==(e=this.Rr)||!e.isStarted)}get status(){return this.Rr?this.Rr.status:this.Fr&&!this.Mr?"disabled":"lazy_loading"}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.Fr=!1,this.Or=void 0,this._instance=e,!this._instance.sessionManager)throw yo.error("started without valid sessionManager"),new Error(mo+" started without valid sessionManager. This is a bug.");if("always"===this._instance.config.cookieless_mode)throw new Error(mo+' cannot be used with cookieless_mode="always"')}get Mr(){var e,t=!(null==(e=this._instance.get_property(Yt))||!e.enabled),i=!this._instance.config.disable_session_recording,n=this._instance.config.disable_session_recording||this._instance.consent.isOptedOut();return r&&t&&i&&!n}startIfEnabledOrStop(e){var t;if(!this.Mr||null==(t=this.Rr)||!t.isStarted){var i=!M(Object.assign)&&!M(Array.from);this.Mr&&i?(this.Ar(e),yo.info("starting")):this.stopRecording()}}Ar(e){var t,i,r;this.Mr&&(null!=f&&null!=(t=f.__PosthogExtensions__)&&null!=(t=t.rrweb)&&t.record&&null!=(i=f.__PosthogExtensions__)&&i.initSessionRecording?this.Dr(e):null==(r=f.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.jr,t=>{if(t)return yo.error("could not load recorder",t);this.Dr(e)}))}stopRecording(){var e,t;null==(e=this.Or)||e.call(this),this.Or=void 0,null==(t=this.Rr)||t.stop()}Lr(){var e;null==(e=this._instance.persistence)||e.unregister(Zt)}Nr(e){if(this._instance.persistence){var t,i,r=this._instance.persistence,n=()=>{var t=!1===e.sessionRecording?void 0:e.sessionRecording,i=null==t?void 0:t.sampleRate,n=B(i)?null:parseFloat(i);B(n)&&this.Lr();var s=null==t?void 0:t.minimumDurationMilliseconds;r.register({[Yt]:y({enabled:!!t},t,{networkPayloadCapture:y({capturePerformance:e.capturePerformance},null==t?void 0:t.networkPayloadCapture),canvasRecording:{enabled:null==t?void 0:t.recordCanvas,fps:null==t?void 0:t.canvasFps,quality:null==t?void 0:t.canvasQuality},sampleRate:n,minimumDurationMilliseconds:M(s)?null:s,endpoint:null==t?void 0:t.endpoint,triggerMatchType:null==t?void 0:t.triggerMatchType,masking:null==t?void 0:t.masking,urlTriggers:null==t?void 0:t.urlTriggers})})};n(),null==(t=this.Or)||t.call(this),this.Or=null==(i=this._instance.sessionManager)?void 0:i.onSessionId(n)}}onRemoteConfig(e){"sessionRecording"in e?!1!==e.sessionRecording?(this.Nr(e),this.Fr=!0,this.startIfEnabledOrStop()):this.Fr=!0:yo.info("skipping remote config with no sessionRecording",e)}log(e,t){var i;void 0===t&&(t="log"),null!=(i=this.Rr)&&i.log?this.Rr.log(e,t):yo.warn("log called before recorder was ready")}get jr(){var e,t,i=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.get_property(Yt);return(null==i||null==(t=i.scriptConfig)?void 0:t.script)||"lazy-recorder"}Dr(e){var t,i;if(null==(t=f.__PosthogExtensions__)||!t.initSessionRecording)throw Error("Called on script loaded before session recording is available");this.Rr||(this.Rr=null==(i=f.__PosthogExtensions__)?void 0:i.initSessionRecording(this._instance),this.Rr._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),this.Rr.start(e)}onRRwebEmit(e){var t;null==(t=this.Rr)||null==t.onRRwebEmit||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.Rr||null==(t=this._instance.persistence)||t.register({$replay_override_linked_flag:!0}),null==(e=this.Rr)||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.Rr||null==(t=this._instance.persistence)||t.register({$replay_override_sampling:!0}),null==(e=this.Rr)||e.overrideSampling()}overrideTrigger(e){var t,i;this.Rr||null==(i=this._instance.persistence)||i.register({["url"===e?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),null==(t=this.Rr)||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return(null==(e=this.Rr)?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var i;return!(null==(i=this.Rr)||!i.tryAddCustomEvent(e,t))}}var wo={},ko=()=>{},Eo="posthog",So=!zn&&-1===(null==p?void 0:p.indexOf("MSIE"))&&-1===(null==p?void 0:p.indexOf("Mozilla")),Ao=e=>{var t;return y({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Mt(null==u?void 0:u.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:ko,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:!1,debug:c&&L(null==c?void 0:c.search)&&-1!==c.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!0,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==r||null==(t=r.location)?void 0:t.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:e=>{var t="Bad HTTP status: "+e.statusCode+" "+e.text;wt.error(t)},get_device_id:e=>e,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",before_send:void 0,request_queue_config:{flush_interval_ms:Ys},error_tracking:{},_onCapture:ko,__preview_eager_load_replay:!1},(e=>({rageclick:!(e&&e>="2025-11-30")||{content_ignorelist:!0},capture_pageview:!(e&&e>="2025-05-24")||"history_change",session_recording:e&&e>="2025-11-30"?{strictMinimumDuration:!0}:{}}))(e))},xo=e=>{var t={};M(e.process_person)||(t.person_profiles=e.process_person),M(e.xhr_headers)||(t.request_headers=e.xhr_headers),M(e.cookie_name)||(t.persistence_name=e.cookie_name),M(e.disable_cookie)||(t.disable_persistence=e.disable_cookie),M(e.store_google)||(t.save_campaign_params=e.store_google),M(e.verbose)||(t.debug=e.verbose);var i=Pt({},t,e);return O(e.property_blacklist)&&(M(e.property_denylist)?i.property_denylist=e.property_blacklist:O(e.property_denylist)?i.property_denylist=[...e.property_blacklist,...e.property_denylist]:wt.error("Invalid value for property_denylist config: "+e.property_denylist)),i};class Io{constructor(){this.__forceAllowLocalhost=!1}get Ur(){return this.__forceAllowLocalhost}set Ur(e){wt.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class Po{get decideEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}get flagsEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}constructor(){this.webPerformance=new Io,this.zr=!1,this.version=v.LIB_VERSION,this.Hr=new Fs,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Ao(),this.SentryIntegration=Nr,this.sentryIntegration=e=>function(e,t){var i=Lr(e,t);return{name:Mr,processEvent:e=>i(e)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Br=!1,this.qr=null,this.Wr=null,this.Gr=null,this.featureFlags=new fs(this),this.toolbar=new Vr(this),this.scrollManager=new eo(this),this.pageViewManager=new gn(this),this.surveys=new Hs(this),this.conversations=new qs(this),this.experiments=new po(this),this.exceptions=new ns(this),this.rateLimiter=new Ks(this),this.requestRouter=new ho(this),this.consent=new Ar(this),this.externalIntegrations=new _o(this),this.people={set:(e,t,i)=>{var r=L(e)?{[e]:t}:e;this.setPersonProperties(r),null==i||i({})},set_once:(e,t,i)=>{var r=L(e)?{[e]:t}:e;this.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",e=>wt.info('send "'+(null==e?void 0:e.event)+'"',e))}init(e,t,i){if(i&&i!==Eo){var r,n=null!==(r=wo[i])&&void 0!==r?r:new Po;return n._init(e,t,i),wo[i]=n,wo[Eo][i]=n,n}return this._init(e,t,i)}_init(e,t,i){var n;if(void 0===t&&(t={}),M(e)||N(e))return wt.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},t.debug=this.Vr(t.debug),this.Jr=t,this.Kr=[],t.person_profiles&&(this.Wr=t.person_profiles),this.set_config(Pt({},Ao(t.defaults),xo(t),{name:i,token:e})),this.config.on_xhr_error&&wt.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:Yi.GZipJS;var s=this.Yr();this.persistence=new _s(this.config,s),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new _s(y({},this.config,{persistence:"sessionStorage"}),s);var o=y({},this.persistence.props),a=y({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Xr=new Qs(e=>this.Qr(e),this.config.request_queue_config),this.Zr=new Xs(this),this.__request_queue=[];var l="always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isExplicitlyOptedOut();if(l||(this.sessionManager=new no(this),this.sessionPropsManager=new io(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(wt.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.ts(l)},0)):(wt.info("Initializing extensions synchronously"),this.ts(l)),v.DEBUG=v.DEBUG||this.config.debug,v.DEBUG&&wt.info("Starting in debug mode",{this:this,config:t,thisC:y({},this.config),p:o,s:a}),void 0!==(null==(n=t.bootstrap)?void 0:n.distinctID)){var u,c,d=this.config.get_device_id(hr()),h=null!=(u=t.bootstrap)&&u.isIdentifiedID?d:t.bootstrap.distinctID;this.persistence.set_property(oi,null!=(c=t.bootstrap)&&c.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:t.bootstrap.distinctID,$device_id:h})}if(this.es()){var g,p,f=Object.keys((null==(g=t.bootstrap)?void 0:g.featureFlags)||{}).filter(e=>{var i;return!(null==(i=t.bootstrap)||null==(i=i.featureFlags)||!i[e])}).reduce((e,i)=>{var r;return e[i]=(null==(r=t.bootstrap)||null==(r=r.featureFlags)?void 0:r[i])||!1,e},{}),_=Object.keys((null==(p=t.bootstrap)?void 0:p.featureFlagPayloads)||{}).filter(e=>f[e]).reduce((e,i)=>{var r,n;return null!=(r=t.bootstrap)&&null!=(r=r.featureFlagPayloads)&&r[i]&&(e[i]=null==(n=t.bootstrap)||null==(n=n.featureFlagPayloads)?void 0:n[i]),e},{});this.featureFlags.receivedFeatureFlags({featureFlags:f,featureFlagPayloads:_})}if(l)this.register_once({distinct_id:pi,$device_id:null},"");else if(!this.get_distinct_id()){var m=this.config.get_device_id(hr());this.register_once({distinct_id:m,$device_id:m},""),this.persistence.set_property(oi,"anonymous")}return Nt(r,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),t.segment?function(e,t){var i=e.config.segment;if(!i)return t();!function(e,t){var i=e.config.segment;if(!i)return t();var r=i=>{var r=()=>i.anonymousId()||hr();e.config.get_device_id=r,i.id()&&(e.register({distinct_id:i.id(),$device_id:r()}),e.persistence.set_property(oi,"identified")),t()},n=i.user();"then"in n&&R(n.then)?n.then(e=>r(e)):r(n)}(e,()=>{i.register((e=>{Promise&&Promise.resolve||Dr.warn("This browser does not have Promise support, and can not use the segment integration");var t=(t,i)=>{if(!i)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||(Dr.info("No userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(Dr.info("UserId set, identifying with PostHog"),e.identify(t.event.userId));var r=e.calculateEventProperties(i,t.event.properties);return t.event.properties=Object.assign({},r,t.event.properties),t};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:e=>t(e,e.event.event),page:e=>t(e,"$pageview"),identify:e=>t(e,"$identify"),screen:e=>t(e,"$screen")}})(e)).then(()=>{t()})})}(this,()=>this.rs()):this.rs(),R(this.config._onCapture)&&this.config._onCapture!==ko&&(wt.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",e=>this.config._onCapture(e.event,e))),this.config.ip&&wt.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this}ts(e){var t=performance.now();this.historyAutocapture=new $r(this),this.historyAutocapture.startIfEnabled();var i=[];i.push(()=>{new Gr(this).startIfEnabledOrStop()}),i.push(()=>{var e;this.siteApps=new ao(this),null==(e=this.siteApps)||e.init()}),e||i.push(()=>{this.sessionRecording=new bo(this),this.sessionRecording.startIfEnabledOrStop()}),this.config.disable_scroll_properties||i.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),i.push(()=>{this.autocapture=new sr(this),this.autocapture.startIfEnabled()}),i.push(()=>{this.surveys.loadIfEnabled()}),i.push(()=>{this.conversations.loadIfEnabled()}),i.push(()=>{this.productTours=new bs(this),this.productTours.loadIfEnabled()}),i.push(()=>{this.heatmaps=new hn(this),this.heatmaps.startIfEnabled()}),i.push(()=>{this.webVitalsAutocapture=new un(this)}),i.push(()=>{this.exceptionObserver=new Or(this),this.exceptionObserver.startIfEnabledOrStop()}),i.push(()=>{this.deadClicksAutocapture=new Cr(this,Pr),this.deadClicksAutocapture.startIfEnabled()}),i.push(()=>{if(this.ss){var e=this.ss;this.ss=void 0,this.yi(e)}}),this.ns(i,t)}ns(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout(()=>{this.ns(e,t)},0);var i=e.shift();if(i)try{i()}catch(e){wt.error("Error initializing extension:",e)}}var r=Math.round(performance.now()-t);this.register_for_session({$sdk_debug_extensions_init_method:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",$sdk_debug_extensions_init_time_ms:r}),this.config.__preview_deferred_init_extensions&&wt.info("PostHog extensions initialized ("+r+"ms)")}yi(e){var t,i,r,n,s,o,a,l,c;if(!u||!u.body)return wt.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.yi(e)},500);this.config.__preview_deferred_init_extensions&&(this.ss=e),this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=S(e.supportedCompression,Yi.GZipJS)?Yi.GZipJS:S(e.supportedCompression,Yi.Base64)?Yi.Base64:void 0),null!=(t=e.analytics)&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.Wr?this.Wr:"identified_only"}),null==(i=this.siteApps)||i.onRemoteConfig(e),null==(r=this.sessionRecording)||r.onRemoteConfig(e),null==(n=this.autocapture)||n.onRemoteConfig(e),null==(s=this.heatmaps)||s.onRemoteConfig(e),this.surveys.onRemoteConfig(e),this.conversations.onRemoteConfig(e),null==(o=this.productTours)||o.onRemoteConfig(e),null==(a=this.webVitalsAutocapture)||a.onRemoteConfig(e),null==(l=this.exceptionObserver)||l.onRemoteConfig(e),this.exceptions.onRemoteConfig(e),null==(c=this.deadClicksAutocapture)||c.onRemoteConfig(e)}rs(){try{this.config.loaded(this)}catch(e){wt.critical("`loaded` function failed",e)}this.os(),this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||"always"===this.config.cookieless_mode)&&this.ls()},1),new Js(this).load(),this.featureFlags.flags()}os(){var e;this.is_capturing()&&this.config.request_batching&&(null==(e=this.Xr)||e.enable())}_dom_loaded(){this.is_capturing()&&xt(this.__request_queue,e=>this.Qr(e)),this.__request_queue=[],this.os()}_handle_unload(){var e,t;this.surveys.handlePageUnload(),this.config.request_batching?(this.us()&&this.capture("$pageleave"),null==(e=this.Xr)||e.unload(),null==(t=this.Zr)||t.unload()):this.us()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}_send_request(e){this.__loaded&&(So?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=Wn(e.url,{ip:this.config.ip?1:0}),e.headers=y({},this.config.request_headers,e.headers),e.compression="best-available"===e.compression?this.compression:e.compression,e.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(e=>{var t,i,r,n=y({},e);n.timeout=n.timeout||6e4,n.url=Wn(n.url,{_:(new Date).getTime().toString(),ver:v.LIB_VERSION,compression:n.compression});var s=null!==(t=n.transport)&&void 0!==t?t:"fetch",o=Qn.filter(e=>!n.disableTransport||!e.transport||!n.disableTransport.includes(e.transport)),a=null!==(i=null==(r=Lt(o,e=>e.transport===s))?void 0:r.method)&&void 0!==i?i:o[0].method;if(!a)throw new Error("No available transport method");a(n)})(y({},e,{callback:t=>{var i,r;this.rateLimiter.checkForLimiting(t),t.statusCode>=400&&(null==(i=(r=this.config).on_request_error)||i.call(r,t)),null==e.callback||e.callback(t)}}))))}Qr(e){this.Zr?this.Zr.retriableRequest(e):this._send_request(e)}_execute_array(e){var t,i=[],r=[],n=[];xt(e,e=>{e&&(t=e[0],O(t)?n.push(e):R(e)?e.call(this):O(e)&&"alias"===t?i.push(e):O(e)&&-1!==t.indexOf("capture")&&R(this[t])?n.push(e):r.push(e))});var s=function(e,t){xt(e,function(e){if(O(e[0])){var i=t;It(e,function(e){i=i[e[0]].apply(i,e.slice(1))})}else this[e[0]].apply(this,e.slice(1))},t)};s(i,this),s(r,this),s(n,this)}es(){var e,t;return(null==(e=this.config.bootstrap)?void 0:e.featureFlags)&&Object.keys(null==(t=this.config.bootstrap)?void 0:t.featureFlags).length>0||!1}push(e){this._execute_array([e])}capture(e,t,i){var r;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Xr){if(this.is_capturing())if(!M(e)&&L(e)){var n=!this.config.opt_out_useragent_filter&&this._is_bot();if(!n||this.config.__preview_capture_bot_pageviews){var s=null!=i&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==s||!s.isRateLimited){null!=t&&t.$current_url&&!L(null==t?void 0:t.$current_url)&&(wt.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==t||delete t.$current_url),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var o=new Date,a=(null==i?void 0:i.timestamp)||o,l=hr(),u={uuid:l,event:e,properties:this.calculateEventProperties(e,t||{},a,l)};"$pageview"===e&&this.config.__preview_capture_bot_pageviews&&n&&(u.event="$bot_pageview",u.properties.$browser_type="bot"),s&&(u.properties.$lib_rate_limit_remaining_tokens=s.remainingTokens),(null==i?void 0:i.$set)&&(u.$set=null==i?void 0:i.$set);var c,d="$groupidentify"!==e,h=this.hs(null==i?void 0:i.$set_once,d);if(h&&(u.$set_once=h),(u=function(e,t){return i=e,r=e=>L(e)&&!F(t)?e.slice(0,t):e,n=new Set,function e(t,i){return t!==Object(t)?r?r(t):t:n.has(t)?void 0:(n.add(t),O(t)?(s=[],xt(t,t=>{s.push(e(t))})):(s={},It(t,(t,i)=>{n.has(t)||(s[i]=e(t))})),s);var s}(i);var i,r,n}(u,null!=i&&i._noTruncate?null:this.config.properties_string_max_length)).timestamp=a,M(null==i?void 0:i.timestamp)||(u.properties.$event_time_override_provided=!0,u.properties.$event_time_override_system_time=o),e===Cs.DISMISSED||e===Cs.SENT){var g=null==t?void 0:t[Ts.SURVEY_ID],p=null==t?void 0:t[Ts.SURVEY_ITERATION];c={id:g,current_iteration:p},localStorage.getItem(Ms(c))||localStorage.setItem(Ms(c),"true"),u.$set=y({},u.$set,{[Ds({id:g,current_iteration:p},e===Cs.SENT?"responded":"dismissed")]:!0})}var f=y({},u.properties.$set,u.$set);if(D(f)||this.setPersonPropertiesForFlags(f),!B(this.config.before_send)){var v=this.ds(u);if(!v)return;u=v}this.Hr.emit("eventCaptured",u);var _={method:"POST",url:null!==(r=null==i?void 0:i._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:u,compression:"best-available",batchKey:null==i?void 0:i._batchKey};return!this.config.request_batching||i&&(null==i||!i._batchKey)||null!=i&&i.send_instantly?this.Qr(_):this.Xr.enqueue(_),u}wt.critical("This capture call is ignored due to client rate limiting.")}}else wt.error("No event name provided to posthog.capture")}else wt.uninitializedWarning("posthog.capture")}Hi(e){return this.on("eventCaptured",t=>e(t.event,t))}calculateEventProperties(e,t,i,r,n){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return t;var s=n?void 0:this.persistence.remove_event_timer(e),o=y({},t);if(o.token=this.config.token,o.$config_defaults=this.config.defaults,("always"==this.config.cookieless_mode||"on_reject"==this.config.cookieless_mode&&this.consent.isExplicitlyOptedOut())&&(o.$cookieless_mode=!0),"$snapshot"===e){var a=y({},this.persistence.properties(),this.sessionPersistence.properties());return o.distinct_id=a.distinct_id,(!L(o.distinct_id)&&!U(o.distinct_id)||N(o.distinct_id))&&wt.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),o}var l,c=on(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:d,windowId:h}=this.sessionManager.checkAndGetSessionAndWindowId(n,i.getTime());o.$session_id=d,o.$window_id=h}this.sessionPropsManager&&Pt(o,this.sessionPropsManager.getSessionProps());try{var g;this.sessionRecording&&Pt(o,this.sessionRecording.sdkDebugProperties),o.$sdk_debug_retry_queue_size=null==(g=this.Zr)?void 0:g.length}catch(e){o.$sdk_debug_error_capturing_properties=String(e)}if(this.requestRouter.region===uo.CUSTOM&&(o.$lib_custom_api_host=this.config.api_host),l="$pageview"!==e||n?"$pageleave"!==e||n?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(i):this.pageViewManager.doPageView(i,r),o=Pt(o,l),"$pageview"===e&&u&&(o.title=u.title),!M(s)){var f=i.getTime()-s;o.$duration=parseFloat((f/1e3).toFixed(3))}p&&this.config.opt_out_useragent_filter&&(o.$browser_type=this._is_bot()?"bot":"browser"),(o=Pt({},c,this.persistence.properties(),this.sessionPersistence.properties(),o)).$is_identified=this._isIdentified(),O(this.config.property_denylist)?It(this.config.property_denylist,function(e){delete o[e]}):wt.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var v=this.config.sanitize_properties;v&&(wt.error("sanitize_properties is deprecated. Use before_send instead"),o=v(o,e));var _=this.vs();return o.$process_person_profile=_,_&&!n&&this.cs("_calculate_event_properties"),o}hs(e,t){var i;if(void 0===t&&(t=!0),!this.persistence||!this.vs())return e;if(this.zr)return e;var r=this.persistence.get_initial_props(),n=null==(i=this.sessionPropsManager)?void 0:i.getSetOnceProps(),s=Pt({},r,n||{},e||{}),o=this.config.sanitize_properties;return o&&(wt.error("sanitize_properties is deprecated. Use before_send instead"),s=o(s,"$set_once")),t&&(this.zr=!0),D(s)?void 0:s}register(e,t){var i;null==(i=this.persistence)||i.register(e,t)}register_once(e,t,i){var r;null==(r=this.persistence)||r.register_once(e,t,i)}register_for_session(e){var t;null==(t=this.sessionPersistence)||t.register(e)}unregister(e){var t;null==(t=this.persistence)||t.unregister(e)}unregister_for_session(e){var t;null==(t=this.sessionPersistence)||t.unregister(e)}fs(e,t){this.register({[e]:t})}getFeatureFlag(e,t){return this.featureFlags.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t=this.featureFlags.getFeatureFlagPayload(e);try{return JSON.parse(t)}catch(e){return t}}isFeatureEnabled(e,t){return this.featureFlags.isFeatureEnabled(e,t)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateFlags(e,t,i){var r=null!=i&&i.merge?this.featureFlags.getFlagVariants():{},n=null!=i&&i.merge?this.featureFlags.getFlagPayloads():{},s=y({},r,e),o=y({},n,t),a={};for(var[l,u]of Object.entries(s)){var c="string"==typeof u;a[l]={key:l,enabled:!!c||Boolean(u),variant:c?u:void 0,reason:void 0,metadata:M(null==o?void 0:o[l])?void 0:{id:0,version:void 0,description:void 0,payload:o[l]}}}this.featureFlags.receivedFeatureFlags({flags:a})}updateEarlyAccessFeatureEnrollment(e,t,i){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,t,i)}getEarlyAccessFeatures(e,t,i){return void 0===t&&(t=!1),this.featureFlags.getEarlyAccessFeatures(e,t,i)}on(e,t){return this.Hr.on(e,t)}onFeatureFlags(e){return this.featureFlags.onFeatureFlags(e)}onSurveysLoaded(e){return this.surveys.onSurveysLoaded(e)}onSessionId(e){var t,i;return null!==(t=null==(i=this.sessionManager)?void 0:i.onSessionId(e))&&void 0!==t?t:()=>{}}getSurveys(e,t){void 0===t&&(t=!1),this.surveys.getSurveys(e,t)}getActiveMatchingSurveys(e,t){void 0===t&&(t=!1),this.surveys.getActiveMatchingSurveys(e,t)}renderSurvey(e,t){this.surveys.renderSurvey(e,t)}displaySurvey(e,t){void 0===t&&(t=Ns),this.surveys.displaySurvey(e,t)}cancelPendingSurvey(e){this.surveys.cancelPendingSurvey(e)}canRenderSurvey(e){return this.surveys.canRenderSurvey(e)}canRenderSurveyAsync(e,t){return void 0===t&&(t=!1),this.surveys.canRenderSurveyAsync(e,t)}identify(e,t,i){if(!this.__loaded||!this.persistence)return wt.uninitializedWarning("posthog.identify");if(U(e)&&(e=e.toString(),wt.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),e)if(["distinct_id","distinctid"].includes(e.toLowerCase()))wt.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.');else if(e!==pi){if(this.cs("posthog.identify")){var r=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var n=r;this.register_once({$had_persisted_distinct_id:!0,$device_id:n},"")}e!==r&&e!==this.get_property(Bt)&&(this.unregister(Bt),this.register({distinct_id:e}));var s="anonymous"===(this.persistence.get_property(oi)||"anonymous");e!==r&&s?(this.persistence.set_property(oi,"identified"),this.setPersonPropertiesForFlags(y({},i||{},t||{}),!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:r},{$set:t||{},$set_once:i||{}}),this.Gr=Xn(e,t,i),this.featureFlags.setAnonymousDistinctId(r)):(t||i)&&this.setPersonProperties(t,i),e!==r&&(this.reloadFeatureFlags(),this.unregister(si))}}else wt.critical('The string "'+pi+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else wt.error("Unique user id has not been set in posthog.identify")}setPersonProperties(e,t){if((e||t)&&this.cs("posthog.setPersonProperties")){var i=Xn(this.get_distinct_id(),e,t);this.Gr!==i?(this.setPersonPropertiesForFlags(y({},t||{},e||{})),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.Gr=i):wt.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,t,i){if(e&&t){var r=this.getGroups();r[e]!==t&&this.resetGroupPropertiesForFlags(e),this.register({$groups:y({},r,{[e]:t})}),i&&(this.capture("$groupidentify",{$group_type:e,$group_key:t,$group_set:i}),this.setGroupPropertiesForFlags({[e]:i})),r[e]===t||i||this.reloadFeatureFlags()}else wt.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){void 0===t&&(t=!0),this.featureFlags.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e,t){void 0===t&&(t=!0),this.cs("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(e,t)}resetGroupPropertiesForFlags(e){this.featureFlags.resetGroupPropertiesForFlags(e)}reset(e){var t,i,r,n;if(wt.info("reset"),!this.__loaded)return wt.uninitializedWarning("posthog.reset");var s=this.get_property("$device_id");if(this.consent.reset(),null==(t=this.persistence)||t.clear(),null==(i=this.sessionPersistence)||i.clear(),this.surveys.reset(),this.featureFlags.reset(),null==(r=this.persistence)||r.set_property(oi,"anonymous"),null==(n=this.sessionManager)||n.resetSessionId(),this.Gr=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:pi,$device_id:null},"");else{var o=this.config.get_device_id(hr());this.register_once({distinct_id:o,$device_id:e?o:s},"")}this.register({$last_posthog_reset:(new Date).toISOString()},1)}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return null!==(e=null==(t=this.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==e?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:t,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t);if(null!=e&&e.withTimestamp&&i){var n,s=null!==(n=e.timestampLookBack)&&void 0!==n?n:10;if(!i)return r;r+="?t="+Math.max(Math.floor(((new Date).getTime()-i)/1e3)-s,0)}return r}alias(e,t){return e===this.get_property(Ft)?(wt.critical("Attempting to create alias for existing People user - aborting."),-2):this.cs("posthog.alias")?(M(t)&&(t=this.get_distinct_id()),e!==t?(this.fs(Bt,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(wt.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=y({},this.config);if($(e)){var i,r,n,s,o,a,l;Pt(this.config,xo(e));var u=this.Yr();null==(i=this.persistence)||i.update_config(this.config,t,u),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new _s(y({},this.config,{persistence:"sessionStorage"}),u);var c=this.Vr(this.config.debug);j(c)&&(this.config.debug=c),j(this.config.debug)&&(this.config.debug?(v.DEBUG=!0,mr.H()&&mr.G("ph_debug","true"),wt.info("set_config",{config:e,oldConfig:t,newConfig:y({},this.config)})):(v.DEBUG=!1,mr.H()&&mr.V("ph_debug"))),null==(r=this.exceptionObserver)||r.onConfigChange(),null==(n=this.sessionRecording)||n.startIfEnabledOrStop(),null==(s=this.autocapture)||s.startIfEnabled(),null==(o=this.heatmaps)||o.startIfEnabled(),null==(a=this.exceptionObserver)||a.startIfEnabledOrStop(),this.surveys.loadIfEnabled(),this.ps(),null==(l=this.externalIntegrations)||l.startIfEnabledOrStop()}}startSessionRecording(e){var t,i,r,n,s,o=!0===e,a={sampling:o||!(null==e||!e.sampling),linked_flag:o||!(null==e||!e.linked_flag),url_trigger:o||!(null==e||!e.url_trigger),event_trigger:o||!(null==e||!e.event_trigger)};Object.values(a).some(Boolean)&&(null==(t=this.sessionManager)||t.checkAndGetSessionAndWindowId(),a.sampling&&(null==(i=this.sessionRecording)||i.overrideSampling()),a.linked_flag&&(null==(r=this.sessionRecording)||r.overrideLinkedFlag()),a.url_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("url")),a.event_trigger&&(null==(s=this.sessionRecording)||s.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!(null==(e=this.sessionRecording)||!e.started)}captureException(e,t){var i=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(e,{handled:!0,syntheticException:i});return this.exceptions.sendExceptionEvent(y({},r,t))}startExceptionAutocapture(e){this.set_config({capture_exceptions:null==e||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){return this.toolbar.loadToolbar(e)}get_property(e){var t;return null==(t=this.persistence)?void 0:t.props[e]}getSessionProperty(e){var t;return null==(t=this.sessionPersistence)?void 0:t.props[e]}toString(){var e,t=null!==(e=this.config.name)&&void 0!==e?e:Eo;return t!==Eo&&(t=Eo+"."+t),t}_isIdentified(){var e,t;return"identified"===(null==(e=this.persistence)?void 0:e.get_property(oi))||"identified"===(null==(t=this.sessionPersistence)?void 0:t.get_property(oi))}vs(){var e,t;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&D(this.getGroups())&&(null==(e=this.persistence)||null==(e=e.props)||!e[Bt])&&(null==(t=this.persistence)||null==(t=t.props)||!t[hi]))}us(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&(!0===this.config.capture_pageview||"history_change"===this.config.capture_pageview)}createPersonProfile(){this.vs()||this.cs("posthog.createPersonProfile")&&this.setPersonProperties({},{})}cs(e){return"never"===this.config.person_profiles?(wt.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.fs(hi,!0),!0)}Yr(){if("always"===this.config.cookieless_mode)return!0;var e=this.consent.isOptedOut(),t=this.config.opt_out_persistence_by_default||"on_reject"===this.config.cookieless_mode;return this.config.disable_persistence||e&&!!t}ps(){var e,t,i,r,n=this.Yr();return(null==(e=this.persistence)?void 0:e.Si)!==n&&(null==(i=this.persistence)||i.set_disabled(n)),(null==(t=this.sessionPersistence)?void 0:t.Si)!==n&&(null==(r=this.sessionPersistence)||r.set_disabled(n)),n}opt_in_capturing(e){var t,i,r,n;"always"!==this.config.cookieless_mode?("on_reject"===this.config.cookieless_mode&&this.consent.isExplicitlyOptedOut()&&(this.reset(!0),null==(i=this.sessionManager)||i.destroy(),null==(r=this.pageViewManager)||r.destroy(),this.sessionManager=new no(this),this.pageViewManager=new gn(this),this.persistence&&(this.sessionPropsManager=new io(this,this.sessionManager,this.persistence)),this.sessionRecording=new bo(this),this.sessionRecording.startIfEnabledOrStop()),this.consent.optInOut(!0),this.ps(),this.os(),null==(t=this.sessionRecording)||t.startIfEnabledOrStop(),"on_reject"==this.config.cookieless_mode&&this.surveys.loadIfEnabled(),(M(null==e?void 0:e.captureEventName)||null!=e&&e.captureEventName)&&this.capture(null!==(n=null==e?void 0:e.captureEventName)&&void 0!==n?n:"$opt_in",null==e?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.ls()):wt.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}opt_out_capturing(){var e,t,i;"always"!==this.config.cookieless_mode?("on_reject"===this.config.cookieless_mode&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.ps(),"on_reject"===this.config.cookieless_mode&&(this.register({distinct_id:pi,$device_id:null}),null==(e=this.sessionManager)||e.destroy(),null==(t=this.pageViewManager)||t.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,null==(i=this.sessionRecording)||i.stopRecording(),this.sessionRecording=void 0,this.ls())):wt.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return e===Sr.GRANTED?"granted":e===Sr.DENIED?"denied":"pending"}is_capturing(){return"always"===this.config.cookieless_mode||("on_reject"===this.config.cookieless_mode?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.ps()}_is_bot(){return l?lo(l,this.config.custom_blocked_useragents):void 0}ls(){u&&("visible"===u.visibilityState?this.Br||(this.Br=!0,this.capture("$pageview",{title:u.title},{send_instantly:!0}),this.qr&&(u.removeEventListener("visibilitychange",this.qr),this.qr=null)):this.qr||(this.qr=this.ls.bind(this),Nt(u,"visibilitychange",this.qr)))}debug(e){!1===e?(null==r||r.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==r||r.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}O(){var e,t,i,r,n,s,o=this.Jr||{};return"advanced_disable_flags"in o?!!o.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(wt.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(i="advanced_disable_decide",r=wt,n=(t="advanced_disable_flags")in(e=o)&&!M(e[t]),s=i in e&&!M(e[i]),n?e[t]:!!s&&(r&&r.warn("Config field '"+i+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[i]))}ds(e){if(B(this.config.before_send))return e;var t=O(this.config.before_send)?this.config.before_send:[this.config.before_send],i=e;for(var r of t){if(i=r(i),B(i)){var n="Event '"+e.event+"' was rejected in beforeSend function";return V(e.event)?wt.warn(n+". This can cause unexpected behavior."):wt.info(n),null}i.properties&&!D(i.properties)||wt.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return i}getPageViewId(){var e;return null==(e=this.pageViewManager.Kt)?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,i){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(i)})}Vr(e){var t=j(e)&&!e,i=mr.H()&&"true"===mr.q("ph_debug");return!t&&(!!i||e)}}!function(e,t){for(var i=0;i<t.length;i++)e.prototype[t[i]]=Rt(e.prototype[t[i]])}(Po,["identify"]);var Co,To={backgroundColor:"#ffffff",textColor:"#1d1f27",buttonColor:"#1d1f27",borderRadius:8,buttonBorderRadius:6,borderColor:"#e5e7eb",fontFamily:"system-ui",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",showOverlay:!0,whiteLabel:!1},Oo=(Co=wo[Eo]=new Po,function(){function e(){e.done||(e.done=!0,So=!1,It(wo,function(e){e._dom_loaded()}))}null!=u&&u.addEventListener?"complete"===u.readyState?e():Nt(u,"DOMContentLoaded",e,{capture:!1}):r&&wt.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),Co)},488(e,t,i){"use strict";var r=this&&this.__assign||function(){return r=Object.assign||function(e){for(var t,i=1,r=arguments.length;i<r;i++)for(var n in t=arguments[i])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},r.apply(this,arguments)},n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.PostHogAnalytics=void 0;var s=n(i(476)),o=i(831),a=n(i(733)),l=function(){function e(e,t,i,n){void 0===i&&(i=!1);var l=this;this.has_identified=!1,this.has_initialized=!1,this.current_page="",this.rudderstack_anonymous_cookie_key="rudder_anonymous_id",this.getAnonymousId=function(){var e;return null===(e=document.cookie.match("(^|;)\\s*"+l.rudderstack_anonymous_cookie_key+"\\s*=\\s*([^;]+)"))||void 0===e?void 0:e.pop()},this.setCookieIfNotExists=function(){if(!l.getAnonymousId()){var e=window.location.hostname,t=["webflow.io"].some(function(t){return e.endsWith(t)})?e:e.split(".").slice(-2).join(".");document.cookie="".concat(l.rudderstack_anonymous_cookie_key,"=").concat((0,o.v6)(),"; path=/; Domain=").concat(t,"; max-age=").concat(63072e3)}},this.getUserId=function(){return s.default.get_distinct_id()},this.handleCachedEvents=function(){var e=["deriv.com","deriv.team","deriv.ae"],t=e.some(function(e){return window.location.hostname.includes(e)})?".".concat(e.find(function(e){return window.location.hostname.includes(e)})):".".concat(e[0]),i=a.default.get("cached_analytics_events"),n=a.default.get("cached_analytics_page_views");try{if(i){var o=JSON.parse(i);Array.isArray(o)&&o.length>0&&(o.forEach(function(e){s.default.capture(e.name,e.properties)}),a.default.remove("cached_analytics_events",{domain:t}))}if(n){var l=JSON.parse(n);Array.isArray(l)&&l.length>0&&(l.forEach(function(e){s.default.capture("$pageview",r({$current_url:window.location.href,page_name:null==e?void 0:e.name},null==e?void 0:e.properties))}),a.default.remove("cached_analytics_page_views",{domain:t}))}}catch(e){console.log(e)}},this.init=function(e,t,i){if(void 0===i&&(i=!1),e){var r;i&&(r=window.define,window.define=void 0),l.setCookieIfNotExists();var n=l.getAnonymousId();s.default.init(e,{api_host:t||"https://ph.deriv.com",ui_host:"https://us.posthog.com",bootstrap:{distinctID:n},capture_pageview:!1,capture_pageleave:!1,autocapture:!0,loaded:function(e){var t;i&&(window.define=r),l.has_initialized=!0,l.has_identified=s.default.get_distinct_id()!==n,l.handleCachedEvents(),null===(t=l.onLoadedCallback)||void 0===t||t.call(l)}})}},this.identifyEvent=function(e,t){var i=l.getUserId(),r=l.getAnonymousId();i&&i!==r||s.default.identify(e,t),l.has_identified=!0},this.pageView=function(e,t,i,n){if(void 0===t&&(t="Deriv App"),l.has_initialized&&e!==l.current_page){var o=r(i?{user_id:i,platform:t}:{platform:t},n);s.default.capture("$pageview",r({$current_url:window.location.href,page_name:e},o)),l.current_page=e}},this.reset=function(){l.has_initialized&&(s.default.reset(),l.has_identified=!1)},this.track=function(e,t){var i=Object.fromEntries(Object.entries(t).filter(function(e){return e[0],void 0!==e[1]}));if(l.has_initialized)try{s.default.capture(e,i)}catch(e){console.error(e)}},this.onLoadedCallback=n,this.init(e,t,i)}return e.getPostHogInstance=function(t,i,r,n){return void 0===r&&(r=!1),e._instance||(e._instance=new e(t,i,r,n)),e._instance},e}();t.PostHogAnalytics=l},507(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t,i=(t="string"==typeof e?(0,n.default)(e):e,Uint8Array.of((15&t[3])<<4|t[4]>>4&15,(15&t[4])<<4|(240&t[5])>>4,(15&t[5])<<4|15&t[6],t[7],(15&t[1])<<4|(240&t[2])>>4,(15&t[2])<<4|(240&t[3])>>4,16|(240&t[0])>>4,(15&t[0])<<4|(240&t[1])>>4,t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15]));return"string"==typeof e?(0,s.unsafeStringify)(i):i};var r,n=(r=i(792))&&r.__esModule?r:{default:r},s=i(910)},518(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r,n,s,o=(r=i(858))&&r.__esModule?r:{default:r},a=i(910),l=0,u=0;t.default=function(e,t,i){var r=t&&i||0,c=t||new Array(16),d=(e=e||{}).node,h=e.clockseq;if(e._v6||(d||(d=n),null==h&&(h=s)),null==d||null==h){var g=e.random||(e.rng||o.default)();null==d&&(d=[g[0],g[1],g[2],g[3],g[4],g[5]],n||e._v6||(d[0]|=1,n=d)),null==h&&(h=16383&(g[6]<<8|g[7]),void 0!==s||e._v6||(s=h))}var p=void 0!==e.msecs?e.msecs:Date.now(),f=void 0!==e.nsecs?e.nsecs:u+1,v=p-l+(f-u)/1e4;if(v<0&&void 0===e.clockseq&&(h=h+1&16383),(v<0||p>l)&&void 0===e.nsecs&&(f=0),f>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");l=p,u=f,s=h;var _=(1e4*(268435455&(p+=122192928e5))+f)%4294967296;c[r++]=_>>>24&255,c[r++]=_>>>16&255,c[r++]=_>>>8&255,c[r++]=255&_;var m=p/4294967296*1e4&268435455;c[r++]=m>>>8&255,c[r++]=255&m,c[r++]=m>>>24&15|16,c[r++]=m>>>16&255,c[r++]=h>>>8|128,c[r++]=255&h;for(var y=0;y<6;++y)c[r+y]=d[y];return t||(0,a.unsafeStringify)(c)}},555(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UserScopedGrowthBook=t.GrowthBookClient=void 0;var r=i(106),n=i(707),s=i(569);const o=(0,r.loadSDKVersion)();t.GrowthBookClient=class{constructor(e){if(e=e||{},this.version=o,this._options=e,this.debug=!!e.debug,this.ready=!1,this._features={},this._experiments=[],this.log=this.log.bind(this),e.plugins)for(const t of e.plugins)t(this)}async setPayload(e){this._payload=e;const t=await(0,s.decryptPayload)(e,this._options.decryptionKey);this._decryptedPayload=t,t.features&&(this._features=t.features),t.experiments&&(this._experiments=t.experiments),t.savedGroups&&(this._options.savedGroups=t.savedGroups),this.ready=!0}initSync(e){const t=e.payload;if(t.encryptedExperiments||t.encryptedFeatures)throw new Error("initSync does not support encrypted payloads");return this._payload=t,this._decryptedPayload=t,t.features&&(this._features=t.features),t.experiments&&(this._experiments=t.experiments),this.ready=!0,(0,n.startStreaming)(this,e),this}async init(e){if((e=e||{}).cacheSettings&&(0,n.configureCache)(e.cacheSettings),e.payload)return await this.setPayload(e.payload),(0,n.startStreaming)(this,e),{success:!0,source:"init"};{const{data:t,...i}=await this._refresh({...e,allowStale:!0});return(0,n.startStreaming)(this,e),await this.setPayload(t||{}),i}}async refreshFeatures(e){const t=await this._refresh({...e||{},allowStale:!1});t.data&&await this.setPayload(t.data)}getApiInfo(){return[this.getApiHosts().apiHost,this.getClientKey()]}getApiHosts(){return(0,s.getApiHosts)(this._options)}getClientKey(){return this._options.clientKey||""}getPayload(){return this._payload||{features:this.getFeatures(),experiments:this._experiments||[]}}getDecryptedPayload(){return this._decryptedPayload||this.getPayload()}async _refresh(e){let{timeout:t,skipCache:i,allowStale:r,streaming:s}=e;if(!this._options.clientKey)throw new Error("Missing clientKey");return(0,n.refreshFeatures)({instance:this,timeout:t,skipCache:i||this._options.disableCache,allowStale:r,backgroundSync:s??!0})}getFeatures(){return this._features||{}}getGlobalAttributes(){return this._options.globalAttributes||{}}setGlobalAttributes(e){this._options.globalAttributes=e}destroy(e){e=e||{},this._destroyed=!0,(0,n.unsubscribe)(this),e.destroyAllStreams&&(0,n.clearAutoRefresh)(),this._features={},this._experiments=[],this._decryptedPayload=void 0,this._payload=void 0,this._options={}}isDestroyed(){return!!this._destroyed}setEventLogger(e){this._options.eventLogger=e}logEvent(e,t,i){if(this._options.eventLogger){const r=this._getEvalContext(i);this._options.eventLogger(e,t,r.user)}}runInlineExperiment(e,t){const{result:i}=(0,s.runExperiment)(e,null,this._getEvalContext(t));return i}_getEvalContext(e){return this._options.globalAttributes&&(e={...e,attributes:{...this._options.globalAttributes,...e.attributes}}),{user:e,global:this._getGlobalContext(),stack:{evaluatedFeatures:new Set}}}_getGlobalContext(){return{features:this._features,experiments:this._experiments,log:this.log,enabled:this._options.enabled,qaMode:this._options.qaMode,savedGroups:this._options.savedGroups,forcedFeatureValues:this._options.forcedFeatureValues,forcedVariations:this._options.forcedVariations,trackingCallback:this._options.trackingCallback,onFeatureUsage:this._options.onFeatureUsage}}isOn(e,t){return this.evalFeature(e,t).on}isOff(e,t){return this.evalFeature(e,t).off}getFeatureValue(e,t,i){const r=this.evalFeature(e,i).value;return null===r?t:r}evalFeature(e,t){return(0,s.evalFeature)(e,this._getEvalContext(t))}log(e,t){this.debug&&(this._options.log?this._options.log(e,t):console.log(e,t))}setTrackingCallback(e){this._options.trackingCallback=e}async applyStickyBuckets(e,t){const i=this._getEvalContext(e),r=await(0,s.getAllStickyBucketAssignmentDocs)(i,t);return{...e,stickyBucketAssignmentDocs:r,saveStickyBucketAssignmentDoc:e=>t.saveAssignments(e)}}createScopedInstance(e,t){return new a(this,e,[...this._options.plugins||[],...t||[]])}};class a{constructor(e,t,i){if(this._gb=e,this._userContext=t,this.logs=[],this._userContext.trackedExperiments=this._userContext.trackedExperiments||new Set,this._userContext.trackedFeatureUsage=this._userContext.trackedFeatureUsage||{},this._userContext.devLogs=this.logs,i)for(const e of i)e(this)}runInlineExperiment(e){return this._gb.runInlineExperiment(e,this._userContext)}isOn(e){return this._gb.isOn(e,this._userContext)}isOff(e){return this._gb.isOff(e,this._userContext)}getFeatureValue(e,t){return this._gb.getFeatureValue(e,t,this._userContext)}evalFeature(e){return this._gb.evalFeature(e,this._userContext)}logEvent(e,t){this._userContext.enableDevMode&&this.logs.push({eventName:e,properties:t,timestamp:Date.now().toString(),logType:"event"}),this._gb.logEvent(e,t||{},this._userContext)}setTrackingCallback(e){this._userContext.trackingCallback=e}getApiInfo(){return this._gb.getApiInfo()}getClientKey(){return this._gb.getClientKey()}setURL(e){this._userContext.url=e}updateAttributes(e){this._userContext.attributes={...this._userContext.attributes,...e}}setAttributeOverrides(e){this._userContext.attributeOverrides=e}async setForcedVariations(e){this._userContext.forcedVariations=e||{}}setForcedFeatures(e){this._userContext.forcedFeatureValues=e}getUserContext(){return this._userContext}getVersion(){return o}getDecryptedPayload(){return this._gb.getDecryptedPayload()}inDevMode(){return!!this._userContext.enableDevMode}}t.UserScopedGrowthBook=a},569(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EVENT_FEATURE_EVALUATED=t.EVENT_EXPERIMENT_VIEWED=void 0,t.decryptPayload=async function(e,t,i){if((e={...e}).encryptedFeatures){try{e.features=JSON.parse(await(0,n.decrypt)(e.encryptedFeatures,t,i))}catch(e){console.error(e)}delete e.encryptedFeatures}if(e.encryptedExperiments){try{e.experiments=JSON.parse(await(0,n.decrypt)(e.encryptedExperiments,t,i))}catch(e){console.error(e)}delete e.encryptedExperiments}if(e.encryptedSavedGroups){try{e.savedGroups=JSON.parse(await(0,n.decrypt)(e.encryptedSavedGroups,t,i))}catch(e){console.error(e)}delete e.encryptedSavedGroups}return e},t.evalFeature=u,t.getAllStickyBucketAssignmentDocs=async function(e,t,i){const r=b(e,i);return t.getAllAssignments(r)},t.getApiHosts=function(e){const t=e.apiHost||"https://cdn.growthbook.io";return{apiHost:t.replace(/\/*$/,""),streamingHost:(e.streamingHost||t).replace(/\/*$/,""),apiRequestHeaders:e.apiHostRequestHeaders,streamingHostRequestHeaders:e.streamingHostRequestHeaders}},t.getExperimentDedupeKey=w,t.getExperimentResult=v,t.getHashAttribute=_,t.getStickyBucketAttributeKey=y,t.getStickyBucketAttributes=b,t.runExperiment=c;var r=i(427),n=i(106);const s=t.EVENT_FEATURE_EVALUATED="Feature Evaluated",o=t.EVENT_EXPERIMENT_VIEWED="Experiment Viewed";async function a(e){try{await e()}catch(e){}}function l(e,t,i){if(e.user.trackedExperiments){const r=w(t,i);if(e.user.trackedExperiments.has(r))return[];e.user.trackedExperiments.add(r)}e.user.enableDevMode&&e.user.devLogs&&e.user.devLogs.push({experiment:t,result:i,timestamp:Date.now().toString(),logType:"experiment"});const r=[];if(e.global.trackingCallback){const n=e.global.trackingCallback;r.push(a(()=>n(t,i,e.user)))}if(e.user.trackingCallback){const n=e.user.trackingCallback;r.push(a(()=>n(t,i)))}if(e.global.eventLogger){const n=e.global.eventLogger;r.push(a(()=>n(o,{experimentId:t.key,variationId:i.key,hashAttribute:i.hashAttribute,hashValue:i.hashValue},e.user)))}return r}function u(e,t){if(t.stack.evaluatedFeatures.has(e))return d(t,e,null,"cyclicPrerequisite");t.stack.evaluatedFeatures.add(e),t.stack.id=e;const i=function(e){const t=new Map;return e.global.forcedFeatureValues&&e.global.forcedFeatureValues.forEach((e,i)=>t.set(i,e)),e.user.forcedFeatureValues&&e.user.forcedFeatureValues.forEach((e,i)=>t.set(i,e)),t}(t);if(i.has(e))return d(t,e,i.get(e),"override");if(!t.global.features||!t.global.features[e])return d(t,e,null,"unknownFeature");const n=t.global.features[e];if(n.rules){const i=new Set(t.stack.evaluatedFeatures);e:for(const s of n.rules){if(s.parentConditions)for(const n of s.parentConditions){t.stack.evaluatedFeatures=new Set(i);const s=u(n.id,t);if("cyclicPrerequisite"===s.source)return d(t,e,null,"cyclicPrerequisite");const o={value:s.value};if(!(0,r.evalCondition)(o,n.condition||{})){if(n.gate)return d(t,e,null,"prerequisite");continue e}}if(s.filters&&p(s.filters,t))continue;if("force"in s){if(s.condition&&!g(s.condition,t))continue;if(!f(t,s.seed||e,s.hashAttribute,t.user.saveStickyBucketAssignmentDoc&&!s.disableStickyBucketing?s.fallbackAttribute:void 0,s.range,s.coverage,s.hashVersion))continue;return s.tracks&&s.tracks.forEach(e=>{!l(t,e.experiment,e.result).length&&t.global.saveDeferredTrack&&t.global.saveDeferredTrack({experiment:e.experiment,result:e.result})}),d(t,e,s.force,"force",s.id)}if(!s.variations)continue;const n={variations:s.variations,key:s.key||e};"coverage"in s&&(n.coverage=s.coverage),s.weights&&(n.weights=s.weights),s.hashAttribute&&(n.hashAttribute=s.hashAttribute),s.fallbackAttribute&&(n.fallbackAttribute=s.fallbackAttribute),s.disableStickyBucketing&&(n.disableStickyBucketing=s.disableStickyBucketing),void 0!==s.bucketVersion&&(n.bucketVersion=s.bucketVersion),void 0!==s.minBucketVersion&&(n.minBucketVersion=s.minBucketVersion),s.namespace&&(n.namespace=s.namespace),s.meta&&(n.meta=s.meta),s.ranges&&(n.ranges=s.ranges),s.name&&(n.name=s.name),s.phase&&(n.phase=s.phase),s.seed&&(n.seed=s.seed),s.hashVersion&&(n.hashVersion=s.hashVersion),s.filters&&(n.filters=s.filters),s.condition&&(n.condition=s.condition);const{result:o}=c(n,e,t);if(t.global.onExperimentEval&&t.global.onExperimentEval(n,o),o.inExperiment&&!o.passthrough)return d(t,e,o.value,"experiment",s.id,n,o)}}return d(t,e,void 0===n.defaultValue?null:n.defaultValue,"defaultValue")}function c(e,t,i){const s=e.key,o=e.variations.length;if(o<2)return{result:v(i,e,-1,!1,t)};if(!1===i.global.enabled||!1===i.user.enabled)return{result:v(i,e,-1,!1,t)};if(e=function(e,t){const i=e.key,r=t.global.overrides;return r&&r[i]&&"string"==typeof(e=Object.assign({},e,r[i])).url&&(e.url=(0,n.getUrlRegExp)(e.url)),e}(e,i),e.urlPatterns&&!(0,n.isURLTargeted)(i.user.url||"",e.urlPatterns))return{result:v(i,e,-1,!1,t)};const a=(0,n.getQueryStringOverride)(s,i.user.url||"",o);if(null!==a)return{result:v(i,e,a,!1,t)};const c=function(e){return e.global.forcedVariations&&e.user.forcedVariations?{...e.global.forcedVariations,...e.user.forcedVariations}:e.global.forcedVariations?e.global.forcedVariations:e.user.forcedVariations?e.user.forcedVariations:{}}(i);if(s in c)return{result:v(i,e,c[s],!1,t)};if("draft"===e.status||!1===e.active)return{result:v(i,e,-1,!1,t)};const{hashAttribute:d,hashValue:h}=_(i,e.hashAttribute,i.user.saveStickyBucketAssignmentDoc&&!e.disableStickyBucketing?e.fallbackAttribute:void 0);if(!h)return{result:v(i,e,-1,!1,t)};let f=-1,b=!1,w=!1;if(i.user.saveStickyBucketAssignmentDoc&&!e.disableStickyBucketing){const{variation:t,versionIsBlocked:r}=function(e){let{ctx:t,expKey:i,expBucketVersion:r,expHashAttribute:s,expFallbackAttribute:o,expMinBucketVersion:a,expMeta:l}=e;r=r||0,a=a||0,s=s||"id",l=l||[];const u=m(i,r),c=function(e,t,i){if(!e.user.stickyBucketAssignmentDocs)return{};const{hashAttribute:r,hashValue:s}=_(e,t),o=y(r,(0,n.toString)(s)),{hashAttribute:a,hashValue:l}=_(e,i),u=l?y(a,(0,n.toString)(l)):null,c={};return u&&e.user.stickyBucketAssignmentDocs[u]&&Object.assign(c,e.user.stickyBucketAssignmentDocs[u].assignments||{}),e.user.stickyBucketAssignmentDocs[o]&&Object.assign(c,e.user.stickyBucketAssignmentDocs[o].assignments||{}),c}(t,s,o);if(a>0)for(let e=0;e<a;e++)if(void 0!==c[m(i,e)])return{variation:-1,versionIsBlocked:!0};const d=c[u];if(void 0===d)return{variation:-1};const h=l.findIndex(e=>e.key===d);return h<0?{variation:-1}:{variation:h}}({ctx:i,expKey:e.key,expBucketVersion:e.bucketVersion,expHashAttribute:e.hashAttribute,expFallbackAttribute:e.fallbackAttribute,expMinBucketVersion:e.minBucketVersion,expMeta:e.meta});b=t>=0,f=t,w=!!r}if(!b){if(e.filters){if(p(e.filters,i))return{result:v(i,e,-1,!1,t)}}else if(e.namespace&&!(0,n.inNamespace)(h,e.namespace))return{result:v(i,e,-1,!1,t)};if(e.include&&!(0,n.isIncluded)(e.include))return{result:v(i,e,-1,!1,t)};if(e.condition&&!g(e.condition,i))return{result:v(i,e,-1,!1,t)};if(e.parentConditions){const n=new Set(i.stack.evaluatedFeatures);for(const s of e.parentConditions){i.stack.evaluatedFeatures=new Set(n);const o=u(s.id,i);if("cyclicPrerequisite"===o.source)return{result:v(i,e,-1,!1,t)};const a={value:o.value};if(!(0,r.evalCondition)(a,s.condition||{}))return{result:v(i,e,-1,!1,t)}}}if(e.groups&&!function(e,t){const i=t.global.groups||{};for(let t=0;t<e.length;t++)if(i[e[t]])return!0;return!1}(e.groups,i))return{result:v(i,e,-1,!1,t)}}if(e.url&&!function(e,t){const i=t.user.url;if(!i)return!1;const r=i.replace(/^https?:\/\//,"").replace(/^[^/]*\//,"/");return!!e.test(i)||!!e.test(r)}(e.url,i))return{result:v(i,e,-1,!1,t)};const k=(0,n.hash)(e.seed||s,h,e.hashVersion||1);if(null===k)return{result:v(i,e,-1,!1,t)};if(!b){const t=e.ranges||(0,n.getBucketRanges)(o,void 0===e.coverage?1:e.coverage,e.weights);f=(0,n.chooseVariation)(k,t)}if(w)return{result:v(i,e,-1,!1,t,void 0,!0)};if(f<0)return{result:v(i,e,-1,!1,t)};if("force"in e)return{result:v(i,e,void 0===e.force?-1:e.force,!1,t)};if(i.global.qaMode||i.user.qaMode)return{result:v(i,e,-1,!1,t)};if("stopped"===e.status)return{result:v(i,e,-1,!1,t)};const E=v(i,e,f,!0,t,k,b);if(i.user.saveStickyBucketAssignmentDoc&&!e.disableStickyBucketing){const{changed:t,key:r,doc:s}=function(e,t,i,r){const n=y(t,i),s=e.user.stickyBucketAssignmentDocs&&e.user.stickyBucketAssignmentDocs[n]&&e.user.stickyBucketAssignmentDocs[n].assignments||{},o={...s,...r};return{key:n,doc:{attributeName:t,attributeValue:i,assignments:o},changed:JSON.stringify(s)!==JSON.stringify(o)}}(i,d,(0,n.toString)(h),{[m(e.key,e.bucketVersion)]:E.key});t&&(i.user.stickyBucketAssignmentDocs=i.user.stickyBucketAssignmentDocs||{},i.user.stickyBucketAssignmentDocs[r]=s,i.user.saveStickyBucketAssignmentDoc(s))}const S=l(i,e,E);0===S.length&&i.global.saveDeferredTrack&&i.global.saveDeferredTrack({experiment:e,result:E});const A=S.length?1===S.length?S[0]:Promise.all(S).then(()=>{}):void 0;return"changeId"in e&&e.changeId&&i.global.recordChangeId&&i.global.recordChangeId(e.changeId),{result:E,trackingCall:A}}function d(e,t,i,r,n,o,l){const u={value:i,on:!!i,off:!i,source:r,ruleId:n||""};return o&&(u.experiment=o),l&&(u.experimentResult=l),"override"!==r&&function(e,t,i){if(e.user.trackedFeatureUsage){const r=JSON.stringify(i.value);if(e.user.trackedFeatureUsage[t]===r)return;e.user.trackedFeatureUsage[t]=r,e.user.enableDevMode&&e.user.devLogs&&e.user.devLogs.push({featureKey:t,result:i,timestamp:Date.now().toString(),logType:"feature"})}if(e.global.onFeatureUsage){const r=e.global.onFeatureUsage;a(()=>r(t,i,e.user))}if(e.user.onFeatureUsage){const r=e.user.onFeatureUsage;a(()=>r(t,i))}if(e.global.eventLogger){const r=e.global.eventLogger;a(()=>r(s,{feature:t,source:i.source,value:i.value,ruleId:"defaultValue"===i.source?"$default":i.ruleId||"",variationId:i.experimentResult?i.experimentResult.key:""},e.user))}}(e,t,u),u}function h(e){return{...e.user.attributes,...e.user.attributeOverrides}}function g(e,t){return(0,r.evalCondition)(h(t),e,t.global.savedGroups||{})}function p(e,t){return e.some(e=>{const{hashValue:i}=_(t,e.attribute);if(!i)return!0;const r=(0,n.hash)(e.seed,i,e.hashVersion||2);return null===r||!e.ranges.some(e=>(0,n.inRange)(r,e))})}function f(e,t,i,r,s,o,a){if(!s&&void 0===o)return!0;if(!s&&0===o)return!1;const{hashValue:l}=_(e,i,r);if(!l)return!1;const u=(0,n.hash)(t,l,a||1);return null!==u&&(s?(0,n.inRange)(u,s):void 0===o||u<=o)}function v(e,t,i,r,n,s,o){let a=!0;(i<0||i>=t.variations.length)&&(i=0,a=!1);const{hashAttribute:l,hashValue:u}=_(e,t.hashAttribute,e.user.saveStickyBucketAssignmentDoc&&!t.disableStickyBucketing?t.fallbackAttribute:void 0),c=t.meta?t.meta[i]:{},d={key:c.key||""+i,featureId:n,inExperiment:a,hashUsed:r,variationId:i,value:t.variations[i],hashAttribute:l,hashValue:u,stickyBucketUsed:!!o};return c.name&&(d.name=c.name),void 0!==s&&(d.bucket=s),c.passthrough&&(d.passthrough=c.passthrough),d}function _(e,t,i){let r=t||"id",n="";const s=h(e);return s[r]&&(n=s[r]),!n&&i&&(s[i]&&(n=s[i]),n&&(r=i)),{hashAttribute:r,hashValue:n}}function m(e,t){return`${e}__${t=t||0}`}function y(e,t){return`${e}||${t}`}function b(e,t){const i={},r=function(e,t){const i=new Set,r=t&&t.features?t.features:e.global.features||{},n=t&&t.experiments?t.experiments:e.global.experiments||[];return Object.keys(r).forEach(e=>{const t=r[e];if(t.rules)for(const e of t.rules)e.variations&&(i.add(e.hashAttribute||"id"),e.fallbackAttribute&&i.add(e.fallbackAttribute))}),n.map(e=>{i.add(e.hashAttribute||"id"),e.fallbackAttribute&&i.add(e.fallbackAttribute)}),Array.from(i)}(e,t);return r.forEach(t=>{const{hashValue:r}=_(e,t);i[t]=(0,n.toString)(r)}),i}function w(e,t){return t.hashAttribute+t.hashValue+e.key+t.variationId}},591(e,t,i){"use strict";i.r(t),i.d(t,{connectGlobalObserver:()=>R,default:()=>F,disconnectGlobalObserver:()=>O,validAttributeName:()=>r});var r=/^[a-zA-Z:_][a-zA-Z0-9:_.-]*$/,n={revert:function(){}},s=new Map,o=new Set;function a(e){var t=s.get(e);return t||(t={element:e,attributes:{}},s.set(e,t)),t}function l(e,t,i,r,n){var s=i(e),o={isDirty:!1,originalValue:s,virtualValue:s,mutations:[],el:e,_positionTimeout:null,observer:new MutationObserver(function(){if("position"!==t||!o._positionTimeout){"position"===t&&(o._positionTimeout=setTimeout(function(){o._positionTimeout=null},1e3));var r=i(e);"position"===t&&r.parentNode===o.virtualValue.parentNode&&r.insertBeforeNode===o.virtualValue.insertBeforeNode||r!==o.virtualValue&&(o.originalValue=r,n(o))}}),mutationRunner:n,setValue:r,getCurrentValue:i};return"position"===t&&e.parentNode?o.observer.observe(e.parentNode,{childList:!0,subtree:!0,attributes:!1,characterData:!1}):o.observer.observe(e,function(e){return"html"===e?{childList:!0,subtree:!0,attributes:!0,characterData:!0}:{childList:!1,subtree:!1,attributes:!0,attributeFilter:[e]}}(t)),o}function u(e,t){var i=t.getCurrentValue(t.el);t.virtualValue=e,e&&"string"!=typeof e?i&&e.parentNode===i.parentNode&&e.insertBeforeNode===i.insertBeforeNode||(t.isDirty=!0,P()):e!==i&&(t.isDirty=!0,P())}function c(e){var t=e.originalValue;e.mutations.forEach(function(e){return t=e.mutate(t)}),u(function(e){return b||(b=document.createElement("div")),b.innerHTML=e,b.innerHTML}(t),e)}function d(e){var t=new Set(e.originalValue.split(/\s+/).filter(Boolean));e.mutations.forEach(function(e){return e.mutate(t)}),u(Array.from(t).filter(Boolean).join(" "),e)}function h(e){var t=e.originalValue;e.mutations.forEach(function(e){return t=e.mutate(t)}),u(t,e)}function g(e){var t=e.originalValue;e.mutations.forEach(function(e){var i=function(e){var t=e.parentSelector,i=e.insertBeforeSelector,r=document.querySelector(t);if(!r)return null;var n=i?document.querySelector(i):null;return i&&!n?null:{parentNode:r,insertBeforeNode:n}}(e.mutate());t=i||t}),u(t,e)}var p=function(e){return e.innerHTML},f=function(e,t){return e.innerHTML=t};function v(e){var t=a(e);return t.html||(t.html=l(e,"html",p,f,c)),t.html}var _=function(e){return{parentNode:e.parentElement,insertBeforeNode:e.nextElementSibling}},m=function(e,t){t.insertBeforeNode&&!t.parentNode.contains(t.insertBeforeNode)||t.parentNode.insertBefore(e,t.insertBeforeNode)};function y(e){var t=a(e);return t.position||(t.position=l(e,"position",_,m,g)),t.position}var b,w,k=function(e,t){return t?e.className=t:e.removeAttribute("class")},E=function(e){return e.className};function S(e){var t=a(e);return t.classes||(t.classes=l(e,"class",E,k,d)),t.classes}function A(e,t){var i,r=a(e);return r.attributes[t]||(r.attributes[t]=l(e,t,(i=t,function(e){var t;return null!=(t=e.getAttribute(i))?t:null}),function(e){return function(t,i){return null!==i?t.setAttribute(e,i):t.removeAttribute(e)}}(t),h)),r.attributes[t]}function x(e,t,i){if(i.isDirty){i.isDirty=!1;var r=i.virtualValue;i.mutations.length||function(e,t){var i,r,n=s.get(e);if(n)if("html"===t)null==(i=n.html)||null==(r=i.observer)||r.disconnect(),delete n.html;else if("class"===t){var o,a;null==(o=n.classes)||null==(a=o.observer)||a.disconnect(),delete n.classes}else if("position"===t){var l,u;null==(l=n.position)||null==(u=l.observer)||u.disconnect(),delete n.position}else{var c,d,h;null==(c=n.attributes)||null==(d=c[t])||null==(h=d.observer)||h.disconnect(),delete n.attributes[t]}}(e,t),i.setValue(e,r)}}function I(e,t){e.html&&x(t,"html",e.html),e.classes&&x(t,"class",e.classes),e.position&&x(t,"position",e.position),Object.keys(e.attributes).forEach(function(i){x(t,i,e.attributes[i])})}function P(){s.forEach(I)}function C(e){if("position"!==e.kind||1!==e.elements.size){var t=new Set(e.elements);document.querySelectorAll(e.selector).forEach(function(i){t.has(i)||(e.elements.add(i),function(e,t){var i=null;"html"===e.kind?i=v(t):"class"===e.kind?i=S(t):"attribute"===e.kind?i=A(t,e.attribute):"position"===e.kind&&(i=y(t)),i&&(i.mutations.push(e),i.mutationRunner(i))}(e,i))})}}function T(){o.forEach(C)}function O(){w&&w.disconnect()}function R(){"undefined"!=typeof document&&(w||(w=new MutationObserver(function(){T()})),T(),w.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!1,characterData:!1}))}function $(e){return"undefined"==typeof document?n:(o.add(e),C(e),{revert:function(){var t;(t=e).elements.forEach(function(e){return function(e,t){var i=null;if("html"===e.kind?i=v(t):"class"===e.kind?i=S(t):"attribute"===e.kind?i=A(t,e.attribute):"position"===e.kind&&(i=y(t)),i){var r=i.mutations.indexOf(e);-1!==r&&i.mutations.splice(r,1),i.mutationRunner(i)}}(t,e)}),t.elements.clear(),o.delete(t)}})}function D(e,t){return $({kind:"html",elements:new Set,mutate:t,selector:e})}function M(e,t){return $({kind:"position",elements:new Set,mutate:t,selector:e})}function L(e,t){return $({kind:"class",elements:new Set,mutate:t,selector:e})}function N(e,t,i){return r.test(t)?"class"===t||"className"===t?L(e,function(e){var t=i(Array.from(e).join(" "));e.clear(),t&&t.split(/\s+/g).filter(Boolean).forEach(function(t){return e.add(t)})}):$({kind:"attribute",attribute:t,elements:new Set,mutate:i,selector:e}):n}R();const F={html:D,classes:L,attribute:N,position:M,declarative:function(e){var t=e.selector,i=e.action,r=e.value,s=e.attribute,o=e.parentSelector,a=e.insertBeforeSelector;if("html"===s){if("append"===i)return D(t,function(e){return e+(null!=r?r:"")});if("set"===i)return D(t,function(){return null!=r?r:""})}else if("class"===s){if("append"===i)return L(t,function(e){r&&e.add(r)});if("remove"===i)return L(t,function(e){r&&e.delete(r)});if("set"===i)return L(t,function(e){e.clear(),r&&e.add(r)})}else if("position"===s){if("set"===i&&o)return M(t,function(){return{insertBeforeSelector:a,parentSelector:o}})}else{if("append"===i)return N(t,s,function(e){return null!==e?e+(null!=r?r:""):null!=r?r:""});if("set"===i)return N(t,s,function(){return null!=r?r:""});if("remove"===i)return N(t,s,function(){return null})}return n}}},656(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.default=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i},671(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e={},t,i=0){var o=(0,n.default)(l(l({},e),{},{_v6:!0}),new Uint8Array(16));if(o=(0,s.default)(o),t){for(var a=0;a<16;a++)t[i+a]=o[a];return t}return(0,r.unsafeStringify)(o)};var r=i(910),n=o(i(518)),s=o(i(343));function o(e){return e&&e.__esModule?e:{default:e}}function a(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,r)}return i}function l(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?a(Object(i),!0).forEach(function(t){u(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):a(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}function u(e,t,i){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var i=t.call(e,"string");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}},706(e,t,i){"use strict";var r=this&&this.__assign||function(){return r=Object.assign||function(e){for(var t,i=1,r=arguments.length;i<r;i++)for(var n in t=arguments[i])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},r.apply(this,arguments)},n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.RudderStack=void 0;var s=i(720),o=i(831),a=n(i(733)),l=function(){function e(e,t,i){void 0===t&&(t=!1);var n=this;this.analytics=new s.RudderAnalytics,this.has_identified=!1,this.has_initialized=!1,this.current_page="",this.rudderstack_anonymous_cookie_key="rudder_anonymous_id",this.getAnonymousId=function(){var e;return null===(e=document.cookie.match("(^|;)\\s*"+n.rudderstack_anonymous_cookie_key+"\\s*=\\s*([^;]+)"))||void 0===e?void 0:e.pop()},this.setCookieIfNotExists=function(){if(!n.getAnonymousId()){var e=window.location.hostname,t=["webflow.io"].some(function(t){return e.endsWith(t)})?e:e.split(".").slice(-2).join(".");document.cookie="".concat(n.rudderstack_anonymous_cookie_key,"=").concat((0,o.v6)(),"; path=/; Domain=").concat(t,"; max-age=").concat(63072e3)}},this.getUserId=function(){return n.analytics.getUserId()},this.handleCachedEvents=function(){var e=["deriv.com","deriv.team","deriv.ae"],t=e.some(function(e){return window.location.hostname.includes(e)})?".".concat(e.find(function(e){return window.location.hostname.includes(e)})):".".concat(e[0]),i=a.default.get("cached_analytics_events"),r=a.default.get("cached_analytics_page_views");try{if(i){var s=JSON.parse(i);Array.isArray(s)&&s.length>0&&(s.forEach(function(e){n.analytics.track(e.name,e.properties)}),a.default.remove("cached_analytics_events",{domain:t}))}if(r){var o=JSON.parse(r);Array.isArray(o)&&o.length>0&&(o.forEach(function(e){n.analytics.page(null==e?void 0:e.name,null==e?void 0:e.properties)}),a.default.remove("cached_analytics_page_views",{domain:t}))}}catch(e){console.log(e)}},this.init=function(e,t){var i;void 0===t&&(t=!1),e&&(t&&(i=window.define,window.define=void 0),n.setCookieIfNotExists(),n.analytics.load(e,"https://deriv-dataplane.rudderstack.com",{externalAnonymousIdCookieName:n.rudderstack_anonymous_cookie_key,onLoaded:function(){var e;t&&(window.define=i),n.has_initialized=!0,n.has_identified=!!n.getUserId(),n.handleCachedEvents(),null===(e=n.onLoadedCallback)||void 0===e||e.call(n)}}))},this.identifyEvent=function(e,t){n.getUserId()||n.analytics.identify(e,t),n.has_identified=!0},this.pageView=function(e,t,i,s){if(void 0===t&&(t="Deriv App"),n.has_initialized&&e!==n.current_page){var o=i?r({user_id:i},s):s;n.analytics.page(t,e,o),n.current_page=e}},this.reset=function(){n.has_initialized&&(n.analytics.reset(),n.has_identified=!1)},this.track=function(e,t){var i=Object.fromEntries(Object.entries(t).filter(function(e){return e[0],void 0!==e[1]}));if(n.has_initialized)try{n.analytics.track(e,i)}catch(e){console.error(e)}},this.onLoadedCallback=i,this.init(e,t)}return e.getRudderStackInstance=function(t,i,r){return void 0===i&&(i=!1),e._instance||(e._instance=new e(t,i,r)),e._instance},e}();t.RudderStack=l},707(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.clearAutoRefresh=x,t.clearCache=async function(){u.clear(),c.clear(),x(),l=!1,await f()},t.configureCache=function(e){Object.assign(n,e),n.backgroundSync||x()},t.helpers=void 0,t.onHidden=g,t.onVisible=p,t.refreshFeatures=async function(e){let{instance:t,timeout:i,skipCache:a,allowStale:c,backgroundSync:d}=e;return d||(n.backgroundSync=!1),async function(e){let{instance:t,allowStale:i,timeout:a,skipCache:c}=e;const d=v(t),g=_(t),p=new Date,f=new Date(p.getTime()-n.maxAge+n.staleTTL);await async function(){if(!l){l=!0;try{if(s.localStorage){const e=await s.localStorage.getItem(n.cacheKey);if(!n.disableCache&&e){const t=JSON.parse(e);t&&Array.isArray(t)&&t.forEach(e=>{let[t,i]=e;u.set(t,{...i,staleAt:new Date(i.staleAt)})}),m()}}}catch(e){}if(!n.disableIdleStreams){const e=o.startIdleListener();e&&(o.stopIdleListener=e)}}}();const y=n.disableCache||c?void 0:u.get(g);return y&&(i||y.staleAt>p)&&y.staleAt>f?(y.sse&&h.add(d),y.staleAt<p?b(t):w(t),{data:y.data,success:!0,source:"cache"}):await(0,r.promiseTimeout)(b(t),a)||{data:null,success:!1,source:"timeout",error:new Error("Timeout")}}({instance:t,allowStale:c,timeout:i,skipCache:a})},t.setPolyfills=function(e){Object.assign(s,e)},t.startStreaming=function(e,t){if(t.streaming){if(!e.getClientKey())throw new Error("Must specify clientKey to enable streaming");t.payload&&w(e,!0),function(e){const t=v(e),i=a.get(t)||new Set;i.add(e),a.set(t,i)}(e)}},t.unsubscribe=function(e){a.forEach(t=>t.delete(e))};var r=i(106);const n={staleTTL:6e4,maxAge:144e5,cacheKey:"gbFeaturesCache",backgroundSync:!0,maxEntries:10,disableIdleStreams:!1,idleStreamInterval:2e4,disableCache:!1},s=(0,r.getPolyfills)(),o=t.helpers={fetchFeaturesCall:e=>{let{host:t,clientKey:i,headers:r}=e;return s.fetch(`${t}/api/features/${i}`,{headers:r})},fetchRemoteEvalCall:e=>{let{host:t,clientKey:i,payload:r,headers:n}=e;const o={method:"POST",headers:{"Content-Type":"application/json",...n},body:JSON.stringify(r)};return s.fetch(`${t}/api/eval/${i}`,o)},eventSourceCall:e=>{let{host:t,clientKey:i,headers:r}=e;return r?new s.EventSource(`${t}/sub/${i}`,{headers:r}):new s.EventSource(`${t}/sub/${i}`)},startIdleListener:()=>{let e;if("undefined"==typeof window||"undefined"==typeof document)return;const t=()=>{"visible"===document.visibilityState?(window.clearTimeout(e),p()):"hidden"===document.visibilityState&&(e=window.setTimeout(g,n.idleStreamInterval))};return document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},stopIdleListener:()=>{}};try{globalThis.localStorage&&(s.localStorage=globalThis.localStorage)}catch(e){}const a=new Map;let l=!1;const u=new Map,c=new Map,d=new Map,h=new Set;function g(){d.forEach(e=>{e&&(e.state="idle",E(e))})}function p(){d.forEach(e=>{e&&"idle"===e.state&&S(e)})}async function f(){try{if(!s.localStorage)return;await s.localStorage.setItem(n.cacheKey,JSON.stringify(Array.from(u.entries())))}catch(e){}}function v(e){const[t,i]=e.getApiInfo();return`${t}||${i}`}function _(e){const t=v(e);if(!("isRemoteEval"in e)||!e.isRemoteEval())return t;const i=e.getAttributes(),r=e.getCacheKeyAttributes()||Object.keys(e.getAttributes()),n={};r.forEach(e=>{n[e]=i[e]});const s=e.getForcedVariations(),o=e.getUrl();return`${t}||${JSON.stringify({ca:n,fv:s,url:o})}`}function m(){const e=Array.from(u.entries()).map(e=>{let[t,i]=e;return{key:t,staleAt:i.staleAt.getTime()}}).sort((e,t)=>e.staleAt-t.staleAt),t=Math.min(Math.max(0,u.size-n.maxEntries),u.size);for(let i=0;i<t;i++)u.delete(e[i].key)}function y(e,t,i){const r=i.dateUpdated||"",s=new Date(Date.now()+n.staleTTL),o=n.disableCache?void 0:u.get(t);if(o&&r&&o.version===r)return o.staleAt=s,void f();n.disableCache||(u.set(t,{data:i,version:r,staleAt:s,sse:h.has(e)}),m()),f();const l=a.get(e);l&&l.forEach(e=>async function(e,t){await e.setPayload(t||e.getPayload())}(e,i))}async function b(e){const{apiHost:t,apiRequestHeaders:i}=e.getApiHosts(),r=e.getClientKey(),n="isRemoteEval"in e&&e.isRemoteEval(),s=v(e),a=_(e);let l=c.get(a);return l||(l=(n?o.fetchRemoteEvalCall({host:t,clientKey:r,payload:{attributes:e.getAttributes(),forcedVariations:e.getForcedVariations(),forcedFeatures:Array.from(e.getForcedFeatures().entries()),url:e.getUrl()},headers:i}):o.fetchFeaturesCall({host:t,clientKey:r,headers:i})).then(e=>{if(!e.ok)throw new Error(`HTTP error: ${e.status}`);return"enabled"===e.headers.get("x-sse-support")&&h.add(s),e.json()}).then(t=>(y(s,a,t),w(e),c.delete(a),{data:t,success:!0,source:"network"})).catch(e=>(c.delete(a),{data:null,source:"error",success:!1,error:e})),c.set(a,l)),l}function w(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=v(e),r=_(e),{streamingHost:o,streamingHostRequestHeaders:l}=e.getApiHosts(),u=e.getClientKey();if(t&&h.add(i),n.backgroundSync&&h.has(i)&&s.EventSource){if(d.has(i))return;const e={src:null,host:o,clientKey:u,headers:l,cb:t=>{try{if("features-updated"===t.type){const e=a.get(i);e&&e.forEach(e=>{b(e)})}else if("features"===t.type){const e=JSON.parse(t.data);y(i,r,e)}e.errors=0}catch(t){k(e)}},errors:0,state:"active"};d.set(i,e),S(e)}}function k(e){if("idle"!==e.state&&(e.errors++,e.errors>3||e.src&&2===e.src.readyState)){const t=Math.pow(3,e.errors-3)*(1e3+1e3*Math.random());E(e),setTimeout(()=>{["idle","active"].includes(e.state)||S(e)},Math.min(t,3e5))}}function E(e){e.src&&(e.src.onopen=null,e.src.onerror=null,e.src.close(),e.src=null,"active"===e.state&&(e.state="disabled"))}function S(e){e.src=o.eventSourceCall({host:e.host,clientKey:e.clientKey,headers:e.headers}),e.state="active",e.src.addEventListener("features",e.cb),e.src.addEventListener("features-updated",e.cb),e.src.onerror=()=>k(e),e.src.onopen=()=>{e.errors=0}}function A(e,t){E(e),d.delete(t)}function x(){h.clear(),d.forEach(A),a.clear(),o.stopIdleListener()}},720(e,t){"use strict";function i(e){return null!=e&&"object"==typeof e&&!0===e["@@functional/placeholder"]}function r(e){return function t(r){return 0===arguments.length||i(r)?t:e.apply(this,arguments)}}function n(e){return function t(n,s){switch(arguments.length){case 0:return t;case 1:return i(n)?t:r(function(t){return e(n,t)});default:return i(n)&&i(s)?t:i(n)?r(function(t){return e(t,s)}):i(s)?r(function(t){return e(n,t)}):e(n,s)}}}function s(e){return function t(s,o,a){switch(arguments.length){case 0:return t;case 1:return i(s)?t:n(function(t,i){return e(s,t,i)});case 2:return i(s)&&i(o)?t:i(s)?n(function(t,i){return e(t,o,i)}):i(o)?n(function(t,i){return e(s,t,i)}):r(function(t){return e(s,o,t)});default:return i(s)&&i(o)&&i(a)?t:i(s)&&i(o)?n(function(t,i){return e(t,i,a)}):i(s)&&i(a)?n(function(t,i){return e(t,o,i)}):i(o)&&i(a)?n(function(t,i){return e(s,t,i)}):i(s)?r(function(t){return e(t,o,a)}):i(o)?r(function(t){return e(s,t,a)}):i(a)?r(function(t){return e(s,o,t)}):e(s,o,a)}}}function o(e,t){return Object.prototype.hasOwnProperty.call(t,e)}Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});var a=r(function(e){return null===e?"Null":void 0===e?"Undefined":Object.prototype.toString.call(e).slice(8,-1)});function l(e){return"[object Object]"===Object.prototype.toString.call(e)}const u=Number.isInteger||function(e){return(0|e)===e};function c(e,t){return t[e<0?t.length+e:e]}function d(e,t,i){if(i||(i=new h),function(e){var t=typeof e;return null==e||"object"!=t&&"function"!=t}(e))return e;var r,n=function(t){var r=i.get(e);if(r)return r;for(var n in i.set(e,t),e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=d(e[n],0,i));return t};switch(a(e)){case"Object":return n(Object.create(Object.getPrototypeOf(e)));case"Array":return n(Array(e.length));case"Date":return new Date(e.valueOf());case"RegExp":return r=e,new RegExp(r.source,r.flags?r.flags:(r.global?"g":"")+(r.ignoreCase?"i":"")+(r.multiline?"m":"")+(r.sticky?"y":"")+(r.unicode?"u":"")+(r.dotAll?"s":""));case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"BigInt64Array":case"BigUint64Array":return e.slice();default:return e}}var h=function(){function e(){this.map={},this.length=0}return e.prototype.set=function(e,t){var i=this.hash(e),r=this.map[i];r||(this.map[i]=r=[]),r.push([e,t]),this.length+=1},e.prototype.hash=function(e){var t=[];for(var i in e)t.push(Object.prototype.toString.call(e[i]));return t.join()},e.prototype.get=function(e){if(this.length<=180){for(var t in this.map)for(var i=this.map[t],r=0;r<i.length;r+=1)if((s=i[r])[0]===e)return s[1]}else{var n=this.hash(e);if(i=this.map[n])for(r=0;r<i.length;r+=1){var s;if((s=i[r])[0]===e)return s[1]}}},e}(),g=r(function(e){return null!=e&&"function"==typeof e.clone?e.clone():d(e)});function p(e,t){for(var i=t,r=0;r<e.length;r+=1){if(null==i)return;var n=e[r];i=u(n)?c(n,i):i[n]}return i}var f=s(function(e,t,i){var r,n={};for(r in i=i||{},t=t||{})o(r,t)&&(n[r]=o(r,i)?e(r,t[r],i[r]):t[r]);for(r in i)o(r,i)&&!o(r,n)&&(n[r]=i[r]);return n}),v=s(function e(t,i,r){return f(function(i,r,n){return l(r)&&l(n)?e(t,r,n):t(i,r,n)},i,r)}),_=s(function(e,t,i){return v(function(t,i,r){return e(i,r)},t,i)}),m=n(p),y=n(function(e,t){var i={};for(var r in t)e(t[r],r,t)&&(i[r]=t[r]);return i});const b=e=>"function"==typeof e&&Boolean(e.constructor&&e.call&&e.apply),w=e=>"string"==typeof e,k=e=>null===e,E=e=>void 0===e,S=e=>k(e)||E(e),A=e=>!E(e),x=e=>!S(e),I=e=>{switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return e instanceof Error}},P=(e,t)=>{const i=t.split(".");return m(i,e)},C=e=>!k(e)&&"[object Object]"===Object.prototype.toString.call(e),T=(e,t)=>{if(!Array.isArray(e)||!Array.isArray(t))return g(t);const i=g(e);return t.forEach((e,t)=>{i[t]=Array.isArray(e)||(e=>!k(e)&&(e=>"object"==typeof e)(e)&&!Array.isArray(e))(e)?O(i[t],e):e}),i},O=(e,t)=>_(T,e,t),R=e=>C(e)&&Object.keys(e).length>0,$=e=>{const t=y(A,e);return Object.keys(t).forEach(e=>{const i=t[e];C(i)&&(t[e]=$(i))}),t},D=e=>{const t=y(x,e);return Object.keys(t).forEach(e=>{const i=t[e];C(i)&&(t[e]=D(i))}),t},M=e=>{if(R(e))return D(e)},L=(e,t)=>"boolean"==typeof e?e:t,N=e=>(Object.getOwnPropertyNames(e).forEach(function(t){e[t]&&"object"==typeof e[t]&&N(e[t])}),Object.freeze(e)),F=e=>e.replace(/^\.+/,""),B=e=>{let t=e;if(!w(e)&&!S(e))try{t=JSON.stringify(e)}catch(e){t=null}return t},U=(e,t,i,r,n)=>{const s={category:e,name:t,properties:i,options:r,callback:void 0};b(n)&&(s.callback=n),b(r)&&(s.category=e,s.name=t,s.properties=i,s.options=void 0,s.callback=r),b(i)&&(s.category=e,s.name=t,s.properties=void 0,s.options=void 0,s.callback=i),b(t)&&(s.category=e,s.name=void 0,s.properties=void 0,s.options=void 0,s.callback=t),b(e)&&(s.category=void 0,s.name=void 0,s.properties=void 0,s.options=void 0,s.callback=e),C(e)?(s.name=void 0,s.category=void 0,s.properties=e,b(t)?s.options=void 0:s.options=t):C(t)&&(s.name=void 0,s.properties=t,b(i)?s.options=void 0:s.options=i),w(e)&&!w(t)&&(s.category=void 0,s.name=e),A(s.category)||(s.category=void 0),A(s.name)||(s.name=void 0),s.properties=s.properties?g(s.properties):{},A(s.options)?s.options=g(s.options):s.options=void 0;const o=w(s.name)?s.name:s.properties.name,a=w(s.category)?s.category:s.properties.category;return s.properties=O(C(s.properties)?s.properties:{},{...o&&{name:o},...a&&{category:a}}),s},j=(e,t,i,r)=>{const n={name:e,properties:t,options:i,callback:void 0};return b(r)&&(n.callback=r),b(i)&&(n.properties=t,n.options=void 0,n.callback=i),b(t)&&(n.properties=void 0,n.options=void 0,n.callback=t),n.properties=x(n.properties)?g(n.properties):{},A(n.options)?n.options=g(n.options):n.options=void 0,n},V=(e,t,i,r)=>{const n={userId:e,traits:t,options:i,callback:void 0};return b(r)&&(n.callback=r),b(i)&&(n.userId=e,n.traits=t,n.options=void 0,n.callback=i),b(t)&&(n.userId=e,n.traits=void 0,n.options=void 0,n.callback=t),(C(e)||k(e))&&(n.userId=null,n.traits=e,b(t)?n.options=void 0:n.options=t),n.userId=B(n.userId),C(n.traits)?n.traits=g(n.traits):n.traits=void 0,A(n.options)?n.options=g(n.options):n.options=void 0,n},H=(e,t,i,r)=>{const n={to:e,from:t,options:i,callback:void 0};return b(r)&&(n.callback=r),b(i)&&(n.to=e,n.from=t,n.options=void 0,n.callback=i),b(t)?(n.to=e,n.from=void 0,n.options=void 0,n.callback=t):(C(t)||k(t))&&(n.to=e,n.from=void 0,n.options=t),A(n.to)&&(n.to=B(n.to)),A(n.from)?n.from=B(n.from):n.from=void 0,A(n.options)?n.options=g(n.options):n.options=void 0,n},G=(e,t,i,r)=>{const n={groupId:e,traits:t,options:i,callback:void 0};return b(r)&&(n.callback=r),b(i)&&(n.groupId=e,n.traits=t,n.options=void 0,n.callback=i),b(t)&&(n.groupId=e,n.traits=void 0,n.options=void 0,n.callback=t),(C(e)||k(e))&&(n.groupId=null,n.traits=e,b(t)?n.options=void 0:n.options=t),n.groupId=B(n.groupId),C(n.traits)?n.traits=g(n.traits):n.traits=void 0,A(n.options)?n.options=g(n.options):n.options=void 0,n};let q=function(e){return e.UNLOADED="Page Unloaded",e}({});const z="API",K="CapabilitiesManager",W="ConfigManager",J="EventManager",Y="PluginsManager",Q="UserSessionManager",Z="ErrorHandler",X="PluginEngine",ee=`Ready${z}`,te=`Load${z}`,ie="AnalyticsCore";for(var re,ne=[],se=0;se<256;se++)ne[se]=(se+256).toString(16).substring(1);for(var oe,ae=256,le=[];ae--;)le[ae]=(ae+256).toString(16).substring(1);const ue=()=>!S(globalThis.crypto)&&b(globalThis.crypto.getRandomValues)?function(){(!re||se+16>4096)&&(re=crypto.getRandomValues(new Uint8Array(4096)),se=0);for(var e,t=0,i="";t<16;t++)e=re[se+t],i+=6==t?ne[15&e|64]:8==t?ne[63&e|128]:ne[e],1&t&&t>1&&t<11&&(i+="-");return se+=16,i}():function(){var e,t=0,i="";if(!oe||ae+16>256){for(oe=Array(t=256);t--;)oe[t]=256*Math.random()|0;t=ae=0}for(;t<16;t++)e=oe[ae+t],i+=6==t?le[15&e|64]:8==t?le[63&e|128]:le[e],1&t&&t>1&&t<11&&(i+="-");return ae++,i}(),ce=()=>w(globalThis.navigator.userAgent)&&/Trident.*rv:11\./.test(globalThis.navigator.userAgent),de=e=>e.toISOString(),he=":: ",ge=(e,t,i)=>`Unable to load (${w(i)?i:i.type}) the script with the id "${e}" from URL "${t}"`,pe="[Circular Reference]",fe=(e,t,i)=>{const r=[];return function(n,s){if(!(t?.includes(n)||e&&S(s))){if("object"!=typeof s||k(s))return s;for(;r.length>0&&r[r.length-1]!==this;)r.pop();return r.includes(s)?(i?.warn(((e,t)=>`JSONStringify${he}A circular reference has been detected in the object and the property "${t}" has been dropped from the output.`)(0,n)),pe):(r.push(s),s)}}},ve=(e,t,i,r)=>{try{return JSON.stringify(e,fe(t,i,r))}catch(e){return r?.warn("Failed to convert the value to a JSON string.",e),null}},_e=e=>{const t=[];return function(e,i){if((e=>"bigint"==typeof e)(i))return"[BigInt]";for(;t.length>0&&t[t.length-1]!==this;)t.pop();return t.includes(i)?pe:(t.push(i),i)}},me=(e,t)=>{const i=Array.isArray(e)?[]:{};for(const r in e)if(Object.hasOwnProperty.call(e,r)){const n=e[r],s=t.call(e,r,n);C(s)||Array.isArray(s)?i[r]=me(s,t):i[r]=s}return i},ye=(e,t)=>{const i=_e(),r=i.call(e,"",e);return C(e)||Array.isArray(e)?me(e,i):r},be="[SDK DISPATCHED ERROR]",we=e=>{const{stack:t,stacktrace:i,"opera#sourceloc":r}=e,n=t??i??r;if(n&&"string"==typeof n)return n},ke=(e,t)=>{if(!I(e))return new Error(`${t}: ${ve(e)}`);try{const i=new(0,e.constructor)(`${t}: ${e.message}`),r=we(e);return r&&(i.stack=r),Object.getOwnPropertyNames(e).forEach(t=>{if("message"!==t&&"stack"!==t&&"name"!==t)try{i[t]=e[t]}catch{}}),i}catch{return new Error(`${t}: ${ve(e)}`)}},Ee=e=>{if(I(e)){const t=we(e);if(t){const{stack:i,stacktrace:r,"opera#sourceloc":n}=e;switch(t){case i:e.stack=`${i}\n${be}`;break;case r:e.stacktrace=`${r}\n${be}`;break;default:e["opera#sourceloc"]=`${n}\n${be}`}}}globalThis.dispatchEvent(new ErrorEvent("error",{error:e,bubbles:!0,cancelable:!0,composed:!0}))},Se="RudderLabs JavaScript SDK",Ae="3.26.0",xe="RudderJS-Initiated",Ie="preloadedEventsBuffer",Pe="ajs_aid",Ce="ajs_event",Te=432e5,Oe=18e5,Re=(e="app")=>{globalThis.RudderStackGlobals||(globalThis.RudderStackGlobals={}),globalThis.RudderStackGlobals[e]||(globalThis.RudderStackGlobals[e]={})},$e=(e,t,i="app")=>{Re(i),globalThis.RudderStackGlobals[i][e]=t},De=(e,t="app")=>(Re(t),globalThis.RudderStackGlobals[t][e]),Me=(e,t)=>{const i={};return e.forEach((r,n)=>{if(n.startsWith(t)){const r=n.substring(t.length);i[r]=e.get(n)}}),i},Le=(e,t)=>{const i=e.shift();let r;if(b(t[i])){switch(i){case"page":r=U(...e);break;case"track":r=j(...e);break;case"identify":r=V(...e);break;case"alias":r=H(...e);break;case"group":r=G(...e);break;default:t[i](...e)}r&&t[i](r)}};class Ne{constructor(e,t=1e4){this.logger=e,this.timeout=t}loadJSFile(e){const{url:t,id:i,timeout:r,async:n,callback:s,extraAttributes:o}=e,a=!b(s);((e,t,i,r=!0,n)=>new Promise((s,o)=>{document.getElementById(t)&&o(new Error((e=>`A script with the id "${e}" is already loaded. Skipping the loading of this script to prevent conflicts`)(t)));try{let a;(e=>{const t=document.getElementsByTagName("head");if(t.length>0)return void t[0]?.insertBefore(e,t[0]?.firstChild);const i=document.getElementsByTagName("script");if(i.length>0&&i[0]?.parentNode)return void i[0]?.parentNode.insertBefore(e,i[0]);const r=document.createElement("head");r.appendChild(e);const n=document.getElementsByTagName("html")[0];n?.insertBefore(r,n.firstChild)})(((e,t,i=!0,r=null,n=null,s={})=>{const o=document.createElement("script");return o.type="text/javascript",o.onload=r,o.onerror=n,o.src=e,o.id=t,o.async=i,Object.keys(s).forEach(e=>{o.setAttribute(e,s[e])}),o.setAttribute("data-loader","RS_JS_SDK"),o})(e,t,r,()=>{globalThis.clearTimeout(a),s(t)},i=>{globalThis.clearTimeout(a),o(new Error(ge(t,e,i)))},n)),a=globalThis.setTimeout(()=>{o(new Error(((e,t,i)=>`A timeout of ${i} ms occurred while trying to load the script with id "${e}" from URL "${t}"`)(t,e,i)))},i)}catch(i){o(ke(i,ge(t,e,"unknown")))}}))(t,i,r||this.timeout,n,o).then(e=>{a||s(e)}).catch(e=>{a||s(i,e)})}}var Fe=Symbol.for("preact-signals");function Be(){if(Ge>1)Ge--;else{for(var e,t=!1;void 0!==He;){var i=He;for(He=void 0,qe++;void 0!==i;){var r=i.o;if(i.o=void 0,i.f&=-3,!(8&i.f)&&Ye(i))try{i.c()}catch(i){t||(e=i,t=!0)}i=r}}if(qe=0,Ge--,t)throw e}}function Ue(e){if(Ge>0)return e();Ge++;try{return e()}finally{Be()}}var je=void 0;function Ve(e){var t=je;je=void 0;try{return e()}finally{je=t}}var He=void 0,Ge=0,qe=0,ze=0;function Ke(e){if(void 0!==je){var t=e.n;if(void 0===t||t.t!==je)return t={i:0,S:e,p:je.s,n:void 0,t:je,e:void 0,x:void 0,r:t},void 0!==je.s&&(je.s.n=t),je.s=t,e.n=t,32&je.f&&e.S(t),t;if(-1===t.i)return t.i=0,void 0!==t.n&&(t.n.p=t.p,void 0!==t.p&&(t.p.n=t.n),t.p=je.s,t.n=void 0,je.s.n=t,je.s=t),t}}function We(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.W=null==t?void 0:t.watched,this.Z=null==t?void 0:t.unwatched,this.name=null==t?void 0:t.name}function Je(e,t){return new We(e,t)}function Ye(e){for(var t=e.s;void 0!==t;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function Qe(e){for(var t=e.s;void 0!==t;t=t.n){var i=t.S.n;if(void 0!==i&&(t.r=i),t.S.n=t,t.i=-1,void 0===t.n){e.s=t;break}}}function Ze(e){for(var t=e.s,i=void 0;void 0!==t;){var r=t.p;-1===t.i?(t.S.U(t),void 0!==r&&(r.n=t.n),void 0!==t.n&&(t.n.p=r)):i=t,t.S.n=t.r,void 0!==t.r&&(t.r=void 0),t=r}e.s=i}function Xe(e,t){We.call(this,void 0),this.x=e,this.s=void 0,this.g=ze-1,this.f=4,this.W=null==t?void 0:t.watched,this.Z=null==t?void 0:t.unwatched,this.name=null==t?void 0:t.name}function et(e){var t=e.u;if(e.u=void 0,"function"==typeof t){Ge++;var i=je;je=void 0;try{t()}catch(t){throw e.f&=-2,e.f|=8,tt(e),t}finally{je=i,Be()}}}function tt(e){for(var t=e.s;void 0!==t;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,et(e)}function it(e){if(je!==this)throw new Error("Out-of-order effect");Ze(this),je=e,this.f&=-2,8&this.f&&tt(this),Be()}function rt(e,t){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32,this.name=null==t?void 0:t.name}function nt(e,t){var i=new rt(e,t);try{i.c()}catch(e){throw i.d(),e}var r=i.d.bind(i);return r[Symbol.dispose]=r,r}We.prototype.brand=Fe,We.prototype.h=function(){return!0},We.prototype.S=function(e){var t=this,i=this.t;i!==e&&void 0===e.e&&(e.x=i,this.t=e,void 0!==i?i.e=e:Ve(function(){var e;null==(e=t.W)||e.call(t)}))},We.prototype.U=function(e){var t=this;if(void 0!==this.t){var i=e.e,r=e.x;void 0!==i&&(i.x=r,e.e=void 0),void 0!==r&&(r.e=i,e.x=void 0),e===this.t&&(this.t=r,void 0===r&&Ve(function(){var e;null==(e=t.Z)||e.call(t)}))}},We.prototype.subscribe=function(e){var t=this;return nt(function(){var i=t.value,r=je;je=void 0;try{e(i)}finally{je=r}},{name:"sub"})},We.prototype.valueOf=function(){return this.value},We.prototype.toString=function(){return this.value+""},We.prototype.toJSON=function(){return this.value},We.prototype.peek=function(){var e=je;je=void 0;try{return this.value}finally{je=e}},Object.defineProperty(We.prototype,"value",{get:function(){var e=Ke(this);return void 0!==e&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(qe>100)throw new Error("Cycle detected");this.v=e,this.i++,ze++,Ge++;try{for(var t=this.t;void 0!==t;t=t.x)t.t.N()}finally{Be()}}}}),Xe.prototype=new We,Xe.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if(32==(36&this.f))return!0;if(this.f&=-5,this.g===ze)return!0;if(this.g=ze,this.f|=1,this.i>0&&!Ye(this))return this.f&=-2,!0;var e=je;try{Qe(this),je=this;var t=this.x();(16&this.f||this.v!==t||0===this.i)&&(this.v=t,this.f&=-17,this.i++)}catch(e){this.v=e,this.f|=16,this.i++}return je=e,Ze(this),this.f&=-2,!0},Xe.prototype.S=function(e){if(void 0===this.t){this.f|=36;for(var t=this.s;void 0!==t;t=t.n)t.S.S(t)}We.prototype.S.call(this,e)},Xe.prototype.U=function(e){if(void 0!==this.t&&(We.prototype.U.call(this,e),void 0===this.t)){this.f&=-33;for(var t=this.s;void 0!==t;t=t.n)t.S.U(t)}},Xe.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;void 0!==e;e=e.x)e.t.N()}},Object.defineProperty(Xe.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=Ke(this);if(this.h(),void 0!==e&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),rt.prototype.c=function(){var e=this.S();try{if(8&this.f)return;if(void 0===this.x)return;var t=this.x();"function"==typeof t&&(this.u=t)}finally{e()}},rt.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,et(this),Qe(this),Ge++;var e=je;return je=this,it.bind(this,e)},rt.prototype.N=function(){2&this.f||(this.f|=2,this.o=He,He=this)},rt.prototype.d=function(){this.f|=8,1&this.f||tt(this)},rt.prototype.dispose=function(){this.d()};class st{constructor(){this.items=[]}enqueue(e){this.items.push(e)}dequeue(){return 0===this.items.length?null:this.items.shift()}isEmpty(){return 0===this.items.length}size(){return this.items.length}clear(){this.items=[]}}const ot={LOG:0,INFO:1,DEBUG:2,WARN:3,ERROR:4,NONE:5},at="ERROR",lt=new class{constructor(e="LOG",t="",i=console){this.minLogLevel=ot[e],this.scope=t,this.logProvider=i}log(...e){this.outputLog("LOG",e)}info(...e){this.outputLog("INFO",e)}debug(...e){this.outputLog("DEBUG",e)}warn(...e){this.outputLog("WARN",e)}error(...e){this.outputLog("ERROR",e)}outputLog(e,t){this.minLogLevel<=ot[e]&&this.logProvider[e.toLowerCase()]?.(...this.formatLogData(t))}setScope(e){this.scope=e||this.scope}setMinLogLevel(e){this.minLogLevel=ot[e],E(this.minLogLevel)&&(this.minLogLevel=ot.LOG)}formatLogData(e){if(Array.isArray(e)&&e.length>0){let t="%c RS SDK";this.scope&&(t=`${t} - ${this.scope}`),t=`${t} %c ${w(e[0])?e[0].trim():""}`;const i=[t,"font-weight: bold; background: black; color: white;","font-weight: normal;"];return w(e[0])||i.push(e[0]),i.push(...e.slice(1)),i}return e}};let ut=function(e){return e.HANDLEDEXCEPTION="handledException",e.UNHANDLEDEXCEPTION="unhandledException",e.UNHANDLEDREJECTION="unhandledPromiseRejection",e}({});const ct=["localStorage","memoryStorage","cookieStorage","sessionStorage","none"],dt="cookieStorage",ht="Unable to process/parse source configuration response",gt="Failed to log breadcrumb",pt="Failed to fetch the source config",ft=e=>`${e}${he}The provided callback parameter is not a function.`,vt=(e,t,i)=>`${e} due to timeout or no connection (${t?t.type:""}) at the client side for URL: ${i}`,_t="Failed to set/remove cookies via server. As a fallback, the cookies will be managed client side.",mt={All:!0},yt="js-integrations",bt="plugins",wt=new RegExp("^(https?:\\/\\/)(((([a-zA-Z\\d]([a-zA-Z\\d-]*[a-zA-Z\\d])*)\\.)+[a-zA-Z]{2,}|localhost|((25[0-5]|2[0-4][0-9]|[0-1]?[0-9]?[0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[0-1]?[0-9]?[0-9]?)))(\\:\\d+)?(\\/[-a-zA-Z\\d%_.~+]*)*(\\?[;&a-zA-Z\\d%_.~+=-]*)?(\\#[-a-zA-Z\\d_]*)?$"),kt="modern",Et="https://cdn.rudderlabs.com",St="v3",At=`${Et}/${St}/${kt}/${yt}`,xt=`${Et}/${St}/${kt}/${bt}`,It="https://api.rudderstack.com",Pt="v3",Ct="xhr",Tt={iubenda:"IubendaConsentManager",oneTrust:"OneTrustConsentManager",ketch:"KetchConsentManager",custom:"CustomConsentManager"},Ot={[Pt]:"StorageEncryption",legacy:"StorageEncryptionLegacy"},Rt={[Ct]:"XhrQueue",beacon:"BeaconQueue"},$t=Je(g({configUrl:It,loadIntegration:!0,sessions:{autoTrack:!0,timeout:Oe,cutOff:{enabled:!1}},sameSiteCookie:"Lax",polyfillIfRequired:!0,integrations:mt,useBeacon:!1,beaconQueueOptions:{},destinationsQueueOptions:{},queueOptions:{},lockIntegrationsVersion:!0,lockPluginsVersion:!0,uaChTrackLevel:"none",plugins:[],useGlobalIntegrationsConfigInEvents:!1,bufferDataPlaneEventsUntilReady:!1,dataPlaneEventsBufferTimeout:1e4,storage:{encryption:{version:Pt},migrate:!0,cookie:{}},sendAdblockPage:!1,sameDomainCookiesOnly:!1,secureCookie:!1,sendAdblockPageOptions:{},useServerSideCookies:!1})),Dt=N({userId:"",userTraits:{},anonymousId:"",groupId:"",groupTraits:{},initialReferrer:"",initialReferringDomain:"",sessionInfo:{},authToken:null}),Mt=N({entries:{userId:!0,userTraits:!0,groupId:!0,groupTraits:!0,sessionInfo:!0,authToken:!0,anonymousId:!1,initialReferrer:!1,initialReferringDomain:!1}}),Lt={userId:Je(Dt.userId),userTraits:Je(Dt.userTraits),anonymousId:Je(Dt.anonymousId),groupId:Je(Dt.groupId),groupTraits:Je(Dt.groupTraits),initialReferrer:Je(Dt.initialReferrer),initialReferringDomain:Je(Dt.initialReferringDomain),sessionInfo:Je(Dt.sessionInfo),authToken:Je(Dt.authToken)},Nt={isOnline:Je(!0),storage:{isLocalStorageAvailable:Je(!1),isCookieStorageAvailable:Je(!1),isSessionStorageAvailable:Je(!1)},isBeaconAvailable:Je(!1),isLegacyDOM:Je(!1),isUaCHAvailable:Je(!1),isCryptoAvailable:Je(!1),isIE11:Je(!1),isAdBlockerDetectionInProgress:Je(!1),isAdBlocked:Je(void 0),cspBlockedURLs:Je([])},Ft={isErrorReportingEnabled:Je(!1),isMetricsReportingEnabled:Je(!1),breadcrumbs:Je([])},Bt=Je(void 0),Ut={activeDataplaneUrl:Je(void 0),integrationsCDNPath:Je(At),pluginsCDNPath:Je(xt),sourceConfigUrl:Je(void 0),status:Je(void 0),initialized:Je(!1),logLevel:Je(at),loaded:Je(!1),readyCallbacks:Je([]),writeKey:Je(void 0),dataPlaneUrl:Je(void 0),safeAnalyticsInstance:Je(void 0)},jt={enabled:Je(!1),initialized:Je(!1),data:Je({}),activeConsentManagerPluginName:Je(void 0),preConsent:Je({enabled:!1}),postConsent:Je({}),resolutionStrategy:Je("and"),provider:Je(void 0),metadata:Je(void 0)},Vt={retries:Je(0),dropped:Je(0),sent:Je(0),queued:Je(0),triggered:Je(0),metricsServiceUrl:Je(void 0)},Ht={app:Je({name:Se,namespace:"com.rudderlabs.javascript",version:Ae,installType:"npm"}),traits:Je(null),library:Je({name:Se,version:Ae,snippetVersion:globalThis.RudderSnippetVersion}),userAgent:Je(null),device:Je(null),network:Je(null),os:Je({name:"",version:""}),locale:Je(null),screen:Je({density:0,width:0,height:0,innerWidth:0,innerHeight:0}),"ua-ch":Je(void 0),timezone:Je(void 0)},Gt={configuredDestinations:Je([]),activeDestinations:Je([]),loadOnlyIntegrations:Je({}),failedDestinations:Je([]),loadIntegration:Je(!0),initializedDestinations:Je([]),clientDestinationsReady:Je(!1),integrationsConfig:Je({})},qt={toBeProcessedArray:Je([]),readyCallbacksArray:Je([])},zt={ready:Je(!1),loadedPlugins:Je([]),failedPlugins:Je([]),pluginsToLoadFromConfig:Je([]),activePlugins:Je([]),totalPluginsToLoad:Je(0)},Kt={encryptionPluginName:Je(void 0),migrate:Je(!1),type:Je(void 0),cookie:Je(void 0),entries:Je({}),trulyAnonymousTracking:Je(!1)},Wt={isEnabledServerSideCookies:Je(!1),dataServiceUrl:Je(void 0)},Jt={eventsQueuePluginName:Je(void 0),deliveryEnabled:Je(!0)},Yt={enabled:Je(!1),pageLifecycle:{enabled:Je(!1),pageViewId:Je(void 0),pageLoadedTimestamp:Je(void 0)}},Qt={...g({capabilities:Nt,consents:jt,context:Ht,eventBuffer:qt,lifecycle:Ut,loadOptions:$t,metrics:Vt,nativeDestinations:Gt,plugins:zt,reporting:Ft,session:Lt,source:Bt,storage:Kt,serverCookies:Wt,dataPlaneEvents:Jt,autoTrack:Yt})};function Zt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Xt,ei,ti={exports:{}},ii={exports:{}};var ri=(ei||(ei=1,function(e){var t,i,r,n;e.exports=(Xt||(Xt=1,function(e){e.exports=function(){function e(e){return!isNaN(parseFloat(e))&&isFinite(e)}function t(e){return e.charAt(0).toUpperCase()+e.substring(1)}function i(e){return function(){return this[e]}}var r=["isConstructor","isEval","isNative","isToplevel"],n=["columnNumber","lineNumber"],s=["fileName","functionName","source"],o=r.concat(n,s,["args"],["evalOrigin"]);function a(e){if(e)for(var i=0;i<o.length;i++)void 0!==e[o[i]]&&this["set"+t(o[i])](e[o[i]])}a.prototype={getArgs:function(){return this.args},setArgs:function(e){if("[object Array]"!==Object.prototype.toString.call(e))throw new TypeError("Args must be an Array");this.args=e},getEvalOrigin:function(){return this.evalOrigin},setEvalOrigin:function(e){if(e instanceof a)this.evalOrigin=e;else{if(!(e instanceof Object))throw new TypeError("Eval Origin must be an Object or StackFrame");this.evalOrigin=new a(e)}},toString:function(){var e=this.getFileName()||"",t=this.getLineNumber()||"",i=this.getColumnNumber()||"",r=this.getFunctionName()||"";return this.getIsEval()?e?"[eval] ("+e+":"+t+":"+i+")":"[eval]:"+t+":"+i:r?r+" ("+e+":"+t+":"+i+")":e+":"+t+":"+i}},a.fromString=function(e){var t=e.indexOf("("),i=e.lastIndexOf(")"),r=e.substring(0,t),n=e.substring(t+1,i).split(","),s=e.substring(i+1);if(0===s.indexOf("@"))var o=/@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(s,""),l=o[1],u=o[2],c=o[3];return new a({functionName:r,args:n||void 0,fileName:l,lineNumber:u||void 0,columnNumber:c||void 0})};for(var l=0;l<r.length;l++)a.prototype["get"+t(r[l])]=i(r[l]),a.prototype["set"+t(r[l])]=function(e){return function(t){this[e]=Boolean(t)}}(r[l]);for(var u=0;u<n.length;u++)a.prototype["get"+t(n[u])]=i(n[u]),a.prototype["set"+t(n[u])]=function(t){return function(i){if(!e(i))throw new TypeError(t+" must be a Number");this[t]=Number(i)}}(n[u]);for(var c=0;c<s.length;c++)a.prototype["get"+t(s[c])]=i(s[c]),a.prototype["set"+t(s[c])]=function(e){return function(t){this[e]=String(t)}}(s[c]);return a}()}(ii)),t=ii.exports,i=/(^|@)\S+:\d+/,r=/^\s*at .*(\S+:\d+|\(native\))/m,n=/^(eval@)?(\[native code])?$/,{parse:function(e){if(void 0!==e.stacktrace||void 0!==e["opera#sourceloc"])return this.parseOpera(e);if(e.stack&&e.stack.match(r))return this.parseV8OrIE(e);if(e.stack)return this.parseFFOrSafari(e);throw new Error("Cannot parse given Error object")},extractLocation:function(e){if(-1===e.indexOf(":"))return[e];var t=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));return[t[1],t[2]||void 0,t[3]||void 0]},parseV8OrIE:function(e){return e.stack.split("\n").filter(function(e){return!!e.match(r)},this).map(function(e){e.indexOf("(eval ")>-1&&(e=e.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(,.*$)/g,""));var i=e.replace(/^\s+/,"").replace(/\(eval code/g,"(").replace(/^.*?\s+/,""),r=i.match(/ (\(.+\)$)/);i=r?i.replace(r[0],""):i;var n=this.extractLocation(r?r[1]:i),s=r&&i||void 0,o=["eval","<anonymous>"].indexOf(n[0])>-1?void 0:n[0];return new t({functionName:s,fileName:o,lineNumber:n[1],columnNumber:n[2],source:e})},this)},parseFFOrSafari:function(e){return e.stack.split("\n").filter(function(e){return!e.match(n)},this).map(function(e){if(e.indexOf(" > eval")>-1&&(e=e.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),-1===e.indexOf("@")&&-1===e.indexOf(":"))return new t({functionName:e});var i=/((.*".+"[^@]*)?[^@]*)(?:@)/,r=e.match(i),n=r&&r[1]?r[1]:void 0,s=this.extractLocation(e.replace(i,""));return new t({functionName:n,fileName:s[0],lineNumber:s[1],columnNumber:s[2],source:e})},this)},parseOpera:function(e){return!e.stacktrace||e.message.indexOf("\n")>-1&&e.message.split("\n").length>e.stacktrace.split("\n").length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9:function(e){for(var i=/Line (\d+).*script (?:in )?(\S+)/i,r=e.message.split("\n"),n=[],s=2,o=r.length;s<o;s+=2){var a=i.exec(r[s]);a&&n.push(new t({fileName:a[2],lineNumber:a[1],source:r[s]}))}return n},parseOpera10:function(e){for(var i=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,r=e.stacktrace.split("\n"),n=[],s=0,o=r.length;s<o;s+=2){var a=i.exec(r[s]);a&&n.push(new t({functionName:a[3]||void 0,fileName:a[2],lineNumber:a[1],source:r[s]}))}return n},parseOpera11:function(e){return e.stack.split("\n").filter(function(e){return!!e.match(i)&&!e.match(/^Error created at/)},this).map(function(e){var i,r=e.split("@"),n=this.extractLocation(r.pop()),s=r.shift()||"",o=s.replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0;s.match(/\(([^)]*)\)/)&&(i=s.replace(/^[^(]+\(([^)]*)\)$/,"$1"));var a=void 0===i||"[arguments not available]"===i?void 0:i.split(",");return new t({functionName:o,args:a,fileName:n[0],lineNumber:n[1],columnNumber:n[2],source:e})},this)}})}(ti)),ti.exports);const ni=Zt(ri),si="global code",oi=e=>w(e)?e:"";function ai(e,t,i,r){return{errorClass:oi(e),message:`${i}${oi(t)}`,type:"browserjs",stacktrace:r.reduce((e,t)=>{const i=(e=>{const t={file:e.fileName,method:(i=e.functionName,A(i)&&/^global code$/i.test(i)?si:i),lineNumber:e.lineNumber,columnNumber:e.columnNumber};var i;return t.lineNumber&&t.lineNumber>-1&&!t.file&&!t.method&&(t.file=si),t})(t);try{return"{}"===JSON.stringify(i)?e:e.concat(i)}catch{return e}},[])}}const li=(e,t)=>{let i;var r,n;return I(e)&&w(we(e))?i=e:(t.warn((r=Z,n=ve(e),`${r}${he}Ignoring a non-error: ${n}.`)),i=void 0),i},ui=(e,t)=>{try{return JSON.parse(e||"")}catch(e){t(ke(e,"Failed to parse response data"))}},ci="The request failed",di=[new RegExp(`${ci}.*`),/A script with the id .* is already loaded\./],hi=[/Failed to fetch dynamically imported module: .*/,/Unable to load \(.*\) the script with the id .*/,/A timeout of \d+ ms occurred while trying to load the script with id .*/],gi={headers:{Accept:"application/json","Content-Type":"application/json;charset=UTF-8"},method:"GET"},pi=(e,t,i)=>{const r=O(gi,t||{});return i&&(r.headers=O(r.headers,{Authorization:i})),r.url=e,r},fi=(e,t=1e4,i)=>new Promise((r,n)=>{let s;if(!0===e.sendRawData)s=e.data;else if(s=ve(e.data,!1,[],i),k(s))return void n({error:new Error("Failed to prepare data for the request."),undefined:void 0,options:e});const o=new XMLHttpRequest,a=t=>{n({error:new Error(vt(ci,t,e.url)),xhr:o,options:e,..."timeout"===t?.type?{timedOut:!0}:{}})};o.ontimeout=a,o.onerror=a,o.onload=()=>{var t,i,s,a,l;o.status>=200&&o.status<400?r({response:o.responseText,xhr:o,options:e}):n({error:new Error((t=ci,i=o.status,s=o.statusText,a=e.url,l=o.responseText,`${t} with status ${i} (${s}) for URL: ${a}. Response: ${l.trim()}`)),xhr:o,options:e})},o.open(e.method,e.url,!0),!0===e.withCredentials&&(o.withCredentials=!0),o.timeout=t,Object.keys(e.headers).forEach(t=>{e.headers[t]&&o.setRequestHeader(t,e.headers[t])});try{o.send(s)}catch(t){n({error:ke(t,(l=ci,u=e.url,`${l} for URL: ${u}`)),xhr:o,options:e})}var l,u}),vi=new class{constructor(e){this.logger=e,this.onError=this.onError.bind(this)}init(e){this.errorHandler=e}async getData(e){const{url:t,options:i,timeout:r,isRawResponse:n}=e;try{const e=await fi(pi(t,i,this.basicAuthHeader),r,this.logger);return{data:n?e.response:ui(e.response,this.onError),details:e}}catch(e){return{data:void 0,details:e}}}getAsyncData(e){const{callback:t,url:i,options:r,timeout:n,isRawResponse:s}=e,o=!b(t);fi(pi(i,r,this.basicAuthHeader),n,this.logger).then(e=>{o||t(s?e.response:ui(e.response,this.onError),e)}).catch(e=>{o||t(void 0,e)})}onError(e,t){this.errorHandler?.onError({error:e,context:"HttpClient",groupingHash:t})}setAuthHeader(e,t=!1){const i=t?e:(e=>(e=>{const t=Array.from(e,e=>String.fromCodePoint(e)).join("");return globalThis.btoa(t)})((new TextEncoder).encode(e)))(`${e}:`);this.basicAuthHeader=`Basic ${i}`}resetAuthHeader(){this.basicAuthHeader=void 0}}(lt),_i=["www.test-host.com","localhost","127.0.0.1","[::1]"],mi=["userId","userTraits","groupId","groupTraits","anonymousId","config","integration","eventBuffer","traits","authToken"],yi=e=>{Qt.capabilities.isAdBlockerDetectionInProgress.value=!0;try{const t=new URL(Qt.lifecycle.sourceConfigUrl.value),i=`${t.origin}${t.pathname}?view=ad`;e.getAsyncData({url:i,options:{method:"HEAD",headers:{"Content-Type":void 0}},isRawResponse:!0,callback:(e,t)=>{Qt.capabilities.isAdBlockerDetectionInProgress.value=!1,Qt.capabilities.isAdBlocked.value=void 0!==t?.error||t?.xhr?.responseURL!==i}})}catch(e){throw Qt.capabilities.isAdBlockerDetectionInProgress.value=!1,e}},bi=(e=()=>window.location.hostname)=>{const t=e();return!t||t&&_i.includes(t)?"development":"production"},wi=e=>{const t=ve(e,!1,mi);return null!==t?JSON.parse(t):{}},ki=(e,t,i,r)=>({id:`${e.value?.id??i.writeKey.value}..${t.sessionInfo.value.id??"NA"}..${r.pageLifecycle.pageViewId.value??"NA"}`,name:e.value?.name??"NA"}),Ei=(e,t)=>({locale:e.value??"NA",userAgent:t.value??"NA",time:new Date}),Si=(e,t,i)=>{const r={version:"1",message_id:ue(),source:{name:"js",sdk_version:t.context.app.value.version,write_key:t.lifecycle.writeKey.value,install_type:t.context.app.value.installType,category:i??"sdk"},errors:e};return ve(r)},Ai=new class{initialized=!1;constructor(e,t){this.httpClient=e,this.logger=t}init(){this.initialized||(this.attachErrorListeners(),this.initialized=!0)}attachErrorListeners(){globalThis.addEventListener("error",e=>{this.onError({error:e,context:Z,errorType:ut.UNHANDLEDEXCEPTION})}),globalThis.addEventListener("unhandledrejection",e=>{this.onError({error:e,context:Z,errorType:ut.UNHANDLEDREJECTION})}),document.addEventListener("securitypolicyviolation",e=>{const t=w(e.blockedURI)?e.blockedURI:"";"enforce"===e.disposition&&t.startsWith(Et)&&!Qt.capabilities.cspBlockedURLs.value.includes(t)&&(Qt.capabilities.cspBlockedURLs.value=[...Qt.capabilities.cspBlockedURLs.value,t])})}async onError(e){try{const{error:t,context:i,customMessage:r,groupingHash:n,category:s}=e,o=e.errorType??ut.HANDLEDEXCEPTION,a=((e,t)=>{switch(t){case ut.UNHANDLEDEXCEPTION:{const{error:t}=e;return t||e}case ut.UNHANDLEDREJECTION:return e.reason;case ut.HANDLEDEXCEPTION:default:return e}})(t,o),l=li(a,this.logger);if(E(l))return;const u=((e,t)=>{try{const i=ni.parse(e);return ai(e.name,e.message,t,i)}catch{return ai(e.name,e.message,t,[])}})(l,`${i}${he}${r?`${r} - `:""}`),c=we(l).includes(be);if(!c&&!(e=>{const t=e.stacktrace[0]?.file;if(!t||"string"!=typeof t)return!1;const i=t.substring(t.lastIndexOf("/")+1),r=t.split("/");return r[r.length-2]===yt||["rsa"].some(e=>i.startsWith(e)&&i.endsWith(".js"))})(u)&&o!==ut.HANDLEDEXCEPTION)return;if(Qt.reporting.isErrorReportingEnabled.value&&await((e,t,i)=>{const r=e.message;return new Promise(e=>{if(hi.some(e=>e.test(r))){const n=/https?:\/\/[^\s"'(),;<>[\]{}]+/.exec(r)?.[0];w(n)?n.startsWith(Et)?t.capabilities.cspBlockedURLs.value.includes(n)?e(!1):((e,t,i)=>{if(E(e.capabilities.isAdBlocked.value)){!1===e.capabilities.isAdBlockerDetectionInProgress.value&&yi(t);const r=nt(()=>{A(e.capabilities.isAdBlocked.value)&&(i(!1===e.capabilities.isAdBlocked.value),r())})}else i(!1===e.capabilities.isAdBlocked.value)})(t,i,e):e(!1):e(!0)}else e(!di.some(e=>e.test(r)))})})(u,Qt,this.httpClient)){const e={severity:"error",unhandled:o!==ut.HANDLEDEXCEPTION,severityReason:{type:o}},t=((e,t,i,r)=>{let n;if("cdn"!==i.context.app.value.installType)return n;if(A(e))if(w(e))n=e;else{const i=li(e,r);n=A(i)?i.message:t}else n=t;return n})(n,u.message,Qt,this.logger),i=((e,t,i,r)=>{const{context:n,lifecycle:s,session:o,source:a,reporting:l,autoTrack:u}=i,{app:c,locale:d,userAgent:h,timezone:p,screen:f,library:v}=n;return{payloadVersion:"5",notifier:{name:"RudderStack JavaScript SDK",version:c.value.version,url:"git+https://github.com/rudderlabs/rudder-sdk-js.git"},events:[{exceptions:[g(e)],severity:t.severity,unhandled:t.unhandled,severityReason:t.severityReason,app:{version:c.value.version,releaseStage:bi(),type:c.value.installType},device:Ei(d,h),request:{url:globalThis.location.href.split("?")[0],clientIp:"[NOT COLLECTED]"},breadcrumbs:g(l.breadcrumbs.value),context:e.message,groupingHash:r,metaData:{app:{snippetVersion:v.value.snippetVersion},device:{...f.value,timezone:p.value},...wi(i)},user:ki(a,o,s,u)}]}})(u,e,Qt,t);this.httpClient.getAsyncData({url:Qt.metrics.metricsServiceUrl.value,options:{method:"POST",data:Si(i,Qt,s),sendRawData:!0},isRawResponse:!0})}(o===ut.HANDLEDEXCEPTION||c)&&this.logger.error(u.message)}catch(e){this.logger.error(`${Z}${he}Failed to handle the error.`,e)}}leaveBreadcrumb(e){try{Qt.reporting.breadcrumbs.value=[...Qt.reporting.breadcrumbs.value,(t=e,{type:"manual",name:t,timestamp:new Date,metaData:{}})]}catch(e){this.onError({error:e,context:Z,customMessage:gt,groupingHash:gt})}var t}}(vi,lt),xi=new class{plugins=[];byName={};cache={};config={throws:!0};constructor(e,t={}){this.config={throws:!0,...t},this.logger=e}register(e,t){if(!e.name){const t=`${X}${he}Plugin name is missing.`;if(this.config.throws)throw new Error(t);return void this.logger.error(t,e)}if(this.byName[e.name]){const t=(i=X,r=e.name,`${i}${he}Plugin "${r}" already exists.`);if(this.config.throws)throw new Error(t);return void this.logger.error(t)}var i,r;this.cache={},this.plugins=this.plugins.slice();let n=this.plugins.length;this.plugins.forEach((t,i)=>{t.deps?.includes(e.name)&&(n=Math.min(n,i))}),this.plugins.splice(n,0,e),this.byName[e.name]=e,b(e.initialize)&&e.initialize(t)}unregister(e){const t=this.byName[e];if(!t){const t=`${X}${he}Plugin "${e}" not found.`;if(this.config.throws)throw new Error(t);return void this.logger.error(t)}const i=this.plugins.indexOf(t);if(-1===i){const t=`${X}${he}Plugin "${e}" not found in plugins but found in byName. This indicates a bug in the plugin engine. Please report this issue to the development team.`;if(this.config.throws)throw new Error(t);return void this.logger.error(t)}this.cache={},delete this.byName[e],this.plugins=this.plugins.slice(),this.plugins.splice(i,1)}getPlugin(e){return this.byName[e]}getPlugins(e){const t=e??".";return this.cache[t]||(this.cache[t]=this.plugins.filter(e=>{if(e.deps?.some(e=>!this.byName[e])){const t=e.deps.filter(e=>!this.byName[e]);return this.logger.error(((e,t,i)=>`${e}${he}Plugin "${t}" could not be loaded because some of its dependencies "${i}" do not exist.`)(X,e.name,t)),!1}return"."===t||((e,t)=>Boolean(P(e,t)))(e,t)})),this.cache[t]}processRawPlugins(e){e(this.plugins),this.cache={}}invoke(e,t=!0,...i){let r=e;if(!r)throw new Error("Failed to invoke plugin because the extension point name is missing.");const n=r.startsWith("!"),s=this.config.throws??r.endsWith("!");if(r=r.replace(/(^!|!$)/g,""),!r)throw new Error("Failed to invoke plugin because the extension point name is invalid.");const o=r.split(".");o.pop();const a=o.join(".");return(t?this.getPlugins(r):[this.getPlugins(r)[0]]).map(e=>{const t=P(e,r);if(!b(t)||n)return t;try{return t.apply(P(e,a),i)}catch(t){if(s)throw t;this.logger.error(((e,t,i)=>`${e}${he}Failed to invoke the "${t}" extension point of plugin "${i}".`)(X,r,e.name),t)}return null})}invokeSingle(e,...t){return this.invoke(e,!1,...t)[0]}invokeMultiple(e,...t){return this.invoke(e,!0,...t)}}(lt,{throws:!0}),Ii=e=>Boolean("cloud"!==e.config.connectionMode||!0===e.config.useNativeSDKToSend||!0===e.config.useNativeSDK),Pi=e=>e.filter(Ii),Ci=["BeaconQueue","CustomConsentManager","DeviceModeDestinations","DeviceModeTransformation","ExternalAnonymousId","GoogleLinker","IubendaConsentManager","KetchConsentManager","NativeDestinationQueue","OneTrustConsentManager","StorageEncryption","StorageEncryptionLegacy","StorageMigrator","XhrQueue"],Ti=["Bugsnag","ErrorReporting"],Oi={rudderAnalyticsRemotePlugins:{url:()=>Promise.resolve(window.RudderStackGlobals&&window.RudderStackGlobals.app&&window.RudderStackGlobals.app.pluginsCDNPath?`${window.RudderStackGlobals.app.pluginsCDNPath}/rsa-plugins.js`:"https://cdn.rudderlabs.com/v3/modern/plugins//rsa-plugins.js"),format:"esm",from:"vite"}};function Ri(e,t){const i=Object.assign(e,t);for(const e of Object.keys(i))"object"==typeof i[e]&&"object"==typeof t[e]&&(i[e]=Ri(i[e],t[e]));return i}const $i=e=>Ri({},(globalThis.__federation_shared__||{}).default||{});function Di(e,t){if(!e?.default&&t){let t=Object.create(null);return t.default=e,t.__esModule=!0,t}return e}function Mi(e,t){return async function(e){const t=Oi[e];return t.inited?t.lib:["esm","systemjs"].includes(t.format)?new Promise((e,i)=>{("function"==typeof t.url?t.url:()=>Promise.resolve(t.url))().then(r=>{import(r).then(i=>{if(!t.inited){const e=$i();i.init(e),t.lib=i,t.lib.init(e),t.inited=!0}e(t.lib)}).catch(i)})}):void 0}(e).then(e=>e.get(t).then(e=>e()))}const Li=e=>(e=>{const t={};return e.forEach(e=>{if(Ci.includes(e)){const i=(e=>{switch(e){case"BeaconQueue":return()=>Mi("rudderAnalyticsRemotePlugins","./BeaconQueue").then(e=>Di(e,!0));case"CustomConsentManager":return()=>Mi("rudderAnalyticsRemotePlugins","./CustomConsentManager").then(e=>Di(e,!0));case"DeviceModeDestinations":return()=>Mi("rudderAnalyticsRemotePlugins","./DeviceModeDestinations").then(e=>Di(e,!0));case"DeviceModeTransformation":return()=>Mi("rudderAnalyticsRemotePlugins","./DeviceModeTransformation").then(e=>Di(e,!0));case"ExternalAnonymousId":return()=>Mi("rudderAnalyticsRemotePlugins","./ExternalAnonymousId").then(e=>Di(e,!0));case"GoogleLinker":return()=>Mi("rudderAnalyticsRemotePlugins","./GoogleLinker").then(e=>Di(e,!0));case"KetchConsentManager":return()=>Mi("rudderAnalyticsRemotePlugins","./KetchConsentManager").then(e=>Di(e,!0));case"IubendaConsentManager":return()=>Mi("rudderAnalyticsRemotePlugins","./IubendaConsentManager").then(e=>Di(e,!0));case"NativeDestinationQueue":return()=>Mi("rudderAnalyticsRemotePlugins","./NativeDestinationQueue").then(e=>Di(e,!0));case"OneTrustConsentManager":return()=>Mi("rudderAnalyticsRemotePlugins","./OneTrustConsentManager").then(e=>Di(e,!0));case"StorageEncryption":return()=>Mi("rudderAnalyticsRemotePlugins","./StorageEncryption").then(e=>Di(e,!0));case"StorageEncryptionLegacy":return()=>Mi("rudderAnalyticsRemotePlugins","./StorageEncryptionLegacy").then(e=>Di(e,!0));case"StorageMigrator":return()=>Mi("rudderAnalyticsRemotePlugins","./StorageMigrator").then(e=>Di(e,!0));case"XhrQueue":return()=>Mi("rudderAnalyticsRemotePlugins","./XhrQueue").then(e=>Di(e,!0));default:return}})(e);i&&(t[e]=i)}}),t})?.(e)||{},Ni={};class Fi{constructor(e,t,i){this.engine=e,this.errorHandler=t,this.logger=i,this.onError=this.onError.bind(this)}init(){Qt.lifecycle.status.value="pluginsLoading",$e("pluginsCDNPath",Qt.lifecycle.pluginsCDNPath.value),this.setActivePlugins(),this.registerLocalPlugins(),this.registerRemotePlugins(),this.attachEffects()}attachEffects(){nt(()=>{(0===Qt.plugins.activePlugins.value.length||Qt.plugins.loadedPlugins.value.length+Qt.plugins.failedPlugins.value.length===Qt.plugins.totalPluginsToLoad.value)&&Ue(()=>{Qt.plugins.ready.value=!0,Qt.lifecycle.status.value="pluginsReady"})})}getPluginsToLoadBasedOnConfig(){let e=Qt.plugins.pluginsToLoadFromConfig.value;if(!e)return[];e=e.filter(e=>!Ti.includes(e)||(this.logger.warn(((e,t)=>`${e}${he}${t} plugin is deprecated. Please exclude it from the load API options.`)(Y,e)),!1));return[{configurationStatus:()=>A(Qt.dataPlaneEvents.eventsQueuePluginName.value),configurationStatusStr:"Data plane events delivery is enabled",activePluginName:Qt.dataPlaneEvents.eventsQueuePluginName.value,supportedPlugins:Object.values(Rt),shouldAddMissingPlugins:!0},{configurationStatus:()=>Pi(Qt.nativeDestinations.configuredDestinations.value).length>0,configurationStatusStr:"Device mode destinations are connected to the source",supportedPlugins:["DeviceModeDestinations","NativeDestinationQueue"]},{configurationStatus:()=>Pi(Qt.nativeDestinations.configuredDestinations.value).some(e=>e.shouldApplyDeviceModeTransformation),configurationStatusStr:"Device mode transformations are enabled for at least one destination",supportedPlugins:["DeviceModeTransformation"]},{configurationStatus:()=>A(Qt.consents.activeConsentManagerPluginName.value),configurationStatusStr:"Consent management is enabled",activePluginName:Qt.consents.activeConsentManagerPluginName.value,supportedPlugins:Object.values(Tt)},{configurationStatus:()=>A(Qt.storage.encryptionPluginName.value),configurationStatusStr:"Storage encryption is enabled",activePluginName:Qt.storage.encryptionPluginName.value,supportedPlugins:Object.values(Ot)},{configurationStatus:()=>Qt.storage.migrate.value,configurationStatusStr:"Storage migration is enabled",supportedPlugins:["StorageMigrator"]}].forEach(t=>{t.configurationStatus()?(e=e.filter(t.activePluginName?e=>!(e!==t.activePluginName&&t.supportedPlugins.includes(e)):e=>A(e)),this.addMissingPlugins(t,!1,e)):e=e.filter(void 0!==t.basePlugins?e=>!(t.basePlugins.includes(e)||t.supportedPlugins.includes(e)):e=>!t.supportedPlugins.includes(e))}),[...Object.keys({}),...e]}addMissingPlugins(e,t,i){const r=e.shouldAddMissingPlugins||t;let n;n=e.activePluginName?[...e.basePlugins||[],e.activePluginName]:[...e.supportedPlugins];const s=n.filter(e=>!i.includes(e));s.length>0&&(r&&i.push(...s),this.logger.warn(((e,t,i,r)=>{const n=1===i.length,s=n?` '${i[0]}' plugin was`:` ['${i.join("', '")}'] plugins were`,o=`${e}${he}${t}, but${s} not configured to load.`;return r?`${o} So, ${n?"the plugin":"those plugins"} will be loaded automatically.`:`${o} Ignore if this was intentional. Otherwise, consider adding ${n?"it":"them"} to the 'plugins' load API option.`})(Y,e.configurationStatusStr,s,r)))}setActivePlugins(){const e=this.getPluginsToLoadBasedOnConfig(),t=[...Object.keys(Ni),...Ci],i=[],r=[];e.forEach(e=>{t.includes(e)?i.push(e):r.push(e)}),r.length>0&&this.logger.warn(`${Y}${he}Ignoring unknown plugins: ${r.join(", ")}.`),Ue(()=>{Qt.plugins.totalPluginsToLoad.value=e.length,Qt.plugins.activePlugins.value=i,Qt.plugins.failedPlugins.value=r})}registerLocalPlugins(){Object.values(Ni).forEach(e=>{b(e)&&Qt.plugins.activePlugins.value.includes(e().name)&&this.register([e()])})}registerRemotePlugins(){const e=(t=Qt.plugins.activePlugins.value,{...Li(t)});var t;Promise.all(Object.keys(e).map(async t=>{await e[t]().then(e=>this.register([e.default()])).catch(e=>{Qt.plugins.failedPlugins.value=[...Qt.plugins.failedPlugins.value,t],this.onError(e,`Failed to load plugin "${t}"`,e)})})).catch(e=>{this.onError(e)})}invokeMultiple(e,...t){try{return this.engine.invokeMultiple(e,...t)}catch(t){return this.onError(t,e),[]}}invokeSingle(e,...t){try{return this.engine.invokeSingle(e,...t)}catch(t){return this.onError(t,e),null}}register(e){e.forEach(e=>{try{this.engine.register(e,Qt)}catch(t){Qt.plugins.failedPlugins.value=[...Qt.plugins.failedPlugins.value,e.name],this.onError(t,`Failed to register plugin "${e.name}"`)}})}unregisterLocalPlugins(){Object.values(Ni).forEach(e=>{try{this.engine.unregister(e().name)}catch(t){this.onError(t,`Failed to unregister plugin "${e().name}"`)}})}onError(e,t,i){this.errorHandler.onError({error:e,context:Y,customMessage:t,groupingHash:i})}}const Bi="cookieStorage",Ui="localStorage",ji="sessionStorage",Vi="memoryStorage",Hi="none",Gi={userId:"rl_user_id",userTraits:"rl_trait",anonymousId:"rl_anonymous_id",groupId:"rl_group_id",groupTraits:"rl_group_trait",initialReferrer:"rl_page_init_referrer",initialReferringDomain:"rl_page_init_referring_domain",sessionInfo:"rl_session",authToken:"rl_auth_token"},qi="clientDataInCookie",zi="clientDataInLocalStorage",Ki="clientDataInSessionStorage",Wi=["userId","userTraits","anonymousId","groupId","groupTraits","initialReferrer","initialReferringDomain","sessionInfo","authToken"],Ji={[Bi]:qi,[Ui]:zi,[Vi]:"clientDataInMemory",[ji]:Ki},Yi=(e,t)=>{try{return encodeURIComponent(e)}catch(e){return void t?.error("Failed to encode the cookie data.",e)}},Qi=e=>{try{return decodeURIComponent(e)}catch(e){return}},Zi=()=>(e=>{const t={},i=e.split(/\s*;\s*/);let r;return i[0]?(i.forEach(e=>{r=e.split("=");const i=r[0]?Qi(r[0]):void 0;i&&(t[i]=r[1]?Qi(r[1]):void 0)}),t):t})(globalThis.document.cookie),Xi=function(e,t,i,r){switch(arguments.length){case 4:case 3:case 2:return((e,t,i,r)=>{const n={...i||{}};let s=`${Yi(e,r)}=${Yi(t,r)}`;k(t)&&(n.maxage=-1),n.maxage&&(n.expires=new Date(+new Date+n.maxage)),n.path&&(s+=`; path=${n.path}`),n.domain&&(s+=`; domain=${n.domain}`),n.expires&&(s+=`; expires=${n.expires.toUTCString()}`),n.samesite&&(s+=`; samesite=${n.samesite}`),n.secure&&(s+="; secure"),globalThis.document.cookie=s})(e,t,i,r);case 1:return e?(e=>Zi()[e])(e):Zi();default:return Zi()}},er=()=>{const e=`.${(()=>{const e=(e=>{const t="function"!=typeof globalThis.URL?(e=>{const t=document.createElement("a");return t.href=e,t.hostname})(e):new URL(e).hostname,i=t?.split(".")??[],r=i[i.length-1],n=[];if(4===i.length&&r&&r===parseInt(r,10).toString())return n;if(i.length<=1)return i[0]&&-1!==i[0].indexOf("localhost")?["localhost"]:n;for(let e=i.length-2;e>=0;e-=1)n.push(i.slice(e).join("."));return n})(globalThis.location.href);for(let t=0;t<e.length;t+=1){const i=e[t],r="__tld__",n={domain:`${-1!==i.indexOf("localhost")?"":"."}${i}`};try{if(Xi(r,1,n),Xi(r))return Xi(r,null,n),i}catch{try{Xi(r,null,n)}catch{}}}return""})()}`;return{maxage:31536e6,path:"/",domain:e&&"."!==e?e:void 0,samesite:"Lax",enabled:!0}},tr=new class{isEnabled=!0;length=0;data={};constructor(e){this.options={enabled:!0},this.logger=e}configure(e){return this.options=O(this.options,e??{}),this.isEnabled=Boolean(this.options.enabled),this.options}setItem(e,t){return this.data[e]=t,this.length=Object.keys(this.data).length,t}getItem(e){return e in this.data?this.data[e]:null}removeItem(e){return e in this.data&&delete this.data[e],this.length=Object.keys(this.data).length,null}clear(){this.data={},this.length=0}key(e){return this.keys()[e]??null}keys(){return Object.keys(this.data)}}(lt);var ir,rr={exports:{}},nr=(ir||(ir=1,function(e){e.exports=function(){function e(e){return e=JSON.stringify(e),!!/^\{[\s\S]*\}$/.test(e)}function t(e){if("string"==typeof e)try{return JSON.parse(e)}catch(t){return e}}function i(e){return"[object Function]"==={}.toString.call(e)}var r=function(e){var t="_Is_Incognit";try{e||(e=window.localStorage),e.setItem(t,"yes"),e.removeItem(t)}catch(t){var i={_data:{},setItem:function(e,t){return i._data[e]=String(t)},getItem:function(e){return i._data.hasOwnProperty(e)?i._data[e]:void 0},removeItem:function(e){return delete i._data[e]},clear:function(){return i._data={}}};e=i}finally{"yes"===e.getItem(t)&&e.removeItem(t)}return e}();function n(){if(!(this instanceof n))return new n}n.prototype={set:function(t,i){if(t&&!e(t))r.setItem(t,function(e){return void 0===e||"function"==typeof e?e+"":JSON.stringify(e)}(i));else if(e(t))for(var n in t)this.set(n,t[n]);return this},get:function(e){if(void 0===e){var i={};return this.forEach(function(e,t){return i[e]=t}),i}if("?"===e.charAt(0))return this.has(e.substr(1));var n=arguments;if(n.length>1){for(var s={},o=0,a=n.length;o<a;o++){var l=t(r.getItem(n[o]));this.has(n[o])&&(s[n[o]]=l)}return s}return t(r.getItem(e))},clear:function(){return r.clear(),this},remove:function(e){var t=this.get(e);return r.removeItem(e),t},has:function(e){return{}.hasOwnProperty.call(this.get(),e)},keys:function(){var e=[];return this.forEach(function(t){e.push(t)}),e},forEach:function(e){for(var t=0,i=r.length;t<i;t++){var n=r.key(t);e(n,this.get(n))}return this},search:function(e){for(var t=this.keys(),i={},r=0,n=t.length;r<n;r++)t[r].indexOf(e)>-1&&(i[t[r]]=this.get(t[r]));return i},len:function(){return r.length}};var s=null;function o(t,r){var a,l=arguments,u=null;if(s||(s=n()),0===l.length)return s.get();if(1===l.length){if("string"==typeof t)return s.get(t);if(e(t))return s.set(t)}if(2===l.length&&"string"==typeof t){if(!r)return s.remove(t);if(r&&"string"==typeof r)return s.set(t,r);r&&i(r)&&(u=null,u=r(t,s.get(t)),o.set(t,u))}if(2===l.length&&(a=t,"[object Array]"===Object.prototype.toString.call(a))&&i(r))for(var c=0,d=t.length;c<d;c++)u=r(t[c],s.get(t[c])),o.set(t[c],u);return o}for(var a in n.prototype)o[a]=n.prototype[a];return o}()}(rr)),rr.exports);const sr=Zt(nr),or=e=>e instanceof DOMException&&(["QuotaExceededError","NS_ERROR_DOM_QUOTA_REACHED"].includes(e.name)||[22,1014].includes(e.code)),ar=(e=Ui,t,i)=>{let r,n;const s=`${K}${he}The "${e}" storage type is `;let o,a="unavailable",l=!0;try{switch(e){case Vi:return!0;case Bi:r=t,n="test_rudder_cookie";break;case Ui:r=t??globalThis.localStorage,n="test_rudder_ls";break;case ji:r=t??globalThis.sessionStorage,n="test_rudder_ss";break;default:return!1}if(r&&(r.setItem(n,"true"),r.getItem(n)))return r.removeItem(n),!0;l=!1}catch(e){l=!1,o=e,or(e)&&(a="full")}return l||i?.warn(`${s}${a}.`,o),!1},lr=new class{isSupportAvailable=!0;isEnabled=!0;length=0;constructor(e){this.options={enabled:!0},this.logger=e}configure(e){return this.options=O(this.options,e??{}),this.isSupportAvailable=ar(Ui),this.isEnabled=Boolean(this.options.enabled&&this.isSupportAvailable),this.options}setItem(e,t){sr.set(e,t),this.length=sr.len()}getItem(e){const t=sr.get(e);return E(t)?null:t}removeItem(e){sr.remove(e),this.length=sr.len()}clear(){sr.clear(),this.length=0}key(e){return this.keys()[e]??null}keys(){return sr.keys()}}(lt),ur=new class{isSupportAvailable=!0;isEnabled=!0;length=0;constructor(e){this.options={enabled:!0},this.logger=e}configure(e){return this.options=O(this.options,e??{}),this.isSupportAvailable=ar(ji),this.isSupportAvailable&&(this.store=globalThis.sessionStorage),this.isEnabled=Boolean(this.options.enabled&&this.isSupportAvailable),this.options}setItem(e,t){this.store&&(this.store.setItem(e,t),this.length=this.store.length)}getItem(e){if(!this.store)return null;const t=this.store.getItem(e);return E(t)?null:t}removeItem(e){this.store&&(this.store.removeItem(e),this.length=this.store.length)}clear(){this.store?.clear(),this.length=0}key(e){return this.store?.key(e)??null}keys(){const e=[];if(!this.store)return e;for(let t=0;t<this.store.length;t+=1){const i=this.store.key(t);null!==i&&e.push(i)}return e}}(lt),cr=new class{isSupportAvailable=!0;isEnabled=!0;length=0;constructor(e){this.logger=e}configure(e){return this.options||(this.options=er()),this.options=O(this.options,e??{}),this.options.sameDomainCookiesOnly&&delete this.options.domain,this.isSupportAvailable=ar(Bi,this),this.isEnabled=Boolean(this.options.enabled&&this.isSupportAvailable),this.options}setItem(e,t){return Xi(e,t,this.options,this.logger),this.length=Object.keys(Xi()).length,!0}getItem(e){const t=Xi(e);return E(t)?null:t}removeItem(e){const t=this.setItem(e,null);return this.length=Object.keys(Xi()).length,t}clear(){}key(e){return this.keys()[e]??null}keys(){return Object.keys(Xi())}}(lt),dr=e=>{switch(e){case Ui:return lr;case ji:return ur;case Vi:return tr;case Bi:return cr;default:return tr}};class hr{constructor(e,t,i){this.id=e.id,this.name=e.name,this.isEncrypted=e.isEncrypted??!1,this.validKeys=e.validKeys??{},this.engine=t,this.noKeyValidation=0===Object.keys(this.validKeys).length,this.noCompoundKey=e.noCompoundKey,this.originalEngine=this.engine,this.errorHandler=e.errorHandler,this.logger=e.logger,this.pluginsManager=i}createValidKey(e){const{name:t,id:i,validKeys:r,noKeyValidation:n,noCompoundKey:s}=this;if(n)return s?e:[t,i,e].join(".");let o;return Object.values(r).forEach(r=>{r===e&&(o=s?e:[t,i,e].join("."))}),o}swapQueueStoreToInMemoryEngine(){const{name:e,id:t,validKeys:i,noCompoundKey:r}=this,n=dr(Vi);Object.keys(i).forEach(s=>{const o=this.get(i[s]),a=r?s:[e,t,s].join(".");n.setItem(a,o),this.remove(s)}),this.engine=n}set(e,t){const i=this.createValidKey(e);if(i)try{this.engine.setItem(i,this.encrypt(ve(t,!1,[],this.logger)))}catch(i){if(or(i))this.logger.warn(`Store ${this.id}${he}The storage is either full or unavailable, so the data will not be persisted. Switching to in-memory storage.`),this.swapQueueStoreToInMemoryEngine(),this.set(e,t);else{const t=(e=>`Failed to save the value for "${e}" to storage`)(e);this.onError(i,t,t)}}}get(e){const t=this.createValidKey(e);let i;try{return t?(i=this.decrypt(this.engine.getItem(t)),S(i)||""===i?null:JSON.parse(i)):null}catch(t){const i=(e=>`Failed to retrieve or parse data for "${e}" from storage`)(e);return this.onError(t,i,i),null}}remove(e){const t=this.createValidKey(e);t&&this.engine.removeItem(t)}getOriginalEngine(){return this.originalEngine}decrypt(e){return S(e)?null:this.crypto(e,"decrypt")}encrypt(e){return this.crypto(e,"encrypt")}crypto(e,t){const i=!this.isEncrypted||!e||"string"!=typeof e||""===(e=>e.replace(/^\s+|\s+$/gm,""))(e);if(i)return e;const r=`storage.${t}`,n=this.pluginsManager?this.pluginsManager.invokeSingle(r,e):e;return void 0===n?e:n??""}onError(e,t,i){this.errorHandler.onError({error:e,context:`Store ${this.id}`,customMessage:t,groupingHash:i})}}class gr{stores={};isInitialized=!1;constructor(e,t,i){this.errorHandler=t,this.logger=i,this.pluginsManager=e}init(){if(this.isInitialized)return;const e=Qt.loadOptions.value,t={cookieStorageOptions:{samesite:e.sameSiteCookie,secure:e.secureCookie,domain:e.setCookieDomain,sameDomainCookiesOnly:e.sameDomainCookiesOnly},localStorageOptions:{},inMemoryStorageOptions:{},sessionStorageOptions:{}};((e={},t={},i={},r={})=>{var n;(e=>{const t=cr.configure(e);Qt.storage.cookie.value={maxage:t.maxage,path:t.path,domain:t.domain,samesite:t.samesite,expires:t.expires,secure:t.secure}})(e),n=t,lr.configure(n),(e=>{tr.configure(e)})(i),(e=>{ur.configure(e)})(r)})($(O(t.cookieStorageOptions??{},Qt.storage.cookie?.value??{})),$(t.localStorageOptions),$(t.inMemoryStorageOptions),$(t.sessionStorageOptions)),this.initClientDataStores(),this.isInitialized=!0}initClientDataStores(){this.initializeStorageState(),[Vi,Ui,Bi,ji].forEach(e=>{dr(e)?.isEnabled&&this.setStore({id:Ji[e],name:Ji[e],isEncrypted:!0,noCompoundKey:!0,type:e,errorHandler:this.errorHandler,logger:this.logger})})}initializeStorageState(){let e=Qt.storage.type.value,t=Qt.loadOptions.value.storage?.entries;const i=Qt.consents.postConsent.value.storage;(A(i?.type)||A(i?.entries))&&(e=i?.type,t=i?.entries);let r=!0,n={};Wi.forEach(i=>{const s=i,o=i,a=t?.[s]?.type,l=((e,t)=>{let i;if(e.consents.preConsent.value.enabled)switch(e.consents.preConsent.value.storage?.strategy){case"none":i=Hi;break;case"session":"sessionInfo"!==t&&(i=Hi);break;case"anonymousId":"anonymousId"!==t&&(i=Hi)}return i})(Qt,i),u=l??a??e??dt,c=this.getResolvedStorageTypeForEntry(u,i);c!==Hi&&(r=!1),n={...n,[i]:{type:c,key:Gi[o]}}}),Ue(()=>{Qt.storage.type.value=e,Qt.storage.entries.value=n,Qt.storage.trulyAnonymousTracking.value=r})}getResolvedStorageTypeForEntry(e,t){let i=e;switch(e){case Ui:dr(Ui)?.isEnabled||(i=Vi);break;case ji:dr(ji)?.isEnabled||(i=Vi);break;case Vi:case Hi:break;default:i=dr(Bi)?.isEnabled?Bi:dr(Ui)?.isEnabled?Ui:dr(ji)?.isEnabled?ji:Vi}return i!==e&&this.logger.warn(((e,t,i,r)=>`StoreManager${he}The storage type "${i}" is not available for entry "${t}". The SDK will initialize the entry with "${r}" storage type instead.`)(0,t,e,i)),i}setStore(e){const t=dr(e.type);return this.stores[e.id]=new hr(e,t,this.pluginsManager),this.stores[e.id]}getStore(e){return this.stores[e]}}const pr=e=>{const t=new URL(e),{host:i,protocol:r}=t,n=i.split(".");let s;return s=n.length>2?`${n[n.length-2]}.${n[n.length-1]}`:i,{topDomain:s,protocol:r}},fr=e=>e?.endsWith("/")?fr(e.substring(0,e.length-1)):e,vr=e=>{try{return new URL(e).host}catch(e){return null}},_r=e=>vr(e)??"",mr=e=>{const t={};try{const i=new URL(e),r="utm_";i.searchParams.forEach((e,i)=>{if(i.startsWith(r)){let n=i.substring(r.length);"campaign"===n&&(n="name"),t[n]=e}})}catch(e){}return t},yr=e=>{if(!w(e))return!1;try{return b(globalThis.URL)&&new URL(e),wt.test(e)}catch(e){return!1}},br="none",wr="immediate",kr=e=>R(e)||Array.isArray(e),Er=(e,t)=>{let i,r,n=[],s=[],o=!1,a=!0===e?.enabled;R(e)&&a&&(({provider:r,consentManagerPluginName:i}=((e,t)=>{let{provider:i}=e;const r=i?Tt[i]:void 0;var n;return i&&!r&&(t.error((n=Tt,`${W}${he}The consent manager "${i}" is not supported. Please choose one of the following supported consent managers: "${Object.keys(n)}".`)),i=void 0),{provider:i,consentManagerPluginName:r}})(e,t)),kr(e.allowedConsentIds)&&(n=e.allowedConsentIds,o=!0),kr(e.deniedConsentIds)&&(s=e.deniedConsentIds,o=!0));const l={allowedConsentIds:n,deniedConsentIds:s};return a=a&&Boolean(i),{provider:r,consentManagerPluginName:i,initialized:o,enabled:a,consentsData:l}},Sr=e=>{const{useServerSideCookies:t,dataServiceEndpoint:i,storage:r,setCookieDomain:n,sameDomainCookiesOnly:s}=Qt.loadOptions.value;let o,a=r?.cookie,l=!1;if(t){l=t;const r=a.domain??n,u=A(r)&&!(e=>{const{topDomain:t}=pr(window.location.href);return t===e})(F(r))||s,c=((e,t)=>`${t?window.location.origin:(e=>{const{topDomain:t,protocol:i}=pr(e);return`${i}//${t}`})(window.location.href)}/${e.startsWith("/")?e.substring(1):e}`)(i??"rsaRequest",u);if(yr(c)){o=fr(c);const t=vr(window.location.href),i=vr(c);t!==i&&(a={...a,samesite:"None",secure:!0}),!s&&u&&i!==F(r)&&(l=!1,e.warn(((e,t,i)=>`${e}${he}The provided cookie domain (${t}) does not match the current webpage's domain (${i}). Hence, the cookies will be set client-side.`)(W,r,i)))}else l=!1}return{sscEnabled:l,cookieOptions:a,finalDataServiceUrl:o}},Ar=(e,t,i,r,n,s,o)=>{let a;if(s){if(!yr(s))return o.error(`${W}${he}The base URL "${s}" for ${e} is not valid.`),null;a=fr(s)}else if(a=i,"cdn"===Qt.context.app.value.installType){const e=(()=>{const e=document.querySelector("script[data-rsa-write-key]");if(e&&e.dataset.rsaWriteKey===Qt.lifecycle.writeKey.value)return e.src;const t=document.getElementsByTagName("script"),i=/(?:^|\/)rsa(\.min)?\.js$/;for(const e of t){const t=e.getAttribute("src");if(t&&i.test(t))return t}})();e&&(a=e.split("/").slice(0,-1).concat(t).join("/"))}return n&&(a=a.replace(new RegExp(`/${St}/${kt}/${t}$`),`/${r}/${kt}/${t}`)),a};class xr{constructor(e,t,i){this.errorHandler=t,this.logger=i,this.httpClient=e,this.onError=this.onError.bind(this),this.processConfig=this.processConfig.bind(this)}attachEffects(){nt(()=>{this.logger.setMinLogLevel(Qt.lifecycle.logLevel.value)})}init(){const{logLevel:e,configUrl:t,lockIntegrationsVersion:i,lockPluginsVersion:r,destSDKBaseURL:n,pluginsSDKBaseURL:s,integrations:o}=Qt.loadOptions.value,a=((e,t,i,r)=>Ar("integrations",yt,At,e,t,i,r))(Ae,i,n,this.logger);if(k(a))return;let l;l=((e,t,i,r)=>Ar("plugins",bt,xt,e,t,i,r))(Ae,r,s,this.logger),null!==l&&(this.attachEffects(),Qt.lifecycle.activeDataplaneUrl.value=fr(Qt.lifecycle.dataPlaneUrl.value),(e=>{const{storage:t}=Qt.loadOptions.value;let i=t?.type;A(i)&&!(e=>"string"==typeof e&&ct.includes(e))(i)&&(e.warn(((e,t,i)=>`${e}${he}The storage type "${t}" is not supported. Please choose one of the following supported types: "${ct}". The default type "${i}" will be used instead.`)(W,i,dt)),i=dt);let r=t?.encryption?.version;const n=r&&Ot[r];var s,o;!E(r)&&E(n)?(e.warn((s=Ot,o=Pt,`${W}${he}The storage encryption version "${r}" is not supported. Please choose one of the following supported versions: "${Object.keys(s)}". The default version "${o}" will be used instead.`)),r=Pt):E(r)&&(r=Pt);const a=t?.migrate,l=a&&r===Pt;!0===a&&l!==a&&e.warn(((e,t,i)=>`${e}${he}The storage data migration has been disabled because the configured storage encryption version (${t}) is not the latest (${i}). To enable storage data migration, please update the storage encryption version to the latest version.`)(W,r,Pt));const{sscEnabled:u,finalDataServiceUrl:c,cookieOptions:d}=Sr(e);Ue(()=>{Qt.storage.type.value=i,Qt.storage.cookie.value=d,Qt.serverCookies.isEnabledServerSideCookies.value=u,Qt.serverCookies.dataServiceUrl.value=c,Qt.storage.encryptionPluginName.value=Ot[r],Qt.storage.migrate.value=l})})(this.logger),(e=>{const{provider:t,consentManagerPluginName:i,initialized:r,enabled:n,consentsData:s}=Er(Qt.loadOptions.value.consentManagement,e),o=Qt.loadOptions.value.preConsent;let a=o?.storage?.strategy??br;var l,u;A(a)&&!["none","session","anonymousId"].includes(a)&&(a=br,e.warn((l=W,u=o?.storage?.strategy,`${l}${he}The pre-consent storage strategy "${u}" is not supported. Please choose one of the following supported strategies: "none, session, anonymousId". The default strategy "${br}" will be used instead.`)));let c=o?.events?.delivery??wr;A(c)&&!["immediate","buffer"].includes(c)&&(c=wr,e.warn(((e,t,i)=>`${e}${he}The pre-consent events delivery type "${t}" is not supported. Please choose one of the following supported types: "immediate, buffer". The default type "${i}" will be used instead.`)(W,o?.events?.delivery,wr))),Ue(()=>{Qt.consents.activeConsentManagerPluginName.value=i,Qt.consents.initialized.value=r,Qt.consents.enabled.value=n,Qt.consents.data.value=s,Qt.consents.provider.value=t,Qt.consents.preConsent.value={enabled:!0===Qt.loadOptions.value.preConsent?.enabled&&!1===r&&!0===n,storage:{strategy:a},events:{delivery:c}}})})(this.logger),(e=>{if(Qt.dataPlaneEvents.deliveryEnabled.value){const t="XhrQueue";let i=t;Qt.loadOptions.value.useBeacon&&(Qt.capabilities.isBeaconAvailable.value?i="BeaconQueue":(i=t,e.warn(`${W}${he}The Beacon API is not supported by your browser. The events will be sent using XHR instead.`))),Ue(()=>{Qt.dataPlaneEvents.eventsQueuePluginName.value=i})}})(this.logger),Ue(()=>{Qt.lifecycle.integrationsCDNPath.value=a,Qt.lifecycle.pluginsCDNPath.value=l,e&&(Qt.lifecycle.logLevel.value=e),Qt.lifecycle.sourceConfigUrl.value=((e,t,i,r,n)=>{const s=new URLSearchParams({p:"npm",v:Ae,build:kt,writeKey:t,lockIntegrationsVersion:i.toString(),lockPluginsVersion:r.toString()});let o=It,a=s,l="/sourceConfig/",u="";if(yr(e)){const t=new URL(e);fr(t.pathname).endsWith("/sourceConfig")||(t.pathname=`${fr(t.pathname)}/sourceConfig/`),t.pathname=t.pathname.replace(/\/{2,}/g,"/"),s.forEach((e,i)=>{null===t.searchParams.get(i)&&t.searchParams.set(i,e)}),o=t.origin,l=t.pathname,a=t.searchParams,u=t.hash}else n.warn(((e,t)=>`${e}${he}The provided source config URL "${t}" is invalid. Using the default source config URL instead.`)(W,e));return`${o}${l}?${a}${u}`})(t,Qt.lifecycle.writeKey.value,i,r,this.logger),Qt.metrics.metricsServiceUrl.value=`${Qt.lifecycle.activeDataplaneUrl.value}/rsaMetrics`,Qt.nativeDestinations.loadOnlyIntegrations.value=o}),this.getConfig())}onError(e,t,i){this.errorHandler.onError({error:e,context:W,customMessage:t,groupingHash:i})}processConfig(e,t){if(!A(e))return void(A(t)?this.onError(t.error,pt):this.onError(new Error(pt)));let i;try{i=w(e)?JSON.parse(e):e}catch(e){return void this.onError(e,ht)}if(!(e=>C(e)&&C(e.source)&&!S(e.source.id)&&C(e.source.config)&&Array.isArray(e.source.destinations))(i))return void this.onError(new Error(ht));if(!1===i.source.enabled)return void this.logger.error("The source is disabled. Please enable the source in the dashboard to send events.");(e=>{var t;Qt.reporting.isErrorReportingEnabled.value=(t=e.source.config,!0===t?.statsCollection?.errors?.enabled&&!window.chrome?.runtime?.id),Qt.reporting.isMetricsReportingEnabled.value=(e=>!0===e?.statsCollection?.metrics?.enabled)(e.source.config)})(i);const r=i.source.destinations.length>0?i.source.destinations.map(e=>{return{id:e.id,displayName:e.destinationDefinition.displayName,enabled:e.enabled,config:e.config,shouldApplyDeviceModeTransformation:e.shouldApplyDeviceModeTransformation??!1,propagateEventsUntransformedOnError:e.propagateEventsUntransformedOnError??!1,userFriendlyId:(t=e.destinationDefinition.displayName,i=e.id,`${t.replaceAll(" ","-")}___${i}`),isCustomIntegration:"Custom Device Mode"===e.destinationDefinition.displayName};var t,i}):[];Ue(()=>{Qt.source.value={config:i.source.config,name:i.source.name,id:i.source.id,workspaceId:i.source.workspaceId},Qt.nativeDestinations.configuredDestinations.value=r,Qt.plugins.pluginsToLoadFromConfig.value=Qt.loadOptions.value.plugins??[],(e=>{let t,i=Qt.consents.resolutionStrategy.value;C(e.consentManagementMetadata)&&(Qt.consents.provider.value&&(i=e.consentManagementMetadata.providers.find(e=>e.provider===Qt.consents.provider.value)?.resolutionStrategy??Qt.consents.resolutionStrategy.value),t=e.consentManagementMetadata),"custom"===Qt.consents.provider.value&&(i=void 0),Ue(()=>{Qt.consents.metadata.value=g(t),Qt.consents.resolutionStrategy.value=i})})(i),Qt.lifecycle.status.value="configured"})}getConfig(){const e=Qt.loadOptions.value.getSourceConfig;if(e){if(!b(e))return void this.logger.error((t=W,`${t}${he}The "getSourceConfig" load API option must be a function that returns valid source configuration data.`));const i=e();i instanceof Promise?i.then(e=>this.processConfig(e)).catch(e=>{this.onError(e,"SourceConfig")}):this.processConfig(i)}else this.httpClient.getAsyncData({url:Qt.lifecycle.sourceConfigUrl.value,options:{headers:{"Content-Type":void 0}},callback:this.processConfig});var t}}const Ir=(e=()=>document)=>e()?.referrer||"$direct",Pr=(e=()=>globalThis.location,t=()=>document)=>{const i=e(),r=((e=()=>document)=>{const t=e().getElementsByTagName("link");let i="";for(let e=0;t[e];e+=1){const r=t[e];if("canonical"===r.getAttribute("rel")&&!i){i=r.getAttribute("href")??"";break}}return i})(t);let n=i.pathname;const{href:s}=i;let o=s;const{search:a}=i;if(r)try{const e=new URL(r);o=""===e.search?r+a:r,n=e.pathname}catch(e){}const l=(e=>{let t=e;try{const i=new URL(e);t=i.origin+i.pathname+i.search}catch(e){}return t})(o),{title:u}=t(),c=Ir(t);return{path:n,referrer:c,referring_domain:_r(c),search:a,title:u,url:l,tab_url:s}},Cr={URL:()=>!b(globalThis.URL)||!b(globalThis.URLSearchParams),Promise:()=>!b(globalThis.Promise),"Number.isNaN":()=>!b(globalThis.Number.isNaN),"Number.isInteger":()=>!b(globalThis.Number.isInteger),"Array.from":()=>!b(globalThis.Array.from),"Array.prototype.find":()=>!b(globalThis.Array.prototype.find),"Array.prototype.includes":()=>!b(globalThis.Array.prototype.includes),"String.prototype.endsWith":()=>!b(globalThis.String.prototype.endsWith),"String.prototype.startsWith":()=>!b(globalThis.String.prototype.startsWith),"String.prototype.includes":()=>!b(globalThis.String.prototype.includes),"String.prototype.replaceAll":()=>!b(globalThis.String.prototype.replaceAll),"String.fromCodePoint":()=>!b(globalThis.String.fromCodePoint),"Object.entries":()=>!b(globalThis.Object.entries),"Object.values":()=>!b(globalThis.Object.values),"Object.assign":()=>!b(globalThis.Object.assign),"Object.fromEntries":()=>!b(globalThis.Object.fromEntries),"Element.prototype.dataset":()=>!(()=>{const e=globalThis.document.createElement("div");return e.setAttribute("data-a-b","c"),!!e.dataset&&"c"===e.dataset.aB})(),TextEncoder:()=>!b(globalThis.TextEncoder)||!b(globalThis.TextDecoder),requestAnimationFrame:()=>!b(globalThis.requestAnimationFrame)||!b(globalThis.cancelAnimationFrame),CustomEvent:()=>!b(globalThis.CustomEvent),"navigator.sendBeacon":()=>!b(globalThis.navigator.sendBeacon),ArrayBuffer:()=>!b(globalThis.Uint8Array),Set:()=>!b(globalThis.Set),atob:()=>!b(globalThis.atob)},Tr=`https://polyfill-fastly.io/v3/polyfill.min.js?version=3.111.0&features=${Object.keys(Cr).join("%2C")}`,Or="rudderstackPolyfill",Rr=()=>!S(globalThis.navigator.userAgentData),$r=()=>{let e={density:0,width:0,height:0,innerWidth:0,innerHeight:0};return e={width:globalThis.screen.width,height:globalThis.screen.height,density:globalThis.devicePixelRatio,innerWidth:globalThis.innerWidth,innerHeight:globalThis.innerHeight},e};class Dr{constructor(e,t,i){this.httpClient=e,this.errorHandler=t,this.logger=i,this.externalSrcLoader=new Ne(this.logger),this.onError=this.onError.bind(this),this.onReady=this.onReady.bind(this)}init(){this.prepareBrowserCapabilities(),this.attachWindowListeners()}detectBrowserCapabilities(){Ue(()=>{Qt.capabilities.storage.isCookieStorageAvailable.value=ar(Bi,dr(Bi),this.logger),Qt.capabilities.storage.isLocalStorageAvailable.value=ar(Ui,void 0,this.logger),Qt.capabilities.storage.isSessionStorageAvailable.value=ar(ji,void 0,this.logger),Qt.capabilities.isBeaconAvailable.value=!S(globalThis.navigator.sendBeacon)&&b(globalThis.navigator.sendBeacon),Qt.capabilities.isUaCHAvailable.value=Rr(),Qt.capabilities.isCryptoAvailable.value=!S(globalThis.crypto)&&b(globalThis.crypto.getRandomValues),Qt.capabilities.isIE11.value=ce(),Qt.capabilities.isOnline.value=globalThis.navigator.onLine,Qt.context.userAgent.value=((e=()=>globalThis.navigator)=>{const t=e();if(E(t))return null;let{userAgent:i}=t;const{brave:r}=t;if(r&&Object.getPrototypeOf(r).isBrave){const e=i.match(/(chrome)\/([\w.]+)/i);e&&(i=`${i} Brave/${e[2]}`)}return i})(),Qt.context.locale.value=((e=()=>globalThis.navigator)=>{const t=e();return E(t)?null:t.language??t.browserLanguage})(),Qt.context.screen.value=$r(),Qt.context.timezone.value=(()=>{const e=/([A-Z]+[+-]\d+)/.exec((new Date).toString());return e?.[1]?e[1]:"NA"})(),Rr()&&((e,t="none")=>{"none"===t&&e(void 0),"default"===t&&e(navigator.userAgentData),"full"===t&&navigator.userAgentData?.getHighEntropyValues(["architecture","bitness","brands","mobile","model","platform","platformVersion","uaFullVersion","fullVersionList","wow64"]).then(t=>{e(t)}).catch(()=>{e()})})(e=>{Qt.context["ua-ch"].value=e},Qt.loadOptions.value.uaChTrackLevel)}),nt(()=>{!0===Qt.loadOptions.value.sendAdblockPage&&void 0!==Qt.lifecycle.sourceConfigUrl.value&&yi(this.httpClient)})}prepareBrowserCapabilities(){Qt.capabilities.isLegacyDOM.value=(()=>{const e=Object.keys(Cr);let t=!1;for(let i=0;i<e.length;i++){const r=Cr[e[i]];if(b(r)&&r()){t=!0;break}}return t})();const e=Qt.loadOptions.value.polyfillURL;let t=Tr;if(x(e)&&(yr(e)?t=e:this.logger.warn(((e,t)=>`${e}${he}The provided polyfill URL "${t}" is invalid. The default polyfill URL will be used instead.`)(K,e))),Qt.loadOptions.value.polyfillIfRequired&&Qt.capabilities.isLegacyDOM.value&&yr(t)){const e=t!==Qt.loadOptions.value.polyfillURL;if(e){const e=`RS_polyfillCallback_${Qt.lifecycle.writeKey.value}`,i=()=>{this.onReady(),delete globalThis[e]};globalThis[e]=i,t=`${t}&callback=${e}`}this.externalSrcLoader.loadJSFile({url:t,id:Or,async:!0,timeout:1e4,callback:i=>{i?e||this.onReady():this.onError(new Error(((e,t)=>`Failed to load the polyfill script with ID "${e}" from URL ${t}.`)(Or,t)))}})}else this.onReady()}attachWindowListeners(){globalThis.addEventListener("offline",()=>{Qt.capabilities.isOnline.value=!1}),globalThis.addEventListener("online",()=>{Qt.capabilities.isOnline.value=!0}),globalThis.addEventListener("resize",function(e,t,i=250){let r;return(...n)=>{globalThis.clearTimeout(r),r=globalThis.setTimeout(()=>{e.apply(t,n)},i)}}(()=>{Qt.context.screen.value=$r()},this))}onReady(){this.detectBrowserCapabilities(),Qt.lifecycle.status.value="browserCapabilitiesReady"}onError(e,t){this.errorHandler.onError({error:e,context:K,groupingHash:t})}}const Mr=["integrations","anonymousId","originalTimestamp"],Lr=["library","consentManagement","userAgent","ua-ch","screen"],Nr=["id","anonymous_id","user_id","sent_at","timestamp","received_at","original_timestamp","event","event_text","channel","context_ip","context_request_ip","context_passed_ip","group_id","previous_id"],Fr=e=>"number"==typeof e&&!Number.isNaN(e),Br=e=>Fr(e)&&e>=0&&Number.isInteger(e),Ur=e=>{const{cutOff:t}=e,i=Date.now();return Boolean(t?.enabled&&t.expiresAt&&i>t.expiresAt)},jr=e=>Boolean(!e.expiresAt||Date.now()>e.expiresAt)||Ur(e),Vr=(e,t)=>{return!!(e&&Br(e)&&(i=e,i.toString().length>=10))||(t.warn(((e,t)=>`${e}${he}The provided session ID (${t}) is either invalid, not a positive integer, or not at least "10" digits long. A new session ID will be auto-generated instead.`)(Q,e)),!1);var i},Hr=e=>Boolean(e===Bi||e===Ui||e===ji||e===Vi),Gr=()=>ue(),qr=e=>{const t=Pr(),i={};return Object.keys(t).forEach(r=>{i[r]=e?.[r]||t[r]}),i.initial_referrer=e?.initial_referrer||Qt.session.initialReferrer.value,i.initial_referring_domain=e?.initial_referring_domain||Qt.session.initialReferringDomain.value,i},zr=(e,t,i)=>{C(e)&&Object.keys(e).forEach(e=>{(Nr.includes(e)||Nr.includes(e.toLowerCase()))&&i.warn(((e,t,i,r)=>`${e}${he}The "${t}" property defined under "${i}" is a reserved keyword. Please choose a different property name to avoid conflicts with reserved keywords (${r}).`)(J,e,t,Nr))})},Kr=(e,t,i)=>{C(t)&&(((e,t)=>{t.anonymousId&&w(t.anonymousId)&&(e.anonymousId=t.anonymousId),R(t.integrations)&&(e.integrations=t.integrations),t.originalTimestamp&&w(t.originalTimestamp)&&(e.originalTimestamp=t.originalTimestamp)})(e,t),e.context=((e,t,i)=>{let r=e;return Object.keys(t).forEach(e=>{if(!Mr.includes(e)&&!Lr.includes(e))if("context"!==e)r=O(r,{[e]:t[e]});else if(!E(t[e])&&C(t[e])){const i={};Object.keys(t[e]).forEach(r=>{Lr.includes(r)||(i[r]=t[e][r])}),r=O(r,{...i})}else i.warn(`${J}${he}Please make sure that the "context" property in the event API's "options" argument is a valid object literal with key-value pairs.`)}),r})(e.context,t,i))},Wr=(e,t,i,r)=>{const n={channel:"web",context:{traits:g(Qt.session.userTraits.value),sessionId:Qt.session.sessionInfo.value.id||void 0,sessionStart:Qt.session.sessionInfo.value.sessionStart||void 0,...Qt.consents.enabled.value&&{consentManagement:{deniedConsentIds:g(Qt.consents.data.value.deniedConsentIds),allowedConsentIds:g(Qt.consents.data.value.allowedConsentIds),provider:Qt.consents.provider.value,resolutionStrategy:Qt.consents.resolutionStrategy.value}},"ua-ch":Qt.context["ua-ch"].value,app:Qt.context.app.value,library:Qt.context.library.value,userAgent:Qt.context.userAgent.value,os:Qt.context.os.value,locale:Qt.context.locale.value,screen:Qt.context.screen.value,campaign:mr(globalThis.location.href),page:qr(i),timezone:Qt.context.timezone.value,...Qt.autoTrack.enabled.value&&{autoTrack:{...Qt.autoTrack.pageLifecycle.enabled.value&&{page:{pageViewId:Qt.autoTrack.pageLifecycle.pageViewId.value}}}}},originalTimestamp:de(new Date),messageId:ue(),userId:e.userId||Qt.session.userId.value};Hr(Qt.storage.entries.value.anonymousId?.type)?n.anonymousId=Qt.session.anonymousId.value:n.anonymousId=Gr(),Qt.storage.trulyAnonymousTracking.value&&(n.context.trulyAnonymousTracking=!0),"identify"===e.type&&(n.context.traits=Qt.storage.entries.value.userTraits?.type!==Hi?g(Qt.session.userTraits.value):e.context.traits),"group"===e.type&&((e.groupId||Qt.session.groupId.value)&&(n.groupId=e.groupId||Qt.session.groupId.value),(e.traits||Qt.session.groupTraits.value)&&(n.traits=Qt.storage.entries.value.groupTraits?.type!==Hi?g(Qt.session.groupTraits.value):e.traits));const s=O(e,n);return void 0===s.event&&(s.event=null),void 0===s.properties&&(s.properties=null),Kr(s,t,r),((e,t)=>{const{properties:i,traits:r,context:n}=e,{traits:s}=n;zr(i,"properties",t),zr(r,"traits",t),zr(s,"context.traits",t)})(s,r),s.integrations=(e=>{let t;return t=Qt.loadOptions.value.useGlobalIntegrationsConfigInEvents?Qt.consents.postConsent.value.integrations??Qt.nativeDestinations.loadOnlyIntegrations.value:e||mt,g(t)})(s.integrations),s};class Jr{constructor(e){this.logger=e}generatePageEvent(e,t,i,r){let n=i??{};return n=((e,t)=>{const i=t?.page||{},r=e,n=Pr();return Object.keys(n).forEach(e=>{E(r[e])&&(r[e]=i[e]||n[e])}),E(r.initial_referrer)&&(r.initial_referrer=i.initial_referrer||Qt.session.initialReferrer.value),E(r.initial_referring_domain)&&(r.initial_referring_domain=i.initial_referring_domain||Qt.session.initialReferringDomain.value),r})(n,r),Wr({properties:n,name:t,category:e,type:"page"},r,n,this.logger)}generateTrackEvent(e,t,i){return Wr({properties:t,event:e,type:"track"},i,void 0,this.logger)}generateIdentifyEvent(e,t,i){return Wr({userId:e,type:"identify",context:{traits:t}},i,void 0,this.logger)}generateAliasEvent(e,t,i){const r=Wr({previousId:t,type:"alias"},i,void 0,this.logger);return r.userId=e??r.userId,r}generateGroupEvent(e,t,i){const r={type:"group"};return e&&(r.groupId=e),t&&(r.traits=t),Wr(r,i,void 0,this.logger)}create(e){let t;switch(e.type){case"page":t=this.generatePageEvent(e.category,e.name,e.properties,e.options);break;case"track":t=this.generateTrackEvent(e.name,e.properties,e.options);break;case"identify":t=this.generateIdentifyEvent(e.userId,e.traits,e.options);break;case"alias":t=this.generateAliasEvent(e.to,e.from,e.options);break;default:t=this.generateGroupEvent(e.groupId,e.traits,e.options)}return t}}class Yr{constructor(e,t,i,r){this.eventRepository=e,this.userSessionManager=t,this.errorHandler=i,this.logger=r,this.eventFactory=new Jr(this.logger)}init(){this.eventRepository.init()}resume(){this.eventRepository.resume()}addEvent(e){this.userSessionManager.refreshSession();const t=this.eventFactory.create(e);this.eventRepository.enqueue(t,e.callback)}}class Qr{constructor(e,t,i,r,n){this.storeManager=t,this.pluginsManager=e,this.logger=n,this.errorHandler=r,this.httpClient=i,this.onError=this.onError.bind(this),this.serverSideCookieDebounceFuncs={},this.serverSideCookiesRequestInProgress={}}init(){this.syncStorageDataToState(),this.registerEffects()}syncStorageDataToState(){this.migrateStorageIfNeeded(),this.migrateDataFromPreviousStorage(),this.setUserId(this.getUserId()),this.setUserTraits(this.getUserTraits()),this.setGroupId(this.getGroupId()),this.setGroupTraits(this.getGroupTraits());const{externalAnonymousIdCookieName:e,anonymousIdOptions:t}=Qt.loadOptions.value;let i;x(e)&&"string"==typeof e&&(i=this.getExternalAnonymousIdByCookieName(e)),this.setAnonymousId(i??this.getAnonymousId(t)),this.setAuthToken(this.getAuthToken()),this.setInitialReferrerInfo(),this.configureSessionTracking()}configureSessionTracking(){let e;if(this.isPersistenceEnabledForStorageEntry("sessionInfo")){const t=this.getConfiguredSessionTrackingInfo(),i=this.getSessionInfo()??Dt.sessionInfo;e={autoTrack:t.autoTrack&&!0!==i.manualTrack,timeout:t.timeout,manualTrack:i.manualTrack,expiresAt:i.expiresAt,id:i.id,sessionStart:i.sessionStart},e.autoTrack||!0===e.manualTrack?!0===t.cutOff?.enabled&&(e.cutOff={enabled:!0,duration:t.cutOff.duration,expiresAt:i.cutOff?.expiresAt}):e=Dt.sessionInfo}else e=Dt.sessionInfo;Qt.session.sessionInfo.value=e,Qt.session.sessionInfo.value.autoTrack&&this.startOrRenewAutoTracking(Qt.session.sessionInfo.value)}setInitialReferrerInfo(){const e=this.getInitialReferrer(),t=this.getInitialReferringDomain();if(e&&t)this.setInitialReferrer(e),this.setInitialReferringDomain(t);else{const t=e||Ir();this.setInitialReferrer(t),this.setInitialReferringDomain(_r(t))}}isPersistenceEnabledForStorageEntry(e){return Hr(Qt.storage.entries.value[e]?.type)}migrateDataFromPreviousStorage(){const e=Qt.storage.entries.value,t=[Bi,Ui,ji];Object.keys(e).forEach(i=>{const r=i,n=e[r]?.type,s=this.storeManager?.getStore(Ji[n]);s&&t.forEach(e=>{const t=this.storeManager?.getStore(Ji[e]);if(t&&e!==n){const e=t.get(Gi[r]);(e=>x(e)&&""!==e)(e)&&s.set(Gi[r],e),t.remove(Gi[r])}})})}migrateStorageIfNeeded(e,t){if(!Qt.storage.migrate.value)return;let i=e??[];0===i.length&&[qi,zi,Ki].forEach(e=>{const t=this.storeManager?.getStore(e);t&&i.push(t)}),(t??Object.keys(Gi)).forEach(e=>{const t=Gi[e];i.forEach(e=>{const i=this.pluginsManager?.invokeSingle("storage.migrate",t,e.engine,this.errorHandler,this.logger);S(i)||e.set(t,i)})})}getConfiguredSessionTrackingInfo(){let e,t=!1!==Qt.loadOptions.value.sessions.autoTrack;if(!t)return{autoTrack:t};const i=Qt.loadOptions.value.sessions?.timeout;return Br(i)?e=i:(this.logger.warn(((e,t)=>`${e}${he}The session timeout value "${t}" is not a number. The default timeout of 1800000 ms will be used instead.`)(Q,i)),e=Oe),0===e&&(this.logger.warn(`${Q}${he}The session timeout value is 0, which disables the automatic session tracking feature. If you want to enable session tracking, please provide a positive integer value for the timeout.`),t=!1),e>0&&e<1e4&&this.logger.warn(((e,t)=>`${e}${he}The session timeout value ${t} ms is less than the recommended minimum of 10000 ms. Please consider increasing the timeout value to ensure optimal performance and reliability.`)(Q,e)),{timeout:e,autoTrack:t,cutOff:this.getCutOffInfo(e)}}getCutOffInfo(e){const t=Qt.loadOptions.value.sessions.cutOff;let i,r=!1;return!0===t.enabled&&(i=t.duration,r=!0,Br(i)?i<e&&(this.logger.warn(((e,t,i)=>`${e}${he}The session cut off duration value "${t}" ms is less than the session timeout value "${i}" ms. The cut off functionality will be disabled.`)(Q,i,e)),r=!1):(this.logger.warn(((e,t)=>`${e}${he}The session cut off duration value "${t}" is not a number. The default cut off duration of 43200000 ms will be used instead.`)(Q,i)),i=Te)),{enabled:r,duration:i}}onError(e,t,i){this.errorHandler.onError({error:e,context:Q,customMessage:t,groupingHash:i})}getEncryptedCookieData(e,t){const i=[];return e.forEach(e=>{const r=t?.encrypt(ve(e.value,!1,[],this.logger));x(r)&&i.push({name:e.name,value:r})}),i}makeRequestToSetCookie(e,t){this.httpClient?.getAsyncData({url:Qt.serverCookies.dataServiceUrl.value,options:{method:"POST",data:ve({reqType:"setCookies",workspaceId:Qt.source.value?.workspaceId,data:{options:{maxAge:Qt.storage.cookie.value?.maxage,path:Qt.storage.cookie.value?.path,domain:Qt.storage.cookie.value?.domain,sameSite:Qt.storage.cookie.value?.samesite,secure:Qt.storage.cookie.value?.secure,expires:Qt.storage.cookie.value?.expires},cookies:e}}),sendRawData:!0,withCredentials:!0},isRawResponse:!0,callback:t})}setServerSideCookies(e,t,i){const r=Object.keys(e),n=()=>r.map(t=>({name:e[t].name,value:Qt.session[t].value})),s={};r.forEach(t=>{s[e[t].name]=i?.get(e[t].name)});const o=()=>{r.forEach(e=>{this.serverSideCookiesRequestInProgress[e]=!1})},a=()=>{n().forEach(e=>{t&&t(e.name,e.value)})};try{const l={};r.forEach(t=>{l[e[t].name]=Qt.session[t].value});const u=this.getEncryptedCookieData(n(),i);u.length>0?this.makeRequestToSetCookie(u,(e,r)=>{var u;o(),200===r?.xhr?.status?n().forEach(e=>{const r=s[e.name],n=i?.get(e.name);ve(l[e.name],!1,[])!==ve(n,!1,[])&&(k(r)&&k(n)&&this.logger.error(`The server failed to set the ${e.name} cookie. As a fallback, the cookies will be set client side.`),t&&t(e.name,e.value))}):(this.logger.error((u=r?.xhr?.status,`The server responded with status ${u} while setting the cookies. As a fallback, the cookies will be set client side.`)),a())}):(a(),o())}catch(e){this.onError(e,_t,_t),a(),o()}}syncValueToStorage(e){const t=Qt.storage.entries.value,i=t[e]?.type;if(Hr(i)){const r=this.storeManager.getStore(Ji[i]),n=t[e]?.key,s=Qt.session[e].value;s&&(w(s)||R(s))?Qt.serverCookies.isEnabledServerSideCookies.value&&i===Bi?(this.serverSideCookiesRequestInProgress[e]=!0,this.serverSideCookieDebounceFuncs[e]&&globalThis.clearTimeout(this.serverSideCookieDebounceFuncs[e]),this.serverSideCookieDebounceFuncs[e]=globalThis.setTimeout(()=>{const t={[e]:{name:n}};this.setServerSideCookies(t,(e,t)=>{r?.set(e,t)},r)},10)):r?.set(n,s):r?.remove(n)}}registerEffects(){Wi.forEach(e=>{nt(()=>{this.syncValueToStorage(e)})})}setAnonymousId(e,t){let i=e;if(w(e)&&i||(i=void 0),this.isPersistenceEnabledForStorageEntry("anonymousId")){if(!i&&t){const e=this.pluginsManager?.invokeSingle("userSession.anonymousIdGoogleLinker",t);i=e}i=i||Gr()}else i=Dt.anonymousId;Qt.session.anonymousId.value=i}getAnonymousId(e){const t=Qt.storage.entries.value.anonymousId?.type;if(Hr(t)){let t=Qt.session.anonymousId.value;if(t&&t!==Dt.anonymousId||(t=this.getEntryValue("anonymousId")),!t&&e){const i=this.pluginsManager?.invokeSingle("storage.getAnonymousId",dr,e);t=i}Qt.session.anonymousId.value=t||Gr()}return Qt.session.anonymousId.value}getEntryValue(e){const t=Qt.storage.entries.value,i=t[e]?.type;if(Hr(i)){const r=this.storeManager?.getStore(Ji[i]);this.migrateStorageIfNeeded([r],[e]);const n=t[e]?.key;return r?.get(n)??null}return null}getExternalAnonymousIdByCookieName(e){const t=dr(Bi);return t?.isEnabled?t.getItem(e)??null:null}getUserSessionValue(e){return this.serverSideCookiesRequestInProgress[e]?Qt.session[e].value:this.getEntryValue(e)}getUserId(){return this.getUserSessionValue("userId")}getUserTraits(){return this.getUserSessionValue("userTraits")}getGroupId(){return this.getUserSessionValue("groupId")}getGroupTraits(){return this.getUserSessionValue("groupTraits")}getInitialReferrer(){return this.getUserSessionValue("initialReferrer")}getInitialReferringDomain(){return this.getUserSessionValue("initialReferringDomain")}getSessionInfo(){return this.getUserSessionValue("sessionInfo")}getAuthToken(){return this.getUserSessionValue("authToken")}getSessionId(){const e=this.getSessionInfo()??Dt.sessionInfo;return e.autoTrack&&!jr(e)||e.manualTrack?e.id??null:null}refreshSession(){let e=this.getSessionInfo()??Dt.sessionInfo;(e.autoTrack||e.manualTrack)&&(e.autoTrack&&(this.startOrRenewAutoTracking(e),e=Qt.session.sessionInfo.value),void 0===e.sessionStart?e={...e,sessionStart:!0}:e.sessionStart&&(e={...e,sessionStart:!1})),Qt.session.sessionInfo.value=e,"readyExecuted"!==Qt.lifecycle.status.value&&this.syncValueToStorage("sessionInfo")}resetAndStartNewSession(){const e=Qt.session,{manualTrack:t,autoTrack:i,timeout:r,cutOff:n}=e.sessionInfo.value;if(i){const t={...Dt.sessionInfo,timeout:r};n&&(t.cutOff={enabled:n.enabled,duration:n.duration}),e.sessionInfo.value=t,this.startOrRenewAutoTracking(e.sessionInfo.value)}else t&&this.startManualTrackingInternal()}reset(e){const{session:t}=Qt,i=(e=>{if("boolean"==typeof e){const{entries:t,...i}=Mt;return{...i,entries:{...t,anonymousId:e}}}return C(e)&&C(e.entries)?O(Mt,e):{...Mt}})(e);Ue(()=>{Object.keys(Dt).forEach(e=>{const r=e;if(!0===i.entries[r])switch(e){case"anonymousId":this.setAnonymousId();break;case"sessionInfo":this.resetAndStartNewSession();break;default:t[r].value=Dt[r]}})})}setUserId(e){Qt.session.userId.value=this.isPersistenceEnabledForStorageEntry("userId")&&e?e:Dt.userId}setUserTraits(e){Qt.session.userTraits.value=this.isPersistenceEnabledForStorageEntry("userTraits")&&C(e)?O(Qt.session.userTraits.value??Dt.userTraits,e):Dt.userTraits}setGroupId(e){Qt.session.groupId.value=this.isPersistenceEnabledForStorageEntry("groupId")&&e?e:Dt.groupId}setGroupTraits(e){Qt.session.groupTraits.value=this.isPersistenceEnabledForStorageEntry("groupTraits")&&C(e)?O(Qt.session.groupTraits.value??Dt.groupTraits,e):Dt.groupTraits}setInitialReferrer(e){Qt.session.initialReferrer.value=this.isPersistenceEnabledForStorageEntry("initialReferrer")&&e?e:Dt.initialReferrer}setInitialReferringDomain(e){Qt.session.initialReferringDomain.value=this.isPersistenceEnabledForStorageEntry("initialReferringDomain")&&e?e:Dt.initialReferringDomain}startOrRenewAutoTracking(e){let t=e;if(jr(e))t=(e=>{const{timeout:t,cutOff:i}=e,r=Date.now();return{id:r,expiresAt:r+t,timeout:t,autoTrack:!0,...i&&{cutOff:i}}})(e);else{const i=Date.now(),r=e.timeout;t.expiresAt=i+r}if(Ur(t)&&(t.cutOff.expiresAt=void 0),t.cutOff){const e=(e=>{if(e?.enabled)return e.expiresAt??(Br(e.duration)?Date.now()+e.duration:void 0)})(t.cutOff);t.cutOff.expiresAt=e}Qt.session.sessionInfo.value=t}start(e){Qt.session.sessionInfo.value=((e,t)=>({id:Vr(e,t)?e:Date.now(),sessionStart:void 0,manualTrack:!0}))(e,this.logger)}startManualTrackingInternal(){this.start(Date.now())}end(){Qt.session.sessionInfo.value=Dt.sessionInfo}setAuthToken(e){Qt.session.authToken.value=this.isPersistenceEnabledForStorageEntry("authToken")&&e?e:Dt.authToken}}const Zr=["BeaconQueue","CustomConsentManager","DeviceModeDestinations","DeviceModeTransformation","ExternalAnonymousId","GoogleLinker","IubendaConsentManager","KetchConsentManager","NativeDestinationQueue","OneTrustConsentManager","StorageEncryption","StorageEncryptionLegacy","StorageMigrator","XhrQueue"],Xr="dataplaneEventsQueue",en="destinationsEventsQueue",tn=(e,t,i,r)=>{if(A(e))if(b(e))try{e(...t)}catch(e){r.error(`${i}${he}The callback threw an exception`,e)}else r.error(ft(i))};class rn{constructor(e,t,i,r,n){this.pluginsManager=e,this.errorHandler=r,this.httpClient=i,this.logger=n,this.storeManager=t}init(){this.dataplaneEventsQueue=this.pluginsManager.invokeSingle(`${Xr}.init`,Qt,this.httpClient,this.storeManager,this.errorHandler,this.logger),this.dmtEventsQueue=this.pluginsManager.invokeSingle("transformEvent.init",Qt,this.pluginsManager,this.httpClient,this.storeManager,this.errorHandler,this.logger),this.destinationsEventsQueue=this.pluginsManager.invokeSingle(`${en}.init`,Qt,this.pluginsManager,this.storeManager,this.dmtEventsQueue,this.errorHandler,this.logger),nt(()=>{!0===Qt.nativeDestinations.clientDestinationsReady.value&&(this.destinationsEventsQueue?.start(),this.dmtEventsQueue?.start())});const e=(e=>e.consents.preConsent.value.enabled&&"buffer"===e.consents.preConsent.value.events?.delivery)(Qt);let t;nt(()=>{const i=!0===Qt.loadOptions.value.bufferDataPlaneEventsUntilReady&&!1===Qt.nativeDestinations.clientDestinationsReady.value;!1!==Qt.nativeDestinations.activeDestinations.value.some(e=>{return t=e,Boolean("hybrid"===t.config.connectionMode||!0===t.config.useNativeSDKToSend);var t})&&!1!==i||e||!0===this.dataplaneEventsQueue?.scheduleTimeoutActive||(globalThis.clearTimeout(t),this.dataplaneEventsQueue?.start())}),!0===Qt.loadOptions.value.bufferDataPlaneEventsUntilReady&&(t=globalThis.setTimeout(()=>{!0!==this.dataplaneEventsQueue?.scheduleTimeoutActive&&this.dataplaneEventsQueue?.start()},Qt.loadOptions.value.dataPlaneEventsBufferTimeout))}resume(){!0!==this.dataplaneEventsQueue?.scheduleTimeoutActive&&(Qt.consents.postConsent.value.discardPreConsentEvents&&(this.dataplaneEventsQueue?.clear(),this.destinationsEventsQueue?.clear()),this.dataplaneEventsQueue?.start())}enqueue(e,t){const i=((e,t)=>{const i=g(e),r=t.nativeDestinations.integrationsConfig.value,n=((e,t)=>Object.keys(e).filter(i=>!0!==e[i]||!t[i]).reduce((t,i)=>{const r=g(t);return r[i]=e[i],r},{}))(e.integrations,r);return i.integrations=O(r,n),i})(e,Qt);this.pluginsManager.invokeSingle(`${Xr}.enqueue`,Qt,this.dataplaneEventsQueue,i,this.errorHandler,this.logger);const r=g(e);this.pluginsManager.invokeSingle(`${en}.enqueue`,Qt,this.destinationsEventsQueue,r,this.errorHandler,this.logger);const n=`${e.type.charAt(0).toUpperCase()}${e.type.slice(1)}${z}`;tn(t,[i],n,this.logger)}}const nn=e=>{const t=new CustomEvent(e,{detail:{analyticsInstance:globalThis.rudderanalytics},bubbles:!0,cancelable:!0,composed:!0});globalThis.document.dispatchEvent(t)};class sn{constructor(){this.preloadBuffer=new st,this.initialized=!1,this.errorHandler=Ai,this.logger=lt,this.externalSrcLoader=new Ne(this.logger),this.httpClient=vi,this.httpClient.init(this.errorHandler),this.capabilitiesManager=new Dr(this.httpClient,this.errorHandler,this.logger)}load(e,t,i={}){Qt.lifecycle.status.value||((e=>w(e)&&e.trim().length>0)(e)?(e=>yr(e))(t)?(Ue(()=>{Qt.lifecycle.writeKey.value=g(e),Qt.lifecycle.dataPlaneUrl.value=g(t),Qt.loadOptions.value=((e,t)=>{const i=g(t);return w(i.setCookieDomain)||(i.setCookieDomain=void 0),["Strict","Lax","None"].includes(i.sameSiteCookie)||(i.sameSiteCookie=void 0),i.secureCookie=L(i.secureCookie,e.secureCookie),i.sameDomainCookiesOnly=L(i.sameDomainCookiesOnly,e.sameDomainCookiesOnly),["none","default","full"].includes(i.uaChTrackLevel)||(i.uaChTrackLevel=void 0),i.integrations=M(i.integrations),Array.isArray(i.plugins)||(i.plugins=Zr),i.useGlobalIntegrationsConfigInEvents=L(i.useGlobalIntegrationsConfigInEvents,e.useGlobalIntegrationsConfigInEvents),i.bufferDataPlaneEventsUntilReady=L(i.bufferDataPlaneEventsUntilReady,e.bufferDataPlaneEventsUntilReady),i.sendAdblockPage=L(i.sendAdblockPage,e.sendAdblockPage),i.useServerSideCookies=L(i.useServerSideCookies,e.useServerSideCookies),w(i.dataServiceEndpoint)||(i.dataServiceEndpoint=void 0),i.sendAdblockPageOptions=M(i.sendAdblockPageOptions),i.loadIntegration=L(i.loadIntegration,e.loadIntegration),R(i.storage)?(i.storage.migrate=L(i.storage.migrate,e.storage?.migrate),i.storage.cookie=M(i.storage.cookie),i.storage.encryption=M(i.storage.encryption),i.storage=D(i.storage)):i.storage=void 0,i.destinationsQueueOptions=M(i.destinationsQueueOptions),i.queueOptions=M(i.queueOptions),i.lockIntegrationsVersion=L(i.lockIntegrationsVersion,e.lockIntegrationsVersion),i.lockPluginsVersion=L(i.lockPluginsVersion,e.lockPluginsVersion),Fr(i.dataPlaneEventsBufferTimeout)||(i.dataPlaneEventsBufferTimeout=void 0),i.beaconQueueOptions=M(i.beaconQueueOptions),i.preConsent=M(i.preConsent),i.sourceConfigurationOverride=M(i.sourceConfigurationOverride),O(e,D(i))})(Qt.loadOptions.value,i),Qt.lifecycle.status.value="mounted"}),this.logger.setMinLogLevel(Qt.loadOptions.value.logLevel??at),$e("state",Qt,e),this.startLifecycle()):this.logger.error(((e,t)=>`${e}${he}The data plane URL "${t}" is invalid. It must be a valid URL string. Please check that the data plane URL is correct and try again.`)(ie,t)):this.logger.error(((e,t)=>`${e}${he}The write key "${t}" is invalid. It must be a non-empty string. Please check that the write key is correct and try again.`)(ie,e)))}startLifecycle(){nt(()=>{try{switch(Qt.lifecycle.status.value){case"mounted":this.onMounted();break;case"browserCapabilitiesReady":this.onBrowserCapabilitiesReady();break;case"configured":this.onConfigured();break;case"pluginsLoading":case"destinationsLoading":case"readyExecuted":default:break;case"pluginsReady":this.onPluginsReady();break;case"initialized":this.onInitialized();break;case"loaded":this.onLoaded();break;case"destinationsReady":this.onDestinationsReady();break;case"ready":this.onReady()}}catch(e){const t="Failed to load the SDK";this.errorHandler.onError({error:e,context:ie,customMessage:t,groupingHash:t})}})}onBrowserCapabilitiesReady(){(e=>{const t=De(Ie)||[];((e=[])=>{const t=new URLSearchParams(globalThis.location.search);t.get(Ce)&&e.unshift(["track",t.get(Ce),Me(t,"ajs_prop_")]);const i=t.get("ajs_uid"),r=Me(t,"ajs_trait_");if(i||R(r)){const t=[...i?[i]:[],r];e.unshift(["identify",...t])}t.get(Pe)&&e.unshift(["setAnonymousId",t.get(Pe)])})(t),t.length>0&&(e.enqueuePreloadBufferEvents(t),$e(Ie,[]))})(this),this.prepareInternalServices(),this.loadConfig()}onLoaded(){this.processBufferedEvents(),!0===Qt.consents.preConsent.value.enabled?Qt.lifecycle.status.value="ready":this.loadDestinations()}onMounted(){this.capabilitiesManager.init()}enqueuePreloadBufferEvents(e){Array.isArray(e)&&e.forEach(e=>this.preloadBuffer.enqueue(g(e)))}processDataInPreloadBuffer(){for(;this.preloadBuffer.size()>0;){const e=this.preloadBuffer.dequeue();e&&Le([...e],this)}}prepareInternalServices(){this.pluginsManager=new Fi(xi,this.errorHandler,this.logger),this.storeManager=new gr(this.pluginsManager,this.errorHandler,this.logger),this.configManager=new xr(this.httpClient,this.errorHandler,this.logger),this.userSessionManager=new Qr(this.pluginsManager,this.storeManager,this.httpClient,this.errorHandler,this.logger),this.eventRepository=new rn(this.pluginsManager,this.storeManager,this.httpClient,this.errorHandler,this.logger),this.eventManager=new Yr(this.eventRepository,this.userSessionManager,this.errorHandler,this.logger)}loadConfig(){Qt.lifecycle.writeKey.value&&this.httpClient.setAuthHeader(Qt.lifecycle.writeKey.value),this.configManager?.init()}onPluginsReady(){this.storeManager?.init(),this.userSessionManager?.init(),Qt.consents.enabled.value&&!Qt.consents.initialized.value&&(this.pluginsManager?.invokeSingle("consentManager.init",Qt,this.logger),!1===Qt.consents.preConsent.value.enabled&&this.pluginsManager?.invokeSingle("consentManager.updateConsentsInfo",Qt,this.storeManager,this.logger)),this.eventManager?.init(),Qt.lifecycle.status.value="initialized"}onConfigured(){this.pluginsManager?.init()}onInitialized(){this.processDataInPreloadBuffer(),Ue(()=>{Qt.lifecycle.loaded.value=!0,Qt.lifecycle.status.value="loaded"}),this.initialized=!0;const e=Qt.loadOptions.value.onLoaded;tn(e,[globalThis.rudderanalytics],te,this.logger),nn("RSA_Initialised")}onReady(){Qt.lifecycle.status.value="readyExecuted",Qt.eventBuffer.readyCallbacksArray.value.forEach(e=>{tn(e,[],ee,this.logger)}),nn("RSA_Ready")}processBufferedEvents(){let e=Qt.eventBuffer.toBeProcessedArray.value;for(;e.length>0;){const t=e.shift();if(Qt.eventBuffer.toBeProcessedArray.value=e,t){const e=t[0];b(this[e])&&this[e](...t.slice(1),!0)}e=Qt.eventBuffer.toBeProcessedArray.value}}loadDestinations(){if("destinationsLoading"===Qt.lifecycle.status.value||"destinationsReady"===Qt.lifecycle.status.value)return;this.pluginsManager?.invokeSingle("nativeDestinations.setActiveDestinations",Qt,this.pluginsManager,this.errorHandler,this.logger);const e=Qt.nativeDestinations.activeDestinations.value.length;0!==e?(Qt.lifecycle.status.value="destinationsLoading",this.pluginsManager?.invokeSingle("nativeDestinations.load",Qt,this.externalSrcLoader,this.errorHandler,this.logger),nt(()=>{(0===e||Qt.nativeDestinations.initializedDestinations.value.length+Qt.nativeDestinations.failedDestinations.value.length===e)&&Ue(()=>{Qt.lifecycle.status.value="destinationsReady",Qt.nativeDestinations.clientDestinationsReady.value=!0})})):Qt.lifecycle.status.value="destinationsReady"}onDestinationsReady(){"ready"!==Qt.lifecycle.status.value&&(Qt.lifecycle.status.value="ready")}ready(e,t=!1){const i="ready";Qt.lifecycle.loaded.value?(this.errorHandler.leaveBreadcrumb(`New ${i} invocation`),b(e)?"readyExecuted"===Qt.lifecycle.status.value?tn(e,[],ee,this.logger):Qt.eventBuffer.readyCallbacksArray.value=[...Qt.eventBuffer.readyCallbacksArray.value,e]:this.logger.error(ft(ee))):Qt.eventBuffer.toBeProcessedArray.value=[...Qt.eventBuffer.toBeProcessedArray.value,[i,e]]}page(e,t=!1){const i="page";Qt.lifecycle.loaded.value?(this.errorHandler.leaveBreadcrumb(`New ${i} event`),Qt.metrics.triggered.value+=1,this.eventManager?.addEvent({type:"page",category:e.category,name:e.name,properties:e.properties,options:e.options,callback:e.callback}),!0===Qt.capabilities.isAdBlocked.value&&e.category!==xe&&this.page(U(xe,"ad-block page request",{path:"/ad-blocked"},Qt.loadOptions.value.sendAdblockPageOptions))):Qt.eventBuffer.toBeProcessedArray.value=[...Qt.eventBuffer.toBeProcessedArray.value,[i,e]]}track(e,t=!1){const i="track";Qt.lifecycle.loaded.value?(this.errorHandler.leaveBreadcrumb(`New ${i} event - ${e.name}`),Qt.metrics.triggered.value+=1,this.eventManager?.addEvent({type:i,name:e.name||void 0,properties:e.properties,options:e.options,callback:e.callback})):Qt.eventBuffer.toBeProcessedArray.value=[...Qt.eventBuffer.toBeProcessedArray.value,[i,e]]}identify(e,t=!1){const i="identify";Qt.lifecycle.loaded.value?(this.errorHandler.leaveBreadcrumb(`New ${i} event`),Qt.metrics.triggered.value+=1,Boolean(e.userId&&Qt.session.userId.value&&e.userId!==Qt.session.userId.value)&&this.reset(),k(e.userId)||this.userSessionManager?.setUserId(e.userId),this.userSessionManager?.setUserTraits(e.traits),this.eventManager?.addEvent({type:i,userId:e.userId,traits:e.traits,options:e.options,callback:e.callback})):Qt.eventBuffer.toBeProcessedArray.value=[...Qt.eventBuffer.toBeProcessedArray.value,[i,e]]}alias(e,t=!1){const i="alias";if(!Qt.lifecycle.loaded.value)return void(Qt.eventBuffer.toBeProcessedArray.value=[...Qt.eventBuffer.toBeProcessedArray.value,[i,e]]);this.errorHandler.leaveBreadcrumb(`New ${i} event`),Qt.metrics.triggered.value+=1;const r=e.from??(this.getUserId()||this.userSessionManager?.getAnonymousId());this.eventManager?.addEvent({type:i,to:e.to,from:r,options:e.options,callback:e.callback})}group(e,t=!1){const i="group";Qt.lifecycle.loaded.value?(this.errorHandler.leaveBreadcrumb(`New ${i} event`),Qt.metrics.triggered.value+=1,k(e.groupId)||this.userSessionManager?.setGroupId(e.groupId),this.userSessionManager?.setGroupTraits(e.traits),this.eventManager?.addEvent({type:i,groupId:e.groupId,traits:e.traits,options:e.options,callback:e.callback})):Qt.eventBuffer.toBeProcessedArray.value=[...Qt.eventBuffer.toBeProcessedArray.value,[i,e]]}reset(e,t=!1){const i="reset";Qt.lifecycle.loaded.value?(this.errorHandler.leaveBreadcrumb(`New ${i} invocation`),this.userSessionManager?.reset(e)):Qt.eventBuffer.toBeProcessedArray.value=[...Qt.eventBuffer.toBeProcessedArray.value,[i,e]]}getAnonymousId(e){return this.userSessionManager?.getAnonymousId(e)}setAnonymousId(e,t,i=!1){const r="setAnonymousId";Qt.lifecycle.loaded.value?(this.errorHandler.leaveBreadcrumb(`New ${r} invocation`),this.userSessionManager?.setAnonymousId(e,t)):Qt.eventBuffer.toBeProcessedArray.value=[...Qt.eventBuffer.toBeProcessedArray.value,[r,e,t]]}getUserId(){return Qt.session.userId.value}getUserTraits(){return Qt.session.userTraits.value}getGroupId(){return Qt.session.groupId.value}getGroupTraits(){return Qt.session.groupTraits.value}startSession(e,t=!1){const i="startSession";Qt.lifecycle.loaded.value?(this.errorHandler.leaveBreadcrumb(`New ${i} invocation`),this.userSessionManager?.start(e)):Qt.eventBuffer.toBeProcessedArray.value=[...Qt.eventBuffer.toBeProcessedArray.value,[i,e]]}endSession(e=!1){const t="endSession";Qt.lifecycle.loaded.value?(this.errorHandler.leaveBreadcrumb(`New ${t} invocation`),this.userSessionManager?.end()):Qt.eventBuffer.toBeProcessedArray.value=[...Qt.eventBuffer.toBeProcessedArray.value,[t]]}getSessionId(){const e=this.userSessionManager?.getSessionId();return e??null}consent(e,t=!1){Qt.lifecycle.loaded.value?(this.errorHandler.leaveBreadcrumb("New consent invocation"),Ue(()=>{Qt.consents.preConsent.value={...Qt.consents.preConsent.value,enabled:!1},Qt.consents.postConsent.value=(e=>{const t={sendPageEvent:!1,trackConsent:!1,discardPreConsentEvents:!1};if(C(e)){const i=g(e);t.storage=i.storage,R(i.integrations)&&(t.integrations=i.integrations),t.discardPreConsentEvents=!0===i.discardPreConsentEvents,t.sendPageEvent=!0===i.sendPageEvent,t.trackConsent=!0===i.trackConsent,R(i.consentManagement)&&(t.consentManagement=O(i.consentManagement,{enabled:Qt.consents.enabled.value}))}return t})(e);const{initialized:t,consentsData:i}=Er(Qt.consents.postConsent.value.consentManagement,this.logger);Qt.consents.initialized.value=t,Qt.consents.data.value=i}),Qt.consents.enabled.value&&!Qt.consents.initialized.value&&this.pluginsManager?.invokeSingle("consentManager.updateConsentsInfo",Qt,this.storeManager,this.logger),this.storeManager?.initializeStorageState(),this.userSessionManager?.syncStorageDataToState(),this.eventManager?.resume(),this.loadDestinations(),this.sendTrackingEvents(t)):Qt.eventBuffer.toBeProcessedArray.value=[...Qt.eventBuffer.toBeProcessedArray.value,["consent",e]]}sendTrackingEvents(e){if(Qt.consents.postConsent.value.trackConsent){const t=j("Consent Management Interaction");e?Qt.eventBuffer.toBeProcessedArray.value=[...Qt.eventBuffer.toBeProcessedArray.value,["track",t]]:this.track(t)}if(Qt.consents.postConsent.value.sendPageEvent){const t=U();e?Qt.eventBuffer.toBeProcessedArray.value=[...Qt.eventBuffer.toBeProcessedArray.value,["page",t]]:this.page(t)}}setAuthToken(e){this.userSessionManager?.setAuthToken(e)}addCustomIntegration(e,t,i=!1){const r="addCustomIntegration";if(i)this.errorHandler.leaveBreadcrumb(`New ${r} invocation`),this.pluginsManager?.invokeSingle("nativeDestinations.addCustomIntegration",e,t,Qt,this.logger);else{if(Qt.lifecycle.loaded.value)return void this.logger.error(((e,t)=>`${e}${he}Cannot add custom integration for destination ID "${t}" after the SDK is loaded.`)(ie,e));Qt.eventBuffer.toBeProcessedArray.value=[...Qt.eventBuffer.toBeProcessedArray.value,[r,e,t]]}}}class on{static globalSingleton=null;analyticsInstances={};defaultAnalyticsKey="";logger=lt;constructor(){try{if(on.globalSingleton)return on.globalSingleton;on.initializeGlobalResources(),this.setDefaultInstanceKey=this.setDefaultInstanceKey.bind(this),this.getAnalyticsInstance=this.getAnalyticsInstance.bind(this),this.load=this.load.bind(this),this.ready=this.ready.bind(this),this.triggerBufferedLoadEvent=this.triggerBufferedLoadEvent.bind(this),this.page=this.page.bind(this),this.track=this.track.bind(this),this.identify=this.identify.bind(this),this.alias=this.alias.bind(this),this.group=this.group.bind(this),this.reset=this.reset.bind(this),this.getAnonymousId=this.getAnonymousId.bind(this),this.setAnonymousId=this.setAnonymousId.bind(this),this.getUserId=this.getUserId.bind(this),this.getUserTraits=this.getUserTraits.bind(this),this.getGroupId=this.getGroupId.bind(this),this.getGroupTraits=this.getGroupTraits.bind(this),this.startSession=this.startSession.bind(this),this.endSession=this.endSession.bind(this),this.getSessionId=this.getSessionId.bind(this),this.setAuthToken=this.setAuthToken.bind(this),this.consent=this.consent.bind(this),this.addCustomIntegration=this.addCustomIntegration.bind(this),this.createSafeAnalyticsInstance(),on.globalSingleton=this,Qt.autoTrack.pageLifecycle.pageViewId.value=ue(),Qt.autoTrack.pageLifecycle.pageLoadedTimestamp.value=Date.now(),this.triggerBufferedLoadEvent(),globalThis.rudderanalytics=this}catch(e){Ee(e)}}createSafeAnalyticsInstance(){Qt.lifecycle.safeAnalyticsInstance.value={page:this.page.bind(this),track:this.track.bind(this),identify:this.identify.bind(this),alias:this.alias.bind(this),group:this.group.bind(this),getAnonymousId:this.getAnonymousId.bind(this),getUserId:this.getUserId.bind(this),getUserTraits:this.getUserTraits.bind(this),getGroupId:this.getGroupId.bind(this),getGroupTraits:this.getGroupTraits.bind(this),getSessionId:this.getSessionId.bind(this)}}static initializeGlobalResources(){Ai.init(),cr.configure(),lr.configure(),ur.configure(),tr.configure()}setDefaultInstanceKey(e){w(e)&&e&&(this.defaultAnalyticsKey=e)}getAnalyticsInstance(e){try{let t=e;return w(t)&&t||(t=this.defaultAnalyticsKey),Boolean(this.analyticsInstances[t])||(this.analyticsInstances[t]=new sn),this.analyticsInstances[t]}catch(e){return void Ee(e)}}load(e,t,i){try{if(this.analyticsInstances[e])return;this.setDefaultInstanceKey(e),this.trackPageLifecycleEvents(i);const r=De(Ie);(e=>{const t="consent",i=e.filter(e=>e[0]===t),r=e.filter(e=>e[0]!==t);e.splice(0,e.length,...i,...r)})(r),$e(Ie,g(r)),this.getAnalyticsInstance(e)?.load(e,t,ye(i))}catch(e){Ee(e)}}trackPageLifecycleEvents(e){const{autoTrack:t,useBeacon:i}=e??{},{enabled:r=!1,options:n={},pageLifecycle:s}=t??{},{events:o=[q.UNLOADED],enabled:a=r,options:l=n}=s??{};Qt.autoTrack.pageLifecycle.enabled.value=a,Qt.autoTrack.enabled.value=r||a,a&&this.setupPageUnloadTracking(o,i,l)}setupPageUnloadTracking(e,t,i){(0===e.length||e.includes(q.UNLOADED))&&(!0===t?((e,t=!1)=>{let i=!1,r=!1;function n(){i||(i=!0,e(r),setTimeout(()=>{i=!1},0))}(t||ce())&&globalThis.addEventListener("beforeunload",()=>{r=!1,n()}),globalThis.addEventListener("blur",()=>{r=!0,n()}),globalThis.addEventListener("focus",()=>{i=!1}),document.addEventListener("pagehide",()=>{r="hidden"===document.visibilityState,n()}),document.addEventListener("visibilitychange",()=>{r=!0,"hidden"===document.visibilityState?n():i=!1})})(e=>{if(!1===e&&Qt.lifecycle.loaded.value){const e=Date.now(),t=e-Qt.autoTrack.pageLifecycle.pageLoadedTimestamp.value;this.track(q.UNLOADED,{timeOnPage:t},{...i,originalTimestamp:de(new Date(e))})}},!0):this.logger.warn(`RudderStackAnalytics${he}Page Unloaded event can only be tracked when the Beacon transport is active. Please enable "useBeacon" load API option.`))}triggerBufferedLoadEvent(){const e=Array.isArray(globalThis.rudderanalytics)?globalThis.rudderanalytics:[],t=(e=>{let t=[],i=0;for(;i<e.length;){if(e[i]&&"load"===e[i][0]){t=g(e[i]),e.splice(i,1);break}i+=1}return t})(e);$e(Ie,g([...e])),t.length>0&&(t.shift(),this.load.apply(null,t))}ready(e){try{this.getAnalyticsInstance()?.ready(ye(e))}catch(e){Ee(e)}}page(e,t,i,r,n){try{this.getAnalyticsInstance()?.page(U(ye(e),ye(t),ye(i),ye(r),ye(n)))}catch(e){Ee(e)}}track(e,t,i,r){try{this.getAnalyticsInstance()?.track(j(ye(e),ye(t),ye(i),ye(r)))}catch(e){Ee(e)}}identify(e,t,i,r){try{this.getAnalyticsInstance()?.identify(V(ye(e),ye(t),ye(i),ye(r)))}catch(e){Ee(e)}}alias(e,t,i,r){try{this.getAnalyticsInstance()?.alias(H(ye(e),ye(t),ye(i),ye(r)))}catch(e){Ee(e)}}group(e,t,i,r){try{this.getAnalyticsInstance()?.group(G(ye(e),ye(t),ye(i),ye(r)))}catch(e){Ee(e)}}reset(e){try{this.getAnalyticsInstance()?.reset(ye(e))}catch(e){Ee(e)}}getAnonymousId(e){try{return this.getAnalyticsInstance()?.getAnonymousId(ye(e))}catch(e){return void Ee(e)}}setAnonymousId(e,t){try{this.getAnalyticsInstance()?.setAnonymousId(ye(e),ye(t))}catch(e){Ee(e)}}getUserId(){try{return this.getAnalyticsInstance()?.getUserId()}catch(e){return void Ee(e)}}getUserTraits(){try{return this.getAnalyticsInstance()?.getUserTraits()}catch(e){return void Ee(e)}}getGroupId(){try{return this.getAnalyticsInstance()?.getGroupId()}catch(e){return void Ee(e)}}getGroupTraits(){try{return this.getAnalyticsInstance()?.getGroupTraits()}catch(e){return void Ee(e)}}startSession(e){try{this.getAnalyticsInstance()?.startSession(ye(e))}catch(e){Ee(e)}}endSession(){try{this.getAnalyticsInstance()?.endSession()}catch(e){Ee(e)}}getSessionId(){try{return this.getAnalyticsInstance()?.getSessionId()}catch(e){return void Ee(e)}}setAuthToken(e){try{this.getAnalyticsInstance()?.setAuthToken(ye(e))}catch(e){Ee(e)}}consent(e){try{this.getAnalyticsInstance()?.consent(ye(e))}catch(e){Ee(e)}}addCustomIntegration(e,t){try{this.getAnalyticsInstance()?.addCustomIntegration(ye(e),ye(t))}catch(e){Ee(e)}}}t.RudderAnalytics=on},733(e){e.exports=function(){"use strict";function e(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var r in i)e[r]=i[r]}return e}return function t(i,r){function n(t,n,s){if("undefined"!=typeof document){"number"==typeof(s=e({},r,s)).expires&&(s.expires=new Date(Date.now()+864e5*s.expires)),s.expires&&(s.expires=s.expires.toUTCString()),t=encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var o="";for(var a in s)s[a]&&(o+="; "+a,!0!==s[a]&&(o+="="+s[a].split(";")[0]));return document.cookie=t+"="+i.write(n,t)+o}}return Object.create({set:n,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var t=document.cookie?document.cookie.split("; "):[],r={},n=0;n<t.length;n++){var s=t[n].split("="),o=s.slice(1).join("=");try{var a=decodeURIComponent(s[0]);if(r[a]=i.read(o,a),e===a)break}catch(e){}}return e?r[e]:r}},remove:function(t,i){n(t,"",e({},i,{expires:-1}))},withAttributes:function(i){return t(this.converter,e({},this.attributes,i))},withConverter:function(i){return t(e({},this.converter,i),this.attributes)}},{attributes:{value:Object.freeze(r)},converter:{value:Object.freeze(i)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"})}()},744(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r,n=(r=i(858))&&r.__esModule?r:{default:r},s=i(910),o=null,a=null,l=0;t.default=function(e,t,i){e=e||{};var r=t&&i||0,u=t||new Uint8Array(16),c=e.random||(e.rng||n.default)(),d=void 0!==e.msecs?e.msecs:Date.now(),h=void 0!==e.seq?e.seq:null,g=a,p=o;return d>l&&void 0===e.msecs&&(l=d,null!==h&&(g=null,p=null)),null!==h&&(h>2147483647&&(h=2147483647),g=h>>>19&4095,p=524287&h),null!==g&&null!==p||(g=(g=127&c[6])<<8|c[7],p=(p=(p=63&c[8])<<8|c[9])<<5|c[10]>>>3),d+1e4>l&&null===h?++p>524287&&(p=0,++g>4095&&(g=0,l++)):l=d,a=g,o=p,u[r++]=l/1099511627776&255,u[r++]=l/4294967296&255,u[r++]=l/16777216&255,u[r++]=l/65536&255,u[r++]=l/256&255,u[r++]=255&l,u[r++]=g>>>4&15|112,u[r++]=255&g,u[r++]=p>>>13&63|128,u[r++]=p>>>5&255,u[r++]=p<<3&255|7&c[10],u[r++]=c[11],u[r++]=c[12],u[r++]=c[13],u[r++]=c[14],u[r++]=c[15],t||(0,s.unsafeStringify)(u)}},775(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r,n=(r=i(37))&&r.__esModule?r:{default:r};t.default=function(e){if(!(0,n.default)(e))throw TypeError("Invalid UUID");return parseInt(e.slice(14,15),16)}},792(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r,n=(r=i(37))&&r.__esModule?r:{default:r};t.default=function(e){if(!(0,n.default)(e))throw TypeError("Invalid UUID");var t,i=new Uint8Array(16);return i[0]=(t=parseInt(e.slice(0,8),16))>>>24,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t,i[4]=(t=parseInt(e.slice(9,13),16))>>>8,i[5]=255&t,i[6]=(t=parseInt(e.slice(14,18),16))>>>8,i[7]=255&t,i[8]=(t=parseInt(e.slice(19,23),16))>>>8,i[9]=255&t,i[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,i[11]=t/4294967296&255,i[12]=t>>>24&255,i[13]=t>>>16&255,i[14]=t>>>8&255,i[15]=255&t,i}},808(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.default="00000000-0000-0000-0000-000000000000"},831(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"MAX",{enumerable:!0,get:function(){return r.default}}),Object.defineProperty(t,"NIL",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(t,"parse",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(t,"v1",{enumerable:!0,get:function(){return a.default}}),Object.defineProperty(t,"v1ToV6",{enumerable:!0,get:function(){return l.default}}),Object.defineProperty(t,"v3",{enumerable:!0,get:function(){return u.default}}),Object.defineProperty(t,"v4",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(t,"v5",{enumerable:!0,get:function(){return d.default}}),Object.defineProperty(t,"v6",{enumerable:!0,get:function(){return h.default}}),Object.defineProperty(t,"v6ToV1",{enumerable:!0,get:function(){return g.default}}),Object.defineProperty(t,"v7",{enumerable:!0,get:function(){return p.default}}),Object.defineProperty(t,"validate",{enumerable:!0,get:function(){return f.default}}),Object.defineProperty(t,"version",{enumerable:!0,get:function(){return v.default}});var r=_(i(213)),n=_(i(808)),s=_(i(792)),o=_(i(910)),a=_(i(518)),l=_(i(343)),u=_(i(948)),c=_(i(73)),d=_(i(186)),h=_(i(671)),g=_(i(507)),p=_(i(744)),f=_(i(37)),v=_(i(775));function _(e){return e&&e.__esModule?e:{default:e}}},858(e,t){"use strict";var i;Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){if(!i&&!(i="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return i(r)};var r=new Uint8Array(16)},910(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.unsafeStringify=a;for(var r,n=(r=i(37))&&r.__esModule?r:{default:r},s=[],o=0;o<256;++o)s.push((o+256).toString(16).slice(1));function a(e,t=0){return(s[e[t+0]]+s[e[t+1]]+s[e[t+2]]+s[e[t+3]]+"-"+s[e[t+4]]+s[e[t+5]]+"-"+s[e[t+6]]+s[e[t+7]]+"-"+s[e[t+8]]+s[e[t+9]]+"-"+s[e[t+10]]+s[e[t+11]]+s[e[t+12]]+s[e[t+13]]+s[e[t+14]]+s[e[t+15]]).toLowerCase()}t.default=function(e,t=0){var i=a(e,t);if(!(0,n.default)(i))throw TypeError("Stringified UUID is invalid");return i}},948(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=s(i(25)),n=s(i(311));function s(e){return e&&e.__esModule?e:{default:e}}var o=(0,r.default)("v3",48,n.default);t.default=o}},t={};function i(r){var n=t[r];if(void 0!==n)return n.exports;var s=t[r]={exports:{}};return e[r].call(s.exports,s,s.exports,i),s.exports}i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return(()=>{"use strict";var e=r;Object.defineProperty(e,"__esModule",{value:!0}),e.Analytics=void 0;var t=i(396);Object.defineProperty(e,"Analytics",{enumerable:!0,get:function(){return t.Analytics}})})(),r})());