1;!function(){try { var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&((e._debugIds|| (e._debugIds={}))[n]="810a4ae0-0bf5-9d77-ce8c-559124f003c3")}catch(e){}}(); 2(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,865856,(e,t,r)=>{!function(e){"use strict";var n="function",i="undefined",o="object",s="string",a="model",u="name",l="type",c="vendor",d="version",f="architecture",h="console",p="mobile",g="tablet",v="smarttv",m="wearable",y="embedded",b="Amazon",_="Apple",w="ASUS",S="BlackBerry",E="Browser",k="Chrome",I="Firefox",x="Google",T="Huawei",C="Microsoft",P="Motorola",O="Opera",A="Samsung",R="Sharp",M="Sony",N="Xiaomi",D="Zebra",L="Facebook",U=function(e,t){var r={};for(var n in e)t[n]&&t[n].length%2==0?r[n]=t[n].concat(e[n]):r[n]=e[n];return r},q=function(e){for(var t={},r=0;r<e.length;r++)t[e[r].toUpperCase()]=e[r];return t},j=function(e,t){return typeof e===s&&-1!==F(t).indexOf(F(e))},F=function(e){return e.toLowerCase()},B=function(e,t){if(typeof e===s)return e=e.replace(/^\s\s*/,""),typeof t===i?e:e.substring(0,350)},V=function(e,t){for(var r,i,s,a,u,l,c=0;c<t.length&&!u;){var d=t[c],f=t[c+1];for(r=i=0;r<d.length&&!u;)if(u=d[r++].exec(e))for(s=0;s<f.length;s++)l=u[++i],typeof(a=f[s])===o&&a.length>0?2===a.length?typeof a[1]==n?this[a[0]]=a[1].call(this,l):this[a[0]]=a[1]:3===a.length?typeof a[1]!==n||a[1].exec&&a[1].test?this[a[0]]=l?l.replace(a[1],a[2]):void 0:this[a[0]]=l?a[1].call(this,l,a[2]):void 0:4===a.length&&(this[a[0]]=l?a[3].call(this,l.replace(a[1],a[2])):void 0):this[a]=l||void 0;c+=2}},K=function(e,t){for(var r in t)if(typeof t[r]===o&&t[r].length>0){for(var n=0;n<t[r].length;n++)if(j(t[r][n],e))return"?"===r?void 0:r}else if(j(t[r],e))return"?"===r?void 0:r;return e},W={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},z={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[d,[u,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[d,[u,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[u,d],[/opios[\/ ]+([\w\.]+)/i],[d,[u,O+" Mini"]],[/\bopr\/([\w\.]+)/i],[d,[u,O]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(weibo)__([\d\.]+)/i],[u,d],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[d,[u,"UC"+E]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[d,[u,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[d,[u,"WeChat"]],[/konqueror\/([\w\.]+)/i],[d,[u,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[d,[u,"IE"]],[/yabrowser\/([\w\.]+)/i],[d,[u,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[u,/(.+)/,"$1 Secure "+E],d],[/\bfocus\/([\w\.]+)/i],[d,[u,I+" Focus"]],[/\bopt\/([\w\.]+)/i],[d,[u,O+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[d,[u,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[d,[u,"Dolphin"]],[/coast\/([\w\.]+)/i],[d,[u,O+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[d,[u,"MIUI "+E]],[/fxios\/([-\w\.]+)/i],[d,[u,I]],[/\bqihu|(qi?ho?o?|360)browser/i],[[u,"360 "+E]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[u,/(.+)/,"$1 "+E],d],[/(comodo_dragon)\/([\w\.]+)/i],[[u,/_/g," "],d],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[u,d],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[u],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[u,L],d],[/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[u,d],[/\bgsa\/([\w\.]+) .*safari\//i],[d,[u,"GSA"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[d,[u,k+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[u,k+" WebView"],d],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[d,[u,"Android "+E]],[/(chrome|omniweb|arora|[t
vendor: 4,850 bytes, line 2
2izenoka]{5} ?browser)\/v?([\w\.]+)/i],[u,d],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[d,[u,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[d,u],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[u,[d,K,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[u,d],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[u,"Netscape"],d],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[d,[u,I+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[u,d],[/(cobalt)\/([\w\.]+)/i],[u,[d,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[f,"amd64"]],[/(ia32(?=;))/i],[[f,F]],[/((?:i[346]|x)86)[;\)]/i],[[f,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[f,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[f,"armhf"]],[/windows (ce|mobile); ppc;/i],[[f,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[f,/ower/,"",F]],[/(sun4\w)[;\)]/i],[[f,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[f,F]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[a,[c,A],[l,g]],[/\b((?:s[cgp]h|gt|sm)-\w+|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[a,[c,A],[l,p]],[/((ipod|iphone)\d+,\d+)/i],[a,[c,_],[l,p]],[/(ipad\d+,\d+)/i],[a,[c,_],[l,g]],[/\((ip(?:hone|od)[\w ]*);/i],[a,[c,_],[l,p]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[a,[c,_],[l,g]],[/(macintosh);/i],[a,[c,_]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[a,[c,T],[l,g]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[a,[c,T],[l,p]],[/\b(poco[\w ]+)(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[a,/_/g," "],[c,N],[l,p]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[a,/_/g," "],[c,N],[l,g]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[a,[c,"OPPO"],[l,p]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[a,[c,"Vivo"],[l,p]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[a,[c,"Realme"],[l,p]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[a,[c,P],[l,p]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[a,[c,P],[l,g]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[a,[c,"LG"],[l,g]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[a,[c,"LG"],[l,p]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[a,[c,"Lenovo"],[l,g]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[a,/_/g," "],[c,"Nokia"],[l,p]],[/(pixel c)\b/i],[a,[c,x],[l,g]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[a,[c,x],[l,p]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[a,[c,M],[l,p]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[a,"Xperia Tablet"],[c,M],[l,g]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[a,[c,"OnePlus"],[l,p]],[/(alexa)webm/i,/(kf[a-z]{2}wi)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[a,[c,b],[l,g]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[a,/(.+)/g,"Fire Phone $1"],[c,b],[l,p]],[/(playbook);[-\w\),; ]+(rim)/i],[a,c,[l,g]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[a,[c,S],[l,p]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[a,[c,w],[l,g]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[a,[c,w],[l,p]],[/(nexus 9)/i],[a,[c,"HTC"],[l,g]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic|sony(?!-bra))[-_ ]?([-\w]*)/i],[c,[a,/_/g," "],[l,p]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[a,[c,"Acer"],[l,g]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[a,[c,"Meizu"],[l,p]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[a,[c,R],[l,p]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asu
vendor: 7,497 bytes, line 2
2s)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[c,a,[l,p]],[/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[c,a,[l,g]],[/(surface duo)/i],[a,[c,C],[l,g]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[a,[c,"Fairphone"],[l,p]],[/(u304aa)/i],[a,[c,"AT&T"],[l,p]],[/\bsie-(\w*)/i],[a,[c,"Siemens"],[l,p]],[/\b(rct\w+) b/i],[a,[c,"RCA"],[l,g]],[/\b(venue[\d ]{2,7}) b/i],[a,[c,"Dell"],[l,g]],[/\b(q(?:mv|ta)\w+) b/i],[a,[c,"Verizon"],[l,g]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[a,[c,"Barnes & Noble"],[l,g]],[/\b(tm\d{3}\w+) b/i],[a,[c,"NuVision"],[l,g]],[/\b(k88) b/i],[a,[c,"ZTE"],[l,g]],[/\b(nx\d{3}j) b/i],[a,[c,"ZTE"],[l,p]],[/\b(gen\d{3}) b.+49h/i],[a,[c,"Swiss"],[l,p]],[/\b(zur\d{3}) b/i],[a,[c,"Swiss"],[l,g]],[/\b((zeki)?tb.*\b) b/i],[a,[c,"Zeki"],[l,g]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[c,"Dragon Touch"],a,[l,g]],[/\b(ns-?\w{0,9}) b/i],[a,[c,"Insignia"],[l,g]],[/\b((nxa|next)-?\w{0,9}) b/i],[a,[c,"NextBook"],[l,g]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[c,"Voice"],a,[l,p]],[/\b(lvtel\-)?(v1[12]) b/i],[[c,"LvTel"],a,[l,p]],[/\b(ph-1) /i],[a,[c,"Essential"],[l,p]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[a,[c,"Envizen"],[l,g]],[/\b(trio[-\w\. ]+) b/i],[a,[c,"MachSpeed"],[l,g]],[/\btu_(1491) b/i],[a,[c,"Rotor"],[l,g]],[/(shield[\w ]+) b/i],[a,[c,"Nvidia"],[l,g]],[/(sprint) (\w+)/i],[c,a,[l,p]],[/(kin\.[onetw]{3})/i],[[a,/\./g," "],[c,C],[l,p]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[a,[c,D],[l,g]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[a,[c,D],[l,p]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[c,a,[l,h]],[/droid.+; (shield) bui/i],[a,[c,"Nvidia"],[l,h]],[/(playstation [345portablevi]+)/i],[a,[c,M],[l,h]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[a,[c,C],[l,h]],[/smart-tv.+(samsung)/i],[c,[l,v]],[/hbbtv.+maple;(\d+)/i],[[a,/^/,"SmartTV"],[c,A],[l,v]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[c,"LG"],[l,v]],[/(apple) ?tv/i],[c,[a,_+" TV"],[l,v]],[/crkey/i],[[a,k+"cast"],[c,x],[l,v]],[/droid.+aft(\w)( bui|\))/i],[a,[c,b],[l,v]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[a,[c,R],[l,v]],[/(bravia[\w ]+)( bui|\))/i],[a,[c,M],[l,v]],[/(mitv-\w{5}) bui/i],[a,[c,N],[l,v]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w ]*; *(\w[^;]*);([^;]*)/i],[[c,B],[a,B],[l,v]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[l,v]],[/((pebble))app/i],[c,a,[l,m]],[/droid.+; (glass) \d/i],[a,[c,x],[l,m]],[/droid.+; (wt63?0{2,3})\)/i],[a,[c,D],[l,m]],[/(quest( 2)?)/i],[a,[c,L],[l,m]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[c,[l,y]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[a,[l,p]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[a,[l,g]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[l,g]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[l,p]],[/(android[-\w\. ]{0,9});.+buil/i],[a,[c,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[d,[u,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[d,[u,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i],[u,d],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[d,u]],os:[[/microsoft (windows) (vista|xp)/i],[u,d],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[u,[d,K,W]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[u,"Windows"],[d,K,W]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[d,/_/g,"."],[u,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[u,"Mac OS"],[d,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[d,u],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[u,d],[/\(bb(10);/i],[d,[u,S]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[d,[u,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[d,[u,I+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[d,[u,"webOS"]],[/crkey\/([\d\.]+)/i],[d,[u,k+"cast"]],[/(cros) [\w]+ ([\w\.]+\w)/i],[[u,"Chromium OS"],d],[/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[u,d],[/(sunos) ?([\w\.\d]*)/i],[[u,"Solaris"],d],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,/(unix) ?([\w\.]*)/i],[u,d]]},H=function(t,r){if(typeof t===o&&(r=t,t=void 0),!(this instanceof H))return new H(t,r).getResult();var n=t||(typeof e!==i&&e.navigator&&e.navigator.userAgent?e.navigator.userAgent:""),h=r?U(z,r):z;return this.getBrowser=function(){var e,t={};return t[u]=void 0,t[d]=void 0,V.call(t,n,h.browser),t.major=typeof(e=t.version)===s?e.replace(/[^\d\.]/g,"").split(".")[0]:void 0,t},this.getCPU=function(){var e={};return e[f]=void 0,V.call(e,n,h.cpu),e},this.getDevice=function(){var e={};return e[c]=void 0,e[a]=void 0,e[l]=void 0,V.call(e,n,h.device),e},this.getEngine=function(){var e={};return e[u]=void 0,e[d]=void 0,V.call(e,n,h.engine),e},this.getOS=function(){var e={};return e[u]=void 0,e[d]=void 0,V.call(e,n,h.os),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return n},this.setUA=function(e){return n=typeof e===s&&e.length>350?B(e,350):e,this},this.setUA(n),this};H.VERSION="0.7.33",H.BROWSER=q([u,d,"major"]),H.CPU=q([f]),H.DEVICE=q([a,c,l,h,p,v,g,m,y]),H.ENGINE=H.OS=q([u,d]),t.exports&&(r=t.exports=H),r.UAParser=H;var G=typeof e!==i&&(e.jQuery||e.Zepto);if(G&&!G.ua){var J=new H;G.ua=J.getResult(),G.ua.get=function(){return J.getUA()},G.ua.set=function(e){J.setUA(e);var t=J.getResult();for(var r in t)G.ua[r]=t[r]}}}("object"==typeof window?window:e.e)},839049,(e,t,r)=>{var n=Object.prototype.hasOwnProperty;function i(e){return"[Throws: "+(e?e.message:"?")+"]"}function o(e){var t=[];return function e(r){if(null===r||"object"!=typeof r)return r;if(-1!==t.indexOf(r))return"[Circular]";if(t.push(r),"function"==typeof r.toJSON)try{var o=e(r.toJSON());return t.pop(),o}catch(e){return i(e)}if(Array.isArray(r)){var s=r.map(e);return t.pop(),s}var a=Object.keys(r).reduce(function(t,o){return t[o]=e(function(e,t){if(n.call(e,t))try{return e[t]}catch(e){return i(e)}return e[t]}(r,o)),t},{});return t.pop(),a}(e)}t.exports=function(e,t,r){return JSON.stringify(o(e),t,r)},t.exports.ensureProperties=o},23016,(e,t,r)=>{"use strict";
2Object.defineProperty(r,"__esModule",{value:!0}),r.Observable=void 0;let n=e=>!!Symbol[e],i=e=>n(e)?Symbol[e]:"@@"+e,o=i("iterator"),s=i("observable"),a=i("species");function u(e,t){let r=e[t];if(null!=r){if("function"!=typeof r)throw TypeError(r+" is not a function");return r}}function l(e){let t=e.constructor;return void 0!==t&&null===(t=t[a])&&(t=void 0),void 0!==t?t:m}function c(e){c.log?c.log(e):setTimeout(()=>{throw e})}function d(e){Promise.resolve().then(()=>{try{e()}catch(e){c(e)}})}function f(e){let t=e._cleanup;if(void 0!==t&&(e._cleanup=void 0,t))try{if("function"==typeof t)t();else{let e=u(t,"unsubscribe");e&&e.call(t)}}catch(e){c(e)}}function h(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function p(e,t,r){e._state="running";let n=e._observer;try{let i=u(n,t);switch(t){case"next":i&&i.call(n,r);break;case"error":if(h(e),i)i.call(n,r);else throw r;break;case"complete":h(e),i&&i.call(n)}}catch(e){c(e)}"closed"===e._state?f(e):"running"===e._state&&(e._state="ready")}function g(e,t,r){if("closed"!==e._state){if("buffering"===e._state)return void e._queue.push({type:t,value:r});if("ready"!==e._state){e._state="buffering",e._queue=[{type:t,value:r}],d(()=>(function(e){let t=e._queue;if(t){e._queue=void 0,e._state="ready";for(let r=0;r<t.length&&(p(e,t[r].type,t[r].value),"closed"!==e._state);++r);}})(e));return}p(e,t,r)}}class v{constructor(e,t){this._cleanup=void 0,this._observer=e,this._queue=void 0,this._state="initializing";let r=this,n={get closed(){return"closed"===r._state},next(e){g(r,"next",e)},error(e){g(r,"error",e)},complete(){g(r,"complete")}};try{this._cleanup=t.call(void 0,n)}catch(e){n.error(e)}"initializing"===this._state&&(this._state="ready")}get closed(){return"closed"===this._state}unsubscribe(){"closed"!==this._state&&(h(this),f(this))}}class m{constructor(e){if(!(this instanceof m))throw TypeError("Observable cannot be called as a function");if("function"!=typeof e)throw TypeError("Observable initializer must be a function");this._subscriber=e}subscribe(e){return("object"!=typeof e||null===e)&&(e={next:e,error:arguments[1],complete:arguments[2]}),new v(e,this._subscriber)}forEach(e){return new Promise((t,r)=>{if("function"!=typeof e)return void r(TypeError(e+" is not a function"));function n(){i.unsubscribe(),t()}let i=this.subscribe({next(t){try{e(t,n)}catch(e){r(e),i.unsubscribe()}},error:r,complete:t})})}map(e){if("function"!=typeof e)throw TypeError(e+" is not a function");return new(l(this))(t=>this.subscribe({next(r){try{r=e(r)}catch(e){return t.error(e)}t.next(r)},error(e){t.error(e)},complete(){t.complete()}}))}filter(e){if("function"!=typeof e)throw TypeError(e+" is not a function");return new(l(this))(t=>this.subscribe({next(r){try{if(!e(r))return}catch(e){return t.error(e)}t.next(r)},error(e){t.error(e)},complete(){t.complete()}}))}reduce(e){if("function"!=typeof e)throw TypeError(e+" is not a function");let t=l(this),r=arguments.length>1,n=!1,i=arguments[1],o=i;return new t(t=>this.subscribe({next(i){let s=!n;if(n=!0,!s||r)try{o=e(o,i)}catch(e){return t.error(e)}else o=i},error(e){t.error(e)},complete(){if(!n&&!r)return t.error(TypeError("Cannot reduce an empty sequence"));t.next(o),t.complete()}}))}async all(){let e=[];return await this.forEach(t=>e.push(t)),e}concat(...e){let t=l(this);return new t(r=>{let n,i=0;return!function o(s){n=s.subscribe({next(e){r.next(e)},error(e){r.error(e)},complete(){i===e.length?(n=void 0,r.complete()):o(t.from(e[i++]))}})}(this),()=>{n&&(n.unsubscribe(),n=void 0)}})}flatMap(e){if("function"!=typeof e)throw TypeError(e+" is not a function");let t=l(this);return new t(r=>{let n=[],i=this.subscribe({next(i){if(e)try{i=e(i)}catch(e){return r.error(e)}let s=t.from(i).subscribe({next(e){r.next(e)},error(e){r.error(e)},complete(){let e=n.indexOf(s);e>=0&&n.splice(e,1),o()}});n.push(s)},error(e){r.error(e)},complete(){o()}});function o(){i.closed&&0===n.length&&r.complete()}return()=>{n.forEach(e=>e.unsubscribe()),i.unsubscribe()}})}[s](){return this}static from(e){let t="function"==typeof this?this:m;if(null==e)throw TypeError(e+" is not an object");let r=u(e,s);if(r){let n=r.call(e);
2if(Object(n)!==n)throw TypeError(n+" is not an object");return n instanceof m&&n.constructor===t?n:new t(e=>n.subscribe(e))}if(n("iterator")&&(r=u(e,o)))return new t(t=>{d(()=>{if(!t.closed){for(let n of r.call(e))if(t.next(n),t.closed)return;t.complete()}})});if(Array.isArray(e))return new t(t=>{d(()=>{if(!t.closed){for(let r=0;r<e.length;++r)if(t.next(e[r]),t.closed)return;t.complete()}})});throw TypeError(e+" is not observable")}static of(...e){return new("function"==typeof this?this:m)(t=>{d(()=>{if(!t.closed){for(let r=0;r<e.length;++r)if(t.next(e[r]),t.closed)return;t.complete()}})})}static get[a](){return this}}r.Observable=m,Object.defineProperty(m,Symbol("extensions"),{value:{symbol:s,hostReportError:c},configurable:!0})},819125,(e,t,r)=>{t.exports=e.r(23016).Observable},459112,e=>{"use strict";let t,r;var n,i,o,s,a,u,l,c,d,f,h,p,g,v,m,y,b,_,w,S,E,k,I,x,T,C,P,O,A,R,M,N,D,L,U,q,j,F,B,V,K,W,z,H,G,J,$,X,Y,Q,Z,ee,et,er,en,ei,eo=e.i(190898),es=e.i(477469);(n=M||(M={}))[n.None=0]="None",n[n.Error=1]="Error",n[n.Warn=2]="Warn",n[n.Verbose=3]="Verbose",n[n.Debug=4]="Debug";var ea=function(e){return void 0===e&&(e=0),(Error().stack||"").split("\n").slice(2+e).map(function(e){return e.trim()})},eu=function(e){return function(){var t=(0,es.__assign)({},e.config);return{logger:t.loggerProvider,logLevel:t.logLevel}}},el=function(e,t){var r,n;t=(t=t.replace(/\[(\w+)\]/g,".$1")).replace(/^\./,"");try{for(var i=(0,es.__values)(t.split(".")),o=i.next();!o.done;o=i.next()){var s=o.value;if(!(s in e))return;e=e[s]}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return e},ec=function(e,t){return function(){var r,n,i={};try{for(var o=(0,es.__values)(t),s=o.next();!s.done;s=o.next()){var a=s.value;i[a]=el(e,a)}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i}},ed=function(e,t,r,n,i){return void 0===i&&(i=null),function(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];var a=r(),u=a.logger,l=a.logLevel;if(l&&l<M.Debug||!l||!u)return e.apply(i,o);var c={type:"invoke public method",name:t,args:o,stacktrace:ea(1),time:{start:new Date().toISOString()},states:{}};n&&c.states&&(c.states.before=n());var d=e.apply(i,o);return d&&d.promise?d.promise.then(function(){n&&c.states&&(c.states.after=n()),c.time&&(c.time.end=new Date().toISOString()),u.debug(JSON.stringify(c,null,2))}):(n&&c.states&&(c.states.after=n()),c.time&&(c.time.end=new Date().toISOString()),u.debug(JSON.stringify(c,null,2))),d}};(i=N||(N={})).SET="$set",i.SET_ONCE="$setOnce",i.ADD="$add",i.APPEND="$append",i.PREPEND="$prepend",i.REMOVE="$remove",i.PREINSERT="$preInsert",i.POSTINSERT="$postInsert",i.UNSET="$unset",i.CLEAR_ALL="$clearAll",(o=D||(D={})).IDENTIFY="$identify",o.GROUP_IDENTIFY="$groupidentify",o.REVENUE="revenue_amount";var ef="".concat("AMP","_unsent"),eh="$default_instance",ep="https://api2.amplitude.com/2/httpapi",eg="https://api.eu.amplitude.com/2/httpapi",ev="https://api2.amplitude.com/batch",em="https://api.eu.amplitude.com/batch",ey="dclid",eb="fbclid",e_="gbraid",ew="gclid",eS="ko_click_id",eE="li_fat_id",ek="msclkid",eI="rdt_cid",ex="ttclid",eT="twclid",eC="wbraid",eP={utm_campaign:void 0,utm_content:void 0,utm_id:void 0,utm_medium:void 0,utm_source:void 0,utm_term:void 0,referrer:void 0,referring_domain:void 0,dclid:void 0,gbraid:void 0,gclid:void 0,fbclid:void 0,ko_click_id:void 0,li_fat_id:void 0,msclkid:void 0,rdt_cid:void 0,ttclid:void 0,twclid:void 0,wbraid:void 0},eO=["access-control-allow-origin","access-control-allow-credentials","access-control-expose-headers","access-control-max-age","access-control-allow-methods","access-control-allow-headers","accept-patch","accept-ranges","age","allow","alt-svc","cache-control","connection","content-disposition","content-encoding","content-language","content-length","content-location","content-md5","content-range","content-type","date","delta-base","etag","expires","im","last-modified","link","location","permanent","p3p","pragma","proxy-authenticate","public-key-pins","retry-after","server","status","strict-transport-security","trailer","transfer-encoding","tk","upgrade","vary","via","warning","www-authenticate","x-b3-traceid","x-frame-options"],eA=["authorization","cookie","set-cookie"],eR=function(e){if(Object.keys(e).length>1e3)return!1;for(var t in e){var r=e[t];if(!eM(t,r))return!1}return!0},eM=function(e,t){var r,n;if("string"!=typeof e)return!1;if(Array.isArray(t)){var i=!0;try{for(var o=(0,es.__values)(t),s=o.next();!s.done;s=o.next()){var a=s.value;if(Array.isArray(a))return!1;if("object"==typeof a)i=i&&eR(a);else if(!["number","string"].includes(typeof a))return!1;if(!i)return!1}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}else if(null==t)return!1;else if("object"==typeof t)return eR(t);else if(!["number","string","boolean"].includes(typeof t))return!1;return!0},eN=function(){function e(){this._propertySet=new Set,this._properties={}}return e.prototype.getUserProperties=function(){return(0,es.__assign)({},this._properties)},e.prototype.set=function(e,t){return this._safeSet(L.SET,e,t),this},e.prototype.setOnce=function(e,t){return this._safeSet(L.SET_ONCE,e,t),this},e.prototype.append=function(e,t){return this._safeSet(L.APPEND,e,t),this},e.prototype.prepend=function(e,t){return this._safeSet(L.PREPEND,e,t),this},e.prototype.postInsert=function(e,t){return this._safeSet(L.POSTINSERT,e,t),this},e.prototype.preInsert=function(e,t){return this._safeSet(L.PREINSERT,e,t),this},e.prototype.remove=function(e,t){return this._safeSet(L.REMOVE,e,t),this},e.prototype.add=function(e,t){return this._safeSet(L.ADD,e,t),this},e.prototype.unset=function(e){return this._safeSet(L.UNSET,e,"-"),this},e.prototype.clearAll=function(){return this._properties={},this._properties[L.CLEAR_ALL]="-",this}
2,e.prototype._safeSet=function(e,t,r){if(this._validate(e,t,r)){var n=this._properties[e];return void 0===n&&(n={},this._properties[e]=n),n[t]=r,this._propertySet.add(t),!0}return!1},e.prototype._validate=function(e,t,r){return!(void 0!==this._properties[L.CLEAR_ALL]||this._propertySet.has(t))&&(e===L.ADD?"number"==typeof r:e===L.UNSET||e===L.REMOVE||eM(t,r))},e}();(s=L||(L={})).SET="$set",s.SET_ONCE="$setOnce",s.ADD="$add",s.APPEND="$append",s.PREPEND="$prepend",s.REMOVE="$remove",s.PREINSERT="$preInsert",s.POSTINSERT="$postInsert",s.UNSET="$unset",s.CLEAR_ALL="$clearAll";var eD=[L.CLEAR_ALL,L.UNSET,L.SET,L.SET_ONCE,L.ADD,L.APPEND,L.PREPEND,L.PREINSERT,L.POSTINSERT,L.REMOVE];(a=U||(U={})).Unknown="unknown",a.Skipped="skipped",a.Success="success",a.RateLimit="rate_limit",a.PayloadTooLarge="payload_too_large",a.Invalid="invalid",a.Failed="failed",a.Timeout="Timeout",a.SystemError="SystemError";var eL=function(e,t,r){return void 0===t&&(t=0),void 0===r&&(r=U.Unknown),{event:e,code:t,message:r}},eU=e.i(658731),eq=(0,es.__spreadArray)([],(0,es.__read)(Array(256).keys()),!1).map(function(e){return e.toString(16).padStart(2,"0")}),ej=function(e){var t,r=(0,eU.getGlobalScope)();if(!(null==(t=null==r?void 0:r.crypto)?void 0:t.getRandomValues))return e?(e^16*Math.random()>>e/4).toString(16):(String(1e7)+String(-1e3)+String(-4e3)+String(-8e3)+String(-1e11)).replace(/[018]/g,ej);var n=r.crypto.getRandomValues(new Uint8Array(16));return n[6]=15&n[6]|64,n[8]=63&n[8]|128,(0,es.__spreadArray)([],(0,es.__read)(n.entries()),!1).map(function(e){var t=(0,es.__read)(e,2),r=t[0],n=t[1];return[4,6,8,10].includes(r)?"-".concat(eq[n]):eq[n]}).join("")},eF=function(){function e(e){this.client=e,this.queue=[],this.applying=!1,this.plugins=[],this._optOutListeners=[]}return e.prototype.register=function(e,t){var r,n;return(0,es.__awaiter)(this,void 0,void 0,function(){return(0,es.__generator)(this,function(i){switch(i.label){case 0:if(this.plugins.some(function(t){return t.name===e.name}))return this.loggerProvider.warn("Plugin with name ".concat(e.name," already exists, skipping registration")),[2];return void 0===e.name&&(e.name=ej(),this.loggerProvider.warn("Plugin name is undefined. \n Generating a random UUID for plugin name: ".concat(e.name,". \n Set a name for the plugin to prevent it from being added multiple times."))),e.type=null!=(r=e.type)?r:"enrichment",[4,null==(n=e.setup)?void 0:n.call(e,t,this.client)];case 1:return i.sent(),this.plugins.push(e),[2]}})})},e.prototype.deregister=function(e,t){var r;return(0,es.__awaiter)(this,void 0,void 0,function(){var n,i;return(0,es.__generator)(this,function(o){switch(o.label){case 0:if(-1===(n=this.plugins.findIndex(function(t){return t.name===e})))return t.loggerProvider.warn("Plugin with name ".concat(e," does not exist, skipping deregistration")),[2];return i=this.plugins[n],this.plugins.splice(n,1),[4,null==(r=i.teardown)?void 0:r.call(i)];case 1:return o.sent(),[2]}})})},e.prototype.reset=function(e){this._clearOptOutListeners(),this.applying=!1,this.plugins.map(function(e){var t;return null==(t=e.teardown)?void 0:t.call(e)}),this.plugins=[],this.client=e},e.prototype.push=function(e){var t=this;return new Promise(function(r){t.queue.push([e,r]),t.scheduleApply(0)})},e.prototype.scheduleApply=function(e){var t=this;this.applying||(this.applying=!0,setTimeout(function(){t.apply(t.queue.shift()).then(function(){t.applying=!1,t.queue.length>0&&t.scheduleApply(0)})},e))},e.prototype.apply=function(e){return(0,es.__awaiter)(this,void 0,void 0,function(){var t,r,n,i,o,s,a,u,l,c,d,f,h,p,g;return(0,es.__generator)(this,function(v){switch(v.label){case 0:if(!e)return[2];t=(0,es.__read)(e,1)[0],r=(0,es.__read)(e,2)[1],this.loggerProvider.log("Timeline.apply: Initial event",t),n=this.plugins.filter(function(e){return"before"===e.type}),v.label=1;case 1:v.trys.push([1,6,7,8]),o=(i=(0,es.__values)(n)).next(),v.label=2;case 2:if(o.done)return[3,5];if(!(s=o.value).execute)return[3,4];return[4,s.execute((0,es.__assign)({},t))];case 3:if(null===(a=v.sent()))return this.loggerProvider.log("Timeline.apply: Event filtered out by before plugin '".concat(String(s.name),"', event: ").concat(JSON.stringify(t))),r({event:t,code:0,message:""}),[2];t=a,this.loggerProvider.log("Timeline.apply: Event after before plugin '".concat(String(s.name),"', event: ").concat(JSON.stringify(t))),v.label=4;case 4:return o=i.next(),[3,2];case 5:return[3,8];case 6:return f={error:v.sent()},[3,8];case 7:try{o&&!o.done&&(h=i.return)&&h.call(i)}finally{if(f)throw f.error}
2return[7];case 8:u=this.plugins.filter(function(e){return"enrichment"===e.type||void 0===e.type}),v.label=9;case 9:v.trys.push([9,14,15,16]),c=(l=(0,es.__values)(u)).next(),v.label=10;case 10:if(c.done)return[3,13];if(!(s=c.value).execute)return[3,12];return[4,s.execute((0,es.__assign)({},t))];case 11:if(null===(a=v.sent()))return this.loggerProvider.log("Timeline.apply: Event filtered out by enrichment plugin '".concat(String(s.name),"', event: ").concat(JSON.stringify(t))),r({event:t,code:0,message:""}),[2];t=a,this.loggerProvider.log("Timeline.apply: Event after enrichment plugin '".concat(String(s.name),"', event: ").concat(JSON.stringify(t))),v.label=12;case 12:return c=l.next(),[3,10];case 13:return[3,16];case 14:return p={error:v.sent()},[3,16];case 15:try{c&&!c.done&&(g=l.return)&&g.call(l)}finally{if(p)throw p.error}return[7];case 16:return d=this.plugins.filter(function(e){return"destination"===e.type}),this.loggerProvider.log("Timeline.apply: Final event before destinations, event: ".concat(JSON.stringify(t))),Promise.all(d.map(function(e){var r=(0,es.__assign)({},t);return e.execute(r).catch(function(e){return eL(r,0,String(e))})})).then(function(e){var n=(0,es.__read)(e,1)[0]||eL(t,100,"Event not tracked, no destination plugins on the instance");r(n)}),[2]}})})},e.prototype.flush=function(){return(0,es.__awaiter)(this,void 0,void 0,function(){var e,t=this;return(0,es.__generator)(this,function(r){switch(r.label){case 0:return e=this.queue,this.queue=[],[4,Promise.all(e.map(function(e){return t.apply(e)}))];case 1:return r.sent(),[4,Promise.all(this.plugins.filter(function(e){return"destination"===e.type}).map(function(e){return e.flush&&e.flush()}))];case 2:return r.sent(),[2]}})})},e.prototype.addOptOutListener=function(e){this._optOutListeners.push(e)},e.prototype._clearOptOutListeners=function(){this._optOutListeners=[]},e.prototype.onIdentityChanged=function(e){this.plugins.forEach(function(t){var r;null==(r=t.onIdentityChanged)||r.call(t,e)})},e.prototype.onSessionIdChanged=function(e){this.plugins.forEach(function(t){var r;null==(r=t.onSessionIdChanged)||r.call(t,e)})},e.prototype.onOptOutChanged=function(e){this.plugins.forEach(function(t){var r;null==(r=t.onOptOutChanged)||r.call(t,e)}),this._callOptOutListeners(e)},e.prototype._callOptOutListeners=function(e){return(0,es.__awaiter)(this,void 0,void 0,function(){var t,r,n,i,o,s;return(0,es.__generator)(this,function(a){switch(a.label){case 0:a.trys.push([0,7,8,9]),r=(t=(0,es.__values)(this._optOutListeners)).next(),a.label=1;case 1:if(r.done)return[3,6];n=r.value,a.label=2;case 2:return a.trys.push([2,4,,5]),[4,n(e)];case 3:return a.sent(),[3,5];case 4:return i=a.sent(),this.loggerProvider.error("Error calling optOut listener",i),[3,5];case 5:return r=t.next(),[3,1];case 6:return[3,9];case 7:return o={error:a.sent()},[3,9];case 8:try{r&&!r.done&&(s=t.return)&&s.call(t)}finally{if(o)throw o.error}return[7];case 9:return[2]}})})},e.prototype.onReset=function(){this.plugins.forEach(function(e){var t;null==(t=e.onReset)||t.call(e)})},e}(),eB=function(e,t){return(0,es.__assign)((0,es.__assign)({},t),{event_type:D.IDENTIFY,user_properties:e.getUserProperties()})},eV=function(e,t,r,n){var i;return(0,es.__assign)((0,es.__assign)({},n),{event_type:D.GROUP_IDENTIFY,group_properties:r.getUserProperties(),groups:((i={})[e]=t,i)})},eK=function(e,t,r){var n,i=new eN;return i.set(e,t),(0,es.__assign)((0,es.__assign)({},r),{event_type:D.IDENTIFY,user_properties:i.getUserProperties(),groups:((n={})[e]=t,n)})},eW=function(e){return{promise:e||Promise.resolve()}},ez=function(){function e(e){void 0===e&&(e="$default"),this.initializing=!1,this.isReady=!1,this.q=[],this.dispatchQ=[],this.logEvent=this.track.bind(this),this.timeline=new eF(this),this.name=e}return e.prototype._init=function(e){return(0,es.__awaiter)(this,void 0,void 0,function(){return(0,es.__generator)(this,function(t){switch(t.label){case 0:return this.config=e,this.timeline.reset(this),this.timeline.loggerProvider=this.config.loggerProvider,[4,this.runQueuedFunctions("q")];case 1:return t.sent(),this.isReady=!0,[2]}})})},e.prototype.runQueuedFunctions=function(e){return(0,es.__awaiter)(this,void 0,void 0,function(){var t,r,n,i,o,s;return(0,es.__generator)(this,function(a){switch(a.label){case 0:t=this[e],this[e]=[],a.label=1;case 1:a.trys.push([1,8,9,10]),n=(r=(0,es.__values)(t)).next(),a.label=2;case 2:if(n.done)return[3,7];if(!((i=(0,n.value)())&&"promise"in i))return[3,4];return[4,i.promise];case 3:return a.sent(),[3,6];case 4:return[4,i];case 5:a.sent(),a.label=6;case 6:return n=r.next(),[3,2];case 7:return[3,10];case 8:return o={error:a.sent()},[3,10];case 9:try{n&&!n.done&&(s=r.return)&&s.call(r)}finally{if(o)throw o.error}
2return[7];case 10:if(!this[e].length)return[3,12];return[4,this.runQueuedFunctions(e)];case 11:a.sent(),a.label=12;case 12:return[2]}})})},e.prototype.track=function(e,t,r){var n=(0,es.__assign)((0,es.__assign)((0,es.__assign)({},"string"==typeof e?{event_type:e}:e),r),t&&{event_properties:t});return this.userProperties=this.getOperationAppliedUserProperties(n.user_properties),eW(this.dispatch(n))},e.prototype.identify=function(e,t){var r=eB(e,t);return this.userProperties=this.getOperationAppliedUserProperties(r.user_properties),eW(this.dispatch(r))},e.prototype.groupIdentify=function(e,t,r,n){var i=eV(e,t,r,n);return eW(this.dispatch(i))},e.prototype.setGroup=function(e,t,r){var n=eK(e,t,r);return this.userProperties=this.getOperationAppliedUserProperties(n.user_properties),eW(this.dispatch(n))},e.prototype.revenue=function(e,t){var r=(0,es.__assign)((0,es.__assign)({},t),{event_type:D.REVENUE,event_properties:e.getEventProperties()});return eW(this.dispatch(r))},e.prototype.add=function(e){return this.isReady?this._addPlugin(e):(this.q.push(this._addPlugin.bind(this,e)),eW())},e.prototype._addPlugin=function(e){return eW(this.timeline.register(e,this.config))},e.prototype.remove=function(e){return this.isReady?this._removePlugin(e):(this.q.push(this._removePlugin.bind(this,e)),eW())},e.prototype._removePlugin=function(e){return eW(this.timeline.deregister(e,this.config))},e.prototype.dispatchWithCallback=function(e,t){if(!this.isReady)return t(eL(e,0,"Client not initialized"));this.process(e).then(t)},e.prototype.dispatch=function(e){return(0,es.__awaiter)(this,void 0,void 0,function(){var t=this;return(0,es.__generator)(this,function(r){return this.isReady?[2,this.process(e)]:[2,new Promise(function(r){t.dispatchQ.push(t.dispatchWithCallback.bind(t,e,r))})]})})},e.prototype.getOperationAppliedUserProperties=function(e){var t,r=null!=(t=this.userProperties)?t:{},n=(0,es.__assign)({},r);if(void 0===e)return n;var i={};return Object.keys(e).forEach(function(t){Object.values(N).includes(t)||(i[t]=e[t])}),eD.forEach(function(t){if(Object.keys(e).includes(t)){var r=e[t];switch(t){case N.CLEAR_ALL:Object.keys(n).forEach(function(e){delete n[e]});break;case N.UNSET:Object.keys(r).forEach(function(e){delete n[e]});break;case N.SET:Object.assign(n,r)}}}),Object.assign(n,i),n},e.prototype.process=function(e){return(0,es.__awaiter)(this,void 0,void 0,function(){var t,r;return(0,es.__generator)(this,function(n){switch(n.label){case 0:if(n.trys.push([0,2,,3]),this.config.optOut)return[2,eL(e,0,"Event skipped due to optOut config")];return e.event_type===D.IDENTIFY&&this.timeline.onIdentityChanged({userProperties:this.userProperties}),[4,this.timeline.push(e)];case 1:return 200===(t=n.sent()).code?this.config.loggerProvider.log(t.message):100===t.code?this.config.loggerProvider.warn(t.message):this.config.loggerProvider.error(t.message),[2,t];case 2:return r=String(n.sent()),this.config.loggerProvider.error(r),[2,t=eL(e,0,r)];case 3:return[2]}})})},e.prototype.setOptOut=function(e){this.isReady?this._setOptOut(e):this.q.push(this._setOptOut.bind(this,!!e))},e.prototype._setOptOut=function(e){this.config.optOut!==e&&(this.config.optOut=!!e,this.timeline.onOptOutChanged(e))},e.prototype.flush=function(){return eW(this.timeline.flush())},e.prototype.plugin=function(e){var t=this.timeline.plugins.find(function(t){return t.name===e});return void 0===t?void this.config.loggerProvider.debug("Cannot find plugin with name ".concat(e)):t},e.prototype.plugins=function(e){return this.timeline.plugins.filter(function(t){return t instanceof e})},e}(),eH=function(e,t){var r=Math.max(t,1);return e.reduce(function(e,t,n){var i=Math.floor(n/r);return e[i]||(e[i]=[]),e[i].push(t),e},[])},eG="Amplitude Logger ",eJ=function(){function e(){this.logLevel=M.None}return e.prototype.disable=function(){this.logLevel=M.None},e.prototype.enable=function(e){void 0===e&&(e=M.Warn),this.logLevel=e},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<M.Verbose||console.log("".concat(eG,"[Log]: ").concat(e.join(" ")))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<M.Warn||console.warn("".concat(eG,"[Warn]: ").concat(e.join(" ")))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];
2this.logLevel<M.Error||console.error("".concat(eG,"[Error]: ").concat(e.join(" ")))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<M.Debug||console.log("".concat(eG,"[Debug]: ").concat(e.join(" ")))},e}(),e$=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:eh,logLevel:M.Warn,loggerProvider:new eJ,offline:!1,optOut:!1,serverUrl:ep,serverZone:"US",useBatch:!1}},eX=function(){function e(e){this._optOut=!1;var t,r,n,i,o=e$();this.apiKey=e.apiKey,this.flushIntervalMillis=null!=(t=e.flushIntervalMillis)?t:o.flushIntervalMillis,this.flushMaxRetries=e.flushMaxRetries||o.flushMaxRetries,this.flushQueueSize=e.flushQueueSize||o.flushQueueSize,this.instanceName=e.instanceName||o.instanceName,this.loggerProvider=e.loggerProvider||o.loggerProvider,this.logLevel=null!=(r=e.logLevel)?r:o.logLevel,this.minIdLength=e.minIdLength,this.plan=e.plan,this.ingestionMetadata=e.ingestionMetadata,this.offline=void 0!==e.offline?e.offline:o.offline,this.optOut=null!=(n=e.optOut)?n:o.optOut,this.serverUrl=e.serverUrl,this.serverZone=e.serverZone||o.serverZone,this.storageProvider=e.storageProvider,this.transportProvider=e.transportProvider,this.useBatch=null!=(i=e.useBatch)?i:o.useBatch,this.loggerProvider.enable(this.logLevel);var s=eY(e.serverUrl,e.serverZone,e.useBatch);this.serverZone=s.serverZone,this.serverUrl=s.serverUrl}return Object.defineProperty(e.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut=e},enumerable:!1,configurable:!0}),e}(),eY=function(e,t,r){if(void 0===e&&(e=""),void 0===t&&(t=e$().serverZone),void 0===r&&(r=e$().useBatch),e)return{serverUrl:e,serverZone:void 0};var n,i=["US","EU"].includes(t)?t:e$().serverZone;return{serverZone:i,serverUrl:(n=r,"EU"===i?n?em:eg:n?ev:ep)}},eQ=function(){function e(){this.sdk={metrics:{histogram:{}}}}return e.prototype.recordHistogram=function(e,t){this.sdk.metrics.histogram[e]=t},e}();function eZ(e){return e>=200&&e<300}var e0=new Set([ep,eg,ev,em]);function e1(e){var t="";try{"body"in e&&(t=JSON.stringify(e.body,null,2))}catch(e){}return t}var e2=function(){function e(e){this.name="amplitude",this.type="destination",this.retryTimeout=1e3,this.throttleTimeout=3e4,this.storageKey="",this.scheduleId=null,this.scheduledTimeout=0,this.flushId=null,this.queue=[],this.diagnosticsClient=null==e?void 0:e.diagnosticsClient}return e.prototype.setup=function(e){var t;return(0,es.__awaiter)(this,void 0,void 0,function(){var r,n=this;return(0,es.__generator)(this,function(i){switch(i.label){case 0:return this.config=e,this.storageKey="".concat(ef,"_").concat(this.config.apiKey.substring(0,10)),[4,null==(t=this.config.storageProvider)?void 0:t.get(this.storageKey)];case 1:return(r=i.sent())&&r.length>0&&Promise.all(r.map(function(e){return n.execute(e)})).catch(),[2,Promise.resolve(void 0)]}})})},e.prototype.execute=function(e){var t=this;return e.insert_id||(e.insert_id=ej()),new Promise(function(r){t.queue.push({event:e,attempts:0,callback:function(e){return r(e)},timeout:0}),t.schedule(t.config.flushIntervalMillis),t.saveEvents()})},e.prototype.removeEventsExceedFlushMaxRetries=function(e){var t=this;return e.filter(function(e){return e.attempts+=1,e.attempts<t.config.flushMaxRetries||(t.fulfillRequest([e],500,"Event rejected due to exceeded retry count"),!1)})},e.prototype.scheduleEvents=function(e){var t=this;e.forEach(function(e){t.schedule(0===e.timeout?t.config.flushIntervalMillis:e.timeout)})},e.prototype.schedule=function(e){var t=this;if(!this.config.offline&&(null===this.scheduleId||this.scheduleId&&e>this.scheduledTimeout)){this.scheduleId&&clearTimeout(this.scheduleId),this.scheduledTimeout=e,this.scheduleId=setTimeout(function(){t.queue=t.queue.map(function(e){return e.timeout=0,e}),t.flush(!0)},e);return}},e.prototype.resetSchedule=function(){this.scheduleId=null,this.scheduledTimeout=0},e.prototype.flush=function(e){return void 0===e&&(e=!1),(0,es.__awaiter)(this,void 0,void 0,function(){var t,r,n=this;return(0,es.__generator)(this,function(i){switch(i.label){case 0:if(this.config.offline)return this.resetSchedule(),this.config.loggerProvider.debug("Skipping flush while offline."),[2];if(this.flushId)return this.resetSchedule(),this.config.loggerProvider.debug("Skipping flush because previous flush has not resolved."),[2];return this.flushId=this.scheduleId,this.resetSchedule(),t=[],r=[],this.queue.forEach(function(e){return 0===e.timeout?t.push(e):r.push(e)}),[4,eH(t,this.config.flushQueueSize).reduce(function(t,r){return(0,es.__awaiter)(n,void 0,void 0,function(){return(0,es.__generator)(this,function(n){switch(n.label){case 0:return[4,t];case 1:return n.sent(),[4,this.send(r,e)];case 2:return[2,n.sent()]}})})},Promise.resolve())];case 1:return i.sent(),this.flushId=null,this.scheduleEvents(this.queue),[2]}})})},e.prototype.send=function(e,t){var r;return void 0===t&&(t=!0),(0,es.__awaiter)(this,void 0,void 0,function(){var n,i,o,s,a;return(0,es.__generator)(this,function(u){var l,c,d;switch(u.label){case 0:if(!this.config.apiKey)return[2,this.fulfillRequest(e,400,"Event rejected due to missing API key")];n={api_key:this.config.apiKey,events:e.map(function(e){var t=e.event;return t.extra,(0,es.__rest)(t,["extra"])}),options:{min_id_length:this.config.minIdLength},client_upload_time:new Date().toISOString(),request_metadata:this.config.requestMetadata},this.config.requestMetadata=new eQ,u.label=1;case 1:return u.trys.push([1,3,,4]),l=i=eY(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,void 0===(c=this.config.enableRequestBodyCompression)&&(c=!1),o=!!e0.has(l)||c,[4,this.config.transportProvider.send(i,n,this.config._enableRequestBodyCompressionExperimental&&o)];case 2:if(null===(s=u.sent()))return this.fulfillRequest(e,0,"Unexpected error occurred"),[2];if(!t)return"body"in s?this.fulfillRequest(e,s.statusCode,"".concat(s.status,": ").concat(e1(s))):this.fulfillRequest(e,s.statusCode,s.status),[2];return this.handleResponse(s,e),[3,4];case 3:return a=(d=u.sent())instanceof Error?d.message:String(d),this.config.loggerProvider.error(a),null==(r=this.diagnosticsClient)||r.recordEvent("analytics.events.unsuccessful.from.catch.error",{events:e.map(function(e){return e.event.event_type}),message:a,stack_trace:ea()}),this.handleResponse({status:U.Failed,statusCode:0},e),[3,4];case 4:return[2]}})})},e.prototype.handleResponse=function(e,t){eZ(e.statusCode)||null==(r=this.diagnosticsClient)||r.recordEvent("analytics.events.unsuccessful",{events:t.map(function(e){return e.event.event_type}),code:e.statusCode,status:e.status,body:e1(e),stack_trace:ea()});var r,n=e.status;switch(n){case U.Success:this.handleSuccessResponse(e,t);break;case U.Invalid:this.handleInvalidResponse(e,t);break;case U.PayloadTooLarge:this.handlePayloadTooLargeResponse(e,t);break;case U.RateLimit:this.handleRateLimitResponse(e,t);break;default:this.config.loggerProvider.warn("{code: 0, error: \"Status '".concat(n,"' provided for ").concat(t.length,' events"}')),this.handleOtherResponse(t)}},e.prototype.handleSuccessResponse=function(e,t){this.fulfillRequest(t,e.statusCode,"Event tracked successfully")},e.prototype.handleInvalidResponse=function(e,t){var r=this;if(e.body.missingField||e.body.error.startsWith("Invalid API key"))return void this.fulfillRequest(t,e.statusCode,e.body.error);var n=new Set((0,es.__spreadArray)((0,es.__spreadArray)((0,es.__spreadArray)((0,es.__spreadArray)([],(0,es.__read)(Object.values(e.body.eventsWithInvalidFields)),!1),(0,es.__read)(Object.values(e.body.eventsWithMissingFields)),!1),(0,es.__read)(Object.values(e.body.eventsWithInvalidIdLengths)),!1),(0,es.__read)(e.body.silencedEvents),!1).flat()),i=t.filter(function(t,i){return!n.has(i)||void r.fulfillRequest([t],e.statusCode,e.body.error)});i.length>0&&this.config.loggerProvider.warn(e1(e));
2var o=this.removeEventsExceedFlushMaxRetries(i);this.scheduleEvents(o)},e.prototype.handlePayloadTooLargeResponse=function(e,t){if(1===t.length)return void this.fulfillRequest(t,e.statusCode,e.body.error);this.config.loggerProvider.warn(e1(e)),this.config.flushQueueSize/=2;var r=this.removeEventsExceedFlushMaxRetries(t);this.scheduleEvents(r)},e.prototype.handleRateLimitResponse=function(e,t){var r=this,n=Object.keys(e.body.exceededDailyQuotaUsers),i=Object.keys(e.body.exceededDailyQuotaDevices),o=e.body.throttledEvents,s=new Set(n),a=new Set(i),u=new Set(o),l=t.filter(function(t,n){return t.event.user_id&&s.has(t.event.user_id)||t.event.device_id&&a.has(t.event.device_id)?void r.fulfillRequest([t],e.statusCode,e.body.error):(u.has(n)&&(t.timeout=r.throttleTimeout),!0)});l.length>0&&this.config.loggerProvider.warn(e1(e));var c=this.removeEventsExceedFlushMaxRetries(l);this.scheduleEvents(c)},e.prototype.handleOtherResponse=function(e){var t=this,r=e.map(function(e){return e.timeout=e.attempts*t.retryTimeout,e}),n=this.removeEventsExceedFlushMaxRetries(r);this.scheduleEvents(n)},e.prototype.fulfillRequest=function(e,t,r){var n,i,o;eZ(t)?null==(o=this.diagnosticsClient)||o.increment("analytics.events.sent",e.length):(null==(n=this.diagnosticsClient)||n.increment("analytics.events.dropped",e.length),null==(i=this.diagnosticsClient)||i.recordEvent("analytics.events.dropped",{events:e.map(function(e){return e.event.event_type}),code:t,message:r,stack_trace:ea()})),this.removeEvents(e),e.forEach(function(e){return e.callback(eL(e.event,t,r))})},e.prototype.saveEvents=function(){if(this.config.storageProvider){var e=this.queue.map(function(e){return e.event});this.config.storageProvider.set(this.storageKey,e)}},e.prototype.removeEvents=function(e){this.queue=this.queue.filter(function(t){return!e.some(function(e){return e.event.insert_id===t.event.insert_id})}),this.saveEvents()},e}(),e3=function(){function e(){this.productId="",this.quantity=1,this.price=0}return e.prototype.setProductId=function(e){return this.productId=e,this},e.prototype.setQuantity=function(e){return e>0&&(this.quantity=e),this},e.prototype.setPrice=function(e){return this.price=e,this},e.prototype.setRevenueType=function(e){return this.revenueType=e,this},e.prototype.setCurrency=function(e){return this.currency=e,this},e.prototype.setRevenue=function(e){return this.revenue=e,this},e.prototype.setReceipt=function(e){return this.receipt=e,this},e.prototype.setReceiptSig=function(e){return this.receiptSig=e,this},e.prototype.setEventProperties=function(e){try{var t=JSON.parse(JSON.stringify(e));eR(t)&&(this.properties=t)}catch(e){}return this},e.prototype.getEventProperties=function(){var e=this.properties?(0,es.__assign)({},this.properties):{};return e[q.REVENUE_PRODUCT_ID]=this.productId,e[q.REVENUE_QUANTITY]=this.quantity,e[q.REVENUE_PRICE]=this.price,e[q.REVENUE_TYPE]=this.revenueType,e[q.REVENUE_CURRENCY]=this.currency,e[q.REVENUE]=this.revenue,e[q.RECEIPT]=this.receipt,e[q.RECEIPT_SIG]=this.receiptSig,e},e}();(u=q||(q={})).REVENUE_PRODUCT_ID="$productId",u.REVENUE_QUANTITY="$quantity",u.REVENUE_PRICE="$price",u.REVENUE_TYPE="$revenueType",u.REVENUE_CURRENCY="$currency",u.REVENUE="$revenue",u.RECEIPT="$receipt",u.RECEIPT_SIG="$receiptSig";var e4=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:e5(),platform:"Web",os:void 0,deviceModel:void 0}},e}(),e5=function(){return"u">typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},e6=function(){function e(){this.queue=[]}return e.prototype.logEvent=function(e){this.receiver?this.receiver(e):this.queue.length<512&&this.queue.push(e)},e.prototype.setEventReceiver=function(e){this.receiver=e,this.queue.length>0&&(this.queue.forEach(function(t){e(t)}),this.queue=[])},e}(),e8=function(){return(e8=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}).apply(this,arguments)};function e7(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);
2if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function e9(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s}"function"==typeof SuppressedError&&SuppressedError;var te=function(e,t){var r,n,i=typeof e;if(i!==typeof t)return!1;try{for(var o=e7(["string","number","boolean","undefined"]),s=o.next();!s.done;s=o.next())if(s.value===i)return e===t}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}if(null==e&&null==t)return!0;if(null==e||null==t||e.length!==t.length)return!1;var a=Array.isArray(e),u=Array.isArray(t);if(a!==u)return!1;if(a&&u){for(var l=0;l<e.length;l++)if(!te(e[l],t[l]))return!1}else{if(!te(Object.keys(e).sort(),Object.keys(t).sort()))return!1;var c=!0;return Object.keys(e).forEach(function(r){te(e[r],t[r])||(c=!1)}),c}return!0};Object.entries||(Object.entries=function(e){for(var t=Object.keys(e),r=t.length,n=Array(r);r--;)n[r]=[t[r],e[t[r]]];return n});var tt=function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var e=this,t=e8({},this.identity.userProperties),r=e8(e8({},this.identity),{userProperties:t});return{setUserId:function(e){return r.userId=e,this},setDeviceId:function(e){return r.deviceId=e,this},setUserProperties:function(e){return r.userProperties=e,this},setOptOut:function(e){return r.optOut=e,this},updateUserProperties:function(e){var t,n,i,o,s,a,u=r.userProperties||{};try{for(var l=e7(Object.entries(e)),c=l.next();!c.done;c=l.next()){var d=e9(c.value,2),f=d[0],h=d[1];switch(f){case"$set":try{for(var p=(i=void 0,e7(Object.entries(h))),g=p.next();!g.done;g=p.next()){var v=e9(g.value,2),m=v[0],y=v[1];u[m]=y}}catch(e){i={error:e}}finally{try{g&&!g.done&&(o=p.return)&&o.call(p)}finally{if(i)throw i.error}}break;case"$unset":try{for(var b=(s=void 0,e7(Object.keys(h))),_=b.next();!_.done;_=b.next()){var m=_.value;delete u[m]}}catch(e){s={error:e}}finally{try{_&&!_.done&&(a=b.return)&&a.call(b)}finally{if(s)throw s.error}}break;case"$clearAll":u={}}}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=l.return)&&n.call(l)}finally{if(t)throw t.error}}return r.userProperties=u,this},commit:function(){return e.setIdentity(r),this}}},e.prototype.getIdentity=function(){return e8({},this.identity)},e.prototype.setIdentity=function(e){var t=e8({},this.identity);this.identity=e8({},e),te(t,this.identity)||this.listeners.forEach(function(t){t(e)})},e.prototype.addIdentityListener=function(e){this.listeners.add(e)},e.prototype.removeIdentityListener=function(e){this.listeners.delete(e)},e}(),tr="u">typeof globalThis?globalThis:e.g,tn=function(){function e(){this.identityStore=new tt,this.eventBridge=new e6,this.applicationContextProvider=new e4}return e.getInstance=function(t){return tr.analyticsConnectorInstances||(tr.analyticsConnectorInstances={}),tr.analyticsConnectorInstances[t]||(tr.analyticsConnectorInstances[t]=new e),tr.analyticsConnectorInstances[t]},e}(),ti=function(e){return void 0===e&&(e=eh),tn.getInstance(e)},to=function(e,t){ti(t).identityStore.editIdentity().setUserId(e).commit()},ts=function(e,t){ti(t).identityStore.editIdentity().setDeviceId(e).commit()},ta=function(e,t){return void 0===t&&(t=Date.now()),Date.now()-t>e},tu=function(){function e(){this.name="identity",this.type="before",this.identityStore=ti().identityStore}return e.prototype.execute=function(e){return(0,es.__awaiter)(this,void 0,void 0,function(){var t;return(0,es.__generator)(this,function(r){return(t=e.user_properties)&&this.identityStore.editIdentity().updateUserProperties(t).commit(),[2,e]})})},e.prototype.setup=function(e){return(0,es.__awaiter)(this,void 0,void 0,function(){return(0,es.__generator)(this,function(t){return e.instanceName&&(this.identityStore=ti(e.instanceName).identityStore),[2]})})},e}(),tl=function(){var e,t=(0,eU.getGlobalScope)();return(null==(e=null==t?void 0:t.location)?void 0:e.search)?t.location.search.substring(1).split("&").filter(
2Boolean).reduce(function(e,t){var r=t.split("=",2),n=tc(r[0]),i=tc(r[1]);return i&&(e[n]=i),e},{}):{}},tc=function(e){void 0===e&&(e="");try{return decodeURIComponent(e)}catch(e){return""}},td=function(){function e(e,t){this.key="AMP_remote_config_".concat(e.substring(0,10)),this.logger=t}return e.prototype.fetchConfig=function(){var e=null,t={remoteConfig:null,lastFetch:new Date};try{e=localStorage.getItem(this.key)}catch(e){return this.logger.debug("Remote config localstorage failed to access: ",e),Promise.resolve(t)}if(null===e)return this.logger.debug("Remote config localstorage gets null because the key does not exist"),Promise.resolve(t);try{var r=JSON.parse(e);return this.logger.debug("Remote config localstorage parsed successfully: ".concat(JSON.stringify(r))),Promise.resolve({remoteConfig:r.remoteConfig,lastFetch:new Date(r.lastFetch)})}catch(e){return this.logger.debug("Remote config localstorage failed to parse: ",e),localStorage.removeItem(this.key),Promise.resolve(t)}},e.prototype.setConfig=function(e){try{return localStorage.setItem(this.key,JSON.stringify(e)),this.logger.debug("Remote config localstorage set successfully."),Promise.resolve(!0)}catch(e){this.logger.debug("Remote config localstorage failed to set: ",e)}return Promise.resolve(!1)},e}(),tf=function(){function e(e,t,r,n){void 0===r&&(r="US"),this.callbackInfos=[],this.lastSuccessfulFetch=null,this.fetchPromise=null,this.isLastFetchInvalidApiKey=!1,this.apiKey=e,this.serverUrl=n||("US"===r?"https://sr-client-cfg.amplitude.com/config":"https://sr-client-cfg.eu.amplitude.com/config"),this.logger=t,this.storage=new td(e,t)}return e.prototype.subscribe=function(e,t,r){var n=ej(),i={id:n,key:e,deliveryMode:t,callback:r};return this.callbackInfos.push(i),"all"===t?this.subscribeAll(i):this.subscribeWaitForRemote(i,t.timeout),n},e.prototype.unsubscribe=function(e){var t=this.callbackInfos.findIndex(function(t){return t.id===e});return -1===t?(this.logger.debug("Remote config client unsubscribe failed because callback with id ".concat(e," doesn't exist.")),!1):(this.callbackInfos.splice(t,1),this.logger.debug("Remote config client unsubscribe succeeded removing callback with id ".concat(e,".")),!0)},e.prototype.updateConfigs=function(){return(0,es.__awaiter)(this,void 0,void 0,function(){var e,t=this;return(0,es.__generator)(this,function(r){switch(r.label){case 0:if(this.lastSuccessfulFetch&&Date.now()-this.lastSuccessfulFetch<3e5)return this.logger.debug("Remote config client skipping updateConfigs: Too recent"),[2];return[4,this.getOrCreateFetchPromise()];case 1:return e=r.sent(),this.storage.setConfig(e),this.callbackInfos.forEach(function(r){t.sendCallback(r,e,"remote")}),[2]}})})},e.prototype.getOrCreateFetchPromise=function(){var e=this;return this.fetchPromise||(this.isLastFetchInvalidApiKey?(this.logger.debug("Remote config client skipping fetch: Invalid API key"),this.fetchPromise=Promise.resolve({remoteConfig:null,lastFetch:new Date}).finally(function(){e.fetchPromise=null})):this.fetchPromise=this.fetch().then(function(t){return null!==t.remoteConfig&&(e.lastSuccessfulFetch=Date.now()),t}).finally(function(){e.fetchPromise=null})),this.fetchPromise},e.prototype.subscribeAll=function(e){return(0,es.__awaiter)(this,void 0,void 0,function(){var t,r,n,i=this;return(0,es.__generator)(this,function(o){switch(o.label){case 0:return t=this.getOrCreateFetchPromise().then(function(t){i.logger.debug("Remote config client subscription all mode fetched from remote: ".concat(JSON.stringify(t))),i.sendCallback(e,t,"remote"),i.storage.setConfig(t)}),r=this.storage.fetchConfig().then(function(e){return e}),[4,Promise.race([t,r])];case 1:return void 0!==(n=o.sent())&&(this.logger.debug("Remote config client subscription all mode fetched from cache: ".concat(JSON.stringify(n))),null!==n.remoteConfig?this.sendCallback(e,n,"cache"):this.logger.debug("Remote config client skips sending c
2allback because cache is empty (first time user).")),[4,t];case 2:return o.sent(),[2]}})})},e.prototype.subscribeWaitForRemote=function(e,t){return(0,es.__awaiter)(this,void 0,void 0,function(){var r,n;return(0,es.__generator)(this,function(i){switch(i.label){case 0:r=new Promise(function(e,r){setTimeout(function(){r("Timeout exceeded")},t)}),i.label=1;case 1:return i.trys.push([1,3,,5]),[4,Promise.race([this.getOrCreateFetchPromise(),r])];case 2:return n=i.sent(),this.logger.debug("Remote config client subscription wait for remote mode returns from remote."),this.sendCallback(e,n,"remote"),this.storage.setConfig(n),[3,5];case 3:return i.sent(),this.logger.debug("Remote config client subscription wait for remote mode exceeded timeout. Try to fetch from cache."),[4,this.storage.fetchConfig()];case 4:return null!==(n=i.sent()).remoteConfig?(this.logger.debug("Remote config client subscription wait for remote mode returns a cached copy."),this.sendCallback(e,n,"cache")):(this.logger.debug("Remote config client subscription wait for remote mode failed to fetch cache."),this.sendCallback(e,n,"remote")),[3,5];case 5:return[2]}})})},e.prototype.sendCallback=function(e,t,r){var n;e.lastCallback=new Date,n=e.key?e.key.split(".").reduce(function(e,t){return null===e?e:t in e?e[t]:null},t.remoteConfig):t.remoteConfig,e.callback(n,r,t.lastFetch)},e.prototype.fetch=function(e,t){return void 0===e&&(e=3),void 0===t&&(t=1e3),(0,es.__awaiter)(this,void 0,void 0,function(){var r,n,i,o,s,a,u=this;return(0,es.__generator)(this,function(l){switch(l.label){case 0:r=t/e,n={remoteConfig:null,lastFetch:new Date},i=function(n){var i,s,a,l,c,d;return(0,es.__generator)(this,function(f){switch(f.label){case 0:i=!0,s=new AbortController,a=setTimeout(function(){return s.abort()},t),f.label=1;case 1:return f.trys.push([1,7,8,9]),[4,fetch(o.getUrlParams(),{method:"GET",headers:{Accept:"*/*"},signal:s.signal})];case 2:if((l=f.sent()).ok)return[3,4];return[4,l.text()];case 3:return c=f.sent(),o.logger.debug("Remote config client fetch with retry time ".concat(e," failed with ").concat(l.status,": ").concat(c)),401===l.status||403===l.status?(o.logger.error("Remote config client fetch failed with ".concat(l.status,". Invalid API key; future fetches will be skipped.")),o.isLastFetchInvalidApiKey=!0,i=!1):l.status>=400&&l.status<500&&429!==l.status&&(i=!1),[3,6];case 4:return[4,l.json()];case 5:return[2,{value:{remoteConfig:f.sent(),lastFetch:new Date}}];case 6:return[3,9];case 7:return(d=f.sent())instanceof Error&&"AbortError"===d.name?o.logger.debug("Remote config client fetch with retry time ".concat(e," timed out after ").concat(t,"ms")):o.logger.debug("Remote config client fetch with retry time ".concat(e," is rejected because: "),d),[3,9];case 8:return clearTimeout(a),[7];case 9:if(!i)return[2,"break"];if(!(n<e-1))return[3,11];return[4,new Promise(function(e){return setTimeout(e,u.getJitterDelay(r))})];case 10:f.sent(),f.label=11;case 11:return[2]}})},o=this,s=0,l.label=1;case 1:if(!(s<e))return[3,4];return[5,i(s)];case 2:if("object"==typeof(a=l.sent()))return[2,a.value];if("break"===a)return[3,4];l.label=3;case 3:return s++,[3,1];case 4:return[2,n]}})})},e.prototype.getJitterDelay=function(e){return Math.floor(Math.random()*e)},e.prototype.getUrlParams=function(){var t=encodeURIComponent(this.apiKey),r=new URLSearchParams;return r.append("config_group",e.CONFIG_GROUP),"".concat(this.serverUrl,"/").concat(t,"?").concat(r.toString())},e.CONFIG_GROUP="browser",e}(),th="tags",tp="counters",tg="histograms",tv="events",tm="internal",ty="last_flush_timestamp",tb=function(){function e(e,t){this.dbPromise=null,this.logger=t,this.dbName="AMP_diagnostics_".concat(e.substring(0,10))}return e.isSupported=function(){var e;return(null==(e=(0,eU.getGlobalScope)())?void 0:e.indexedDB)!==void 0},e.prototype.getDB=function(){return(0,es.__awaiter)(this,void 0,void 0,function(){return(0,es.__generator)(this,function(e){return this.dbPromise||(this.dbPromise=this.openDB()),[2,this.dbPromise]})})},e.prototype.openDB=function(){var e=this;return new Promise(function(t,r){var n=indexedDB.open(e.dbName,1);n.onerror=function(){e.dbPromise=null,r(Error("Failed to open IndexedDB"))},n.onsuccess=function(){var r=n.result;r.onclose=function(){e.dbPromise=null,e.logger.debug("DiagnosticsStorage: DB connection closed.")},r.onerror=function(t){e.logger.debug("DiagnosticsStorage: A global database error occurred.",t),r.close()},t(r)},n.onupgradeneeded=function(t){var r=t.target.result;e.createTables(r)}})},e.prototype.createTables=function(e){e.objectStoreNames.contains(th)||e.createObjectStore(th,{keyPath:"key"}),e.objectStoreNames.contains(tp)||e.createObjectStore(tp,{keyPath:"key"}),e.objectStoreNames.contains(tg)||e.createObjectStore(tg,{keyPath:"key"}),e.objectStoreNames.contains(tv)||e.createObjectStore(tv,{keyPath:"id",autoIncrement:!0}).createIndex("time_idx","time",{unique:!1}),e.objectStoreNames.contains(tm)||e.createObjectStore(tm,{keyPath:"key"})},e.prototype.setTags=function(e){return(0,es.__awaiter)(this,void 0,void 0,function(){var t,r,n,i=this;return(0,es.__generator)(this,function(o){switch(o.label){case 0:if(o.tr
2ys.push([0,2,,3]),0===Object.entries(e).length)return[2];return[4,this.getDB()];case 1:return r=(t=o.sent().transaction([th],"readwrite")).objectStore(th),[2,new Promise(function(n){var o=Object.entries(e);t.oncomplete=function(){n()},t.onabort=function(e){i.logger.debug("DiagnosticsStorage: Failed to set tags",e),n()},o.forEach(function(e){var t=(0,es.__read)(e,2),n=t[0],o=t[1];r.put({key:n,value:o}).onerror=function(e){i.logger.debug("DiagnosticsStorage: Failed to set tag",n,o,e)}})})];case 2:return n=o.sent(),this.logger.debug("DiagnosticsStorage: Failed to set tags",n),[3,3];case 3:return[2]}})})},e.prototype.incrementCounters=function(e){return(0,es.__awaiter)(this,void 0,void 0,function(){var t,r,n,i=this;return(0,es.__generator)(this,function(o){switch(o.label){case 0:if(o.trys.push([0,2,,3]),0===Object.entries(e).length)return[2];return[4,this.getDB()];case 1:return r=(t=o.sent().transaction([tp],"readwrite")).objectStore(tp),[2,new Promise(function(n){var o=Object.entries(e);t.oncomplete=function(){n()},t.onabort=function(e){i.logger.debug("DiagnosticsStorage: Failed to increment counters",e),n()},o.forEach(function(e){var t=(0,es.__read)(e,2),n=t[0],o=t[1],s=r.get(n);s.onsuccess=function(){var e=s.result,t=e?e.value:0;r.put({key:n,value:t+o}).onerror=function(e){i.logger.debug("DiagnosticsStorage: Failed to update counter",n,e)}},s.onerror=function(e){i.logger.debug("DiagnosticsStorage: Failed to read existing counter",n,e)}})})];case 2:return n=o.sent(),this.logger.debug("DiagnosticsStorage: Failed to increment counters",n),[3,3];case 3:return[2]}})})},e.prototype.setHistogramStats=function(e){return(0,es.__awaiter)(this,void 0,void 0,function(){var t,r,n,i=this;return(0,es.__generator)(this,function(o){switch(o.label){case 0:if(o.trys.push([0,2,,3]),0===Object.entries(e).length)return[2];return[4,this.getDB()];case 1:return r=(t=o.sent().transaction([tg],"readwrite")).objectStore(tg),[2,new Promise(function(n){var o=Object.entries(e);t.oncomplete=function(){n()},t.onabort=function(e){i.logger.debug("DiagnosticsStorage: Failed to set histogram stats",e),n()},o.forEach(function(e){var t=(0,es.__read)(e,2),n=t[0],o=t[1],s=r.get(n);s.onsuccess=function(){var e,t=s.result;e=t?{key:n,count:t.count+o.count,min:Math.min(t.min,o.min),max:Math.max(t.max,o.max),sum:t.sum+o.sum}:{key:n,count:o.count,min:o.min,max:o.max,sum:o.sum},r.put(e).onerror=function(e){i.logger.debug("DiagnosticsStorage: Failed to set histogram stats",n,e)}},s.onerror=function(e){i.logger.debug("DiagnosticsStorage: Failed to read existing histogram stats",n,e)}})})];case 2:return n=o.sent(),this.logger.debug("DiagnosticsStorage: Failed to set histogram stats",n),[3,3];case 3:return[2]}})})},e.prototype.addEventRecords=function(e){return(0,es.__awaiter)(this,void 0,void 0,function(){var t,r,n,i=this;return(0,es.__generator)(this,function(o){switch(o.label){case 0:if(o.trys.push([0,2,,3]),0===e.length)return[2];return[4,this.getDB()];case 1:return r=(t=o.sent().transaction([tv],"readwrite")).objectStore(tv),[2,new Promise(function(n){t.oncomplete=function(){n()},t.onabort=function(e){i.logger.debug("DiagnosticsStorage: Failed to add event records",e),n()};var o=r.count();o.onsuccess=function(){var t=Math.max(0,10-o.result);t<e.length&&i.logger.debug("DiagnosticsStorage: Only added ".concat(t," of ").concat(e.length," events due to storage limit")),e.slice(0,t).forEach(function(e){r.add(e).onerror=function(e){i.logger.debug("DiagnosticsStorage: Failed to add event record",e)}})},o.onerror=function(e){i.logger.debug("DiagnosticsStorage: Failed to count existing events",e)}})];case 2:return n=o.sent(),this.logger.debug("DiagnosticsStorage: Failed to add event records",n),[3,3];case 3:return[2]}})})},e.prototype.setInternal=function(e,t){return(0,es.__awaiter)(this,void 0,void 0,function(){var r,n,i;return(0,es.__generator)(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.getDB()];case 1:return n=(r=o.sent().transaction([tm],"readwrite")).objectStore(tm),[2,new Promise(function(i,o){r.onabort=function(){return o(Error("Failed to set internal value"))};var s=n.put({key:e,value:t});s.onsuccess=function(){return i()},s.onerror=function(){return o(Error("Failed to set internal value"))}})];case 2:return i=o.sent(),this.logger.debug("DiagnosticsStorage: Failed to set internal value",i),[3,3];case 3:return[2]}})})},e.prototype.getInternal=function(e){return(0,es.__awaiter)(this,void 0,void 0,function(){var t,r,n;return(0,es.__generator)(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.getDB()];case 1:return r=(t=i.sent().transaction([tm],"readonly")).objectStore(tm),[2,new Promise(function(n,i){t.onabort=function(){return i(Error("Failed to get internal value"))};var o=r.get(e);o.onsuccess=function(){return n(o.result)},o.onerror=function(){return i(Error("Failed to get internal value"))}})];case 2:return n=i.sent(),this.logger.debug("DiagnosticsStorage: Failed to get internal value",n),[2,void 0];case 3:return[2]}})})},e.prototype.getLastFlushTimestamp=function(){return(0,es.__awaiter)(this,void 0,void 0,function(){var e,t;return(0,es.__generator)(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.getInternal(ty)];case 1:return[2,(e=r.sent())?parseInt(e.value,10):void 0];case 2:return t=r.sent(),this.logger.debug("DiagnosticsStorage: Failed to get last flush timestamp",t),[2,void 0];case 3:return[2]}})})},e.prototype.setLastFlushTimestamp=function(e){return(0,es.__awaiter)(this,void 0,void 0,function(){var t;return(0,es.__generator)(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.setInternal(ty,e.toString())];case 1:return r.sent(),[3,3];case 2:return t=r.sent(),this.logger.debug("DiagnosticsStorage: Failed to set last flush timestamp",t),[3,3];case 3:return[2]}})})},e.prototype.clearTable=function(e,t){return new Promise(function(r,n){var i=e.objectStore(t).clear();i.onsuccess=function(){return r()},i.onerror=function(){return n(Error("Failed to clear table ".concat(t)))}})},e.prototype.getAllAndClear=function(){return(0,es.__awaiter)(this,void 0,void 0,function(){var e,t,r,n,i,o,s;return(0,es.__generator)(this,function(a){switch(a.label){case 0:return a.trys.push([0,4,,5]),[4,this.getDB()];case 1:return e=a.sent().transaction([th,tp,tg,tv],"readwrite"),[4,Promise.all([this.getAllFromStore(e,th),this.getAllFromStore(e,tp),this.getAllFromStore(e,tg),this.getAllFromStore(e,tv)])];case 2:return r=(t=es.__read.apply(void 0,[a.sent(),4]))[0],n=t[1],i=t[2],o=t[3],[4,Promise.all([this.clearTable(e,tp),this.clearTable(e,tg),this.clearTable(e,tv)])];case 3:return a.sent(),[2,{tags:r,counters:n,histogramStats:i,events:o}];case 4:return s=a.sent(),this.logger.debug("DiagnosticsStorage: Failed to get all and clear data",s),[2,{tags:[],counters:[],histogramStats:[],events:[]}];case 5:return[2]}})})},e.prototype.getAllFromStore=function(e,t){return new Promise(function(r,n){var i=e.objectStore(t).getAll();i.onsuccess=function(){return r(i.result)},i.onerror=function(){return n(Error("Failed to get all from ".concat(t)))}})},e}(),t_=function(e){var t=0;if(0===e.length)return t;for(var r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r)|0;return t}
2,tw=function(e,t){return 31*Math.abs(t_(e.toString()))%1e5/1e5<t},tS=function(){var e=(0,eU.getGlobalScope)();if(!e)return[];var t=e.__AMPLITUDE_SCRIPT_URL__;return Array.isArray(t)?t:"string"==typeof t?[t]:[]},tE=function(e){var t=(0,eU.getGlobalScope)();if(t&&"function"==typeof t.addEventListener){var r=function(t){e.recordEvent("sdk.error.uncaught",(0,es.__assign)({type:t.type,message:t.message,filename:t.filename,error_name:t.errorName,stack:t.stack},t.metadata))};t.addEventListener("error",function(e){var t=e.error instanceof Error?e.error:void 0,n=null==t?void 0:t.stack,i=tk({filename:e.filename,stack:n});i&&r({type:"error",message:e.message,stack:n,filename:e.filename,errorName:null==t?void 0:t.name,metadata:{colno:e.colno,lineno:e.lineno,isTrusted:e.isTrusted,matchReason:i}})},!0),t.addEventListener("unhandledrejection",function(e){var t,n=e.reason instanceof Error?e.reason:void 0,i=null==n?void 0:n.stack,o=tI(i),s=tk({filename:o,stack:i});s&&r({type:"unhandledrejection",message:null!=(t=null==n?void 0:n.message)?t:tx(e.reason),stack:i,filename:o,errorName:null==n?void 0:n.name,metadata:{isTrusted:e.isTrusted,matchReason:s}})},!0)}},tk=function(e){var t,r,n=tS();if(0!==n.length)try{for(var i=(0,es.__values)(n),o=i.next();!o.done;o=i.next()){var s=o.value;if(e.filename&&e.filename.includes(s))return"filename";if(e.stack&&e.stack.includes(s))return"stack"}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}},tI=function(e){if(e){var t=e.match(/(https?:\/\/\S+?)(?=[)\s]|$)/);return t?t[1]:void 0}},tx=function(e){if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(e){return"[object Object]"}},tT=function(){function e(e,t,r,n){void 0===r&&(r="US"),this.inMemoryTags={},this.inMemoryCounters={},this.inMemoryHistograms={},this.inMemoryEvents=[],this.saveTimer=null,this.flushTimer=null,this.apiKey=e,this.logger=t,this.serverUrl="US"===r?"https://diagnostics.prod.us-west-2.amplitude.com/v1/capture":"https://diagnostics.prod.eu-central-1.amplitude.com/v1/capture",this.logger.debug("DiagnosticsClient: Initializing with options",JSON.stringify(n,null,2)),this.config=(0,es.__assign)({enabled:!0,sampleRate:0},n),this.startTimestamp=Date.now(),this.shouldTrack=tw(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,tb.isSupported()?this.storage=new tb(e,t):this.logger.debug("DiagnosticsClient: IndexedDB is not supported"),this.initializeFlushInterval(),this.shouldTrack&&(this.increment("sdk.diagnostics.sampled.in.and.enabled"),tE(this))}return e.prototype.isStorageAndTrackEnabled=function(){return!!this.storage&&!!this.shouldTrack},e.prototype.setTag=function(e,t){if(this.isStorageAndTrackEnabled()){if(Object.keys(this.inMemoryTags).length>=1e4)return void this.logger.debug("DiagnosticsClient: Early return setTags as reaching memory limit");this.inMemoryTags[e]=t,this.startTimersIfNeeded()}},e.prototype.increment=function(e,t){if(void 0===t&&(t=1),this.isStorageAndTrackEnabled()){if(Object.keys(this.inMemoryCounters).length>=1e4)return void this.logger.debug("DiagnosticsClient: Early return increment as reaching memory limit");this.inMemoryCounters[e]=(this.inMemoryCounters[e]||0)+t,this.startTimersIfNeeded()}},e.prototype.recordHistogram=function(e,t){if(this.isStorageAndTrackEnabled()){if(Object.keys(this.inMemoryHistograms).length>=1e4)return void this.logger.debug("DiagnosticsClient: Early return recordHistogram as reaching memory limit");var r=this.inMemoryHistograms[e];r?(r.count+=1,r.min=Math.min(r.min,t),r.max=Math.max(r.max,t),r.sum+=t):this.inMemoryHistograms[e]={count:1,min:t,max:t,sum:t},this.startTimersIfNeeded()}},e.prototype.recordEvent=function(e,t){if(this.isStorageAndTrackEnabled()){if(this.inMemoryEvents.length>=10)return void this.logger.debug("DiagnosticsClient: Early return recordEvent as reaching memory limit");this.inMemoryEvents.push({event_name:e,time:Date.now(),event_properties:t}),this.startTimersIfNeeded()}},e.prototype.startTimersIfNeeded=function(){var e=this;this.saveTimer||(this.saveTimer=setTimeout(function(){e.saveAllDataToStorage().catch(function(t){e.logger.debug("DiagnosticsClient: Failed to save all data to storage",t)}).finally(function(){e.saveTimer=null})},1e3)),this.flushTimer||(this.flushTimer=setTimeout(function(){e._flush().catch(function(t){e.logger.debug("DiagnosticsClient: Failed to flush",t)}).finally(function(){e.flushTimer=null})},3e5))},e.prototype.saveAllDataToStorage=function(){return(0,es.__awaiter)(this,void 0,void 0,function(){var e,t,r,n;return(0,es.__generator)(this,function(i){switch(i.label){case 0:if(!this.storage)return[2];return e=(0,es.__assign)({},this.inMemoryTags),t=(0,es.__assign)({},this.inMemoryCounters),r=(0,es.__assign)({},this.inMemoryHistograms),n=(0,es.__spreadArray)([],(0,es.__read)(this.inMemoryEvents),!1),this.inMemoryEvents=[],this.inMemoryTags={},this.inMemoryCounters={},this.inMemoryHistograms={},[4,Promise.all([this.storage.setTags(e),this.storage.incrementCounters(t),this.storage.setHistogramStats(r),this.storage.addEventRecords(n)])];case 1:return i.sent(),[2]}})})},e.prototype._flush=function(){return(0,es.__awaiter)(this,void 0,void 0,function(){var e,t,r,n,i,o,s,a,u,l;return(0,es.__generator)(this,function(c){switch(c.label){case 0:if(!this.storage)return[2];return[4,this.saveAllDataToStorage()];case 1:return c.sent(),this.saveTimer=null,this.flushTimer=null,[4,this.storage.getAllAndClear()];case 2:if(t=(e=c.sent()).tags,r=e.counters,n=e.histogramStats,i=e.events,this.storage.setLastFlushTimestamp(Date.now()),o={},t.forEach(function(e){o[e.key]=e.value}),s={},r.forEach(function(e){s[e.key]=e.value}),a={}
2,n.forEach(function(e){a[e.key]={count:e.count,min:e.min,max:e.max,avg:Math.round(e.sum/e.count*100)/100}}),u=i.map(function(e){return{event_name:e.event_name,time:e.time,event_properties:e.event_properties}}),0===Object.keys(s).length&&0===Object.keys(a).length&&0===u.length)return[2];return l={tags:o,histogram:a,counters:s,events:u},this.fetch(l),[2]}})})},e.prototype.fetch=function(e){return(0,es.__awaiter)(this,void 0,void 0,function(){var t;return(0,es.__generator)(this,function(r){switch(r.label){case 0:if(r.trys.push([0,2,,3]),!(0,eU.getGlobalScope)())throw Error("DiagnosticsClient: Fetch is not supported");return[4,fetch(this.serverUrl,{method:"POST",headers:{"X-ApiKey":this.apiKey,"Content-Type":"application/json"},body:JSON.stringify(e)})];case 1:if(!r.sent().ok)return this.logger.debug("DiagnosticsClient: Failed to send diagnostics data."),[2];return this.logger.debug("DiagnosticsClient: Successfully sent diagnostics data"),[3,3];case 2:return t=r.sent(),this.logger.debug("DiagnosticsClient: Failed to send diagnostics data. ",t),[3,3];case 3:return[2]}})})},e.prototype.initializeFlushInterval=function(){return(0,es.__awaiter)(this,void 0,void 0,function(){var e,t,r;return(0,es.__generator)(this,function(n){switch(n.label){case 0:if(!this.storage)return[2];return e=Date.now(),[4,this.storage.getLastFlushTimestamp()];case 1:if(-1===(t=n.sent()||-1))return this.storage.setLastFlushTimestamp(e),this._setFlushTimer(3e5),[2];return(r=e-t)>=3e5?this._flush():this._setFlushTimer(3e5-r),[2]}})})},e.prototype._setFlushTimer=function(e){var t=this;this.flushTimer=setTimeout(function(){t._flush().catch(function(e){t.logger.debug("DiagnosticsClient: Failed to flush",e)}).finally(function(){t.flushTimer=null})},e)},e.prototype._setSampleRate=function(e){this.logger.debug("DiagnosticsClient: Setting sample rate to",e),this.config.sampleRate=e,this.shouldTrack=tw(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,this.logger.debug("DiagnosticsClient: Should track is",this.shouldTrack)},e}(),tC=e.i(839049),tP=tC.default||tC,tO=function(e,t){return"boolean"==typeof e?e:(null==e?void 0:e[t])!==!1},tA=function(e){return tO(e,"attribution")},tR=function(e){return tO(e,"formInteractions")},tM=function(e){return tO(e,"pageViews")},tN=function(e){return tO(e,"sessions")},tD=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.networkTracking||"object"==typeof e.networkTracking)},tL=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.elementInteractions||"object"==typeof e.elementInteractions)},tU=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.frustrationInteractions||"object"==typeof e.frustrationInteractions)},tq=function(e){if(tL(e.autocapture)&&"object"==typeof e.autocapture&&"object"==typeof e.autocapture.elementInteractions)return e.autocapture.elementInteractions},tj=function(e){if(tU(e.autocapture)&&"object"==typeof e.autocapture&&"object"==typeof e.autocapture.frustrationInteractions)return e.autocapture.frustrationInteractions},tF=function(e){var t;if(tD(e.autocapture)){var r=void 0;return"object"==typeof e.autocapture&&"object"==typeof e.autocapture.networkTracking?r=e.autocapture.networkTracking:e.networkTrackingOptions&&(r=e.networkTrackingOptions),(0,es.__assign)((0,es.__assign)({},r),{captureRules:null==(t=null==r?void 0:r.captureRules)?void 0:t.map(function(t){var r,n,i;if((null==(r=t.urls)?void 0:r.length)&&(null==(n=t.hosts)?void 0:n.length)){var o=JSON.stringify(t.hosts),s=JSON.stringify(t.urls);return null==(i=e.loggerProvider)||i.warn("Found network capture rule with both urls='".concat(s,"' and hosts='").concat(o,"' set. ")+"Definition of urls takes precedence over hosts, so ignoring hosts."),(0,es.__assign)((0,es.__assign)({},t),{hosts:void 0})}return t})})}},tB=function(e){var t,r=function(){return!1},n=void 0,i=e.pageCounter;return tM(e.defaultTracking)&&(r=void 0,t=void 0,e.defaultTracking&&"object"==typeof e.defaultTracking&&e.defaultTracking.pageViews&&"object"==typeof e.defaultTracking.pageViews&&("trackOn"in e.defaultTracking.pageViews&&(r=e.defaultTracking.pageViews.trackOn),"trackHistoryChanges"in e.defaultTracking.pageViews&&(n=e.defaultTracking.pageViews.trackHistoryChanges),"eventType"in e.defaultTracking.pageViews&&e.defaultTracking.pageViews.eventType&&(t=e.defaultTracking.pageViews.eventType))),{trackOn:r,trackHistoryChanges:n,eventType:t,pageCounter:i}},tV=function(e){if(tR(e.defaultTracking)&&e.defaultTracking&&"object"==typeof e.defaultTracking&&"object"==typeof e.defaultTracking.formInteractions)return e.defaultTracking.formInteractions},tK=function(e,t){for(var r=0;r<t.length;r++){var n=t[r],i=n.name,o=n.args,s=n.resolve,a=e&&e[i];if("function"==typeof a){var u=a.apply(e,o);"function"==typeof s&&s(null==u?void 0:u.promise)}}return e},tW=function(e){return e&&void 0!==e._q},tz=function(){if("u"<typeof navigator)return"";var e,t,r,n,i=navigator.userLanguage;return null!=(n=null!=(r=null!=(t=null==(e=navigator.languages)?void 0:e[0])?t:navigator.language)?r:i)?n:""},tH="2.40.0",tG="amplitude-ts",tJ=function(){function e(){this.name="@amplitude/plugin-context-browser",this.type="before",this.library="".concat(tG,"/").concat(tH),"u">typeof navigator&&(this.userAgent=navigator.userAgent)}return e.prototype.setup=function(e){return this.config=e,Promise.resolve(void 0)},e.prototype.execute=function(e){var t,r;return(0,es.__awaiter)(this,void 0,void 0,function(){var n,i,o;return(0,es.__generator)(this,function(s){return n=new Date().getTime(),i=null!=(t=this.config.lastEventId)?t:-1,o=null!=(r=e.event_id)?r:i+1,this.config.lastEventId=o,e.time||(this.config.lastEventTime=n),[2,(0,es.__assign)((0,es.__assign)((0,es.__assign)((0,es.__assign)((0,es.__assign)((0,es.__assign)((0,es.__assign)((0,es.__assign)({user_id:this.config.userId,device_id:this.config.deviceId,session_id:this.config.sessionId,time:n},this.config.appVersion&&{app_version:this.config.appVersion}),this.config.trackingOptions.platform&&{platform:"Web"}),this.config.trackingOptions.language&&{language:tz()}),this.config.trackingOptions.ipAddress&&{ip:"$remote"}),{insert_id:ej(),partner_id:this.config.partnerId,plan:this.config.plan}),this.config.ingestionMetadata&&{ingestion_metadata:{source_name:this.config.ingestionMetadata.sourceName,source_version:this.config.ingestionMetadata.sourceVersion}}),e),{event_id:o,library:this.library,user_agent:this.userAgent})]})})},e}(),t$=function(){function e(){this.memoryStorage=new Map}return e.prototype.isEnabled=function(){return(0,es.__awaiter)(this,void 0,void 0,function(){return(0,es.__generator)(this,function(e){return[2,!0]})})},e.prototype.get=function(e){return(0,es.__awaiter)(this,void 0,void 0,function(){return(0,es.__generator)(this,function(t){return[2,this.memoryStorage.get(e)]})})},e.prototype.getRaw=function(e){return(0,es.__awaiter)(this,void 0,void 0,function(){var t;return(0,es.__generator)(this,function(r){switch(r.label){case 0:return[4,this.get(e)];case 1:return[2,(t=r.sent())?JSON.stringify(t):void 0]}})})},e.prototype.set=function(e,t){return(0,es.__awaiter)(this,void 0,void 0,function(){return(0,es.__generator)(this,function(r){return this.memoryStorage.set(e,t),[2]})})},e.prototype.remove=function(e){return(0,es.__awaiter)(this,void 0,void 0,function(){return(0,es.__generator)(this,function(t){return this.memoryStorage.delete(e),[2]})})},e.prototype.reset=function(){return(0,es.__awaiter)(this,void 0,void 0,function(){return(0,es.__generator)(this,function(e){return this.memoryStorage.clear(),[2]})})},e}(),tX=function(){var e,t=(0,eU.getGlobalScope)();return null==(e=null==t?void 0:t.navigator)?void 0:e.locks},tY=function(){function e(e,t){void 0===t&&(t={}),this.options=(0,es.__assign)({},e),this.config=t}return e.prototype.isEnabled=function(){return(0,es.__awaiter)(this,void 0,void 0,function(){var t,r,n,i=this;return(0,es.__generator)(this,function(o){switch(o.label){case 0:return t="AMP_TEST",r=new e((0,es.__assign)({},this.options)),n=String(Date.now()),[4,r.transaction(t,function(e){var r,o;try{e.set(n);var s=e.get()===n;return!s&&i.config.diagnosticsClient&&(null==(r=i.config.diagnosticsClient)||r.recordEvent("cookies.isEnabled.failure",{reason:"Test Value mismatch",testKey:t,testValue:n,sync:!0})),s}catch(e){if(i.config.diagnosticsClient){var a=e instanceof Error?e.message:String(e);null==(o=i.config.diagnosticsClient)||o.recordEvent("cookies.isEnabled.failure",{reason:"Cookie getter/setter failed",testKey:t,testValue:n,error:a,sync:!0})}return!1}
2finally{e.set(null)}})];case 1:return[2,o.sent()]}})})},e.prototype.get=function(e){return(0,es.__awaiter)(this,void 0,void 0,function(){var t;return(0,es.__generator)(this,function(r){switch(r.label){case 0:return[4,this.getRaw(e)];case 1:return t=r.sent(),[2,this.decodeCookieValue(e,t)]}})})},e.prototype.decodeCookieValue=function(e,t){if(t)try{var r=t0(t);if(void 0===r)return void console.error("Amplitude Logger [Error]: Failed to decode cookie value for key: ".concat(e,", value: ").concat(t));return JSON.parse(r)}catch(r){console.error("Amplitude Logger [Error]: Failed to parse cookie value for key: ".concat(e,", value: ").concat(t));return}},e.prototype.getSync=function(e){var t=this.getRawSync(e);return this.decodeCookieValue(e,t)},e.prototype.getRaw=function(e){var t,r;return(0,es.__awaiter)(this,void 0,void 0,function(){var n,i,o,s,a,u,l,c;return(0,es.__generator)(this,function(d){switch(d.label){case 0:n=(0,eU.getGlobalScope)(),d.label=1;case 1:if(d.trys.push([1,4,,5]),!(i=null==n?void 0:n.cookieStore))return[3,3];return[4,i.getAll(e)];case 2:if(o=d.sent()){o.length>1&&(null==(t=this.config.diagnosticsClient)||t.recordEvent("cookies.duplicate",{cookies:o.map(function(e){return e.domain})}),null==(r=this.config.diagnosticsClient)||r.increment("cookies.duplicate.occurrence.cookieStore"));try{for(a=(s=(0,es.__values)(o)).next();!a.done;a=s.next())if(u=a.value,t1(u.domain,this.options.domain))return[2,u.value]}catch(e){l={error:e}}finally{try{a&&!a.done&&(c=s.return)&&c.call(s)}finally{if(l)throw l.error}}}d.label=3;case 3:return[3,5];case 4:return d.sent(),[3,5];case 5:return[2,this.getRawSync(e)]}})})},e.prototype.getRawSync=function(e){var t,r,n=this,i=(0,eU.getGlobalScope)(),o=(null!=(r=null==(t=null==i?void 0:i.document)?void 0:t.cookie.split("; "))?r:[]).filter(function(t){return 0===t.indexOf(e+"=")}),s=void 0,a=this.config.duplicateResolverFn;if("function"==typeof a&&o.length>1&&(s=o.find(function(t){var r;try{var i=a(t.substring(e.length+1));return i||null==(r=n.config.diagnosticsClient)||r.increment("cookies.duplicate.occurrence.document.cookie"),i}catch(e){return!1}})),s||(s=o[0]),s)return s.substring(e.length+1)},e.prototype.set=function(e,t){return(0,es.__awaiter)(this,void 0,void 0,function(){return(0,es.__generator)(this,function(r){return this.setSync(e,t),[2]})})},e.prototype.setSync=function(e,t){var r;try{var n=null!=(r=this.options.expirationDays)?r:0,i=null!==t?n:-1,o=void 0;if(i){var s=new Date;s.setTime(s.getTime()+24*i*36e5),o=s}var a="".concat(e,"=").concat(btoa(encodeURIComponent(JSON.stringify(t))));o&&(a+="; expires=".concat(o.toUTCString())),a+="; path=/",this.options.domain&&(a+="; domain=".concat(this.options.domain)),this.options.secure&&(a+="; Secure"),this.options.sameSite&&(a+="; SameSite=".concat(this.options.sameSite));var u=(0,eU.getGlobalScope)();(null==u?void 0:u.document)&&(u.document.cookie=a)}catch(t){var l=t instanceof Error?t.message:String(t);console.error("Amplitude Logger [Error]: Failed to set cookie for key: ".concat(e,". Error: ").concat(l))}},e.prototype.remove=function(e){return(0,es.__awaiter)(this,void 0,void 0,function(){return(0,es.__generator)(this,function(t){switch(t.label){case 0:return[4,this.set(e,null)];case 1:return t.sent(),[2]}})})},e.prototype.reset=function(){return(0,es.__awaiter)(this,void 0,void 0,function(){return(0,es.__generator)(this,function(e){return[2]})})},e.isDomainWritable=function(t){return(0,es.__awaiter)(this,void 0,void 0,function(){var r,n;return(0,es.__generator)(this,function(i){switch(i.label){case 0:if(e.cachedTlds[t])return[2,!0];r="AMP_TLDTEST",n=new e({domain:"."+t}),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,n.transaction(r,function(r){if(e.cachedTlds[t])return!0;try{r.set(1);var n=!!r.get();return n&&(e.cachedTlds[t]=!0),n}finally{r.set(null)}})];case 2:return[2,!!i.sent()];case 3:return i.sent(),[2,!1];case 4:return[2]}})})},e.prototype.transaction=function(e,t){return(0,es.__awaiter)(this,void 0,void 0,function(){var r,n,i=this;return(0,es.__generator)(this,function(o){switch(o.label){case 0:if(r=tX(),n=function(){return t({get:function(){return i.getSync(e)},set:function(t){return i.setSync(e,t)}})},!r)return[2,n()];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,r.request("com.amplitude:cookie-lock:".concat(e),n)];case 2:return[2,o.sent()];case 3:return o.sent(),[2,n()];case 4:return[2]}})})},e.cachedTlds={},e}(),tQ=function(e){try{return decodeURIComponent(atob(e))}catch(e){return}},tZ=function(e){try{return decodeURIComponent(atob(decodeURIComponent(e)))}catch(e){return}},t0=function(e){var t;
2return null!=(t=tQ(e))?t:tZ(e)},t1=function(e,t){if(""===e&&""===t)return!0;if(!e||!t)return!1;var r=e.startsWith(".")?e.substring(1):e,n=t.startsWith(".")?t.substring(1):t;return r.toLowerCase()===n.toLowerCase()},t2=function(e,t,r){return void 0===t&&(t=""),void 0===r&&(r=10),["AMP",t,e.substring(0,r)].filter(Boolean).join("_")},t3=function(){function e(e){this.storage=e}return e.prototype.isEnabled=function(){return(0,es.__awaiter)(this,void 0,void 0,function(){var t,r,n;return(0,es.__generator)(this,function(i){switch(i.label){case 0:if(!this.storage)return[2,!1];t=String(Date.now()),r=new e(this.storage),n="AMP_TEST",i.label=1;case 1:return i.trys.push([1,4,5,7]),[4,r.set(n,t)];case 2:return i.sent(),[4,r.get(n)];case 3:return[2,i.sent()===t];case 4:return i.sent(),[2,!1];case 5:return[4,r.remove(n)];case 6:return i.sent(),[7];case 7:return[2]}})})},e.prototype.get=function(e){return(0,es.__awaiter)(this,void 0,void 0,function(){var t;return(0,es.__generator)(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.getRaw(e)];case 1:if(!(t=r.sent()))return[2,void 0];return[2,JSON.parse(t)];case 2:return r.sent(),console.error("[Amplitude] Error: Could not get value from storage"),[2,void 0];case 3:return[2]}})})},e.prototype.getRaw=function(e){var t;return(0,es.__awaiter)(this,void 0,void 0,function(){return(0,es.__generator)(this,function(r){return[2,(null==(t=this.storage)?void 0:t.getItem(e))||void 0]})})},e.prototype.set=function(e,t){var r;return(0,es.__awaiter)(this,void 0,void 0,function(){return(0,es.__generator)(this,function(n){try{null==(r=this.storage)||r.setItem(e,JSON.stringify(t))}catch(e){}return[2]})})},e.prototype.remove=function(e){var t;return(0,es.__awaiter)(this,void 0,void 0,function(){return(0,es.__generator)(this,function(r){try{null==(t=this.storage)||t.removeItem(e)}catch(e){}return[2]})})},e.prototype.reset=function(){var e;return(0,es.__awaiter)(this,void 0,void 0,function(){return(0,es.__generator)(this,function(t){try{null==(e=this.storage)||e.clear()}catch(e){}return[2]})})},e}(),t4=function(e){function t(t){var r,n,i,o=this;try{i=null==(r=(0,eU.getGlobalScope)())?void 0:r.localStorage}catch(e){null==(n=null==t?void 0:t.loggerProvider)||n.debug("Failed to access localStorage. error=".concat(JSON.stringify(e))),i=void 0}return(o=e.call(this,i)||this).loggerProvider=null==t?void 0:t.loggerProvider,o}return(0,es.__extends)(t,e),t.prototype.set=function(t,r){var n;return(0,es.__awaiter)(this,void 0,void 0,function(){var i;return(0,es.__generator)(this,function(o){switch(o.label){case 0:if(!(Array.isArray(r)&&r.length>1e3))return[3,2];return i=r.length-1e3,[4,e.prototype.set.call(this,t,r.slice(0,1e3))];case 1:return o.sent(),null==(n=this.loggerProvider)||n.error("Failed to save ".concat(i," events because the queue length exceeded ").concat(1e3,".")),[3,4];case 2:return[4,e.prototype.set.call(this,t,r)];case 3:o.sent(),o.label=4;case 4:return[2]}})})},t}(t3),t5=function(e){function t(){var t;return e.call(this,null==(t=(0,eU.getGlobalScope)())?void 0:t.sessionStorage)||this}return(0,es.__extends)(t,e),t}(t3),t6=function(){function e(){}return e.prototype.send=function(e,t,r){return Promise.resolve(null)},e.prototype.buildResponse=function(e){if("object"!=typeof e)return null;var t,r,n,i,o,s,a,u,l,c,d,f,h,p,g,v,m,y,b,_,w,S,E=e.code||0,k=this.buildStatus(E);switch(k){case U.Success:return{status:k,statusCode:E,body:{eventsIngested:null!=(t=e.events_ingested)?t:0,payloadSizeBytes:null!=(r=e.payload_size_bytes)?r:0,serverUploadTime:null!=(n=e.server_upload_time)?n:0}};case U.Invalid:return{status:k,statusCode:E,body:{error:null!=(i=e.error)?i:"",missingField:null!=(o=e.missing_field)?o:"",eventsWithInvalidFields:null!=(s=e.events_with_invalid_fields)?s:{},eventsWithMissingFields:null!=(a=e.events_with_missing_fields)?a:{},eventsWithInvalidIdLengths:null!=(u=e.events_with_invalid_id_lengths)?u:{},epsThreshold:null!=(l=e.eps_threshold)?l:0,exceededDailyQuotaDevices:null!=(c=e.exceeded_daily_quota_devices)?c:{},silencedDevices:null!=(d=e.silenced_devices)?d:[],silencedEvents:null!=(f=e.silenced_events)?f:[],throttledDevices:null!=(h=e.throttled_devices)?h:{},throttledEvents:null!=(p=e.throttled_events)?p:[]}};case U.PayloadTooLarge:return{status:k,statusCode:E,body:{error:null!=(g=e.error)?g:""}};case U.RateLimit:return{status:k,statusCode:E,body:{error:null!=(v=e.error)?v:"",epsThreshold:null!=(m=e.eps_threshold)?m:0,throttledDevices:null!=(y=e.throttled_devices)?y:{},throttledUsers:null!=(b=e.throttled_users)?b:{},exceededDailyQuotaDevices:null!=(_=e.exceeded_daily_quota_devices)?_:{},exceededDailyQuotaUsers:null!=(w=e.exceeded_daily_quota_users)?w:{},throttledEvents:null!=(S=e.throttled_events)?S:[]}};case U.Timeout:default:return{status:k,statusCode:E}}},e.prototype.buildStatus=function(e){return eZ(e)?U.Success:429===e?U.RateLimit:413===e?U.PayloadTooLarge:408===e?U.Timeout:e>
2=400&&e<500?U.Invalid:e>=500?U.Failed:U.Unknown},e}();function t8(){return"u">typeof CompressionStream}function t7(e){return(0,es.__awaiter)(this,void 0,void 0,function(){var t;return(0,es.__generator)(this,function(r){switch(r.label){case 0:if(void 0===(t=CompressionStream))return[2,void 0];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,new Response(new Blob([e]).stream().pipeThrough(new t("gzip"))).arrayBuffer()];case 2:return[2,r.sent()];case 3:return r.sent(),[2,void 0];case 4:return[2]}})})}var t9=function(e){function t(t){void 0===t&&(t={});var r=e.call(this)||this;return r.state={done:4},r.customHeaders=t,r}return(0,es.__extends)(t,e),t.prototype.send=function(e,t,r){return void 0===r&&(r=!1),(0,es.__awaiter)(this,void 0,void 0,function(){var n=this;return(0,es.__generator)(this,function(i){return[2,new Promise(function(i,o){"u"<typeof XMLHttpRequest&&o(Error("XHRTransport is not supported."));var s=new XMLHttpRequest;s.open("POST",e,!0),s.onreadystatechange=function(){if(s.readyState===n.state.done){var e=s.responseText;try{i(n.buildResponse(JSON.parse(e)))}catch(e){i(n.buildResponse({code:s.status}))}}};var a={"Content-Type":"application/json",Accept:"*/*"},u=JSON.stringify(t),l=r&&u.length>=2048&&t8(),c=function(e){var t,r;a=(0,es.__assign)((0,es.__assign)({},n.customHeaders),a);try{for(var i=(0,es.__values)(Object.entries(a)),o=i.next();!o.done;o=i.next()){var u=(0,es.__read)(o.value,2),l=u[0],c=u[1];s.setRequestHeader(l,c)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}s.send(e)};(0,es.__awaiter)(n,void 0,void 0,function(){var e;return(0,es.__generator)(this,function(t){switch(t.label){case 0:if(!l)return[3,2];return[4,t7(u)];case 1:return(e=t.sent())?(a["Content-Encoding"]="gzip",c(e)):c(u),[3,3];case 2:c(u),t.label=3;case 3:return[2]}})}).catch(o)})]})})},t}(t6),re=function(e){function t(t){void 0===t&&(t={});var r=e.call(this)||this;return r.customHeaders=t,r}return(0,es.__extends)(t,e),t.prototype.send=function(e,t,r){return void 0===r&&(r=!1),(0,es.__awaiter)(this,void 0,void 0,function(){var n,i,o,s,a,u,l;return(0,es.__generator)(this,function(c){switch(c.label){case 0:if("u"<typeof fetch)throw Error("FetchTransport is not supported");if(n=JSON.stringify(t),i=r&&n.length>=2048&&t8(),o=n,s={"Content-Type":"application/json",Accept:"*/*"},!i)return[3,2];return[4,t7(n)];case 1:(a=c.sent())&&(s["Content-Encoding"]="gzip",o=a),c.label=2;case 2:return[4,fetch(e,{headers:s=(0,es.__assign)((0,es.__assign)({},this.customHeaders),s),body:o,method:"POST"})];case 3:return[4,(u=c.sent()).text()];case 4:l=c.sent();try{return[2,this.buildResponse(JSON.parse(l))]}catch(e){return[2,this.buildResponse({code:u.status})]}}})})},t}(t6),rt=function(e){function t(){return e.call(this)||this}return(0,es.__extends)(t,e),t.prototype.send=function(e,t,r){return void 0===r&&(r=!1),(0,es.__awaiter)(this,void 0,void 0,function(){var r=this;return(0,es.__generator)(this,function(n){return[2,new Promise(function(n,i){var o=(0,eU.getGlobalScope)();if(!(null==o?void 0:o.navigator.sendBeacon))throw Error("SendBeaconTransport is not supported");try{var s=JSON.stringify(t);if(o.navigator.sendBeacon(e,s))return n(r.buildResponse({code:200,events_ingested:t.events.length,payload_size_bytes:s.length,server_upload_time:Date.now()}));return n(r.buildResponse({code:500}))}catch(e){i(e)}})]})})},t}(t6),rr=function(e){var t=parseInt(e,32);if(!isNaN(t))return t},rn=function(e){if(atob&&escape&&e)try{return decodeURIComponent(escape(atob(e)))}catch(e){return}},ri="[Amplitude]",ro="".concat(ri," Form Started"),rs="".concat(ri," Form Submitted"),ra="".concat(ri," File Downloaded"),ru="session_start",rl="session_end",rc="".concat(ri," File Extension"),rd="".concat(ri," File Name"),rf="".concat(ri," Link ID"),rh="".concat(ri," Link Text"),rp="".concat(ri," Link URL"),rg="".concat(ri," Form ID"),rv="".concat(ri," Form Name"),rm="".concat(ri," Form Destination"),ry="cookie",rb={always:"always",ifEmptyCampaign:"ifEmptyCampaign"},r_=function(e){var t=e.split(".");return t.length<=2?e:t.slice(t.length-2,t.length).join(".")},rw=function(e,t,r,n,i,o){void 0===i&&(i=!0),e.referrer;var s=e.referring_domain,a=(0,es.__rest)(e,["referrer","referring_domain"]),u=t||{},l=(u.referrer,u.referring_domain),c=(0,es.__rest)(u,["referrer","referring_domain"]),d=r.excludeInternalReferrers;if(d){var f=rI(d,n);if(!(f instanceof TypeError)&&e.referring_domain&&rP(e.referring_domain,o)){if
2("always"===f)return rx(f,e.referring_domain,n),!1;else if("ifEmptyCampaign"===f&&Object.values((0,es.__assign)((0,es.__assign)({},e),{referring_domain:void 0,referrer:void 0})).every(function(e){return!e}))return rx(f,e.referring_domain,n),!1}}if(rS(r.excludeReferrers,e.referring_domain))return n.debug("This is not a new campaign because ".concat(e.referring_domain," is in the exclude referrer list.")),!1;if(!i&&Object.values(e).every(function(e){return!e})&&t)return n.debug("This is not a new campaign because this is a direct traffic in the same session."),!1;var h=JSON.stringify(a)!==JSON.stringify(c),p=r_(s||"")!==r_(l||""),g=!t||h||p;return g?n.debug("This is a new campaign. An $identify event will be sent."):n.debug("This is not a new campaign because it's the same as the previous one."),g},rS=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=""),e.some(function(e){return e instanceof RegExp?e.test(t):e===t})},rE=function(e,t){var r=t.startsWith(".")?t:".".concat(t);return!!(e.startsWith(".")?e:".".concat(e)).endsWith(r)},rk=function(e){var t=e;return t?(t.startsWith(".")&&(t=t.substring(1)),[new RegExp("".concat(t.replace(".","\\."),"$"))]):[]},rI=function(e,t){if(!0===e)return rb.always;if("object"==typeof e){var r=e.condition;if("string"==typeof r&&Object.keys(rb).includes(r))return r;if(void 0===r)return rb.always}var n="Invalid configuration provided for attribution.excludeInternalReferrers: ".concat(JSON.stringify(e));return t.error(n),TypeError(n)};function rx(e,t,r){var n="This is not a new campaign because referring_domain=".concat(t," is on the same domain as the current page and it is configured to exclude internal referrers");"always"===e?r.debug(n):"ifEmptyCampaign"===e&&r.debug("".concat(n," with empty campaign parameters"))}var rT=["ac.in","ac.jp","ac.kr","ac.th","ac.uk","ac.za","appspot.com","asn.au","azurewebsites.net","cloudfront.net","myshopify.com","blogspot.com","co.ca","co.in","co.jp","co.kr","co.nz","co.th","co.uk","co.za","com.ar","com.au","com.br","com.cn","com.hk","com.in","com.jp","com.kr","com.mx","com.pl","com.sg","com.tr","com.tw","ed.jp","edu.au","edu.br","edu.cn","edu.hk","edu.sg","edu.th","edu.tr","edu.tw","firebaseapp.com","fly.dev","gc.ca","geek.nz","github.io","gitlab.io","go.jp","go.kr","go.th","gob.ar","gob.mx","gov.au","gov.br","gov.cn","gov.hk","gov.in","gov.pl","gov.sg","gov.tr","gov.tw","gov.uk","gov.za","govt.nz","gr.jp","herokuapp.com","id.au","idv.hk","iwi.nz","lg.jp","ltd.uk","maori.nz","me.uk","mil.kr","ne.jp","ne.kr","net.au","net.br","net.cn","net.hk","net.in","net.nz","net.pl","net.sg","net.tr","net.tw","net.za","onrender.com","or.jp","or.kr","or.th","org.ar","org.au","org.br","org.cn","org.hk","org.in","org.mx","org.nz","org.pl","org.sg","org.tw","org.uk","org.za","pages.dev","pe.kr","plc.uk","re.kr","res.in","sch.uk","vercel.app","netlify.app","workers.dev"],rC=function(e){var t,r,n=e||(null==(r=null==(t=(0,eU.getGlobalScope)())?void 0:t.location)?void 0:r.hostname);if(!n)return"";var i=n.split("."),o=i[i.length-1],s=i[i.length-2];return(rT.find(function(e){return n.endsWith(".".concat(e))})&&(o=i[i.length-2]+"."+i[i.length-1],s=i[i.length-3]),s)?"".concat(s,".").concat(o):o},rP=function(e,t){var r=(0,eU.getGlobalScope)();return!!r&&rE(e,(t||"").trim()||rC(r.location.hostname))},rO=function(e){function t(t,r,n,i,o,s,a,u,l,c,d,f,h,p,g,v,m,y,b,_,w,S,E,k,I,x,T,C,P,O,A,R,N,D,L,U,q,j,F,B,V,K,W,z,H){void 0===n&&(n=new t$),void 0===i&&(i={domain:"",expiration:365,sameSite:"Lax",secure:!1,upgrade:!0}),void 0===u&&(u=1e3),void 0===l&&(l=5),void 0===c&&(c=30),void 0===d&&(d=ry),void 0===v&&(v=new eJ),void 0===m&&(m=M.Warn),void 0===b&&(b=!1),void 0===_&&(_=!1),void 0===E&&(E=""),void 0===k&&(k="US"),void 0===T&&(T=18e5),void 0===C&&(C=new t4({loggerProvider:v})),void 0===P&&(P={ipAddress:!0,language:!0,platform:!0}),void 0===O&&(O="fetch"),void 0===A&&(A=!1),void 0===R&&(R=!0),void 0===j&&(j=!0),void 0===F&&(F=0),void 0===W&&(W=!1),void 0===z&&(z=!1);var G,J=this;(J=e.call(this,{apiKey:t,storageProvider:C,transportProvider:rM(O)})||this).apiKey=t,J.appVersion=r,J.cookieOptions=i,J.defaultTracking=o,J.autocapture=s,J.flushIntervalMillis=u,J.flushMaxRetries=l,J.flushQueueSize=c,J.identityStorage=d,J.ingestionMetadata=f,J.instanceName=h,J.loggerProvider=v,J.logLevel=m,J.minIdLength=y,J.offline=b,J.partnerId=w,J.plan=S,J.serverUrl=E,J.serverZone=k,J.sessionTimeout=T,J.storageProvider=C,J.trackingOptions=P,J.transport=O,J.useBatch=A,J.fetchRemoteConfig=R,J.networkTrackingOptions=U,J.identify=q,J.enableDiagnostics=j,J.diagnosticsSampleRate=F,J.diagnosticsClient=B,J.remoteConfig=V,J.topLevelDomain=K,J.enableRequestBodyCompression=W,J._enableRequestBodyCompressionExperimental=z,J.customEnrichment=H,J.version=tH,J._optOut=!1,J._cookieStorage=n,J.deviceId=a,J.lastEventId=p,J.lastEventTime=g,J.optOut=_,J.deferredSessionId=x,J.sessionId=I,J.pageCounter=D,J.userId=N,J.debugLogsEnabled=L,J.loggerProvider.enable(L?M.Debug:J.logLevel),J.networkTrackingOptions=U,J.identify=q,J.enableDiagnostics=j,J.diagnosticsSampleRate=F,J.diagnosticsClient=B;var $=null!=(G=null==V?void 0:V.fetchRemoteConfig)?G:R;return J.remoteConfig=J.remoteConfig||{},J.remoteConfig.fetchRemoteConfig=$,J.fetchRemoteConfig=$,J.topLevelDomain=K||rC(),J}return(0,es.__extends)(t,e),Object.defineProperty(t.prototype,"cookieStorage",{get:function(){return this._cookieStorage},set:function(e){this._cookieStorage!==e&&(this._cookieStorage=e,this.updateStorage())}
2,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"deviceId",{get:function(){return this._deviceId},set:function(e){this._deviceId!==e&&(this._deviceId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"userId",{get:function(){return this._userId},set:function(e){this._userId!==e&&(this._userId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sessionId",{get:function(){return this._sessionId},set:function(e){this._sessionId!==e&&(this._sessionId=e,void 0!==e&&void 0!==this._deferredSessionId&&(this._deferredSessionId=void 0),this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"deferredSessionId",{get:function(){return this._deferredSessionId},set:function(e){this._deferredSessionId!==e&&e!==this.sessionId&&(this._deferredSessionId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut!==e&&(this._optOut=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastEventTime",{get:function(){return this._lastEventTime},set:function(e){this._lastEventTime!==e&&(this._lastEventTime=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastEventId",{get:function(){return this._lastEventId},set:function(e){this._lastEventId!==e&&(this._lastEventId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pageCounter",{get:function(){return this._pageCounter},set:function(e){this._pageCounter!==e&&(this._pageCounter=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"debugLogsEnabled",{set:function(e){this._debugLogsEnabled!==e&&(this._debugLogsEnabled=e,this.updateStorage())},enumerable:!1,configurable:!0}),t.prototype.updateStorage=function(){var e={deviceId:this._deviceId,userId:this._userId,sessionId:this._sessionId,deferredSessionId:this._deferredSessionId,optOut:this._optOut,lastEventTime:this._lastEventTime,lastEventId:this._lastEventId,pageCounter:this._pageCounter,debugLogsEnabled:this._debugLogsEnabled,cookieDomain:void 0};this.cookieStorage instanceof tY&&(e.cookieDomain=this.cookieStorage.options.domain),this.cookieStorage.set(t2(this.apiKey),e)},t}(eX),rA=function(e,t,r){switch(void 0===e&&(e=ry),void 0===t&&(t={}),e){case"localStorage":return new t4;case"sessionStorage":return new t5;case"none":return new t$;default:return new tY((0,es.__assign)((0,es.__assign)({},t),{expirationDays:t.expiration}),r)}},rR=function(e){var t,r;return void 0===e&&(e={}),(null==(t=e.remoteConfig)?void 0:t.fetchRemoteConfig)===!0||(null==(r=e.remoteConfig)?void 0:r.fetchRemoteConfig)!==!1&&!1!==e.fetchRemoteConfig},rM=function(e){var t="object"==typeof e?e.type:e,r="object"==typeof e?e.headers:void 0;return"xhr"===t?new t9(r):"beacon"===t?new rt:new re(r)},rN="data-amp-mask",rD="*****",rL=/\b(?:\d[ -]*?){13,16}\b/,rU=/(\d{3}-?\d{2}-?\d{4})/g,rq=/[^\s@]+@[^\s@.]+\.[^\s@]+/g,rj=function(e,t){if(void 0===t&&(t=[]),"string"!=typeof e)return"";var r,n,i=e;i=(i=(i=i.replace(rL,rD)).replace(rU,rD)).replace(rq,rD);try{for(var o=(0,es.__values)(t),s=o.next();!s.done;s=o.next()){var a=s.value;try{i=i.replace(a,rD)}catch(e){}}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i},rF=function(e){if("u"<typeof document||!document.title)return"";var t=document.querySelector("title");return t&&t.hasAttribute(rN)?rD:e?e(document.title):document.title},rB=function(){function e(){}return e.prototype.parse=function(){return(0,es.__awaiter)(this,void 0,void 0,function(){return(0,es.__generator)(this,function(e){return[2,(0,es.__assign)((0,es.__assign)((0,es.__assign)((0,es.__assign)({},eP),this.getUtmParam()),this.getReferrer()),this.getClickIds())]})})},e.prototype.getUtmParam=function(){var e=tl();return{utm_campaign:e.utm_campaign,utm_content:e.utm_content,utm_id:e.utm_id,utm_medium:e.utm_medium,utm_source:e.utm_source,utm_term:e.utm_term}},e.prototype.getReferrer=function(){var e,t,r={referrer:void 0,referring_domain:void 0};try{r.referrer=document.referrer||void 0,r.referring_domain=null!=(t=null==(e=r.referrer)?void 0:e.split("/")[2])?t:void 0}catch(e){}return r},e.prototype.getClickIds=function(){var e,t=tl();return(e={})[ey]=t[ey],e[eb]=t[eb],e[e_]=t[e_],e[ew]=t[ew],e[eS]=t[eS],e[eE]=t[eE],e[ek]=t[ek],e[eI]=t[eI],e[ex]=t[ex],e[eT]=t[eT],e[eC]=t[eC],e},e}(),rV=function(e){var t={};for(var r in e){var n=e[r];n&&(t[r]=n)}return t},rK="AMP_PAGE_VIEW",rW=function(e){void 0===e&&(e={});var t,r,n,i=(0,eU.getGlobalScope)(),o=void 0,s=!1,a=e.trackOn,u=e.trackHistoryChanges,l=e.eventType,c=void 0===l?"[Amplitude] Page Viewed":l,d=function(e){var t=e;try{t=decodeURI(e)}catch(e){null==o||o.error("Malformed URI sequence: ",e)}return t},f=function(e){return(0,es.__awaiter)(void 0,void 0,void 0,function(){var t,r,n;return(0,es.__generator)(this,function(i){switch(i.label){case 0:return t=d("u">typeof location&&location.href||""),n={event_type:c},r=[{}],[4,rz()];case 1:return[2,(n.event_properties=es.__assign.apply(void 0,[es.__assign.apply(void 0,r.concat([i.sent()])),{"[Amplitude] Page Domain":"u">typeof location&&location.hostname||"","[Amplitude] Page Location":t,"[Amplitude] Page Path":"u">typeof location&&d(location.pathname)||"","[Amplitude] Page Title":rF(rj),"[Amplitude] Page URL":t.split("?")[0],"[Amplitude] Page View ID":e}]),n)]}})})},h=function(){return void 0===a||"function"==typeof a&&a()},p="u">typeof location?location.href:null,g=function(){(0,es.__awaiter)(void 0,void 0,void 0,function(){var e,r,i,s,a;return(0,es.__generator)(this,function(l){switch(l.label){case 0:if(r=rG(u,e=location.href,p||"")&&h(),p=e,!r)return[3,4];if(i=void 0,n&&(i=ej(),n.set(rK,{pageViewId:i})),null==o||o.log("Tracking page view event"),null!=t)return[3,1];return[3,3];case 1:return a=(s=t).track,[4,f(i)];case 2:a.apply(s,[l.sent()]),l.label=3;case 3:l.label=4;case 4:return[2]}})})};return{name:"@amplitude/plugin-page-view-tracking-browser",type:"enrichment",setup:function(e,a){return(0,es.__awaiter)(void 0,void 0,void 0,function(){var u,l,c;return(0,es.__generator)(this,function(d){switch(d.label){case 0:if(t=a,r=e,(o=e.loggerProvider).log("Installing @amplitude/plugin-page-view-tracking-browser"),s=!0,i){try{n=new t3(i.sessionStorage)}catch(e){null==o||o.debug("sessionStorage is not available in this environment.")}i.addEventListener("popstate",g),i.history.pushState=new Proxy(i.history.pushState,{apply:function(e,t,r){var n=(0,es.__read)(r,3),i=n[0],o=n[1],a=n[2];e.apply(t,[i,o,a]),s&&g()}})}if(!h())return[3,2];return o.log("Tracking page view event"),u=void 0,n&&(u=ej(),n.set(rK,{pageViewId:u})),c=(l=t).track,[4,f(u)];case 1:c.apply(l,[d.sent()]),d.label=2;case 2:return[2]}})})},execute:function(e){return(0,es.__awaiter)(void 0,void 0,void 0,function(){var t,i,s;return(0,es.__generator)(this,function(u){switch(u.label){case 0:if(!("attribution"===a&&rH(e)))return[3,4];
2if(null==o||o.log("Enriching campaign event to page view event with campaign parameters"),t=void 0,!n)return[3,2];return[4,n.get(rK)];case 1:t=null==(i=u.sent())?void 0:i.pageViewId,u.label=2;case 2:return[4,f(t)];case 3:e.event_type=(s=u.sent()).event_type,e.event_properties=(0,es.__assign)((0,es.__assign)({},e.event_properties),s.event_properties),u.label=4;case 4:return r&&e.event_type===c&&(r.pageCounter=r.pageCounter?r.pageCounter+1:1,e.event_properties=(0,es.__assign)((0,es.__assign)({},e.event_properties),{"[Amplitude] Page Counter":r.pageCounter})),[2,e]}})})},teardown:function(){return(0,es.__awaiter)(void 0,void 0,void 0,function(){return(0,es.__generator)(this,function(e){return i&&(i.removeEventListener("popstate",g),s=!1),[2]})})}}},rz=function(){return(0,es.__awaiter)(void 0,void 0,void 0,function(){var e;return(0,es.__generator)(this,function(t){switch(t.label){case 0:return e=rV,[4,new rB().parse()];case 1:return[2,e.apply(void 0,[t.sent()])]}})})},rH=function(e){if("$identify"===e.event_type&&e.user_properties){var t=e.user_properties,r=t[N.SET]||{},n=t[N.UNSET]||{},i=(0,es.__spreadArray)((0,es.__spreadArray)([],(0,es.__read)(Object.keys(r)),!1),(0,es.__read)(Object.keys(n)),!1);return Object.keys(eP).every(function(e){return i.includes(e)})}return!1},rG=function(e,t,r){if("pathOnly"!==e)return t!==r;if(""==r)return!0;var n=new URL(t),i=new URL(r);return n.origin+n.pathname!==i.origin+i.pathname},rJ=function(){var e,t,r=[],n=function(e,t,n){e.addEventListener(t,n),r.push({element:e,type:t,handler:n})},i=function(){r.forEach(function(e){var t=e.element,r=e.type,n=e.handler;null==t||t.removeEventListener(r,n)}),r=[]};return{name:"@amplitude/plugin-form-interaction-tracking-browser",type:"enrichment",setup:function(r,i){return(0,es.__awaiter)(void 0,void 0,void 0,function(){var o,s;return(0,es.__generator)(this,function(a){return t=tV(r),o=function(){if(!i)return void r.loggerProvider.warn("Form interaction tracking requires a later version of @amplitude/analytics-browser. Form interaction events are not tracked.");if("u">typeof document){var o=new WeakSet,s=function(e){if(!o.has(e)){o.add(e);var s=!1;n(e,"change",function(){var t,r=rX(e);s||i.track(ro,((t={})[rg]=r$(e.id),t[rv]=r$(e.name),t[rm]=r,t)),s=!0}),n(e,"submit",function(n){var o,a,u=rX(e);if(s||i.track(ro,((o={})[rg]=r$(e.id),o[rv]=r$(e.name),o[rm]=u,o)),s=!0,(null==t?void 0:t.shouldTrackSubmit)!==void 0)if("function"==typeof t.shouldTrackSubmit&&"u">typeof SubmitEvent&&n instanceof SubmitEvent)try{if(!t.shouldTrackSubmit(n))return}catch(e){r.loggerProvider.warn("shouldTrackSubmit callback threw an error, proceeding with tracking.")}else r.loggerProvider.warn("shouldTrackSubmit is ignored because it is not a function or event is not a SubmitEvent.");i.track(rs,((a={})[rg]=r$(e.id),a[rv]=r$(e.name),a[rm]=u,a)),s=!1})}};Array.from(document.getElementsByTagName("form")).forEach(s),"u">typeof MutationObserver&&(e=new MutationObserver(function(e){e.forEach(function(e){e.addedNodes.forEach(function(e){"FORM"===e.nodeName&&s(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&Array.from(e.querySelectorAll("form")).map(s)})})})).observe(document.body,{subtree:!0,childList:!0})}},"complete"===document.readyState?o():(s=(0,eU.getGlobalScope)())?s.addEventListener("load",o):r.loggerProvider.debug("Form interaction tracking is not installed because global is undefined."),[2]})})},execute:function(e){return(0,es.__awaiter)(void 0,void 0,void 0,function(){return(0,es.__generator)(this,function(t){return[2,e]})})},teardown:function(){return(0,es.__awaiter)(void 0,void 0,void 0,function(){return(0,es.__generator)(this,function(t){return null==e||e.disconnect(),i(),[2]})})}}},r$=function(e){if("string"==typeof e)return e},rX=function(e){var t=e.getAttribute("action");try{t=new URL(encodeURI(null!=t?t:""),window.location.href).href}catch(e){}return t},rY=function(){var e,t=[],r=function(e,r,n){e.addEventListener(r,n),t.push({element:e,type:r,handler:n})},n=function(){t.forEach(function(e){var t=e.element,r=e.type,n=e.handler;null==t||t.removeEventListener(r,n)}),t=[]};return{name:"@amplitude/plugin-file-download-tracking-browser",type:"enrichment",setup:function(t,n){return(0,es.__awaiter)(void 0,void 0,void 0,function(){var i,o;return(0,es.__generator)(this,function(s){return i=function(){if(!n)return void t.loggerProvider.warn("File download tracking requires a later version of @amplitude/analytics-browser. File download events are not tracked.");if("u">typeof document){var i=function(e){try{t=new URL(e.href,window.location.href)}catch(e){return}var t,i=o.exec(t.href),s=null==i?void 0:i[1];s&&r(e,"click",function(){var r;s&&n.track(ra,((r={})[rc]=s,r[rd]=t.pathname,r[rf]=e.id,r[rh]=e.text,r[rp]=e.href,r))})},o=/\.(pdf|xlsx?|docx?|txt|rtf|csv|exe|key|pp(s|t|tx)|7z|pkg|rar|gz|zip|avi|mov|mp4|mpe?g|wmv|midi?|mp3|wav|wma)(\?.+)?$/;
2Array.from(document.getElementsByTagName("a")).forEach(i),"u">typeof MutationObserver&&(e=new MutationObserver(function(e){e.forEach(function(e){e.addedNodes.forEach(function(e){"A"===e.nodeName&&i(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&Array.from(e.querySelectorAll("a")).map(i)})})})).observe(document.body,{subtree:!0,childList:!0})}},"complete"===document.readyState?i():(o=(0,eU.getGlobalScope)())?o.addEventListener("load",i):t.loggerProvider.debug("File download tracking is not installed because global is undefined."),[2]})})},execute:function(e){return(0,es.__awaiter)(void 0,void 0,void 0,function(){return(0,es.__generator)(this,function(t){return[2,e]})})},teardown:function(){return(0,es.__awaiter)(void 0,void 0,void 0,function(){return(0,es.__generator)(this,function(t){return null==e||e.disconnect(),n(),[2]})})}}},rQ=!1,rZ=function(e){rQ||void 0!==e.defaultTracking||(e.loggerProvider.warn("`options.defaultTracking` is set to undefined. This implicitly configures your Amplitude instance to track Page Views, Sessions, File Downloads, and Form Interactions. You can suppress this warning by explicitly setting a value to `options.defaultTracking`. The value must either be a boolean, to enable and disable all default events, or an object, for advanced configuration. For example:\n\namplitude.init(<YOUR_API_KEY>, {\n defaultTracking: true,\n});\n\nVisit https://www.docs.developers.amplitude.com/data/sdks/browser-2/#tracking-default-events for more details."),rQ=!0)},r0=function(){var e=(0,eU.getGlobalScope)(),t=[],r=function(r,n){(null==e?void 0:e.addEventListener)&&(null==e||e.addEventListener(r,n),t.push({type:r,handler:n}))},n=function(){t.forEach(function(t){var r=t.type,n=t.handler;null==e||e.removeEventListener(r,n)}),t=[]};return{name:"@amplitude/plugin-network-checker-browser",type:"before",setup:function(e,t){return(0,es.__awaiter)(void 0,void 0,void 0,function(){return(0,es.__generator)(this,function(n){return"u"<typeof navigator?(e.loggerProvider.debug("Network connectivity checker plugin is disabled because navigator is not available."),e.offline=!1):(e.offline=!navigator.onLine,r("online",function(){e.loggerProvider.debug("Network connectivity changed to online."),e.offline=!1,setTimeout(function(){t.flush()},e.flushIntervalMillis)}),r("offline",function(){e.loggerProvider.debug("Network connectivity changed to offline."),e.offline=!0})),[2]})})},teardown:function(){return(0,es.__awaiter)(void 0,void 0,void 0,function(){return(0,es.__generator)(this,function(e){return n(),[2]})})}}};function r1(e,t,r){var n,i,o=[];try{for(var s=(0,es.__values)(null!=t?t:[]),a=s.next();!a.done;a=s.next()){var u=a.value;try{o.push(new RegExp(u))}catch(e){r.loggerProvider.warn("Invalid regex pattern: ".concat(u),e)}}}catch(e){n={error:e}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(n)throw n.error}}return e.concat(o)}var r2=["a","button","input","select","textarea","label","video","audio",'[contenteditable="true" i]',"[data-amp-default-track]",".amp-default-track"],r3="data-amp-track-",r4=["div","span","h1","h2","h3","h4","h5","h6"],r5="https://app.amplitude.com",r6={US:r5,EU:"https://app.eu.amplitude.com",STAGING:"https://apps.stag2.amplitude.com"},r8="__AMPLITUDE_MESSENGER_INSTANCE__",r7="__AMPLITUDE_MESSENGER__",r9=function(){function e(e){var t=(void 0===e?{}:e).origin;this[j]=!0,this.isSetup=!1,this.messageHandler=null,this.requestCallbacks={},this.actionHandlers=new Map,this.pendingMessages=new Map,this.scriptLoadPromises=new Map,this.endpoint=void 0===t?r5:t}return e.prototype.notify=function(e){var t,r,n,i;null==(r=null==(t=this.logger)?void 0:t.debug)||r.call(t,"Message sent: ",JSON.stringify(e)),null==(i=null==(n=window.opener)?void 0:n.postMessage)||i.call(n,e,this.endpoint)},e.prototype.sendRequest=function(e,t,r){var n=this;void 0===r&&(r={timeout:15e3});var i="".concat(Date.now(),"-").concat(Math.random().toString(36).substr(2,9)),o={id:i,action:e,args:t};return new Promise(function(t,s){n.requestCallbacks[i]={resolve:t,reject:s},n.notify(o),r.timeout>0&&setTimeout(function(){s(Error("".concat(e," timed out (id: ").concat(i,")"))),delete n.requestCallbacks[i]},r.timeout)})},e.prototype.handleResponse=function(e){var t;if(!this.requestCallbacks[e.id]){null==(t=this.logger)||t.warn("No callback found for request id: ".concat(e.id));return}this.requestCallbacks[e.id].resolve(e.responseData),delete this.requestCallbacks[e.id]},e.prototype.registerActionHandler=function(e,t){this.actionHandlers.has(e)&&(null==(o=null==(i=this.logger)?void 0:i.warn)||o.call(i,"Overwriting existing action handler for: ".concat(e))),this.actionHandlers.set(e,t);var r,n,i,o,s=this.pendingMessages.get(e);if(s){this.pendingMessages.delete(e);try{for(var a=(0,es.__values)(s),u=a.next();!u.done;u=a.next()){var l=u.value;t(l)}}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}}},e.prototype.loadScriptOnce=function(e){return(0,es.__awaiter)(this,void 0,void 0,function(){var t,r,n;return(0,es.__generator)(this,function(i){switch(i.label){case 0:if(t=this.scriptLoadPromises.get(e))return[2,t];r=(document.querySelector('script[src="'.concat(CSS.escape(e),'"]'))?Promise.resolve({status:!0}):new Promise(function(t,r){var n;try{var i=document.createElement("script");i.type="text/javascript",i.async=!0,i.src=e,i.addEventListener("load",function(){t({status:!0})},{once:!0}),i.addEventListener("error",function(){r({status:!1,message:"Failed to load the script ".concat(e)})}),null==(n=document.head)||n.appendChild(i)}catch(e){r(e)}})).then(function(){}),this.scriptLoadPromises.set(e,r),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,r];case 2:return i.sent(),[3,4];case 3:throw n=i.sent(),this.scriptLoadPromises.delete(e),n;case 4:return[2]}})})},e.prototype.setup=function(e){var t,r,n=this,i=void 0===e?{}:e,o=i.logger,s=i.endpoint;o&&(this.logger=o),s&&this.endpoint===r5&&(this.endpoint=s),this.isSetup||(this.isSetup=!0,null==(r=null==(t=this.logger)?void 0:t.debug)||r.call(t,"Setting up messenger"),this.messageHandler=function(e){if(null==(r=null==(t=n.logger)?void 0:t.debug)||r.call(t,"Message received: ",JSON.stringify(e)),n.endpoint===e.origin){var t,r,i,o,s,a=e.data,u=null==a?void 0:a.action;if(u)if("id"in a&&a.id)null==(o=null==(i=n.logger)?void 0:i.debug)||o.call(i,"Received Response to previous request: ",JSON.stringify(e)),n.handleResponse(a
2);else{if("ping"===u)return void n.notify({action:"pong"});var l=n.actionHandlers.get(u);if(l)l(a.data);else{var c=null!=(s=n.pendingMessages.get(u))?s:[];c.push(a.data),n.pendingMessages.set(u,c)}}}},window.addEventListener("message",this.messageHandler),this.notify({action:"page-loaded"}))},e.prototype.destroy=function(){this.messageHandler&&(window.removeEventListener("message",this.messageHandler),this.messageHandler=null),this.isSetup=!1,this.actionHandlers.clear(),this.pendingMessages.clear(),this.requestCallbacks={},this.scriptLoadPromises.clear();var e=(0,eU.getGlobalScope)();(null==e?void 0:e[r7])===this&&delete e[r7]},e}();function ne(e){var t=(0,eU.getGlobalScope)(),r=null==t?void 0:t[r7];if("object"==typeof r&&null!==r&&r8 in r&&!0===r[r8])return r;var n=new r9(e);return t&&(t[r7]=n),n}j=r8;var nt="__AMPLITUDE_BACKGROUND_CAPTURE__";function nr(e,t){var r;if(!0!==e[nt]){e[nt]=!0;var n=null!=(r=null==t?void 0:t.scriptUrl)?r:"https://cdn.amplitude.com/libs/background-capture-1.0.0-alpha.3.js.gz",i=null,o=function(t,r){var n,i;"background-capture-complete"===t&&(null==(i=null==(n=e.logger)?void 0:n.debug)||i.call(n,"Background capture complete"),e.notify({action:"background-capture-complete",data:r}))};e.registerActionHandler("initialize-background-capture",function(){null==(r=null==(t=e.logger)?void 0:t.debug)||r.call(t,"Initializing background capture (external script)");var t,r,s=new URL(n,e.endpoint).toString();e.loadScriptOnce(s).then(function(){var t,r,n;null==(r=null==(t=e.logger)?void 0:t.debug)||r.call(t,"Background capture script loaded (external)"),i=null==(n=null==window?void 0:window.amplitudeBackgroundCapture)?void 0:n.call(window,{messenger:e,onBackgroundCapture:o}),e.notify({action:"background-capture-loaded"})}).catch(function(){var t;null==(t=e.logger)||t.warn("Failed to initialize background capture")})}),e.registerActionHandler("close-background-capture",function(){var e;null==(e=null==i?void 0:i.close)||e.call(i),i=null})}}var nn=e.i(819125);function ni(e,t){return new nn.default(function(r){e.subscribe({next:function(e){t(e).then(function(e){return r.next(e)}).catch(function(e){return r.error(e)})},error:function(e){r.error(e)},complete:function(){r.complete()}})})}function no(e,t){return new nn.default(function(r){var n=!1,i=new Set,o=function(){var e,t;n=!0;try{for(var r=(0,es.__values)(i),o=r.next();!o.done;o=r.next()){var s=o.value;try{s.unsubscribe()}catch(e){}}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}i.clear()},s=function(e){var t=e.subscribe({next:function(e){n||r.next(e)},error:function(e){n||(n=!0,r.error(e),o())},complete:function(){i.delete(t),n||0!==i.size||(r.complete(),o(),n=!0)}});i.add(t)};return s(e),s(t),o})}function ns(e){var t=new Set,r=null;function n(){null==r||r.unsubscribe(),r=null,t.clear()}return new nn.default(function(i){return t.add(i),null===r&&(r=e.subscribe({next:function(e){try{for(var r,n,i,o=(0,es.__values)(t),s=o.next();!s.done;s=o.next()){var a=s.value;null==(i=a.next)||i.call(a,e)}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}},error:function(e){try{for(var r,i,o,s=(0,es.__values)(t),a=s.next();!a.done;a=s.next()){var u=a.value;null==(o=u.error)||o.call(u,e)}}catch(e){r={error:e}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}n()},complete:function(){try{for(var e,r,i,o=(0,es.__values)(t),s=o.next();!s.done;s=o.next()){var a=s.value;null==(i=a.complete)||i.call(a)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}n()}})),function(){t.delete(i),0===t.size&&r&&(r.unsubscribe(),r=null)}})}var na="1.25.3",nu="[Amplitude] Element Clicked",nl="[Amplitude] Element Tag",nc="[Amplitude] Element Text",nd="[Amplitude] Page URL",nf="[Amplitude] Viewport Height",nh="[Amplitude] Viewport Width",np="[Amplitude] Page View ID",ng="data-amp-mask-attributes",nv=function(e,t){return!t||!t.length||t.some(function(t){return"string"==typeof t?e===t:e.match(t)})},nm=function(e,t){var r=e;try{r=decodeURI(e)}catch(e){null==t||t.error("Malformed URI sequence: ",e)}return r},ny=["input","select","textarea"],nb=function(e,t){var r,n=null==(r=null==window?void 0:window.getComputedStyle)?void 0:r.call(window,e);return(null==n?void 0:n.getPropertyValue("cursor"))==="pointer"&&"click"===t},n_=function(e){var t=e.pageUrlAllowlist,r=e.pageUrlExcludelist;return!(r&&r.length>0&&nv(window.location.href,r))&&!!nv(window.location.href,t)},nw=function(e,t,r){return void 0===r&&(r=!1),function(n,i){var o,s,a=e.shouldTrackEventResolver,u=null==(s=null==(o=null==i?void 0:i.tagName)?void 0:o.toLowerCase)?void 0:s.call(o);if(!u)return!1;if(a)return a(n,i);if(!n_(e))return!1;var l=String(null==i?void 0:i.getAttribute("type"))||"";if("string"==typeof l)switch(l.toLowerCase()){case"hidden":case"password":return!1}var c=nb(i,n);if(r&&c)return!0;
2if(t&&!t.some(function(e){var t;return!!(null==(t=null==i?void 0:i.matches)?void 0:t.call(i,e))}))return!1;switch(u){case"input":case"select":case"textarea":return"change"===n||"click"===n;default:if(c)return!0;return"click"===n}}},nS=function(e){var t,r,n,i=null==(r=null==(t=null==e?void 0:e.tagName)?void 0:t.toLowerCase)?void 0:r.call(t),o=e instanceof HTMLElement&&(null==(n=e.getAttribute("contenteditable"))?void 0:n.toLowerCase())==="true";return!ny.includes(i)&&!o},nE=function(e){return Object.keys(e).reduce(function(t,r){var n=e[r];return null!=n&&("object"!=typeof n||0!==Object.keys(n).length)&&("string"!=typeof n||0!==n.trim().length)&&(t[r]=n),t},{})},nk=function(){var e;try{var t=(0,eU.getGlobalScope)(),r=null==(e=null==t?void 0:t.sessionStorage)?void 0:e.getItem("AMP_PAGE_VIEW");if(!r)return;var n=JSON.parse(r);if("string"==typeof n.pageViewId)return n.pageViewId}catch(e){}},nI=function(e,t){return e?t.some(function(t){var r;return null==(r=null==e?void 0:e.matches)?void 0:r.call(e,t)})?e:nI(null==e?void 0:e.parentElement,t):null},nx=function(e){return null!==e.event.target&&!!e.closestTrackedAncestor};(l=F||(F={}))[l.LEFT_OR_TOUCH_CONTACT=0]="LEFT_OR_TOUCH_CONTACT",l[l.MIDDLE=1]="MIDDLE",l[l.RIGHT=2]="RIGHT";var nT="__AMPLITUDE_VISUAL_TAGGING__",nC=nn,nP=(0,eU.getGlobalScope)(),nO=null==nP?void 0:nP.console,nA={},nR={},nM=!1,nN=function(e,t){if(!nO||"function"!=typeof nO[e]||!nR[e]&&(nR[e]=nO[e],nO[e]=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];try{if(nA[e]&&!nM){nM=!0;var n=nA[e];n&&n.forEach(function(r){try{r(e,t)}catch(e){}})}}catch(e){}return nM=!1,nR[e].apply(nO,t)},0))return Error("Console override failed");nA[e]?nA[e].push(t):nA[e]=[t]},nD=function(e){var t,r;try{for(var n=(0,es.__values)(Object.values(nA)),i=n.next();!i.done;i=n.next())for(var o=i.value,s=o.length-1;s>=0;s--)if(o[s]===e){o.splice(s,1);break}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}},nL=(0,eU.getGlobalScope)(),nU=function(){return new nC.default(function(e){var t=new MutationObserver(function(t){e.next(t)});return document.body&&t.observe(document.body,{childList:!0,attributes:!0,characterData:!0,subtree:!0}),function(){return t.disconnect()}})},nq=function(e){return void 0===e&&(e="click"),new nC.default(function(t){var r,n=function(e){t.next(e)};return null==(r=(0,eU.getGlobalScope)())||r.document.addEventListener(e,n,{capture:!0}),function(){var t;null==(t=(0,eU.getGlobalScope)())||t.document.removeEventListener(e,n,{capture:!0})}})},nj=function(){var e=no(new nC.default(function(e){var t=function(t){if(t instanceof ErrorEvent){var r={kind:"error"};t.error instanceof Error||t.error instanceof DOMException?r=(0,es.__assign)((0,es.__assign)({},r),{message:t.error.message,stack:t.error.stack,filename:t.filename,lineNumber:t.lineno,columnNumber:t.colno}):"string"==typeof t.error&&(r.message=t.error),e.next(r)}};return nL.addEventListener("error",t),function(){nL.removeEventListener("error",t)}}),new nC.default(function(e){var t=function(t){var r={kind:"unhandledrejection"};t.reason instanceof Error||t.reason instanceof DOMException?(r.message=t.reason.message,r.stack=t.reason.stack):"string"==typeof t.reason&&(r.message=t.reason),e.next(r)};return nL.addEventListener("unhandledrejection",t),function(){nL.removeEventListener("unhandledrejection",t)}}));return no(e,new nC.default(function(e){var t=function(t){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var i=void 0;Array.isArray(r[0])&&"string"==typeof r[0][0]&&(i=r[0][0]),e.next({kind:"console",message:i})};return nN("error",t),function(){nD(t)}}))},nF=function(e,t){try{if("[Amplitude] Element Text"===t.subprop_key)return"is"===t.subprop_op&&t.subprop_value.includes(e.targetElementProperties["[Amplitude] Element Text"]);if("[Amplitude] Element Hierarchy"===t.subprop_key)return"autotrack css match"===t.subprop_op&&!!e.closestTrackedAncestor.closest(t.subprop_value.toString())}catch(e){console.error("Error matching event to filter",e)}return!1},nB=function(e,t){try{if("DOM_ELEMENT"===e.sourceType){var r=document.documentElement;if(e.scope&&t&&(r=t.closest(e.scope)),r&&e.selector)return r.querySelector(e.selector);return r}}catch(e){}},nV=function(e,t,r){e.forEach(function(e){if("string"!=typeof e&&"ATTACH_EVENT_PROPERTY"===e.actionType){var n=r.extractDataFromDataSource(e.dataSource,t.closestTrackedAncestor);t.targetElementProperties[e.destinationKey]=n}})},nK={"[Amplitude] Element Clicked":"click","[Amplitude] Element Changed":"change"},nW=function(e){var t,r,n,i,o=Object.values(nK).reduce(function(e,t){return e[t]=new Set,e},{});if(!e)return o;try{for(var s=(0,es.__values)(e),a=s.next();!a.done;a=s.next()){var u=a.value;try{try{for(var l=(n=void 0,(0,es.__values)(u.definition)),c=l.next();!c.done;c=l.next()){var d=nK[c.value.event_type];d&&o[d].add(u.id)}}catch(e){n={error:e}}finally{try{c&&!c.done&&(i=l.return)&&i.call(l)}finally{if(n)throw n.error}}}catch(e){console.warn("Skipping Labeled Event due to malformed definition",null==u?void 0:u.id,e)}}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}return o},nz=function(e){var t,r,n,i,o=new Map;try{for(var s=(0,es.__values)(e),a=s.next();!a.done;a=s.next()){var u=a.value;try{for(var l=(n=void 0,(0,es.__values)(u.conditions)),c=l.next();!c.done;c=l.next()){var d=c.value;if("LABELED_EVENT"===d.type){var f=d.match.eventId,h=o.get(f);h||(h=[],o.set(f,h)),h.push(u)}}}catch(e){n={error:e}}finally{try{c&&!c.done&&(i=l.return)&&i.call(l)}finally{if(n)throw n.error}}}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}return o},nH=function(e,t){var r,n,i,o,s=new Set;try{for(var a=(0,es.__values)(e),u=a.next();!u.done;u=a.next()){var l=u.value,c=t.get(l.id);if(c)try{for(var d=(i=void 0,(0,es.__values)(c)),f=d.next();!f.done;f=d.next()){var h=f.value;s.add(h)}}catch(e){i={error:e}}
2finally{try{f&&!f.done&&(o=d.return)&&o.call(d)}finally{if(i)throw i.error}}}}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return Array.from(s)},nG=function(){function e(e,t,r,n){this.groupedLabeledEvents=e,this.labeledEventToTriggerMap=t,this.dataExtractor=r,this.options=n}return e.prototype.evaluate=function(e){var t,r,n=this.options.pageActions;if(!n)return e;var i=nH(Array.from(this.groupedLabeledEvents[e.type]).map(function(e){return n.labeledEvents[e]}).filter(function(t){return t.definition.some(function(t){return nK[t.event_type]===e.type&&t.filters.every(function(t){return nF(e,t)})})}),this.labeledEventToTriggerMap);try{for(var o=(0,es.__values)(i),s=o.next();!s.done;s=o.next()){var a=s.value;nV(a.actions,e,this.dataExtractor)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}return e},e.prototype.update=function(e,t,r){this.groupedLabeledEvents=e,this.labeledEventToTriggerMap=t,this.options=r},e}(),nJ=new Set(["id","class","style","value","onclick","onchange","oninput","onblur","onsubmit","onfocus","onkeydown","onkeyup","onkeypress","data-reactid","data-react-checksum","data-reactroot",ng,rN]),n$=["type"],nX=["svg","path","g"],nY=["password","hidden"],nQ=function(){function e(e,t){this.value=e,this.optimized=t}return e.prototype.toString=function(){return this.value},e}(),nZ=function(e,t){if(e.nodeType!==Node.ELEMENT_NODE)return"";for(var r=[],n=e;n;){var i=n0(n,!!t,n===e);if(!i||(r.push(i),i.optimized))break;n=n.parentElement}return r.reverse(),r.join(" > ")},n0=function(e,t,r){if(e.nodeType!==Node.ELEMENT_NODE)return null;var n,i,o=e.getAttribute("id");if(t){if(o)return new nQ(c(o),!0);var s=e.tagName.toLowerCase();if("body"===s||"head"===s||"html"===s)return new nQ(s,!0)}var a=e.tagName.toLowerCase();if(o)return new nQ(a+c(o),!0);var u=e.parentNode;if(!u||u.nodeType===Node.DOCUMENT_NODE)return new nQ(a,!0);function l(e){var t=e.getAttribute("class");return t?t.split(/\s+/g).filter(Boolean).map(function(e){return"$"+e}):[]}function c(e){return"#"+CSS.escape(e)}for(var d=l(e),f=!1,h=!1,p=-1,g=-1,v=u.children,m=0;v&&(-1===p||!h)&&m<v.length;++m){var y=v[m];if(y.nodeType===Node.ELEMENT_NODE){if(g+=1,y===e){p=g;continue}if(!h&&y.tagName.toLowerCase()===a){f=!0;var b=new Set(d);if(!b.size){h=!0;continue}for(var _=l(y),w=0;w<_.length;++w){var S=_[w];if(b.has(S)&&(b.delete(S),!b.size)){h=!0;break}}}}}var E=a;if(r&&"input"===a.toLowerCase()&&e.getAttribute("type")&&!e.getAttribute("id")&&!e.getAttribute("class")&&(E+="[type="+CSS.escape(e.getAttribute("type")||"")+"]"),h)E+=":nth-child("+String(p+1)+")";else if(f)try{for(var k=(0,es.__values)(d),I=k.next();!I.done;I=k.next()){var x=I.value;E+="."+CSS.escape(x.slice(1))}}catch(e){n={error:e}}finally{try{I&&!I.done&&(i=k.return)&&i.call(k)}finally{if(n)throw n.error}}return new nQ(E,!1)},n1=function(e,t){var r,n,i,o=this;this.replaceSensitiveString=function(e){return rj(e,o.additionalMaskTextPatterns)},this.getHierarchy=function(e){var t,r,n,i,s=performance.now(),a=[];if(!e)return[];for(var u=function(e){var t=[];if(!e)return t;
2t.push(e);for(var r=e.parentElement;r&&"HTML"!==r.tagName;)t.push(r),r=r.parentElement;return t}(e),l=new Map,c=u.length-1;c>=0;c--){var d=u[c];if(d){var f,h=(f=d.getAttribute(ng))?f.split(",").map(function(e){return e.trim()}).filter(function(e){return e.length>0&&"id"!==e&&"class"!==e}):[],p=c===u.length-1?[]:null!=(n=l.get(u[c+1]))?n:new Set,g=new Set((0,es.__spreadArray)((0,es.__spreadArray)([],(0,es.__read)(p),!1),(0,es.__read)(h),!1));l.set(d,g)}}a=u.map(function(e){var t;return function(e,t){if(null===e)return null;var r,n,i,o,s,a,u=String(e.tagName).toLowerCase(),l={tag:u},c=Array.from(null!=(o=null==(i=e.parentElement)?void 0:i.children)?o:[]);c.length&&(l.index=c.indexOf(e),l.indexOfType=c.filter(function(t){return t.tagName===e.tagName}).indexOf(e));var d=null==(a=null==(s=e.previousElementSibling)?void 0:s.tagName)?void 0:a.toLowerCase();d&&(l.prevSib=String(d));var f=e.getAttribute("id");f&&(l.id=String(f));var h=Array.from(e.classList);h.length&&(l.classes=h);var p={},g=Array.from(e.attributes).filter(function(e){return!nJ.has(e.name)}),v=!nS(e);if(!nY.includes(String(e.getAttribute("type")))&&!nX.includes(u))try{for(var m=(0,es.__values)(g),y=m.next();!y.done;y=m.next()){var b=y.value;if(!v||n$.includes(b.name)){if(t.has(b.name)){p[b.name]=rD;continue}p[b.name]=String(b.value).substring(0,128)}}}catch(e){r={error:e}}finally{try{y&&!y.done&&(n=m.return)&&n.call(m)}finally{if(r)throw r.error}}return Object.keys(p).length&&(l.attrs=p),l}(e,null!=(t=l.get(e))?t:new Set)});var v=function(e){(null==e?void 0:e.attrs)&&Object.entries(e.attrs).forEach(function(t){var r=(0,es.__read)(t,2),n=r[0],i=r[1];e.attrs&&(e.attrs[n]=o.replaceSensitiveString(i))})};try{for(var m=(0,es.__values)(a),y=m.next();!y.done;y=m.next()){var b=y.value;v(b)}}catch(e){t={error:e}}finally{try{y&&!y.done&&(r=m.return)&&r.call(m)}finally{if(t)throw t.error}}var _=performance.now();return null==(i=o.diagnosticsClient)||i.recordHistogram("autocapturePlugin.getHierarchy",_-s),a},this.getNearestLabel=function(e){var t,r=e.parentElement;if(!r)return"";try{t=r.querySelector(":scope>span,h1,h2,h3,h4,h5,h6")}catch(e){t=null}return t?o.getText(t):o.getNearestLabel(r)},this.getElementPath=function(e){if(!e)return"";var t,r=performance.now(),n=nZ(e),i=performance.now();return null==(t=o.diagnosticsClient)||t.recordHistogram("autocapturePlugin.getElementPath",i-r),n},this.getEventProperties=function(e,t,r){var n,i,s,a,u=null==(s=null==(i=null==t?void 0:t.tagName)?void 0:i.toLowerCase)?void 0:s.call(i),l="function"==typeof t.getBoundingClientRect?t.getBoundingClientRect():{left:null,top:null},c=o.getHierarchy(t),d=null==(a=c[0])?void 0:a.attrs,f=o.getNearestLabel(t),h=Object.entries(null!=d?d:{}).reduce(function(e,t){var n=(0,es.__read)(t,2),i=n[0],o=n[1];if(i.startsWith(r)){var s=i.replace(r,"");s&&(e[s]=o||"")}return e},{}),p=((n={})["[Amplitude] Element Hierarchy"]=c,n[nl]=u,n[nc]=o.getText(t),n["[Amplitude] Element Position Left"]=null==l.left?null:Math.round(l.left),n["[Amplitude] Element Position Top"]=null==l.top?null:Math.round(l.top),n["[Amplitude] Element Attributes"]=h,n["[Amplitude] Element Path"]=o.getElementPath(t),n["[Amplitude] Element Parent Label"]=f,n[nd]=nm(window.location.href.split("?")[0]),n["[Amplitude] Page Title"]=rF(o.replaceSensitiveString),n[nf]=window.innerHeight,n[nh]=window.innerWidth,n),g=nk();if(g&&(p[np]=g),p["[Amplitude] Element ID"]=t.getAttribute("id")||"",p["[Amplitude] Element Class"]=t.getAttribute("class"),p["[Amplitude] Element Aria Label"]=null==d?void 0:d["aria-label"],"a"===u&&"click"===e&&t instanceof HTMLAnchorElement){var v=t.href.substring(0,128);p["[Amplitude] Element Href"]=o.replaceSensitiveString(v)}return nE(p)},this.addTypeAndTimestamp=function(e,t){return{event:e,timestamp:Date.now(),type:t}},this.addAdditionalEventProperties=function(e,t,r,n,i){void 0===i&&(i=!1);var s=o.addTypeAndTimestamp(e,t);if(("click"===s.type||"change"===s.type)&&null!==s.event.target){if(i&&nb(s.event.target,s.type))return s.closestTrackedAncestor=s.event.target,s.targetElementProperties=o.getEventProperties(s.type,s.closestTrackedAncestor,n),s;var a=nI(s.event.target,r);a&&(s.closestTrackedAncestor=a,s.targetElementProperties=o.getEventProperties(s.type,a,n))}return s},this.extractDataFromDataSource=function(e,t){if("DOM_ELEMENT"===e.sourceType){var r=nB(e,t);if(r){if("TEXT"===e.elementExtractType)return o.getText(r);if("ATTRIBUTE"===e.elementExtractType&&e.attribute)return r.getAttribute(e.attribute)}}},this.getTextWithMaskedDescendants=function(e){var t,r,n="[".concat(rN,"], [contenteditable]");if(!e.querySelector(n))return e.innerText;var i="",s=Array.from(e.childNodes);try{for(var a=(0,es.__values)(s),u=a.next();!u.done;u=a.next()){var l=u.value;if(l.nodeType===Node.TEXT_NODE){i+=l.textContent||"";continue}if(l instanceof Element){if(l.hasAttribute(rN)||l.hasAttribute("contenteditable")){i+=rD;continue}i+=o.getTextWithMaskedDescendants(l)}}}catch(e){t={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}return i},this.getText=function(e){if(null!==e.closest("[".concat(rN,"]")))return rD;var t="";return t=e.querySelector("[".concat(rN,"], [contenteditable]"))?o.getTextWithMaskedDescendants(e):e.innerText||"",o.replaceSensitiveStr
2ing(t.substring(0,255)).replace(/\s+/g," ").trim()},this.getEventTagProps=function(e){if(!e)return{};var t,r,n,i=null==(n=null==(r=null==e?void 0:e.tagName)?void 0:r.toLowerCase)?void 0:n.call(r);return nE(((t={})[nl]=i,t[nc]=o.getText(e),t[nd]=window.location.href.split("?")[0],t))},this.diagnosticsClient=null==t?void 0:t.diagnosticsClient;var s=null!=(i=e.maskTextRegex)?i:[],a=[];try{for(var u=(0,es.__values)(s),l=u.next();!l.done;l=u.next()){var c=l.value;if(a.length>=25)break;if(c instanceof RegExp)a.push(c);else if("pattern"in c&&"string"==typeof c.pattern)try{a.push(RegExp(c.pattern,"i"))}catch(e){}}}catch(e){r={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(r)throw r.error}}this.additionalMaskTextPatterns=a},nC=nn;(c=B||(B={})).ClickObservable="clickObservable",c.ChangeObservable="changeObservable",c.NavigateObservable="navigateObservable",c.MutationObservable="mutationObservable",c.ScrollObservable="scrollObservable",c.ExposureObservable="exposureObservable",c.BrowserErrorObservable="browserErrorObservable",c.SelectionObservable="selectionObservable",c.MouseMoveObservable="mouseMoveObservable";var n2=function(e,t){void 0===e&&(e={}),null==t||t.diagnosticsClient.setTag("plugin.autocapture.version",na);var r,n,i,o,s,a,u,l,c,d,f,h,p,g=e.dataAttributePrefix,v=void 0===g?r3:g,m=e.visualTaggingOptions,y=void 0===m?{enabled:!0}:m;e.cssSelectorAllowlist=null!=(r=e.cssSelectorAllowlist)?r:r2,e.actionClickAllowlist=null!=(n=e.actionClickAllowlist)?n:r4,e.debounceTime=null!=(i=e.debounceTime)?i:0;var b=(null==(o=e.viewportContentUpdated)?void 0:o.enabled)!==!1,_=null!=(u=null!=(a=null==(s=e.viewportContentUpdated)?void 0:s.exposureDuration)?a:e.exposureDuration)?u:150;e.viewportContentUpdated=(0,es.__assign)((0,es.__assign)({},e.viewportContentUpdated),{exposureDuration:_}),e.pageUrlExcludelist=null==(l=e.pageUrlExcludelist)?void 0:l.reduce(function(e,t){if("string"==typeof t&&e.push(t),t instanceof RegExp&&e.push(t),"object"==typeof t&&null!==t&&"pattern"in t)try{e.push(new RegExp(t.pattern))}catch(e){console.warn("Invalid regex pattern: ".concat(t.pattern),e)}return e},[]);var w="@amplitude/plugin-autocapture-browser",S=[],E=new n1(e,t),k=new Set,I=new Set,x=function(){var t,r,n,i=ns(nq().map(function(t){return E.addAdditionalEventProperties(t,"click",e.cssSelectorAllowlist,v)})),o=ns(new nC.default(function(t){var r,n=function(r){var n=E.addAdditionalEventProperties(r,"change",e.cssSelectorAllowlist,v);t.next(n)};return null==(r=(0,eU.getGlobalScope)())||r.document.addEventListener("change",n,{capture:!0}),function(){var e;return null==(e=(0,eU.getGlobalScope)())?void 0:e.document.removeEventListener("change",n)}}));window.navigation&&(n=ns(new nC.default(function(t){var r=function(r){var n=E.addAdditionalEventProperties(r,"navigate",e.cssSelectorAllowlist,v);t.next(n)};return window.navigation.addEventListener("navigate",r),function(){window.navigation.removeEventListener("navigate",r)}})));var s=ns(nU().map(function(t){return E.addAdditionalEventProperties(t,"mutation",e.cssSelectorAllowlist,v)})),a=new nC.default(function(e){var t,r=function(t){e.next(t)};return null==(t=(0,eU.getGlobalScope)())||t.addEventListener("scroll",r),function(){var e;null==(e=(0,eU.getGlobalScope)())||e.removeEventListener("scroll",r)}}),u=(t=e.cssSelectorAllowlist,new nC.default(function(e){var r,n=(0,eU.getGlobalScope)();if(!(null==n?void 0:n.IntersectionObserver))return function(){};var i=new IntersectionObserver(function(t){t.forEach(function(t){e.next(t)})},{root:null,rootMargin:"0px",threshold:1}),o=t.join(",");(null!=(r=null==n?void 0:n.document.querySelectorAll(o))?r:[]).forEach(function(e){i.observe(e)});var a=s.subscribe(function(e){return e.event.forEach(function(e){return e.addedNodes.forEach(function(e){e instanceof Element&&(e.matches(o)&&i.observe(e),e.querySelectorAll(o).forEach(function(e){i.observe(e)}))})})});return function(){a.unsubscribe(),i.disconnect()}}));return(r={})[B.ChangeObservable]=o,r[B.ClickObservable]=i,r[B.MutationObservable]=s,r[B.NavigateObservable]=n,r[B.ScrollObservable]=a,r[B.ExposureObservable]=u,r},T=nW(Object.values(null!=(d=null==(c=e.pageActions)?void 0:c.labeledEvents)?d:{})),C=nz(null!=(h=null==(f=e.pageActions)?void 0:f.triggers)?h:[]),P=new nG(T,C,E,e),O=function(t){var r,n;t&&(e.pageActions=(0,es.__assign)((0,es.__assign)({},e.pageActions),t),T=nW(Object.values(null!=(r=e.pageActions.labeledEvents)?r:{})),C=nz(null!=(n=e.pageActions.triggers)?n:[]),P.update(T,C,e))};return{name:w,type:"enrichment",setup:function(t,r){return(0,es.__awaiter)(void 0,void 0,void 0,function(){var n,i,o,s,a,u,l,c,d,f,h,g,m,T,C,A,R,M,N,D,L;return(0,es.__generator)(this,function(U){var q,j,F,V,K,W,z,H,G,J,$,X,Y,Q,Z,ee,et,er,en,ei,eo,ea,eu,el,ec,ed,ef,eh,ep,eg,ev,em,ey,eb,e_,ew,eS,eE,ek;return"u"<typeof document?[2]:(n=!1,i={maxX:void 0,maxY:void 0},t.fetchRemoteConfig&&(t.remoteConfigClient?t.remoteConfigClient.subscribe("configs.analyticsSDK.pageActions","all",function(e){O(e)}):t.loggerProvider.debug("Remote config client is not provided, skipping remote config fetch")),o=nw(e,e.cssSelectorAllowlist),s=nw(e,e.actionClickAllowlist),j=(q={allObservables:a=x(),amplitude:r,shouldTrackEvent:o,evaluateTriggers:P.evaluate.bind(P)}).amplitude,F=q.allObservables,V=q.shouldTrackEvent,K=q.evaluateTriggers,u=F.clickObservable.filter(nx).filter(function(e){return V("click",e.closestTrackedAncestor)}).map(function(e){return K(e)}).subscribe(function(e){null==j||j.track(nu,e.targetElementProperties)}),S.push(u),z=(W={allObservables:a,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return E.getEventProperties.apply(E,(0,es.__spreadArray)((0,es.__spreadArray)([],(0,es.__read)(e),!1),[v],!1))},amplitude:r,shouldTrackEvent:o,evaluateTriggers:P.evaluate.bind(P)}).amplitude,H=W.allObservables,G=W.getEventProperties,J=W.shouldTrackEvent,$=W.evaluateTriggers,l=H.changeObservable.filter(nx).filter(function(e){return J("change",e.closestTrackedAncestor)}).map(function(e){return $(e)}).subscribe(function(e){null==z||z.track("[Amplitude] Element Changed",G("change",e.closestTrackedAncestor))}),S.push(l),Y=(X={allObservables:a,options:e,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return E.getEventProperties.apply(E,(0,es.__spreadArray)((0,es.__spreadArray)([],(0,es.__read)(e),!1),[v],!1))},amplitude:r,shouldTrackEvent:o,shouldTrackActionClick:s}).amplitude,Q=X.allObservables,Z=X.options,ee=X.getEventProperties,et=X.shouldTrackEvent,er=X.shouldTrackActionClick,en=Q.clickObservable,ei=Q.mutationObservable,eo=Q.navigateObservable,ea=en.filter(function(e){return!et("click",e.closestTrackedAncestor)}).map(function(e){var t=nI(e.event.target,Z.actionClickAllowlist);return e.closestTrackedAncestor=t,null!==e.closestTrackedAncestor&&(e.targetElementProperties=ee(e.type,e.closestTrackedAncestor)),e}).filter(nx).filter(function(e){return er("click",e.closestTrackedAncestor)}),eu=eo?no(ei,eo):ei,el=no(ea,eu),ec=null,ed=null,(c=ni(el,function(e){if(ec&&(clearTimeout(ec),ec=null),"click"===e.type)ed=e,ec=setTimeout(function(){ec=null,ed=null},500);else if(ed){var t=ed;return ed=null,Promise.resolve(t)}return Promise.resolve(null)}).subscribe(function(e){e&&(null==Y||Y.track(nu,ee("click",e.closestTrackedAncestor)))}))&&S.push(c),(ef={allObservables:a,amplitude:r}).amplitude,eh=ef.allObservables.scrollObservable,ep={maxX:0,maxY:0},eg=eh.subscribe(function(){var e,t,r,n,i=(0,eU.getGlobalScope)(),o=Math.floor(null!=(t=null!=(e=null==i?void 0:i.scrollX)?e:null==i?void 0:i.pageXOffset)?t:0),s=Math.floor(null!=(n=null!=(r=null==i?void 0:i.scrollY)?r:null==i?void 0:i.pageYOffset)?
2n:0);ep.maxX=Math.max(ep.maxX,o),ep.maxY=Math.max(ep.maxY,s)}),d={unsubscribe:function(){eg.unsubscribe()},getState:function(){return ep},reset:function(){ep.maxX=0,ep.maxY=0}},S.push(d),f={},h=(0,eU.getGlobalScope)(),g=function(e){e&&n||(setTimeout(function(){n=!1},100),n=!0,function(e){var t,r,n,i,o=e.amplitude,s=e.scrollTracker,a=e.currentElementExposed,u=e.elementExposedForPage,l=e.exposureTracker,c=e.isPageEnd,d=e.lastScroll,f=s.getState(),h=(0,eU.getGlobalScope)(),p=null!=(r=null==h?void 0:h.innerWidth)?r:0,g=null!=(n=null==h?void 0:h.innerHeight)?n:0,v=((t={})[nd]=null==(i=null==h?void 0:h.location)?void 0:i.href,t["[Amplitude] Max Page X"]=f.maxX+p,t["[Amplitude] Max Page Y"]=f.maxY+g,t[nf]=g,t[nh]=p,t["[Amplitude] Element Exposed"]=Array.from(a),t),m=nk();if(m&&(v[np]=m),0===a.size&&f.maxX===d.maxX&&f.maxY===d.maxY){c&&(s.reset(),u.clear(),null==l||l.reset());return}null==o||o.track("[Amplitude] Viewport Content Updated",v),d.maxX=f.maxX,d.maxY=f.maxY,a.clear(),c&&(s.reset(),u.clear(),null==l||l.reset())}({amplitude:r,scrollTracker:d,currentElementExposed:I,elementExposedForPage:k,exposureTracker:f.exposure,isPageEnd:e,lastScroll:i}))},m=function(e){!k.has(e)&&(k.add(e),I.add(e),JSON.stringify(Array.from(I)).length>=18e3&&g(!1))},b&&(em=(ev={allObservables:a,onExposure:m,dataExtractor:E,exposureDuration:_}).allObservables,ey=ev.onExposure,eb=ev.dataExtractor,ew=void 0===(e_=ev.exposureDuration)?150:e_,eS=new Map,eE=new Map,ek=em.exposureObservable.subscribe(function(e){var t=e.target;if(e.isIntersecting){if(!eS.get(t)){var r=setTimeout(function(){eS.set(t,!0),ey(eb.getElementPath(t)),eE.set(t,null)},ew);eE.set(t,r)}}else if(!e.isIntersecting&&e.intersectionRatio<1){var r=eE.get(t);r&&(clearTimeout(r),eE.set(t,null))}}),f.exposure={unsubscribe:function(){ek.unsubscribe()},reset:function(){eE.forEach(function(e){e&&clearTimeout(e)}),eE.clear(),eS.clear()}},f.exposure&&S.push(f.exposure),T=function(){g(!0)},null==h||h.addEventListener("beforeunload",T),p=function(){null==h||h.removeEventListener("beforeunload",T)},S.push({unsubscribe:function(){return p()}}),(C=a[B.NavigateObservable])?S.push(C.subscribe(function(){g(!0)})):h&&(A=function(){g(!0)},h.addEventListener("popstate",A),R=h.history.pushState,h.history&&R&&(h.history.pushState=new Proxy(R,{apply:function(e,t,r){var n=(0,es.__read)(r,3),i=n[0],o=n[1],s=n[2];e.apply(t,[i,o,s]),g(!0)}})),S.push({unsubscribe:function(){h.removeEventListener("popstate",A),h.history&&R&&(h.history.pushState=R)}}))),null==(L=null==t?void 0:t.loggerProvider)||L.log("".concat(w," has been successfully added.")),window.opener&&y.enabled&&(M=e.cssSelectorAllowlist,N=e.actionClickAllowlist,!function(e,t){if(!0!==e[nT]){e[nT]=!0;var r=t.dataExtractor,n=t.isElementSelectable,i=t.cssSelectorAllowlist,o=t.actionClickAllowlist,s=null,a=function(t){e.notify({action:"element-selected",data:t})},u=function(t,r){"selector-mode-changed"===t?e.notify({action:"track-selector-mode-changed",data:r}):"selector-moved"===t&&e.notify({action:"track-selector-moved",data:r})};e.registerActionHandler("initialize-visual-tagging-selector",function(t){e.loadScriptOnce("https://cdn.amplitude.com/libs/visual-tagging-selector-1.0.0-alpha.js.gz").then(function(){var l;s=null==(l=null==window?void 0:window.amplitudeVisualTaggingSelector)?void 0:l.call(window,{getEventTagProps:r.getEventTagProps,isElementSelectable:function(e){return!n||n((null==t?void 0:t.actionType)||"click",e)},onTrack:u,onSelect:a,visualHighlightClass:"amp-visual-tagging-selector-highlight",messenger:e,cssSelectorAllowlist:i,actionClickAllowlist:o,extractDataFromDataSource:r.extractDataFromDataSource,dataExtractor:r,diagnostics:{autocapture:{version:na}}}),e.notify({action:"selector-loaded"})}).catch(function(){var t;null==(t=e.logger)||t.warn("Failed to initialize visual tagging selector")})}),e.registerActionHandler("close-visual-tagging-selector",function(){var e;null==(e=null==s?void 0:s.close)||e.call(s)})}}(D=ne(),{dataExtractor:E,isElementSelectable:nw(e,(0,es.__spreadArray)((0,es.__spreadArray)([],(0,es.__read)(M),!1),(0,es.__read)(N),!1)),cssSelectorAllowlist:M,actionClickAllowlist:N}),nr(D),D.setup((0,es.__assign)({logger:null==t?void 0:t.loggerProvider},(null==t?void 0:t.serverZone)&&{endpoint:r6[t.serverZone]}))),[2])})})},execute:function(e){return(0,es.__awaiter)(void 0,void 0,void 0,function(){return(0,es.__generator)(this,function(t){return[2,e]})})},teardown:function(){return(0,es.__awaiter)(void 0,void 0,void 0,function(){var e,t,r,n;return(0,es.__generator)(this,function(i){try{for(t=(e=(0,es.__values)(S)).next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){r={error:e}}finally{try{t&&!t.done&&(n=e.return)&&n.call(e)}finally{if(r)throw r.error}}return[2]})})}}},nC=nn,n3=(0,es.__spreadArray)(['input[type="button"]','input[type="submit"]','input[type="reset"]','input[type="image"]','input[type="file"]'],(0,es.__read)(["a","button",'[role="button"]','[role="link"]','[role="menuitem"]','[role="menuitemcheckbox"]','[role="menuitemradio"]','[role="option"]','[role="tab"]','[role="treeitem"]','[contenteditable="true" i]']),!1),n4=["*"],n5=["mutation","navigate"];function n6(e,t){var r,n,i,o,s=t.event,a=s.pageX,u=s.pageY;e.yMin=Math.min(null!=(r=e.yMin)?r:u,u),e.yMax=Math.max(null!=(n=e.yMax)?n:u,u),e.xMin=Math.min(null!=(i=e.xMin)?i:a,a),e.xMax=Math.max(null!=(o=e.xMax)?o:a,a),e.isOutOfBounds=e.yMax-e.yMin>50||e.xMax-e.xMin>50}function n8(e){if(0===e.length)return null;var t=e[0],r=e[e.length-1];return{rageClickEvent:(0,es.__assign)({"[Amplitude] Begin Time":new Date(t.timestamp).toISOString(),"[Amplitude] End Time":new Date(r.timestamp).toISOString(),"[Amplitude] Duration":r.timestamp-t.timestamp,"[Amplitude] Clicks":e.map(function(e){return{X:e.event.pageX,Y:e.event.pageY,Time:e.timestamp}}),"[Amplitude] Click Count":e.length},t.targetElementProperties),time:t.timestamp}}var nC=nn;(d=V||(V={})).INCREASING="increasing",d.DECREASING="decreasing",(f=K||(K={})).X="x",f.Y="y";var n7=function(e){var t=e.allWindowObservables.mouseMoveObservable;return new nC.default(function(e){var r=null,n=null,i=null;return t.subscribe(function(t){var o={x:t.clientX,y:t.clientY};if(null===r){r=o;return}o.x>r.x?(n===V.DECREASING&&e.next(K.X),n=V.INCREASING):o.x<r.x&&(n===V.INCREASING&&e.next(K.X),n=V.DECREASING),o.y>r.y?(i===V.DECREASING&&e.next(K.Y),i=V.INCREASING):o.y<r.y&&(i===V.INCREASING&&e.next(K.Y),i=V.DECREASING),r=o})})};function n9(e){var t=e.changes,r=e.changesThreshold,n=e.thresholdMs;return!(t.length<r)&&t[t.length-1]-t[0]<n}function ie(e){e.changes=[],e.startTime=void 0}function it(e){for(var t=e.changes,r=e.thresholdMs,n=0,i=t[t.length-1];n<t.length&&!(i-t[n]<r);n++);0!==n&&(e.startTime=t[n],e.changes.splice(0,n))}var ir=function(e){var t=e.mouseDirectionChangeObservable,r=e.directionChanges,n=void 0===r?20:r,i=e.thresholdMs,o=void 0===i?2e3:i;return new nC.default(function(e){var r={changes:[],changesThreshold:n,thresholdMs:o},i={changes:[],changesThreshold:n,thresholdMs:o},s=void 0,a=null;function u(){void 0!==s&&(e.next(s),s=void 0,null!==a&&clearTimeout(a),ie(r),ie(i))}return t.subscribe(function(e){null!==a&&clearTimeout(a),t=e===K.X?r:i,n=+Date.now(),t.startTime=t.startTime||n,l=t.changes,c=t.changesThreshold,l.push(n),l.length>c&&l.shift();var t,n,l,c,d=function(e,t){var r=void 0;if(n9(e)&&(r=e.startTime),n9(t)){var n=t.startTime;n&&(!r||n<r)&&(r=n)}return r}(r,i);return d?(s=s||d,a=setTimeout(function(){u(),a=null},o)):u(),it(r),it(i),function(){null!==a&&(clearTimeout(a),a=null)}})})},ii=function(e){var t=e.amplitude,r=e.options,n=e.allObservables,i=e.directionChanges,o=e.thresholdMs;return ir({mouseDirectionChangeObservable:n7({allWindowObservables:n}),directionChanges:void 0===i?20:i,thresholdMs:void 0===o?2e3:o}).subscribe(function(e){n_(r)&&t.track("[Amplitude] Thrashed Cursor",void 0,{time:e})})};function io(e,t,r,n){if(!n)return[];var i=e[t];return"object"==typeof i&&null!==i&&"cssSelectorAllowlist"in i&&Array.isArray(i.cssSelectorAllowlist)?i.cssSelectorAllowlist:r}var is=function(e){void 0===e&&(e={});var t,r="@amplitude/plugin-frustration-browser",n=[],i=!1!==e.errorClicks;e.errorClicks||(i=!1);var o=!1!==e.deadClicks&&null!==e.deadClicks,s=!1!==e.rageClicks&&null!==e.rageClicks,a=!1!==e.thrashedCursor&&null!==e.thrashedCursor;e.thrashedCursor||(a=!1);var u=io(e,"rageClicks",n4,s),l=io(e,"deadClicks",n3,o),c=io(e,"errorClicks",n3,i),d=null!=(t=e.dataAttributePrefix)?t:r3,f=new n1(e),h=(0,es.__spreadArray)([],(0,es.__read)(new Set((0,es.__spreadArray)((0,es.__spreadArray)((0,es.__spreadArray)([],(0,es.__read)(u),!1),(0,es.__read)(l),!1),(0,es.__read)(c),!1))),!1),p=function(){var e,t,r=ns(nq("pointerdown").map(function(e){return f.addAdditionalEventProperties(e,"click",h,d,!0)})),n=ns(nj().map(function(e){return f.addTypeAndTimestamp(e,"error")})),i=ns(nU().map(function(e){return f.addAdditionalEventProperties(e,"mutation",h,d)}));window.navigation&&(t=ns(new nC.default(function(e){var t=function(t){e.next((0,es.__assign)((0,es.__assign)({},t),{type:"navigate"}))};return window.navigation.addEventListener("navigate",t),function(){window.navigation.removeEventListener("navigate",t)}}).map(function(e){return f.addAdditionalEventProperties(e,"navigate",h,d)})));var o=ns(new nC.default(function(e){var t=function(){var t=document.activeElement;if(t&&("TEXTAREA"===t.tagName||"INPUT"===t.tagName)){var r=void 0,n=void 0;try{if(r=t.selectionStart,n=t.selectionEnd,r===n)return}catch(e){return}return e.next()}var i=window.getSelection();if(i&&!i.isCollapsed)return e.next()};return window.document.addEventListener("selectionchange",t),function(){window.document.removeEventListener("selectionchange",t)}})),s=ns(new nC.default(function(e){var t=function(t){e.next(t)},r={capture:!0};return nL.document.addEventListener("mousemove",t,r),function(){nL.document.removeEventListener("mousemove",t,r)}}));return(e={})[B.ClickObservable]=r,e[B.MutationObservable]=i,e[B.NavigateObservable]=t,e[B.BrowserErrorObservable]=n,e[B.SelectionObservable]=o,e[B.MouseMoveObservable]=s,e};return{name:r,type:"enrichment",setup:function(t,h){return(0,es.__awaiter)(void 0,void 0,void 0,function(){var g,v,m,y,b,_,w,S;return(0,es.__generator)(this,function(E){var k,I,x,T,C,P,O,A,R,M,N,D,L,U,q,j,B,V,K,W,z,H;return"u"<typeof document?[2]:(g=p(),s&&(v=function(e){var t=this,r=e.amplitude,n=e.allObservables,i=e.shouldTrackRageClick,o=n.clickObservable,s=n.selectionObservable,a=[],u={},l=null;function c(e){a=[],u={},e&&(n6(u,e),a.push(e))}var d=ni(o.filter(function(e){return i("click",e.closestTrackedAncestor)}),function(e){return(0,es.__awaiter)(t,void 0,void 0,function(){var t;return(0,es.__generator)(this,function(r){var n,i,o,s;return(n6(u,e),t=null,0===a.length||(n=a).length>0&&n[n.length-1].closestTrackedAncestor!==e.closestTrackedAncestor||(o=Math.max(0,(i=a).length-4+1),s=i[o],e.timestamp-s.timestamp>
2=1e3)||u.isOutOfBounds)?(l&&(t=n8(a)),c(e)):a.push(e),(l&&(clearTimeout(l.timerId),l.resolve(t),l=null),a.length>=4)?[2,new Promise(function(e){l={resolve:e,timerId:setTimeout(function(){e(n8(a))},1e3)}})]:[2,null]})})}),f=null==s?void 0:s.subscribe(function(){c()}),h=d.subscribe(function(e){null!==e&&r.track("[Amplitude] Rage Click",e.rageClickEvent,{time:e.time})});return{unsubscribe:function(){h.unsubscribe(),null==f||f.unsubscribe()}}}({allObservables:g,amplitude:h,shouldTrackRageClick:nw(e,u)}),n.push(v)),o&&(I=(k={amplitude:h,allObservables:g,getEventProperties:function(e,t){return f.getEventProperties(e,t,d)},shouldTrackDeadClick:nw(e,l)}).amplitude,x=k.allObservables,T=k.getEventProperties,C=k.shouldTrackDeadClick,P=x.clickObservable,O=x.mutationObservable,A=x.navigateObservable,R=P.filter(function(e){return nx(e)&&C("click",e.closestTrackedAncestor)&&e.event.target instanceof Element&&null===e.event.target.closest('a[target="_blank"]')&&e.event.button===F.LEFT_OR_TOUCH_CONTACT}),M=A?no(O,A):O,N=no(R,M),D=null,m=ni(N,function(e){if(D&&n5.includes(e.type))clearTimeout(D),D=null;else if("click"===e.type)return D?Promise.resolve(null):new Promise(function(t){D=setTimeout(function(){t(e),D=null},3e3)});return Promise.resolve(null)}).subscribe(function(e){if(e){var t={"[Amplitude] X":e.event.clientX,"[Amplitude] Y":e.event.clientY};I.track("[Amplitude] Dead Click",(0,es.__assign)((0,es.__assign)({},T("click",e.closestTrackedAncestor)),t),{time:e.timestamp})}}),n.push(m)),i&&(U=(L={amplitude:h,allObservables:g,shouldTrackErrorClick:nw(e,c)}).amplitude,q=L.allObservables,j=L.shouldTrackErrorClick,B=q.clickObservable,V=q.browserErrorObservable,K=B.filter(function(e){return nx(e)&&j("click",e.closestTrackedAncestor)&&e.event.target instanceof Element&&null===e.event.target.closest('a[target="_blank"]')&&e.event.button===F.LEFT_OR_TOUCH_CONTACT}),W=null,z=null,H=function(){null!==W&&(clearTimeout(W),W=null),z=null},y=no(K,V).subscribe(function(e){var t;if("click"===e.type){H(),z=e,W=setTimeout(H,2e3);return}"error"===e.type&&z&&(U.track("[Amplitude] Error Click",(0,es.__assign)(((t={})["[Amplitude] Kind"]=e.event.kind,t["[Amplitude] Message"]=e.event.message,t["[Amplitude] Stack"]=e.event.stack,t["[Amplitude] Filename"]=e.event.filename,t["[Amplitude] Line Number"]=e.event.lineNumber,t["[Amplitude] Column Number"]=e.event.columnNumber,t),z.targetElementProperties)),H())}),n.push(y)),a&&(b=void 0,_=void 0,"object"==typeof e.thrashedCursor&&(b=e.thrashedCursor.directionChanges,_=e.thrashedCursor.threshold,b&&b<5&&(t.loggerProvider.warn("'thrashedCursor.directionChanges' of ".concat(b," is below the minimum of ").concat(5,", setting to ").concat(5)),b=5),_&&_>4e3&&(t.loggerProvider.warn("'thrashedCursor.threshold' of ".concat(_," is above the maximum of ").concat(4e3,", setting to ").concat(4e3)),_=4e3)),w=ii({amplitude:h,options:e,allObservables:g,directionChanges:b,thresholdMs:_}),n.push(w)),null==(S=null==t?void 0:t.loggerProvider)||S.log("".concat(r," has been successfully added.")),[2])})})},execute:function(e){return(0,es.__awaiter)(void 0,void 0,void 0,function(){return(0,es.__generator)(this,function(t){return[2,e]})})},teardown:function(){return(0,es.__awaiter)(void 0,void 0,void 0,function(){var e,t,r,i;return(0,es.__generator)(this,function(o){try{for(t=(e=(0,es.__values)(n)).next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){r={error:e}}finally{try{t&&!t.done&&(i=e.return)&&i.call(e)}finally{if(r)throw r.error}}return[2]})})}}};function ia(e,t,r){e&&function e(t){var r,n,i=t.json,o=t.targetObject,s=t.allowlist,a=t.excludelist,u=t.ancestors,l=t.parentObject,c=t.targetKey;o||(o=i);var d=Object.keys(o);try{for(var f=(0,es.__values)(d),h=f.next();!h.done;h=f.next()){var p,g=h.value,v=(0,es.__spreadArray)((0,es.__spreadArray)([],(0,es.__read)(u),!1),[g],!1);(p=o[g],"string"==typeof p||"number"==typeof p||"boolean"==typeof p||null==p)?(!il(v,s)||il(v,a))&&delete o[g]:e({json:i,targetObject:o[g],allowlist:s,excludelist:a,ancestors:v,parentObject:o,targetKey:g})}}catch(e){r={error:e}}finally{try{h&&!h.done&&(n=f.return)&&n.call(f)}finally{if(r)throw r.error}}0===Object.keys(o).length&&l&&c&&delete l[c]}({json:e,allowlist:t.map(iu),excludelist:r.map(iu),ancestors:[]})}function iu(e){return e.startsWith("/")&&(e=e.slice(1)),e.split("/").map(function(e){return e.replace(/~0/g,"~").replace(/~1/g,"/")})}function il(e,t){return t.some(function(t){return function e(t,r,n,i){if(void 0===n&&(n=0),void 0===i&&(i=0),i===r.length)return n===t.length;if(n===t.length){for(;i<r.length&&"**"===r[i];)i++;return i===r.length}var o=r[i];if("**"===o){if(i+1===r.length)return!0;for(var s=n;s<=t.length;s++)if(e(t,r,s,i+1))return!0;return!1}return("*"===o||o===t[n])&&e(t,r,n+1,i+1)}(e,t)})}var ic=function(){function e(e){this.request=e}return e.prototype.headers=function(e){void 0===e&&(e=[]);var t,r,n=this.request.headers,i={};if(Array.isArray(n))n.forEach(function(e){var t=(0,es.__read)(e,2),r=t[0],n=t[1];i[r]=n});else if(n instanceof Headers)n.forEach(function(e,t){i[t]=e});else if("object"==typeof n&&null!==n)try{for(var o=(0,es.__values)(Object.entries(n)),s=o.next();!s.done;s=o.next()){var a=(0,es.__read)(s.value,2),u=a[0],l=a[1];i[u]=l}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}return iy(i,{allow:e})},Object.defineProperty(e.prototype,"bodySize",{get:function(){if("number"==typeof this._bodySize)return this._bodySize;var e=(0,eU.getGlobalScope)();if(null==e?void 0:e.TextEncoder){var t=this.request.body;return this._bodySize=ih(t,100),this._bodySize}}
2,enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"method",{get:function(){return this.request.method},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"body",{get:function(){return"string"==typeof this.request.body?this.request.body:null},enumerable:!1,configurable:!0}),e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),(0,es.__awaiter)(this,void 0,void 0,function(){return(0,es.__generator)(this,function(r){return 0===e.length?[2,null]:[2,iv(this.body,e,t)]})})},e}(),id=function(){function e(e,t){this.bodyRaw=e,this.requestHeaders=t}return e.prototype.headers=function(e){return void 0===e&&(e=[]),iy(this.requestHeaders,{allow:e})},Object.defineProperty(e.prototype,"bodySize",{get:function(){return ih(this.bodyRaw,100)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"body",{get:function(){return"string"==typeof this.bodyRaw?this.bodyRaw:null},enumerable:!1,configurable:!0}),e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),(0,es.__awaiter)(this,void 0,void 0,function(){return(0,es.__generator)(this,function(r){return 0===e.length?[2,null]:[2,iv(this.body,e,t)]})})},e}();function ih(e,t){var r,n,i,o,s=(0,eU.getGlobalScope)(),a=null==s?void 0:s.TextEncoder;if(a){if("string"==typeof e)o=e,i=new a().encode(o).length;else if(e instanceof Blob)i=(o=e).size;else if(e instanceof URLSearchParams)o=e,i=new a().encode(o.toString()).length;else if(ArrayBuffer.isView(e))i=(o=e).byteLength;else if(e instanceof ArrayBuffer)i=(o=e).byteLength;else if(e instanceof FormData){var u=0,l=0;try{for(var c=(0,es.__values)(e.entries()),d=c.next();!d.done;d=c.next()){var f=(0,es.__read)(d.value,2),h=f[0],p=f[1];if(u+=h.length,"string"==typeof p)u+=new a().encode(p).length;else{if(!(p instanceof Blob))return;u+=p.size}if(++l>=t)return}}catch(e){r={error:e}}finally{try{d&&!d.done&&(n=c.return)&&n.call(c)}finally{if(r)throw r.error}}i=u}else if(e instanceof ReadableStream){o=e;return}return i}}var ip=function(){function e(e){this.response=e}return e.prototype.headers=function(e){var t;if(void 0===e&&(e=[]),this.response.headers instanceof Headers){var r=this.response.headers,n={};return null==(t=null==r?void 0:r.forEach)||t.call(r,function(e,t){n[t]=e}),iy(n,{allow:e})}},Object.defineProperty(e.prototype,"bodySize",{get:function(){if(void 0!==this._bodySize)return this._bodySize;var e,t,r=null==(t=null==(e=this.response.headers)?void 0:e.get)?void 0:t.call(e,"content-length"),n=r?parseInt(r,10):void 0;return this._bodySize=n,n},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this.response.status},enumerable:!1,configurable:!0}),e.prototype.text=function(){return(0,es.__awaiter)(this,void 0,void 0,function(){return(0,es.__generator)(this,function(e){switch(e.label){case 0:this.clonedResponse||(this.clonedResponse=this.response.clone()),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,Promise.race([this.clonedResponse.text(),new Promise(function(e){return setTimeout(function(){return e(null)},500)})])];case 2:return[2,e.sent()];case 3:return e.sent(),[2,null];case 4:return[2]}})})},e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),(0,es.__awaiter)(this,void 0,void 0,function(){return(0,es.__generator)(this,function(r){switch(r.label){case 0:if(0===e.length)return[2,null];return[4,this.text()];case 1:return[2,iv(r.sent(),e,t)]}})})},e}(),ig=function(){function e(e,t,r,n){this.statusCode=e,this.headersString=t,this.size=r,this.getJson=n}return Object.defineProperty(e.prototype,"bodySize",{get:function(){return this.size},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this.statusCode},enumerable:!1,configurable:!0}),e.prototype.headers=function(e){if(void 0===e&&(e=[]),!this.headersString)return{};var t,r,n={},i=this.headersString.split("\r\n");try{for(var o=(0,es.__values)(i),s=o.next();!s.done;s=o.next()){var a=s.value,u=(0,es.__read)(a.split(": "),2),l=u[0],c=u[1];l&&c&&(n[l]=c)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}return iy(n,{allow:e})},e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),(0,es.__awaiter)(this,void 0,void 0,function(){var r;return(0,es.__generator)(this,function(n){return 0===e.length?[2,null]:(r=this.getJson())?(ia(r,e,t),[2,r]):[2,null]})})},e}();function iv(e,t,r){if(!e)return null;try{var n=JSON.parse(e);return ia(n,t,r),n}catch(e){return null}}(h=W||(W={})).REDACT="redact",h.REMOVE="remove";var im="[REDACTED]",iy=function(e,t){var r,n,i=t.allow,o=void 0===i?[]:i,s=t.strategy,a=void 0===s?W.REMOVE:s,u=(0,es.__spreadArray)([],(0,es.__read)(eA),!1),l={};try{for(var c=(0,es.__values)(Object.keys(e)),d=c.next();!d.done;d=c.next()){var f=d.value;!function(t){var r=t.toLowerCase();u.find(function(e){return e.toLowerCase()===r})?a===W.REDACT&&(l[t]=im):o.find(function(e){return e.toLowerCase()===r})?l[t]=e[t]:a===W.REDACT&&(l[t]=im)}(f)}}catch(e){r={error:e}}finally{try{d&&!d.done&&(n=c.return)&&n.call(c)}finally{if(r)throw r.error}}return l},ib=function(){function e(e,t,r,n,i,o,s,a,u,l,c){void 0===s&&(s=0),this.type=e,this.method=t,this.timestamp=r,this.startTime=n,this.url=i,this.requestWrapper=o,this.status=s,this.duration=a,this.responseWrapper=u,this.error=l,this.endTime=c}return e.prototype.toSerializable=function(){var e,t,r,n;
2return Object.fromEntries(Object.entries({type:this.type,method:this.method,url:this.url,timestamp:this.timestamp,status:this.status,duration:this.duration,error:this.error,startTime:this.startTime,endTime:this.endTime,requestHeaders:null==(e=this.requestWrapper)?void 0:e.headers((0,es.__spreadArray)([],(0,es.__read)(eO),!1)),requestBodySize:null==(t=this.requestWrapper)?void 0:t.bodySize,responseHeaders:null==(r=this.responseWrapper)?void 0:r.headers((0,es.__spreadArray)([],(0,es.__read)(eO),!1)),responseBodySize:null==(n=this.responseWrapper)?void 0:n.bodySize}).filter(function(e){var t=(0,es.__read)(e,2);return void 0!==(t[0],t[1])}))},e}(),i_=function(e,t){void 0===t&&(t=ej()),this.callback=e,this.id=t};function iw(e){try{e()}catch(e){}}var iS=new(function(){function e(t){this.eventCallbacks=new Map,this.isObserving=!1,this.logger=t;var r=(0,eU.getGlobalScope)();e.isSupported()&&(this.globalScope=r)}return e.isSupported=function(){var e=(0,eU.getGlobalScope)();return!!e&&!!e.fetch},e.prototype.subscribe=function(e,t){var r,n,i,o,s,a,u,l,c,d;if(this.logger||(this.logger=t),this.eventCallbacks.set(e.id,e),!this.isObserving){var f=null==(i=null==(n=null==(r=this.globalScope)?void 0:r.XMLHttpRequest)?void 0:n.prototype)?void 0:i.open,h=null==(a=null==(s=null==(o=this.globalScope)?void 0:o.XMLHttpRequest)?void 0:s.prototype)?void 0:a.send,p=null==(c=null==(l=null==(u=this.globalScope)?void 0:u.XMLHttpRequest)?void 0:l.prototype)?void 0:c.setRequestHeader;f&&h&&p&&this.observeXhr(f,h,p);var g=null==(d=this.globalScope)?void 0:d.fetch;g&&this.observeFetch(g),this.isObserving=!0}},e.prototype.unsubscribe=function(e){this.eventCallbacks.delete(e.id)},e.prototype.triggerEventCallbacks=function(e){var t=this;this.eventCallbacks.forEach(function(r){try{r.callback(e)}catch(e){iw(function(){var r;null==(r=t.logger)||r.debug("an unexpected error occurred while triggering event callbacks",e)})}})},e.prototype.handleNetworkRequestEvent=function(e,t,r,n,i,o,s){if(void 0!==o&&void 0!==s){var a,u,l,c,d="GET";if("object"==typeof t&&null!==t&&"url"in t&&"method"in t?(u=t.url,d=t.method):u=null==(a=null==t?void 0:t.toString)?void 0:a.call(t),u)try{var f=new URL(u);u="".concat(f.protocol,"//").concat(f.host).concat(f.pathname).concat(f.search).concat(f.hash)}catch(e){}d=(null==r?void 0:r.method)||d,n&&(l=n.status),i&&(c={name:i.name||"UnknownError",message:i.message||"An unknown error occurred"},l=0);var h=Math.floor(performance.now()-s),p=Math.floor(o+h),g=new ib(e,d,o,o,u,r,l,h,n,c,p);this.triggerEventCallbacks(g)}},e.prototype.getTimestamps=function(){var e,t;return{startTime:null==(e=Date.now)?void 0:e.call(Date),durationStart:null==(t=null==performance?void 0:performance.now)?void 0:t.call(performance)}},e.prototype.observeFetch=function(e){var t=this;this.globalScope&&e&&(this.globalScope.fetch=function(r,n){return(0,es.__awaiter)(t,void 0,void 0,function(){var t,i,o,s=this;return(0,es.__generator)(this,function(a){switch(a.label){case 0:try{t=this.getTimestamps()}catch(e){iw(function(){var t;return null==(t=s.logger)?void 0:t.debug("an unexpected error occurred while retrieving timestamps",e)})}a.label=1;case 1:return a.trys.push([1,3,,4]),[4,e(r,n)];case 2:return i=a.sent(),[3,4];case 3:return o=a.sent(),[3,4];case 4:try{this.handleNetworkRequestEvent("fetch",r,n?new ic(n):void 0,i?new ip(i):void 0,o,null==t?void 0:t.startTime,null==t?void 0:t.durationStart)}catch(e){iw(function(){var t;return null==(t=s.logger)?void 0:t.debug("an unexpected error occurred while handling fetch",e)})}if(i)return[2,i];throw o}})})})},e.createXhrJsonParser=function(e,t){return function(){var r;try{if("json"===e.responseType){if(null==(r=t.globalScope)?void 0:r.structuredClone)return t.globalScope.structuredClone(e.response)}else if(["text",""].includes(e.responseType))return JSON.parse(e.responseText)}catch(r){r instanceof Error&&"InvalidStateError"===r.name&&iw(function(){var r;return null==(r=t.logger)?void 0:r.debug("unexpected error when retrieving responseText. responseType='".concat(e.responseType,"'"))})}return null}},e.prototype.observeXhr=function(t,r,n){if(this.globalScope&&t&&r){var i=this.globalScope.XMLHttpRequest.prototype,o=this;i.open=function(){for(var e,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i=(0,es.__read)(r,2),s=i[0],a=i[1];try{this.$$AmplitudeAnalyticsEvent=(0,es.__assign)({method:s,url:null==(e=null==a?void 0:a.toString)?void 0:e.call(a),headers:{}},o.getTimestamps())}catch(e){iw(function(){var t;return null==(t=o.logger)?void 0:t.debug("an unexpected error occurred while calling xhr open",e)})}return t.apply(this,r)},i.send=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var i=this,s=e.createXhrJsonParser(this,o),a=t[0],u=i.$$AmplitudeAnalyticsEvent;return i.$$AmplitudeAnalyticsEvent&&i.addEventListener("loadend",function(){try{var e=i.getAllResponseHeaders(),t=i.getResponseHeader("content-length"),r=new ig(i.status,e,t?parseInt(t,10):void 0,s),n=i.$$AmplitudeAnalyticsEvent.headers,l=new id(a,n);u.status=i.status,o.handleNetworkRequestEvent("xhr",{url:u.url,method:u.method},l,r,void 0,u.startTime,u.durationStart)}catch(e){iw(function(){var t;return null==(t=o.logger)?void 0:t.debug("an unexpected error occurred while handling xhr send",e)})}}),r.apply(i,t)},i.setRequestHeader=function(e,t){try{var r=this.$$AmplitudeAnalyticsEvent;r&&(r.headers[e]=t)}catch(e){iw(function(){var t;return null==(t=o.logger)?void 0:t.debug("an unexpected error occurred while calling xhr setRequestHeader",e)})}n.apply(this,[e,t])}}},e}()),iE="[Amplitude] Network Request",nC=nn,ik="500-599";function iI(e,t){return RegExp("^"+t.replace(/[-[\]{}()+?.,\\^$|#\s]/g,"\\$&").replace(/\*/g,".*")+"$").test(e)}function ix(e,t){var r,n,i=t.split(",");try{for(var o=(0,es.__values)(i),s=o.next();!s.done;s=o.next()){var a=s.value,u=(0,es.__read)(a.split("-").map(Number),2),l=u[0],c=u[1];if(e===l&&void 0===c||e>=l&&e<=c)return!0}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return!1}function iT(e){var t;if(e)try{var r=null==(t=(0,eU.getGlobalScope)())?void 0:t.location.href,n=new URL(e,r),i=n.searchParams.toString(),o=n.hash.replace("#",""),s=n.href,a=n.host;n.hash="",n.search="";var u=n.href;return{query:i,fragment:o,href:s,hrefWithoutQueryOrHash:u,host:a}}catch(e){return}}function iC(e){return"object"!=typeof e||null===e?e?(0,es.__spreadArray)([],(0,es.__read)(eO),!1):void 0:0!==e.length?e:void 0}function iP(e){var t,r;return!(null==(t=null==e?void 0:e.allowlist)?void 0:t.length)&&!(null==(r=null==e?void 0:e.blocklist)?void 0:r.length)}(z||(z={})).NetworkObservable="networkObservable";var iO=function(e){void 0===e&&(e={});var t,r="@amplitude/plugin-network-capture-browser",n=function(){var e,r=new nC.default(function(e){var r=new i_(function(t){var r={event:t,timestamp:Date.now(),type:"network"};e.next(r)});return iS.subscribe(r,t),function(){iS.unsubscribe(r)}});return(e={})[z.NetworkObservable]=r,e};return{name:r,type:"enrichment",setup:function(i,o){return(0,es.__awaiter)(void 0,void 0,void 0,function(){var s;return(0,es.__generator)(this,function(a){var u,l,c,d,f;return"u"<typeof document?[2]:(s=n(),t=null==i?void 0:i.loggerProvider,l=(u={allObservables:s,networkTrackingOptions:e,amplitude:o,loggerProvider:t}).allObservables,c=u.networkTrackingOptions,d=u.amplitude,f=u.loggerProvider,H=l.networkObservable.filter(function(e){return function(e,t){void 0===t&&(t={});var r,n,i=iT(e.url);if(!i)return!1;var o=i.host;return!(!1!==t.ignoreAmplitudeRequests&&(iI(o,"*.amplitude.com")||iI(o,"amplitude.com"))||(null==(r=t.ignoreHosts)?void 0:r.find(function(e){return iI(o,e)})))&&(!!t.captureRules||void 0===e.status||!!ix(e.status,ik))&&(!t.captureRules||((0,es.__spreadArray)([],(0,es.__read)(t.captureRules),!1).reverse().find(function(t){if(n=function(e,t,r,n,i){if((!e.hosts||e.hosts.find(function(e){return iI(t,e)}))&&(!n||!e.urls||nv(n,e.urls))&&(!i||!e.methods||e.methods.find(function(e){return i.toLowerCase()===e.toLowerCase()||"*"===e})))return(!r&&0!==r||!!ix(r,e.statusCodeRange||ik))&&!0}(t,o,e.status,e.url,e.method)){var r=iC(t.responseHeaders);if(e.responseWrapper&&r){var i=e.responseWrapper.headers(r);i&&(e.responseHeaders=i)}var s=iC(t.requestHeaders);if(e.requestWrapper&&s){var a=e.requestWrapper.headers(s);a&&(e.requestHeaders=a)}e.responseWrapper&&t.responseBody&&!iP(t.responseBody)&&(e.responseBodyJson=e.responseWrapper.json(t.responseBody.allowlist,t.responseBody.blocklist)),e.requestWrapper&&t.requestBody&&!iP(t.requestBody)&&(e.requestBodyJson=e.requestWrapper.json(t.requestBody.allowlist,t.requestBody.blocklist))}return void 0!==n}),!!n))&&!(e.requestWrapper&&function(e,t){if(e.includes("amplitude.com"))try{var r=t.body;if("string"!=typeof r)return!1;if(JSON.parse(r).events.find(function(e){return e.event_type===iE}))return!0}catch(e){}return!1}(o,e.requestWrapper))}(e.event,c)}).subscribe(function(e){var t,r,n,i=e.event,o=iT(i.url);if(o){var s=null==(r=i.responseWrapper)?void 0:r.bodySize,a=null==(n=i.requestWrapper)?void 0:n.bodySize;!function(e,t,r,n){(0,es.__awaiter)(this,void 0,void 0,function(){var i,o,s;return(0,es.__generator)(this,function(a){switch(a.label){case 0:if(!(t.requestBodyJson||t.responseBodyJson))return[3,2];return[4,Promise.all([t.requestBodyJson,t.responseBodyJson])];case 1:if(o=(i=es.__read.apply(void 0,[a.sent(),2]))[0],s=i[1],o)try{e["[Amplitude] Request Body"]=JSON.stringify(o)}catch(e){null==n||n.debug("Failed to stringify request body",e)}if(s)try{e["[Amplitude] Response Body"]=JSON.stringify(s)}catch(e){null==n||n.debug("Failed to stringify response body")}a.label=2;case 2:return null==r||r.track(iE,e),[2]}})})}(((t={})["[Amplitude] URL"]=o.hrefWithoutQueryOrHash,t["[Amplitude] URL Query"]=o.query,t["[Amplitude] URL Fragment"]=o.fragment,t["[Amplitude] Request Method"]=i.method,t["[Amplitude] Status Code"]=i.status,t["[Amplitude] Start Time"]=i.startTime,t["[Amplitude] Completion Time"]=i.endTime,t["[Amplitude] Duration"]=i.duration,t["[Amplitude] Request Body Size"]=a,t["[Amplitude] Response Body Size"]=s,t["[Amplitude] Request Type"]=i.type,t["[Amplitude] Request Headers"]=i.requestHeaders,t["[Amplitude] Response Headers"]=i.responseHeaders,t),i,d,f)}}),null==t||t.log("".concat(r," has been successfully added.")),[2])})})},execute:function(e){return(0,es.__awaiter)(void 0,void 0,void 0,function(){return(0,es.__generator)(this,function(t){return[2,e]})})},teardown:function(){return(0,es.__awaiter)(void 0,void 0,void 0,function(){return(0,es.__generator)(this,function(e){return H.unsubscribe(),[2]})})}}};let iA=-1,iR=e=>{addEventListener("pageshow",t=>{t.persisted&&(iA=t.timeStamp,e(t))},!0)},iM=(e,t,r,n)=>{let i,o;return s=>{let a;t.value>=0&&(s||n)&&((o=t.value-(i??0))||void 0===i)&&(i=t.value,t.delta=o,a=t.value,t.rating=a>r[1]?"poor":a>r[0]?"needs-improvement":"good",e(t))}},iN=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},iD=()=>{let e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},iL=()=>{let e=iD();return e?.activationStart??0},iU=(e,t=-1)=>{let r=iD(),n="navigate";return iA>=0?n="back-forward-cache":r&&(document.prerendering||iL()>0?n="prerender":document.wasDiscarded?n="restore":r.type&&(n=r.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v5-${Date.now()}-${Math.floor(0x82f79cd8fff*Math.random())+1e12}`,navigationType:n}},iq=new WeakMap;function ij(e,t){return iq.get(e)||iq.set(e,new t),iq.get(e)}class iF{t;i=0;o=[];h(e){if(e.hadRecentInput)return;let t=this.o[0],r=this.o.at(-1);this.i&&t&&r&&e.startTime-r.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}}let iB=(e,t,r={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(e)){let n=new PerformanceObserver(e=>{Promise.resolve().then(()=>{t(e.getEntries())})});return n.observe({type:e,buffered:!0,...r}),n}}catch{}},iV=e=>{let t=!1;return()=>{t||(e(),t=!0)}},iK=-1,iW=new Set,iz=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,iH=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(let e of iW)e();isFinite(iK)||(iK="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",iH,!0))}},iG=()=>{if(iK<0){let e=iL();iK=(document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").filter(t=>"hidden"===t.name&&t.startTime>e)[0]?.startTime)??iz(),addEventListener("visibilitychange",iH,!0),addEventListener("prerenderingchange",iH,!0),iR(()=>{setTimeout(()=>{iK=iz()})})}return{get firstHiddenTime(){return iK},onHidden(e){iW.add(e)}}},iJ=e=>{document.prerendering?addEventListener("prerenderingchange",()=>e(),!0):e()},i$=[1800,3e3],iX=(e,t={})=>{iJ(()=>{let r=iG(),n,i=iU("FCP"),o=iB("paint",e=>{for(let t of e)"first-contentful-paint"===t.name&&(o.disconnect(),t.startTime<r.firstHiddenTime&&(i.value=Math.max(t.startTime-iL(),0),i.entries.push(t),n(!0)))});o&&(n=iM(e,i,i$,t.reportAllChanges),iR(r=>{n=iM(e,i=iU("FCP"),i$,t.reportAllChanges),iN(()=>{i.value=performance.now()-r.timeStamp,n(!0)})}))})},iY=[.1,.25],iQ=0,iZ=1/0,i0=0,i1=e=>{for(let t of e)t.interactionId&&(iZ=Math.min(iZ,t.interactionId),iQ=(i0=Math.max(i0,t.interactionId))?(i0-iZ)/7+1:0)},i2=()=>t?iQ:performance.interactionCount??0,i3=0;class i4{u=[];l=new Map;m;p;v(){i3=i2(),this.u.length=0,this.l.clear()}L(){let e=Math.min(this.u.length-1,Math.floor((i2()-i3)/50));return this.u[e]}h(e){if(this.m?.(e),!e.interactionId&&"first-input"!==e.entryType)return;let t=this.u.at(-1),r=this.l.get(e.interactionId);if(r||this.u.length<10||e.duration>t.P){if(r?e.duration>r.P?(r.entries=[e],r.P=e.duration):e.duration===r.P&&e.startTime===r.entries[0].startTime&&r.entries.push(e):(r={id:e.interactionId,entries:[e],P:e.duration},this.l.set(r.id,r),this.u.push(r)),this.u.sort((e,t)=>
2t.P-e.P),this.u.length>10)for(let e of this.u.splice(10))this.l.delete(e.id);this.p?.(r)}}}let i5=e=>{let t=globalThis.requestIdleCallback||setTimeout;"hidden"===document.visibilityState?e():(addEventListener("visibilitychange",e=iV(e),{once:!0,capture:!0}),t(()=>{e(),removeEventListener("visibilitychange",e,{capture:!0})}))},i6=[200,500];class i8{m;h(e){this.m?.(e)}}let i7=[2500,4e3],i9=[800,1800],oe=e=>{document.prerendering?iJ(()=>oe(e)):"complete"!==document.readyState?addEventListener("load",()=>oe(e),!0):setTimeout(e)};function ot(e){var t,r;return{value:e.value,rating:e.rating,delta:e.delta,navigationType:e.navigationType,id:e.id,timestamp:Math.floor((r=(null==(t=e.entries[0])?void 0:t.startTime)||0,performance.timeOrigin+r)),navigationStart:Math.floor(performance.timeOrigin)}}var or=function(){var e=null,r=(0,eU.getGlobalScope)(),n=null==r?void 0:r.document,i=null==r?void 0:r.location;return{name:"web-vitals-browser",type:"enrichment",setup:function(r,o){return(0,es.__awaiter)(void 0,void 0,void 0,function(){var s,a;return(0,es.__generator)(this,function(u){return void 0===n||(s=nm((null==i?void 0:i.href)||"",r.loggerProvider),a={"[Amplitude] Page Domain":(null==i?void 0:i.hostname)||"","[Amplitude] Page Location":s,"[Amplitude] Page Path":nm((null==i?void 0:i.pathname)||"",r.loggerProvider),"[Amplitude] Page Title":"u">typeof document&&document.title||"","[Amplitude] Page URL":nm(s.split("?")[0],r.loggerProvider)},((e,t={})=>{iJ(()=>{let r=iG(),n,i=iU("LCP"),o=ij(t,i8),s=e=>{for(let s of(t.reportAllChanges||(e=e.slice(-1)),e))o.h(s),s.startTime<r.firstHiddenTime&&(i.value=Math.max(s.startTime-iL(),0),i.entries=[s],n())},a=iB("largest-contentful-paint",s);if(a){n=iM(e,i,i7,t.reportAllChanges);let r=iV(()=>{s(a.takeRecords()),a.disconnect(),n(!0)}),o=e=>{e.isTrusted&&(i5(r),removeEventListener(e.type,o,{capture:!0}))};for(let e of["keydown","click","visibilitychange"])addEventListener(e,o,{capture:!0});iR(r=>{n=iM(e,i=iU("LCP"),i7,t.reportAllChanges),iN(()=>{i.value=performance.now()-r.timeStamp,n(!0)})})}})})(function(e){a["[Amplitude] LCP"]=ot(e)}),iX(function(e){a["[Amplitude] FCP"]=ot(e)}),((e,r={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;let n=iG();iJ(()=>{"interactionCount"in performance||t||(t=iB("event",i1,{type:"event",buffered:!0,durationThreshold:0}));let i,o=iU("INP"),s=ij(r,i4),a=e=>{i5(()=>{for(let t of e)s.h(t);let t=s.L();t&&t.P!==o.value&&(o.value=t.P,o.entries=t.entries,i())})},u=iB("event",a,{durationThreshold:r.durationThreshold??40});i=iM(e,o,i6,r.reportAllChanges),u&&(u.observe({type:"first-input",buffered:!0}),n.onHidden(()=>{a(u.takeRecords()),i(!0)}),iR(()=>{s.v(),i=iM(e,o=iU("INP"),i6,r.reportAllChanges)}))})})(function(e){a["[Amplitude] INP"]=ot(e)}),((e,t={})=>{let r=iG();iX(iV(()=>{let n,i=iU("CLS",0),o=ij(t,iF),s=e=>{for(let t of e)o.h(t);o.i>i.value&&(i.value=o.i,i.entries=o.o,n())},a=iB("layout-shift",s);a&&(n=iM(e,i,iY,t.reportAllChanges),r.onHidden(()=>{s(a.takeRecords()),n(!0)}),iR(()=>{o.i=0,n=iM(e,i=iU("CLS",0),iY,t.reportAllChanges),iN(()=>n())}),setTimeout(n))}))})(function(e){a["[Amplitude] CLS"]=ot(e)}),((e,t={})=>{let r=iU("TTFB"),n=iM(e,r,i9,t.reportAllChanges);oe(()=>{let i=iD();i&&(r.value=Math.max(i.responseStart-iL(),0),r.entries=[i],n(!0),iR(()=>{(n=iM(e,r=iU("TTFB",0),i9,t.reportAllChanges))(!0)}))})})(function(e){a["[Amplitude] TTFB"]=ot(e)}),e=function(){"hidden"===n.visibilityState&&e&&(o.track("[Amplitude] Web Vitals",a),n.removeEventListener("visibilitychange",e),e=null)},n.addEventListener("visibilitychange",e)),[2]})})},execute:function(e){return(0,es.__awaiter)(void 0,void 0,void 0,function(){return(0,es.__generator)(this,function(t){return[2,e]})})},teardown:function(){return(0,es.__awaiter)(void 0,void 0,void 0,function(){return(0,es.__generator)(this,function(t){return e&&(null==n||n.removeEventListener("visibilitychange",e)),[2]})})}}},on=function(e,t,r){return void 0===t&&(t=""),void 0===r&&(r=10),["AMP",t,e.substring(0,r)].filter(Boolean).join("_")},oi=function(){function e(e,t){var r;this.shouldTrackNewCampaign=!1,this.options=(0,es.__assign)({initialEmptyValue:"EMPTY",resetSessionOnNewCampaign:!1,excludeReferrers:rk((null==(r=t.cookieOptions)?void 0:r.domain)||t.topLevelDomain),optOut:t.optOut},e),this.storage=t.cookieStorage,this.storageKey=on(t.apiKey,"MKTG"),this.webExpStorageKey=on(t.apiKey,"MKTG_ORIGINAL"),this.currentCampaign=eP,this.sessionTimeout=t.sessionTimeout,this.lastEventTime=t.lastEventTime,this.logger=t.loggerProvider,this.topLevelDomain=t.topLevelDomain,t.loggerProvider.log("Installing web attribution tracking.")}return e.prototype.init=function(){return(0,es.__awaiter)(this,void 0,void 0,function(){var e,t;return(0,es.__generator)(this,function(r){switch(r.label){case 0:if(this.options.optOut)return[2];return[4,this.fetchCampaign()];case 1:if(t=es.__read.apply(void 0,[r.sent(),2]),this.currentCampaign=t[0],this.previousCampaign=t[1],e=!this.lastEventTime||ta(this.sessionTimeout,this.lastEventTime),!rw(this.currentCampaign,this.previousCampaign,this.options,this.logger,e,this.topLevelDomain))return[3,3];return this.shouldTrackNewCampaign=!0,[4,this.storage.set(this.storageKey,this.currentCampaign)];case 2:r.sent(),r.label=3;case 3:return[2]}})})},e.prototype.fetchCampaign=function(){return(0,es.__awaiter)(this,void 0,void 0,function(){var e;return(0,es.__generator)(this,function(t){switch(t.label){case 0:return[4,this.storage.get(this.webExpStorageKey)];case 1:if(!(e=t.sent()))return[3,3];return[4,this.storage.remove(this.webExpStorageKey)];case 2:t.sent(),t.label=3;case 3:return[4,Promise.all([e||new rB().parse(),this.storage.get(this.storageKey)])];case 4:return[2,t.sent()]}})})},e.prototype.generateCampaignEvent=function(e){this.shouldTrackNewCampaign=!1;var t,r,n=(t=this.currentCampaign,r=this.options,eB(Object.entries((0,es.__assign)((0,es.__assign)({},eP),t)).reduce(function(e,t){var n,i=(0,es.__read)(t,2),o=i[0],s=i[1];return(e.setOnce("initial_".concat(o),null!=(n=null!=s?s:r.initialEmptyValue)?n:"EMPTY"),s)?e.set(o,s):e.unset(o)},new eN)));return e&&(n.event_id=e),n},e.prototype.shouldSetSessionIdOnNewCampaign=function(){return this.shouldTrackNewCampaign&&!!this.options.resetSessionOnNewCampaign},e}(),oo=new Set([D.IDENTIFY,D.GROUP_IDENTIFY]),os=function(e){void 0===e&&(e={});var t,r,n,i,o,s,a,u=null!=(t=e.fallbackAttributionEvent)&&t,l=(0,eU.getGlobalScope)(),c={},d=!1,f=!1,h=function(){return(0,es.__awaiter)(void 0,void 0,void 0,function(){return(0,es.__generator)(this,function(e){switch(e.label){case 0:return[4,new rB().parse()];case 1:return c=rV(e.sent()),u&&(null==n||n.log("Tracking attribution fallback event."),null==r||r.track("[Amplitude] Attribution",c)),[2]}})})},p=function(){h()},g=function(e){return new Proxy(e,{apply:function(e,t,r){Reflect.apply(e,t,r),d&&p()}})};return{name:"@amplitude/plugin-event-property-attribution-browser",type:"enrichment",setup:function(e,t){return(0,es.__awaiter)(void 0,void 0,void 0,function(){return(0,es.__generator)(this,function(u){switch(u.label){case 0:return r=t,n=e.loggerProvider,d=!0,n.log("Installing event property attribution tracking."),[4,h()];case 1:if(u.sent(),!l)return[2];if(l.addEventListener("popstate",p),!f){if(i=Reflect.get(l.history,"pushState"),o=Reflect.get(l.history,"replaceState"),!i||!o)return[2];s=g(i),l.history.pushState=s,a=g(o),l.history.replaceState=a,f=!0}return[2]}})})},execute:function(e){return(0,es.__awaiter)(void 0,void 0,void 0,function(){return(0,es.__generator)(this,function(t){return oo.has(e.event_type)||(e.event_properties=(0,es.__assign)((0,es.__assign)({},c),e.event_properties)),[2,e]})})},teardown:function(){return(0,es.__awaiter)(void 0,void 0,void 0,function(){var e,t;return(0,es.__generator)(this,function(r){return l&&(l.removeEventListener("popstate",p),e=Reflect.get(l.history,"pushState"),t=Reflect.get(l.history,"replaceState"),f&&e===s&&i&&(l.history.pushState=i),f&&t===a&&o&&(l.history.replaceState=o)),d=!1,f=!1,i=void 0,o=void 0,s=void 0,a=void 0,c={},[2]})})}}},oa="AMP_CURRENT_PAGE",ou="AMP_PREVIOUS_PAGE",ol="AMP_URL_INFO";(p=G||(G={})).Direct="direct",p.Internal="internal",p.External="external";var oc=new Set([D.IDENTIFY,D.GROUP_IDENTIFY,D.REVENUE]),od=function(e){var t=(void 0===e?{}:e).internalDomains,r=void 0===t?[]:t,n=(0,eU.getGlobalScope)(),i=void 0,o=!1,s=void 0,a=!1,u=!1,l=function(e){var t;try{var r=nm(e,s);
2t=new URL(r).hostname}catch(e){null==s||s.error("Could not parse URL: ",e)}return t},c=function(e){var t="u">typeof location&&location.hostname||"",n=e?l(e):void 0;if(!n)return G.Direct;var i=r.some(function(e){return -1!==t.indexOf(e)}),o=r.some(function(e){return -1!==n.indexOf(e)});return t===n||o&&i?G.Internal:G.External},d=function(){(0,es.__awaiter)(void 0,void 0,void 0,function(){var e,t,r,n,s;return(0,es.__generator)(this,function(a){switch(a.label){case 0:if(!(i&&o))return[3,3];return[4,i.get(ol)];case 1:return e=a.sent(),t=nm("u">typeof location&&location.href||""),r=(null==e?void 0:e[oa])||"",n=void 0,n=t===r?(null==e?void 0:e[ou])||"":r||document.referrer||"",[4,i.set(ol,((s={})[oa]=t,s[ou]=n,s))];case 2:a.sent(),a.label=3;case 3:return[2]}})})};return{name:"@amplitude/plugin-page-url-enrichment-browser",type:"enrichment",setup:function(e,t){return(0,es.__awaiter)(void 0,void 0,void 0,function(){var t;return(0,es.__generator)(this,function(r){switch(r.label){case 0:if((s=e.loggerProvider).log("Installing @amplitude/plugin-page-url-enrichment-browser"),u=!0,!n)return[3,2];try{i=new t3(n.sessionStorage)}catch(e){null==s||s.debug("sessionStorage is not available in this environment.")}return[4,null==i?void 0:i.isEnabled()];case 1:o=null!=(t=r.sent())&&t,n.addEventListener("popstate",d),a||(n.history.pushState=new Proxy(n.history.pushState,{apply:function(e,t,r){var n=(0,es.__read)(r,3),i=n[0],o=n[1],s=n[2];e.apply(t,[i,o,s]),u&&d()}}),n.history.replaceState=new Proxy(n.history.replaceState,{apply:function(e,t,r){var n=(0,es.__read)(r,3),i=n[0],o=n[1],s=n[2];e.apply(t,[i,o,s]),u&&d()}}),a=!0),r.label=2;case 2:return[2]}})})},execute:function(e){return(0,es.__awaiter)(void 0,void 0,void 0,function(){var t,r,n,s,a;return(0,es.__generator)(this,function(u){switch(u.label){case 0:if(t=nm("u">typeof location&&location.href||""),!(i&&o))return[3,5];return[4,i.get(ol)];case 1:if(null==(r=u.sent())?void 0:r[oa])return[3,3];return[4,i.set(ol,((a={})[oa]=t,a[ou]=document.referrer||"",a))];case 2:u.sent(),u.label=3;case 3:return[4,i.get(ol)];case 4:if(n=u.sent(),s="",n&&(s=n[ou]||""),oc.has(e.event_type))return[2,e];e.event_properties=(0,es.__assign)((0,es.__assign)({},e.event_properties||{}),{"[Amplitude] Page Domain":of(e,"[Amplitude] Page Domain","u">typeof location&&location.hostname||""),"[Amplitude] Page Location":of(e,"[Amplitude] Page Location",t),"[Amplitude] Page Path":of(e,"[Amplitude] Page Path","u">typeof location&&nm(location.pathname)||""),"[Amplitude] Page Title":of(e,"[Amplitude] Page Title",rF(rj)),"[Amplitude] Page URL":of(e,"[Amplitude] Page URL",t.split("?")[0]),"[Amplitude] Previous Page Location":s,"[Amplitude] Previous Page Type":c(s)}),u.label=5;case 5:return[2,e]}})})},teardown:function(){return(0,es.__awaiter)(void 0,void 0,void 0,function(){return(0,es.__generator)(this,function(e){switch(e.label){case 0:if(n&&(n.removeEventListener("popstate",d),u=!1),!(i&&o))return[3,2];return[4,i.set(ol,{})];case 1:e.sent(),e.label=2;case 2:return[2]}})})}}};function of(e,t,r){return(e.event_properties||(e.event_properties={}),void 0===e.event_properties[t])?r:e.event_properties[t]}var oh=function(){var e,t,r;function n(t){if(t)try{var r=Function("return "+t)();if("function"==typeof r)return r;null==e||e.error("Custom enrichment body did not evaluate to a function")}catch(t){null==e||e.error("Could not create custom enrichment function",t)}return function(e){return e}}return{name:"@amplitude/plugin-custom-enrichment-browser",type:"enrichment",setup:function(i,o){return(0,es.__awaiter)(void 0,void 0,void 0,function(){var o,s;return(0,es.__generator)(this,function(a){return null==(e=i.loggerProvider)||e.log("Installing @amplitude/plugin-custom-enrichment-browser"),(null==(s=i.remoteConfig)?void 0:s.fetchRemoteConfig)&&(i.remoteConfigClient?(o=i.remoteConfigClient.subscribe("configs.analyticsSDK.browserSDK.customEnrichment","all",function(e){r=e&&"object"==typeof e&&null!==e&&"body"in e&&"string"==typeof e.body?n(e.body||""):n("")}),t=function(){var e;return null==(e=i.remoteConfigClient)?void 0:e.unsubscribe(o)}):null==e||e.debug("Remote config client is not provided, skipping remote config fetch")),[2]})})},execute:function(t){return(0,es.__awaiter)(void 0,void 0,void 0,function(){var n;return(0,es.__generator)(this,function(i){if(r)try{return[2,null!=(n=r(t))?n:null]}catch(t){null==e||e.error("Could not execute custom enrichment function",t)}return[2,t]})})},teardown:function(){return(0,es.__awaiter)(void 0,void 0,void 0,function(){return(0,es.__generator)(this,function(e){return t&&t(),[2]})})}}},op="userProperty",og="eventProperty",ov=function(e){return e===op||e===og}
2,om=function(e){var t=(0,es.__spreadArray)([],(0,es.__read)(new Set((Array.isArray(e)?e:[e]).filter(ov))),!1);return t.length>0?t:[op]},oy=function(e,t){return om(e.trackingMethod).includes(t)},ob=function(e){return oy(e,op)};let o_={init:ed((g=new(function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._diagnosticsSampleRate=0,t._enableRequestBodyCompressionExperimentalValue=!1,t}return(0,es.__extends)(t,e),t.prototype.init=function(e,t,r){var n,i;return void 0===e&&(e=""),arguments.length>2?(n=t,i=r):"string"==typeof t?(n=t,i=void 0):(n=null==t?void 0:t.userId,i=t),eW(this._init((0,es.__assign)((0,es.__assign)({},i),{userId:n,apiKey:e})))},t.prototype._init=function(t){var r,n,i,o,s,a,u,l;return(0,es.__awaiter)(this,void 0,void 0,function(){var c,d,f,h,p,g,v,m,y,b,_,w,S,E,k=this;return(0,es.__generator)(this,function(I){var x,T,C,P,O,A,R,N;switch(I.label){case 0:if(this.initializing)return[2];if(this.initializing=!0,c=rR(t),d=null!=(r=t.loggerProvider)?r:new eJ,t.loggerProvider||d.enable(null!=(n=t.logLevel)?n:M.Warn),f=null!=(i=t.serverZone)?i:"US",p=this._diagnosticsSampleRate,g=null==(o=t.enableDiagnostics)||o,!c)return[3,2];return h=new tf(t.apiKey,d,f,null==(s=t.remoteConfig)?void 0:s.serverUrl),[4,new Promise(function(e){null==h||h.subscribe("configs.diagnostics.browserSDK","all",function(t,r,n){if(d.debug("Diagnostics remote configuration received:",JSON.stringify({remoteConfig:t,source:r,lastFetch:n},null,2)),t){var i=t.sampleRate;"number"!=typeof i||isNaN(i)||(p=i);var o=t.enabled;"boolean"==typeof o&&(g=o)}e()})})];case 1:I.sent(),I.label=2;case 2:return(v=new tT(t.apiKey,d,f,{enabled:g,sampleRate:p})).setTag("library","".concat(tG,"/").concat(tH)),"u">typeof navigator&&v.setTag("user_agent",navigator.userAgent),[4,(x=t.apiKey,T=t,C=this,P=v,O={loggerProvider:d,serverZone:f,enableDiagnostics:g,diagnosticsSampleRate:p},void 0===T&&(T={}),(0,es.__awaiter)(void 0,void 0,void 0,function(){var e,t,r,n,i,o,s,a,u,l,c,d,f,h,p,g,v,m,y,b,_,w,S,E,k,I,A,R,M,N,D,L,U,q,j,F,B,V,K,W,z,H,G,J,$,X,Y,Q,Z,ee,et;return(0,es.__generator)(this,function(er){var en,ei,eo,ea;switch(er.label){case 0:if(e=T.identityStorage||ry,t="",!(e===ry&&!(null==(w=T.cookieOptions)?void 0:w.domain)&&(null==(S=T.cookieOptions)?void 0:S.domain)!==""))return[3,2];return[4,(en=void 0,ei=P,(0,es.__awaiter)(void 0,void 0,void 0,function(){var e,t,r,n,i,o,s;return(0,es.__generator)(this,function(a){switch(a.label){case 0:return[4,new tY(void 0,{diagnosticsClient:ei}).isEnabled()];case 1:if(!a.sent()||!en&&("u"<typeof location||!location.hostname)||1===(t=(e=null!=en?en:location.hostname).split(".")).length)return[2,""];for(r=[],n=1,rT.find(function(t){return e.endsWith(".".concat(t))})&&(n=2),i=t.length-n-1;i>=0;--i)r.push(t.slice(i).join("."));i=0,a.label=2;case 2:if(!(i<r.length))return[3,7];o=r[i],a.label=3;case 3:return a.trys.push([3,5,,6]),[4,tY.isDomainWritable(o)];case 4:if(a.sent())return[2,"."+o];return[3,6];case 5:return s=a.sent(),ei&&ei.recordEvent("cookies.tld.failure",{reason:"Unexpected exception checking domain is writable: ".concat(o),error:s instanceof Error?s.message:String(s)}),[3,6];case 6:return i++,[3,2];case 7:return ei&&ei.recordEvent("cookies.tld.failure",{reason:"Could not determine TLD for host ".concat(e)}),[2,""]}})}))];case 1:t=er.sent(),er.label=2;case 2:return r=(0,es.__assign)({domain:null!=(k=null==(E=T.cookieOptions)?void 0:E.domain)?k:t,expiration:365,sameSite:"Lax",secure:!1,upgrade:!0},T.cookieOptions),n={duplicateResolverFn:function(e){var t=t0(e);return!!t&&t1(JSON.parse(t).cookieDomain,r.domain)},diagnosticsClient:P},[4,(eo=i=rA(T.identityStorage,r,n),void 0===(ea=null==(A=null==(I=T.cookieOptions)?void 0:I.upgrade)||A)&&(ea=!0),(0,es.__awaiter)(void 0,void 0,void 0,function(){var e,t,r,n,i,o,s,a,u;return(0,es.__generator)(this,function(l){switch(l.label){case 0:return e="".concat("amp","_").concat(x.substring(0,6)),[4,eo.getRaw(e)];case 1:if(!(t=l.sent()))return[2,{optOut:!1}];if(!ea)return[3,3];return[4,eo.remove(e)];case 2:l.sent(),l.label=3;
2case 3:return n=(r=(0,es.__read)(t.split("."),6))[0],i=r[1],o=r[2],s=r[3],a=r[4],u=r[5],[2,{deviceId:n,userId:rn(i),sessionId:rr(s),lastEventId:rr(u),lastEventTime:rr(a),optOut:!!o}]}})}))];case 3:return o=er.sent(),[4,i.get(t2(x))];case 4:return s=er.sent(),l=!(u=(a=tl()).ampTimestamp?Number(a.ampTimestamp):void 0)||Date.now()<u,c=null!=(L=null!=(D=null!=(N=null!=(R=T.deviceId)?R:l?null!=(M=a.ampDeviceId)?M:a.deviceId:void 0)?N:null==s?void 0:s.deviceId)?D:o.deviceId)?L:ej(),d=null!=(U=null==s?void 0:s.lastEventId)?U:o.lastEventId,f=null!=(q=null==s?void 0:s.lastEventTime)?q:o.lastEventTime,h=null!=(F=null!=(j=T.optOut)?j:null==s?void 0:s.optOut)?F:o.optOut,p=null!=(B=null==s?void 0:s.sessionId)?B:o.sessionId,g=null==s?void 0:s.deferredSessionId,v=null!=(K=null!=(V=T.userId)?V:null==s?void 0:s.userId)?K:o.userId,C.previousSessionDeviceId=null!=(W=null==s?void 0:s.deviceId)?W:o.deviceId,C.previousSessionUserId=null!=(z=null==s?void 0:s.userId)?z:o.userId,m={ipAddress:null==(G=null==(H=T.trackingOptions)?void 0:H.ipAddress)||G,language:null==($=null==(J=T.trackingOptions)?void 0:J.language)||$,platform:null==(Y=null==(X=T.trackingOptions)?void 0:X.platform)||Y},y=null==s?void 0:s.pageCounter,b=null==s?void 0:s.debugLogsEnabled,void 0!==T.autocapture&&(T.defaultTracking=T.autocapture),[4,(_=new rO(x,T.appVersion,i,r,T.defaultTracking,T.autocapture,c,T.flushIntervalMillis,T.flushMaxRetries,T.flushQueueSize,e,T.ingestionMetadata,T.instanceName,d,f,null!=(Q=null==O?void 0:O.loggerProvider)?Q:T.loggerProvider,T.logLevel,T.minIdLength,T.offline,h,T.partnerId,T.plan,T.serverUrl,null!=(Z=null==O?void 0:O.serverZone)?Z:T.serverZone,p,g,T.sessionTimeout,T.storageProvider,m,T.transport,T.useBatch,T.fetchRemoteConfig,v,y,b,T.networkTrackingOptions,T.identify,null!=(ee=null==O?void 0:O.enableDiagnostics)?ee:T.enableDiagnostics,null!=(et=null==O?void 0:O.diagnosticsSampleRate)?et:C._diagnosticsSampleRate,P,T.remoteConfig,t,T.enableRequestBodyCompression,C._enableRequestBodyCompressionExperimentalValue,T.customEnrichment)).storageProvider.isEnabled()];case 5:return er.sent()||(_.loggerProvider.warn("Storage provider ".concat(_.storageProvider.constructor.name," is not enabled. Falling back to MemoryStorage.")),_.storageProvider=new t$),[2,_]}})}))];case 3:if(m=I.sent(),!(c&&h))return[3,5];return[4,new Promise(function(e){null==h||h.subscribe("configs.analyticsSDK.browserSDK","all",function(t,r,n){m.loggerProvider.debug("Remote configuration received:",JSON.stringify({remoteConfig:t,source:r,lastFetch:n},null,2)),t&&function(e,t){if(e){!function e(t){if("object"==typeof t&&null!==t&&!Array.isArray(t)){var r,n,i,o,s,a,u,l,c,d,f,h,p=Object.keys(t);try{for(var g=(0,es.__values)(p),v=g.next();!v.done;v=g.next()){var m=v.value;try{var y=t[m];"boolean"==typeof(null==y?void 0:y.enabled)&&(y.enabled?(delete y.enabled,0===Object.keys(y).length&&(t[m]=!0)):t[m]=!1),e(y)}catch(e){}}}catch(e){r={error:e}}finally{try{v&&!v.done&&(n=g.return)&&n.call(g)}finally{if(r)throw r.error}}try{if(null==(c=null==(l=null==(u=t.autocapture)?void 0:u.networkTracking)?void 0:l.captureRules)?void 0:c.length)try{for(var b=(0,es.__values)(t.autocapture.networkTracking.captureRules),_=b.next();!_.done;_=b.next()){var w=_.value;try{for(var S=(s=void 0,(0,es.__values)(["responseHeaders","requestHeaders"])),E=S.next();!E.done;E=S.next()){var k=E.value,I=null!=(d=w[k])?d:{},x=I.captureSafeHeaders,T=I.allowlist;if(x||T){if(void 0!==T&&!Array.isArray(T)){delete w[k];continue}w[k]=(0,es.__spreadArray)((0,es.__spreadArray)([],(0,es.__read)(x?eO:[]),!1),(0,es.__read)(null!=T?T:[]),!1)}}}catch(e){s={error:e}}finally{try{E&&!E.done&&(a=S.return)&&a.call(S)}finally{if(s)throw s.error}}}}catch(e){i={error:e}}finally{try{_&&!_.done&&(o=b.return)&&o.call(b)}finally{if(i)throw i.error}}}catch(e){}var C=null==(f=t.autocapture)?void 0:f.frustrationInteractions;C&&(C.rageClick&&(C.rageClicks=C.rageClick,delete C.rageClick),C.deadClick&&(C.deadClicks=C.deadClick,delete C.deadClick));try{var P=null==(h=t.autocapture)?void 0:h.elementInteractions;if(P&&"object"==typeof P&&(!0===P.viewportContentUpdated&&(P.viewportContentUpdated={}),!1===P.viewportContentUpdated&&(P.viewportContentUpdated={enabled:!1}),void 0!==P.exposureDuration)){var O=P.viewportContentUpdated;void 0===O?P.viewportContentUpdated={exposureDuration:P.exposureDuration}:"object"==typeof O&&void 0===O.exposureDuration&&!1!==O.enabled&&(O.exposureDuration=P.exposureDuration),delete P.exposureDuration}}catch(e){}}}(e);try{var r,n,i,o,s,a,u;if(t.loggerProvider.debug("Update browser config with remote configuration:",JSON.stringify(e)),e&&"autocapture"in e){if("boolean"==typeof e.autocapture&&(t.autocapture=e.autocapture),"object"==typeof e.autocapture&&null!==e.autocapture){var l=(0,es.__assign)({},e.autocapture);if(void 0===t.autocapture&&(t.autocapture=e.autocapture),"object"==typeof e.autocapture.elementInteractions&&null!==e.autocapture.elementInteractions&&(null==(i=e.autocapture.elementInteractions.pageUrlAllowlistRegex)?void 0:i.length)){l.elementInteractions=(0,es.__assign)({},e.autocapture.elementInteractions);var c=l.elementInteractions,d=null!=(o=c.pageUrlAllowlist)?o:[],f=e.autocapture.elementInteractions.pageUrlAllowlistRegex;c.pageUrlAllowlist=r1(d,f,t),delete c.pageUrlAllowlistRegex}
2if("object"==typeof e.autocapture.networkTracking&&null!==e.autocapture.networkTracking&&(null==(s=e.autocapture.networkTracking.captureRules)?void 0:s.length)){l.networkTracking=(0,es.__assign)({},e.autocapture.networkTracking);var h=null!=(a=l.networkTracking.captureRules)?a:[];try{for(var p=(0,es.__values)(h),g=p.next();!g.done;g=p.next()){var v=g.value;v.urls=r1(null!=(u=v.urls)?u:[],v.urlsRegex,t),delete v.urlsRegex}}catch(e){r={error:e}}finally{try{g&&!g.done&&(n=p.return)&&n.call(p)}finally{if(r)throw r.error}}}"boolean"==typeof t.autocapture&&(t.autocapture=(0,es.__assign)({attribution:t.autocapture,fileDownloads:t.autocapture,formInteractions:t.autocapture,pageViews:t.autocapture,sessions:t.autocapture,elementInteractions:t.autocapture,webVitals:t.autocapture,frustrationInteractions:t.autocapture},l)),"object"==typeof t.autocapture&&(t.autocapture=(0,es.__assign)((0,es.__assign)({},t.autocapture),l))}t.defaultTracking=t.autocapture}"customEnrichment"in e&&null!==e.customEnrichment&&!1!==t.customEnrichment&&(t.customEnrichment=e.customEnrichment),t.loggerProvider.debug("Browser config after remote config update:",JSON.stringify(t))}catch(e){t.loggerProvider.error("Failed to apply remote configuration because of error: ",e)}}}(t,m),e()})})];case 4:I.sent(),I.label=5;case 5:return[4,e.prototype._init.call(this,m)];case 6:if(I.sent(),this.logBrowserOptions(m),this.config.remoteConfigClient=h,y=tA((A=this.config).defaultTracking)&&A.defaultTracking&&"object"==typeof A.defaultTracking&&A.defaultTracking.attribution&&"object"==typeof A.defaultTracking.attribution?(0,es.__assign)({},A.defaultTracking.attribution):{},!(tA(this.config.defaultTracking)&&ob(y)))return[3,8];return this.config.optOut&&this.timeline.addOptOutListener(function(e){return(0,es.__awaiter)(k,void 0,void 0,function(){return(0,es.__generator)(this,function(t){switch(t.label){case 0:if(e)return[3,2];return this.webAttribution=new oi(y,this.config),[4,this.webAttribution.init()];case 1:t.sent(),t.label=2;case 2:return[2]}})})}),this.webAttribution=new oi(y,this.config),[4,this.webAttribution.init()];case 7:I.sent(),I.label=8;case 8:if(w=!(!(_=(b=tl()).ampTimestamp?Number(b.ampTimestamp):void 0)||Date.now()<_)||Number.isNaN(Number(b.ampSessionId))?void 0:Number(b.ampSessionId),-1!==(S=this.config.deferredSessionId)||this.config.optOut||(S=Date.now()),this.setSessionId(null!=(l=null!=(u=null!=(a=t.sessionId)?a:w)?u:S)?l:this.config.sessionId),this.config.optOut&&this.timeline.addOptOutListener(function(e){return(0,es.__awaiter)(k,void 0,void 0,function(){return(0,es.__generator)(this,function(t){return!e&&this.config.deferredSessionId&&(-1===this.config.deferredSessionId?this.setSessionId(void 0):this.setSessionId(this.config.deferredSessionId)),[2]})})}),(E=ti(t.instanceName)).identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),null===this.config.offline)return[3,10];return[4,this.add(r0()).promise];case 9:I.sent(),I.label=10;case 10:return[4,this.add(new e2({diagnosticsClient:v})).promise];case 11:return I.sent(),[4,this.add(new tJ).promise];case 12:return I.sent(),[4,this.add(new tu).promise];case 13:if(I.sent(),rZ(this.config),!tO(this.config.defaultTracking,"fileDownloads"))return[3,15];return this.config.loggerProvider.debug("Adding file download tracking plugin"),[4,this.add(rY()).promise];case 14:I.sent(),I.label=15;case 15:if(!tR(this.config.defaultTracking))return[3,17];return this.config.loggerProvider.debug("Adding form interaction plugin"),[4,this.add(rJ()).promise];case 16:I.sent(),I.label=17;case 17:if(!tM(this.config.defaultTracking))return[3,20];if(this.config.optOut)return[3,19];return this.config.loggerProvider.debug("Adding page view tracking plugin"),[4,this.add(rW(tB(this.config))).promise];case 18:return I.sent(),[3,20];case 19:this.timeline.addOptOutListener(function(e){return(0,es.__awaiter)(k,void 0,void 0,function(){return(0,es.__generator)(this,function(t){switch(t.label){case 0:if(e)return[2];return this.config.loggerProvider.debug("Adding page view tracking plugin"),[4,this.add(rW(tB(this.config))).promise];case 1:return t.sent(),[2]}})})}),I.label=20;case 20:if(!(tA(this.config.defaultTracking)&&oy(y,og)))return[3,22];return this.config.loggerProvider.debug("Adding event property attribution plugin"),[4,this.add(os(y)).promise];case 21:I.sent(),I.label=22;case 22:if(!tL(this.config.autocapture))return[3,24];return this.config.loggerProvider.debug("Adding user interactions plugin (autocapture plugin)"),[4,this.add(n2(tq(this.config),{diagnosticsClient:v})).promise];case 23:I.sent(),I.label=24;case 24:if(!tU(this.config.autocapture))return[3,26];return this.config.loggerProvider.debug("Adding frustration interactions plugin"),[4,this.add(is(tj(this.config))).promise];
2case 25:I.sent(),I.label=26;case 26:if(!tD(this.config.autocapture))return[3,28];return this.config.loggerProvider.debug("Adding network tracking plugin"),[4,this.add(iO(tF(this.config))).promise];case 27:I.sent(),I.label=28;case 28:if(!("boolean"==typeof(R=this.config.autocapture)?R:"object"==typeof R&&!0===R.webVitals))return[3,30];return this.config.loggerProvider.debug("Adding web vitals plugin"),[4,this.add(or()).promise];case 29:I.sent(),I.label=30;case 30:if(!tO(this.config.autocapture,"pageUrlEnrichment"))return[3,32];return this.config.loggerProvider.debug("Adding referrer page url plugin"),[4,this.add(od()).promise];case 31:I.sent(),I.label=32;case 32:if(!("boolean"==typeof(N=this.config.customEnrichment)?N:"object"==typeof N&&null!==N&&!1!==N.enabled))return[3,34];return this.config.loggerProvider.debug("Adding custom enrichment plugin"),[4,this.add(oh()).promise];case 33:I.sent(),I.label=34;case 34:return this.initializing=!1,[4,this.runQueuedFunctions("dispatchQ")];case 35:return I.sent(),E.eventBridge.setEventReceiver(function(e){var t=e.eventProperties||{},r=t.time,n=(0,es.__rest)(t,["time"]);k.track(e.eventType,n,"number"==typeof r?{time:r}:void 0)}),[2]}})})},t.prototype.getUserId=function(){var e;return null==(e=this.config)?void 0:e.userId},t.prototype.setUserId=function(e){this.config?(this.config.loggerProvider.debug("function setUserId: ",e),(e!==this.config.userId||void 0===e)&&(this.config.userId=e,this.timeline.onIdentityChanged({userId:e}),to(e,this.config.instanceName))):this.q.push(this.setUserId.bind(this,e))},t.prototype.getDeviceId=function(){var e;return null==(e=this.config)?void 0:e.deviceId},t.prototype.setDeviceId=function(e){this.config?(this.config.loggerProvider.debug("function setDeviceId: ",e),e!==this.config.deviceId&&(this.config.deviceId=e,this.timeline.onIdentityChanged({deviceId:e}),ts(e,this.config.instanceName))):this.q.push(this.setDeviceId.bind(this,e))},t.prototype.reset=function(){this.setDeviceId(ej()),this.setUserId(void 0),this.timeline.onReset()},t.prototype.getIdentity=function(){var e,t;return{deviceId:null==(e=this.config)?void 0:e.deviceId,userId:null==(t=this.config)?void 0:t.userId,userProperties:this.userProperties}},t.prototype.setIdentity=function(e){if("userId"in e&&this.setUserId(e.userId),"deviceId"in e&&e.deviceId&&this.setDeviceId(e.deviceId),"userProperties"in e){this.userProperties=e.userProperties;var t,r,n,i=new eN,o=null!=(n=e.userProperties)?n:{};try{for(var s=(0,es.__values)(Object.entries(o)),a=s.next();!a.done;a=s.next()){var u=(0,es.__read)(a.value,2),l=u[0],c=u[1];i.set(l,c)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}this.identify(i)}},t.prototype.getOptOut=function(){var e;return null==(e=this.config)?void 0:e.optOut},t.prototype.getSessionId=function(){var e;return null==(e=this.config)?void 0:e.sessionId},t.prototype.setSessionId=function(e){var t,r=[];if(!this.config)return this.q.push(this.setSessionId.bind(this,e)),eW(Promise.resolve());if(this.config.optOut)return this.config.deferredSessionId=null!=e?e:-1,eW(Promise.resolve());if(void 0===e&&(e=Date.now()),e===this.config.sessionId)return eW(Promise.resolve());this.config.loggerProvider.debug("function setSessionId: ",e);var n=this.getSessionId();n!==e&&this.timeline.onSessionIdChanged(e);var i=this.config.lastEventTime,o=null!=(t=this.config.lastEventId)?t:-1;this.config.sessionId=e,this.config.lastEventTime=void 0,this.config.pageCounter=0,tN(this.config.defaultTracking)&&(n&&i&&r.push(this.track(rl,void 0,{device_id:this.previousSessionDeviceId,event_id:++o,session_id:n,time:i+1,user_id:this.previousSessionUserId}).promise),this.config.lastEventTime=this.config.sessionId);var s=this.trackCampaignEventIfNeeded(++o,r);return this.config.identify&&r.push(this.track(eB(this.config.identify)).promise),tN(this.config.defaultTracking)&&r.push(this.track(ru,void 0,{event_id:s?++o:o,session_id:this.config.sessionId,time:this.config.lastEventTime}).promise),this.previousSessionDeviceId=this.config.deviceId,this.previousSessionUserId=this.config.userId,eW(Promise.all(r))},t.prototype.extendSession=function(){this.config?this.config.lastEventTime=
2Date.now():this.q.push(this.extendSession.bind(this))},t.prototype.setTransport=function(e){this.config?this.config.transportProvider=rM(e):this.q.push(this.setTransport.bind(this,e))},t.prototype.identify=function(t,r){if(tW(t)){var n=t._q;t._q=[],t=tK(new eN,n)}return(null==r?void 0:r.user_id)&&this.setUserId(r.user_id),(null==r?void 0:r.device_id)&&this.setDeviceId(r.device_id),e.prototype.identify.call(this,t,r)},t.prototype.groupIdentify=function(t,r,n,i){if(tW(n)){var o=n._q;n._q=[],n=tK(new eN,o)}return e.prototype.groupIdentify.call(this,t,r,n,i)},t.prototype.revenue=function(t,r){if(tW(t)){var n=t._q;t._q=[],t=tK(new e3,n)}return e.prototype.revenue.call(this,t,r)},t.prototype.trackCampaignEventIfNeeded=function(e,t){if(!this.webAttribution||!this.webAttribution.shouldTrackNewCampaign||!ob(this.webAttribution.options))return!1;var r=this.webAttribution.generateCampaignEvent(e);return t?t.push(this.track(r).promise):this.track(r),this.config.loggerProvider.log("Tracking attribution."),!0},t.prototype.process=function(t){return(0,es.__awaiter)(this,void 0,void 0,function(){var r,n,i;return(0,es.__generator)(this,function(o){return r=Date.now(),n=ta(this.config.sessionTimeout,this.config.lastEventTime),i=this.webAttribution&&this.webAttribution.shouldSetSessionIdOnNewCampaign(),t.event_type!==ru&&t.event_type!==rl&&(!t.session_id||t.session_id===this.getSessionId())&&(n||i?(this.setSessionId(r),i&&this.config.loggerProvider.log("Created a new session for new campaign.")):n||this.trackCampaignEventIfNeeded()),[2,e.prototype.process.call(this,t)]})})},t.prototype.logBrowserOptions=function(e){try{var t=(0,es.__assign)((0,es.__assign)({},e),{apiKey:e.apiKey.substring(0,10)+"********"});this.config.loggerProvider.debug("Initialized Amplitude with BrowserConfig:",tP(t))}catch(e){this.config.loggerProvider.error("Error logging browser config",e)}},t.prototype._setDiagnosticsSampleRate=function(e){if(!(e>1)&&!(e<0)&&!this.config){this._diagnosticsSampleRate=e;return}},t.prototype._enableRequestBodyCompressionExperimental=function(e){if(!this.config){this._enableRequestBodyCompressionExperimentalValue=e;return}},t}(ez))).init.bind(g),"init",eu(g),ec(g,["config"])),add:ed(g.add.bind(g),"add",eu(g),ec(g,["config.apiKey","timeline.plugins"])),remove:ed(g.remove.bind(g),"remove",eu(g),ec(g,["config.apiKey","timeline.plugins"])),track:ed(g.track.bind(g),"track",eu(g),ec(g,["config.apiKey","timeline.queue.length"])),logEvent:ed(g.logEvent.bind(g),"logEvent",eu(g),ec(g,["config.apiKey","timeline.queue.length"])),identify:ed(g.identify.bind(g),"identify",eu(g),ec(g,["config.apiKey","timeline.queue.length"])),groupIdentify:ed(g.groupIdentify.bind(g),"groupIdentify",eu(g),ec(g,["config.apiKey","timeline.queue.length"])),setGroup:ed(g.setGroup.bind(g),"setGroup",eu(g),ec(g,["config.apiKey","timeline.queue.length"])),revenue:ed(g.revenue.bind(g),"revenue",eu(g),ec(g,["config.apiKey","timeline.queue.length"])),flush:ed(g.flush.bind(g),"flush",eu(g),ec(g,["config.apiKey","timeline.queue.length"])),getUserId:ed(g.getUserId.bind(g),"getUserId",eu(g),ec(g,["config","config.userId"])),setUserId:ed(g.setUserId.bind(g),"setUserId",eu(g),ec(g,["config","config.userId"])),getDeviceId:ed(g.getDeviceId.bind(g),"getDeviceId",eu(g),ec(g,["config","config.deviceId"])),setDeviceId:ed(g.setDeviceId.bind(g),"setDeviceId",eu(g),ec(g,["config","config.deviceId"])),reset:ed(g.reset.bind(g),"reset",eu(g),ec(g,["config","config.userId","config.deviceId"])),getSessionId:ed(g.getSessionId.bind(g),"getSessionId",eu(g),ec(g,["config"])),setSessionId:ed(g.setSessionId.bind(g),"setSessionId",eu(g),ec(g,["config"])),extendSession:ed(g.extendSession.bind(g),"extendSession",eu(g),ec(g,["config"])),setOptOut:ed(g.setOptOut.bind(g),"setOptOut",eu(g),ec(g,["config"])),setTransport:ed(g.setTransport.bind(g),"setTransport",eu(g),ec(g,["config"])),getIdentity:ed(g.getIdentity.bind(g),"getIdentity",eu(g),ec(g,["config"])),setIdentity:ed(g.setIdentity.bind(g),"setIdentity",eu(g),ec(g,["config","config.userId","config.deviceId"])),getOptOut:ed(g.getOptOut.bind(g),"getOptOut",eu(g),ec(g,["config"])),_setDiagnosticsSampleRate:ed(g._setDiagnosticsSampleRate.bind(g),"_setDiagnosticsSampleRate",eu(g),ec(g,["config"])),_enableRequestBodyCompressionExperimental:ed(g._enableRequestBodyCompressionExperimental.bind(g),"_enableRequestBodyCompressionExperimental",eu(g),ec(g,["config"]))};e.s([],407242),e.i(407242),(v=J||(J={})).US="US",v.EU="EU",v.STAGING="STAGING",e.s(["DEFAULT_ACTION_CLICK_ALLOWLIST",0,r4,"DEFAULT_CSS_SELECTOR_ALLOWLIST",0,r2,"DEFAULT_DATA_ATTRIBUTE_PREFIX",0,r3,"EXCLUDE_INTERNAL_REFERRERS_CONDITIONS",0,rb,"IdentifyOperation",0,N,"LogLevel",0,M,"OfflineDisabled",0,null,"RevenueProperty",0,q,"ServerZone",0,J,"SpecialEventType",0,D],767672),e.i(767672);var ow=o_.add,oS=(o_.extendSession,o_.flush,o_.getDeviceId,o_.getIdentity,o_.getOptOut,o_.getSessionId,o_.getUserId,o_.groupIdentify,o_.identify),oE=o_.init,ok=(o_.logEvent,o_.remove,o_.reset,o_.revenue,o_.setDeviceId,o_.setGroup,o_.setIdentity,o_.setOptOut,o_.setSessionId,o_.setTransport,o_.setUserId),oI=o_.track;o_._setDiagnosticsSampleRate,o_._enableRequestBodyCompressionExperimental;var ox=e.i(108),oT=function(e,t){return(oT=Object.setPrototypeOf||({__proto__:[]}
2)instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)};function oC(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}oT(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var oP=function(){return(oP=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}).apply(this,arguments)};function oO(e,t,r,n){return new(r||(r=Promise))(function(i,o){function s(e){try{u(n.next(e))}catch(e){o(e)}}function a(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(s,a)}u((n=n.apply(e,t||[])).next())})}function oA(e,t){var r,n,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(u){var l=[a,u];if(r)throw TypeError("Generator is already executing.");for(;s&&(s=0,l[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&l[0]?n.return:l[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,l[1])).done)return i;switch(n=0,i&&(l=[2&l[0],i.value]),l[0]){case 0:case 1:i=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,n=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===l[0]||2===l[0])){o=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){o.label=l[1];break}if(6===l[0]&&o.label<i[1]){o.label=i[1],i=l;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(l);break}i[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],n=0}finally{r=i=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}function oR(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function oM(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s}function oN(e,t,r){if(r||2==arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var oD="is not",oL="contains",oU="does not contain",oq="less",oj="less or equal",oF="greater",oB="greater or equal",oV="version less",oK="version less or equal",oW="version greater",oz="version greater or equal",oH="set is",oG="set is not",oJ="set contains",o$="set does not contain",oX="set contains any",oY="set does not contain any",oQ=function(e){for(var t=[],r=0,n=0;n<e.length;n++){var i=e.charCodeAt(n);i<128?t[r++]=i:(i<2048?t[r++]=i>>6|192:((64512&i)==55296&&n+1<e.length&&(64512&e.charCodeAt(n+1))==56320?(i=65536+((1023&i)<<10)+(1023&e.charCodeAt(++n)),t[r++]=i>>18|240,t[r++]=i>>12&63|128):t[r++]=i>>12|224,t[r++]=i>>6&63|128),t[r++]=63&i|128)}return Uint8Array.from(t)},oZ=function(e,t){void 0===t&&(t=0);for(var r=oQ(e),n=r.length,i=n>>2,o=t,s=0;s<i;s++)o=o0(o3(r,s<<2),o);var a=i<<2,u=0;switch(n-a){case 3:u^=r[a+2]<<16,u^=r[a+1]<<8,u^=r[a],o^=u=Math.imul(u=o2(u=Math.imul(u,-0x3361d2af),15),0x1b873593);break;case 2:u^=r[a+1]<<8,u^=r[a],o^=u=Math.imul(u=o2(u=Math.imul(u,-0x3361d2af),15),0x1b873593);break;case 1:u^=r[a],o^=u=Math.imul(u=o2(u=Math.imul(u,-0x3361d2af),15),0x1b873593)}return o1(o^=n)>>>0},o0=function(e,t){var r=e,n=t;return n^=r=Math.imul(r=o2(r=Math.imul(r,-0x3361d2af),15),0x1b873593),(n=Math.imul(n=o2(n,13),5))+-0x19ab949c|0},o1=function(e){var t=e;return t^=t>>>16,t=Math.imul(t,-0x7a143595),t^=t>>>
213,t=Math.imul(t,-0x3d4d51cb),t^=t>>>16},o2=function(e,t,r){void 0===r&&(r=32),t>r&&(t%=r);var n=(e&0xffffffff<<r-t>>>0)>>>0>>>r-t>>>0;return(e<<t|n)>>>0},o3=function(e,t){return void 0===t&&(t=0),o4(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])},o4=function(e){return(-0x1000000&e)>>>24|(0xff0000&e)>>>8|(65280&e)<<8|(255&e)<<24},o5=function(e,t){var r,n;if(t&&0!==t.length){try{for(var i=oR(t),o=i.next();!o.done;o=i.next()){var s=o.value;if(!s||!e||"object"!=typeof e)return;e=e[s]}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}if(null==e)return;return e}},o6="^".concat("(\\d+)\\.(\\d+)","(\\.").concat("(\\d+)").concat("(-(([-\\w]+\\.?)*))?",")?$"),o8=function(){function e(e,t,r,n){void 0===n&&(n=void 0),this.major=e,this.minor=t,this.patch=r,this.preRelease=n}return e.parse=function(t){if(t){var r=new RegExp(o6).exec(t);if(r){var n=Number(r[1]),i=Number(r[2]);if(!(isNaN(n)||isNaN(i)))return new e(n,i,Number(r[4])||0,r[5]||void 0)}}},e.prototype.compareTo=function(e){if(this.major>e.major)return 1;if(this.major<e.major)return -1;if(this.minor>e.minor)return 1;if(this.minor<e.minor)return -1;if(this.patch>e.patch)return 1;if(this.patch<e.patch||this.preRelease&&!e.preRelease)return -1;if(!this.preRelease&&e.preRelease)return 1;if(this.preRelease&&e.preRelease){if(this.preRelease>e.preRelease)return 1;if(this.preRelease<e.preRelease)return -1}return 0},e}(),o7=function(){function e(){}return e.prototype.evaluate=function(e,t){var r,n,i={},o={context:e,result:i};try{for(var s=oR(t),a=s.next();!a.done;a=s.next()){var u=a.value,l=this.evaluateFlag(o,u);l&&(i[u.key]=l)}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return i},e.prototype.evaluateWithTraces=function(e,t){var r,n,i={},o={},s={context:e,result:i};try{for(var a=oR(t),u=a.next();!u.done;u=a.next()){var l=u.value,c=this.evaluateFlagWithTrace(s,l),d=c.variant,f=c.trace;d&&(i[l.key]=d),o[l.key]=f}}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return{results:i,traces:o}},e.prototype.evaluateFlag=function(e,t){try{for(var r,n,i,o=oR(t.segments),s=o.next();!s.done;s=o.next()){var a=s.value;if(i=this.evaluateSegment(e,t,a)){var u=oP(oP(oP({},t.metadata),a.metadata),i.metadata);i=oP(oP({},i),{metadata:u});break}}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i},e.prototype.evaluateFlagWithTrace=function(e,t){var r,n,i,o,s,a,u,l,c,d,f,h=[];try{for(var p=oR(t.segments),g=p.next();!g.done;g=p.next()){var v=g.value;if(!v.conditions){var m=this.bucket(e,v),y=void 0!==m;h.push({segmentMetadata:v.metadata,conditionsPassed:!0,bucketed:y,bucketVariant:m,conditionResult:void 0,matched:y}),c||void 0===m||(c=t.variants[m],d=v,f=null==(u=v.metadata)?void 0:u.segmentName);continue}var b=[],_=!1;try{for(var w=(i=void 0,oR(v.conditions)),S=w.next();!S.done;S=w.next()){var E=S.value,k=!0,I=[];try{for(var x=(s=void 0,oR(E)),T=x.next();!T.done;T=x.next()){var C=T.value,P=o5(e,C.selector),O=this.matchCondition(e,C);if(I.push({propValue:P,condition:C,matched:O}),!O){k=!1;break}}}catch(e){s={error:e}}finally{try{T&&!T.done&&(a=x.return)&&a.call(x)}finally{if(s)throw s.error}}if(b.push(I),k){_=!0;break}}}catch(e){i={error:e}}finally{try{S&&!S.done&&(o=w.return)&&o.call(w)}finally{if(i)throw i.error}}var A=!1,R=void 0;_&&(R=this.bucket(e,v),A=void 0!==R),h.push({segmentMetadata:v.metadata,conditionsPassed:_,bucketed:A,bucketVariant:R,conditionResult:b,matched:_&&A}),_&&void 0!==R&&!c&&(c=t.variants[R],d=v,f=null==(l=v.metadata)?void 0:l.segmentName)}}catch(e){r={error:e}}finally{try{g&&!g.done&&(n=p.return)&&n.call(p)}finally{if(r)throw r.error}}if(c&&d){var M=oP(oP(oP({},t.metadata),d.metadata),c.metadata);c=oP(oP({},c),{metadata:M})}var N={flagKey:t.key,matched:void 0!==c,matchedSegment:f,steps:h};return{variant:c,trace:N}},e.prototype.evaluateSegment=function(e,t,r){if(!r.conditions){var n=this.bucket(e,r);return void 0!==n?t.variants[n]:void 0}if(this.evaluateConditions(e,r.conditions)){var n=this.bucket(e,r);if(void 0!==n)return t.variants[n]}},e.prototype.evaluateConditions=function(e,t){var r,n,i,o;try{for(var s=oR(t),a=s.next();!a.done;a=s.next()){var u=a.value,l=!0;try{for(var c=(i=void 0,oR(u)),d=c.next();!d.done;d=c.next()){var f=d.value;if(!(l=this.matchCondition(e,f)))break}}catch(e){i={error:e}}
2finally{try{d&&!d.done&&(o=c.return)&&o.call(c)}finally{if(i)throw i.error}}if(l)return!0}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return!1},e.prototype.matchCondition=function(e,t){var r=o5(e,t.selector);if(null==r)return this.matchNull(t.op,t.values);if(this.isSetOperator(t.op)){var n=this.coerceStringArray(r);return!!n&&this.matchSet(n,t.op,t.values)}var i=this.coerceString(r);return void 0!==i&&this.matchString(i,t.op,t.values)},e.prototype.getHash=function(e){return oZ(e)},e.prototype.bucket=function(e,t){if(!t.bucket)return t.variant;var r,n,i,o,s=this.coerceString(o5(e,t.bucket.selector));if(!s||0===s.length)return t.variant;var a="".concat(t.bucket.salt,"/").concat(s),u=this.getHash(a),l=u%100,c=Math.floor(u/100);try{for(var d=oR(t.bucket.allocations),f=d.next();!f.done;f=d.next()){var h=f.value,p=h.range[0],g=h.range[1];if(l>=p&&l<g)try{for(var v=(i=void 0,oR(h.distributions)),m=v.next();!m.done;m=v.next()){var y=m.value,b=y.range[0],_=y.range[1];if(c>=b&&c<_)return y.variant}}catch(e){i={error:e}}finally{try{m&&!m.done&&(o=v.return)&&o.call(v)}finally{if(i)throw i.error}}}}catch(e){r={error:e}}finally{try{f&&!f.done&&(n=d.return)&&n.call(d)}finally{if(r)throw r.error}}return t.variant},e.prototype.matchNull=function(e,t){var r=this.containsNone(t);switch(e){case"is":case oL:case oq:case oj:case oF:case oB:case oV:case oK:case oW:case oz:case oH:case oJ:case oX:return r;case oD:case oU:case o$:case oY:return!r;default:return!1}},e.prototype.matchSet=function(e,t,r){switch(t){case oH:return this.setEquals(e,r);case oG:return!this.setEquals(e,r);case oJ:return this.matchesSetContainsAll(e,r);case o$:return!this.matchesSetContainsAll(e,r);case oX:return this.matchesSetContainsAny(e,r);case oY:return!this.matchesSetContainsAny(e,r);default:return!1}},e.prototype.matchString=function(e,t,r){var n=this;switch(t){case"is":return this.matchesIs(e,r);case oD:return!this.matchesIs(e,r);case oL:return this.matchesContains(e,r);case oU:return!this.matchesContains(e,r);case oq:case oj:case oF:case oB:return this.matchesComparable(e,t,r,function(e){return n.parseNumber(e)},this.comparator);case oV:case oK:case oW:case oz:return this.matchesComparable(e,t,r,function(e){return o8.parse(e)},this.versionComparator);case"regex match":return this.matchesRegex(e,r);case"regex does not match":return!this.matchesRegex(e,r);default:return!1}},e.prototype.matchesIs=function(e,t){if(this.containsBooleans(t)){var r=e.toLowerCase();if("true"===r||"false"===r)return t.some(function(e){return e.toLowerCase()===r})}return t.some(function(t){return e===t})},e.prototype.matchesContains=function(e,t){var r,n;try{for(var i=oR(t),o=i.next();!o.done;o=i.next()){var s=o.value;if(e.toLowerCase().includes(s.toLowerCase()))return!0}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return!1},e.prototype.matchesComparable=function(e,t,r,n,i){var o=this,s=n(e),a=r.map(function(e){return n(e)}).filter(function(e){return void 0!==e});return void 0===s||0===a.length?r.some(function(r){return o.comparator(e,t,r)}):a.some(function(e){return i(s,t,e)})},e.prototype.comparator=function(e,t,r){switch(t){case oq:case oV:return e<r;case oj:case oK:return e<=r;case oF:case oW:return e>r;case oB:case oz:return e>=r;default:return!1}},e.prototype.versionComparator=function(e,t,r){var n=e.compareTo(r);switch(t){case oq:case oV:return n<0;case oj:case oK:return n<=0;case oF:case oW:return n>0;case oB:case oz:return n>=0;default:return!1}},e.prototype.matchesRegex=function(e,t){return t.some(function(t){return!!new RegExp(t).exec(e)})},e.prototype.containsNone=function(e){return e.some(function(e){return"(none)"===e})},e.prototype.containsBooleans=function(e){return e.some(function(e){switch(e.toLowerCase()){case"true":case"false":return!0;default:return!1}})},e.prototype.parseNumber=function(e){var t;return null!=(t=Number(e))?t:void 0},e.prototype.coerceString=function(e){if(null!=e)return"object"==typeof e?JSON.stringify(e):String(e)},e.prototype.coerceStringArray=function(e){var t=this;if(Array.isArray(e)){var r=e;return r.map(function(e){return t.coerceString(e)}
2).filter(Boolean)}var n=String(e);try{var i=JSON.parse(n);if(Array.isArray(i)){var r=e;return r.map(function(e){return t.coerceString(e)}).filter(Boolean)}var o=this.coerceString(n);return o?[o]:void 0}catch(e){var o=this.coerceString(n);return o?[o]:void 0}},e.prototype.isSetOperator=function(e){switch(e){case oH:case oG:case oJ:case o$:case oX:case oY:return!0;default:return!1}},e.prototype.setEquals=function(e,t){var r=new Set(e),n=new Set(t);return r.size===n.size&&oN([],oM(n),!1).every(function(e){return r.has(e)})},e.prototype.matchesSetContainsAll=function(e,t){var r,n;if(e.length<t.length)return!1;try{for(var i=oR(t),o=i.next();!o.done;o=i.next()){var s=o.value;if(!this.matchesIs(s,e))return!1}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return!0},e.prototype.matchesSetContainsAny=function(e,t){var r,n;try{for(var i=oR(t),o=i.next();!o.done;o=i.next()){var s=o.value;if(this.matchesIs(s,e))return!0}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return!1},e}(),o9=function(e,t){var r,n,i=oP({},e),o=[],s=t||Object.keys(i);try{for(var a=oR(s),u=a.next();!u.done;u=a.next()){var l=u.value,c=se(l,i);c&&o.push.apply(o,oN([],oM(c),!1))}}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return o},se=function(e,t,r){void 0===r&&(r=[]);var n,i,o=t[e];if(o){if(!o.dependencies||0===o.dependencies.length)return delete t[o.key],[o];r.push(o.key);var s=[],a=function(e){if(r.some(function(t){return t===e}))throw Error("Detected a cycle between flags ".concat(r));var n=se(e,t,r);n&&s.push.apply(s,oN([],oM(n),!1))};try{for(var u=oR(o.dependencies),l=u.next();!l.done;l=u.next()){var c=l.value;a(c)}}catch(e){n={error:e}}finally{try{l&&!l.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}return s.push(o),r.pop(),delete t[o.key],s}};let st="function"==typeof ox.Buffer,sr="function"==typeof TextDecoder?new TextDecoder:void 0,sn="function"==typeof TextEncoder?new TextEncoder:void 0,si=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),so=(r={},si.forEach((e,t)=>r[e]=t),r),ss=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,sa=String.fromCharCode.bind(String),su="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):e=>new Uint8Array(Array.prototype.slice.call(e,0)),sl=e=>e.replace(/=/g,"").replace(/[+\/]/g,e=>"+"==e?"-":"_"),sc="function"==typeof btoa?e=>btoa(e):st?e=>ox.Buffer.from(e,"binary").toString("base64"):e=>{let t,r,n,i,o="",s=e.length%3;for(let s=0;s<e.length;){if((r=e.charCodeAt(s++))>255||(n=e.charCodeAt(s++))>255||(i=e.charCodeAt(s++))>255)throw TypeError("invalid character found");o+=si[(t=r<<16|n<<8|i)>>18&63]+si[t>>12&63]+si[t>>6&63]+si[63&t]}return s?o.slice(0,s-3)+"===".substring(s):o},sd=st?e=>ox.Buffer.from(e).toString("base64"):e=>{let t=[];for(let r=0,n=e.length;r<n;r+=4096)t.push(sa.apply(null,e.subarray(r,r+4096)));return sc(t.join(""))},sf=e=>{if(e.length<2){var t=e.charCodeAt(0);return t<128?e:t<2048?sa(192|t>>>6)+sa(128|63&t):sa(224|t>>>12&15)+sa(128|t>>>6&63)+sa(128|63&t)}var t=65536+(e.charCodeAt(0)-55296)*1024+(e.charCodeAt(1)-56320);return sa(240|t>>>18&7)+sa(128|t>>>12&63)+sa(128|t>>>6&63)+sa(128|63&t)},sh=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,sp=st?e=>ox.Buffer.from(e,"utf8").toString("base64"):sn?e=>sd(sn.encode(e)):e=>sc(e.replace(sh,sf)),sg=(e,t=!1)=>t?sl(sp(e)):sp(e),sv=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,sm=e=>{switch(e.length){case 4:var t=((7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3))-65536;return sa((t>>>10)+55296)+sa((1023&t)+56320);case 3:return sa((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return sa((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},sy="function"==typeof atob?e=>atob(e.replace(/[^A-Za-z0-9\+\/]/g,"")):st?e=>ox.Buffer.from(e,"base64").toString("binary"):e=>{let t,r,n;if(e=e.replace(/\s+/g,""),!ss.test(e))throw TypeError("malformed base64.");e+="==".slice(2-(3&e.length));let i=[];for(let o=0;o<e.length;)t=so[e.charAt(o++)]<<18|so[e.charAt(o++)]<<12|(r=so[e.charAt(o++)])<<6|(n=so[e.charAt(o++)]),64===r?i.push(sa(t>>16&255)):64===n?i.push(sa(t>>16&255,t>>8&255)):i.push(sa(t>>16&255,t>>8&255,255&t));return i.join("")},sb=st?e=>su(ox.Buffer.from(e,"base64")):e=>su(sy(e).split("").map(e=>e.charCodeAt(0))),s_=st?e=>ox.Buffer.from(e,"base64").toString("utf8"):sr?e=>sr.decode(sb(e)):e=>sy(e).replace(sv,sm);var sw=function(e){function t(r,n){var i=e.call(this,n)||this;return i.statusCode=r,Object.setPrototypeOf(i,t.prototype),i}return oC(t,e),t}(Error),sS=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return oC(t,e),t}(Error),sE=function(){function e(e,t,r){this.deploymentKey=e,this.serverUrl=t,this.httpClient=r}return e.prototype.getVariants=function(e,t){return oO(this,void 0,void 0,function(){var r,n,i,o;return oA(this,function(s){switch(s.label){case 0:return r=sg(JSON.stringify(e),!0),n={Authorization:"Api-Key ".concat(this.deploymentKey),"X-Amp-Exp-User":r},(null==t?void 0:t.flagKeys)&&(n["X-Amp-Exp-Flag-Keys"]=sg(JSON.stringify(t.flagKeys),!0)),(null==t?void 0:t.trackingOption)&&(n["X-Amp-Exp-Track"]=t.trackingOption),(null==t?void 0:t.exposureTrackingOption)&&(n["X-Amp-Exp-Exposure-Track"]=t.exposureTrackingOption),i=new URL("".concat(this.serverUrl,"/sdk/v2/vardata?v=0")),(null==t?void 0:t.evaluationMode)&&i.searchParams.append("eval_mode",null==t?void 0:t.evaluationMode),(null==t?void 0:t.deliveryMethod)&&i.searchParams.append("delivery_method",null==t?void 0:t.deliveryMethod),[4,this.httpClient.request({requestUrl:i.toString(),method:"GET",headers:n,timeoutMillis:null==t?void 0:t.t
2imeoutMillis})];case 1:if(200!=(o=s.sent()).status)throw new sw(o.status,"Fetch error response: status=".concat(o.status));return[2,JSON.parse(o.body)]}})})},e}(),sk=function(){function e(e,t,r){this.deploymentKey=e,this.serverUrl=t,this.httpClient=r}return e.prototype.getFlags=function(e){return oO(this,void 0,void 0,function(){var t,r;return oA(this,function(n){switch(n.label){case 0:return t={Authorization:"Api-Key ".concat(this.deploymentKey)},(null==e?void 0:e.libraryName)&&(null==e?void 0:e.libraryVersion)&&(t["X-Amp-Exp-Library"]="".concat(e.libraryName,"/").concat(e.libraryVersion)),(null==e?void 0:e.user)&&(t["X-Amp-Exp-User"]=sg(JSON.stringify(e.user),!0)),[4,this.httpClient.request({requestUrl:"".concat(this.serverUrl,"/sdk/v2/flags")+((null==e?void 0:e.deliveryMethod)?"?delivery_method=".concat(e.deliveryMethod):""),method:"GET",headers:t,timeoutMillis:null==e?void 0:e.timeoutMillis})];case 1:if(200!=(r=n.sent()).status)throw Error("Flags error response: status=".concat(r.status));return[2,JSON.parse(r.body).reduce(function(e,t){return e[t.key]=t,e},{})]}})})},e}(),sI="u">typeof globalThis?globalThis:e.g||self,sx=function(){return"u">typeof globalThis?globalThis:"u">typeof window?window:"u">typeof self?self:e.g},sT=function(){var e=sx();if(e)try{var t="EXP_test";return e.localStorage.setItem(t,t),e.localStorage.removeItem(t),!0}catch(e){}return!1},sC=function(){function e(e,t){this.poller=void 0,this.action=e,this.ms=t}return e.prototype.start=function(){this.poller||(this.poller=sI.setInterval(this.action,this.ms),this.action())},e.prototype.stop=function(){this.poller&&(sI.clearInterval(this.poller),this.poller=void 0)},e}(),sP=e.i(865856);function sO(e){this.amplitudeInstance=e}function sA(e){this.amplitudeInstance=e}sO.prototype.getUser=function(){var e,t,r,n,i,o,s,a,u,l;return{device_id:null==(t=null==(e=this.amplitudeInstance)?void 0:e.options)?void 0:t.deviceId,user_id:null==(n=null==(r=this.amplitudeInstance)?void 0:r.options)?void 0:n.userId,version:null==(o=null==(i=this.amplitudeInstance)?void 0:i.options)?void 0:o.versionName,language:null==(a=null==(s=this.amplitudeInstance)?void 0:s.options)?void 0:a.language,platform:null==(l=null==(u=this.amplitudeInstance)?void 0:u.options)?void 0:l.platform,os:this.getOs(),device_model:this.getDeviceModel()}},sO.prototype.getOs=function(){var e,t,r,n,i,o;return[null==(r=null==(t=null==(e=this.amplitudeInstance)?void 0:e._ua)?void 0:t.browser)?void 0:r.name,null==(o=null==(i=null==(n=this.amplitudeInstance)?void 0:n._ua)?void 0:i.browser)?void 0:o.major].filter(function(e){return null!=e}).join(" ")},sO.prototype.getDeviceModel=function(){var e,t,r;return null==(r=null==(t=null==(e=this.amplitudeInstance)?void 0:e._ua)?void 0:t.os)?void 0:r.name},sA.prototype.track=function(e){this.amplitudeInstance.logEvent(e.name,e.properties)},sA.prototype.setUserProperty=function(e){var t,r;this.amplitudeInstance.setUserProperties(((t={})[e.userProperty]=null==(r=e.variant)?void 0:r.value,t))},sA.prototype.unsetUserProperty=function(e){var t;this.amplitudeInstance._logEvent("$identify",null,null,{$unset:((t={})[e.userProperty]="-",t)})};var sR=function(){return(sR=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}).apply(this,arguments)};function sM(e,t,r,n){return new(r||(r=Promise))(function(i,o){function s(e){try{u(n.next(e))}catch(e){o(e)}}function a(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(s,a)}u((n=n.apply(e,t||[])).next())})}function sN(e,t){var r,n,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(u){var l=[a,u];if(r)throw TypeError("Generator is already executing.");for(;s&&(s=0,l[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&l[0]?n.return:l[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,l[1])).done)return i;switch(n=0,i&&(l=[2&l[0],i.value]),l[0]){case 0:case 1:i=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,n=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===l[0]||2===l[0])){o=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){o.label=l[1];break}if(6===l[0]&&o.label<i[1]){o.label=i[1],i=l;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(l);break}i[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],n=0}finally{r=i=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}function sD(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);
2if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function sL(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s}function sU(e,t,r){if(r||2==arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var sq=function(e,t){void 0===t&&(t=!1);var r,n,i=sB(e,t),o=void 0,s=sI.document.cookie.split("; ");try{for(var a=sD(s),u=a.next();!u.done;u=a.next()){var l=u.value,c=sL(l.split("=",2),2),d=c[0],f=c[1];d===i&&(o=decodeURIComponent(f))}}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}if(o)try{if(t){var h=atob(o);return JSON.parse(decodeURIComponent(h))}var p=o.split("."),g=void 0;return p.length>=2&&p[1]&&(g=atob(p[1])),{deviceId:p[0],userId:g}}catch(e){return}},sj=function(e){var t=sB(e,!0);try{var r=sI.localStorage.getItem(t);if(!r)return;var n=JSON.parse(r);if("object"!=typeof n)return;return n}catch(e){return}},sF=function(e){var t=sB(e,!0);try{var r=sI.sessionStorage.getItem(t);if(!r)return;var n=JSON.parse(r);if("object"!=typeof n)return;return n}catch(e){return}},sB=function(e,t){if(t){if((null==e?void 0:e.length)<10)return;return"AMP_".concat(e.substring(0,10))}if(!((null==e?void 0:e.length)<6))return"amp_".concat(e.substring(0,6))},sV=function(){function e(e,t,r){this.type="integration",this.apiKey=e,this.identityStore=t.identityStore,this.eventBridge=t.eventBridge,this.contextProvider=t.applicationContextProvider,this.timeoutMillis=r,this.loadPersistedState(),r<=0&&(this.setup=void 0)}return e.prototype.setup=function(e,t){return sM(this,void 0,void 0,function(){return sN(this,function(r){return(null==e?void 0:e.automaticFetchOnAmplitudeIdentityChange)&&this.identityStore.addIdentityListener(function(){null==t||t.fetch()}),[2,this.waitForConnectorIdentity(this.timeoutMillis)]})})},e.prototype.getUser=function(){var e=this.identityStore.getIdentity();return{user_id:e.userId,device_id:e.deviceId,user_properties:e.userProperties,version:this.contextProvider.versionName}},e.prototype.track=function(e){return!!this.eventBridge.receiver&&(this.eventBridge.logEvent({eventType:e.eventType,eventProperties:e.eventProperties}),!0)},e.prototype.loadPersistedState=function(){if(!this.apiKey||this.apiKey.startsWith("client-"))return!1;var e=sq(this.apiKey,!0);return!!(e||(e=sq(this.apiKey,!1))||(e=sj(this.apiKey))||(e=sF(this.apiKey)))&&(this.commitIdentityToConnector(e),!0)},e.prototype.commitIdentityToConnector=function(e){var t=this.identityStore.editIdentity();t.setDeviceId(e.deviceId),e.userId&&t.setUserId(e.userId),t.commit()},e.prototype.waitForConnectorIdentity=function(e){return sM(this,void 0,void 0,function(){var t,r=this;return sN(this,function(n){return(t=this.identityStore.getIdentity()).userId||t.deviceId?[2]:[2,Promise.race([new Promise(function(e){var t=function(){e(),r.identityStore.removeIdentityListener(t)};r.identityStore.addIdentityListener(t)}),new Promise(function(t,r){sI.setTimeout(r,e,"Timed out waiting for Amplitude Analytics SDK to initialize.")})])]})})},e}(),sK=sI.fetch||function(e,t){return t=t||{},new Promise(function(r,n){var i=new XMLHttpRequest,o=[],s=[],a={},u=function(){return{ok:2==(i.status/100|0),statusText:i.statusText,status:i.status,url:i.responseURL,text:function(){return Promise.resolve(i.responseText)},json:function(){return Promise.resolve(JSON.parse(i.responseText))},blob:function(){return Promise.resolve(new Blob([i.response]))},clone:u,headers:{keys:function(){return o},entries:function(){return s},get:function(e){return a[e.toLowerCase()]},has:function(e){return e.toLowerCase()in a}}}};for(var l in i.open(t.method||"get",e,!0),i.onload=function(){i.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,function(e,t,r){o.push(t=t.toLowerCase()),s.push([t,r]),a[t]=a[t]?a[t]+","+r:r}),r(u())},i.onerror=n,i.withCredentials="include"==t.credentials,t.headers)i.setRequestHeader(l,t.headers[l]);i.send(t.body||null)})},sW=function(){function e(e){this.client=e}return e.prototype.request=function(e){return sM(this,void 0,void 0,function(){return sN(this,function(t){switch(t.label){case 0:return[4,this.client.request(e.requestUrl,e.method,e.headers,null,e.timeoutMillis)];case 1:return[2,t.sent()]}})})},e}(),sz={request:function(e,t,r,n,i){var o;return o=sM(void 0,void 0,void 0,function(){var i,o;return sN(this,function(s){switch(s.label){case 0:return[4,sK(e,{method:t,headers:r,body:n})];case 1:return o={status:(i=s.sent()).status},[4,i.text()];case 2:return o.body=s.sent(),[2,o]}})}),null==i||i<=0?o:new Promise(function(e,t){sI.setTimeout(function(){t(new sS("Request timeout after "+i+" milliseconds"))},i),o.then(e,t)})}};(m=$||($={}))[m.Disable=0]="Disable",m[m.Error=1]="Error",m[m.Warn=2]="Warn",m[m.Info=3]="Info",m[m.Debug=4]="Debug",m[m.Verbose=5]="Verbose",(y=X||(X={})).LocalStorage="localStorage",y.InitialVariants="initialVariants",(b=Y||(Y={})).LocalStorage="storage",b.InitialVariants="initial",b.SecondaryLocalStorage="secondary-storage",b.SecondaryInitialVariants="secondary-initial",b.FallbackInline="fallback-inline",b.FallbackConfig="fallback-config",b.LocalEvaluation="local-evaluation";var sH=function(e){return!e||e===Y.FallbackInline||e===Y.FallbackConfig||e===Y.SecondaryInitialVariants},sG={debug:!1,logLevel:$.Error,loggerProvider:null,instanceName:"$default_instance",fallbackVariant:{},initialVariants:{},initialFlags:void 0,source:X.LocalStorage,serverUrl:"https://api.lab.amplitude.com",flagsServerUrl:"https://flag.lab.amplitude.com",serverZone:"US",fetchTimeoutMillis:1e4,retryFetchOnFailure:!0,throwOnError:!1,automaticExposureTracking:!0,pollOnStart:!0,flagConfigPollingIntervalMillis:3e5,fetchOnStart:!0,automaticFetchOnAmplitudeIdentityChange:!1,userProvider:null,analyticsProvider:null,exposureTrackingProvider:null,httpClient:sz},sJ="1.21.0",s$=function(){function e(e,t){var r,n=this;this.isReady=new Promise(function(e){n.resolve=e}),this.config=e,this.client=t;var i=null!=(r=e.instanceName)?r:sG.instanceName;this.queue=new sY(i),this.cache=new sX(i)}return e.prototype.ready=function(){return this.integration?this.isReady:Prom
2ise.resolve()},e.prototype.setIntegration=function(e){var t=this;this.integration&&this.integration.teardown&&this.integration.teardown(),this.integration=e,e.setup?this.integration.setup(this.config,this.client).then(function(){t.queue.setTracker(t.integration.track.bind(e)),t.resolve()},function(){t.queue.setTracker(t.integration.track.bind(e)),t.resolve()}):(this.queue.setTracker(this.integration.track.bind(e)),this.resolve())},e.prototype.getUser=function(){return this.integration?this.integration.getUser():{}},e.prototype.track=function(e,t){if(this.cache.shouldTrack(e,t)){var r=this.getExposureEvent(e);this.queue.push(r)}},e.prototype.getExposureEvent=function(e){var t,r,n,i={eventType:"$exposure",eventProperties:e};return(null==(t=e.metadata)?void 0:t.exposureEvent)?i={eventType:null==(r=e.metadata)?void 0:r.exposureEvent,eventProperties:e}:(null==(n=e.metadata)?void 0:n.deliveryMethod)==="web"&&(i={eventType:"$impression",eventProperties:e}),i},e}(),sX=function(){function e(e){this.isSessionStorageAvailable=sQ(),this.inMemoryCache={},this.identity={},this.storageKey="EXP_sent_v3_".concat(e),this.isSessionStorageAvailable&&(sI.sessionStorage.removeItem("EXP_sent_".concat(e)),sI.sessionStorage.removeItem("EXP_sent_v2_".concat(e)))}return e.prototype.shouldTrack=function(e,t){if((null==(r=e.metadata)?void 0:r.deliveryMethod)==="web")return!0;var r,n,i={userId:null==t?void 0:t.user_id,deviceId:null==t?void 0:t.device_id};this.identityEquals(this.identity,i)||this.clearCache(),this.identity=i,this.loadCache();var o=e.flag_key in this.inMemoryCache,s=this.inMemoryCache[e.flag_key],a=null!=(n=e.variant)?n:null,u=!1;return o&&(null!=s?s:null)===a||(u=!0,this.inMemoryCache[e.flag_key]=a),this.storeCache(),u},e.prototype.clearCache=function(){this.inMemoryCache={},this.isSessionStorageAvailable&&sI.sessionStorage.removeItem(this.storageKey)},e.prototype.identityEquals=function(e,t){return e.userId&&t.userId?e.userId===t.userId:!e.userId&&!t.userId&&e.deviceId===t.deviceId},e.prototype.loadCache=function(){if(this.isSessionStorageAvailable){var e=sI.sessionStorage.getItem(this.storageKey);this.inMemoryCache=e?JSON.parse(e):{}}},e.prototype.storeCache=function(){if(this.isSessionStorageAvailable)try{sI.sessionStorage.setItem(this.storageKey,JSON.stringify(this.inMemoryCache))}catch(e){}},e}(),sY=function(){function e(e,t){void 0===t&&(t=512),this.isLocalStorageAvailable=sT(),this.inMemoryQueue=[],this.storageKey="EXP_unsent_".concat(e),this.maxQueueSize=t}return e.prototype.push=function(e){this.loadQueue(),this.inMemoryQueue.push(e),this.flush(),this.storeQueue()},e.prototype.setTracker=function(e){var t=this;this.tracker=e,this.poller=sI.setInterval(function(){t.loadFlushStore()},1e3),this.loadFlushStore()},e.prototype.flush=function(){if(this.tracker&&0!==this.inMemoryQueue.length){for(var e=0;e<this.inMemoryQueue.length;e++)try{if(!this.tracker(this.inMemoryQueue[e]))break}catch(e){break}this.inMemoryQueue=this.inMemoryQueue.slice(e),0===this.inMemoryQueue.length&&this.poller&&(sI.clearInterval(this.poller),this.poller=void 0)}},e.prototype.loadQueue=function(){if(this.isLocalStorageAvailable){var e=sI.localStorage.getItem(this.storageKey);this.inMemoryQueue=e?JSON.parse(e):[]}},e.prototype.storeQueue=function(){this.isLocalStorageAvailable&&(this.inMemoryQueue.length>this.maxQueueSize&&(this.inMemoryQueue=this.inMemoryQueue.slice(this.inMemoryQueue.length-this.maxQueueSize)),sI.localStorage.setItem(this.storageKey,JSON.stringify(this.inMemoryQueue)))},e.prototype.loadFlushStore=function(){this.loadQueue(),this.flush(),this.storeQueue()},e}(),sQ=function(){var e=sx();if(e)try{var t="EXP_test";return e.sessionStorage.setItem(t,t),e.sessionStorage.removeItem(t),!0}catch(e){}return!1},sZ=function(){function e(e,t){void 0===t&&(t=$.Error),this.logger=e,this.logLevel=t}return e.prototype.error=function(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];this.logLevel>=$.Error&&(t=this.logger).error.apply(t,sU([e],sL(r),!1))},e.prototype.warn=function(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];this.logLevel>=$.Warn&&(t=this.logger).warn.apply(t,sU([e],sL(r),!1))},e.prototype.info=function(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];this.logLevel>=$.Info&&(t=this.logger).info.apply(t,sU([e],sL(r),!1))},e.prototype.debug=function(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];this.logLevel>=$.Debug&&(t=this.logger).debug.apply(t,sU([e],sL(r),!1))},e.prototype.verbose=function(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];this.logLevel>=$.Verbose&&(t=this.logger).verbose.apply(t,sU([e],sL(r),!1))},e}(),s0=function(){function e(){}return e.prototype.error=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];console.error.apply(console,sU([e],sL(t),!1))},e.prototype.warn=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];console.warn.apply(console,sU([e],sL(t),!1))},e.prototype.info=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];console.info.apply(console,sU([e],sL(t),!1))},e.prototype.debug=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];console.debug.apply(console,sU([e],sL(t),!1))},e.prototype.verbose=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];console.debug.apply(console,sU([e],sL(t),!1))},e}(),s1=function(){function e(){this.globalScope=sx()}return e.prototype.get=function(e){var t;return null==(t=this.globalScope)?void 0:t.localStorage.getItem(e)},e.prototype.put=function(e,t){var r;null==(r=this.globalScope)||r.localStorage.setItem(e,t)},e.prototype.delete=function(e){var t;null==(t=this.globalScope)||t.localStorage.removeItem(e)},e}(),s2=function(e,t,r){var n=e.substring(e.length-6);return new s6("amp-exp-".concat(t,"-").concat(n),r,s8)},s3=function(e,t,r){void 0===r&&(r=new s1);var n=e.substring(e.length-6);return new s6("amp-exp-".concat(t,"-").concat(n,"-flags"),r)},s4=function(e,t,r){void 0===r&&(r=new s1);var n=e.substring(e.length-6);return new s5("amp-exp-".concat(t,"-").concat(n,"-variants-options"),r)},s5=function(){function e(e,t){this.namespace=e,this.storage=t}return e.prototype.get=function(){return this.value},e.prototype.put=function(e){this.value=e},e.prototype.load=function(){var e=this.storage.get(this.namespace);e&&(this.value=JSON.parse(e))},e.prototype.store=function(){void 0===this.value?this.storage.delete(this.namespace):this.storage.put(this.namespace,JSON.stringify(this.value))},e}(),s6=function(){function e(e,t,r){this.cache={},this.namespace=e,this.storage=t,this.transformer=r}return e.prototype.get=function(e){return this.cache[e]},e.prototype.getAll=function(){return sR({},this.cache)},e.prototype.put=function(e,t){this.cache[e]=t},e.prototype.putAll=function(e){var t,r;try{for(var n=sD(Object.keys(e)),i=n.next();!i.done;i=n.next()){var o=i.value;this.cache[o]=e[o]}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}},e.prototype.remove=function(e){delete this.cache[e]},e.prototype.clear=function(){this.cache={}},e.prototype.load=function(){var e,t,r,n=this.storage.get(this.namespace);try{r=JSON.parse(n)||{}}catch(e){return}var i={};try{for(var o=sD(Object.keys(r)),s=o.next();!s.done;s=o.next()){var a=s.value;try{var u=void 0;(u=this.transformer?this.transformer(r[a]):r[a])&&(i[a]=u)}catch(e){}}}catch(t){e={error:t}}finally{try{s&&!s.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}this.clear(),this.putAll(i)},e.prototype.store=function(e){void 0===e&&(e=this.cache),this.storage.put(this.namespace,JSON.stringify(e))},e}(),s8=function(e){if("string"==typeof e)return{key:e,value:e};if("object"==typeof e){var t=e.key,r=e.value,n=e.payload,i=e.metadata,o=e.expKey;i&&i.experimentKey?o=i.experimentKey:o&&((i=i||{}).experimentKey=o);var s={};return t?s.key=t:r&&(s.key=r),r&&(s.value=r),i&&(s.metadata=i),n&&(s.payload=n),o&&(s.expKey=o),s}},s7=function(){function e(){this.globalScope=sx()}return e.prototype.get=function(e){var t;return null==(t=this.globalScope)?void 0:t.sessionStorage.getItem(e)},e.prototype.put=function(e,t){var r;null==(r=this.globalScope)||r.sessionStorage.setItem(e,t)},e.prototype.delete=function(e){var t;null==(t=this.globalScope)||t.sessionStorage.removeItem(e)},e}(),s9=function(e,t,r,n){var i,o=null==r?void 0:r.value,s="[Experiment] ".concat(t);return{name:"[Experiment] Exposure",user:e,key:t,variant:r,userProperty:s,properties:{key:t,variant:o,source:n},userProperties:((i={})[s]=o,i)}},ae=function(e){return null==e},at=function(e){return!!ae(e)||e&&0===Object.keys(e).length},ar=function(e){if(!e||"object"!=typeof e)return{};var t,r,n={};try{for(var i=sD(Object.entries(e)),o=i.next();!o.done;o=i.next()){var s=sL(o.value,2),a=s[0],u=s[1];ae(u)||(n[a]=u)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return n},an=function(e){var t;return(null==(t=null==e?void 0:e.metadata)?void 0:t.evaluationMode)==="local"},ai=function(){function e(e,t,r,n){this.started=!1,this.done=!1,this.attempts=e,this.min=t,this.max=r,this.scalar=n}return e.prototype.start=function(e){return sM(this,void 0,void 0,function(){return sN(this,function(t){switch(t.label){case 0:if(this.started)throw Error("Backoff already started");return this.started=!0,[4,this.backoff(e,0,this.min)];case 1:return t.sent(),[2]}})})},e.prototype.cancel=function(){this.done=!0,clearTimeout(this.timeoutHandle)},e.prototype.backoff=function(e,t,r){return sM(this,void 0,void 0,function(){var n=this;return sN(this,function(i){return this.done||(this.timeoutHandle=sI.setTimeout(function(){return sM(n,void 0,void 0,function(){var n,i;return sN(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,e()];case 1:return o.sent(),[3,3];case 2:return o.sent(),(n=t+1)<this.attempts&&(i=Math.min(r*this.scalar,this.max),this.backoff(e,n,i)
2),[3,3];case 3:return[2]}})})},r)),[2]})})},e}(),ao=function(e){if(!e)return{};var t,r,n,i,o={user:e},s=sx();s&&(o.page={url:s.location.href});var a={};if(!e.groups)return o;try{for(var u=sD(Object.keys(e.groups)),l=u.next();!l.done;l=u.next()){var c=l.value,d=e.groups[c];if(d.length>0&&d[0]){var f=d[0],h={group_name:f},p=null==(i=null==(n=e.group_properties)?void 0:n[c])?void 0:i[f];p&&Object.keys(p).length>0&&(h.group_properties=p),a[c]=h}}}catch(e){t={error:e}}finally{try{l&&!l.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}return Object.keys(a).length>0&&(o.groups=a),delete o.user.groups,delete o.user.group_properties,o},as=function(e){return null==e?{}:"string"==typeof e?{key:e,value:e}:e},aa=function(e){if(!e)return{};var t=void 0;e.metadata&&(t=e.metadata.experimentKey);var r={};return e.key&&(r.key=e.key),e.value&&(r.value=e.value),e.payload&&(r.payload=e.payload),t&&(r.expKey=t),e.metadata&&(r.metadata=e.metadata),r},au=function(){function e(e){this.setProperties={},this.unsetProperties={},this.analyticsProvider=e}return e.prototype.track=function(e){this.setProperties[e.key]!=e.variant.value&&(this.setProperties[e.key]=e.variant.value,delete this.unsetProperties[e.key],this.analyticsProvider.track(e))},e.prototype.setUserProperty=function(e){this.setProperties[e.key]!=e.variant.value&&this.analyticsProvider.setUserProperty(e)},e.prototype.unsetUserProperty=function(e){this.unsetProperties[e.key]||(this.unsetProperties[e.key]="unset",delete this.setProperties[e.key],this.analyticsProvider.unsetUserProperty(e))},e}(),al=function(){function e(e){this.tracked={},this.identity={},this.exposureTrackingProvider=e}return e.prototype.track=function(e,t){var r={userId:null==t?void 0:t.user_id,deviceId:null==t?void 0:t.device_id};this.identityEquals(this.identity,r)||(this.tracked={}),this.identity=r;var n=e.flag_key in this.tracked,i=this.tracked[e.flag_key];n&&i===e.variant||(this.tracked[e.flag_key]=e.variant,this.exposureTrackingProvider.track(e))},e.prototype.identityEquals=function(e,t){return e.userId===t.userId&&e.deviceId===t.deviceId},e}(),ac=function(){function e(t,r){var n,i,o,s,a,u=this;this.engine=new o7,this.isRunning=!1,this.apiKey=t,r=ar(r),this.config=sR(sR(sR({},sG),r),{serverUrl:(null==r?void 0:r.serverUrl)||((null==(n=null==r?void 0:r.serverZone)?void 0:n.toLowerCase())==="eu"?"https://api.lab.eu.amplitude.com":sG.serverUrl),flagsServerUrl:(null==r?void 0:r.flagsServerUrl)||((null==(i=null==r?void 0:r.serverZone)?void 0:i.toLowerCase())==="eu"?"https://flag.lab.eu.amplitude.com":sG.flagsServerUrl),flagConfigPollingIntervalMillis:r.flagConfigPollingIntervalMillis<6e4?6e4:null!=(o=r.flagConfigPollingIntervalMillis)?o:sG.flagConfigPollingIntervalMillis}),this.logger=new sZ(this.config.loggerProvider||new s0,e.getLogLevel(r));var l=null==(s=this.config)?void 0:s.internalInstanceNameSuffix;if(this.isWebExperiment="web"===l,this.poller=new sC(function(){return sM(u,void 0,void 0,function(){var e;return sN(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.doFlags()];case 1:return t.sent(),[3,3];case 2:return e=t.sent(),this.logger.info(e),[3,3];case 3:return[2]}})})},this.config.flagConfigPollingIntervalMillis),this.config.initialVariants)for(var c in this.config.initialVariants)this.config.initialVariants[c]=s8(this.config.initialVariants[c]);this.config.userProvider&&(this.userProvider=this.config.userProvider),this.config.analyticsProvider&&(this.analyticsProvider=new au(this.config.analyticsProvider)),this.config.exposureTrackingProvider&&(this.userSessionExposureTracker=new al(this.config.exposureTrackingProvider)),this.integrationManager=new s$(this.config,this);var d=new sW(this.config.httpClient||sz);this.flagApi=new sk(this.apiKey,this.config.flagsServerUrl,d),this.evaluationApi=new sE(this.apiKey,this.config.serverUrl,d);var f=l?"".concat(this.config.instanceName,"-").concat(l):this.config.instanceName;a=this.isWebExperiment?new s7:new s1,this.variants=s2(this.apiKey,f,a),this.flags=s3(this.apiKey,f,a),this.fetchVariantsOptions=s4(this.apiKey,f,a);try{this.flags.load(),this.variants.load(),this.fetchVariantsOptions.load()}catch(e){}this.mergeInitialFlagsWithStorage()}return e.prototype.start=function(e){return sM(this,void 0,void 0,function(){var t,r,n;return sN(this,function(i){switch(i.label){case 0:if(this.isRunning)return[2];this.isRunning=!0,this.setUser(e),i.label=1;case 1:if(i.trys.push([1,6,,7]),t=this.doFlags(),!(null==(n=this.config.fetchOnStart)||n))return[3,3];return[4,Promise.all([this.fetch(e),t])];case 2:return i.sent(),[3,5];case 3:return[4,t];case 4:i.sent(),i.label=5;case 5:return[3,7];case 6:if(r=i.sent(),this.config.throwOnError)throw r;return[3,7];case 7:return this.config.pollOnStart&&this.poller.start(),[2]}})})},e.prototype.stop=function(){this.isRunning&&(this.poller.stop(),this.isRunning=!1)},e.prototype.fetch=function(){return sM(this,arguments,void 0,function(e,t){var r;return void 0===e&&(e=this.user),sN(this,function(n){switch(n.label){case 0:this.setUser(e||{}),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this.fetchInternal(e,this.config.fetchTimeoutMillis,this.config.retryFetchOnFailure,t)];case 2:return n.sent(),[3,4];case 3:if(r=n.sent(),this.config.throwOnError)throw r;return r instanceof sS?this.logger.debug(r):this.logger.error(r),[3,4];case 4:return[2,this]}})})},e.prototype.variant=function(e,t){if(!this.apiKey)return{value:void 0};var r,n,i=this.variantAndSource(e,t);return this.config.automaticExposureTracking&&this.exposureInternal(e,i),this.logger.debug("[Experiment] variant for ".concat(e," is ").concat((null==(r=i.variant)?void 0:r.key)||(null==(n=i.variant)?void 0:n.value))),i.variant||{}}
2,e.prototype.exposure=function(e){var t=this.variantAndSource(e);this.exposureInternal(e,t)},e.prototype.all=function(){if(!this.apiKey)return{};var e=this.evaluate();for(var t in e)an(this.flags.get(t))||delete e[t];return sR(sR(sR({},this.secondaryVariants()),this.sourceVariants()),e)},e.prototype.clear=function(){this.variants.clear();try{this.variants.store()}catch(e){}},e.prototype.getUser=function(){if(!this.user)return this.user;if(null==(e=this.user)||!e.user_properties)return sR({},this.user);var e,t=sR({},this.user.user_properties);return sR(sR({},this.user),{user_properties:t})},e.prototype.setUser=function(e){var t;if(!e){this.user=null;return}if(null==(t=this.user)?void 0:t.user_properties){var r=sR({},e.user_properties);this.user=sR(sR({},e),{user_properties:r})}else this.user=sR({},e)},e.prototype.getUserProvider=function(){return this.userProvider},e.prototype.setUserProvider=function(e){return this.userProvider=e,this},e.prototype.mergeInitialFlagsWithStorage=function(){var e=this;this.config.initialFlags&&JSON.parse(this.config.initialFlags).forEach(function(t){e.flags.get(t.key)||e.flags.put(t.key,t)})},e.prototype.evaluate=function(e){var t,r,n=this.addContext(this.user),i=o9(this.flags.getAll(),e),o=ao(n),s=this.engine.evaluate(o,i),a={};try{for(var u=sD(Object.keys(s)),l=u.next();!l.done;l=u.next()){var c=l.value;a[c]=aa(s[c])}}catch(e){t={error:e}}finally{try{l&&!l.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}return a},e.prototype.getEvaluationTraces=function(e){var t=this.addContext(this.user),r=o9(this.flags.getAll(),e),n=ao(t);return this.engine.evaluateWithTraces(n,r).traces},e.prototype.variantAndSource=function(e,t){var r={};this.config.source===X.LocalStorage?r=this.localStorageVariantAndSource(e,t):this.config.source===X.InitialVariants&&(r=this.initialVariantsVariantAndSource(e,t));var n=this.flags.get(e);return(an(n)||!r.variant&&n)&&(r=this.localEvaluationVariantAndSource(e,n,t)),r},e.prototype.localEvaluationVariantAndSource=function(e,t,r){var n,i={},o=this.evaluate([t.key])[e],s=Y.LocalEvaluation,a=null==(n=null==o?void 0:o.metadata)?void 0:n.default;if(!ae(o)&&!a)return{variant:as(o),source:s,hasDefaultVariant:!1};if(a&&(i={variant:as(o),source:s,hasDefaultVariant:!0}),!ae(r))return{variant:as(r),source:Y.FallbackInline,hasDefaultVariant:i.hasDefaultVariant};var u=this.config.initialVariants[e];if(!ae(u))return{variant:as(u),source:Y.SecondaryInitialVariants,hasDefaultVariant:i.hasDefaultVariant};var l=as(this.config.fallbackVariant),c={variant:l,source:Y.FallbackConfig,hasDefaultVariant:i.hasDefaultVariant};return at(l)?i:c},e.prototype.localStorageVariantAndSource=function(e,t){var r,n={},i=this.variants.get(e),o=null==(r=null==i?void 0:i.metadata)?void 0:r.default;if(!ae(i)&&!o)return{variant:as(i),source:Y.LocalStorage,hasDefaultVariant:!1};if(o&&(n={variant:as(i),source:Y.LocalStorage,hasDefaultVariant:!0}),!ae(t))return{variant:as(t),source:Y.FallbackInline,hasDefaultVariant:n.hasDefaultVariant};var s=this.config.initialVariants[e];if(!ae(s))return{variant:as(s),source:Y.SecondaryInitialVariants,hasDefaultVariant:n.hasDefaultVariant};var a=as(this.config.fallbackVariant),u={variant:a,source:Y.FallbackConfig,hasDefaultVariant:n.hasDefaultVariant};return at(a)?n:u},e.prototype.initialVariantsVariantAndSource=function(e,t){var r,n={},i=this.config.initialVariants[e];if(!ae(i))return{variant:as(i),source:Y.InitialVariants,hasDefaultVariant:!1};var o=this.variants.get(e),s=null==(r=null==o?void 0:o.metadata)?void 0:r.default;if(!ae(o)&&!s)return{variant:as(o),source:Y.LocalStorage,hasDefaultVariant:!1};if(s&&(n={variant:as(o),source:Y.LocalStorage,hasDefaultVariant:!0}),!ae(t))return{variant:as(t),source:Y.FallbackInline,hasDefaultVariant:n.hasDefaultVariant};var a=as(this.config.fallbackVariant),u={variant:a,source:Y.FallbackConfig,hasDefaultVariant:n.hasDefaultVariant};return at(a)?n:u},e.prototype.fetchInternal=function(e,t,r,n){return sM(this,void 0,void 0,function(){var i,o,s;return sN(this,function(a){switch(a.label){case 0:if(!this.apiKey)throw Error("Experiment API key is empty");this.logger.debug("[Experiment] Fetch all: retry=".concat(r)),r&&this.stopRetries(),a.label=1;case 1:return a.trys.push([1,4,,5]),[4,this.doFetch(e,t,sR({trackingOption:null==(s=this.fetchVariantsOptions.get())?void 0:s.trackingOption},n))];case 2:return i=a.sent(),[4,this.storeVariants(i,n)];case 3:return a.sent(),[2,i];case 4:throw o=a.sent(),r&&this.shouldRetryFetch(o)&&this.startRetries(e,n),o;case 5:return[2]}})})},e.prototype.setTracksAssignment=function(e){return sM(this,void 0,void 0,function(){return sN(this,function(t){return this.fetchVariantsOptions.put(sR(sR({},this.fetchVariantsOptions.get()||{}),{trackingOption:e?"track":"no-track"}
2)),this.fetchVariantsOptions.store(),[2]})})},e.prototype.cleanUserPropsForFetch=function(e){var t=sR({},e);return delete t.cookie,t},e.prototype.doFetch=function(e,t,r){return sM(this,void 0,void 0,function(){var n,i,o,s,a,u,l;return sN(this,function(c){switch(c.label){case 0:return[4,this.addContextOrWait(e)];case 1:return e=c.sent(),e=this.cleanUserPropsForFetch(e),this.logger.debug("[Experiment] Fetch variants for user: ",e),[4,this.evaluationApi.getVariants(e,sR({timeoutMillis:t},r))];case 2:n=c.sent(),i={};try{for(s=(o=sD(Object.keys(n))).next();!s.done;s=o.next())i[a=s.value]=aa(n[a])}catch(e){u={error:e}}finally{try{s&&!s.done&&(l=o.return)&&l.call(o)}finally{if(u)throw u.error}}return this.logger.debug("[Experiment] Received variants: ",i),[2,i]}})})},e.prototype.doFlags=function(){return sM(this,void 0,void 0,function(){var e,t,r;return sN(this,function(n){switch(n.label){case 0:if(n.trys.push([0,4,,5]),e=void 0,!this.isWebExperiment)return[3,2];return[4,this.addContextOrWait(this.getUser())];case 1:e=n.sent(),n.label=2;case 2:return[4,this.flagApi.getFlags({libraryName:"experiment-js-client",libraryVersion:sJ,timeoutMillis:this.config.fetchTimeoutMillis,deliveryMethod:this.isWebExperiment?"web":void 0,user:(null==e?void 0:e.user_id)||(null==e?void 0:e.device_id)?{user_id:null==e?void 0:e.user_id,device_id:null==e?void 0:e.device_id}:void 0})];case 3:return t=n.sent(),this.flags.clear(),this.flags.putAll(t),[3,5];case 4:if((r=n.sent())instanceof sS){if(this.logger.debug(r),this.config.throwOnError)throw r}else throw r;return[3,5];case 5:try{this.flags.store()}catch(e){}return this.mergeInitialFlagsWithStorage(),[2]}})})},e.prototype.storeVariants=function(e,t){return sM(this,void 0,void 0,function(){var r,n,i,o;return sN(this,function(s){for(o in 0===(r=t&&t.flagKeys?t.flagKeys:[]).length&&this.variants.clear(),n=function(t){r=r.filter(function(e){return e!==t}),i.variants.put(t,e[t])},i=this,e)n(o);for(o in r)this.variants.remove(o);try{this.variants.store()}catch(e){}return this.logger.debug("[Experiment] Stored variants: ",e),[2]})})},e.prototype.startRetries=function(e,t){return sM(this,void 0,void 0,function(){var r=this;return sN(this,function(n){return this.logger.debug("[Experiment] Retry fetch"),this.retriesBackoff=new ai(8,500,1e4,1.5),this.retriesBackoff.start(function(){return sM(r,void 0,void 0,function(){return sN(this,function(r){switch(r.label){case 0:return[4,this.fetchInternal(e,1e4,!1,t)];case 1:return r.sent(),[2]}})})}),[2]})})},e.prototype.stopRetries=function(){this.retriesBackoff&&this.retriesBackoff.cancel()},e.prototype.addContext=function(e){var t,r=null==(t=this.userProvider)?void 0:t.getUser(),n=this.integrationManager.getUser(),i=sR(sR(sR({},null==r?void 0:r.user_properties),n.user_properties),null==e?void 0:e.user_properties);return sR(sR(sR(sR({library:"experiment-js-client/".concat(sJ)},r),n),e),{user_properties:i})},e.prototype.addContextOrWait=function(e){return sM(this,void 0,void 0,function(){return sN(this,function(t){switch(t.label){case 0:return[4,this.integrationManager.ready()];case 1:return t.sent(),[2,this.addContext(e)]}})})},e.prototype.sourceVariants=function(){return this.config.source==X.LocalStorage?this.variants.getAll():this.config.source==X.InitialVariants?this.config.initialVariants:void 0},e.prototype.secondaryVariants=function(){return this.config.source==X.LocalStorage?this.config.initialVariants:this.config.source==X.InitialVariants?this.variants.getAll():void 0},e.prototype.exposureInternal=function(e,t){if(null==(i=null==(n=null==(r=t.variant)?void 0:r.metadata)?void 0:n.trackExposure)||i){this.legacyExposureInternal(e,t.variant,t.source);var r,n,i,o,s,a,u,l,c,d={flag_key:e},f=sH(t.source);if(!f||t.hasDefaultVariant){(null==(o=t.variant)?void 0:o.expKey)&&(d.experiment_key=null==(s=t.variant)?void 0:s.expKey);var h=null==(a=t.variant)?void 0:a.metadata;if(f||(null==h?void 0:h.default)||((null==(u=t.variant)?void 0:u.key)?d.variant=t.variant.key:(null==(l=t.variant)?void 0:l.value)&&(d.variant=t.variant.value)),h&&(d.metadata=h),this.isWebExperiment&&(d.time=Date.now()),this.isWebExperiment){var p=sx();if(null==p?void 0:p.location)try{var g=p.location.href;d.metadata.url=g.split("?")[0]||""}catch(e){}}var v=this.addContext(this.getUser());null==(c=this.userSessionExposureTracker)||c.track(d,v),this.integrationManager.track(d,v)}}},e.prototype.legacyExposureInternal=function(e,t,r){var n,i,o,s,a;if(this.analyticsProvider){var u=s9(this.addContext(this.getUser()),e,t,r);!sH(r)&&(null==t?void 0:t.value)?(null==t?void 0:t.value)&&(null==(s=null==(o=this.analyticsProvider)?void 0:o.setUserProperty)||s.call(o,u),null==(a=this.analyticsProvider)||a.track(u)):null==(i=null==(n=this.analyticsProvider)?void 0:n.unsetUserProperty)||i.call(n,u)}},e.getLogLevel=function(e){var t;return!0===e.debug?$.Debug:null!=(t=e.logLevel)?t:$.Error},e.prototype.shouldRetryFetch=function(e){return!(e instanceof sw)||e.statusCode<400||e.statusCode>=500||429===e.statusCode}
2,e.prototype.addPlugin=function(e){"integration"===e.type&&this.integrationManager.setIntegration(e)},e}(),ad=function(){function e(e,t){var r,n,i;this.globalScope=sx(),this.userAgent=void 0!==(null==(r=this.globalScope)?void 0:r.navigator)?null==(n=this.globalScope)?void 0:n.navigator.userAgent:void 0,this.ua=new sP.UAParser(this.userAgent).getResult(),this.localStorage=new s1,this.sessionStorage=new s7,this.userProvider=e,this.apiKey=t,this.storageKey="EXP_".concat(null==(i=this.apiKey)?void 0:i.slice(0,10),"_DEFAULT_USER_PROVIDER")}return e.prototype.getUser=function(){var e,t,r,n,i,o=(null==(e=this.userProvider)?void 0:e.getUser())||{};return sR({language:this.getLanguage(),platform:"Web",os:this.getOs(this.ua),device_model:this.getDeviceModel(this.ua),device_category:null!=(r=null==(t=this.ua.device)?void 0:t.type)?r:"desktop",referring_url:null==(i=null==(n=this.globalScope)?void 0:n.document)?void 0:i.referrer.replace(/\/$/,""),cookie:this.getCookie(),browser:this.getBrowser(this.ua),landing_url:this.getLandingUrl(),first_seen:this.getFirstSeen(),url_param:this.getUrlParam(),user_agent:this.userAgent},o)},e.prototype.getLanguage=function(){return"u">typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},e.prototype.getOs=function(e){var t,r;return[null==(t=e.browser)?void 0:t.name,null==(r=e.browser)?void 0:r.major].filter(function(e){return null!=e}).join(" ")},e.prototype.getDeviceModel=function(e){var t;return null==(t=e.os)?void 0:t.name},e.prototype.getBrowser=function(e){var t,r=null==(t=e.browser)?void 0:t.name;return(null==r?void 0:r.includes("Chrom"))&&(r="Chrome"),(null==r?void 0:r.includes("Firefox"))&&(r="Firefox"),(null==r?void 0:r.includes("Safari"))&&(r="Safari"),(null==r?void 0:r.includes("Edge"))&&(r="Edge"),(null==r?void 0:r.includes("Opera"))&&(r="Opera"),r},e.prototype.getCookie=function(){var e,t,r,n,i;if(null==(t=null==(e=this.globalScope)?void 0:e.document)?void 0:t.cookie)return Object.fromEntries(null==(i=null==(n=null==(r=this.globalScope)?void 0:r.document)?void 0:n.cookie)?void 0:i.split("; ").map(function(e){return e.split("=")}))},e.prototype.getLandingUrl=function(){var e,t;try{var r=JSON.parse(this.sessionStorage.get(this.storageKey)||"{}");return r.landing_url||(r.landing_url=null==(t=null==(e=this.globalScope)?void 0:e.location)?void 0:t.href.replace(/\/$/,""),this.sessionStorage.put(this.storageKey,JSON.stringify(r))),r.landing_url}catch(e){return}},e.prototype.getFirstSeen=function(){try{var e=JSON.parse(this.localStorage.get(this.storageKey)||"{}");return e.first_seen||(e.first_seen=(Date.now()/1e3).toString(),this.localStorage.put(this.storageKey,JSON.stringify(e))),e.first_seen}catch(e){return}},e.prototype.getUrlParam=function(){if(this.globalScope){var e,t,r,n={};try{var i=new URL(this.globalScope.location.href);try{for(var o=sD(i.searchParams),s=o.next();!s.done;s=o.next()){var a=sL(s.value,2),u=a[0],l=a[1];n[u]=sU(sU([],sL(null!=(r=n[u])?r:[]),!1),sL(l.split(",")),!1)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}}catch(e){return}return Object.entries(n).reduce(function(e,t){var r=sL(t,2),n=r[0],i=r[1];return e[n]=1==i.length?i[0]:i,e},{})}},e}();sI.experimentInstances={};var af=sI.experimentInstances,ah=function(e){return(null==e?void 0:e.instanceName)||sG.instanceName},ap=function(e,t){var r=ah(t),n=null==t?void 0:t.internalInstanceNameSuffix;return n?"".concat(r,".").concat(e,".").concat(n):"".concat(r,".").concat(e)},ag=function(e,t,r){var n=ap(e,t),i=af[n];return i?i:(i=new ac(e,sR(sR({},t),{userProvider:new ad(null==t?void 0:t.userProvider,e)})),r&&i.addPlugin(r()),af[n]=i,i)};function av(){}av.prototype.getUser=function(){return{}},av.prototype.start=function(e){return sM(this,void 0,void 0,function(){return sN(this,function(e){return[2]})})},av.prototype.stop=function(){},av.prototype.setUser=function(e){},av.prototype.fetch=function(e,t){return sM(this,void 0,void 0,function(){return sN(this,function(e){return[2,this]})})},av.prototype.getUserProvider=function(){return null},av.prototype.setUserProvider=function(e){return this},av.prototype.variant=function(e,t){return sG.fallbackVariant},av.prototype.all=function(){return{}},av.prototype.clear=function(){}
2,av.prototype.exposure=function(e){};var am=function(e){function t(t){void 0===t&&(t={});var r=e.call(this)||this;return r.customHeaders=t,r}return(0,es.__extends)(t,e),t.prototype.send=function(e,t){return(0,es.__awaiter)(this,void 0,void 0,function(){var r,n;return(0,es.__generator)(this,function(i){switch(i.label){case 0:if("u"<typeof fetch)throw Error("FetchTransport is not supported");return[4,fetch(e,{headers:(0,es.__assign)({"Content-Type":"application/json",Accept:"*/*"},this.customHeaders),body:JSON.stringify(t),method:"POST"})];case 1:return[4,(r=i.sent()).text()];case 2:n=i.sent();try{return[2,this.buildResponse(JSON.parse(n))]}catch(e){return[2,this.buildResponse({code:r.status})]}}})})},t}(t6),ay="[Amplitude]",ab="".concat(ay," Session Replay ID"),a_=J.US,aw={enabled:!0},aS="".concat(ay," Session Replay Debug"),aE="amp-mask",ak="https://api-sr.amplitude.com/sessions/v2/track",aI="https://api-sr.eu.amplitude.com/sessions/v2/track",ax="https://api-sr.stag2.amplitude.com/sessions/v2/track";(_=Q||(Q={})).GET_SR_PROPS="get-sr-props",_.DEBUG_INFO="debug-info",_.FETCH_REQUEST="fetch-request",_.METADATA="metadata",_.TARGETING_DECISION="targeting-decision";var aT=function(){function e(e){this.logger=e,this.log=this.getSafeMethod("log"),this.warn=this.getSafeMethod("warn"),this.error=this.getSafeMethod("error"),this.debug=this.getSafeMethod("debug")}return e.prototype.getSafeMethod=function(e){if(!this.logger)return function(){};var t,r=this.logger[e];return"function"==typeof r?(null!=(t=r.__rrweb_original__)?t:r).bind(this.logger):function(){}},e.prototype.enable=function(e){this.logger.enable(e)},e.prototype.disable=function(){this.logger.disable()},e}(),aC="medium",aP=function(e,t,r){switch(t){case"light":if("input"!==e)return!0;var n,i,o=r?(i=(n=r).type,n.hasAttribute("data-rr-is-password")?"password":i?i.toLowerCase():null):"";if(!o)return!1;if(["password","hidden","email","tel"].includes(o)||r.autocomplete.startsWith("cc-"))return!0;return!1;case"medium":case"conservative":return!0;default:return aP(e,aC,r)}},aO=function(e,t,r){var n,i,o;if(void 0===t&&(t={defaultMaskLevel:aC}),r){if(r.closest("."+aE)||(null!=(n=t.maskSelector)?n:[]).some(function(e){return r.closest(e)}))return!0;if(r.closest(".amp-unmask")||(null!=(i=t.unmaskSelector)?i:[]).some(function(e){return r.closest(e)}))return!1}return aP(e,null!=(o=t.defaultMaskLevel)?o:aC,r)},aA=function(e,t){return function(r,n){return aO(e,t,n)?r.replace(/[^\s]/g,"*"):r}},aR=function(){var e=(0,eU.getGlobalScope)();return(null==e?void 0:e.location)?e.location.href:""},aM=function(e){var t=e.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*").replace(/\?/g,".");return new RegExp("^".concat(t,"$"))},aN=function(e){if(!e.every(function(e){return"string"==typeof e.selector&&"string"==typeof e.replacement}))throw Error("ugcFilterRules must be an array of objects with selector and replacement properties");if(!e.every(function(e){var t;return"string"==typeof(t=e.selector)&&""!==t.trim()&&!!/^\/|^https?:\/\/[^\s]+$/.test(t)}))throw Error("ugcFilterRules must be an array of objects with valid globs")},aD=function(e,t){var r,n;try{for(var i=(0,es.__values)(t),o=i.next();!o.done;o=i.next()){var s=o.value,a=aM(s.selector);if(a.test(e))return e.replace(a,s.replacement)}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return e},aL=function(){return(0,es.__awaiter)(void 0,void 0,void 0,function(){var e,t,r,n;return(0,es.__generator)(this,function(i){switch(i.label){case 0:if(i.trys.push([0,3,,4]),!(e=(0,eU.getGlobalScope)()))return[3,2];return[4,e.navigator.storage.estimate()];case 1:return r=(t=i.sent()).usage,n=t.quota,[2,{totalStorageSize:r?Math.round(r/1024):0,percentOfQuota:r&&n?Math.round((r/n+Number.EPSILON)*1e3)/1e3:0,usageDetails:JSON.stringify(t.usageDetails)}];case 2:return[3,4];case 3:return i.sent(),[3,4];case 4:return[2,{totalStorageSize:0,percentOfQuota:0,usageDetails:""}]}})})},aU=function(e){var t=(0,es.__assign)({},e),r=t.apiKey;return t.apiKey="****".concat(r.substring(r.length-4)),t},aq=function(){return{flushMaxRetries:2,logLevel:M.Warn,loggerProvider:new eJ,transportProvider:new am}},aj=function(e){function t(t,r){var n,i,o,s,a,u,l=this,c=aq();return(l=e.call(this,(0,es.__assign)((0,es.__assign)({transportProvider:c.transportProvider,loggerProvider:new aT(r.loggerProvider||c.loggerProvider)},r),{apiKey:t}))||this).flushMaxRetries=void 0!==r.flushMaxRetries&&r.flushMaxRetries<=c.flushMaxRetries?r.flushMaxRetries:c.flushMaxRetries,l.apiKey=t,l.sampleRate=r.sampleRate||0,l.serverZone=r.serverZone||a_,l.configServerUrl=r.configServerUrl,l.trackServerUrl=r.trackServerUrl,l.shouldInlineStylesheet=r.shouldInlineStylesheet,l.version=r.version,l.performanceConfig=r.performanceConfig||aw,l.storeType=null!=(n=r.storeType)?n:"idb",l.applyBackgroun
2dColorToBlockedElements=null!=(i=r.applyBackgroundColorToBlockedElements)&&i,l.enableUrlChangePolling=null!=(o=r.enableUrlChangePolling)&&o,l.urlChangePollingInterval=null!=(s=r.urlChangePollingInterval)?s:1e3,l.captureDocumentTitle=null!=(a=r.captureDocumentTitle)&&a,r.privacyConfig&&(l.privacyConfig=r.privacyConfig),r.interactionConfig&&(l.interactionConfig=r.interactionConfig,l.interactionConfig.ugcFilterRules&&aN(l.interactionConfig.ugcFilterRules)),r.debugMode&&(l.debugMode=r.debugMode),void 0!==r.useWebWorker?l.useWebWorker=r.useWebWorker:(null==(u=r.experimental)?void 0:u.useWebWorker)!==void 0&&(l.useWebWorker=r.experimental.useWebWorker),r.omitElementTags&&(l.omitElementTags=r.omitElementTags),l}return(0,es.__extends)(t,e),t}(eX),aF=((w=aF||{})[w.DomContentLoaded=0]="DomContentLoaded",w[w.Load=1]="Load",w[w.FullSnapshot=2]="FullSnapshot",w[w.IncrementalSnapshot=3]="IncrementalSnapshot",w[w.Meta=4]="Meta",w[w.Custom=5]="Custom",w[w.Plugin=6]="Plugin",w),aB=((S=aB||{})[S.Mutation=0]="Mutation",S[S.MouseMove=1]="MouseMove",S[S.MouseInteraction=2]="MouseInteraction",S[S.Scroll=3]="Scroll",S[S.ViewportResize=4]="ViewportResize",S[S.Input=5]="Input",S[S.TouchMove=6]="TouchMove",S[S.MediaInteraction=7]="MediaInteraction",S[S.StyleSheetRule=8]="StyleSheetRule",S[S.CanvasMutation=9]="CanvasMutation",S[S.Font=10]="Font",S[S.Log=11]="Log",S[S.Drag=12]="Drag",S[S.StyleDeclaration=13]="StyleDeclaration",S[S.Selection=14]="Selection",S[S.AdoptedStyleSheet=15]="AdoptedStyleSheet",S[S.CustomElement=16]="CustomElement",S),aV=((E=aV||{})[E.MouseUp=0]="MouseUp",E[E.MouseDown=1]="MouseDown",E[E.Click=2]="Click",E[E.ContextMenu=3]="ContextMenu",E[E.DblClick=4]="DblClick",E[E.Focus=5]="Focus",E[E.Blur=6]="Blur",E[E.TouchStart=7]="TouchStart",E[E.TouchMove_Departed=8]="TouchMove_Departed",E[E.TouchEnd=9]="TouchEnd",E[E.TouchCancel=10]="TouchCancel",E),aK=((k=aK||{})[k.Mouse=0]="Mouse",k[k.Pen=1]="Pen",k[k.Touch=2]="Touch",k),aW=((I=aW||{})[I["2D"]=0]="2D",I[I.WebGL=1]="WebGL",I[I.WebGL2=2]="WebGL2",I),az=((x=az||{})[x.Play=0]="Play",x[x.Pause=1]="Pause",x[x.Seeked=2]="Seeked",x[x.VolumeChange=3]="VolumeChange",x[x.RateChange=4]="RateChange",x),aH=((T=aH||{}).Start="start",T.Pause="pause",T.Resume="resume",T.Resize="resize",T.Finish="finish",T.FullsnapshotRebuilded="fullsnapshot-rebuilded",T.LoadStylesheetStart="load-stylesheet-start",T.LoadStylesheetEnd="load-stylesheet-end",T.SkipStart="skip-start",T.SkipEnd="skip-end",T.MouseInteraction="mouse-interaction",T.EventCast="event-cast",T.CustomEvent="custom-event",T.Flush="flush",T.StateChange="state-change",T.PlayBack="play-back",T.Destroy="destroy",T),aG=((C=aG||{})[C.Document=0]="Document",C[C.DocumentType=1]="DocumentType",C[C.Element=2]="Element",C[C.Text=3]="Text",C[C.CDATA=4]="CDATA",C[C.Comment=5]="Comment",C),aJ=function(e,t){var r=document.createDocumentFragment(),n=function(e){if(void 0===e&&(e=[]),"string"==typeof e&&(e=[e]),0!==(e=e.filter(function(e){try{r.querySelector(e)}catch(r){return t.warn('[session-replay-browser] omitting selector "'.concat(e,'" because it is invalid')),!1}return!0})).length)return e};return e.blockSelector=n(e.blockSelector),e.maskSelector=n(e.maskSelector),e.unmaskSelector=n(e.unmaskSelector),e},a$=function(){function e(e,t){this.localConfig=t,this.remoteConfigClient=e}return e.prototype.generateJoinedConfig=function(){var e,t,r,n,i;return(0,es.__awaiter)(this,void 0,void 0,function(){var o,s,a,u,l,c,d,f,h,p,g,v,m,y,b,_,w,S=this;return(0,es.__generator)(this,function(E){switch(E.label){case 0:(o=(0,es.__assign)({},this.localConfig)).optOut=this.localConfig.optOut,o.captureEnabled=!0,E.label=1;case 1:return E.trys.push([1,3,,4]),[4,new Promise(function(e,t){S.remoteConfigClient.subscribe("configs.sessionReplay","all",function(r,n){if(S.localConfig.loggerProvider.debug("Session Replay remote configuration received from ".concat(n,":"),JSON.stringify(r,null,2)),!r)return void t(Error("No remote config received"));var i,a=r.sr_sampling_config,u=r.sr_privacy_config,l=r.sr_targeting_config,c=null==(i=o.interactionConfig)?void 0:i.ugcFilterRules;o.interactionConfig=r.sr_interaction_config,o.interactionConfig&&c&&(o.interactionConfig.ugcFilterRules=c),o.loggingConfig=r.sr_logging_config,(a||u||l)&&(s={},a&&(s.sr_sampling_config=a),u&&(s.sr_privacy_config=u),l&&(s.sr_targeting_config=l)),e()})})];case 2:return E.sent(),[3,4];case 3:return a=E.sent(),this.localConfig.loggerProvider.error("Failed to generate joined config: ",a),o.captureEnabled=!1,[2,{localConfig:this.localConfig,joinedConfig:o,remoteConfig:void 0}];case 4:if(!s)return[2,{localConfig:this.localConfig,joinedConfig:o,remoteConfig:s}];if(u=s.sr_sampling_config,l=s.sr_privacy_config,c=s.sr_targeting_config,u&&Object.keys(u).length>0?(Object.prototype.hasOwnProperty.call(u,"capture_enabled")?o.captureEnabled=u.capture_enabled:o.captureEnabled=!1,Object.prototype.hasOwnProperty.call(u,"sample_rate")&&(o.sampleRate=u.sample_rate)):(o.captureEnabled=!0,this.localConfig.loggerProvider.debug("Remote config successfully fetched, but no values set for project, Session Replay capture enabled.")),l){d=null!=(e=o.privacyConfig)?e:{},f={defaultMaskLevel:null!=(r=null!=(t=l.defaultMaskLevel)?t:d.defaultMaskLevel)?r:"medium",blockSelector:[],maskSelector:[],unmaskSelector:[],maskAttributes:(0,es.__spreadArray)([],(0,es.__read)(new Set((0,es.__spreadArray)((0,es.__spreadArray)([],(0,es.__read)(null!=(n=d.maskAttributes)?n:[]),!1),(0,es.__read)(null!=(i=l.maskAttributes)?i:[]),!1))),!1)},h=function(e){var t,r,n,i,o,s,a,u,l,c={};"string"==typeof e.blockSelector&&(e.blockSelector=[e.blockSelector]);try{for(var d=(0,es.__values)(null!=(a=e.blockSelector)?a:[]),f=d.next();!f.done;f=d.next()){var h=f.value;c[h]="block"}}catch(e){t={error:e}}finally{try{f&&!f.done&&(r=d.return)&&r.call(d)}finally{if(t)throw t.error}}try{for(var p=(0,es.__values)(null!=(u=e.maskSelector)?u:[]),g=p.next();!g.done;g=p.next()){var h=g.value;c[h]="mask"}}catch(e){n={error:e}}finally{try{g&&!g.done&&(i=p.return)&&i.call(p)}finally{if(n)throw n.error}}try{for(var v=(0,es.__values)(null!=(l=e.unmaskSelector)?l:[]),m=v.next();!m.done;m=v.next()){var h=m.value;c[h]="unmask"}}catch(e){o={error:e}}finally{try{m&&!m.done&&(s=v.return)&&s.call(v)}finally{if(o)throw o.error}}return c},p=(0,es.__assign)((0,es.__assign)({},h(d)),h(l));try{for(v=(g=(0,es.__values)(Object.entries(p))).next();!v.done;v=g.next())y=(m=(0,es.__read)(v.value,2))[0],b=m[1],"mask"===b?f.maskSelector.push(y):"block"===b?f.blockSelector.push(y):"unmask"===b&&f.unmaskSelector.push(y)}catch(e){_={error:e}}finally{try{v&&!v.done&&(w=g.return)&&w.call(g)}finally{if(_)throw _.error}}o.privacyConfig=aJ(f,this.localConfig.loggerProvider)}return c&&Object.keys(c).length>0&&(o.targetingConfig=c),this.localConfig.loggerProvider.debug(JSON.stringify({name:"session replay joined config",config:aU(o)},null,2)),[2,{localConfig:this.localConfig,joinedConfig:o,remoteConfig:s}]}})})},e}();function aX(e,t){return t||("STAGING"===e?ax:"EU"===e?aI:ak)}var aY=function(){function e(e,t,r,n,i){var o,s=this;this.taskQueue=[],this.isProcessing=!1,this.compressEvent=function(e){var t=e.type,r=e.timestamp,n=e.delay,i=e.data;return null!=n?JSON.stringify({type:t,timestamp:r,delay:n,data:i}):JSON.stringify({type:t,timestamp:r,data:i})},this.addCompressedEventToManager=function(e,t){s.eventsManager&&s.deviceId&&s.eventsManager.addEvent({event:{type:"replay",data:e},sessionId:t,deviceId:s.deviceId})},this.addCompressedEvent=function(e,t){if(s.worker)try{s.worker.postMessage({event:e,sessionId:t})}catch(r){"DataCloneError"===r.name?s.worker.postMessage(JSON.stringify({event:e,sessionId:t})):s.config.loggerProvider.warn("Unexpected error while posting message to worker:",r)}else{var r=s.compressEvent(e);s.addCompressedEventToManager(r,t)}},this.terminate=function(){var e;null==(e=s.worker)||e.terminate()};var a=(0,eU.getGlobalScope)();if(this.canUseIdleCallback=a&&"requestIdleCallback"in a,this.eventsManager=e,this.config=t,this.deviceId=r,this.timeout=(null==(o=t.performanceConfig)?void 0:o.timeout)||2e3,this.onFullSnapshotProcessed=i,n){t.loggerProvider.log("Enabling web worker for compression");try{var u=new Blob([n],{type:"application/javascript"}),l=URL.createObjectURL(u),c=new Worker(l);c.onerror=function(e){e.preventDefault(),t.loggerProvider.error("Worker failed, falling back to non-worker compression: ".concat(e.message," (").concat(e.filename,":").concat(e.lineno,")")),c.terminate(),s.worker=void 0},c.onmessage=function(e){var t=e.data,r=t.compressedEvent,n=t.sessionId;s.addCompressedEventToManager(r,n)},this.worker=c}catch(e){t.loggerProvider.error("Failed to create worker, falling back to non-worker compression:",e)}}}return e.prototype.scheduleIdleProcessing=function(){var e=this;this.isProcessing||(this.isProcessing=!0,requestIdleCallback(function(t){e.processQueue(t)},{timeout:this.timeout}))},e.prototype.enqueueEvent=function(e,t){if(e.type===aF.FullSnapshot){if(this.config.loggerProvider.debug("Processing full snapshot immediately."),this.taskQueue.length>0){try{for(var r,n,i,o,s=(0,es.__values)(this.taskQueue.splice(0)),a=s.next();!a.done;a=s.next()){var u=a.value,l=this.compressEvent(u.event);this.addCompressedEventToManager(l,u.sessionId)}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}this.isProcessing=!1}var c=this.compressEvent(e);this.addCompressedEventToManager(c,t),null==(i=this.onFullSnapshotProcessed)||i.call(this);return}this.canUseIdleCallback&&(null==(o=this.config.performanceConfig)?void 0:o.enabled)?(this.config.loggerProvider.debug("Enqueuing event for processing during idle time."),this.taskQueue.push({event:e,sessionId:t}),this.scheduleIdleProcessing()):(this.config.loggerProvider.debug("Processing event without idle callback."),this.addCompressedEvent(e,t))},e.prototype.processQueue=function(e){for(var t=this;this.taskQueue.length>0&&(e.timeRemaining()>0||e.didTimeout);){var r=this.taskQueue.shift();if(r){var n=r.event,i=r.sessionId;this.addCompressedEvent(n,i)}}this.taskQueue.length>0?requestIdleCallback(function(e){t.processQueue(e)},{timeout:this.timeout}):this.isProcessing=!1},e}(),aQ="Session replay event batch rejected due to exceeded retry count",aZ="Failed to store session replay events in IndexedDB",a0="1.36.2",a1=function(){function e(e){var t=e.trackServerUrl,r=e.loggerProvider,n=e.payloadBatcher,i=e.workerScript,o=this;if(this.storageKey="",this.retryTimeout=1e3,this.scheduled=null,this.queue=[],this.sendIdCounter=0,this.pendingWorkerRequests=new Map,this.loggerProvider=r,this.payloadBatcher=n||function(e){return e},this.trackServerUrl=t,i)try{var s=new Blob([i],{type:"application/javascript"}),a=URL.createObjectURL(s),u=new Worker(a);u.onerror=function(e){var t,n;e.preventDefault(),r.error("Track destination worker failed, falling back to main-thread sending: ".concat(e.message," (").concat(e.filename,":").concat(e.lineno,")")),u.terminate(),o.worker=void 0;
2try{for(var i=(0,es.__values)(o.pendingWorkerRequests),s=i.next();!s.done;s=i.next()){var a=(0,es.__read)(s.value,2)[1];r.warn("Session replay event send failed due to worker crash: ".concat(e.message)),a.resolve()}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}o.pendingWorkerRequests.clear()},u.onmessage=function(e){var t=e.data;if("log"===t.type)r.log(t.message);else if("warn"===t.type)r.warn(t.message);else if("complete"===t.type){var n=o.pendingWorkerRequests.get(t.id);n&&(o.completeRequest({context:n.context}),n.resolve(),o.pendingWorkerRequests.delete(t.id))}},this.worker=u}catch(e){r.error("Failed to create track destination worker, falling back to main-thread sending:",e)}}return e.prototype.sendEventsList=function(e){this.addToQueue((0,es.__assign)((0,es.__assign)({},e),{attempts:0,timeout:0}))},e.prototype.sendBeacon=function(e){var t,r,n=e.events,i=e.sessionId,o=e.deviceId,s=e.apiKey,a=e.serverZone,u=function(e){return new Blob([e]).size},l=n,c=JSON.stringify({version:2,events:l});if(u(c)>65536){for(var d=0,f=l.length;d<f;){var h=Math.floor((d+f+1)/2);65536>=u(JSON.stringify({version:2,events:l.slice(0,h)}))?d=h:f=h-1}c=JSON.stringify({version:2,events:l=l.slice(0,d)}),this.loggerProvider.warn("sendBeacon payload exceeded 64 KB limit, trimmed from ".concat(n.length," to ").concat(l.length," events"))}if(0!==l.length){var p=new URLSearchParams({device_id:o,session_id:String(i),type:"replay",api_key:s}),g="".concat(aX(a,this.trackServerUrl),"?").concat(p.toString()),v=(0,eU.getGlobalScope)();try{var m=new Blob([c],{type:"application/json"}),y=null==(r=null==(t=null==v?void 0:v.navigator)?void 0:t.sendBeacon)?void 0:r.call(t,g,m);!1===y&&this.loggerProvider.warn("sendBeacon failed to queue session replay payload")}catch(e){}}},e.prototype.addToQueue=function(){for(var e=this,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];t.filter(function(t){return t.attempts<(t.flushMaxRetries||0)?(t.attempts+=1,!0):(e.completeRequest({context:t,err:aQ}),!1)}).forEach(function(t){e.queue=e.queue.concat(t),e.schedule(0)})},e.prototype.schedule=function(e){var t=this;this.scheduled||(this.scheduled=setTimeout(function(){t.flush(!0).then(function(){t.queue.length>0&&t.schedule(e)})},e))},e.prototype.flush=function(e){return void 0===e&&(e=!1),(0,es.__awaiter)(this,void 0,void 0,function(){var t,r,n,i,o,s;return(0,es.__generator)(this,function(a){switch(a.label){case 0:t=this.queue,this.queue=[],this.scheduled&&(clearTimeout(this.scheduled),this.scheduled=null),a.label=1;case 1:a.trys.push([1,6,7,8]),n=(r=(0,es.__values)(t)).next(),a.label=2;case 2:if(n.done)return[3,5];return i=n.value,[4,this.send(i,e)];case 3:a.sent(),a.label=4;case 4:return n=r.next(),[3,2];case 5:return[3,8];case 6:return o={error:a.sent()},[3,8];case 7:try{n&&!n.done&&(s=r.return)&&s.call(r)}finally{if(o)throw o.error}return[7];case 8:return[2]}})})},e.prototype.send=function(e,t){return void 0===t&&(t=!0),(0,es.__awaiter)(this,void 0,void 0,function(){var r,n,i,o;return(0,es.__generator)(this,function(s){return(r=e.apiKey)?(n=e.deviceId)?0===(i=this.payloadBatcher({version:1,events:e.events})).events.length?(this.completeRequest({context:e}),[2]):(o=this.worker)?[2,this.sendViaWorker(o,e,i,t)]:[2,this.sendOnMainThread(r,n,e,i,t)]:[2,this.completeRequest({context:e,err:"Session replay event batch not sent due to missing device ID"})]:[2,this.completeRequest({context:e,err:"Session replay event batch not sent due to missing api key"})]})})},e.prototype.sendViaWorker=function(e,t,r,n){return(0,es.__awaiter)(this,void 0,void 0,function(){var i,o=this;return(0,es.__generator)(this,function(s){return i="".concat(++this.sendIdCounter),[2,new Promise(function(s){var a;o.pendingWorkerRequests.set(i,{context:t,resolve:s}),e.postMessage({type:"send",id:i,payload:r,useRetry:n,context:{apiKey:t.apiKey,deviceId:t.deviceId,sessionId:t.sessionId,events:t.events,eventType:t.type,flushMaxRetries:null!=(a=t.flushMaxRetries)?a:0,sampleRate:t.sampleRate,serverZone:t.serverZone,trackServerUrl:o.trackServerUrl,version:t.version,currentUrl:aR(),sdkVersion:a0}})})]})})},e.prototype.sendOnMainThread=function(e,t,r,n,i){var o,s,a,u;return(0,es.__awaiter)(this,void 0,void 0,function(){var l,c,d,f,h,p,g,v,m,y,b,_,w;return(0,es.__generator)(this,function(S){switch(S.label){case 0:l=aR(),c=a0,d=r.sampleRate,f=new
2URLSearchParams({device_id:t,session_id:"".concat(r.sessionId),type:"".concat(r.type)}),h="".concat(null!=(s=null==(o=r.version)?void 0:o.type)?s:"standalone","/").concat(null!=(u=null==(a=r.version)?void 0:a.version)?u:c),S.label=1;case 1:if(S.trys.push([1,9,,10]),p=JSON.stringify(n),!((g=(0,eU.getGlobalScope)())&&"CompressionStream"in g))return[3,3];return[4,function(e,t){return(0,es.__awaiter)(this,void 0,void 0,function(){var r,n,i,o,s,a,u,l,c,d,f,h,p=this;return(0,es.__generator)(this,function(g){switch(g.label){case 0:return g.trys.push([0,4,,5]),n=(r=new t.CompressionStream("gzip")).writable.getWriter(),i=r.readable.getReader(),o=[],s=(0,es.__awaiter)(p,void 0,void 0,function(){var e,t,r;return(0,es.__generator)(this,function(n){switch(n.label){case 0:return[4,i.read()];case 1:if(t=(e=n.sent()).done,r=e.value,t)return[3,3];o.push(r),n.label=2;case 2:return[3,0];case 3:return[2]}})}),[4,n.write(new TextEncoder().encode(e))];case 1:return g.sent(),[4,n.close()];case 2:return g.sent(),[4,s];case 3:g.sent(),a=new Uint8Array(o.reduce(function(e,t){return e+t.length},0)),u=0;try{for(c=(l=(0,es.__values)(o)).next();!c.done;c=l.next())d=c.value,a.set(d,u),u+=d.length}catch(e){f={error:e}}finally{try{c&&!c.done&&(h=l.return)&&h.call(l)}finally{if(f)throw f.error}}return[2,a];case 4:return g.sent(),[2,null];case 5:return[2]}})})}(p,g)];case 2:return m=S.sent(),[3,4];case 3:m=null,S.label=4;case 4:return v=m,y={headers:(0,es.__assign)({"Content-Type":"application/json",Accept:"*/*",Authorization:"Bearer ".concat(e),"X-Client-Version":c,"X-Client-Library":h,"X-Client-Url":l.substring(0,1e3),"X-Client-Sample-Rate":"".concat(d),"X-Sampling-Hash-Alg":"xxhash32"},v?{"Content-Encoding":"gzip"}:{}),body:null!=v?v:p,method:"POST"},[4,fetch("".concat(aX(r.serverZone,this.trackServerUrl),"?").concat(f.toString()),y)];case 5:if(null===(b=S.sent()))return this.completeRequest({context:r,err:"Unexpected error occurred"}),[2];if(i)return[3,6];_="";try{_=JSON.stringify(b.body,null,2)}catch(e){}return this.completeRequest({context:r,success:"".concat(b.status,": ").concat(_)}),[3,8];case 6:return[4,this.handleReponse(b.status,r)];case 7:S.sent(),S.label=8;case 8:return[3,10];case 9:return w=S.sent(),this.completeRequest({context:r,err:w}),[3,10];case 10:return[2]}})})},e.prototype.handleReponse=function(e,t){return(0,es.__awaiter)(this,void 0,void 0,function(){return(0,es.__generator)(this,function(r){switch(r.label){case 0:switch(new t6().buildStatus(e)){case U.Success:return[3,1];case U.Failed:return[3,2]}return[3,4];case 1:return this.handleSuccessResponse(t),[3,5];case 2:return[4,this.handleOtherResponse(t)];case 3:return r.sent(),[3,5];case 4:this.completeRequest({context:t,err:"Network error occurred, event batch rejected"}),r.label=5;case 5:return[2]}})})},e.prototype.handleSuccessResponse=function(e){var t=Math.round(new Blob(e.events).size/1024);this.completeRequest({context:e,success:"Session replay event batch tracked successfully for session id ".concat(e.sessionId,", size of events: ").concat(t," KB")})},e.prototype.handleOtherResponse=function(e){return(0,es.__awaiter)(this,void 0,void 0,function(){var t;return(0,es.__generator)(this,function(r){switch(r.label){case 0:if(t=Math.random()*e.attempts*this.retryTimeout,e.attempts++,e.attempts>(e.flushMaxRetries||0))return this.completeRequest({context:e,err:aQ}),[2];return[4,new Promise(function(e){return setTimeout(e,t)})];case 1:return r.sent(),[4,this.send(e,!0)];case 2:return r.sent(),[2]}})})},e.prototype.completeRequest=function(e){var t=e.context,r=e.err,n=e.success;t.onComplete(),r?this.loggerProvider.warn(r):n&&this.loggerProvider.log(n)},e}(),a2=e.i(528120),a3=function(){function e(e){var t,r,n,i=this;this.minInterval=500,this.maxInterval=1e4,this.maxPersistedEventsSize=1e6,this.interval=this.minInterval,this._timeAtLastSplit=Date.now(),this.shouldSplitEventsList=function(e,t){var r=i.getStringSize(t);return i.getEventsArraySize(e)+r>=i.maxPersistedEventsSize||Date.now()-i.timeAtLastSplit>i.interval&&!!e.length&&(i.interval=Math.min(i.maxInterval,i.interval+i.minInterval),i._timeAtLastSplit=Date.now(),!0)},this.loggerProvider=e.loggerProvider,this.minInterval=null!=(t=e.minInterval)?t:this.minInterval,this.maxInterval=null!=(r=e.maxInterval)?r:this.maxInterval,this.maxPer
2sistedEventsSize=null!=(n=e.maxPersistedEventsSize)?n:this.maxPersistedEventsSize}return Object.defineProperty(e.prototype,"timeAtLastSplit",{get:function(){return this._timeAtLastSplit},enumerable:!1,configurable:!0}),e.prototype.getStringSize=function(e){return e.length},e.prototype.getEventsArraySize=function(e){var t,r,n=0;try{for(var i=(0,es.__values)(e),o=i.next();!o.done;o=i.next()){var s=o.value;n+=this.getStringSize(s)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return n+(2+Math.max(0,e.length-1)+2*e.length)},e}(),a4=function(e,t,r){"object"==typeof r&&null!==r&&"AbortError"===r.name?e.debug(t):e.warn(t)},a5="sessionCurrentSequence",a6="sequencesToSend",a8=function(e){var t,r;return e.objectStoreNames.contains(a5)||(r=e.createObjectStore(a5,{keyPath:"sessionId"})),e.objectStoreNames.contains(a6)||(t=e.createObjectStore(a6,{keyPath:"sequenceId",autoIncrement:!0})).createIndex("sessionId","sessionId"),{sequencesStore:t,currentSequenceStore:r}},a7=function(e){function t(t){var r=e.call(this,t)||this;return r.getSequencesToSend=function(){return(0,es.__awaiter)(r,void 0,void 0,function(){var e,t,r,n,i,o,s,a,u=this;return(0,es.__generator)(this,function(l){switch(l.label){case 0:e=!1,l.label=1;case 1:return l.trys.push([1,6,,7]),t=[],(r=this.db.transaction("sequencesToSend")).done.catch(function(t){e||a4(u.loggerProvider,"".concat(aZ,": ").concat(t),t)}),[4,r.store.openCursor()];case 2:n=l.sent(),l.label=3;case 3:if(!n)return[3,5];return o=(i=n.value).sessionId,s=i.events,t.push({events:s,sequenceId:n.key,sessionId:o}),[4,n.continue()];case 4:return n=l.sent(),[3,3];case 5:return[2,t];case 6:return a=l.sent(),e=!0,a4(this.loggerProvider,"".concat(aZ,": ").concat(a),a),[3,7];case 7:return[2,void 0]}})})},r.storeCurrentSequence=function(e){return(0,es.__awaiter)(r,void 0,void 0,function(){var t,r,n;return(0,es.__generator)(this,function(i){switch(i.label){case 0:return i.trys.push([0,4,,5]),[4,this.db.get(a5,e)];case 1:if(!(t=i.sent()))return[2,void 0];return[4,this.db.put(a6,{sessionId:e,events:t.events})];case 2:return r=i.sent(),[4,this.db.put(a5,{sessionId:e,events:[]})];case 3:return i.sent(),[2,(0,es.__assign)((0,es.__assign)({},t),{sessionId:e,sequenceId:r})];case 4:return n=i.sent(),a4(this.loggerProvider,"".concat(aZ,": ").concat(n),n),[3,5];case 5:return[2,void 0]}})})},r.addEventToCurrentSequence=function(e,t){return(0,es.__awaiter)(r,void 0,void 0,function(){var r,n,i,o,s,a,u=this;return(0,es.__generator)(this,function(l){switch(l.label){case 0:r=!1,l.label=1;case 1:return l.trys.push([1,9,,10]),(n=this.db.transaction([a5,a6],"readwrite")).done.catch(function(e){r||a4(u.loggerProvider,"".concat(aZ,": ").concat(e),e)}),[4,n.objectStore(a5).get(e)];case 2:if(i=l.sent())return[3,4];return[4,n.objectStore(a5).put({sessionId:e,events:[t]})];case 3:case 5:return l.sent(),[2,void 0];case 4:if(this.shouldSplitEventsList(i.events,t))return[3,6];return[4,n.objectStore(a5).put({sessionId:e,events:i.events.concat(t)})];case 6:return o=i.events,[4,n.objectStore(a5).put({sessionId:e,events:[t]})];case 7:return l.sent(),[4,n.objectStore(a6).put({sessionId:e,events:o})];case 8:return s=l.sent(),[2,{events:o,sessionId:e,sequenceId:s}];case 9:return a=l.sent(),r=!0,a4(this.loggerProvider,"".concat(aZ,": ").concat(a),a),[3,10];case 10:return[2,void 0]}})})},r.storeSendingEvents=function(e,t){return(0,es.__awaiter)(r,void 0,void 0,function(){var r;return(0,es.__generator)(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.db.put(a6,{sessionId:e,events:t})];case 1:return[2,n.sent()];case 2:return r=n.sent(),a4(this.loggerProvider,"".concat(aZ,": ").concat(r),r),[3,3];case 3:return[2,void 0]}})})},r.cleanUpSessionEventsStore=function(e,t){return(0,es.__awaiter)(r,void 0,void 0,function(){var e;return(0,es.__generator)(this,function(r){switch(r.label){case 0:if(!t)return[2];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.db.delete(a6,t)];case 2:return r.sent(),[3,4];case 3:return e=r.sent(),a4(this.loggerProvider,"".concat(aZ,": ").concat(e),e),[3,4];case 4:return[2]}})})},r.db=t.db,r}return(0,es.__extends)(t,e),t.new=function(e,r){return(0,es.__awaiter)(this,void 0,void 0,function(){var n,i,o;return(0,es.__generator)(this,function(s){switch(s.label){case 0:var a;return s.trys.push([0,2,,3]),n="replay"===e?"":"_".concat(e),[4,(a="".concat(r.a
2piKey.substring(0,10),"_amp_session_replay_events").concat(n),(0,es.__awaiter)(void 0,void 0,void 0,function(){return(0,es.__generator)(this,function(e){switch(e.label){case 0:return[4,(0,a2.openDB)(a,1,{upgrade:a8})];case 1:return[2,e.sent()]}})}))];case 1:return i=s.sent(),[2,new t((0,es.__assign)((0,es.__assign)({},r),{db:i}))];case 2:return o=s.sent(),a4(r.loggerProvider,"".concat(aZ,": ").concat(o),o),[3,3];case 3:return[2]}})})},t.prototype.getCurrentSequenceEvents=function(e){return(0,es.__awaiter)(this,void 0,void 0,function(){var t,r,n,i,o,s;return(0,es.__generator)(this,function(a){switch(a.label){case 0:if(!e)return[3,2];return[4,this.db.get("sessionCurrentSequence",e)];case 1:if(!(t=a.sent()))return[2,void 0];return[2,[t]];case 2:r=[],a.label=3;case 3:return a.trys.push([3,8,9,10]),[4,this.db.getAll("sessionCurrentSequence")];case 4:i=(n=es.__values.apply(void 0,[a.sent()])).next(),a.label=5;case 5:if(i.done)return[3,7];t=i.value,r.push(t),a.label=6;case 6:return i=n.next(),[3,5];case 7:return[3,10];case 8:return o={error:a.sent()},[3,10];case 9:try{i&&!i.done&&(s=n.return)&&s.call(n)}finally{if(o)throw o.error}return[7];case 10:return[2,r]}})})},t}(a3),a9=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.finalizedSequences={},t.sequences={},t.sequenceId=0,t}return(0,es.__extends)(t,e),t.prototype.resetCurrentSequence=function(e){this.sequences[e]=[]},t.prototype.addSequence=function(e){var t=this.sequenceId++,r=(0,es.__spreadArray)([],(0,es.__read)(this.sequences[e]),!1);return this.finalizedSequences[t]={sessionId:e,events:r},this.resetCurrentSequence(e),{sequenceId:t,events:r,sessionId:e}},t.prototype.getSequencesToSend=function(){return(0,es.__awaiter)(this,void 0,void 0,function(){return(0,es.__generator)(this,function(e){return[2,Object.entries(this.finalizedSequences).map(function(e){var t=(0,es.__read)(e,2),r=t[0],n=t[1],i=n.sessionId,o=n.events;return{sequenceId:Number(r),sessionId:i,events:o}})]})})},t.prototype.storeCurrentSequence=function(e){return(0,es.__awaiter)(this,void 0,void 0,function(){return(0,es.__generator)(this,function(t){return this.sequences[e]?[2,this.addSequence(e)]:[2,void 0]})})},t.prototype.addEventToCurrentSequence=function(e,t){return(0,es.__awaiter)(this,void 0,void 0,function(){var r;return(0,es.__generator)(this,function(n){return this.sequences[e]||this.resetCurrentSequence(e),this.shouldSplitEventsList(this.sequences[e],t)&&(r=this.addSequence(e)),this.sequences[e].push(t),[2,r]})})},t.prototype.storeSendingEvents=function(e,t){return(0,es.__awaiter)(this,void 0,void 0,function(){return(0,es.__generator)(this,function(r){return this.finalizedSequences[this.sequenceId]={sessionId:e,events:t},[2,this.sequenceId++]})})},t.prototype.cleanUpSessionEventsStore=function(e,t){return(0,es.__awaiter)(this,void 0,void 0,function(){return(0,es.__generator)(this,function(e){return void 0!==t&&delete this.finalizedSequences[t],[2]})})},t}(a3),ue=function(e){var t=e.config,r=e.minInterval,n=e.maxInterval,i=e.type,o=e.payloadBatcher,s=e.storeType,a=e.trackDestinationWorkerScript;return(0,es.__awaiter)(void 0,void 0,void 0,function(){var e,u,l,c,d,f,h,p;function g(t){return void 0===t&&(t=!1),(0,es.__awaiter)(this,void 0,void 0,function(){return(0,es.__generator)(this,function(r){return[2,e.flush(t)]})})}return(0,es.__generator)(this,function(v){switch(v.label){case 0:if(e=new a1((0,es.__assign)((0,es.__assign)({},t),{loggerProvider:t.loggerProvider,payloadBatcher:o,workerScript:a})),u=function(){return new a9({loggerProvider:t.loggerProvider,maxInterval:n,minInterval:r})},"idb"!==s)return[3,2];return[4,(0,es.__awaiter)(void 0,void 0,void 0,function(){var e;return(0,es.__generator)(this,function(o){switch(o.label){case 0:return[4,a7.new(i,{loggerProvider:t.loggerProvider,minInterval:r,maxInterval:n,apiKey:t.apiKey})];case 1:if(!(e=o.sent()))return t.loggerProvider.log("Failed to initialize idb store, falling back to memory store."),[2,u()];return[2,e]}})})];case 1:return c=v.sent(),[3,3];case 2:c=u(),v.label=3;case 3:return l=c,d=[],f=0,h=function(e){if(!(e<=f)){var t=Math.min(e-f,d.length);t>0&&(d.splice(0,t),f=e)}},p=function(r){var n=r.events,o=r.sessionId,s=r.deviceId,a=r.sequenceId;t.debugMode&&aL().then(function(e){var r=e.totalStorageSize,n=e.percentOfQuota,i=e.usageDetails;t.loggerProvider.debug("Total storage size: ".concat(r," KB, percentage of quota: ").concat(n,"%, usage details: ").concat(i))}).catch(function(){}),e.sendEventsList({events:n,sessionId:o,flushMaxRetries:t.flushMaxRetries,apiKey:t.apiKey,deviceId:s,sampleRate:t.sampleRate,serverZone:t.serverZone,version:t.version,type:i,onComplete:function(){return(0,es.__awaiter)(void 0,void 0,void 0,function(){return(0,es.__generator)(this,function(e){switch(e.label){case 0:return[4,l.cleanUpSessionEventsStore(o,a)];case 1:return e.sent(),[2]}})})}})},[2,{sendCurrentSequenceEvents:function(e){var r=e.sessionId,n=e.deviceId,i=f+d.length;l.storeCurrentSequence(r).then(function(e){e&&(h(i),p({sequenceId:e.sequenceId,events:e.events,sessionId:e.sessionId,deviceId:n}))}).catch(function(e){t.loggerProvider.warn("Failed to get current sequence of session replay events for session:",e)})},addEvent:function(e){var r=e.event,n=e.sessionId,i=e.deviceId,o=f+d.length;d.push(r.data),l.addEventToCurrentSequence(n,r.data).then(function(e){e&&(h(o),p({sequenceId:e.sequenceId,events:e.events,sessionId:e.sessionId,deviceId:i}))}).catch(function(e){t.loggerProvider.warn("Failed to add event to session replay capture:",e)})},sendStoredEvents:function(e){var t=e.deviceId;return(0,es.__awaiter)(void 0,void 0,void 0,function(){var e;return(0,es.__generator)(this,function(r){switch(r.label){case 0:return[4,l.getSequencesToSend()];case 1:return(e=r.sent())&&e.forEach(function(e){p({sequenceId:e.sequenceId,events:e.events,sessionId:e.sessionId,deviceId:t})}),[2]}})})},flush:g,getBeaconEvents:function(){return(0,es.__spreadArray)([],(0,es.__read)(d),!1)},trackDestination:e}]}})})},ut=function(){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=new Map;e.forEach(function(e){r.set(e.name,e.manager)}),this.managers=r}return e.prototype.sendStoredEvents=function(e){return(0,es.__awaiter)(this,void 0,void 0,function(){var t;return(0,es.__generator)(this,function(r){switch(r.label){case 0:return t=[],this.managers.forEac
2h(function(r){t.push(r.sendStoredEvents(e))}),[4,Promise.all(t)];case 1:return r.sent(),[2]}})})},e.prototype.addEvent=function(e){var t,r=e.sessionId,n=e.event,i=e.deviceId;null==(t=this.managers.get(n.type))||t.addEvent({sessionId:r,event:n,deviceId:i})},e.prototype.sendCurrentSequenceEvents=function(e){var t=e.sessionId,r=e.deviceId;this.managers.forEach(function(e){e.sendCurrentSequenceEvents({sessionId:t,deviceId:r})})},e.prototype.flush=function(e){return(0,es.__awaiter)(this,void 0,void 0,function(){var t;return(0,es.__generator)(this,function(r){switch(r.label){case 0:return t=[],this.managers.forEach(function(r){t.push(r.flush(e))}),[4,Promise.all(t)];case 1:return r.sent(),[2]}})})},e}();function ur(e,t,r){for(var n=null,i=[],o=e,s=0;o&&"break"!==function(){var e,a,u,l,c=new Date().getTime()-et.getTime();if(void 0!==Z.timeoutMs&&c>Z.timeoutMs)throw Error("Timeout: Can't find a unique selector after ".concat(c,"ms"));var d=uc((e=o.getAttribute("id"))&&Z.idName(e)?{name:"#"+CSS.escape(e),penalty:0}:null)||uc.apply(void 0,(0,es.__spreadArray)([],(0,es.__read)(Array.from(o.attributes).filter(function(e){return Z.attr(e.name,e.value)}).map(function(e){return{name:"[".concat(CSS.escape(e.name),'="').concat(CSS.escape(e.value),'"]'),penalty:.5}})),!1))||uc.apply(void 0,(0,es.__spreadArray)([],(0,es.__read)(Array.from(o.classList).filter(Z.className).map(function(e){return{name:"."+CSS.escape(e),penalty:1}})),!1))||uc((a=o.tagName.toLowerCase(),Z.tagName(a)?{name:a,penalty:2}:null))||[ua()],f=function(e){var t=e.parentNode;if(!t)return null;var r=t.firstChild;if(!r)return null;for(var n=0;r&&(r.nodeType===Node.ELEMENT_NODE&&n++,r!==e);)r=r.nextSibling;return n}(o);if("all"==t)f&&(d=d.concat(d.filter(ul).map(function(e){return uu(e,f)})));else if("two"==t)d=d.slice(0,1),f&&(d=d.concat(d.filter(ul).map(function(e){return uu(e,f)})));else if("one"==t){var h=(0,es.__read)(d=d.slice(0,1),1)[0];f&&ul(h)&&(d=[uu(h,f)])}else"none"==t&&(d=[ua()],f&&(d=[uu(d[0],f)]));try{for(var p=(u=void 0,(0,es.__values)(d)),g=p.next();!g.done;g=p.next()){var h=g.value;h.level=s}}catch(e){u={error:e}}finally{try{g&&!g.done&&(l=p.return)&&l.call(p)}finally{if(u)throw u.error}}if(i.push(d),i.length>=Z.seedMinLength&&(n=un(i,r)))return"break";o=o.parentElement,s++}(););return(n||(n=un(i,r)),!n&&r)?r():n}function un(e,t){var r,n,i=uf(function e(t,r){var n,i,o,s,a;return void 0===r&&(r=[]),(0,es.__generator)(this,function(u){switch(u.label){case 0:if(!(t.length>0))return[3,9];u.label=1;case 1:u.trys.push([1,6,7,8]),i=(n=(0,es.__values)(t[0])).next(),u.label=2;case 2:if(i.done)return[3,5];return o=i.value,[5,(0,es.__values)(e(t.slice(1,t.length),r.concat(o)))];case 3:u.sent(),u.label=4;case 4:return i=n.next(),[3,2];case 5:return[3,8];case 6:return s={error:u.sent()},[3,8];case 7:try{i&&!i.done&&(a=n.return)&&a.call(n)}finally{if(s)throw s.error}return[7];case 8:return[3,11];case 9:return[4,r];case 10:u.sent(),u.label=11;case 11:return[2]}})}(e));if(i.length>Z.threshold)return t?t():null;try{for(var o=(0,es.__values)(i),s=o.next();!s.done;s=o.next()){var a=s.value;if(us(a))return a}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return null}function ui(e){for(var t=e[0],r=t.name,n=1;n<e.length;n++){var i=e[n].level||0;r=t.level===i-1?"".concat(e[n].name," > ").concat(r):"".concat(e[n].name," ").concat(r),t=e[n]}return r}function uo(e){return e.map(function(e){return e.penalty}).reduce(function(e,t){return e+t},0)}function us(e){var t=ui(e);switch(ee.querySelectorAll(t).length){case 0:throw Error("Can't select any node with this selector: ".concat(t));case 1:return!0;default:return!1}}function ua(){return{name:"*",penalty:3}}function uu(e,t){return{name:e.name+":nth-child(".concat(t,")"),penalty:e.penalty+1}}function ul(e){return"html"!==e.name&&!e.name.startsWith("#")}function uc(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e.filter(ud);return r.length>0?r:null}function ud(e){return null!=e}function uf(e){return(0,es.__spreadArray)([],(0,es.__read)(e),!1).sort(function(e,t){return uo(e)-uo(t)})}var uh=function(e){var t=e.version,r=e.events,n=[];return r.forEach(function(e){var t=JSON.parse(e);t.count=1,"click"===t.type&&n.push(t)}),{version:t,events:n}},up=function(e){var t=e.version,r=e.events,n=[];return r.forEach(function(e){var t=JSON.parse(e);"click"===t.type&&n.push(t)}),{version:t,events:Object.values(n.reduce(function(e,t){var r=t.x,n=t.y,i=t.selector,o=t.timestamp,s=o-o%36e5,a="".concat(r,":").concat(n,":").concat(null!=i?i:"",":").concat(s);return e[a]?e[a].count+=1:e[a]=(0,es.__assign)((0,es.__assign)({},t),{timestamp:s,count:1}),e},{}))}},ug=function(e,t){var r=this;this.createHook=function(e){var t=e.eventsManager,n=e.sessionId,i=e.deviceIdFn,o=e.mirror,s=e.ugcFilterRules,a=e.performanceOptions;return function(e){if(e.type!==aV.Click)return;var u,l=(0,eU.getGlobalScope)();
2if(l){var c=l.location,d=l.innerHeight,f=l.innerWidth;if(c){var h=e.x,p=e.y;if(void 0!==h&&void 0!==p){var g=o.getNode(e.id);if(g)try{u=function(e,t){if(et=new Date,e.nodeType!==Node.ELEMENT_NODE)throw Error("Can't generate CSS selector for non-element node type.");if("html"===e.tagName.toLowerCase())return"html";var r,n,i={root:document.body,idName:function(e){return!0},className:function(e){return!0},tagName:function(e){return!0},attr:function(e,t){return!1},seedMinLength:1,optimizedMinLength:2,threshold:1e3,maxNumberOfTries:1e4,timeoutMs:void 0};r=(Z=(0,es.__assign)((0,es.__assign)({},i),t)).root,n=i,ee=r.nodeType===Node.DOCUMENT_NODE?r:r===n.root?r.ownerDocument:r;var o=ur(e,"all",function(){return ur(e,"two",function(){return ur(e,"one",function(){return ur(e,"none")})})});if(o){var s=uf(function e(t,r,n){var i,o,s;return void 0===n&&(n={counter:0,visited:new Map}),(0,es.__generator)(this,function(a){switch(a.label){case 0:if(!(t.length>2&&t.length>Z.optimizedMinLength))return[3,5];i=1,a.label=1;case 1:var u,l;if(!(i<t.length-1))return[3,5];if(n.counter>Z.maxNumberOfTries||(n.counter+=1,(o=(0,es.__spreadArray)([],(0,es.__read)(t),!1)).splice(i,1),s=ui(o),n.visited.has(s)))return[2];if(!(us(o)&&(u=o,l=r,ee.querySelector(ui(u))===l)))return[3,4];return[4,o];case 2:return a.sent(),n.visited.set(s,!0),[5,(0,es.__values)(e(o,r,n))];case 3:a.sent(),a.label=4;case 4:return i++,[3,1];case 5:return[2]}})}(o,e));return s.length>0&&(o=s[0]),ui(o)}throw Error("Selector was not found.")}(g,a)}catch(e){r.logger.debug("error resolving selector from finder")}var v=aD(c.href,s),m={x:h+r.scrollWatcher.currentScrollX,y:p+r.scrollWatcher.currentScrollY,selector:u,viewportHeight:d,viewportWidth:f,pageUrl:v,timestamp:Date.now(),type:"click"},y=i();y&&t.addEvent({sessionId:n,event:{type:"interaction",data:JSON.stringify(m)},deviceId:y})}}}}},this.logger=e,this.scrollWatcher=t};function uv(){var e=(0,eU.getGlobalScope)();return(null==e?void 0:e.innerHeight)||document.documentElement&&document.documentElement.clientHeight||0}function um(){var e=(0,eU.getGlobalScope)();return(null==e?void 0:e.innerWidth)||document.documentElement&&document.documentElement.clientWidth||0}var uy=function(){function e(e,t){var r=(0,eU.getGlobalScope)();r&&r.navigator&&"function"==typeof r.navigator.sendBeacon?this.sendBeacon=function(e,t){try{if(r.navigator.sendBeacon(e,JSON.stringify(t)))return!0}catch(e){}return!1}:this.sendBeacon=function(){return!1},this.sendXhr=function(e,t){var r=new XMLHttpRequest;return r.open("POST",e,!0),r.setRequestHeader("Accept","*/*"),r.send(JSON.stringify(t)),!0},this.basePageUrl=aX(t.serverZone,t.trackServerUrl),this.apiKey=t.apiKey,this.context=e}return e.prototype.send=function(e,t){var r=this.context,n=r.sessionId,i=r.type,o=new URLSearchParams({device_id:e,session_id:String(n),type:String(i),api_key:this.apiKey}),s="".concat(this.basePageUrl,"?").concat(o.toString());this.sendBeacon(s,t)||this.sendXhr(s,t)},e}(),ub=function(){function e(e,t){var r=this;this.timestamp=Date.now(),this.hook=function(e){r.update(e)},this.send=function(e){return function(t){var n,i,o,s,a=e(),u=(0,eU.getGlobalScope)();if(u&&a){var l=null!=(n=u.scrollX)?n:0,c=null!=(i=u.scrollY)?i:0;(l>0||c>0)&&r.update({id:1,x:l,y:c}),r.transport.send(a,{version:1,events:[{maxScrollX:r._maxScrollX,maxScrollY:r._maxScrollY,maxScrollWidth:r._maxScrollWidth,maxScrollHeight:r._maxScrollHeight,viewportHeight:uv(),viewportWidth:um(),pageUrl:aD(u.location.href,null!=(s=null==(o=r.config.interactionConfig)?void 0:o.ugcFilterRules)?s:[]),timestamp:r.timestamp,type:"scroll"}]})}}},this._maxScrollX=0,this._maxScrollY=0,this._currentScrollX=0,this._currentScrollY=0,this._maxScrollWidth=um(),this._maxScrollHeight=uv(),this.config=t,this.transport=e}return e.default=function(t,r){return new e(new uy(t,r),r)},Object.defineProperty(e.prototype,"maxScrollX",{get:function(){return this._maxScrollX},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxScrollY",{get:function(){return this._maxScrollY},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxScrollWidth",{get:function(){return this._maxScrollWidth}
2,enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxScrollHeight",{get:function(){return this._maxScrollHeight},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentScrollX",{get:function(){return this._currentScrollX},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentScrollY",{get:function(){return this._currentScrollY},enumerable:!1,configurable:!0}),e.prototype.update=function(e){var t=Date.now();if(this._currentScrollX=e.x,this._currentScrollY=e.y,e.x>this._maxScrollX){var r=um();this._maxScrollX=e.x;var n=e.x+r;n>this._maxScrollWidth&&(this._maxScrollWidth=n),this.timestamp=t}if(e.y>this._maxScrollY){var i=uv();this._maxScrollY=e.y;var o=e.y+i;o>this._maxScrollHeight&&(this._maxScrollHeight=o),this.timestamp=t}},e}(),u_=function(e){var t=e.sessionId,r=e.deviceId;this.deviceId=r,this.sessionId=t,t&&r&&(this.sessionReplayId="".concat(r,"/").concat(t))},uw=new function(){var e=this;this.dbs={},this.createStore=function(t){return(0,es.__awaiter)(e,void 0,void 0,function(){return(0,es.__generator)(this,function(e){switch(e.label){case 0:return[4,(0,a2.openDB)(t,1,{upgrade:function(e){e.objectStoreNames.contains("sessionTargetingMatch")||e.createObjectStore("sessionTargetingMatch",{keyPath:"sessionId"})}})];case 1:return[2,e.sent()]}})})},this.openOrCreateDB=function(t){return(0,es.__awaiter)(e,void 0,void 0,function(){var e,r;return(0,es.__generator)(this,function(n){switch(n.label){case 0:if(this.dbs&&this.dbs[t])return[2,this.dbs[t]];return e="".concat(t.substring(0,10),"_amp_session_replay_targeting"),[4,this.createStore(e)];case 1:return r=n.sent(),this.dbs[t]=r,[2,r]}})})},this.getTargetingMatchForSession=function(t){var r=t.loggerProvider,n=t.apiKey,i=t.sessionId;return(0,es.__awaiter)(e,void 0,void 0,function(){var e,t,o,s;return(0,es.__generator)(this,function(a){switch(a.label){case 0:return a.trys.push([0,3,,4]),[4,this.openOrCreateDB(n)];case 1:return e=a.sent(),t=String(i),[4,e.get("sessionTargetingMatch",t)];case 2:return[2,null==(o=a.sent())?void 0:o.targetingMatch];case 3:return s=a.sent(),a4(r,"Failed to get targeting match for session id ".concat(i,": ").concat(s),s),[3,4];case 4:return[2,void 0]}})})},this.storeTargetingMatchForSession=function(t){var r=t.loggerProvider,n=t.apiKey,i=t.sessionId,o=t.targetingMatch;return(0,es.__awaiter)(e,void 0,void 0,function(){var e,t,s;return(0,es.__generator)(this,function(a){switch(a.label){case 0:return a.trys.push([0,3,,4]),[4,this.openOrCreateDB(n)];case 1:return e=a.sent(),t=String(i),[4,e.put("sessionTargetingMatch",{targetingMatch:o,sessionId:t,lastUpdated:Date.now()})];case 2:return[2,a.sent()];case 3:return s=a.sent(),a4(r,"Failed to store targeting match for session id ".concat(i,": ").concat(s),s),[3,4];case 4:return[2,void 0]}})})},this.clearStoreOfOldSessions=function(t){var r=t.loggerProvider,n=t.apiKey,i=t.currentSessionId;return(0,es.__awaiter)(e,void 0,void 0,function(){var e,t,o,s,a,u,l,c;return(0,es.__generator)(this,function(d){switch(d.label){case 0:return d.trys.push([0,8,,9]),[4,this.openOrCreateDB(n)];case 1:return e=d.sent(),t=String(i),[4,(o=e.transaction("sessionTargetingMatch","readwrite")).store.getAll()];case 2:s=d.sent(),a=0,d.label=3;case 3:if(!(a<s.length))return[3,6];if(u=s[a],l=Date.now()-u.lastUpdated,!(u.sessionId!==t&&l>1728e5))return[3,5];return[4,o.store.delete(u.sessionId)];case 4:d.sent(),d.label=5;case 5:return a++,[3,3];case 6:return[4,o.done];case 7:return d.sent(),[3,9];case 8:return c=d.sent(),a4(r,"Failed to clear old targeting matches for sessions: ".concat(c),c),[3,9];case 9:return[2]}})})}},uS=function(t){var r=t.sessionId,n=t.targetingConfig,i=t.loggerProvider,o=t.apiKey,s=t.targetingParams,a=t.urlChange,u=void 0!==a&&a;return(0,es.__awaiter)(void 0,void 0,void 0,function(){var t,a,l;return(0,es.__generator)(this,function(c){switch(c.label){case 0:return[4,uw.clearStoreOfOldSessions({loggerProvider:i,apiKey:o,currentSessionId:r})];case 1:return c.sent(),[4,uw.getTargetingMatchForSession({loggerProvider:i,apiKey:o,sessionId:r})];case 2:if(!0===c.sent()&&!u)return[2,!0];t=!0,c.label=3;case 3:return c.trys.push([3,6,,7]),[4,e.A(236484)];case 4:return[4,(0,c.sent().evaluateTargeting)((0,es.__assign)((0,es.__assign)({},s),{flag:n,sessionId:"string"==typeof r?parseInt(r,10):r,apiKey:o,loggerProvider:i}))];case 5:return(a=c.sent())&&a.sr_targeting_config&&(t="on"===a.sr_targeting_config.key),uw.storeTargetingMatchForSession({loggerProvider:i,apiKey:o,sessionId:r,targetingMatch:t}),[3,7];case 6:return l=c.sent(),i.warn(l.message),[3,7];case 7:return[2,t]}})})};function uE(e,t){return(e<<t|e>>>32-t)>>>0}
2function uk(e,t){return Math.imul(e=uE(e=e+Math.imul(t,0x85ebca77)>>>0,13),0x9e3779b1)>>>0}function uI(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}var ux="__amplitude_url_tracking_patched__",uT=new WeakMap;function uC(e,t,r){if(void 0===r&&(r={}),!(null==e?void 0:e.location))return function(){};var n=r.enablePolling,i=r.pollingInterval;if(void 0!==n&&n){var o=function(){var t;return null!=(t=e.location.href)?t:""},s=o(),a=e.setInterval(function(){var e=o();e!==s&&(s=e,t(e))},void 0===i?1e3:i);return function(){null!=a&&e.clearInterval(a)}}var u=uT.get(e);if(!u){var l=void 0,c=new Set,d=function(){var t;return null!=(t=e.location.href)?t:""},f=function(){var e=d();(void 0===l||e!==l)&&(l=e,c.forEach(function(t){return t(e)}))},h=function(e){var t=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=e.apply(this,t);return f(),n};return t[ux]=!0,t},p=e.history;if(null==p?void 0:p.pushState){var g=Reflect.get(p,"pushState");g[ux]||(p.pushState=h(g))}if(null==p?void 0:p.replaceState){var v=Reflect.get(p,"replaceState");v[ux]||(p.replaceState=h(v))}u={callbacks:c,notify:f,onPopStateOrHashChange:function(){return f()},listenersAttached:!1},uT.set(e,u)}var m=u;return m.listenersAttached||(e.addEventListener("popstate",m.onPopStateOrHashChange),e.addEventListener("hashchange",m.onPopStateOrHashChange),m.listenersAttached=!0),m.callbacks.add(t),function(){m.callbacks.delete(t),0===m.callbacks.size&&m.listenersAttached&&(e.removeEventListener("popstate",m.onPopStateOrHashChange),e.removeEventListener("hashchange",m.onPopStateOrHashChange),m.listenersAttached=!1)}}function uP(e){return void 0===e&&(e={}),{name:"amplitude/url-tracking@1",observer:function(t,r,n){var i,o,s,a=(0,es.__assign)((0,es.__assign)({},e),n),u=a.ugcFilterRules||[],l=null!=(i=a.enablePolling)&&i,c=null!=(o=a.pollingInterval)?o:1e3,d=null!=(s=a.captureDocumentTitle)&&s;if(!r)return function(){};var f=void 0,h=function(){return r.location&&r.location.href||""},p=function(){var e=r.innerHeight,t=r.innerWidth,n=r.document,i=h(),o="";return d&&(o=(null==n?void 0:n.title)||""),{href:u.length>0?aD(i,u):i,title:o,viewportHeight:e,viewportWidth:t,type:"url-change-event"}},g=function(){var e=h();(void 0===f||e!==f)&&(f=e,t(p()))},v=uC(r,function(){return g()},l?{enablePolling:!0,pollingInterval:c}:{});return g(),function(){return v()}},options:e}}uP();var uO=function(){function t(){var e=this;this.name="@amplitude/session-replay-browser",this.recordCancelCallback=null,this.eventCount=0,this.sessionTargetingMatch=!1,this.pageLeaveFns=[],this.recordFunction=null,this.urlChangeCleanup=null,this.latestUrlChangeTargetingEvaluationId=0,this.teardownEventListeners=function(t){var r=(0,eU.getGlobalScope)();r&&(r.removeEventListener("blur",e.blurListener),r.removeEventListener("focus",e.focusListener),t||r.addEventListener("blur",e.blurListener),t||r.addEventListener("focus",e.focusListener),r.self&&"onpagehide"in r.self?(r.removeEventListener("pagehide",e.pageLeaveListener),t||r.addEventListener("pagehide",e.pageLeaveListener)):(r.removeEventListener("beforeunload",e.pageLeaveListener),t||r.addEventListener("beforeunload",e.pageLeaveListener)))},this.blurListener=function(){e.sendEvents()},this.focusListener=function(){e.recordEvents(!1)},this.pageLeaveListener=function(t){e.pageLeaveFns.forEach(function(e){e(t)})},this.evaluateTargetingAndCapture=function(t,r,n,i){return void 0===r&&(r=!1),void 0===n&&(n=!1),void 0===i&&(i=!1),(0,es.__awaiter)(e,void 0,void 0,function(){var e,o,s,a,u,l,c,d,f,h,p,g;return(0,es.__generator)(this,function(v){switch(v.label){case 0:if(!this.identifiers||!this.identifiers.sessionId||!this.config)return this.identifiers&&!this.identifiers.sessionId?this.loggerProvider.log("Session ID has not been set yet, cannot evaluate targeting for Session Replay."):this.loggerProvider.warn("Session replay init has not been called, cannot evaluate targeting."),[2];if(!this.config.targetingConfig)if(!r)return this.loggerProvider.log("No targeting config set, skipping initialization/recording for event."),[2];else this.loggerProvider.log("Targeting config has not been set yet, cannot evaluate targeting.");if(this.lastTargetingParams=t,!((e=this.config.targetingConfig)&&!this.sessionTargetingMatch))return[3,2];return o=i?this.latestUrlChangeTargetingEvaluationId:void 0,(s=t.event)&&Object.values(D).includes(s.event_type)&&(s=void 0),a=null!=(p=null!=(d=null==(c=t.page)?void 0:c.url)?d:null==(h=null==(f=(0,eU.getGlobalScope)())?void 0:f.location)?void 0:h.href)?p:"",u=null!=(g=t.page)?g:""!==a?{url:a}:void 0,[4,uS({sessionId:this.identifiers.sessionId,targetingConfig:e,loggerProvider:this.loggerProvider,apiKey:this.config.apiKey,targetingParams:{userProperties:t.userProperties,event:s,page:u},urlChange:i})];case 1:if(l=v.sent(),i&&void 0!==o&&o!==this.latestUrlChangeTargetingEvaluationId)return this.loggerProvider.debug("Ignoring stale URL-change targeting result #".concat(o,"; latest is #").concat(this.latestUrlChangeTargetingEvaluationId,".")),[2];this.sessionTargetingMatch=this.sessionTargetingMatch||l,this.loggerProvider.debug(JSON.stringify({name:"targeted replay capture config",sessionTargetingMatch:this.sessionTargetingMatch,event:s,targetingParams:t},null,2)),v.label=2;case 2:if(!r)return[3,3];return this.initialize(!0),[3,5];case 3:if(!(n||!this.recordCancelCallback))return[3,5];return this.loggerProvider.log("Recording events for session due to forceRestart or no ongoing recording."),[4,this.recordEvents()];case 4:v.sent(),v.label=5;case 5:return[2]}})})},this.addCustomRRWebEvent=function(t,r,n){return void 0===r&&(r={}),void 0===n&&(n=!0),(0,es.__awaiter)(e,void 0,void 0,function(){var e,i,o,s;return(0,es.__generator)(this,function(a){switch(a.label){case 0:if(a.trys.push([0,3,,4]),e=void 0,!((i=this.config)&&t!==Q.METADATA)||(e={config:aU(i),version:a0},!n))return[3,2];return[4,aL()];case 1:o=a.sent(),e=(0,es.__assign)((0,es.__assign)({},o),e),a.label=2;case 2:return this.recordCancelCallback&&this.recordFunction?this.recordFunction.addCustomEvent(t,(0,es.__assign)((0,es.__assign)({},r),e)):this.loggerProvider.debug("Not able to add custom replay capture event ".concat(t," due to no ongoing recording.")),[3,4];case 3:return s=a.sent(),this.loggerProvider.debug("Error while adding custom replay capture event: ",s),[3,4];case 4:return[2]}})})},this.stopRecordingEvents=function(){var t;try{e.loggerProvider.log("Session Replay capture stopping."),e.recordCancelCallback&&e.recordCancelCallback(),e.recordCancelCallback=null,null==(t=e.networkObservers)||t.stop()}catch(t){e.loggerProvider.warn("Error occurred while stopping replay capture: ".concat(t.toString()))}},this.loggerProvider=new aT(new eJ)}return t.prototype.init=function(e,t){return eW(this._init(e,t))},t.prototype.setupUrlChangeListenerForTargeting=function(){var e,t=this;null==(e=this.urlChangeCleanup)||e.call(this);var r=(0,eU.getGlobalScope)();if(null==r?void 0:r.location){var n=uC(r,function(e){var r=++t.latestUrlChangeTargetingEvaluationId;t.evaluateTargetingAndCapture({userProperties:{},event:void 0,page:{url:e}}
2,!1,!1,!0),t.loggerProvider.debug("Queued URL-change targeting re-evaluation #".concat(r," for ").concat(e,"."))});this.urlChangeCleanup=function(){n(),t.urlChangeCleanup=null}}},t.prototype.getCurrentPageForTargeting=function(){var e,t,r=null==(t=null==(e=(0,eU.getGlobalScope)())?void 0:e.location)?void 0:t.href;return null!=r?{url:r}:void 0},t.prototype._init=function(t,r){var n,i,o,s,a,u,l,c;return(0,es.__awaiter)(this,void 0,void 0,function(){var d,f,h,p,g,v,m,y,b,_,w,S,E,k,I,x,T,C,P,O=this;return(0,es.__generator)(this,function(A){switch(A.label){case 0:return null==(n=this.urlChangeCleanup)||n.call(this),this.loggerProvider=new aT(r.loggerProvider||new eJ),Object.prototype.hasOwnProperty.call(r,"logLevel")&&this.loggerProvider.enable(r.logLevel),this.identifiers=new u_({sessionId:r.sessionId,deviceId:r.deviceId}),d=this,[4,(0,es.__awaiter)(void 0,void 0,void 0,function(){var e;return(0,es.__generator)(this,function(n){return e=new aj(t,r),[2,new a$(new tf(t,e.loggerProvider,e.serverZone,r.configServerUrl),e)]})})];case 1:return d.joinedConfigGenerator=A.sent(),[4,this.joinedConfigGenerator.generateJoinedConfig()];case 2:if(h=(f=A.sent()).joinedConfig,p=f.localConfig,g=f.remoteConfig,this.config=h,this.setMetadata(r.sessionId,h,p,g,null==(i=r.version)?void 0:i.version,a0,null==(o=r.version)?void 0:o.type),this.pageLeaveFns=[],r.sessionId&&(null==(s=this.config.interactionConfig)?void 0:s.enabled)&&(v=ub.default({sessionId:r.sessionId,type:"interaction"},this.config),this.pageLeaveFns=[v.send(this.getDeviceId.bind(this)).bind(v)],this.scrollHook=v.hook.bind(v),this.clickHandler=new ug(this.loggerProvider,v)),m=[],"idb"!==(y=this.config.storeType)||(null==(a=(0,eU.getGlobalScope)())?void 0:a.indexedDB)||(y="memory",this.loggerProvider.warn("Could not use preferred indexedDB storage, reverting to in memory option.")),this.loggerProvider.log("Using ".concat(y," for event storage.")),w=(0,eU.getGlobalScope)(),!(this.config.useWebWorker&&w&&w.Worker))return[3,4];return[4,e.A(966151)];case 3:E=(S=A.sent()).compressionScript,k=S.trackDestinationScript,b=E,_=k,A.label=4;case 4:return A.trys.push([4,6,,7]),[4,ue({config:this.config,type:"replay",storeType:y,trackDestinationWorkerScript:_})];case 5:return I=A.sent(),m.push({name:"replay",manager:I}),[3,7];case 6:return x=A.sent(),this.loggerProvider.warn("Error occurred while creating replay events manager: ".concat(x.toString())),[3,7];case 7:if(!(null==(u=this.config.interactionConfig)?void 0:u.enabled))return[3,11];T=this.config.interactionConfig.batch?up:uh,A.label=8;case 8:return A.trys.push([8,10,,11]),[4,ue({config:this.config,type:"interaction",minInterval:null!=(l=this.config.interactionConfig.trackEveryNms)?l:3e4,maxInterval:6e4,payloadBatcher:T,storeType:y,trackDestinationWorkerScript:_})];case 9:return C=A.sent(),m.push({name:"interaction",manager:C}),[3,11];case 10:return x=A.sent(),this.loggerProvider.warn("Error occurred while creating interaction events manager: ".concat(x.toString())),[3,11];case 11:return this.eventsManager=new(ut.bind.apply(ut,(0,es.__spreadArray)([void 0],(0,es.__read)(m),!1))),this.eventCompressor&&this.eventCompressor.terminate(),this.eventCompressor=new aY(this.eventsManager,this.config,this.getDeviceId(),b,function(){return O.sendEvents()}),this.pageLeaveFns=(0,es.__spreadArray)((0,es.__spreadArray)([],(0,es.__read)(this.pageLeaveFns),!1),[function(){if(O.config&&(null==(e=O.identifiers)?void 0:e.sessionId)&&I){var e,t=I.getBeaconEvents();if(t.length){var r=O.getDeviceId();r&&I.trackDestination.sendBeacon({events:t,sessionId:O.identifiers.sessionId,deviceId:r,apiKey:O.config.apiKey,serverZone:O.config.serverZone})}}}],!1),[4,this.initializeNetworkObservers()];case 12:return A.sent(),(null==(c=(0,eU.getGlobalScope)())?void 0:c.opener)&&(nr(P=ne()),P.setup((0,es.__assign)({logger:this.loggerProvider},this.config.serverZone&&{endpoint:r6[this.config.serverZone]}))),this.loggerProvider.log("Installing @amplitude/session-replay-browser."),this.teardownEventListeners(!1),[4,this.evaluateTargetingAndCapture({userProperties:r.userProperties,page:this.getCurrentPageForTargeting()},!0)];
2case 13:return A.sent(),this.config.targetingConfig&&this.setupUrlChangeListenerForTargeting(),[2]}})})},t.prototype.setSessionId=function(e,t){return eW(this.asyncSetSessionId(e,t))},t.prototype.asyncSetSessionId=function(e,t,r){var n;return(0,es.__awaiter)(this,void 0,void 0,function(){var i,o,s;return(0,es.__generator)(this,function(a){switch(a.label){case 0:if(this.latestUrlChangeTargetingEvaluationId++,this.sessionTargetingMatch=!1,this.lastShouldRecordDecision=void 0,(i=this.identifiers&&this.identifiers.sessionId)&&this.sendEvents(i),o=t||this.getDeviceId(),this.identifiers=new u_({sessionId:e,deviceId:o}),!(this.joinedConfigGenerator&&i))return[3,2];return[4,this.joinedConfigGenerator.generateJoinedConfig()];case 1:s=a.sent().joinedConfig,this.config=s,a.label=2;case 2:if(!(null==(n=this.config)?void 0:n.targetingConfig))return[3,4];return[4,this.evaluateTargetingAndCapture({userProperties:null==r?void 0:r.userProperties,page:this.getCurrentPageForTargeting()},!1,!0)];case 3:return a.sent(),[3,6];case 4:return[4,this.recordEvents()];case 5:a.sent(),a.label=6;case 6:return[2]}})})},t.prototype.getSessionReplayProperties=function(){var e,t=this.config,r=this.identifiers;if(!t||!r)return this.loggerProvider.warn("Session replay init has not been called, cannot get session replay properties."),{};var n=this.getShouldRecord(),i={};return n&&((e={})[ab]=r.sessionReplayId?r.sessionReplayId:null,i=e,t.debugMode&&(i[aS]=JSON.stringify({appHash:t_(t.apiKey).toString()}))),this.addCustomRRWebEvent(Q.GET_SR_PROPS,{shouldRecord:n,eventProperties:i},10===this.eventCount),10===this.eventCount&&(this.eventCount=0),this.eventCount++,i},t.prototype.sendEvents=function(e){var t,r=e||(null==(t=this.identifiers)?void 0:t.sessionId),n=this.getDeviceId();this.eventsManager&&r&&n&&this.eventsManager.sendCurrentSequenceEvents({sessionId:r,deviceId:n})},t.prototype.initialize=function(e){var t;return void 0===e&&(e=!1),(0,es.__awaiter)(this,void 0,void 0,function(){var r;return(0,es.__generator)(this,function(n){return(null==(t=this.identifiers)?void 0:t.sessionId)?(r=this.getDeviceId())?(this.eventsManager&&e&&this.eventsManager.sendStoredEvents({deviceId:r}),[2,this.recordEvents()]):(this.loggerProvider.log("Session is not being recorded due to lack of device id."),[2,Promise.resolve()]):(this.loggerProvider.log("Session is not being recorded due to lack of session id."),[2,Promise.resolve()])})})},t.prototype.shouldOptOut=function(){if(null==(e=this.config)?void 0:e.instanceName){var e,t,r;r=ti(this.config.instanceName).identityStore.getIdentity().optOut}return void 0!==r?r:null==(t=this.config)?void 0:t.optOut},t.prototype.getShouldRecord=function(){if(!this.identifiers||!this.config||!this.identifiers.sessionId)return this.loggerProvider.warn("Session is not being recorded due to lack of config, please call sessionReplay.init."),!1;if(!this.config.captureEnabled)return this.loggerProvider.log("Session ".concat(this.identifiers.sessionId," not being captured due to capture being disabled for project or because the remote config could not be fetched.")),!1;if(this.shouldOptOut())return this.loggerProvider.log("Opting session ".concat(this.identifiers.sessionId," out of recording due to optOut config.")),!1;var e,t,r=!1,n="",i=!1;return this.config.targetingConfig?this.sessionTargetingMatch?(n="Capturing replays for session ".concat(this.identifiers.sessionId," due to matching targeting conditions."),this.loggerProvider.log(n),r=!0,i=!0):(n="Not capturing replays for session ".concat(this.identifiers.sessionId," due to not matching targeting conditions."),this.loggerProvider.log(n),r=!1,i=!1):(e=this.identifiers.sessionId,t=this.config.sampleRate,function(e,t){void 0===t&&(t=0);var r,n=function(e){for(var t=[],r=0;r<e.length;r++){var n=e.charCodeAt(r);if(n>=55296&&n<=56319&&r+1<e.length){var i=e.charCodeAt(r+1);i>=56320&&i<=57343&&(n=(n-55296<<10)+(i-56320)+65536,r++)}n<128?t.push(n):n<2048?t.push(192|n>>6,128|63&n):n<65536?t.push(224|n>>12,128|n>>6&63,128|63&n):t.push(240|n>>18,128|n>>12&63,128|n>>6&63,128|63&n)}return new Uint8Array(t)}(e),i=n.length,o=0;if(i>=16){for(var s=t+0x9e3779b1+0x85ebca77>>>0,a=t+0x85ebca77>>>0,u=t>>>0,l=t-0x9e3779b1>>>0;o<=i-16;)s=uk(s,uI(n,o)),o+=4,a=uk(a,uI(n,o)),o+=4,u=uk(u,uI(n,o)),o+=4,l=uk(l,uI(n,o)),o+=4;r=uE(s,1)+uE(a,7)+uE(u,12)+uE(l,18)>>>0}else r=t+0x165667b1>>>0;for(r=r+i>>>0;o<=i-4;)r=Math.imul(uE(r=r+Math.imul(uI(n,o),0xc2b2ae3d)>>>0,17),0x27d4eb2f)>>>0,o+=4;for(;o<i;)r=Math.imul(uE(r=r+Math.imul(n[o],0x165667b1)>>>0,11),0x9e3779b1)>>>0,o++;return r^=r>>>15,r=Math.imul(r,0x85ebca77)>>>0,r^=r>>>13,r=Math.imul(r,0xc2b2ae3d)>>>0,(r^=r>>>16)>>>0}(e.toString())%1e6/1e6<t)?(r=!0,i=!0):(n="Opting session ".concat(this.identifiers.sessionId," out of recording due to sample rate."),this.loggerProvider.log(n),r=!1,i=!1),this.lastShouldRecordDecision!==r&&this.config.targetingConfig&&(this.addCustomRRWebEvent(Q.TARGETING_DECISION,{message:n,sessionId:this.identifiers.sessionId,matched:i,targetingParams:this.lastTargetingParams}),this.lastShouldRecordDecision=r),r},t.prototype.getBlockSelectors=function(){var e,t,r,n=null!=(r=null==(t=null==(e=this.config)?void 0:e.privacyConfig)?void 0:t.blockSelector)?r:[];if(0!==n.length)return n},t.prototype.getMaskTextSelectors=function(){if((null==(t=null==(e=this.config)?void 0:e.privacyConfig)?void 0:t.defaultMaskLevel)==="conservative")return"*";var e,t,r,n,i=null==(n=null==(r=this.config)?void 0:r.privacyConfig)?void 0:n.maskSelector;if(i)return i},t.prototype.getRecordingPlugins=function(t){var r,n,i,o,s,a;return(0,es.__awaiter)(this,void 0,void 0,function(){var u,l,c,d;return(0,es.__generator)(this,function(f){switch(f.label){case 0:u=[];try{l=uP({ugcFilterRules:(null==(n=null==(r=this.config)?void 0:r.interactionConfig)?void 0:n.ugcFilterRules)||[],enablePolling:(null==(i=this.config)?void 0:i.enableUrlChangePolling)||!1,pollingInterval:null==(o=this.config)?void 0:o.urlChangePollingInterval,captureDocumentTitle:null==(s=this.config)?void 0:s.captureDocumentTitle}),u.push(l)}catch(e){this.loggerProvider.warn("Failed to create URL tracking plugin:",e)}if(!(null==(a=null==t?void 0:t.console)?void 0:a.enabled))return[3,4];f.label=1;case 1:return f.trys.push([1,3,,4]),[4,e.A(256632)];case 2:return c=f.sent().getRecordConsolePlugin,u.push(c({level:t.console.levels})),[3,4];case 3:return d=f.sent(),this.loggerProvider.warn("Failed to load console plugin:",d),[3,4];case 4:return[2,u.length>0?u:void 0]}})})},t.prototype.getRecordFunction=function(){return(0,es.__awaiter)(this,void 0,void 0,function(){var t,r;return(0,es.__generator)(this,function(n){switch(n.label){case 0:if(this.recordFunction)return[2,this.recordFunction];n.label=1;case 1:return n.trys.push([1,3,,4]),[4,e.A(736962)];case 2:return t=n.sent().record,this.recordFunction=t,[2,t];case 3:return r=n.sent(),this.loggerProvider.warn("Failed to load rrweb-record module:",r),[2,null];case 4:return[2]}})})},t.prototype.recordEvents=function(e){var t,r,n,i,o,s,a,u;return void 0===e&&(e=!0),(0,es.__awaiter)(this,void 0,void 0,function(){var l,c,d,f,h,p,g,v,m,y,b,_,w,S,E,
2k=this;return(0,es.__generator)(this,function(I){switch(I.label){case 0:if(l=this.config,c=this.getShouldRecord(),d=null==(t=this.identifiers)?void 0:t.sessionId,!c||!d||!l)return[2];return this.stopRecordingEvents(),[4,this.getRecordFunction()];case 1:if(!(f=I.sent()))return[2];return[4,this.initializeNetworkObservers()];case 2:I.sent(),h=null==(r=l.loggingConfig)?void 0:r.network,p=[ak,aI,ax,aX(l.serverZone,l.trackServerUrl)],null==(n=this.networkObservers)||n.start(function(e){p.some(function(t){return e.url.startsWith(t)})||k.addCustomRRWebEvent(Q.FETCH_REQUEST,e)},h),g=l.privacyConfig,v=l.interactionConfig,m=l.loggingConfig,y=(null==v?void 0:v.enabled)?{mouseInteraction:this.eventsManager&&(null==(i=this.clickHandler)?void 0:i.createHook({eventsManager:this.eventsManager,sessionId:d,deviceIdFn:this.getDeviceId.bind(this),mirror:f.mirror,ugcFilterRules:null!=(o=v.ugcFilterRules)?o:[],performanceOptions:null==(s=l.performanceConfig)?void 0:s.interaction})),scroll:this.scrollHook}:{},b=(null==v?void 0:v.enabled)&&v.ugcFilterRules?v.ugcFilterRules:[],this.loggerProvider.log("Session Replay capture beginning for ".concat(d,".")),I.label=3;case 3:var x;return I.trys.push([3,5,,6]),_=this,w=f,E={emit:function(e){if(k.shouldOptOut()){k.loggerProvider.log("Opting session ".concat(d," out of recording due to optOut config.")),k.stopRecordingEvents(),k.sendEvents();return}e.type===aF.Meta&&(e.data.href=aD(e.data.href,b)),k.eventCompressor&&k.eventCompressor.enqueueEvent(e,d)},inlineStylesheet:l.shouldInlineStylesheet,hooks:y,maskAllInputs:!0,maskTextClass:aE,blockClass:"amp-block",blockSelector:this.getBlockSelectors(),applyBackgroundColorToBlockedElements:l.applyBackgroundColorToBlockedElements,maskInputFn:aA("input",g),maskTextFn:aA("text",g),maskAttributeFn:(x=g,function(e,t,r){var n;return"style"!==e&&(null!=(n=null==x?void 0:x.maskAttributes)?n:[]).includes(e)&&aO("text",x,r)?t.replace(/[^\s]/g,"*"):t}),maskTextSelector:this.getMaskTextSelectors(),recordCanvas:!1,slimDOMOptions:{script:null==(a=l.omitElementTags)?void 0:a.script,comment:null==(u=l.omitElementTags)?void 0:u.comment},errorHandler:function(e){if(e.message.includes("insertRule")&&e.message.includes("CSSStyleSheet")||e._external_)throw e;return k.loggerProvider.warn("Error while capturing replay: ",e.toString()),!0}},[4,this.getRecordingPlugins(m)];case 4:return _.recordCancelCallback=w.apply(void 0,[(E.plugins=I.sent(),E)]),this.addCustomRRWebEvent(Q.DEBUG_INFO),e&&this.addCustomRRWebEvent(Q.METADATA,this.metadata),[3,6];case 5:return S=I.sent(),this.loggerProvider.warn("Failed to initialize session replay:",S),[3,6];case 6:return[2]}})})},t.prototype.getDeviceId=function(){var e;return null==(e=this.identifiers)?void 0:e.deviceId},t.prototype.getSessionId=function(){var e;return null==(e=this.identifiers)?void 0:e.sessionId},t.prototype.flush=function(e){var t;return void 0===e&&(e=!1),(0,es.__awaiter)(this,void 0,void 0,function(){return(0,es.__generator)(this,function(r){return[2,null==(t=this.eventsManager)?void 0:t.flush(e)]})})},t.prototype.shutdown=function(){var e;null==(e=this.urlChangeCleanup)||e.call(this),this.teardownEventListeners(!0),this.stopRecordingEvents(),this.sendEvents()},t.prototype.mapSDKType=function(e){return"plugin"===e?"@amplitude/plugin-session-replay-browser":"segment"===e?"@amplitude/segment-session-replay-plugin":null},t.prototype.setMetadata=function(e,t,r,n,i,o,s){var a=(null==e?void 0:e.toString())?t_(e.toString()):void 0;this.metadata={joinedConfig:t,localConfig:r,remoteConfig:n,sessionId:e,hashValue:a,sampleRate:t.sampleRate,replaySDKType:this.mapSDKType(s),replaySDKVersion:i,standaloneSDKType:"@amplitude/session-replay-browser",standaloneSDKVersion:o}},t.prototype.initializeNetworkObservers=function(){var t,r,n;return(0,es.__awaiter)(this,void 0,void 0,function(){var i,o;return(0,es.__generator)(this,function(s){switch(s.label){case 0:if(!((null==(n=null==(r=null==(t=this.config)?void 0:t.loggingConfig)?void 0:r.network)?void 0:n.enabled)&&!this.networkObservers))return[3,4];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,e.A(142928)];case 2:return i=s.sent().NetworkObservers,this.networkObservers=new i,[3,4];case 3:return o=s.sent(),this.loggerProvider.warn("Failed to import or instantiate NetworkObservers:",o),[3,4];case 4:return[2]}})})},t}(),uA=function(e){return function(){var t=e.config||aq();return{logger:t.loggerProvider,logLevel:t.logLevel}}};let uR={init:ed((P=new uO).init.bind(P),"init",uA(P)),evaluateTargetingAndCapture:ed(P.evaluateTargetingAndCapture.bind(P),"evaluateTargetingAndRecord",uA(P)),setSessionId:ed(P.setSessionId.bind(P),"setSessionId",uA(P)),getSessionId:ed(P.getSessionId.bind(P),"getSessionId",uA(P)),getSessionReplayProperties:ed(P.getSessionReplayProperties.bind(P),"getSessionReplayProperties",uA(P)),flush:ed(P.flush.bind(P),"flush",uA(P)),shutdown:ed(P.shutdown.bind(P),"shutdown",uA(P))};
2var uM=uR.init,uN=uR.setSessionId,uD=uR.getSessionId,uL=uR.getSessionReplayProperties,uU=uR.flush,uq=uR.shutdown,uj=uR.evaluateTargetingAndCapture;(O=er||(er={})).SET="$set",O.SET_ONCE="$setOnce",O.ADD="$add",O.APPEND="$append",O.PREPEND="$prepend",O.REMOVE="$remove",O.PREINSERT="$preInsert",O.POSTINSERT="$postInsert",O.UNSET="$unset",O.CLEAR_ALL="$clearAll",(A=en||(en={})).REVENUE_PRODUCT_ID="$productId",A.REVENUE_QUANTITY="$quantity",A.REVENUE_PRICE="$price",A.REVENUE_TYPE="$revenueType",A.REVENUE_CURRENCY="$currency",A.REVENUE="$revenue",(R=ei||(ei={})).IDENTIFY="$identify",R.GROUP_IDENTIFY="$groupidentify",R.REVENUE="revenue_amount";var uF=[er.SET,er.SET_ONCE,er.ADD,er.APPEND,er.PREPEND,er.POSTINSERT],uB=function(e){if(e.user_properties){var t={};return Object.keys(e.user_properties).forEach(function(r){if(uF.includes(r)){var n=e.user_properties&&e.user_properties[r];t=(0,es.__assign)((0,es.__assign)({},t),n)}}),t}},uV="1.27.9",uK="".concat("[Amplitude]"," Session Replay ID"),uW=function(){function e(t){this.name=e.pluginName,this.type="enrichment",this.config=null,this.sessionReplay={flush:uU,getSessionId:uD,getSessionReplayProperties:uL,init:uM,setSessionId:uN,shutdown:uq,evaluateTargetingAndCapture:uj},this.options=(0,es.__assign)({forceSessionTracking:!1},t),this.srInitOptions=this.options}return e.prototype.setup=function(e,t){var r,n,i,o,s,a,u,l;return(0,es.__awaiter)(this,void 0,void 0,function(){var t,c;return(0,es.__generator)(this,function(d){switch(d.label){case 0:var f;return d.trys.push([0,2,,3]),null==e||e.loggerProvider.log("Installing @amplitude/plugin-session-replay, version ".concat(uV,".")),this.config=e,this.options.forceSessionTracking&&("boolean"==typeof e.defaultTracking?!1===e.defaultTracking&&(e.defaultTracking={pageViews:!1,formInteractions:!1,fileDownloads:!1,sessions:!0}):e.defaultTracking=(0,es.__assign)((0,es.__assign)({},e.defaultTracking),{sessions:!0})),t=(void 0===(f=this.config.instanceName)&&(f="$default_instance"),tn.getInstance(f)).identityStore.getIdentity().userProperties,this.srInitOptions={instanceName:this.config.instanceName,deviceId:null!=(r=this.options.deviceId)?r:this.config.deviceId,optOut:this.config.optOut,sessionId:this.options.customSessionId?void 0:this.config.sessionId,loggerProvider:this.config.loggerProvider,logLevel:this.config.logLevel,flushMaxRetries:this.config.flushMaxRetries,serverZone:this.config.serverZone,configServerUrl:this.options.configServerUrl||(null==(n=this.config.remoteConfig)?void 0:n.serverUrl),trackServerUrl:this.options.trackServerUrl,sampleRate:this.options.sampleRate,privacyConfig:{blockSelector:null==(i=this.options.privacyConfig)?void 0:i.blockSelector,maskSelector:null==(o=this.options.privacyConfig)?void 0:o.maskSelector,unmaskSelector:null==(s=this.options.privacyConfig)?void 0:s.unmaskSelector,defaultMaskLevel:null==(a=this.options.privacyConfig)?void 0:a.defaultMaskLevel},debugMode:this.options.debugMode,shouldInlineStylesheet:this.options.shouldInlineStylesheet,version:{type:"plugin",version:uV},performanceConfig:this.options.performanceConfig,storeType:this.options.storeType,useWebWorker:null!=(u=this.options.useWebWorker)?u:null==(l=this.options.experimental)?void 0:l.useWebWorker,userProperties:t,omitElementTags:this.options.omitElementTags,applyBackgroundColorToBlockedElements:this.options.applyBackgroundColorToBlockedElements,interactionConfig:this.options.interactionConfig,captureDocumentTitle:this.options.captureDocumentTitle,enableUrlChangePolling:this.options.enableUrlChangePolling,urlChangePollingInterval:this.options.urlChangePollingInterval},[4,this.sessionReplay.init(e.apiKey,this.srInitOptions).promise];case 1:return d.sent(),[3,3];case 2:return c=d.sent(),null==e||e.loggerProvider.error("Session Replay: Failed to initialize due to ".concat(c.message)),[3,3];case 3:return[2]}})})},e.prototype.onSessionIdChanged=function(e){var t;return(0,es.__awaiter)(this,void 0,void 0,function(){return(0,es.__generator)(this,function(r){switch(r.label){case 0:return null==(t=this.config)||t.loggerProvider.debug("Analytics session id is changed to ".concat(e,", SR session id is ").concat(String(this.sessionReplay.getSessionId()),".")),[4,this.sessionReplay.setSessionId(e).promise];case 1:return r.sent(),[2]}})})},e.prototype.onOptOutChanged=function(e){var t;return(0,es.__awaiter)(this,void 0,void 0,function(){return(0,es.__generator)(this,function(r){switch(r.label){case 0:if(null==(t=this.config)||t.loggerProvider.debug("optOut is changed to ".concat(String(e),", calling ").concat(e?"sessionReplay.shutdown()":"sessionReplay.init()",".")),!e)return[3,1];return this.sessionReplay.shutdown(),[3,4];case 1:if(null==this.config)return[3,3];return[4,this.sessionReplay.init(this.config.apiKey,this.srInitOptions).promise];case 2:r.sent(),r.label=3;case 3:r.label=4;case 4:return[2]}})})},e.prototype.execute=function(e){var t,r,n;return(0,es.__awaiter)(this,void 0,void 0,function(){var i,o,s,a,u;return(0,es.__generator)(this,function(l){switch(l.label){case 0:if(l.trys.push([0,9,,10]),!this.options.customSessionId)return[3,4];if(!(i=this.options.customSessionId(e)))return[3,3];if(i===this.sessionReplay.getSessionId())return[3,2];return[4,this.sessionReplay.setSessionId(i).promise];case 1:l.sent(),l.label=2;case 2:o=this.sessionReplay.getSessionReplayProperties(),e.event_properties=(0,es.__assign)((0,es.__assign)({},e.event_properties),o),l.label=3;case 3:return[3,8];case 4:if(!((i=null==(t=this.config)?void 0:t.sessionId)&&i!==this.sessionReplay.getSessionId()))return[3,6];return[4,this.sessionReplay.setSessionId(i).promise];case 5:l.sent(),l.label=6;case 6:if(!(i&&i===e.session_id))return[3,8];return s=void 0,e.event_type===D.IDENTIFY&&(s=uB(e)),a=(0,eU.getGlobalScope)(),[4,this.sessionReplay.evaluateTargetingAndCapture({event:e,userProperties:s,page:(null==(r=null==a?void 0:a.location)?void 0:r.href)!=null?{url:a.location.href}:void 0})];case 7:l.sent(),o=this.sessionReplay.getSessionReplayProperties(),e.event_properties=(0,es.__assign)((0,es.__assign)({},e.event_properties),o),l.label=8;case 8:return e.event_type===D.IDENTIFY&&e.event_properties&&delete e.event_properties[uK],[2,Promise.resolve(e)];case 9:return u=l.sent(),null==(n=this.config)||n.loggerProvider.error("Session Replay: Failed to enrich event due to ".concat(u.message)),[2,Promise.resolve(e)];case 10:return[2]}})})},e.prototype.teardown=function(){var e;return(0,es.__awaiter)(this,void 0,void 0,function(){return(0,es.__generator)(this,function(t){try{this.sessionReplay.shutdown(),this.config=null}catch(t){null==(e=this.config)||e.loggerProvider.error("Session Replay: teardown failed due to ".concat(t.message))}return[2]})})},e.prototype.getSessionReplayProperties=function(){return this.sessionReplay.getSessionReplayProperties()},e.pluginName="@amplitude/plugin-session-replay-browser",e}(),uz=e.i(196713),uH=e.i(578791),uG=e.i(907265);let uJ=(0,uH.createContext)({experiment:null,experimentLoading:!0,setUserId:()=>"",setUserProperties:()=>void 0,track:()=>""});e.s(["AnalyticsProvider",0,function({appName:e,children:t}){let[r,n]=(0,uH.useState)(null),[i,o]=(0,uH.useState)(!0);return(0,uH.useEffect)(()=>{let e=!1;if(!uz.COMMON_ENV.NEXT_PUBLIC_AMPLITUDE_API_KEY)return void o(!1);if(ow(new uW(void 0)),oE(uz.COMMON_ENV.NEXT_PUBLIC_AMPLITUDE_API_KEY,void 0,{autocapture:{elementInteractions:!0,pageViews:!0,sessions:!0}}),uz.COMMON_ENV.NEXT_PUBLIC_AMPLITUDE_EXPERIMENT_DEPLOYMENT_KEY){var t,r;let i=(t=uz.COMMON_ENV.NEXT_PUBLIC_AMPLITUDE_EXPERIMENT_DEPLOYMENT_KEY,ag(t,r={pollOnStart:!1},function(){return new sV(t,tn.getInstance(ah(r)),1e4)}));i.start().then(()=>{e||(n(i),o(!1))}).catch(()=>{e||o(!1)})}else o(!1);return()=>{e=!0}},[]),(0,eo.jsx)(uJ.Provider,{value:{experiment:r,experimentLoading:i,setUserId:e=>{uz.COMMON_ENV.NEXT_PUBLIC_AMPLITUDE_API_KEY&&ok(e)},setUserProperties:(e,t)=>{if(!uz.COMMON_ENV.NEXT_PUBLIC_AMPLITUDE_API_KEY)return;let r=new eN;for(let[n,i]of Object.entries(e))t?.setOnce?r.setOnce(n,i):r.set(n,i);oS(r)},track:(t,r)=>{if(uz.COMMON_ENV.NEXT_PUBLIC_AMPLITUDE_API_KEY)try{r.app_name=e,oI(t,r)}catch(e){(0,uG.captureError)(e)}}},children:t})},"useAnalytics",0,function(){return(0,uH.use)(uJ)}],459112)}]); 3 4//# debugId=810a4ae0-0bf5-9d77-ce8c-559124f003c3
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.