1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,101638,(e,t,r)=>{t.exports=e.r(175390)},484404,(e,t,r)=>{!function(n,i){"use strict";var o="function",s="undefined",a="object",u="string",l="model",c="name",d="type",f="vendor",h="version",p="architecture",g="console",v="mobile",m="tablet",y="smarttv",b="wearable",_="embedded",w="Amazon",S="Apple",E="ASUS",k="BlackBerry",x="Browser",I="Chrome",T="Firefox",P="Google",C="Huawei",A="Microsoft",O="Motorola",R="Opera",N="Samsung",D="Sharp",M="Sony",j="Xiaomi",L="Zebra",U="Facebook",q=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},F=function(e){for(var t={},r=0;r<e.length;r++)t[e[r].toUpperCase()]=e[r];return t},V=function(e,t){return typeof e===u&&-1!==B(t).indexOf(B(e))},B=function(e){return e.toLowerCase()},K=function(e,t){if(typeof e===u)return e=e.replace(/^\s\s*/,""),typeof t===s?e:e.substring(0,350)},z=function(e,t){for(var r,n,i,s,u,l,c=0;c<t.length&&!u;){var d=t[c],f=t[c+1];for(r=n=0;r<d.length&&!u;)if(u=d[r++].exec(e))for(i=0;i<f.length;i++)l=u[++n],typeof(s=f[i])===a&&s.length>0?2===s.length?typeof s[1]==o?this[s[0]]=s[1].call(this,l):this[s[0]]=s[1]:3===s.length?typeof s[1]!==o||s[1].exec&&s[1].test?this[s[0]]=l?l.replace(s[1],s[2]):void 0:this[s[0]]=l?s[1].call(this,l,s[2]):void 0:4===s.length&&(this[s[0]]=l?s[3].call(this,l.replace(s[1],s[2])):void 0):this[s]=l||void 0;c+=2}},W=function(e,t){for(var r in t)if(typeof t[r]===a&&t[r].length>0){for(var n=0;n<t[r].length;n++)if(V(t[r][n],e))return"?"===r?void 0:r}else if(V(t[r],e))return"?"===r?void 0:r;return e},H={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"},$={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[h,[c,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[h,[c,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[c,h],[/opios[\/ ]+([\w\.]+)/i],[h,[c,R+" Mini"]],[/\bopr\/([\w\.]+)/i],[h,[c,R]],[/(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],[c,h],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[h,[c,"UC"+x]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[h,[c,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[h,[c,"WeChat"]],[/konqueror\/([\w\.]+)/i],[h,[c,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[h,[c,"IE"]],[/yabrowser\/([\w\.]+)/i],[h,[c,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[c,/(.+)/,"$1 Secure "+x],h],[/\bfocus\/([\w\.]+)/i],[h,[c,T+" Focus"]],[/\bopt\/([\w\.]+)/i],[h,[c,R+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[h,[c,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[h,[c,"Dolphin"]],[/coast\/([\w\.]+)/i],[h,[c,R+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[h,[c,"MIUI "+x]],[/fxios\/([-\w\.]+)/i],[h,[c,T]],[/\bqihu|(qi?ho?o?|360)browser/i],[[c,"360 "+x]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[c,/(.+)/,"$1 "+x],h],[/(comodo_dragon)\/([\w\.]+)/i],[[c,/_/g," "],h],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[c,h],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[c],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[c,U],h],[/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[c,h],[/\bgsa\/([\w\.]+) .*safari\//i],[h,[c,"GSA"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[h,[c,I+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[c,I+" WebView"],h],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[h,[c,"Android "+x]],[/(chrome|omniweb|arora|[t
vendor: 4,850 bytes, line 1
1izenoka]{5} ?browser)\/v?([\w\.]+)/i],[c,h],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[h,[c,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[h,c],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[c,[h,W,{"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],[c,h],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[c,"Netscape"],h],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[h,[c,T+" 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],[c,h],[/(cobalt)\/([\w\.]+)/i],[c,[h,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[p,"amd64"]],[/(ia32(?=;))/i],[[p,B]],[/((?:i[346]|x)86)[;\)]/i],[[p,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[p,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[p,"armhf"]],[/windows (ce|mobile); ppc;/i],[[p,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[p,/ower/,"",B]],[/(sun4\w)[;\)]/i],[[p,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[p,B]]],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],[l,[f,N],[d,m]],[/\b((?:s[cgp]h|gt|sm)-\w+|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[l,[f,N],[d,v]],[/((ipod|iphone)\d+,\d+)/i],[l,[f,S],[d,v]],[/(ipad\d+,\d+)/i],[l,[f,S],[d,m]],[/\((ip(?:hone|od)[\w ]*);/i],[l,[f,S],[d,v]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[l,[f,S],[d,m]],[/(macintosh);/i],[l,[f,S]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[l,[f,C],[d,m]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[l,[f,C],[d,v]],[/\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],[[l,/_/g," "],[f,j],[d,v]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[l,/_/g," "],[f,j],[d,m]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[l,[f,"OPPO"],[d,v]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[l,[f,"Vivo"],[d,v]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[l,[f,"Realme"],[d,v]],[/\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],[l,[f,O],[d,v]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[l,[f,O],[d,m]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[l,[f,"LG"],[d,m]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[l,[f,"LG"],[d,v]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[l,[f,"Lenovo"],[d,m]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[l,/_/g," "],[f,"Nokia"],[d,v]],[/(pixel c)\b/i],[l,[f,P],[d,m]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[l,[f,P],[d,v]],[/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],[l,[f,M],[d,v]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[l,"Xperia Tablet"],[f,M],[d,m]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[l,[f,"OnePlus"],[d,v]],[/(alexa)webm/i,/(kf[a-z]{2}wi)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[l,[f,w],[d,m]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[l,/(.+)/g,"Fire Phone $1"],[f,w],[d,v]],[/(playbook);[-\w\),; ]+(rim)/i],[l,f,[d,m]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[l,[f,k],[d,v]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[l,[f,E],[d,m]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[l,[f,E],[d,v]],[/(nexus 9)/i],[l,[f,"HTC"],[d,m]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic|sony(?!-bra))[-_ ]?([-\w]*)/i],[f,[l,/_/g," "],[d,v]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[l,[f,"Acer"],[d,m]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[l,[f,"Meizu"],[d,v]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[l,[f,D],[d,v]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asu
1s)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[f,l,[d,v]],[/(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],[f,l,[d,m]],[/(surface duo)/i],[l,[f,A],[d,m]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[l,[f,"Fairphone"],[d,v]],[/(u304aa)/i],[l,[f,"AT&T"],[d,v]],[/\bsie-(\w*)/i],[l,[f,"Siemens"],[d,v]],[/\b(rct\w+) b/i],[l,[f,"RCA"],[d,m]],[/\b(venue[\d ]{2,7}) b/i],[l,[f,"Dell"],[d,m]],[/\b(q(?:mv|ta)\w+) b/i],[l,[f,"Verizon"],[d,m]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[l,[f,"Barnes & Noble"],[d,m]],[/\b(tm\d{3}\w+) b/i],[l,[f,"NuVision"],[d,m]],[/\b(k88) b/i],[l,[f,"ZTE"],[d,m]],[/\b(nx\d{3}j) b/i],[l,[f,"ZTE"],[d,v]],[/\b(gen\d{3}) b.+49h/i],[l,[f,"Swiss"],[d,v]],[/\b(zur\d{3}) b/i],[l,[f,"Swiss"],[d,m]],[/\b((zeki)?tb.*\b) b/i],[l,[f,"Zeki"],[d,m]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[f,"Dragon Touch"],l,[d,m]],[/\b(ns-?\w{0,9}) b/i],[l,[f,"Insignia"],[d,m]],[/\b((nxa|next)-?\w{0,9}) b/i],[l,[f,"NextBook"],[d,m]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[f,"Voice"],l,[d,v]],[/\b(lvtel\-)?(v1[12]) b/i],[[f,"LvTel"],l,[d,v]],[/\b(ph-1) /i],[l,[f,"Essential"],[d,v]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[l,[f,"Envizen"],[d,m]],[/\b(trio[-\w\. ]+) b/i],[l,[f,"MachSpeed"],[d,m]],[/\btu_(1491) b/i],[l,[f,"Rotor"],[d,m]],[/(shield[\w ]+) b/i],[l,[f,"Nvidia"],[d,m]],[/(sprint) (\w+)/i],[f,l,[d,v]],[/(kin\.[onetw]{3})/i],[[l,/\./g," "],[f,A],[d,v]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[l,[f,L],[d,m]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[l,[f,L],[d,v]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[f,l,[d,g]],[/droid.+; (shield) bui/i],[l,[f,"Nvidia"],[d,g]],[/(playstation [345portablevi]+)/i],[l,[f,M],[d,g]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[l,[f,A],[d,g]],[/smart-tv.+(samsung)/i],[f,[d,y]],[/hbbtv.+maple;(\d+)/i],[[l,/^/,"SmartTV"],[f,N],[d,y]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[f,"LG"],[d,y]],[/(apple) ?tv/i],[f,[l,S+" TV"],[d,y]],[/crkey/i],[[l,I+"cast"],[f,P],[d,y]],[/droid.+aft(\w)( bui|\))/i],[l,[f,w],[d,y]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[l,[f,D],[d,y]],[/(bravia[\w ]+)( bui|\))/i],[l,[f,M],[d,y]],[/(mitv-\w{5}) bui/i],[l,[f,j],[d,y]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w ]*; *(\w[^;]*);([^;]*)/i],[[f,K],[l,K],[d,y]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[d,y]],[/((pebble))app/i],[f,l,[d,b]],[/droid.+; (glass) \d/i],[l,[f,P],[d,b]],[/droid.+; (wt63?0{2,3})\)/i],[l,[f,L],[d,b]],[/(quest( 2)?)/i],[l,[f,U],[d,b]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[f,[d,_]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[l,[d,v]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[l,[d,m]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[d,m]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[d,v]],[/(android[-\w\. ]{0,9});.+buil/i],[l,[f,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[h,[c,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[h,[c,"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],[c,h],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[h,c]],os:[[/microsoft (windows) (vista|xp)/i],[c,h],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[c,[h,W,H]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[c,"Windows"],[h,W,H]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[h,/_/g,"."],[c,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[c,"Mac OS"],[h,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[h,c],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[c,h],[/\(bb(10);/i],[h,[c,k]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[h,[c,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[h,[c,T+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[h,[c,"webOS"]],[/crkey\/([\d\.]+)/i],[h,[c,I+"cast"]],[/(cros) [\w]+ ([\w\.]+\w)/i],[[c,"Chromium OS"],h],[/(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],[c,h],[/(sunos) ?([\w\.\d]*)/i],[[c,"Solaris"],h],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,/(unix) ?([\w\.]*)/i],[c,h]]},G=function(e,t){if(typeof e===a&&(t=e,e=void 0),!(this instanceof G))return new G(e,t).getResult();var r=e||(typeof n!==s&&n.navigator&&n.navigator.userAgent?n.navigator.userAgent:""),i=t?q($,t):$;return this.getBrowser=function(){var e,t={};return t[c]=void 0,t[h]=void 0,z.call(t,r,i.browser),t.major=typeof(e=t.version)===u?e.replace(/[^\d\.]/g,"").split(".")[0]:void 0,t},this.getCPU=function(){var e={};return e[p]=void 0,z.call(e,r,i.cpu),e},this.getDevice=function(){var e={};return e[f]=void 0,e[l]=void 0,e[d]=void 0,z.call(e,r,i.device),e},this.getEngine=function(){var e={};return e[c]=void 0,e[h]=void 0,z.call(e,r,i.engine),e},this.getOS=function(){var e={};return e[c]=void 0,e[h]=void 0,z.call(e,r,i.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 r},this.setUA=function(e){return r=typeof e===u&&e.length>350?K(e,350):e,this},this.setUA(r),this};if(G.VERSION="0.7.33",G.BROWSER=F([c,h,"major"]),G.CPU=F([p]),G.DEVICE=F([l,f,d,g,v,y,m,b,_]),G.ENGINE=G.OS=F([c,h]),typeof r!==s)t.exports&&(r=t.exports=G),r.UAParser=G;else if(typeof define===o&&define.amd)e.r,void 0!==G&&e.v(G);else typeof n!==s&&(n.UAParser=G);var J=typeof n!==s&&(n.jQuery||n.Zepto);if(J&&!J.ua){var Q=new G;J.ua=Q.getResult(),J.ua.get=function(){return Q.getUA()},J.ua.set=function(e){Q.setUA(e);var t=Q.getResult();for(var r in t)J.ua[r]=t[r]}}}("object"==typeof window?window:e.e)},29306,610707,e=>{"use strict";let t,r,n,i,o;
1var s,a,u,l,c,d,f,h,p,g,v,m,y,b,_,w,S,E,k,x,I,T,P,C,A,O,R,N,D,M,j,L,U,q,F,V,B,K,z,W,H,$,G,J,Q,X,Z,Y,ee,et,er,en,ei,eo,es,ea,eu,el,ec,ed,ef,eh=e.i(824627);(s=z||(z={})).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",(a=W||(W={})).IDENTIFY="$identify",a.GROUP_IDENTIFY="$groupidentify",a.REVENUE="revenue_amount";var ep="".concat("AMP","_unsent"),eg="$default_instance",ev="https://api2.amplitude.com/2/httpapi",em="dclid",ey="fbclid",eb="gbraid",e_="gclid",ew="ko_click_id",eS="li_fat_id",eE="msclkid",ek="rdt_cid",ex="ttclid",eI="twclid",eT="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},eC=["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"],eO=function(e){if(Object.keys(e).length>1e3)return!1;for(var t in e){var r=e[t];if(!eR(t,r))return!1}return!0},eR=function(e,t){var r,n;if("string"!=typeof e)return!1;if(Array.isArray(t)){var i=!0;try{for(var o=(0,eh.__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&&eO(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 eO(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,eh.__assign)({},this._properties)},e.prototype.set=function(e,t){return this._safeSet(H.SET,e,t),this},e.prototype.setOnce=function(e,t){return this._safeSet(H.SET_ONCE,e,t),this},e.prototype.append=function(e,t){return this._safeSet(H.APPEND,e,t),this},e.prototype.prepend=function(e,t){return this._safeSet(H.PREPEND,e,t),this},e.prototype.postInsert=function(e,t){return this._safeSet(H.POSTINSERT,e,t),this},e.prototype.preInsert=function(e,t){return this._safeSet(H.PREINSERT,e,t),this},e.prototype.remove=function(e,t){return this._safeSet(H.REMOVE,e,t),this},e.prototype.add=function(e,t){return this._safeSet(H.ADD,e,t),this},e.prototype.unset=function(e){return this._safeSet(H.UNSET,e,"-"),this},e.prototype.clearAll=function(){return this._properties={},this._properties[H.CLEAR_ALL]="-",this},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[H.CLEAR_ALL]||this._propertySet.has(t))&&(e===H.ADD?"number"==typeof r:e===H.UNSET||e===H.REMOVE||eR(t,r))},e}();(u=H||(H={})).SET="$set",u.SET_ONCE="$setOnce",u.ADD="$add",u.APPEND="$append",u.PREPEND="$prepend",u.REMOVE="$remove",u.PREINSERT="$preInsert",u.POSTINSERT="$postInsert",u.UNSET="$unset",u.CLEAR_ALL="$clearAll";var eD=[H.CLEAR_ALL,H.UNSET,H.SET,H.SET_ONCE,H.ADD,H.APPEND,H.PREPEND,H.PREINSERT,H.POSTINSERT,H.REMOVE];e.s(["Identify",()=>eN,"OrderedIdentifyOperations",()=>eD],610707),(l=$||($={})).Unknown="unknown",l.Skipped="skipped",l.Success="success",l.RateLimit="rate_limit",l.PayloadTooLarge="payload_too_large",l.Invalid="invalid",l.Failed="failed",l.Timeout="Timeout",l.SystemError="SystemError";var eM=function(e,t,r){return void 0===t&&(t=0),void 0===r&&(r=$.Unknown),{event:e,code:t,message:r}},ej=e.i(42926),eL=(0,eh.__spreadArray)([],(0,eh.__read)(Array(256).keys()),!1).map(function(e){return e.toString(16).padStart(2,"0")}),eU=function(e){var t,r=(0,ej.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,eU);var n=r.crypto.getRandomValues(new Uint8Array(16));return n[6]=15&n[6]|64,n[8]=63&n[8]|128,(0,eh.__spreadArray)([],(0,eh.__read)(n.entries()),!1).map(function(e){var t=(0,eh.__read)(e,2),r=t[0],n=t[1];return[4,6,8,10].includes(r)?"-".concat(eL[n]):eL[n]}).join("")},eq=function(){function e(e){this.client=e,this.queue=[],this.applying=!1,this.plugins=[]}return e.prototype.register=function(e,t){var r,n;return(0,eh.__awaiter)(this,void 0,void 0,function(){return(0,eh.__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=eU(),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,eh.__awaiter)(this,void 0,void 0,function(){var n,i;return(0,eh.__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.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,eh.__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,eh.__generator)(this,function(v){switch(v.label){case 0:if(!e)return[2];t=(0,eh.__read)(e,1)[0],r=(0,eh.__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,eh.__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,eh.__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}
1return[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,eh.__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,eh.__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,eh.__assign)({},t);return e.execute(r).catch(function(e){return eM(r,0,String(e))})})).then(function(e){var n=(0,eh.__read)(e,1)[0]||eM(t,100,"Event not tracked, no destination plugins on the instance");r(n)}),[2]}})})},e.prototype.flush=function(){return(0,eh.__awaiter)(this,void 0,void 0,function(){var e,t=this;return(0,eh.__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.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)})},e.prototype.onReset=function(){this.plugins.forEach(function(e){var t;null==(t=e.onReset)||t.call(e)})},e}(),eF=function(e,t){return(0,eh.__assign)((0,eh.__assign)({},t),{event_type:W.IDENTIFY,user_properties:e.getUserProperties()})},eV=function(e,t,r,n){var i;return(0,eh.__assign)((0,eh.__assign)({},n),{event_type:W.GROUP_IDENTIFY,group_properties:r.getUserProperties(),groups:((i={})[e]=t,i)})},eB=function(e,t,r){var n,i=new eN;return i.set(e,t),(0,eh.__assign)((0,eh.__assign)({},r),{event_type:W.IDENTIFY,user_properties:i.getUserProperties(),groups:((n={})[e]=t,n)})},eK=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 eq(this),this.name=e}return e.prototype._init=function(e){return(0,eh.__awaiter)(this,void 0,void 0,function(){return(0,eh.__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,eh.__awaiter)(this,void 0,void 0,function(){var t,r,n,i,o,s;return(0,eh.__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,eh.__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}return[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,eh.__assign)((0,eh.__assign)((0,eh.__assign)({},"string"==typeof e?{event_type:e}:e),r),t&&{event_properties:t});return eK(this.dispatch(n))},e.prototype.identify=function(e,t){var r=eF(e,t);return eK(this.dispatch(r))},e.prototype.groupIdentify=function(e,t,r,n){var i=eV(e,t,r,n);return eK(this.dispatch(i))},e.prototype.setGroup=function(e,t,r){var n=eB(e,t,r);return eK(this.dispatch(n))},e.prototype.revenue=function(e,t){var r=(0,eh.__assign)((0,eh.__assign)({},t),{event_type:W.REVENUE,event_properties:e.getEventProperties()});return eK(this.dispatch(r))},e.prototype.add=function(e){return this.isReady?this._addPlugin(e):(this.q.push(this._addPlugin.bind(this,e)),eK())},e.prototype._addPlugin=function(e){return eK(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)),eK())},e.prototype._removePlugin=function(e){return eK(this.timeline.deregister(e,this.config))},e.prototype.dispatchWithCallback=function(e,t){if(!this.isReady)return t(eM(e,0,"Client not initialized"));this.process(e).then(t)},e.prototype.dispatch=function(e){return(0,eh.__awaiter)(this,void 0,void 0,function(){var t=this;return(0,eh.__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={};if(void 0===e)return t;var r={};return Object.keys(e).forEach(function(t){Object.values(z).includes(t)||(r[t]=e[t])}),eD.forEach(function(r){if(Object.keys(e).includes(r)){var n=e[r];switch(r){case z.CLEAR_ALL:Object.keys(t).forEach(function(e){delete t[e]});break;
1case z.UNSET:Object.keys(n).forEach(function(e){delete t[e]});break;case z.SET:Object.assign(t,n)}}}),Object.assign(t,r),t},e.prototype.process=function(e){return(0,eh.__awaiter)(this,void 0,void 0,function(){var t,r,n;return(0,eh.__generator)(this,function(i){switch(i.label){case 0:if(i.trys.push([0,2,,3]),this.config.optOut)return[2,eM(e,0,"Event skipped due to optOut config")];return e.event_type===W.IDENTIFY&&(t=this.getOperationAppliedUserProperties(e.user_properties),this.timeline.onIdentityChanged({userProperties:t})),[4,this.timeline.push(e)];case 1:return 200===(r=i.sent()).code?this.config.loggerProvider.log(r.message):100===r.code?this.config.loggerProvider.warn(r.message):this.config.loggerProvider.error(r.message),[2,r];case 2:return n=String(i.sent()),this.config.loggerProvider.error(n),[2,r=eM(e,0,n)];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.timeline.onOptOutChanged(e),this.config.optOut=!!e)},e.prototype.flush=function(){return eK(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}(),eW=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},[])};(c=G||(G={}))[c.None=0]="None",c[c.Error=1]="Error",c[c.Warn=2]="Warn",c[c.Verbose=3]="Verbose",c[c.Debug=4]="Debug";var eH="Amplitude Logger ",e$=function(){function e(){this.logLevel=G.None}return e.prototype.disable=function(){this.logLevel=G.None},e.prototype.enable=function(e){void 0===e&&(e=G.Warn),this.logLevel=e},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<G.Verbose||console.log("".concat(eH,"[Log]: ").concat(e.join(" ")))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<G.Warn||console.warn("".concat(eH,"[Warn]: ").concat(e.join(" ")))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<G.Error||console.error("".concat(eH,"[Error]: ").concat(e.join(" ")))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<G.Debug||console.log("".concat(eH,"[Debug]: ").concat(e.join(" ")))},e}(),eG=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:eg,logLevel:G.Warn,loggerProvider:new e$,offline:!1,optOut:!1,serverUrl:ev,serverZone:"US",useBatch:!1}},eJ=function(){function e(e){this._optOut=!1;var t,r,n,i,o=eG();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=eQ(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}(),eQ=function(e,t,r){if(void 0===e&&(e=""),void 0===t&&(t=eG().serverZone),void 0===r&&(r=eG().useBatch),e)return{serverUrl:e,serverZone:void 0};var n,i=["US","EU"].includes(t)?t:eG().serverZone;return{serverZone:i,serverUrl:(n=r,"EU"===i?n?"https://api.eu.amplitude.com/batch":"https://api.eu.amplitude.com/2/httpapi":n?"https://api2.amplitude.com/batch":ev)}},eX=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 eY=function(e){return void 0===e&&(e=0),(Error().stack||"").split("\n").slice(2+e).map(function(e){return e.trim()})},e0=function(e){return function(){var t=(0,eh.__assign)({},e.config);return{logger:t.loggerProvider,logLevel:t.logLevel}}},e1=function(e,t){var r,n;t=(t=t.replace(/\[(\w+)\]/g,".$1")).replace(/^\./,"");try{for(var i=(0,eh.__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},e2=function(e,t){return function(){var r,n,i={};try{for(var o=(0,eh.__values)(t),s=o.next();!s.done;s=o.next()){var a=s.value;i[a]=e1(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}},e3=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<G.Debug||!l||!u)return e.apply(i,o);var c={type:"invoke public method",name:t,args:o,stacktrace:eY(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}};function e4(e){var t="";try{"body"in e&&(t=JSON.stringify(e.body,null,2))}catch(e){}return t}var e5=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,eh.__awaiter)(this,void 0,void 0,function(){var r,n=this;return(0,eh.__generator)(this,function(i){switch(i.label){case 0:return this.config=e,this.storageKey="".concat(ep,"_").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=eU()),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()})}
1,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,eh.__awaiter)(this,void 0,void 0,function(){var t,r,n=this;return(0,eh.__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,eW(t,this.config.flushQueueSize).reduce(function(t,r){return(0,eh.__awaiter)(n,void 0,void 0,function(){return(0,eh.__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,eh.__awaiter)(this,void 0,void 0,function(){var n,i,o,s;return(0,eh.__generator)(this,function(a){switch(a.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,eh.__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 eX,a.label=1;case 1:return a.trys.push([1,3,,4]),i=eQ(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,[4,this.config.transportProvider.send(i,n)];case 2:if(null===(o=a.sent()))return this.fulfillRequest(e,0,"Unexpected error occurred"),[2];if(!t)return"body"in o?this.fulfillRequest(e,o.statusCode,"".concat(o.status,": ").concat(e4(o))):this.fulfillRequest(e,o.statusCode,o.status),[2];return this.handleResponse(o,e),[3,4];case 3:var u;return s=(u=a.sent())instanceof Error?u.message:String(u),this.config.loggerProvider.error(s),null==(r=this.diagnosticsClient)||r.recordEvent("analytics.events.unsuccessful.from.catch.error",{events:e.map(function(e){return e.event.event_type}),message:s,stack_trace:eY()}),this.handleResponse({status:$.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:e4(e),stack_trace:eY()});var r,n=e.status;switch(n){case $.Success:this.handleSuccessResponse(e,t);break;case $.Invalid:this.handleInvalidResponse(e,t);break;case $.PayloadTooLarge:this.handlePayloadTooLargeResponse(e,t);break;case $.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,eh.__spreadArray)((0,eh.__spreadArray)((0,eh.__spreadArray)((0,eh.__spreadArray)([],(0,eh.__read)(Object.values(e.body.eventsWithInvalidFields)),!1),(0,eh.__read)(Object.values(e.body.eventsWithMissingFields)),!1),(0,eh.__read)(Object.values(e.body.eventsWithInvalidIdLengths)),!1),(0,eh.__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(e4(e));
1var 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(e4(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(e4(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:eY()})),this.removeEvents(e),e.forEach(function(e){return e.callback(eM(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}(),e6=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){return eO(e)&&(this.properties=e),this},e.prototype.getEventProperties=function(){var e=this.properties?(0,eh.__assign)({},this.properties):{};return e[J.REVENUE_PRODUCT_ID]=this.productId,e[J.REVENUE_QUANTITY]=this.quantity,e[J.REVENUE_PRICE]=this.price,e[J.REVENUE_TYPE]=this.revenueType,e[J.REVENUE_CURRENCY]=this.currency,e[J.REVENUE]=this.revenue,e[J.RECEIPT]=this.receipt,e[J.RECEIPT_SIG]=this.receiptSig,e},e}();(d=J||(J={})).REVENUE_PRODUCT_ID="$productId",d.REVENUE_QUANTITY="$quantity",d.REVENUE_PRICE="$price",d.REVENUE_TYPE="$revenueType",d.REVENUE_CURRENCY="$currency",d.REVENUE="$revenue",d.RECEIPT="$receipt",d.RECEIPT_SIG="$receiptSig";var e8=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:e7(),platform:"Web",os:void 0,deviceModel:void 0}},e}(),e7=function(){return"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},e9=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}(),te=function(){return(te=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 tt(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);
1if(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 tr(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 tn=function(e,t){var r,n,i=typeof e;if(i!==typeof t)return!1;try{for(var o=tt(["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(!tn(e[l],t[l]))return!1}else{if(!tn(Object.keys(e).sort(),Object.keys(t).sort()))return!1;var c=!0;return Object.keys(e).forEach(function(r){tn(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 ti=function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var e=this,t=te({},this.identity.userProperties),r=te(te({},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=tt(Object.entries(e)),c=l.next();!c.done;c=l.next()){var d=tr(c.value,2),f=d[0],h=d[1];switch(f){case"$set":try{for(var p=(i=void 0,tt(Object.entries(h))),g=p.next();!g.done;g=p.next()){var v=tr(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,tt(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 te({},this.identity)},e.prototype.setIdentity=function(e){var t=te({},this.identity);this.identity=te({},e),tn(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}(),to="undefined"!=typeof globalThis?globalThis:e.g,ts=function(){function e(){this.identityStore=new ti,this.eventBridge=new e9,this.applicationContextProvider=new e8}return e.getInstance=function(t){return to.analyticsConnectorInstances||(to.analyticsConnectorInstances={}),to.analyticsConnectorInstances[t]||(to.analyticsConnectorInstances[t]=new e),to.analyticsConnectorInstances[t]},e}(),ta=function(e){return void 0===e&&(e=eg),ts.getInstance(e)},tu=function(e,t){ta(t).identityStore.editIdentity().setUserId(e).commit()},tl=function(e,t){ta(t).identityStore.editIdentity().setDeviceId(e).commit()},tc=function(e,t){return void 0===t&&(t=Date.now()),Date.now()-t>e},td=function(){function e(){this.name="identity",this.type="before",this.identityStore=ta().identityStore}return e.prototype.execute=function(e){return(0,eh.__awaiter)(this,void 0,void 0,function(){var t;return(0,eh.__generator)(this,function(r){return(t=e.user_properties)&&this.identityStore.editIdentity().updateUserProperties(t).commit(),[2,e]})})},e.prototype.setup=function(e){return(0,eh.__awaiter)(this,void 0,void 0,function(){return(0,eh.__generator)(this,function(t){return e.instanceName&&(this.identityStore=ta(e.instanceName).identityStore),[2]})})},e}(),tf=function(){var e,t=(0,ej.getGlobalScope)();return(null==(e=null==t?void 0:t.location)?void 0:e.search)?t.location.search.substring(1).split("&").filter(
1Boolean).reduce(function(e,t){var r=t.split("=",2),n=th(r[0]),i=th(r[1]);return i&&(e[n]=i),e},{}):{}},th=function(e){void 0===e&&(e="");try{return decodeURIComponent(e)}catch(e){return""}},tp=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}(),tg=function(){function e(e,t,r,n){void 0===r&&(r="US"),this.callbackInfos=[],this.lastSuccessfulFetch=null,this.fetchPromise=null,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 tp(e,t)}return e.prototype.subscribe=function(e,t,r){var n=eU(),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,eh.__awaiter)(this,void 0,void 0,function(){var e,t=this;return(0,eh.__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.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,eh.__awaiter)(this,void 0,void 0,function(){var t,r,n,i=this;return(0,eh.__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
1allback because cache is empty (first time user).")),[4,t];case 2:return o.sent(),[2]}})})},e.prototype.subscribeWaitForRemote=function(e,t){return(0,eh.__awaiter)(this,void 0,void 0,function(){var r,n;return(0,eh.__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,eh.__awaiter)(this,void 0,void 0,function(){var r,n,i,o,s,a,u=this;return(0,eh.__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;return(0,eh.__generator)(this,function(d){switch(d.label){case 0:i=new AbortController,s=setTimeout(function(){return i.abort()},t),d.label=1;case 1:return d.trys.push([1,7,8,9]),[4,fetch(o.getUrlParams(),{method:"GET",headers:{Accept:"*/*"},signal:i.signal})];case 2:if((a=d.sent()).ok)return[3,4];return[4,a.text()];case 3:return l=d.sent(),o.logger.debug("Remote config client fetch with retry time ".concat(e," failed with ").concat(a.status,": ").concat(l)),[3,6];case 4:return[4,a.json()];case 5:return[2,{value:{remoteConfig:d.sent(),lastFetch:new Date}}];case 6:return[3,9];case 7:return(c=d.sent())instanceof Error&&"AbortError"===c.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: "),c),[3,9];case 8:return clearTimeout(s),[7];case 9:if(!(n<e-1))return[3,11];return[4,new Promise(function(e){return setTimeout(e,u.getJitterDelay(r))})];case 10:d.sent(),d.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];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}(),tv="tags",tm="counters",ty="histograms",tb="events",t_="internal",tw="last_flush_timestamp",tS=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,ej.getGlobalScope)())?void 0:e.indexedDB)!==void 0},e.prototype.getDB=function(){return(0,eh.__awaiter)(this,void 0,void 0,function(){return(0,eh.__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(tv)||e.createObjectStore(tv,{keyPath:"key"}),e.objectStoreNames.contains(tm)||e.createObjectStore(tm,{keyPath:"key"}),e.objectStoreNames.contains(ty)||e.createObjectStore(ty,{keyPath:"key"}),e.objectStoreNames.contains(tb)||e.createObjectStore(tb,{keyPath:"id",autoIncrement:!0}).createIndex("time_idx","time",{unique:!1}),e.objectStoreNames.contains(t_)||e.createObjectStore(t_,{keyPath:"key"})},e.prototype.setTags=function(e){return(0,eh.__awaiter)(this,void 0,void 0,function(){var t,r,n,i=this;return(0,eh.__generator)(this,function(o){switch(o.label){case 0:if(o.tr
1ys.push([0,2,,3]),0===Object.entries(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){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,eh.__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,eh.__awaiter)(this,void 0,void 0,function(){var t,r,n,i=this;return(0,eh.__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([tm],"readwrite")).objectStore(tm),[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,eh.__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,eh.__awaiter)(this,void 0,void 0,function(){var t,r,n,i=this;return(0,eh.__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([ty],"readwrite")).objectStore(ty),[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,eh.__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,eh.__awaiter)(this,void 0,void 0,function(){var t,r,n,i=this;return(0,eh.__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([tb],"readwrite")).objectStore(tb),[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,eh.__awaiter)(this,void 0,void 0,function(){var r,n,i;return(0,eh.__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([t_],"readwrite")).objectStore(t_),[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,eh.__awaiter)(this,void 0,void 0,function(){var t,r,n;return(0,eh.__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([t_],"readonly")).objectStore(t_),[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,eh.__awaiter)(this,void 0,void 0,function(){var e,t;return(0,eh.__generator)(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.getInternal(tw)];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,eh.__awaiter)(this,void 0,void 0,function(){var t;return(0,eh.__generator)(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.setInternal(tw,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,eh.__awaiter)(this,void 0,void 0,function(){var e,t,r,n,i,o,s;return(0,eh.__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([tv,tm,ty,tb],"readwrite"),[4,Promise.all([this.getAllFromStore(e,tv),this.getAllFromStore(e,tm),this.getAllFromStore(e,ty),this.getAllFromStore(e,tb)])];case 2:return r=(t=eh.__read.apply(void 0,[a.sent(),4]))[0],n=t[1],i=t[2],o=t[3],[4,Promise.all([this.clearTable(e,tm),this.clearTable(e,ty),this.clearTable(e,tb)])];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}(),tE=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}
1,tk=function(e,t){return 31*Math.abs(tE(e.toString()))%1e5/1e5<t},tx=function(){var e=(0,ej.getGlobalScope)();return null==e?void 0:e.__AMPLITUDE_SCRIPT_URL__},tI=function(e){var t=(0,ej.getGlobalScope)();if(t&&"function"==typeof t.addEventListener){var r=function(t){e.recordEvent("sdk.error.uncaught",(0,eh.__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=tT({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=tP(i),s=tT({filename:o,stack:i});s&&r({type:"unhandledrejection",message:null!=(t=null==n?void 0:n.message)?t:tC(e.reason),stack:i,filename:o,errorName:null==n?void 0:n.name,metadata:{isTrusted:e.isTrusted,matchReason:s}})},!0)}},tT=function(e){var t=tx();if(t){if(e.filename&&e.filename.includes(t))return"filename";if(e.stack&&e.stack.includes(t))return"stack"}},tP=function(e){if(e){var t=e.match(/(https?:\/\/\S+?)(?=[)\s]|$)/);return t?t[1]:void 0}},tC=function(e){if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(e){return"[object Object]"}},tA=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,eh.__assign)({enabled:!0,sampleRate:0},n),this.startTimestamp=Date.now(),this.shouldTrack=tk(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,tS.isSupported()?this.storage=new tS(e,t):this.logger.debug("DiagnosticsClient: IndexedDB is not supported"),this.initializeFlushInterval(),this.shouldTrack&&(this.increment("sdk.diagnostics.sampled.in.and.enabled"),tI(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,eh.__awaiter)(this,void 0,void 0,function(){var e,t,r,n;return(0,eh.__generator)(this,function(i){switch(i.label){case 0:if(!this.storage)return[2];return e=(0,eh.__assign)({},this.inMemoryTags),t=(0,eh.__assign)({},this.inMemoryCounters),r=(0,eh.__assign)({},this.inMemoryHistograms),n=(0,eh.__spreadArray)([],(0,eh.__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,eh.__awaiter)(this,void 0,void 0,function(){var e,t,r,n,i,o,s,a,u,l;return(0,eh.__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={}
1,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,eh.__awaiter)(this,void 0,void 0,function(){var t;return(0,eh.__generator)(this,function(r){switch(r.label){case 0:if(r.trys.push([0,2,,3]),!(0,ej.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,eh.__awaiter)(this,void 0,void 0,function(){var e,t,r;return(0,eh.__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=tk(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,this.logger.debug("DiagnosticsClient: Should track is",this.shouldTrack)},e}(),tO=function(e,t){return"boolean"==typeof e?e:(null==e?void 0:e[t])!==!1},tR=function(e){return tO(e,"attribution")},tN=function(e){return tO(e,"pageViews")},tD=function(e){return tO(e,"sessions")},tM=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.networkTracking||"object"==typeof e.networkTracking)},tj=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.elementInteractions||"object"==typeof e.elementInteractions)},tL=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.frustrationInteractions||"object"==typeof e.frustrationInteractions)},tU=function(e){if(tj(e.autocapture)&&"object"==typeof e.autocapture&&"object"==typeof e.autocapture.elementInteractions)return e.autocapture.elementInteractions},tq=function(e){if(tL(e.autocapture)&&"object"==typeof e.autocapture&&"object"==typeof e.autocapture.frustrationInteractions)return e.autocapture.frustrationInteractions},tF=function(e){var t;if(tM(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,eh.__assign)((0,eh.__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,eh.__assign)((0,eh.__assign)({},t),{hosts:void 0})}return t})})}},tV=function(e){var t,r=function(){return!1},n=void 0,i=e.pageCounter;return tN(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}},tB=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},tK=function(e){return e&&void 0!==e._q},tz=function(){if("undefined"==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:""},tW="2.33.0",tH="amplitude-ts",t$=function(){function e(){this.name="@amplitude/plugin-context-browser",this.type="before",this.library="".concat(tH,"/").concat(tW),"undefined"!=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,eh.__awaiter)(this,void 0,void 0,function(){var n,i,o;return(0,eh.__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,eh.__assign)((0,eh.__assign)((0,eh.__assign)((0,eh.__assign)((0,eh.__assign)((0,eh.__assign)((0,eh.__assign)((0,eh.__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:eU(),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}(),tG=function(){function e(){this.memoryStorage=new Map}return e.prototype.isEnabled=function(){return(0,eh.__awaiter)(this,void 0,void 0,function(){return(0,eh.__generator)(this,function(e){return[2,!0]})})},e.prototype.get=function(e){return(0,eh.__awaiter)(this,void 0,void 0,function(){return(0,eh.__generator)(this,function(t){return[2,this.memoryStorage.get(e)]})})},e.prototype.getRaw=function(e){return(0,eh.__awaiter)(this,void 0,void 0,function(){var t;return(0,eh.__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,eh.__awaiter)(this,void 0,void 0,function(){return(0,eh.__generator)(this,function(r){return this.memoryStorage.set(e,t),[2]})})},e.prototype.remove=function(e){return(0,eh.__awaiter)(this,void 0,void 0,function(){return(0,eh.__generator)(this,function(t){return this.memoryStorage.delete(e),[2]})})},e.prototype.reset=function(){return(0,eh.__awaiter)(this,void 0,void 0,function(){return(0,eh.__generator)(this,function(e){return this.memoryStorage.clear(),[2]})})},e}(),tJ=function(){function e(e){this.options=(0,eh.__assign)({},e)}return e.prototype.isEnabled=function(){return(0,eh.__awaiter)(this,void 0,void 0,function(){var t,r;return(0,eh.__generator)(this,function(n){switch(n.label){case 0:if(!(0,ej.getGlobalScope)())return[2,!1];e.testValue=String(Date.now()),t=new e(this.options),r="AMP_TEST",n.label=1;case 1:return n.trys.push([1,4,5,7]),[4,t.set(r,e.testValue)];case 2:return n.sent(),[4,t.get(r)];case 3:return[2,n.sent()===e.testValue];case 4:return n.sent(),[2,!1];case 5:return[4,t.remove(r)];case 6:return n.sent(),[7];case 7:return[2]}})})},e.prototype.get=function(e){var t;return(0,eh.__awaiter)(this,void 0,void 0,function(){var r,n;return(0,eh.__generator)(this,function(i){switch(i.label){case 0:return[4,this.getRaw(e)];case 1:if(!(r=i.sent()))return[2,void 0];try{if(n=null!=(t=tQ(r))?t:tX(r),void 0===n)return console.error("Amplitude Logger [Error]: Failed to decode cookie value for key: ".concat(e,", value: ").concat(r)),[2,void 0];return[2,JSON.parse(n)]}catch(t){return console.error("Amplitude Logger [Error]: Failed to parse cookie value for key: ".concat(e,", value: ").concat(r)),[2,void 0]}}})})},e.prototype.getRaw=function(e){var t,r;return(0,eh.__awaiter)(this,void 0,void 0,function(){var n,i;return(0,eh.__generator)(this,function(o){return(i=(null!=(r=null==(t=null==(n=(0,ej.getGlobalScope)())?void 0:n.document)?void 0:t.cookie.split("; "))?r:[]).find(function(t){return 0===t.indexOf(e+"=")}))?[2,i.substring(e.length+1)]:[2,void 0]})})},e.prototype.set=function(e,t){var r;return(0,eh.__awaiter)(this,void 0,void 0,function(){var n,i,o,s,a,u,l;return(0,eh.__generator)(this,function(c){try{n=null!=(r=this.options.expirationDays)?r:0,i=null!==t?n:-1,o=void 0,i&&((s=new Date).setTime(s.getTime()+24*i*36e5),o=s),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)),(u=(0,ej.getGlobalScope)())&&(u.document.cookie=a)}catch(t){l=t instanceof Error?t.message:String(t),console.error("Amplitude Logger [Error]: Failed to set cookie for key: ".concat(e,". Error: ").concat(l))}return[2]})})},e.prototype.remove=function(e){return(0,eh.__awaiter)(this,void 0,void 0,function(){return(0,eh.__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,eh.__awaiter)(this,void 0,void 0,function(){return(0,eh.__generator)(this,function(e){return[2]})})},e}(),tQ=function(e){try{return decodeURIComponent(atob(e))}catch(e){return}},tX=function(e){try{return decodeURIComponent(atob(decodeURIComponent(e)))}catch(e){return}},tZ=function(e,t,r){return void 0===t&&(t=""),void 0===r&&(r=10),["AMP",t,e.substring(0,r)].filter(
1Boolean).join("_")},tY=function(){function e(){}return e.prototype.send=function(e,t){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 $.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 $.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 $.PayloadTooLarge:return{status:k,statusCode:E,body:{error:null!=(g=e.error)?g:""}};case $.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 $.Timeout:default:return{status:k,statusCode:E}}},e.prototype.buildStatus=function(e){return eZ(e)?$.Success:429===e?$.RateLimit:413===e?$.PayloadTooLarge:408===e?$.Timeout:e>=400&&e<500?$.Invalid:e>=500?$.Failed:$.Unknown},e}(),t0=function(e){function t(t){void 0===t&&(t={});var r=e.call(this)||this;return r.customHeaders=t,r}return(0,eh.__extends)(t,e),t.prototype.send=function(e,t){return(0,eh.__awaiter)(this,void 0,void 0,function(){var r,n;return(0,eh.__generator)(this,function(i){switch(i.label){case 0:if("undefined"==typeof fetch)throw Error("FetchTransport is not supported");return[4,fetch(e,{headers:(0,eh.__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}(tY),t1=function(){function e(e){this.storage=e}return e.prototype.isEnabled=function(){return(0,eh.__awaiter)(this,void 0,void 0,function(){var t,r,n;return(0,eh.__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,eh.__awaiter)(this,void 0,void 0,function(){var t;return(0,eh.__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,eh.__awaiter)(this,void 0,void 0,function(){return(0,eh.__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,eh.__awaiter)(this,void 0,void 0,function(){return(0,eh.__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,eh.__awaiter)(this,void 0,void 0,function(){return(0,eh.__generator)(this,function(r){try{null==(t=this.storage)||t.removeItem(e)}catch(e){}return[2]})})},e.prototype.reset=function(){var e;return(0,eh.__awaiter)(this,void 0,void 0,function(){return(0,eh.__generator)(this,function(t){try{null==(e=this.storage)||e.clear()}catch(e){}return[2]})})},e}(),t2=function(e){function t(t){var r,n,i,o=this;try{i=null==(r=(0,ej.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,eh.__extends)(t,e),t.prototype.set=function(t,r){var n;return(0,eh.__awaiter)(this,void 0,void 0,function(){var i;return(0,eh.__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}(t1),t3=function(e){function t(){var t;return e.call(this,null==(t=(0,ej.getGlobalScope)())?void 0:t.sessionStorage)||this}return(0,eh.__extends)(t,e),t}(t1),t4=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,eh.__extends)(t,e),t.prototype.send=function(e,t){return(0,eh.__awaiter)(this,void 0,void 0,function(){var r=this;return(0,eh.__generator)(this,function(n){return[2,new Promise(function(n,i){"undefined"==typeof XMLHttpRequest&&i(Error("XHRTransport is not supported."));var o,s,a=new XMLHttpRequest;a.open("POST",e,!0),a.onreadystatechange=function(){if(a.readyState===r.state.done){var e=a.responseText;try{n(r.buildResponse(JSON.parse(e)))}catch(e){n(r.buildResponse({code:a.status}))}}};var u=(0,eh.__assign)({"Content-Type":"application/json",Accept:"*/*"},r.customHeaders);try{for(var l=(0,eh.__values)(Object.entries(u)),c=l.next();!c.done;c=l.next()){var d=(0,eh.__read)(c.value,2),f=d[0],h=d[1];a.setRequestHeader(f,h)}}catch(e){o={error:e}}finally{try{c&&!c.done&&(s=l.return)&&s.call(l)}finally{if(o)throw o.error}}a.send(JSON.stringify(t))})]})})},t}(tY),t5=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,eh.__extends)(t,e),t.prototype.send=function(e,t){return(0,eh.__awaiter)(this,void 0,void 0,function(){var r=this;return(0,eh.__generator)(this,function(n){return[2,new Promise(function(n,i){var o=(0,ej.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,JSON.stringify(t)))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}(tY),t6=function(e){var t=parseInt(e,32);if(!isNaN(t))return t},t8=function(e){if(atob&&escape&&e)try{return decodeURIComponent(escape(atob(e)))}catch(e){return}},t7="[Amplitude]",t9="".concat(t7," Form Started"),re="".concat(t7," Form Submitted"),rt="".concat(t7," File Downloaded"),rr="session_start",rn="session_end",ri="".concat(t7," File Extension"),ro="".concat(t7," File Name"),rs="".concat(t7," Link ID"),ra="".concat(t7," Link Text"),ru="".concat(t7," Link URL"),rl="".concat(t7," Form ID"),rc="".concat(t7," Form Name"),rd="".concat(t7," Form Destination"),rf="cookie",rh=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,
1k,x,I,T,P,C,A,O,R,N,D,M,j,L,U,q,F){void 0===n&&(n=new tG),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=rf),void 0===v&&(v=new e$),void 0===m&&(m=G.Warn),void 0===b&&(b=!1),void 0===_&&(_=!1),void 0===E&&(E=""),void 0===k&&(k="US"),void 0===I&&(I=18e5),void 0===T&&(T=new t2({loggerProvider:v})),void 0===P&&(P={ipAddress:!0,language:!0,platform:!0}),void 0===C&&(C="fetch"),void 0===A&&(A=!1),void 0===O&&(O=!0),void 0===L&&(L=!0),void 0===U&&(U=0);var V,B=e.call(this,{apiKey:t,storageProvider:T,transportProvider:rg(C)})||this;return B.apiKey=t,B.appVersion=r,B.cookieOptions=i,B.defaultTracking=o,B.autocapture=s,B.flushIntervalMillis=u,B.flushMaxRetries=l,B.flushQueueSize=c,B.identityStorage=d,B.ingestionMetadata=f,B.instanceName=h,B.loggerProvider=v,B.logLevel=m,B.minIdLength=y,B.offline=b,B.partnerId=w,B.plan=S,B.serverUrl=E,B.serverZone=k,B.sessionTimeout=I,B.storageProvider=T,B.trackingOptions=P,B.transport=C,B.useBatch=A,B.fetchRemoteConfig=O,B.networkTrackingOptions=M,B.identify=j,B.enableDiagnostics=L,B.diagnosticsSampleRate=U,B.diagnosticsClient=q,B.remoteConfig=F,B.version=tW,B._optOut=!1,B._cookieStorage=n,B.deviceId=a,B.lastEventId=p,B.lastEventTime=g,B.optOut=_,B.sessionId=x,B.pageCounter=N,B.userId=R,B.debugLogsEnabled=D,B.loggerProvider.enable(D?G.Debug:B.logLevel),B.networkTrackingOptions=M,B.identify=j,B.enableDiagnostics=L,B.diagnosticsSampleRate=U,B.diagnosticsClient=q,V=(null==F?void 0:F.fetchRemoteConfig)===!0||(null==F?void 0:F.fetchRemoteConfig)!==!1&&!1!==O,B.remoteConfig=B.remoteConfig||{},B.remoteConfig.fetchRemoteConfig=V,B.fetchRemoteConfig=V,B}return(0,eh.__extends)(t,e),Object.defineProperty(t.prototype,"cookieStorage",{get:function(){return this._cookieStorage},set:function(e){this._cookieStorage!==e&&(this._cookieStorage=e,this.updateStorage())},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,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,optOut:this._optOut,lastEventTime:this._lastEventTime,lastEventId:this._lastEventId,pageCounter:this._pageCounter,debugLogsEnabled:this._debugLogsEnabled};this.cookieStorage.set(tZ(this.apiKey),e)},t}(eJ),rp=function(e,t){switch(void 0===e&&(e=rf),void 0===t&&(t={}),e){case"localStorage":return new t2;case"sessionStorage":return new t3;case"none":return new tG;default:return new tJ((0,eh.__assign)((0,eh.__assign)({},t),{expirationDays:t.expiration}))}},rg=function(e){var t="object"==typeof e?e.type:e,r="object"==typeof e?e.headers:void 0;return"xhr"===t?new t4(r):"beacon"===t?new t5:new t0(r)},rv="data-amp-mask",rm="*****",ry=/\b(?:\d[ -]*?){13,16}\b/,rb=/(\d{3}-?\d{2}-?\d{4})/g,r_=/[^\s@]+@[^\s@.]+\.[^\s@]+/g,rw=function(e,t){if(void 0===t&&(t=[]),"string"!=typeof e)return"";var r,n,i=e;i=(i=(i=i.replace(ry,rm)).replace(rb,rm)).replace(r_,rm);try{for(var o=(0,eh.__values)(t),s=o.next();!s.done;s=o.next()){var a=s.value;try{i=i.replace(a,rm)}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},rS=function(e){if("undefined"==typeof document||!document.title)return"";var t=document.querySelector("title");return t&&t.hasAttribute(rv)?rm:e?e(document.title):document.title},rE=function(){function e(){}return e.prototype.parse=function(){return(0,eh.__awaiter)(this,void 0,void 0,function(){return(0,eh.__generator)(this,function(e){return[2,(0,eh.__assign)((0,eh.__assign)((0,eh.__assign)((0,eh.__assign)({},eP),this.getUtmParam()),this.getReferrer()),this.getClickIds())]})})},e.prototype.getUtmParam=function(){var e=tf();
1return{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=tf();return(e={})[em]=t[em],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[ex]=t[ex],e[eI]=t[eI],e[eT]=t[eT],e},e}(),rk=function(e){var t={};for(var r in e){var n=e[r];n&&(t[r]=n)}return t},rx=function(e){void 0===e&&(e={});var t,r,n=(0,ej.getGlobalScope)(),i=void 0,o=!1,s=e.trackOn,a=e.trackHistoryChanges,u=e.eventType,l=void 0===u?"[Amplitude] Page Viewed":u,c=function(e){var t=e;try{t=decodeURI(e)}catch(e){null==i||i.error("Malformed URI sequence: ",e)}return t},d=function(){return(0,eh.__awaiter)(void 0,void 0,void 0,function(){var e,t,r;return(0,eh.__generator)(this,function(n){switch(n.label){case 0:return e=c("undefined"!=typeof location&&location.href||""),r={event_type:l},t=[{}],[4,rI()];case 1:return[2,(r.event_properties=eh.__assign.apply(void 0,[eh.__assign.apply(void 0,t.concat([n.sent()])),{"[Amplitude] Page Domain":"undefined"!=typeof location&&location.hostname||"","[Amplitude] Page Location":e,"[Amplitude] Page Path":"undefined"!=typeof location&&c(location.pathname)||"","[Amplitude] Page Title":rS(rw),"[Amplitude] Page URL":e.split("?")[0]}]),r)]}})})},f=function(){return void 0===s||"function"==typeof s&&s()},h="undefined"!=typeof location?location.href:null,p=function(){return(0,eh.__awaiter)(void 0,void 0,void 0,function(){var e,r,n,o;return(0,eh.__generator)(this,function(s){switch(s.label){case 0:if(r=rP(a,e=location.href,h||"")&&f(),h=e,!r)return[3,4];if(null==i||i.log("Tracking page view event"),null!=t)return[3,1];return[3,3];case 1:return o=(n=t).track,[4,d()];case 2:o.apply(n,[s.sent()]),s.label=3;case 3:s.label=4;case 4:return[2]}})})},g=function(){p()};return{name:"@amplitude/plugin-page-view-tracking-browser",type:"enrichment",setup:function(e,s){return(0,eh.__awaiter)(void 0,void 0,void 0,function(){var a,u;return(0,eh.__generator)(this,function(l){switch(l.label){case 0:if(t=s,r=e,(i=e.loggerProvider).log("Installing @amplitude/plugin-page-view-tracking-browser"),o=!0,n&&(n.addEventListener("popstate",g),n.history.pushState=new Proxy(n.history.pushState,{apply:function(e,t,r){var n=(0,eh.__read)(r,3),i=n[0],s=n[1],a=n[2];e.apply(t,[i,s,a]),o&&p()}})),!f())return[3,2];return i.log("Tracking page view event"),u=(a=t).track,[4,d()];case 1:u.apply(a,[l.sent()]),l.label=2;case 2:return[2]}})})},execute:function(e){return(0,eh.__awaiter)(void 0,void 0,void 0,function(){var t;return(0,eh.__generator)(this,function(n){switch(n.label){case 0:if(!("attribution"===s&&rT(e)))return[3,2];return null==i||i.log("Enriching campaign event to page view event with campaign parameters"),[4,d()];case 1:e.event_type=(t=n.sent()).event_type,e.event_properties=(0,eh.__assign)((0,eh.__assign)({},e.event_properties),t.event_properties),n.label=2;case 2:return r&&e.event_type===l&&(r.pageCounter=r.pageCounter?r.pageCounter+1:1,e.event_properties=(0,eh.__assign)((0,eh.__assign)({},e.event_properties),{"[Amplitude] Page Counter":r.pageCounter})),[2,e]}})})},teardown:function(){return(0,eh.__awaiter)(void 0,void 0,void 0,function(){return(0,eh.__generator)(this,function(e){return n&&(n.removeEventListener("popstate",g),o=!1),[2]})})}}},rI=function(){return(0,eh.__awaiter)(void 0,void 0,void 0,function(){var e;return(0,eh.__generator)(this,function(t){switch(t.label){case 0:return e=rk,[4,new rE().parse()];case 1:return[2,e.apply(void 0,[t.sent()])]}})})},rT=function(e){if("$identify"===e.event_type&&e.user_properties){var t=e.user_properties,r=t[z.SET]||{},n=t[z.UNSET]||{},i=(0,eh.__spreadArray)((0,eh.__spreadArray)([],(0,eh.__read)(Object.keys(r)),!1),(0,eh.__read)(Object.keys(n)),!1);return Object.keys(eP).every(function(e){return i.includes(e)})}return!1},rP=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},rC=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-form-interaction-tracking-browser",type:"enrichment",setup:function(t,n){return(0,eh.__awaiter)(void 0,void 0,void 0,function(){var i,o;return(0,eh.__generator)(this,function(s){return i=function(){if(!n)return void t.loggerProvider.warn("Form interaction tracking requires a later version of @amplitude/analytics-browser. Form interaction events are not tracked.");if("undefined"!=typeof document){var i=function(e){var t=!1;r(e,"change",function(){var r,i=rO(e);t||n.track(t9,((r={})[rl]=rA(e.id),r[rc]=rA(e.name),r[rd]=i,r)),t=!0}),r(e,"submit",function(){var r,i,o=rO(e);t||n.track(t9,((r={})[rl]=rA(e.id),r[rc]=rA(e.name),r[rd]=o,r)),n.track(re,((i={})[rl]=rA(e.id),i[rc]=rA(e.name),i[rd]=o,i)),t=!1})};
1Array.from(document.getElementsByTagName("form")).forEach(i),"undefined"!=typeof MutationObserver&&(e=new MutationObserver(function(e){e.forEach(function(e){e.addedNodes.forEach(function(e){"FORM"===e.nodeName&&i(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&Array.from(e.querySelectorAll("form")).map(i)})})})).observe(document.body,{subtree:!0,childList:!0})}},"complete"===document.readyState?i():(o=(0,ej.getGlobalScope)())?o.addEventListener("load",i):t.loggerProvider.debug("Form interaction tracking is not installed because global is undefined."),[2]})})},execute:function(e){return(0,eh.__awaiter)(void 0,void 0,void 0,function(){return(0,eh.__generator)(this,function(t){return[2,e]})})},teardown:function(){return(0,eh.__awaiter)(void 0,void 0,void 0,function(){return(0,eh.__generator)(this,function(t){return null==e||e.disconnect(),n(),[2]})})}}},rA=function(e){if("string"==typeof e)return e},rO=function(e){var t=e.getAttribute("action");try{t=new URL(encodeURI(null!=t?t:""),window.location.href).href}catch(e){}return t},rR=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,eh.__awaiter)(void 0,void 0,void 0,function(){var i,o;return(0,eh.__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("undefined"!=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(rt,((r={})[ri]=s,r[ro]=t.pathname,r[rs]=e.id,r[ra]=e.text,r[ru]=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)(\?.+)?$/;Array.from(document.getElementsByTagName("a")).forEach(i),"undefined"!=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,ej.getGlobalScope)())?o.addEventListener("load",i):t.loggerProvider.debug("File download tracking is not installed because global is undefined."),[2]})})},execute:function(e){return(0,eh.__awaiter)(void 0,void 0,void 0,function(){return(0,eh.__generator)(this,function(t){return[2,e]})})},teardown:function(){return(0,eh.__awaiter)(void 0,void 0,void 0,function(){return(0,eh.__generator)(this,function(t){return null==e||e.disconnect(),n(),[2]})})}}},rN=!1,rD=function(e){rN||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."),rN=!0)},rM=function(){var e=(0,ej.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,eh.__awaiter)(void 0,void 0,void 0,function(){return(0,eh.__generator)(this,function(n){return"undefined"==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,eh.__awaiter)(void 0,void 0,void 0,function(){return(0,eh.__generator)(this,function(e){return n(),[2]})})}}};function rj(e,t,r){var n,i,o=[];try{for(var s=(0,eh.__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 rL=["a","button","input","select","textarea","label","video","audio",'[contenteditable="true" i]',"[data-amp-default-track]",".amp-default-track"],rU="data-amp-track-",rq=["div","span","h1","h2","h3","h4","h5","h6"];function rF(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function rV(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function rB(e,t,r){return t&&rV(e.prototype,t),r&&rV(e,r),e}var rK=function(){return"function"==typeof Symbol},rz=function(e){return rK()&&!!Symbol[e]},rW=function(e){return rz(e)?Symbol[e]:"@@"+e};rK()&&!rz("observable")&&(Symbol.observable=Symbol("observable"));var rH=rW("iterator"),r$=rW("observable"),rG=rW("species");function rJ(e,t){var r=e[t];if(null!=r){if("function"!=typeof r)throw TypeError(r+" is not a function");return r}}function rQ(e){var t=e.constructor;return void 0!==t&&null===(t=t[rG])&&(t=void 0),void 0!==t?t:r5}function rX(e){rX.log?rX.log(e):setTimeout(function(){throw e})}function rZ(e){Promise.resolve().then(function(){try{e()}catch(e){rX(e)}})}function rY(e){var t=e._cleanup;if(void 0!==t&&(e._cleanup=void 0,t))try{if("function"==typeof t)t();else{var r=rJ(t,"unsubscribe");r&&r.call(t)}}catch(e){rX(e)}}function r0(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function r1(e,t,r){e._state="running";var n=e._observer;try{var i=rJ(n,t);switch(t){case"next":i&&i.call(n,r);break;case"error":if(r0(e),i)i.call(n,r);else throw r;break;case"complete":r0(e),i&&i.call(n)}}catch(e){rX(e)}"closed"===e._state?rY(e):"running"===e._state&&(e._state="ready")}function r2(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}],rZ(function(){var t=e._queue;if(t){e._queue=void 0,e._state="ready";for(var r=0;r<t.length&&(r1(e,t[r].type,t[r].value),"closed"!==e._state);++r);}});return}r1(e,t,r)}}var r3=function(){function e(e,t){this._cleanup=void 0,this._observer=e,this._queue=void 0,this._state="initializing";var r=new r4(this);try{this._cleanup=t.call(void 0,r)}catch(e){r.error(e)}"initializing"===this._state&&(this._state="ready")}return e.prototype.unsubscribe=function(){"closed"!==this._state&&(r0(this),rY(this))},rB(e,[{key:"closed",get:function(){return"closed"===this._state}}]),e}(),r4=function(){function e(e){this._subscription=e}var t=e.prototype;return t.next=function(e){r2(this._subscription,"next",e)},t.error=function(e){r2(this._subscription,"error",e)},t.complete=function(){r2(this._subscription,"complete")},rB(e,[{key:"closed",get:function(){return"closed"===this._subscription._state}}]),e}(),r5=function(){function e(t){if(!(this instanceof e))throw TypeError("Observable cannot be called as a function");if("function"!=typeof t)throw TypeError("Observable initializer must be a function");this._subscriber=t}var t=e.prototype;return t.subscribe=function(e){return("object"!=typeof e||null===e)&&(e={next:e,error:arguments[1],complete:arguments[2]}),new r3(e,this._subscriber)},t.forEach=function(e){var t=this;return new Promise(function(r,n){if("function"!=typeof e)return void n(TypeError(e+" is not a function"));function i(){o.unsubscribe(),r()}var o=t.subscribe({next:function(t){try{e(t,i)}catch(e){n(e),o.unsubscribe()}},error:n,complete:r})})},t.map=function(e){var t=this;if("function"!=typeof e)throw TypeError(e+" is not a function");return new(rQ(this))(function(r){return t.subscribe({next:function(t){try{t=e(t)}catch(e){return r.error(e)}r.next(t)},error:function(e){r.error(e)},complete:function(){r.complete()}})})},t.filter=function(e){var t=this;if("function"!=typeof e)throw TypeError(e+" is not a function");return new(rQ(this))(function(r){return t.subscribe({next:function(t){try{if(!e(t))return}catch(e){return r.error(e)}r.next(t)},error:function(e){r.error(e)},complete:function(){r.complete()}})})},t.reduce=function(e){var t=this;if("function"!=typeof e)throw TypeError(e+" is not a function");var r=rQ(this),n=arguments.length>1,i=!1,o=arguments[1],s=o;return new r(function(r){return t.subscribe({next:function(t){var o=!i;if(i=!0,!o||n)try{s=e(s,t)}catch(e){return r.error(e)}else s=t},error:function(e){r.error(e)},complete:function(){if(!i&&!n)return r.error(TypeError("Cannot reduce an empty sequence"));r.next(s),r.complete()}})})},t.concat=function(){for(var e=this,t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];var i=rQ(this);return new i(function(t){var n,o=0;return!function e(s){n=s.subscribe({next:function(e){t.next(e)},error:function(e){t.error(e)},complete:function(){o===r.length?(n=void 0,t.complete()):e(i.from(r[o++]
1))}})}(e),function(){n&&(n.unsubscribe(),n=void 0)}})},t.flatMap=function(e){var t=this;if("function"!=typeof e)throw TypeError(e+" is not a function");var r=rQ(this);return new r(function(n){var i=[],o=t.subscribe({next:function(t){if(e)try{t=e(t)}catch(e){return n.error(e)}var o=r.from(t).subscribe({next:function(e){n.next(e)},error:function(e){n.error(e)},complete:function(){var e=i.indexOf(o);e>=0&&i.splice(e,1),s()}});i.push(o)},error:function(e){n.error(e)},complete:function(){s()}});function s(){o.closed&&0===i.length&&n.complete()}return function(){i.forEach(function(e){return e.unsubscribe()}),o.unsubscribe()}})},t[r$]=function(){return this},e.from=function(t){var r="function"==typeof this?this:e;if(null==t)throw TypeError(t+" is not an object");var n=rJ(t,r$);if(n){var i=n.call(t);if(Object(i)!==i)throw TypeError(i+" is not an object");return i instanceof r5&&i.constructor===r?i:new r(function(e){return i.subscribe(e)})}if(rz("iterator")&&(n=rJ(t,rH)))return new r(function(e){rZ(function(){if(!e.closed){for(var r,i=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return rF(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return rF(e,void 0)}}(e))){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(n.call(t));!(r=i()).done;){var o=r.value;if(e.next(o),e.closed)return}e.complete()}})});if(Array.isArray(t))return new r(function(e){rZ(function(){if(!e.closed){for(var r=0;r<t.length;++r)if(e.next(t[r]),e.closed)return;e.complete()}})});throw TypeError(t+" is not observable")},e.of=function(){for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];return new("function"==typeof this?this:e)(function(e){rZ(function(){if(!e.closed){for(var t=0;t<r.length;++t)if(e.next(r[t]),e.closed)return;e.complete()}})})},rB(e,null,[{key:rG,get:function(){return this}}]),e}();function r6(e,t){return new r5(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 r8(e,t){return new r5(function(r){var n=!1,i=new Set,o=function(){var e,t;n=!0;try{for(var r=(0,eh.__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 r7(e){var t=new Set,r=null;function n(){null==r||r.unsubscribe(),r=null,t.clear()}return new r5(function(i){return t.add(i),null===r&&(r=e.subscribe({next:function(e){try{for(var r,n,i,o=(0,eh.__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,eh.__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,eh.__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)}})}rK()&&Object.defineProperty(r5,Symbol("extensions"),{value:{symbol:r$,hostReportError:rX},configurable:!0});var r9="1.18.3",ne="[Amplitude] Element Clicked",nt="[Amplitude] Element Tag",nr="[Amplitude] Element Text",nn="[Amplitude] Page URL",ni="https://app.amplitude.com",no={US:ni,EU:"https://app.eu.amplitude.com",STAGING:"https://apps.stag2.amplitude.com"},ns="data-amp-mask-attributes",na=function(e,t){return!t||!t.length||t.some(function(t){return"string"==typeof t?e===t:e.match(t)})},nu=function(e,t){var r=e;try{r=decodeURI(e)}catch(e){null==t||t.error("Malformed URI sequence: ",e)}return r},nl=["input","select","textarea"],nc=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},nd=function(e,t,r){return void 0===r&&(r=!1),function(n,i){var o,s,a=e.pageUrlAllowlist,u=e.pageUrlExcludelist,l=e.shouldTrackEventResolver,c=null==(s=null==(o=null==i?void 0:i.tagName)?void 0:o.toLowerCase)?void 0:s.call(o);if(!c)return!1;if(l)return l(n,i);if(!na(window.location.href,a)||u&&u.length>0&&na(window.location.href,u))return!1;var d=String(null==i?void 0:i.getAttribute("type"))||"";if("string"==typeof d)switch(d.toLowerCase()){case"hidden":case"password":return!1}var f=nc(i,n);if(r&&f)return!0;
1if(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(c){case"input":case"select":case"textarea":return"change"===n||"click"===n;default:if(f)return!0;return"click"===n}}},nf=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!nl.includes(i)&&!o},nh=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},{})},np=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:np(null==e?void 0:e.parentElement,t):null},ng=function(e){return null!==e.event.target&&!!e.closestTrackedAncestor},nv=new Set(["id","class","style","value","onclick","onchange","oninput","onblur","onsubmit","onfocus","onkeydown","onkeyup","onkeypress","data-reactid","data-react-checksum","data-reactroot",ns,rv]),nm=["type"],ny=["svg","path","g"],nb=["password","hidden"],n_=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){}},nw=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}})},nS=function(e,t){var r,n,i,o=this;this.replaceSensitiveString=function(e){return rw(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;
1t.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(ns))?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,eh.__spreadArray)((0,eh.__spreadArray)([],(0,eh.__read)(p),!1),(0,eh.__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!nv.has(e.name)}),v=!nf(e);if(!nb.includes(String(e.getAttribute("type")))&&!ny.includes(u))try{for(var m=(0,eh.__values)(g),y=m.next();!y.done;y=m.next()){var b=y.value;if(!v||nm.includes(b.name)){if(t.has(b.name)){p[b.name]=rm;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,eh.__read)(t,2),n=r[0],i=r[1];e.attrs&&(e.attrs[n]=o.replaceSensitiveString(i))})};try{for(var m=(0,eh.__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.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,eh.__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[nt]=u,n[nr]=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 Parent Label"]=f,n[nn]=nu(window.location.href.split("?")[0]),n["[Amplitude] Page Title"]=rS(o.replaceSensitiveString),n["[Amplitude] Viewport Height"]=window.innerHeight,n["[Amplitude] Viewport Width"]=window.innerWidth,n);if(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 g=t.href.substring(0,128);p["[Amplitude] Element Href"]=o.replaceSensitiveString(g)}return nh(p)},this.addAdditionalEventProperties=function(e,t,r,n,i){void 0===i&&(i=!1);var s={event:e,timestamp:Date.now(),type:t};if(("click"===s.type||"change"===s.type)&&null!==s.event.target){if(i&&nc(s.event.target,s.type))return s.closestTrackedAncestor=s.event.target,s.targetElementProperties=o.getEventProperties(s.type,s.closestTrackedAncestor,n),s;var a=np(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=n_(e,t);if(r){if("TEXT"===e.elementExtractType)return o.getText(r);if("ATTRIBUTE"===e.elementExtractType&&e.attribute)return r.getAttribute(e.attribute)}}},this.getText=function(e){if(null!==e.closest("[".concat(rv,"]")))return rm;var t="";if(e.querySelector("[".concat(rv,"], [contenteditable]"))){var r=e.cloneNode(!0);r.querySelectorAll("[".concat(rv,"], [contenteditable]")).forEac
1h(function(e){e.innerText=rm}),t=r.innerText||""}else t=e.innerText||"";return o.replaceSensitiveString(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 nh(((t={})[nt]=i,t[nr]=o.getText(e),t[nn]=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,eh.__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},nE=function(){function e(e){var t=(void 0===e?{}:e).origin,r=this;this.endpoint=ni,this.requestCallbacks={},this.onSelect=function(e){r.notify({action:"element-selected",data:e})},this.onTrack=function(e,t){"selector-mode-changed"===e?r.notify({action:"track-selector-mode-changed",data:t}):"selector-moved"===e&&r.notify({action:"track-selector-moved",data:t})},this.endpoint=void 0===t?ni: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),(null==r?void 0: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.setup=function(e){var t=this,r=void 0===e?{dataExtractor:new nS({})}:e,n=r.logger,i=r.endpoint,o=r.isElementSelectable,s=r.cssSelectorAllowlist,a=r.actionClickAllowlist,u=r.dataExtractor;this.logger=n,i&&this.endpoint===ni&&(this.endpoint=i);var l=null;window.addEventListener("message",function(e){if(null==(n=null==(r=t.logger)?void 0:r.debug)||n.call(r,"Message received: ",JSON.stringify(e)),t.endpoint===e.origin){var r,n,i,c,d,f=null==e?void 0:e.data,h=null==f?void 0:f.action;if(h)if("id"in f)null==(c=null==(i=t.logger)?void 0:i.debug)||c.call(i,"Received Response to previous request: ",JSON.stringify(e)),t.handleResponse(f);else if("ping"===h)t.notify({action:"pong"});else if("initialize-visual-tagging-selector"===h){var p,g=null==f?void 0:f.data;(p="https://cdn.amplitude.com/libs/visual-tagging-selector-1.0.0-alpha.js.gz",new Promise(function(e,t){var r;try{var n=document.createElement("script");n.type="text/javascript",n.async=!0,n.src=p,n.addEventListener("load",function(){e({status:!0})},{once:!0}),n.addEventListener("error",function(){t({status:!1,message:"Failed to load the script ".concat(p)})}),null==(r=document.head)||r.appendChild(n)}catch(e){t(e)}})).then(function(){var e;l=null==(e=null==window?void 0:window.amplitudeVisualTaggingSelector)?void 0:e.call(window,{getEventTagProps:u.getEventTagProps,isElementSelectable:function(e){return!o||o((null==g?void 0:g.actionType)||"click",e)},onTrack:t.onTrack,onSelect:t.onSelect,visualHighlightClass:"amp-visual-tagging-selector-highlight",messenger:t,cssSelectorAllowlist:s,actionClickAllowlist:a,extractDataFromDataSource:u.extractDataFromDataSource,dataExtractor:u,diagnostics:{autocapture:{version:r9}}}),t.notify({action:"selector-loaded"})}).catch(function(){var e;null==(e=t.logger)||e.warn("Failed to initialize visual tagging selector")})}else"close-visual-tagging-selector"===h&&(null==(d=null==l?void 0:l.close)||d.call(l))}}),this.notify({action:"page-loaded"})},e}(),nk=function(){return new r5(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()}})},nx=function(e){return void 0===e&&(e="click"),new r5(function(t){var r,n=function(e){t.next(e)};return null==(r=(0,ej.getGlobalScope)())||r.document.addEventListener(e,n,{capture:!0}),function(){var t;null==(t=(0,ej.getGlobalScope)())||t.document.removeEventListener(e,n,{capture:!0})}})},nI=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},nT={"[Amplitude] Element Clicked":"click","[Amplitude] Element Changed":"change"},nP=function(e){var t,r,n,i,o=Object.values(nT).reduce(function(e,t){return e[t]=new Set,e},{});if(!e)return o;try{for(var s=(0,eh.__values)(e),a=s.next();!a.done;a=s.next()){var u=a.value;try{try{for(var l=(n=void 0,(0,eh.__values)(u.definition)),c=l.next();!c.done;c=l.next()){var d=nT[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},nC=function(e){var t,r,n,i,o=new Map;try{for(var s=(0,eh.__values)(e),a=s.next();!a.done;a=s.next()){var u=a.value;try{for(var l=(n=void 0,(0,eh.__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},nA=function(e,t){var r,n,i,o,s=new Set;try{for(var a=(0,eh.__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,eh.__values)(c)),f=d.next();!f.done;f=d.next()){var h=f.value;s.add(h)}}catch(e){i={error:e}}
1finally{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)},nO=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=nA(Array.from(this.groupedLabeledEvents[e.type]).map(function(e){return n.labeledEvents[e]}).filter(function(t){return t.definition.some(function(t){return nT[t.event_type]===e.type&&t.filters.every(function(t){return nI(e,t)})})}),this.labeledEventToTriggerMap);try{for(var o=(0,eh.__values)(i),s=o.next();!s.done;s=o.next()){var a=s.value;nw(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}();(f=Q||(Q={})).ClickObservable="clickObservable",f.ChangeObservable="changeObservable",f.NavigateObservable="navigateObservable",f.MutationObservable="mutationObservable";var nR=function(e,t){void 0===e&&(e={}),null==t||t.diagnosticsClient.setTag("plugin.autocapture.version",r9);var r,n,i,o,s,a,u,l,c=e.dataAttributePrefix,d=void 0===c?rU:c,f=e.visualTaggingOptions,h=void 0===f?{enabled:!0,messenger:new nE}:f;e.cssSelectorAllowlist=null!=(r=e.cssSelectorAllowlist)?r:rL,e.actionClickAllowlist=null!=(n=e.actionClickAllowlist)?n:rq,e.debounceTime=null!=(i=e.debounceTime)?i:0,e.pageUrlExcludelist=null==(o=e.pageUrlExcludelist)?void 0:o.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 p="@amplitude/plugin-autocapture-browser",g=[],v=new nS(e,t),m=function(){var t,r,n=r7(nx().map(function(t){return v.addAdditionalEventProperties(t,"click",e.cssSelectorAllowlist,d)})),i=r7(new r5(function(t){var r,n=function(r){var n=v.addAdditionalEventProperties(r,"change",e.cssSelectorAllowlist,d);t.next(n)};return null==(r=(0,ej.getGlobalScope)())||r.document.addEventListener("change",n,{capture:!0}),function(){var e;return null==(e=(0,ej.getGlobalScope)())?void 0:e.document.removeEventListener("change",n)}}));window.navigation&&(r=r7(new r5(function(t){var r=function(r){var n=v.addAdditionalEventProperties(r,"navigate",e.cssSelectorAllowlist,d);t.next(n)};return window.navigation.addEventListener("navigate",r),function(){window.navigation.removeEventListener("navigate",r)}})));var o=r7(nk().map(function(t){return v.addAdditionalEventProperties(t,"mutation",e.cssSelectorAllowlist,d)}));return(t={})[Q.ChangeObservable]=i,t[Q.ClickObservable]=n,t[Q.MutationObservable]=o,t[Q.NavigateObservable]=r,t},y=nP(Object.values(null!=(a=null==(s=e.pageActions)?void 0:s.labeledEvents)?a:{})),b=nC(null!=(l=null==(u=e.pageActions)?void 0:u.triggers)?l:[]),_=new nO(y,b,v,e),w=function(t){var r,n;t&&(e.pageActions=(0,eh.__assign)((0,eh.__assign)({},e.pageActions),t),y=nP(Object.values(null!=(r=e.pageActions.labeledEvents)?r:{})),b=nC(null!=(n=e.pageActions.triggers)?n:[]),_.update(y,b,e))};return{name:p,type:"enrichment",setup:function(t,r){return(0,eh.__awaiter)(void 0,void 0,void 0,function(){var n,i,o,s,a,u,l,c,f,y;return(0,eh.__generator)(this,function(b){var S,E,k,x,I,T,P,C,A,O,R,N,D,M,j,L,U,q,F,V,B,K,z,W,H,$;return"undefined"==typeof document?[2]:(t.fetchRemoteConfig&&(t.remoteConfigClient?t.remoteConfigClient.subscribe("analyticsSDK.pageActions","all",function(e){w(e)}):t.loggerProvider.debug("Remote config client is not provided, skipping remote config fetch")),n=nd(e,e.cssSelectorAllowlist),i=nd(e,e.actionClickAllowlist),E=(S={allObservables:o=m(),amplitude:r,shouldTrackEvent:n,evaluateTriggers:_.evaluate.bind(_)}).amplitude,k=S.allObservables,x=S.shouldTrackEvent,I=S.evaluateTriggers,s=k.clickObservable.filter(ng).filter(function(e){return x("click",e.closestTrackedAncestor)}).map(function(e){return I(e)}).subscribe(function(e){null==E||E.track(ne,e.targetElementProperties)}
1),g.push(s),P=(T={allObservables:o,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return v.getEventProperties.apply(v,(0,eh.__spreadArray)((0,eh.__spreadArray)([],(0,eh.__read)(e),!1),[d],!1))},amplitude:r,shouldTrackEvent:n,evaluateTriggers:_.evaluate.bind(_)}).amplitude,C=T.allObservables,A=T.getEventProperties,O=T.shouldTrackEvent,R=T.evaluateTriggers,a=C.changeObservable.filter(ng).filter(function(e){return O("change",e.closestTrackedAncestor)}).map(function(e){return R(e)}).subscribe(function(e){null==P||P.track("[Amplitude] Element Changed",A("change",e.closestTrackedAncestor))}),g.push(a),D=(N={allObservables:o,options:e,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return v.getEventProperties.apply(v,(0,eh.__spreadArray)((0,eh.__spreadArray)([],(0,eh.__read)(e),!1),[d],!1))},amplitude:r,shouldTrackEvent:n,shouldTrackActionClick:i}).amplitude,M=N.allObservables,j=N.options,L=N.getEventProperties,U=N.shouldTrackEvent,q=N.shouldTrackActionClick,F=M.clickObservable,V=M.mutationObservable,B=M.navigateObservable,K=F.filter(function(e){return!U("click",e.closestTrackedAncestor)}).map(function(e){var t=np(e.event.target,j.actionClickAllowlist);return e.closestTrackedAncestor=t,null!==e.closestTrackedAncestor&&(e.targetElementProperties=L(e.type,e.closestTrackedAncestor)),e}).filter(ng).filter(function(e){return q("click",e.closestTrackedAncestor)}),z=B?r8(V,B):V,W=r8(K,z),H=null,$=null,(u=r6(W,function(e){if(H&&(clearTimeout(H),H=null),"click"===e.type)$=e,H=setTimeout(function(){H=null,$=null},500);else if($){var t=$;return $=null,Promise.resolve(t)}return Promise.resolve(null)}).subscribe(function(e){e&&(null==D||D.track(ne,L("click",e.closestTrackedAncestor)))}))&&g.push(u),null==(f=null==t?void 0:t.loggerProvider)||f.log("".concat(p," has been successfully added.")),window.opener&&h.enabled&&(l=e.cssSelectorAllowlist,c=e.actionClickAllowlist,null==(y=h.messenger)||y.setup((0,eh.__assign)((0,eh.__assign)({dataExtractor:v,logger:null==t?void 0:t.loggerProvider},(null==t?void 0:t.serverZone)&&{endpoint:no[t.serverZone]}),{isElementSelectable:nd(e,(0,eh.__spreadArray)((0,eh.__spreadArray)([],(0,eh.__read)(l),!1),(0,eh.__read)(c),!1)),cssSelectorAllowlist:l,actionClickAllowlist:c}))),[2])})})},execute:function(e){return(0,eh.__awaiter)(void 0,void 0,void 0,function(){return(0,eh.__generator)(this,function(t){return[2,e]})})},teardown:function(){return(0,eh.__awaiter)(void 0,void 0,void 0,function(){var e,t,r,n;return(0,eh.__generator)(this,function(i){try{for(t=(e=(0,eh.__values)(g)).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]})})}}},nN=(0,eh.__spreadArray)(['input[type="button"]','input[type="submit"]','input[type="reset"]','input[type="image"]','input[type="file"]'],(0,eh.__read)(["a","button",'[role="button"]','[role="link"]','[role="menuitem"]','[role="menuitemcheckbox"]','[role="menuitemradio"]','[role="option"]','[role="tab"]','[role="treeitem"]','[contenteditable="true" i]']),!1),nD=["*"],nM=["mutation","navigate"];function nj(e,t){var r,n,i,o,s=t.event,a=s.clientX,u=s.clientY;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 nL(e){if(0===e.length)return null;var t=e[0],r=e[e.length-1];return{rageClickEvent:(0,eh.__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.clientX,Y:e.event.clientY,Time:e.timestamp}}),"[Amplitude] Click Count":e.length},t.targetElementProperties),time:t.timestamp}}var nU=function(e){void 0===e&&(e={});var t,r,n,i,o,s="@amplitude/plugin-frustration-browser",a=[],u=null!=(r=null==(t=e.rageClicks)?void 0:t.cssSelectorAllowlist)?r:nD,l=null!=(i=null==(n=e.deadClicks)?void 0:n.cssSelectorAllowlist)?i:nN,c=null!=(o=e.dataAttributePrefix)?o:rU,d=new nS(e),f=(0,eh.__spreadArray)([],(0,eh.__read)(new Set((0,eh.__spreadArray)((0,eh.__spreadArray)([],(0,eh.__read)(u),!1),(0,eh.__read)(l),!1))),!1),h=function(){var e,t,r=r7(nx("pointerdown").map(function(e){return d.addAdditionalEventProperties(e,"click",f,c,!0)})),n=r7(nk().map(function(e){return d.addAdditionalEventProperties(e,"mutation",f,c)}));return window.navigation&&(t=r7(new r5(function(e){var t=function(t){e.next((0,eh.__assign)((0,eh.__assign)({},t),{type:"navigate"}))};return window.navigation.addEventListener("navigate",t),function(){window.navigation.removeEventListener("navigate",t)}}).map(function(e){return d.addAdditionalEventProperties(e,"navigate",f,c)}))),(e={})[Q.ClickObservable]=r,e[Q.MutationObservable]=n,e[Q.NavigateObservable]=t,e};return{name:s,type:"enrichment",setup:function(t,r){return(0,eh.__awaiter)(void 0,void 0,void 0,function(){var n,i,o,f,p,g;
1return(0,eh.__generator)(this,function(v){var m,y,b,_,w,S,E,k,x,I,T,P;return"undefined"==typeof document?[2]:(n=nd(e,u),i=nd(e,l),f=function(e){var t=this,r=e.amplitude,n=e.allObservables,i=e.shouldTrackRageClick,o=n.clickObservable,s=[],a={},u=null;return r6(o.filter(function(e){return i("click",e.closestTrackedAncestor)}),function(e){return(0,eh.__awaiter)(t,void 0,void 0,function(){var t;return(0,eh.__generator)(this,function(r){var n,i,o,l;return(nj(a,e),t=null,0===s.length||(n=s).length>0&&n[n.length-1].closestTrackedAncestor!==e.closestTrackedAncestor||(o=Math.max(0,(i=s).length-4+1),l=i[o],e.timestamp-l.timestamp>=1e3)||a.isOutOfBounds)?(u&&(t=nL(s)),s=[],a={},e&&(nj(a,e),s.push(e))):s.push(e),(u&&(clearTimeout(u.timerId),u.resolve(t),u=null),s.length>=4)?[2,new Promise(function(e){u={resolve:e,timerId:setTimeout(function(){e(nL(s))},1e3)}})]:[2,null]})})}).subscribe(function(e){null!==e&&r.track("[Amplitude] Rage Click",e.rageClickEvent,{time:e.time})})}({allObservables:o=h(),amplitude:r,shouldTrackRageClick:n}),a.push(f),y=(m={amplitude:r,allObservables:o,getEventProperties:function(e,t){return d.getEventProperties(e,t,c)},shouldTrackDeadClick:i}).amplitude,b=m.allObservables,_=m.getEventProperties,w=m.shouldTrackDeadClick,S=b.clickObservable,E=b.mutationObservable,k=b.navigateObservable,x=S.filter(function(e){return ng(e)&&w("click",e.closestTrackedAncestor)&&e.event.target instanceof Element&&null===e.event.target.closest('a[target="_blank"]')}),I=k?r8(E,k):E,T=r8(x,I),P=null,p=r6(T,function(e){if(P&&nM.includes(e.type))clearTimeout(P),P=null;else if("click"===e.type)return P?Promise.resolve(null):new Promise(function(t){P=setTimeout(function(){t(e),P=null},3e3)});return Promise.resolve(null)}).subscribe(function(e){if(e){var t={"[Amplitude] X":e.event.clientX,"[Amplitude] Y":e.event.clientY};y.track("[Amplitude] Dead Click",(0,eh.__assign)((0,eh.__assign)({},_("click",e.closestTrackedAncestor)),t),{time:e.timestamp})}}),a.push(p),null==(g=null==t?void 0:t.loggerProvider)||g.log("".concat(s," has been successfully added.")),[2])})})},execute:function(e){return(0,eh.__awaiter)(void 0,void 0,void 0,function(){return(0,eh.__generator)(this,function(t){return[2,e]})})},teardown:function(){return(0,eh.__awaiter)(void 0,void 0,void 0,function(){var e,t,r,n;return(0,eh.__generator)(this,function(i){try{for(t=(e=(0,eh.__values)(a)).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]})})}}};function nq(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,eh.__values)(d),h=f.next();!h.done;h=f.next()){var p,g=h.value,v=(0,eh.__spreadArray)((0,eh.__spreadArray)([],(0,eh.__read)(u),!1),[g],!1);(p=o[g],"string"==typeof p||"number"==typeof p||"boolean"==typeof p||null==p)?(!nV(v,s)||nV(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(nF),excludelist:r.map(nF),ancestors:[]})}function nF(e){return e.startsWith("/")&&(e=e.slice(1)),e.split("/").map(function(e){return e.replace(/~0/g,"~").replace(/~1/g,"/")})}function nV(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 nB=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,eh.__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,eh.__values)(Object.entries(n)),s=o.next();!s.done;s=o.next()){var a=(0,eh.__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 nJ(i,{allow:e})},Object.defineProperty(e.prototype,"bodySize",{get:function(){if("number"==typeof this._bodySize)return this._bodySize;var e=(0,ej.getGlobalScope)();if(null==e?void 0:e.TextEncoder){var t=this.request.body;return this._bodySize=nz(t,100),this._bodySize}}
1,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,eh.__awaiter)(this,void 0,void 0,function(){return(0,eh.__generator)(this,function(r){return 0===e.length?[2,null]:[2,n$(this.body,e,t)]})})},e}(),nK=function(){function e(e,t){this.bodyRaw=e,this.requestHeaders=t}return e.prototype.headers=function(e){return void 0===e&&(e=[]),nJ(this.requestHeaders,{allow:e})},Object.defineProperty(e.prototype,"bodySize",{get:function(){return nz(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,eh.__awaiter)(this,void 0,void 0,function(){return(0,eh.__generator)(this,function(r){return 0===e.length?[2,null]:[2,n$(this.body,e,t)]})})},e}();function nz(e,t){var r,n,i,o,s=(0,ej.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,eh.__values)(e.entries()),d=c.next();!d.done;d=c.next()){var f=(0,eh.__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 nW=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}),nJ(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,eh.__awaiter)(this,void 0,void 0,function(){return(0,eh.__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,eh.__awaiter)(this,void 0,void 0,function(){return(0,eh.__generator)(this,function(r){switch(r.label){case 0:if(0===e.length)return[2,null];return[4,this.text()];case 1:return[2,n$(r.sent(),e,t)]}})})},e}(),nH=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,eh.__values)(i),s=o.next();!s.done;s=o.next()){var a=s.value,u=(0,eh.__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 nJ(n,{allow:e})},e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),(0,eh.__awaiter)(this,void 0,void 0,function(){var r;return(0,eh.__generator)(this,function(n){return 0===e.length?[2,null]:(r=this.getJson())?(nq(r,e,t),[2,r]):[2,null]})})},e}();function n$(e,t,r){if(!e)return null;try{var n=JSON.parse(e);return nq(n,t,r),n}catch(e){return null}}(h=X||(X={})).REDACT="redact",h.REMOVE="remove";var nG="[REDACTED]",nJ=function(e,t){var r,n,i=t.allow,o=void 0===i?[]:i,s=t.strategy,a=void 0===s?X.REMOVE:s,u=(0,eh.__spreadArray)([],(0,eh.__read)(eA),!1),l={};try{for(var c=(0,eh.__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===X.REDACT&&(l[t]=nG):o.find(function(e){return e.toLowerCase()===r})?l[t]=e[t]:a===X.REDACT&&(l[t]=nG)}(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},nQ=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;
1return 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,eh.__spreadArray)([],(0,eh.__read)(eC),!1)),requestBodySize:null==(t=this.requestWrapper)?void 0:t.bodySize,responseHeaders:null==(r=this.responseWrapper)?void 0:r.headers((0,eh.__spreadArray)([],(0,eh.__read)(eC),!1)),responseBodySize:null==(n=this.responseWrapper)?void 0:n.bodySize}).filter(function(e){var t=(0,eh.__read)(e,2);return void 0!==(t[0],t[1])}))},e}(),nX=function(e,t){void 0===t&&(t=eU()),this.callback=e,this.id=t},nZ=new(function(){function e(t){this.eventCallbacks=new Map,this.isObserving=!1,this.logger=t;var r=(0,ej.getGlobalScope)();e.isSupported()&&(this.globalScope=r)}return e.isSupported=function(){var e=(0,ej.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){var n;try{r.callback(e)}catch(e){null==(n=t.logger)||n.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 nQ(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,eh.__awaiter)(t,void 0,void 0,function(){var t,i,o,s,a;return(0,eh.__generator)(this,function(u){switch(u.label){case 0:try{t=this.getTimestamps()}catch(e){null==(s=this.logger)||s.debug("an unexpected error occurred while retrieving timestamps",e)}u.label=1;case 1:return u.trys.push([1,3,,4]),[4,e(r,n)];case 2:return i=u.sent(),[3,4];case 3:return o=u.sent(),[3,4];case 4:try{this.handleNetworkRequestEvent("fetch",r,n?new nB(n):void 0,i?new nW(i):void 0,o,null==t?void 0:t.startTime,null==t?void 0:t.durationStart)}catch(e){null==(a=this.logger)||a.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,n;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&&(null==(n=t.logger)||n.error("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=[],i=0;i<arguments.length;i++)n[i]=arguments[i];var s=(0,eh.__read)(n,2),a=s[0],u=s[1];try{this.$$AmplitudeAnalyticsEvent=(0,eh.__assign)({method:a,url:null==(e=null==u?void 0:u.toString)?void 0:e.call(u),headers:{}},o.getTimestamps())}catch(e){null==(r=o.logger)||r.error("an unexpected error occurred while calling xhr open",e)}return t.apply(this,n)},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.addEventListener("loadend",function(){var e;try{var t=i.getAllResponseHeaders(),r=i.getResponseHeader("content-length"),n=new nH(i.status,t,r?parseInt(r,10):void 0,s),l=i.$$AmplitudeAnalyticsEvent.headers,c=new nK(a,l);u.status=i.status,o.handleNetworkRequestEvent("xhr",{url:u.url,method:u.method},c,n,void 0,u.startTime,u.durationStart)}catch(t){null==(e=o.logger)||e.error("an unexpected error occurred while handling xhr send",t)}}),r.apply(i,t)},i.setRequestHeader=function(e,t){var r;try{this.$$AmplitudeAnalyticsEvent.headers[e]=t}catch(e){null==(r=o.logger)||r.error("an unexpected error occurred while calling xhr setRequestHeader",e)}n.apply(this,[e,t])}}},e}()),nY="[Amplitude] Network Request",n0="500-599";function n1(e,t){return RegExp("^"+t.replace(/[-[\]{}()+?.,\\^$|#\s]/g,"\\$&").replace(/\*/g,".*")+"$").test(e)}function n2(e,t){var r,n,i=t.split(",");try{for(var o=(0,eh.__values)(i),s=o.next();!s.done;s=o.next()){var a=s.value,u=(0,eh.__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 n3(e){var t;if(e)try{var r=null==(t=(0,ej.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 n4(e){return"object"!=typeof e||null===e?e?(0,eh.__spreadArray)([],(0,eh.__read)(eC),!1):void 0:0!==e.length?e:void 0}function n5(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 n6=function(e){void 0===e&&(e={});var t,r="@amplitude/plugin-network-capture-browser",n=function(){var e,r=new r5(function(e){var r=new nX(function(t){var r={event:t,timestamp:Date.now(),type:"network"};e.next(r)});return nZ.subscribe(r,t),function(){nZ.unsubscribe(r)}});return(e={})[Z.NetworkObservable]=r,e};return{name:r,type:"enrichment",setup:function(i,o){return(0,eh.__awaiter)(void 0,void 0,void 0,function(){var s;return(0,eh.__generator)(this,function(a){var u,l,c,d,f;return"undefined"==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,Y=l.networkObservable.filter(function(e){return function(e,t){void 0===t&&(t={});var r,n,i=n3(e.url);if(!i)return!1;var o=i.host;return!(!1!==t.ignoreAmplitudeRequests&&(n1(o,"*.amplitude.com")||n1(o,"amplitude.com"))||(null==(r=t.ignoreHosts)?void 0:r.find(function(e){return n1(o,e)})))&&(!!t.captureRules||void 0===e.status||!!n2(e.status,n0))&&(!t.captureRules||((0,eh.__spreadArray)([],(0,eh.__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 n1(t,e)}))&&(!n||!e.urls||na(n,e.urls))&&(!i||!e.methods||e.methods.find(function(e){return i.toLowerCase()===e.toLowerCase()||"*"===e})))return(!r&&0!==r||!!n2(r,e.statusCodeRange||n0))&&!0}(t,o,e.status,e.url,e.method)){var r=n4(t.responseHeaders);if(e.responseWrapper&&r){var i=e.responseWrapper.headers(r);i&&(e.responseHeaders=i)}var s=n4(t.requestHeaders);if(e.requestWrapper&&s){var a=e.requestWrapper.headers(s);a&&(e.requestHeaders=a)}e.responseWrapper&&t.responseBody&&!n5(t.responseBody)&&(e.responseBodyJson=e.responseWrapper.json(t.responseBody.allowlist,t.responseBody.blocklist)),e.requestWrapper&&t.requestBody&&!n5(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===nY}))return!0}catch(e){}return!1}(o,e.requestWrapper))}(e.event,c)}).subscribe(function(e){var t,r,n,i=e.event,o=n3(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,eh.__awaiter)(this,void 0,void 0,function(){var i,o,s;return(0,eh.__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=eh.__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(nY,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,eh.__awaiter)(void 0,void 0,void 0,function(){return(0,eh.__generator)(this,function(t){return[2,e]})})},teardown:function(){return(0,eh.__awaiter)(void 0,void 0,void 0,function(){return(0,eh.__generator)(this,function(e){return Y.unsubscribe(),[2]})})}}};let n8=-1,n7=e=>{addEventListener("pageshow",t=>{t.persisted&&(n8=t.timeStamp,e(t))},!0)},n9=(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))}},ie=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},it=()=>{let e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},ir=()=>{let e=it();return e?.activationStart??0},ii=(e,t=-1)=>{let r=it(),n="navigate";return n8>=0?n="back-forward-cache":r&&(document.prerendering||ir()>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}},io=new WeakMap;function is(e,t){return io.get(e)||io.set(e,new t),io.get(e)}class ia{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 iu=(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{}},il=e=>{let t=!1;return()=>{t||(e(),t=!0)}},ic=-1,id=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,ih=e=>{"hidden"===document.visibilityState&&ic>-1&&(ic="visibilitychange"===e.type?e.timeStamp:0,ig())},ip=()=>{addEventListener("visibilitychange",ih,!0),addEventListener("prerenderingchange",ih,!0)},ig=()=>{removeEventListener("visibilitychange",ih,!0),removeEventListener("prerenderingchange",ih,!0)},iv=()=>{if(ic<0){let e=ir();ic=(document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").filter(t=>"hidden"===t.name&&t.startTime>e)[0]?.startTime)??id(),ip(),n7(()=>{setTimeout(()=>{ic=id(),ip()})})}return{get firstHiddenTime(){return ic}}},im=e=>{document.prerendering?addEventListener("prerenderingchange",()=>e(),!0):e()},iy=[1800,3e3],ib=(e,t={})=>{im(()=>{let r=iv(),n,i=ii("FCP"),o=iu("paint",e=>{for(let t of e)"first-contentful-paint"===t.name&&(o.disconnect(),t.startTime<r.firstHiddenTime&&(i.value=Math.max(t.startTime-ir(),0),i.entries.push(t),n(!0)))});o&&(n=n9(e,i,iy,t.reportAllChanges),n7(r=>{n=n9(e,i=ii("FCP"),iy,t.reportAllChanges),ie(()=>{i.value=performance.now()-r.timeStamp,n(!0)})}))})},i_=[.1,.25],iw=0,iS=1/0,iE=0,ik=e=>{for(let t of e)t.interactionId&&(iS=Math.min(iS,t.interactionId),iw=(iE=Math.max(iE,t.interactionId))?(iE-iS)/7+1:0)},ix=()=>t?iw:performance.interactionCount??0,iI=0;class iT{u=[];l=new Map;m;p;v(){iI=ix(),this.u.length=0,this.l.clear()}P(){let e=Math.min(this.u.length-1,Math.floor((ix()-iI)/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.T){if(r?e.duration>r.T?(r.entries=[e],r.T=e.duration):e.duration===r.T&&e.startTime===r.entries[0].startTime&&r.entries.push(e):(r={id:e.interactionId,entries:[e],T:e.duration},this.l.set(r.id,r),this.u.push(r)),this.u.sort((e,t)=>
1t.T-e.T),this.u.length>10)for(let e of this.u.splice(10))this.l.delete(e.id);this.p?.(r)}}}let iP=e=>{let t=globalThis.requestIdleCallback||setTimeout;"hidden"===document.visibilityState?e():(t(e=il(e)),document.addEventListener("visibilitychange",e,{once:!0}))},iC=[200,500];class iA{m;h(e){this.m?.(e)}}let iO=[2500,4e3],iR=[800,1800],iN=e=>{document.prerendering?im(()=>iN(e)):"complete"!==document.readyState?addEventListener("load",()=>iN(e),!0):setTimeout(e)};function iD(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 iM=function(){var e=null,r=(0,ej.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,eh.__awaiter)(void 0,void 0,void 0,function(){var s,a;return(0,eh.__generator)(this,function(u){return void 0===n||(s=nu((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":nu((null==i?void 0:i.pathname)||"",r.loggerProvider),"[Amplitude] Page Title":"undefined"!=typeof document&&document.title||"","[Amplitude] Page URL":nu(s.split("?")[0],r.loggerProvider)},((e,t={})=>{im(()=>{let r=iv(),n,i=ii("LCP"),o=is(t,iA),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-ir(),0),i.entries=[s],n())},a=iu("largest-contentful-paint",s);if(a){n=n9(e,i,iO,t.reportAllChanges);let r=il(()=>{s(a.takeRecords()),a.disconnect(),n(!0)});for(let e of["keydown","click","visibilitychange"])addEventListener(e,()=>iP(r),{capture:!0,once:!0});n7(r=>{n=n9(e,i=ii("LCP"),iO,t.reportAllChanges),ie(()=>{i.value=performance.now()-r.timeStamp,n(!0)})})}})})(function(e){a["[Amplitude] LCP"]=iD(e)}),ib(function(e){a["[Amplitude] FCP"]=iD(e)}),((e,r={})=>{globalThis.PerformanceEventTiming&&"interactionId"in PerformanceEventTiming.prototype&&im(()=>{"interactionCount"in performance||t||(t=iu("event",ik,{type:"event",buffered:!0,durationThreshold:0}));let n,i=ii("INP"),o=is(r,iT),s=e=>{iP(()=>{for(let t of e)o.h(t);let t=o.P();t&&t.T!==i.value&&(i.value=t.T,i.entries=t.entries,n())})},a=iu("event",s,{durationThreshold:r.durationThreshold??40});n=n9(e,i,iC,r.reportAllChanges),a&&(a.observe({type:"first-input",buffered:!0}),document.addEventListener("visibilitychange",()=>{"hidden"===document.visibilityState&&(s(a.takeRecords()),n(!0))}),n7(()=>{o.v(),n=n9(e,i=ii("INP"),iC,r.reportAllChanges)}))})})(function(e){a["[Amplitude] INP"]=iD(e)}),((e,t={})=>{ib(il(()=>{let r,n=ii("CLS",0),i=is(t,ia),o=e=>{for(let t of e)i.h(t);i.i>n.value&&(n.value=i.i,n.entries=i.o,r())},s=iu("layout-shift",o);s&&(r=n9(e,n,i_,t.reportAllChanges),document.addEventListener("visibilitychange",()=>{"hidden"===document.visibilityState&&(o(s.takeRecords()),r(!0))}),n7(()=>{i.i=0,r=n9(e,n=ii("CLS",0),i_,t.reportAllChanges),ie(()=>r())}),setTimeout(r))}))})(function(e){a["[Amplitude] CLS"]=iD(e)}),((e,t={})=>{let r=ii("TTFB"),n=n9(e,r,iR,t.reportAllChanges);iN(()=>{let i=it();i&&(r.value=Math.max(i.responseStart-ir(),0),r.entries=[i],n(!0),n7(()=>{(n=n9(e,r=ii("TTFB",0),iR,t.reportAllChanges))(!0)}))})})(function(e){a["[Amplitude] TTFB"]=iD(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,eh.__awaiter)(void 0,void 0,void 0,function(){return(0,eh.__generator)(this,function(t){return[2,e]})})},teardown:function(){return(0,eh.__awaiter)(void 0,void 0,void 0,function(){return(0,eh.__generator)(this,function(t){return e&&(null==n||n.removeEventListener("visibilitychange",e)),[2]})})}}},ij=function(e,t,r){return void 0===t&&(t=""),void 0===r&&(r=10),["AMP",t,e.substring(0,r)].filter(Boolean).join("_")},iL=function(e){var t=e.split(".");return t.length<=2?e:t.slice(t.length-2,t.length).join(".")},iU=function(e,t,r,n,i){void 0===i&&(i=!0),e.referrer;var o=e.referring_domain,s=(0,eh.__rest)(e,["referrer","referring_domain"]),a=t||{},u=(a.referrer,a.referring_domain),l=(0,eh.__rest)(a,["referrer","referring_domain"]);if(iq(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 c=JSON.stringify(s)!==JSON.stringify(l),d=iL(o||"")!==iL(u||""),f=!t||c||d;return f?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."),f},iq=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})},iF=function(e){var t=e;
1return t?(t.startsWith(".")&&(t=t.substring(1)),[new RegExp("".concat(t.replace(".","\\."),"$"))]):[]},iV=function(){function e(e,t){var r;this.shouldTrackNewCampaign=!1,this.options=(0,eh.__assign)({initialEmptyValue:"EMPTY",resetSessionOnNewCampaign:!1,excludeReferrers:iF(null==(r=t.cookieOptions)?void 0:r.domain)},e),this.storage=t.cookieStorage,this.storageKey=ij(t.apiKey,"MKTG"),this.webExpStorageKey=ij(t.apiKey,"MKTG_ORIGINAL"),this.currentCampaign=eP,this.sessionTimeout=t.sessionTimeout,this.lastEventTime=t.lastEventTime,this.logger=t.loggerProvider,t.loggerProvider.log("Installing web attribution tracking.")}return e.prototype.init=function(){return(0,eh.__awaiter)(this,void 0,void 0,function(){var e,t;return(0,eh.__generator)(this,function(r){switch(r.label){case 0:return[4,this.fetchCampaign()];case 1:if(t=eh.__read.apply(void 0,[r.sent(),2]),this.currentCampaign=t[0],this.previousCampaign=t[1],e=!this.lastEventTime||tc(this.sessionTimeout,this.lastEventTime),!iU(this.currentCampaign,this.previousCampaign,this.options,this.logger,e))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,eh.__awaiter)(this,void 0,void 0,function(){var e;return(0,eh.__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 rE().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,eF(Object.entries((0,eh.__assign)((0,eh.__assign)({},eP),t)).reduce(function(e,t){var n,i=(0,eh.__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}(),iB="AMP_CURRENT_PAGE",iK="AMP_PREVIOUS_PAGE",iz="AMP_URL_INFO";(p=ee||(ee={})).Direct="direct",p.Internal="internal",p.External="external";var iW=new Set([W.IDENTIFY,W.GROUP_IDENTIFY,W.REVENUE]),iH=function(e){var t=(void 0===e?{}:e).internalDomains,r=void 0===t?[]:t,n=(0,ej.getGlobalScope)(),i=void 0,o=!1,s=void 0,a=!1,u=!1,l=function(e){var t;try{var r=nu(e,s);t=new URL(r).hostname}catch(e){null==s||s.error("Could not parse URL: ",e)}return t},c=function(e){var t="undefined"!=typeof location&&location.hostname||"",n=e?l(e):void 0;if(!n)return ee.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?ee.Internal:ee.External},d=function(){(0,eh.__awaiter)(void 0,void 0,void 0,function(){var e,t,r,n,s;return(0,eh.__generator)(this,function(a){switch(a.label){case 0:if(!(i&&o))return[3,3];return[4,i.get(iz)];case 1:return e=a.sent(),t=nu("undefined"!=typeof location&&location.href||""),r=(null==e?void 0:e[iB])||"",n=void 0,n=t===r?(null==e?void 0:e[iK])||"":r||document.referrer||"",[4,i.set(iz,((s={})[iB]=t,s[iK]=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,eh.__awaiter)(void 0,void 0,void 0,function(){return(0,eh.__generator)(this,function(t){switch(t.label){case 0:if((s=e.loggerProvider).log("Installing @amplitude/plugin-page-url-enrichment-browser"),u=!0,!n)return[3,2];return[4,(i=new t1(n.sessionStorage)).isEnabled()];case 1:o=t.sent(),n.addEventListener("popstate",d),a||(n.history.pushState=new Proxy(n.history.pushState,{apply:function(e,t,r){var n=(0,eh.__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,eh.__read)(r,3),i=n[0],o=n[1],s=n[2];e.apply(t,[i,o,s]),u&&d()}}),a=!0),t.label=2;case 2:return[2]}})})},execute:function(e){return(0,eh.__awaiter)(void 0,void 0,void 0,function(){var t,r,n,s,a;return(0,eh.__generator)(this,function(u){switch(u.label){case 0:if(t=nu("undefined"!=typeof location&&location.href||""),!(i&&o))return[3,5];return[4,i.get(iz)];case 1:if(null==(r=u.sent())?void 0:r[iB])return[3,3];return[4,i.set(iz,((a={})[iB]=t,a[iK]=document.referrer||"",a))];case 2:u.sent(),u.label=3;case 3:return[4,i.get(iz)];case 4:if(n=u.sent(),s="",n&&(s=n[iK]||""),iW.has(e.event_type))return[2,e];e.event_properties=(0,eh.__assign)((0,eh.__assign)({},e.event_properties||{}),{"[Amplitude] Page Domain":i$(e,"[Amplitude] Page Domain","undefined"!=typeof location&&location.hostname||""),"[Amplitude] Page Location":i$(e,"[Amplitude] Page Location",t),"[Amplitude] Page Path":i$(e,"[Amplitude] Page Path","undefined"!=typeof location&&nu(location.pathname)||""),"[Amplitude] Page Title":i$(e,"[Amplitude] Page Title",rS(rw)),"[Amplitude] Page URL":i$(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,eh.__awaiter)(void 0,void 0,void 0,function(){return(0,eh.__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(iz,{})];case 1:e.sent(),e.label=2;case 2:return[2]}})})}}};function i$(e,t,r){return(e.event_properties||(e.event_properties={}),void 0===e.event_properties[t])?r:e.event_properties[t]}var iG=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._diagnosticsSampleRate=0,t}return(0,eh.__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),eK(this._init((0,eh.__assign)((0,eh.__assign)({},i),{userId:n,apiKey:e})))},t.prototype._init=function(t){var r,n,i,o;return(0,eh.__awaiter)(this,void 0,void 0,function(){var s,a,u,l,c,d,f,h,p=this;return(0,eh.__generator)(this,function(g){var v,m,y,b,_;switch(g.label){case 0:if(this.initializing)return[2];return this.initializing=!0,[4,(v=t.apiKey,m=t,y=this,void 0===m&&(m={}),(0,eh.__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,b,_,w,S,E,
1k,x,I,T,P,C,A,O,R,N,D,M,j,L,U,q,F,V,B,K,z,W,H,$;return(0,eh.__generator)(this,function(G){switch(G.label){case 0:if(e=m.identityStorage||rf,E={},e===rf)return[3,1];return r="",[3,5];case 1:if(null==(x=null==(k=m.cookieOptions)?void 0:k.domain))return[3,2];return n=x,[3,4];case 2:return[4,(0,eh.__awaiter)(void 0,void 0,void 0,function(){var e,t,r,n,i,o;return(0,eh.__generator)(this,function(s){switch(s.label){case 0:return[4,new tJ().isEnabled()];case 1:if(!s.sent()||"undefined"==typeof location||!location.hostname)return[2,""];for(e=(0,location.hostname).split("."),t=[],r="AMP_TLDTEST",n=e.length-2;n>=0;--n)t.push(e.slice(n).join("."));n=0,s.label=2;case 2:if(!(n<t.length))return[3,7];return[4,(o=new tJ({domain:"."+(i=t[n])})).set(r,1)];case 3:return s.sent(),[4,o.get(r)];case 4:if(!s.sent())return[3,6];return[4,o.remove(r)];case 5:return s.sent(),[2,"."+i];case 6:return n++,[3,2];case 7:return[2,""]}})})];case 3:n=G.sent(),G.label=4;case 4:r=n,G.label=5;case 5:var J,Q;return t=eh.__assign.apply(void 0,[(E.domain=r,E.expiration=365,E.sameSite="Lax",E.secure=!1,E.upgrade=!0,E),m.cookieOptions]),[4,(J=i=rp(m.identityStorage,t),void 0===(Q=null==(T=null==(I=m.cookieOptions)?void 0:I.upgrade)||T)&&(Q=!0),(0,eh.__awaiter)(void 0,void 0,void 0,function(){var e,t,r,n,i,o,s,a,u;return(0,eh.__generator)(this,function(l){switch(l.label){case 0:return e="".concat("amp","_").concat(v.substring(0,6)),[4,J.getRaw(e)];case 1:if(!(t=l.sent()))return[2,{optOut:!1}];if(!Q)return[3,3];return[4,J.remove(e)];case 2:l.sent(),l.label=3;case 3:return n=(r=(0,eh.__read)(t.split("."),6))[0],i=r[1],o=r[2],s=r[3],a=r[4],u=r[5],[2,{deviceId:n,userId:t8(i),sessionId:t6(s),lastEventId:t6(u),lastEventTime:t6(a),optOut:!!o}]}})}))];case 6:return o=G.sent(),[4,i.get(tZ(v))];case 7:return s=G.sent(),l=!(u=(a=tf()).ampTimestamp?Number(a.ampTimestamp):void 0)||Date.now()<u,c=null!=(R=null!=(O=null!=(A=null!=(P=m.deviceId)?P:l?null!=(C=a.ampDeviceId)?C:a.deviceId:void 0)?A:null==s?void 0:s.deviceId)?O:o.deviceId)?R:eU(),d=null!=(N=null==s?void 0:s.lastEventId)?N:o.lastEventId,f=null!=(D=null==s?void 0:s.lastEventTime)?D:o.lastEventTime,h=null!=(j=null!=(M=m.optOut)?M:null==s?void 0:s.optOut)?j:o.optOut,p=null!=(L=null==s?void 0:s.sessionId)?L:o.sessionId,g=null!=(q=null!=(U=m.userId)?U:null==s?void 0:s.userId)?q:o.userId,y.previousSessionDeviceId=null!=(F=null==s?void 0:s.deviceId)?F:o.deviceId,y.previousSessionUserId=null!=(V=null==s?void 0:s.userId)?V:o.userId,b={ipAddress:null==(K=null==(B=m.trackingOptions)?void 0:B.ipAddress)||K,language:null==(W=null==(z=m.trackingOptions)?void 0:z.language)||W,platform:null==($=null==(H=m.trackingOptions)?void 0:H.platform)||$},_=null==s?void 0:s.pageCounter,w=null==s?void 0:s.debugLogsEnabled,void 0!==m.autocapture&&(m.defaultTracking=m.autocapture),[4,(S=new rh(v,m.appVersion,i,t,m.defaultTracking,m.autocapture,c,m.flushIntervalMillis,m.flushMaxRetries,m.flushQueueSize,e,m.ingestionMetadata,m.instanceName,d,f,m.loggerProvider,m.logLevel,m.minIdLength,m.offline,h,m.partnerId,m.plan,m.serverUrl,m.serverZone,p,m.sessionTimeout,m.storageProvider,b,m.transport,m.useBatch,m.fetchRemoteConfig,g,_,w,m.networkTrackingOptions,m.identify,m.enableDiagnostics,y._diagnosticsSampleRate,void 0,m.remoteConfig)).storageProvider.isEnabled()];case 8:return G.sent()||(S.loggerProvider.warn("Storage provider ".concat(S.storageProvider.constructor.name," is not enabled. Falling back to MemoryStorage.")),S.storageProvider=new tG),[2,S]}})}))];case 1:if(!((s=g.sent()).remoteConfig&&s.remoteConfig.fetchRemoteConfig))return[3,4];return a=new tg(s.apiKey,s.loggerProvider,s.serverZone,null==(r=s.remoteConfig)?void 0:r.serverUrl),[4,new Promise(function(e){null==a||a.subscribe("configs.analyticsSDK.browserSDK","all",function(t,r,n){s.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=Object.keys(t);try{for(var p=(0,eh.__values)(h),g=p.next();!g.done;g=p.next()){var v=g.value;try{var m=t[v];"boolean"==typeof(null==m?void 0:m.enabled)&&(m.enabled?(delete m.enabled,0===Object.keys(m).length&&(t[v]=!0)):t[v]=!1),e(m)}catch(e){}}}catch(e){r={error:e}}finally{try{g&&!g.done&&(n=p.return)&&n.call(p)}finally{if(r)throw r.error}}
1try{if(null==(c=null==(l=null==(u=t.autocapture)?void 0:u.networkTracking)?void 0:l.captureRules)?void 0:c.length)try{for(var y=(0,eh.__values)(t.autocapture.networkTracking.captureRules),b=y.next();!b.done;b=y.next()){var _=b.value;try{for(var w=(s=void 0,(0,eh.__values)(["responseHeaders","requestHeaders"])),S=w.next();!S.done;S=w.next()){var E=S.value,k=null!=(d=_[E])?d:{},x=k.captureSafeHeaders,I=k.allowlist;if(x||I){if(void 0!==I&&!Array.isArray(I)){delete _[E];continue}_[E]=(0,eh.__spreadArray)((0,eh.__spreadArray)([],(0,eh.__read)(x?eC:[]),!1),(0,eh.__read)(null!=I?I:[]),!1)}}}catch(e){s={error:e}}finally{try{S&&!S.done&&(a=w.return)&&a.call(w)}finally{if(s)throw s.error}}}}catch(e){i={error:e}}finally{try{b&&!b.done&&(o=y.return)&&o.call(y)}finally{if(i)throw i.error}}}catch(e){}var T=null==(f=t.autocapture)?void 0:f.frustrationInteractions;T&&(T.rageClick&&(T.rageClicks=T.rageClick,delete T.rageClick),T.deadClick&&(T.deadClicks=T.deadClick,delete T.deadClick))}}(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,eh.__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,eh.__assign)({},e.autocapture.elementInteractions);var c=l.elementInteractions,d=null!=(o=c.pageUrlAllowlist)?o:[],f=e.autocapture.elementInteractions.pageUrlAllowlistRegex;c.pageUrlAllowlist=rj(d,f,t),delete c.pageUrlAllowlistRegex}if("object"==typeof e.autocapture.networkTracking&&null!==e.autocapture.networkTracking&&(null==(s=e.autocapture.networkTracking.captureRules)?void 0:s.length)){l.networkTracking=(0,eh.__assign)({},e.autocapture.networkTracking);var h=null!=(a=l.networkTracking.captureRules)?a:[];try{for(var p=(0,eh.__values)(h),g=p.next();!g.done;g=p.next()){var v=g.value;v.urls=rj(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,eh.__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,eh.__assign)((0,eh.__assign)({},t.autocapture),l))}t.defaultTracking=t.autocapture}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,s),e()})})];case 2:return g.sent(),[4,new Promise(function(e){null==a||a.subscribe("configs.diagnostics.browserSDK","all",function(t,r,n){if(s.loggerProvider.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)||(s.diagnosticsSampleRate=i);var o=t.enabled;"boolean"==typeof o&&(s.enableDiagnostics=o)}e()})})];case 3:g.sent(),g.label=4;case 4:return(u=new tA(s.apiKey,s.loggerProvider,s.serverZone,{enabled:s.enableDiagnostics,sampleRate:s.diagnosticsSampleRate})).setTag("library","".concat(tH,"/").concat(tW)),u.setTag("user_agent",navigator.userAgent),[4,e.prototype._init.call(this,s)];case 5:if(g.sent(),this.logBrowserOptions(s),this.config.diagnosticsClient=u,this.config.remoteConfigClient=a,!tR(this.config.defaultTracking))return[3,7];return l=tR((b=this.config).defaultTracking)&&b.defaultTracking&&"object"==typeof b.defaultTracking&&b.defaultTracking.attribution&&"object"==typeof b.defaultTracking.attribution?(0,eh.__assign)({},b.defaultTracking.attribution):{},this.webAttribution=new iV(l,this.config),[4,this.webAttribution.init()];case 6:g.sent(),g.label=7;case 7:if(f=!(!(d=(c=tf()).ampTimestamp?Number(c.ampTimestamp):void 0)||Date.now()<d)||Number.isNaN(Number(c.ampSessionId))?void 0:Number(c.ampSessionId),this.setSessionId(null!=(o=null!=(i=null!=(n=t.sessionId)?n:f)?i:this.config.sessionId)?o:Date.now()),(h=ta(t.instanceName)).identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),null===this.config.offline)return[3,9];return[4,this.add(rM()).promise];case 8:g.sent(),g.label=9;case 9:return[4,this.add(new e5({diagnosticsClient:u})).promise];case 10:return g.sent(),[4,this.add(new t$).promise];case 11:return g.sent(),[4,this.add(new td).promise];case 12:if(g.sent(),rD(this.config),!tO(this.config.defaultTracking,"fileDownloads"))return[3,14];return this.config.loggerProvider.debug("Adding file download tracking plugin"),[4,this.add(rR()).promise];case 13:g.sent(),g.label=14;case 14:if(!tO(this.config.defaultTracking,"formInteractions"))return[3,16
1];return this.config.loggerProvider.debug("Adding form interaction plugin"),[4,this.add(rC()).promise];case 15:g.sent(),g.label=16;case 16:if(!tN(this.config.defaultTracking))return[3,18];return this.config.loggerProvider.debug("Adding page view tracking plugin"),[4,this.add(rx(tV(this.config))).promise];case 17:g.sent(),g.label=18;case 18:if(!tj(this.config.autocapture))return[3,20];return this.config.loggerProvider.debug("Adding user interactions plugin (autocapture plugin)"),[4,this.add(nR(tU(this.config),{diagnosticsClient:u})).promise];case 19:g.sent(),g.label=20;case 20:if(!tL(this.config.autocapture))return[3,22];return this.config.loggerProvider.debug("Adding frustration interactions plugin"),[4,this.add(nU(tq(this.config))).promise];case 21:g.sent(),g.label=22;case 22:if(!tM(this.config.autocapture))return[3,24];return this.config.loggerProvider.debug("Adding network tracking plugin"),[4,this.add(n6(tF(this.config))).promise];case 23:g.sent(),g.label=24;case 24:if(!("boolean"==typeof(_=this.config.autocapture)?_:"object"==typeof _&&!0===_.webVitals))return[3,26];return this.config.loggerProvider.debug("Adding web vitals plugin"),[4,this.add(iM()).promise];case 25:g.sent(),g.label=26;case 26:if(!tO(this.config.autocapture,"pageUrlEnrichment"))return[3,28];return this.config.loggerProvider.debug("Adding referrer page url plugin"),[4,this.add(iH()).promise];case 27:g.sent(),g.label=28;case 28:return this.initializing=!1,[4,this.runQueuedFunctions("dispatchQ")];case 29:return g.sent(),h.eventBridge.setEventReceiver(function(e){var t=e.eventProperties||{},r=t.time,n=(0,eh.__rest)(t,["time"]);p.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}),tu(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}),tl(e,this.config.instanceName))):this.q.push(this.setDeviceId.bind(this,e))},t.prototype.reset=function(){this.setDeviceId(eU()),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.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)),eK(Promise.resolve());if(e===this.config.sessionId)return eK(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,tD(this.config.defaultTracking)&&(n&&i&&r.push(this.track(rn,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(eF(this.config.identify)).promise),tD(this.config.defaultTracking)&&r.push(this.track(rr,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,eK(Promise.all(r))},t.prototype.extendSession=function(){this.config?this.config.lastEventTime=Date.now():this.q.push(this.extendSession.bind(this))},t.prototype.setTransport=function(e){this.config?this.config.transportProvider=rg(e):this.q.push(this.setTransport.bind(this,e))},t.prototype.identify=function(t,r){if(tK(t)){var n=t._q;t._q=[],t=tB(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(tK(n)){var o=n._q;n._q=[],n=tB(new eN,o)}return e.prototype.groupIdentify.call(this,t,r,n,i)},t.prototype.revenue=function(t,r){if(tK(t)){var n=t._q;t._q=[],t=tB(new e6,n)}return e.prototype.revenue.call(this,t,r)},t.prototype.trackCampaignEventIfNeeded=function(e,t){if(!this.webAttribution||!this.webAttribution.shouldTrackNewCampaign)return!1;var r=this.webAttribution.generateCampaignEvent(e);
1return t?t.push(this.track(r).promise):this.track(r),this.config.loggerProvider.log("Tracking attribution."),!0},t.prototype.process=function(t){return(0,eh.__awaiter)(this,void 0,void 0,function(){var r,n,i;return(0,eh.__generator)(this,function(o){return r=Date.now(),n=tc(this.config.sessionTimeout,this.config.lastEventTime),i=this.webAttribution&&this.webAttribution.shouldSetSessionIdOnNewCampaign(),t.event_type!==rr&&t.event_type!==rn&&(!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()),t.event_type===W.IDENTIFY&&t.user_properties&&(this.userProperties=this.getOperationAppliedUserProperties(t.user_properties)),[2,e.prototype.process.call(this,t)]})})},t.prototype.logBrowserOptions=function(e){try{var t=(0,eh.__assign)((0,eh.__assign)({},e),{apiKey:e.apiKey.substring(0,10)+"********"});this.config.loggerProvider.debug("Initialized Amplitude with BrowserConfig:",JSON.stringify(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}(ez);(g=et||(et={})).US="US",g.EU="EU",g.STAGING="STAGING";var iJ="[Amplitude]",iQ="".concat(iJ," Session Replay ID"),iX=et.US,iZ={enabled:!0},iY="".concat(iJ," Session Replay Debug"),i0="amp-mask";(v=er||(er={})).GET_SR_PROPS="get-sr-props",v.DEBUG_INFO="debug-info",v.FETCH_REQUEST="fetch-request",v.METADATA="metadata",v.TARGETING_DECISION="targeting-decision";var i1=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}(),i2="medium",i3=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 i3(e,i2,r)}},i4=function(e,t,r){var n,i,o;if(void 0===t&&(t={defaultMaskLevel:i2}),r){if(r.closest("."+i0)||(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 i3(e,null!=(o=t.defaultMaskLevel)?o:i2,r)},i5=function(e,t){return function(r,n){return i4(e,t,n)?r.replace(/[^\s]/g,"*"):r}},i6=function(){var e=(0,ej.getGlobalScope)();return(null==e?void 0:e.location)?e.location.href:""},i8=function(e,t){return t||(e===et.STAGING?"https://api-sr.stag2.amplitude.com/sessions/v2/track":e===et.EU?"https://api-sr.eu.amplitude.com/sessions/v2/track":"https://api-sr.amplitude.com/sessions/v2/track")},i7=function(e){var t=e.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*").replace(/\?/g,".");return new RegExp("^".concat(t,"$"))},i9=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")},oe=function(e,t){var r,n;try{for(var i=(0,eh.__values)(t),o=i.next();!o.done;o=i.next()){var s=o.value,a=i7(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},ot=function(){return(0,eh.__awaiter)(void 0,void 0,void 0,function(){var e,t,r,n;return(0,eh.__generator)(this,function(i){switch(i.label){case 0:if(i.trys.push([0,3,,4]),!(e=(0,ej.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:""}]}})})},or=function(e){var t=(0,eh.__assign)({},e),r=t.apiKey;return t.apiKey="****".concat(r.substring(r.length-4)),t},on=function(){return{flushMaxRetries:2,logLevel:G.Warn,loggerProvider:new e$,transportProvider:new t0}},oi=function(e){function t(t,r){var n,i,o,s,a,u,l=this,c=on();return(l=e.call(this,(0,eh.__assign)((0,eh.__assign)({transportProvider:c.transportProvider,loggerProvider:new i1(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||iX,l.configServerUrl=r.configServerUrl,l.trackServerUrl=r.trackServerUrl,l.shouldInlineStylesheet=r.shouldInlineStylesheet,l.version=r.version,l.performanceConfig=r.performanceConfig||iZ,l.storeType=null!=(n=r.storeType)?n:"idb",l.applyBackgroun
1dColorToBlockedElements=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&&i9(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,eh.__extends)(t,e),t}(eJ),oo=((m=oo||{})[m.DomContentLoaded=0]="DomContentLoaded",m[m.Load=1]="Load",m[m.FullSnapshot=2]="FullSnapshot",m[m.IncrementalSnapshot=3]="IncrementalSnapshot",m[m.Meta=4]="Meta",m[m.Custom=5]="Custom",m[m.Plugin=6]="Plugin",m),os=((y=os||{})[y.Mutation=0]="Mutation",y[y.MouseMove=1]="MouseMove",y[y.MouseInteraction=2]="MouseInteraction",y[y.Scroll=3]="Scroll",y[y.ViewportResize=4]="ViewportResize",y[y.Input=5]="Input",y[y.TouchMove=6]="TouchMove",y[y.MediaInteraction=7]="MediaInteraction",y[y.StyleSheetRule=8]="StyleSheetRule",y[y.CanvasMutation=9]="CanvasMutation",y[y.Font=10]="Font",y[y.Log=11]="Log",y[y.Drag=12]="Drag",y[y.StyleDeclaration=13]="StyleDeclaration",y[y.Selection=14]="Selection",y[y.AdoptedStyleSheet=15]="AdoptedStyleSheet",y[y.CustomElement=16]="CustomElement",y),oa=((b=oa||{})[b.MouseUp=0]="MouseUp",b[b.MouseDown=1]="MouseDown",b[b.Click=2]="Click",b[b.ContextMenu=3]="ContextMenu",b[b.DblClick=4]="DblClick",b[b.Focus=5]="Focus",b[b.Blur=6]="Blur",b[b.TouchStart=7]="TouchStart",b[b.TouchMove_Departed=8]="TouchMove_Departed",b[b.TouchEnd=9]="TouchEnd",b[b.TouchCancel=10]="TouchCancel",b),ou=((_=ou||{})[_.Mouse=0]="Mouse",_[_.Pen=1]="Pen",_[_.Touch=2]="Touch",_),ol=((w=ol||{})[w["2D"]=0]="2D",w[w.WebGL=1]="WebGL",w[w.WebGL2=2]="WebGL2",w),oc=((S=oc||{})[S.Play=0]="Play",S[S.Pause=1]="Pause",S[S.Seeked=2]="Seeked",S[S.VolumeChange=3]="VolumeChange",S[S.RateChange=4]="RateChange",S),od=((E=od||{}).Start="start",E.Pause="pause",E.Resume="resume",E.Resize="resize",E.Finish="finish",E.FullsnapshotRebuilded="fullsnapshot-rebuilded",E.LoadStylesheetStart="load-stylesheet-start",E.LoadStylesheetEnd="load-stylesheet-end",E.SkipStart="skip-start",E.SkipEnd="skip-end",E.MouseInteraction="mouse-interaction",E.EventCast="event-cast",E.CustomEvent="custom-event",E.Flush="flush",E.StateChange="state-change",E.PlayBack="play-back",E.Destroy="destroy",E),of=((k=of||{})[k.Document=0]="Document",k[k.DocumentType=1]="DocumentType",k[k.Element=2]="Element",k[k.Text=3]="Text",k[k.CDATA=4]="CDATA",k[k.Comment=5]="Comment",k),oh=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},op=function(){function e(e,t){this.localConfig=t,this.remoteConfigClient=e}return e.prototype.generateJoinedConfig=function(){var e,t,r;return(0,eh.__awaiter)(this,void 0,void 0,function(){var n,i,o,s,a,u,l,c,d,f,h,p,g,v,m,y,b,_=this;return(0,eh.__generator)(this,function(w){switch(w.label){case 0:(n=(0,eh.__assign)({},this.localConfig)).optOut=this.localConfig.optOut,n.captureEnabled=!0,w.label=1;case 1:return w.trys.push([1,3,,4]),[4,new Promise(function(e,t){_.remoteConfigClient.subscribe("configs.sessionReplay","all",function(r,o){if(_.localConfig.loggerProvider.debug("Session Replay remote configuration received from ".concat(o,":"),JSON.stringify(r,null,2)),!r)return void t(Error("No remote config received"));var s,a=r.sr_sampling_config,u=r.sr_privacy_config,l=r.sr_targeting_config,c=null==(s=n.interactionConfig)?void 0:s.ugcFilterRules;n.interactionConfig=r.sr_interaction_config,n.interactionConfig&&c&&(n.interactionConfig.ugcFilterRules=c),n.loggingConfig=r.sr_logging_config,(a||u||l)&&(i={},a&&(i.sr_sampling_config=a),u&&(i.sr_privacy_config=u),l&&(i.sr_targeting_config=l)),e()})})];case 2:return w.sent(),[3,4];case 3:return o=w.sent(),this.localConfig.loggerProvider.error("Failed to generate joined config: ",o),n.captureEnabled=!1,[2,{localConfig:this.localConfig,joinedConfig:n,remoteConfig:void 0}];case 4:if(!i)return[2,{localConfig:this.localConfig,joinedConfig:n,remoteConfig:i}];if(s=i.sr_sampling_config,a=i.sr_privacy_config,u=i.sr_targeting_config,s&&Object.keys(s).length>0?(Object.prototype.hasOwnProperty.call(s,"capture_enabled")?n.captureEnabled=s.capture_enabled:n.captureEnabled=!1,Object.prototype.hasOwnProperty.call(s,"sample_rate")&&(n.sampleRate=s.sample_rate)):(n.captureEnabled=!0,this.localConfig.loggerProvider.debug("Remote config successfully fetched, but no values set for project, Session Replay capture enabled.")),a){l=null!=(e=n.privacyConfig)?e:{},c={defaultMaskLevel:null!=(r=null!=(t=a.defaultMaskLevel)?t:l.defaultMaskLevel)?r:"medium",blockSelector:[],maskSelector:[],unmaskSelector:[]},d=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,eh.__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,eh.__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,eh.__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},f=(0,eh.__assign)((0,eh.__assign)({},d(l)),d(a));try{for(p=(h=(0,eh.__values)(Object.entries(f))).next();!p.done;p=h.next())v=(g=(0,eh.__read)(p.value,2))[0],m=g[1],"mask"===m?c.maskSelector.push(v):"block"===m?c.blockSelector.push(v):"unmask"===m&&c.unmaskSelector.push(v)}catch(e){y={error:e}}finally{try{p&&!p.done&&(b=h.return)&&b.call(h)}finally{if(y)throw y.error}}n.privacyConfig=oh(c,this.localConfig.loggerProvider)}return u&&Object.keys(u).length>0&&(n.targetingConfig=u),this.localConfig.loggerProvider.debug(JSON.stringify({name:"session replay joined config",config:or(n)},null,2)),[2,{localConfig:this.localConfig,joinedConfig:n,remoteConfig:i}]}})})},e}(),og=Uint8Array,ov=Uint16Array,om=Uint32Array,oy=new og([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),ob=new og([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),o_=new og([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ow=function(e,t){for(var r=new ov(31),n=0;n<31;++n)r[n]=t+=1<<e[n-1];for(var i=new om(r[30]),n=1;n<30;++n)for(var o=r[n];o<r[n+1];++o)i[o]=o-r[n]<<5|n;return[r,i]},oS=ow(oy,2),oE=oS[0],ok=oS[1];oE[28]=258,ok[258]=28;for(var ox=ow(ob,0),oI=(ox[0],ox[1]),oT=new ov(32768),oP=0;oP<32768;++oP){var oC=(43690&oP)>>>1|(21845&oP)<<1;oC=(61680&(oC=(52428&oC)>>>2|(13107&oC)<<2))>>>4|(3855&oC)<<4,oT[oP]=((65280&oC)>>>8|(255&oC)<<8)>>>1}for(var oA=function(e,t,r){for(var n,i=e.length,o=0,s=new ov(t);o<i;++o)++s[e[o]-1];var a=new ov(t);for(o=0;o<t;
1++o)a[o]=a[o-1]+s[o-1]<<1;if(r){n=new ov(1<<t);var u=15-t;for(o=0;o<i;++o)if(e[o])for(var l=o<<4|e[o],c=t-e[o],d=a[e[o]-1]++<<c,f=d|(1<<c)-1;d<=f;++d)n[oT[d]>>>u]=l}else for(o=0,n=new ov(i);o<i;++o)n[o]=oT[a[e[o]-1]++]>>>15-e[o];return n},oO=new og(288),oP=0;oP<144;++oP)oO[oP]=8;for(var oP=144;oP<256;++oP)oO[oP]=9;for(var oP=256;oP<280;++oP)oO[oP]=7;for(var oP=280;oP<288;++oP)oO[oP]=8;for(var oR=new og(32),oP=0;oP<32;++oP)oR[oP]=5;var oN=oA(oO,9,0),oD=oA(oR,5,0),oM=function(e){return(e/8|0)+(7&e&&1)},oj=function(e,t,r){(null==r||r>e.length)&&(r=e.length);var n=new(e instanceof ov?ov:e instanceof om?om:og)(r-t);return n.set(e.subarray(t,r)),n},oL=function(e,t,r){r<<=7&t;var n=t/8|0;e[n]|=r,e[n+1]|=r>>>8},oU=function(e,t,r){r<<=7&t;var n=t/8|0;e[n]|=r,e[n+1]|=r>>>8,e[n+2]|=r>>>16},oq=function(e,t){for(var r=[],n=0;n<e.length;++n)e[n]&&r.push({s:n,f:e[n]});var i=r.length,o=r.slice();if(!i)return[new og(0),0];if(1==i){var s=new og(r[0].s+1);return s[r[0].s]=1,[s,1]}r.sort(function(e,t){return e.f-t.f}),r.push({s:-1,f:25001});var a=r[0],u=r[1],l=0,c=1,d=2;for(r[0]={s:-1,f:a.f+u.f,l:a,r:u};c!=i-1;)a=r[r[l].f<r[d].f?l++:d++],u=r[l!=c&&r[l].f<r[d].f?l++:d++],r[c++]={s:-1,f:a.f+u.f,l:a,r:u};for(var f=o[0].s,n=1;n<i;++n)o[n].s>f&&(f=o[n].s);var h=new ov(f+1),p=oF(r[c-1],h,0);if(p>t){var n=0,g=0,v=p-t,m=1<<v;for(o.sort(function(e,t){return h[t.s]-h[e.s]||e.f-t.f});n<i;++n){var y=o[n].s;if(h[y]>t)g+=m-(1<<p-h[y]),h[y]=t;else break}for(g>>>=v;g>0;){var b=o[n].s;h[b]<t?g-=1<<t-h[b]++-1:++n}for(;n>=0&&g;--n){var _=o[n].s;h[_]==t&&(--h[_],++g)}p=t}return[new og(h),p]},oF=function(e,t,r){return -1==e.s?Math.max(oF(e.l,t,r+1),oF(e.r,t,r+1)):t[e.s]=r},oV=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new ov(++t),n=0,i=e[0],o=1,s=function(e){r[n++]=e},a=1;a<=t;++a)if(e[a]==i&&a!=t)++o;else{if(!i&&o>2){for(;o>138;o-=138)s(32754);o>2&&(s(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(s(i),--o;o>6;o-=6)s(8304);o>2&&(s(o-3<<5|8208),o=0)}for(;o--;)s(i);o=1,i=e[a]}return[r.subarray(0,n),t]},oB=function(e,t){for(var r=0,n=0;n<t.length;++n)r+=e[n]*t[n];return r},oK=function(e,t,r){var n=r.length,i=oM(t+2);e[i]=255&n,e[i+1]=n>>>8,e[i+2]=255^e[i],e[i+3]=255^e[i+1];for(var o=0;o<n;++o)e[i+o+4]=r[o];return(i+4+n)*8},oz=function(e,t,r,n,i,o,s,a,u,l,c){oL(t,c++,r),++i[256];for(var d,f,h,p,g=oq(i,15),v=g[0],m=g[1],y=oq(o,15),b=y[0],_=y[1],w=oV(v),S=w[0],E=w[1],k=oV(b),x=k[0],I=k[1],T=new ov(19),P=0;P<S.length;++P)T[31&S[P]]++;for(var P=0;P<x.length;++P)T[31&x[P]]++;for(var C=oq(T,7),A=C[0],O=C[1],R=19;R>4&&!A[o_[R-1]];--R);var N=l+5<<3,D=oB(i,oO)+oB(o,oR)+s,M=oB(i,v)+oB(o,b)+s+14+3*R+oB(T,A)+(2*T[16]+3*T[17]+7*T[18]);if(N<=D&&N<=M)return oK(t,c,e.subarray(u,u+l));if(oL(t,c,1+(M<D)),c+=2,M<D){d=oA(v,m,0),f=v,h=oA(b,_,0),p=b;var j=oA(A,O,0);oL(t,c,E-257),oL(t,c+5,I-1),oL(t,c+10,R-4),c+=14;for(var P=0;P<R;++P)oL(t,c+3*P,A[o_[P]]);c+=3*R;for(var L=[S,x],U=0;U<2;++U)for(var q=L[U],P=0;P<q.length;++P){var F=31&q[P];oL(t,c,j[F]),c+=A[F],F>15&&(oL(t,c,q[P]>>>5&127),c+=q[P]>>>12)}}else d=oN,f=oO,h=oD,p=oR;for(var P=0;P<a;++P)if(n[P]>255){var F=n[P]>>>18&31;oU(t,c,d[F+257]),c+=f[F+257],F>7&&(oL(t,c,n[P]>>>23&31),c+=oy[F]);var V=31&n[P];oU(t,c,h[V]),c+=p[V],V>3&&(oU(t,c,n[P]>>>5&8191),c+=ob[V])}else oU(t,c,d[n[P]]),c+=f[n[P]];return oU(t,c,d[256]),c+f[256]},oW=new om([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),oH=function(e,t,r,n,i,o){var s=e.length,a=new og(n+s+5*(1+Math.floor(s/7e3))+i),u=a.subarray(n,a.length-i),l=0;if(!t||s<8)for(var c=0;c<=s;c+=65535){var d=c+65535;d<s?l=oK(u,l,e.subarray(c,d)):(u[c]=o,l=oK(u,l,e.subarray(c,s)))}else{for(var f=oW[t-1],h=f>>>13,p=8191&f,g=(1<<r)-1,v=new ov(32768),m=new ov(g+1),y=Math.ceil(r/3),b=2*y,_=function(t){return(e[t]^e[t+1]<<y^e[t+2]<<b)&g},w=new om(25e3),S=new ov(288),E=new ov(32),k=0,x=0,c=0,I=0,T=0,P=0;c<s;++c){var C=_(c),A=32767&c,O=m[C];if(v[A]=O,m[C]=A,T<=c){var R=s-c;if((k>7e3||I>24576)&&R>423){l=oz(e,u,0,w,S,E,x,I,P,c-P,l),I=k=x=0,P=c;for(var N=0;N<286;++N)S[N]=0;for(var N=0;N<30;++N)E[N]=0}var D=2,M=0,j=p,L=A-O&32767;if(R>2&&C==_(c-L))for(var U=Math.min(h,R)-1,q=Math.min(32767,c),F=Math.min(258,R);L<=q&&--j&&A!=O;){if(e[c+D]==e[c+D-L]){for(var V=0;V<F&&e[c+V]==e[c+V-L];++V);if(V>D){if(D=V,M=L,V>U)break;for(var B=Math.min(L,V-2),K=0,N=0;N<B;++N){var z=c-L+N+32768&32767,W=v[z],H=z-W+32768&32767;H>K&&(K=H,O=z)}}}O=v[A=O],L+=A-O+32768&32767}if(M){w[I++]=0x10000000|ok[D]<<18|oI[M];var $=31&ok[D],G=31&oI[M];x+=oy[$]+ob[G],++S[257+$],++E[G],T=c+D,++k}else w[I++]=e[c],++S[e[c]]}}l=oz(e,u,o,w,S,E,x,I,P,c-P,l)}
1return oj(a,0,n+oM(l)+i)},o$=function(){var e=1,t=0;return{p:function(r){for(var n=e,i=t,o=r.length,s=0;s!=o;){for(var a=Math.min(s+5552,o);s<a;++s)n+=r[s],i+=n;n%=65521,i%=65521}e=n,t=i},d:function(){return(e>>>8<<16|(255&t)<<8|t>>>8)+((255&e)<<23)*2}}},oG=function(e,t,r){for(;r;++t)e[t]=r,r>>>=8},oJ=function(e,t){var r=t.level,n=0==r?0:r<6?1:9==r?3:2;e[0]=120,e[1]=n<<6|(n?32-2*n:1)},oQ=function(){function e(e,t,r,n){var i,o=this;this.taskQueue=[],this.isProcessing=!1,this.compressEvent=function(e){var t,r,n,i,o;return JSON.stringify(function(e,t){var r="";if(!t&&"undefined"!=typeof TextDecoder)return new TextDecoder().decode(e);for(var n=0;n<e.length;){var i=e[n++];i<128||t?r+=String.fromCharCode(i):i<224?r+=String.fromCharCode((31&i)<<6|63&e[n++]):i<240?r+=String.fromCharCode((15&i)<<12|(63&e[n++])<<6|63&e[n++]):r+=String.fromCharCode(55296|(i=((15&i)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536)>>10,56320|1023&i)}return r}((t=function(e,t){var r=e.length;if("undefined"!=typeof TextEncoder)return new TextEncoder().encode(e);for(var n=new og(e.length+(e.length>>>1)),i=0,o=function(e){n[i++]=e},s=0;s<r;++s){if(i+5>n.length){var a=new og(i+8+(r-s<<1));a.set(n),n=a}var u=e.charCodeAt(s);u<128?o(u):(u<2048?o(192|u>>>6):(u>55295&&u<57344?(o(240|(u=65536+(1047552&u)|1023&e.charCodeAt(++s))>>>18),o(128|u>>>12&63)):o(224|u>>>12),o(128|u>>>6&63)),o(128|63&u))}return oj(n,0,i)}(JSON.stringify({...e,v:"v1"})),void 0===r&&(r={}),(n=o$()).p(t),oJ(o=oH(t,null==(i=r).level?6:i.level,null==i.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):12+i.mem,2,4,!0),r),oG(o,o.length-4,n.d()),o),!0))},this.addCompressedEventToManager=function(e,t){o.eventsManager&&o.deviceId&&o.eventsManager.addEvent({event:{type:"replay",data:e},sessionId:t,deviceId:o.deviceId})},this.addCompressedEvent=function(e,t){if(o.worker)try{o.worker.postMessage({event:e,sessionId:t})}catch(r){"DataCloneError"===r.name?o.worker.postMessage(JSON.stringify({event:e,sessionId:t})):o.config.loggerProvider.warn("Unexpected error while posting message to worker:",r)}else{var r=o.compressEvent(e);o.addCompressedEventToManager(r,t)}},this.terminate=function(){var e;null==(e=o.worker)||e.terminate()};var s=(0,ej.getGlobalScope)();if(this.canUseIdleCallback=s&&"requestIdleCallback"in s,this.eventsManager=e,this.config=t,this.deviceId=r,this.timeout=(null==(i=t.performanceConfig)?void 0:i.timeout)||2e3,n){t.loggerProvider.log("Enabling web worker for compression");var a=new Worker(URL.createObjectURL(new Blob([n],{type:"application/javascript"})));a.onerror=function(e){t.loggerProvider.error(e)},a.onmessage=function(e){var t=e.data,r=t.compressedEvent,n=t.sessionId;o.addCompressedEventToManager(r,n)},this.worker=a}}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){var r;this.canUseIdleCallback&&(null==(r=this.config.performanceConfig)?void 0:r.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}(),oX="Failed to store session replay events in IndexedDB",oZ="1.30.4",oY=function(){function e(e){var t=e.trackServerUrl,r=e.loggerProvider,n=e.payloadBatcher;this.storageKey="",this.retryTimeout=1e3,this.scheduled=null,this.queue=[],this.loggerProvider=r,this.payloadBatcher=n||function(e){return e},this.trackServerUrl=t}return e.prototype.sendEventsList=function(e){this.addToQueue((0,eh.__assign)((0,eh.__assign)({},e),{attempts:0,timeout:0}))},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:"Session replay event batch rejected due to exceeded retry count"}),!1)}
1).forEach(function(t){(e.queue=e.queue.concat(t),0===t.timeout)?e.schedule(0):setTimeout(function(){t.timeout=0,e.schedule(0)},t.timeout)})},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,eh.__awaiter)(this,void 0,void 0,function(){var t,r,n=this;return(0,eh.__generator)(this,function(i){switch(i.label){case 0:return t=[],r=[],this.queue.forEach(function(e){return 0===e.timeout?t.push(e):r.push(e)}),this.queue=r,this.scheduled&&(clearTimeout(this.scheduled),this.scheduled=null),[4,Promise.all(t.map(function(t){return n.send(t,e)}))];case 1:return i.sent(),[2]}})})},e.prototype.send=function(e,t){var r,n;return void 0===t&&(t=!0),(0,eh.__awaiter)(this,void 0,void 0,function(){var i,o,s,a,u,l,c,d,f,h,p,g;return(0,eh.__generator)(this,function(v){switch(v.label){case 0:if(!(i=e.apiKey))return[2,this.completeRequest({context:e,err:"Session replay event batch not sent due to missing api key"})];if(!(o=e.deviceId))return[2,this.completeRequest({context:e,err:"Session replay event batch not sent due to missing device ID"})];if(s=i6(),a=oZ,u=e.sampleRate,l=new URLSearchParams({device_id:o,session_id:"".concat(e.sessionId),type:"".concat(e.type)}),c="".concat((null==(r=e.version)?void 0:r.type)||"standalone","/").concat((null==(n=e.version)?void 0:n.version)||a),0===(d=this.payloadBatcher({version:1,events:e.events})).events.length)return this.completeRequest({context:e}),[2];v.label=1;case 1:return v.trys.push([1,3,,4]),f={headers:{"Content-Type":"application/json",Accept:"*/*",Authorization:"Bearer ".concat(i),"X-Client-Version":a,"X-Client-Library":c,"X-Client-Url":s.substring(0,1e3),"X-Client-Sample-Rate":"".concat(u)},body:JSON.stringify(d),method:"POST"},[4,fetch("".concat(i8(e.serverZone,this.trackServerUrl),"?").concat(l.toString()),f)];case 2:if(null===(h=v.sent()))return this.completeRequest({context:e,err:"Unexpected error occurred"}),[2];if(t)this.handleReponse(h.status,e);else{p="";try{p=JSON.stringify(h.body,null,2)}catch(e){}this.completeRequest({context:e,success:"".concat(h.status,": ").concat(p)})}return[3,4];case 3:return g=v.sent(),this.completeRequest({context:e,err:g}),[3,4];case 4:return[2]}})})},e.prototype.handleReponse=function(e,t){switch(new tY().buildStatus(e)){case $.Success:this.handleSuccessResponse(t);break;case $.Failed:this.handleOtherResponse(t);break;default:this.completeRequest({context:t,err:"Network error occurred, event batch rejected"})}},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){this.addToQueue((0,eh.__assign)((0,eh.__assign)({},e),{timeout:e.attempts*this.retryTimeout}))},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}(),o0=e.i(601217),o1=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.maxPersistedEventsSize=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,eh.__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}();(x=en||(en={})).RECORDING="recording",x.SENT="sent";var o2="sessionCurrentSequence",o3="sequencesToSend",o4=function(){var e=(0,ej.getGlobalScope)();return new Promise(function(t,r){if(!e)return r(Error("Global scope not found"));if(!e.indexedDB)return r(Error("Session Replay: cannot find indexedDB"));try{var n=e.indexedDB.open("keyval-store"),i=!1;n.onupgradeneeded=function(){1===n.result.version&&(i=!0)},n.onsuccess=function(){if(i){try{n.result.close()}catch(e){}try{e.indexedDB.deleteDatabase("keyval-store")}catch(e){}t();return}t(n.result)},n.onerror=function(e){var i;if((null==(i=n.error)?void 0:i.name)==="AbortError"){e.preventDefault(),t();return}r(n.error)}}catch(e){r(e)}})},o5=function(e){return(0,eh.__awaiter)(void 0,void 0,void 0,function(){return(0,eh.__generator)(this,function(t){switch(t.label){case 0:if(!(e.length>0))return[3,2];return[4,Promise.all(e.splice(0,10))];case 1:return t.sent(),[3,0];case 2:return[2]}})})},o6=function(e){var t,r;return e.objectStoreNames.contains(o2)||(r=e.createObjectStore(o2,{keyPath:"sessionId"})),e.objectStoreNames.contains(o3)||(t=e.createObjectStore(o3,{keyPath:"sequenceId",autoIncrement:!0})).createIndex("sessionId","sessionId"),{sequencesStore:t,currentSequenceStore:r}},o8=function(e){function t(t){var r=e.call(this,t)||this;return r.getSequencesToSend=function(){return(0,eh.__awaiter)(r,void 0,void 0,function(){var e,t,r,n,i,o;return(0,eh.__generator)(this,function(s){switch(s.label){case 0:return s.trys.push([0,5,,6]),e=[],[4,this.db.transaction("sequencesToSend").store.openCursor()];case 1:t=s.sent(),s.label=2;case 2:if(!t)return[3,4];return n=(r=t.value).sessionId,i=r.events,e.push({events:i,sequenceId:t.key,sessionId:n}),[4,t.continue()];case 3:return t=s.sent(),[3,2];case 4:return[2,e];case 5:return o=s.sent(),this.loggerProvider.warn("".concat(oX,": ").concat(o)),[3,6];case 6:return[2,void 0]}})})},r.storeCurrentSequence=function(e){return(0,eh.__awaiter)(r,void 0,void 0,function(){var t,r,n;return(0,eh.__generator)(this,function(i){switch(i.label){case 0:return i.trys.push([0,4,,5]),[4,this.db.get(o2,e)];case 1:if(!(t=i.sent()))return[2,void 0];return[4,this.db.put(o3,{sessionId:e,events:t.events})];case 2:return r=i.sent(),[4,this.db.put(o2,{sessionId:e,events:[]})];case 3:return i.sent(),[2,(0,eh.__assign)((0,eh.__assign)({},t),{sessionId:e,sequenceId:r})];case 4:return n=i.sent(),this.loggerProvider.warn("".concat(oX,": ").concat(n)),[3,5];case 5:return[2,void 0]}})})},r.addEventToCurrentSequence=function(e,t){return(0,eh.__awaiter)(r,void 0,void 0,function(){var r,n,i,o,s,a;return(0,eh.__generator)(this,function(u){switch(u.label){case 0:return u.trys.push([0,10,,11]),[4,(r=this.db.transaction(o2,"readwrite")).store.get(e)];case 1:if(n=u.sent())return[3,3];return[4,r.store.put({sessionId:e,events:[t]})];case 2:return u.sent(),[2];case 3:if(i=void 0,!this.shouldSplitEventsList(n.events,t))return[3,5];return i=n.events,[4,r.store.put({sessionId:e,events:[t]})];case 4:return u.sent(),[3,7];case 5:return o=n.events.concat(t),[4,r.store.put({sessionId:e,events:o})];case 6:u.sent(),u.label=7;case 7:return[4,r.done];case 8:if(u.sent(),!i)return[2,void 0];return[4,this.storeSendingEvents(e,i)];case 9:if(!(s=u.sent()))return[2,void 0];return[2,{events:i,sessionId:e,sequenceId:s}];case 10:return a=u.sent(),this.loggerProvider.warn("".concat(oX,": ").concat(a)),[3,11];case 11:return[2,void 0]}})})},r.storeSendingEvents=function(e,t){return(0,eh.__awaiter)(r,void 0,void 0,function(){var r;return(0,eh.__generator)(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.db.put(o3,{sessionId:e,events:t})];case 1:return[2,n.sent()];case 2:return r=n.sent(),this.loggerProvider.warn("".concat(oX,": ").concat(r)),[3,3];case 3:return[2,void 0]}})})},r.cleanUpSessionEventsStore=function(e,t){return(0,eh.__awaiter)(r,void 0,void 0,function(){var e;return(0,eh.__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(o3,t)];case 2:return r.sent(),[3,4];case 3:return e=r.sent(),this.loggerProvider.warn("".concat(oX,": ").concat(e)),[3,4];case 4:return[2]}})})},r.transitionFromKeyValStore=function(e){return(0,eh.__awaiter)(r,void 0,void 0,function(){var t,r,n,i,o,s,a,u=this;return(0,eh.__generator)(this,function(l){switch(l.label){case 0:return l.trys.push([0,6,,7]),[4,o4()];case 1:if(!(t=l.sent()))return[2];r=function(e,t){return(0,eh.__awaiter)(u,void 0,void 0,function(){var r,n,i=this;return(0,eh.__generator)(this,function(o){switch(o.label){case 0:return r=t.sessionSequences,n=[],Object.keys(r).forEach(function(o){var s=parseInt(o,10),a=r[s];if(s===t.currentSequenceId){var u=a.events.map(function(t){return(0,eh.__awaiter)(i,void 0,void 0,function(){return(0,eh.__generator)(this,function(r){return[2,this.addEventToCurrentSequence(e,t)]})})});n.push.apply(n,(0,eh.__spreadArray)([],(0,eh.__read)(u),!1))}else a.status!==en.SENT&&n.push(i.storeSendingEvents(e,a.events))}),[4,o5(n)];case 1:return o.sent(),[2]}})})},n="".concat(ep,"_").concat(this.apiKey.substring(0,10)),l.label=2;case 2:return l.trys.push([2,4,,5]),i=t.transaction("keyval").objectStore("keyval").getAll(n),[4,new Promise(function(t){i.onsuccess=function(n){return(0,eh.__awaiter)(u,void 0,void 0,function(){var i,o,s,a=this;return(0,eh.__generator)(this,function(u){switch(u.label){case 0:if(!(o=(i=n&&n.target.result)&&i[0]))return[3,2];
1return s=[],Object.keys(o).forEach(function(t){var n=parseInt(t,10),i=o[n];if(e===n)s.push(r(n,i));else{var u=i.sessionSequences;Object.keys(u).forEach(function(e){var t=parseInt(e,10);u[t].status!==en.SENT&&s.push(a.storeSendingEvents(n,u[t].events))})}}),[4,o5(s)];case 1:u.sent(),u.label=2;case 2:return t(),[2]}})})}})];case 3:return l.sent(),(o=(0,ej.getGlobalScope)())&&o.indexedDB.deleteDatabase("keyval-store"),[3,5];case 4:return s=l.sent(),this.loggerProvider.warn("Failed to transition session replay events from keyval to new store: ".concat(s)),[3,5];case 5:return[3,7];case 6:return a=l.sent(),this.loggerProvider.warn("Failed to access keyval store: ".concat(a,". For more information, visit: https://www.docs.developers.amplitude.com/session-replay/sdks/standalone/#indexeddb-best-practices")),[3,7];case 7:return[2]}})})},r.apiKey=t.apiKey,r.db=t.db,r}return(0,eh.__extends)(t,e),t.new=function(e,r,n){return(0,eh.__awaiter)(this,void 0,void 0,function(){var i,o,s,a;return(0,eh.__generator)(this,function(u){switch(u.label){case 0:var l;return u.trys.push([0,3,,4]),i="replay"===e?"":"_".concat(e),[4,(l="".concat(r.apiKey.substring(0,10),"_amp_session_replay_events").concat(i),(0,eh.__awaiter)(void 0,void 0,void 0,function(){return(0,eh.__generator)(this,function(e){switch(e.label){case 0:return[4,(0,o0.openDB)(l,1,{upgrade:o6})];case 1:return[2,e.sent()]}})}))];case 1:return o=u.sent(),[4,(s=new t((0,eh.__assign)((0,eh.__assign)({},r),{db:o}))).transitionFromKeyValStore(n)];case 2:return u.sent(),[2,s];case 3:return a=u.sent(),r.loggerProvider.warn("".concat(oX,": ").concat(a)),[3,4];case 4:return[2]}})})},t.prototype.getCurrentSequenceEvents=function(e){return(0,eh.__awaiter)(this,void 0,void 0,function(){var t,r,n,i,o,s;return(0,eh.__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=eh.__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}(o1),o7=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.finalizedSequences={},t.sequences={},t.sequenceId=0,t}return(0,eh.__extends)(t,e),t.prototype.resetCurrentSequence=function(e){this.sequences[e]=[]},t.prototype.addSequence=function(e){var t=this.sequenceId++,r=(0,eh.__spreadArray)([],(0,eh.__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,eh.__awaiter)(this,void 0,void 0,function(){return(0,eh.__generator)(this,function(e){return[2,Object.entries(this.finalizedSequences).map(function(e){var t=(0,eh.__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,eh.__awaiter)(this,void 0,void 0,function(){return(0,eh.__generator)(this,function(t){return this.sequences[e]?[2,this.addSequence(e)]:[2,void 0]})})},t.prototype.addEventToCurrentSequence=function(e,t){return(0,eh.__awaiter)(this,void 0,void 0,function(){var r;return(0,eh.__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,eh.__awaiter)(this,void 0,void 0,function(){return(0,eh.__generator)(this,function(r){return this.finalizedSequences[this.sequenceId]={sessionId:e,events:t},[2,this.sequenceId++]})})},t.prototype.cleanUpSessionEventsStore=function(e,t){return(0,eh.__awaiter)(this,void 0,void 0,function(){return(0,eh.__generator)(this,function(e){return void 0!==t&&delete this.finalizedSequences[t],[2]})})},t}(o1),o9=function(e){var t=e.config,r=e.sessionId,n=e.minInterval,i=e.maxInterval,o=e.type,s=e.payloadBatcher,a=e.storeType;return(0,eh.__awaiter)(void 0,void 0,void 0,function(){var e,u,l,c,d;function f(t){return void 0===t&&(t=!1),(0,eh.__awaiter)(this,void 0,void 0,function(){return(0,eh.__generator)(this,function(r){return[2,e.flush(t)]})})}return(0,eh.__generator)(this,function(h){switch(h.label){case 0:if(e=new oY((0,eh.__assign)((0,eh.__assign)({},t),{loggerProvider:t.loggerProvider,payloadBatcher:s})),u=function(){return new o7({loggerProvider:t.loggerProvider,maxInterval:i,minInterval:n})},"idb"!==a)return[3,2];return[4,(0,eh.__awaiter)(void 0,void 0,void 0,function(){var e;return(0,eh.__generator)(this,function(s){switch(s.label){case 0:return[4,o8.new(o,{loggerProvider:t.loggerProvider,minInterval:n,maxInterval:i,apiKey:t.apiKey},r)];case 1:return e=s.sent(),t.loggerProvider.log("Failed to initialize idb store, falling back to memory store."),[2,null!=e?e:u()]}})})];case 1:return c=h.sent(),[3,3];case 2:c=u(),h.label=3;case 3:return l=c,d=function(r){var n=r.events,i=r.sessionId,s=r.deviceId,a=r.sequenceId;t.debugMode&&ot().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:i,flushMaxRetries:t.flushMaxRetries,apiKey:t.apiKey,deviceId:s,sampleRate:t.sampleRate,serverZone:t.serverZone,version:t.version,type:o,onComplete:function(){return(0,eh.__awaiter)(void 0,void 0,void 0,function(){return(0,eh.__generator)(this,function(e){switch(e.label){case 0:return[4,l.cleanUpSessionEventsStore(i,a)];case 1:return e.sent(),[2]}})})}})},[2,{sendCurrentSequenceEvents:function(e){var r=e.sessionId,n=e.deviceId;l.storeCurrentSequence(r).then(function(e){e&&d({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;l.addEventToCurrentSequence(n,r.data).then(function(e){return e&&d({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,eh.__awaiter)(void 0,void 0,void 0,function(){var e;return(0,eh.__generator)(this,function(r){switch(r.label){case 0:return[4,l.getSequencesToSend()];case 1:return(e=r.sent())&&e.forEach(function(e){d({sequenceId:e.sequenceId,events:e.events,sessionId:e.sessionId,deviceId:t})}),[2]}})})},flush:f}]}})})},se=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,eh.__awaiter)(this,void 0,void 0,function(){var t;return(0,eh.__generator)(this,function(r){switch(r.label){case 0:return t=[],this.managers.forEac
1h(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,eh.__awaiter)(this,void 0,void 0,function(){var t;return(0,eh.__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 st(e,t,r){for(var n=null,i=[],o=e,s=0;o&&"break"!==function(){var e,a,u,l,c=new Date().getTime()-es.getTime();if(void 0!==ei.timeoutMs&&c>ei.timeoutMs)throw Error("Timeout: Can't find a unique selector after ".concat(c,"ms"));var d=sl((e=o.getAttribute("id"))&&ei.idName(e)?{name:"#"+CSS.escape(e),penalty:0}:null)||sl.apply(void 0,(0,eh.__spreadArray)([],(0,eh.__read)(Array.from(o.attributes).filter(function(e){return ei.attr(e.name,e.value)}).map(function(e){return{name:"[".concat(CSS.escape(e.name),'="').concat(CSS.escape(e.value),'"]'),penalty:.5}})),!1))||sl.apply(void 0,(0,eh.__spreadArray)([],(0,eh.__read)(Array.from(o.classList).filter(ei.className).map(function(e){return{name:"."+CSS.escape(e),penalty:1}})),!1))||sl((a=o.tagName.toLowerCase(),ei.tagName(a)?{name:a,penalty:2}:null))||[ss()],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(su).map(function(e){return sa(e,f)})));else if("two"==t)d=d.slice(0,1),f&&(d=d.concat(d.filter(su).map(function(e){return sa(e,f)})));else if("one"==t){var h=(0,eh.__read)(d=d.slice(0,1),1)[0];f&&su(h)&&(d=[sa(h,f)])}else"none"==t&&(d=[ss()],f&&(d=[sa(d[0],f)]));try{for(var p=(u=void 0,(0,eh.__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>=ei.seedMinLength&&(n=sr(i,r)))return"break";o=o.parentElement,s++}(););return(n||(n=sr(i,r)),!n&&r)?r():n}function sr(e,t){var r,n,i=sd(function e(t,r){var n,i,o,s,a;return void 0===r&&(r=[]),(0,eh.__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,eh.__values)(t[0])).next(),u.label=2;case 2:if(i.done)return[3,5];return o=i.value,[5,(0,eh.__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>ei.threshold)return t?t():null;try{for(var o=(0,eh.__values)(i),s=o.next();!s.done;s=o.next()){var a=s.value;if(so(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 sn(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 si(e){return e.map(function(e){return e.penalty}).reduce(function(e,t){return e+t},0)}function so(e){var t=sn(e);switch(eo.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 ss(){return{name:"*",penalty:3}}function sa(e,t){return{name:e.name+":nth-child(".concat(t,")"),penalty:e.penalty+1}}function su(e){return"html"!==e.name&&!e.name.startsWith("#")}function sl(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e.filter(sc);return r.length>0?r:null}function sc(e){return null!=e}function sd(e){return(0,eh.__spreadArray)([],(0,eh.__read)(e),!1).sort(function(e,t){return si(e)-si(t)})}var sf=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}},sh=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,eh.__assign)((0,eh.__assign)({},t),{timestamp:s,count:1}),e},{}))}},sp=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!==oa.Click)return;var u,l=(0,ej.getGlobalScope)();
1if(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(es=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=(ei=(0,eh.__assign)((0,eh.__assign)({},i),t)).root,n=i,eo=r.nodeType===Node.DOCUMENT_NODE?r:r===n.root?r.ownerDocument:r;var o=st(e,"all",function(){return st(e,"two",function(){return st(e,"one",function(){return st(e,"none")})})});if(o){var s=sd(function e(t,r,n){var i,o,s;return void 0===n&&(n={counter:0,visited:new Map}),(0,eh.__generator)(this,function(a){switch(a.label){case 0:if(!(t.length>2&&t.length>ei.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>ei.maxNumberOfTries||(n.counter+=1,(o=(0,eh.__spreadArray)([],(0,eh.__read)(t),!1)).splice(i,1),s=sn(o),n.visited.has(s)))return[2];if(!(so(o)&&(u=o,l=r,eo.querySelector(sn(u))===l)))return[3,4];return[4,o];case 2:return a.sent(),n.visited.set(s,!0),[5,(0,eh.__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]),sn(o)}throw Error("Selector was not found.")}(g,a)}catch(e){r.logger.debug("error resolving selector from finder")}var v=oe(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 sg(){var e=(0,ej.getGlobalScope)();return(null==e?void 0:e.innerHeight)||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight||0}function sv(){var e=(0,ej.getGlobalScope)();return(null==e?void 0:e.innerWidth)||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth||0}var sm=function(){function e(e,t){var r=(0,ej.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=i8(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}(),sy=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=e(),s=(0,ej.getGlobalScope)();s&&o&&r.transport.send(o,{version:1,events:[{maxScrollX:r._maxScrollX,maxScrollY:r._maxScrollY,maxScrollWidth:r._maxScrollWidth,maxScrollHeight:r._maxScrollHeight,viewportHeight:sg(),viewportWidth:sv(),pageUrl:oe(s.location.href,null!=(i=null==(n=r.config.interactionConfig)?void 0:n.ugcFilterRules)?i:[]),timestamp:r.timestamp,type:"scroll"}]})}},this._maxScrollX=0,this._maxScrollY=0,this._currentScrollX=0,this._currentScrollY=0,this._maxScrollWidth=sv(),this._maxScrollHeight=sg(),this.config=t,this.transport=e}return e.default=function(t,r){return new e(new sm(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}
1,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=sv();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=sg();this._maxScrollY=e.y;var o=e.y+i;o>this._maxScrollHeight&&(this._maxScrollHeight=o),this.timestamp=t}},e}(),sb=function(e){var t=e.sessionId,r=e.deviceId;this.deviceId=r,this.sessionId=t,t&&r&&(this.sessionReplayId="".concat(r,"/").concat(t))},s_=new function(){var e=this;this.dbs={},this.createStore=function(t){return(0,eh.__awaiter)(e,void 0,void 0,function(){return(0,eh.__generator)(this,function(e){switch(e.label){case 0:return[4,(0,o0.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,eh.__awaiter)(e,void 0,void 0,function(){var e,r;return(0,eh.__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,eh.__awaiter)(e,void 0,void 0,function(){var e,t,o,s;return(0,eh.__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(),r.warn("Failed to get targeting match for session id ".concat(i,": ").concat(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,eh.__awaiter)(e,void 0,void 0,function(){var e,t,s;return(0,eh.__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(),r.warn("Failed to store targeting match for session id ".concat(i,": ").concat(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,eh.__awaiter)(e,void 0,void 0,function(){var e,t,o,s,a,u,l,c;return(0,eh.__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(),r.warn("Failed to clear old targeting matches for sessions: ".concat(c)),[3,9];case 9:return[2]}})})}},sw=function(t){var r=t.sessionId,n=t.targetingConfig,i=t.loggerProvider,o=t.apiKey,s=t.targetingParams;return(0,eh.__awaiter)(void 0,void 0,void 0,function(){var t,a,u;return(0,eh.__generator)(this,function(l){switch(l.label){case 0:return[4,s_.clearStoreOfOldSessions({loggerProvider:i,apiKey:o,currentSessionId:r})];case 1:return l.sent(),[4,s_.getTargetingMatchForSession({loggerProvider:i,apiKey:o,sessionId:r})];case 2:if(!0===l.sent())return[2,!0];t=!0,l.label=3;case 3:return l.trys.push([3,6,,7]),[4,e.A(18737)];case 4:return[4,(0,l.sent().evaluateTargeting)((0,eh.__assign)((0,eh.__assign)({},s),{flag:n,sessionId:r,apiKey:o,loggerProvider:i}))];case 5:return(a=l.sent())&&a.sr_targeting_config&&(t="on"===a.sr_targeting_config.key),s_.storeTargetingMatchForSession({loggerProvider:i,apiKey:o,sessionId:r,targetingMatch:t}),[3,7];case 6:return u=l.sent(),i.warn(u.message),[3,7];case 7:return[2,t]}})})};function sS(e){return void 0===e&&(e={}),{name:"amplitude/url-tracking@1",observer:function(t,r,n){var i,o,s,a=(0,eh.__assign)((0,eh.__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="__amplitude_url_tracking_patched__",p="__amplitude_url_tracking_reset__",g=function(){return r.location&&r.location.href||""}
1,v=function(){var e=r.innerHeight,t=r.innerWidth,n=r.document,i=g(),o="";return d&&(o=(null==n?void 0:n.title)||""),{href:u.length>0?oe(i,u):i,title:o,viewportHeight:e,viewportWidth:t,type:"url-change-event"}},m=function(){var e=g();(void 0===f||e!==f)&&(f=e,t(v()))},y=function(e){var t=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var i=e.apply(this,t);return r[p]||m(),i};return t[h]=!0,t},b=function(){m()};if(l){var _=r.setInterval(function(){m()},c);return m(),function(){_&&r.clearInterval(_)}}if(r.history){var w=r.history.pushState.bind(r.history),S=r.history.replaceState.bind(r.history);return r.history.pushState[h]||(r.history.pushState=y(w),r.history.replaceState=y(S)),r.addEventListener("popstate",m),r.addEventListener("hashchange",b),m(),function(){r[p]=!0,r.removeEventListener("popstate",m),r.removeEventListener("hashchange",b)}}return r.addEventListener("hashchange",b),m(),function(){r.removeEventListener("hashchange",b)}},options:e}}sS();var sE=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.teardownEventListeners=function(t){var r=(0,ej.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){return void 0===r&&(r=!1),void 0===n&&(n=!1),(0,eh.__awaiter)(e,void 0,void 0,function(){var e,i;return(0,eh.__generator)(this,function(o){switch(o.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,!(this.config.targetingConfig&&!this.sessionTargetingMatch))return[3,2];return(e=t.event)&&Object.values(W).includes(e.event_type)&&(e=void 0),i=this,[4,sw({sessionId:this.identifiers.sessionId,targetingConfig:this.config.targetingConfig,loggerProvider:this.loggerProvider,apiKey:this.config.apiKey,targetingParams:{userProperties:t.userProperties,event:e}})];case 1:i.sessionTargetingMatch=o.sent(),this.loggerProvider.debug(JSON.stringify({name:"targeted replay capture config",sessionTargetingMatch:this.sessionTargetingMatch,event:e,targetingParams:t},null,2)),o.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:o.sent(),o.label=5;case 5:return[2]}})})},this.addCustomRRWebEvent=function(t,r,n){return void 0===r&&(r={}),void 0===n&&(n=!0),(0,eh.__awaiter)(e,void 0,void 0,function(){var e,i,o,s;return(0,eh.__generator)(this,function(a){switch(a.label){case 0:if(a.trys.push([0,3,,4]),e=void 0,!((i=this.config)&&t!==er.METADATA)||(e={config:or(i),version:oZ},!n))return[3,2];return[4,ot()];case 1:o=a.sent(),e=(0,eh.__assign)((0,eh.__assign)({},o),e),a.label=2;case 2:return this.recordCancelCallback&&this.recordFunction?this.recordFunction.addCustomEvent(t,(0,eh.__assign)((0,eh.__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 i1(new e$)}return t.prototype.init=function(e,t){return eK(this._init(e,t))},t.prototype._init=function(t,r){var n,i,o,s,a,u;return(0,eh.__awaiter)(this,void 0,void 0,function(){var l,c,d,f,h,p,g,v,m,y,b,_,w,S;return(0,eh.__generator)(this,function(E){switch(E.label){case 0:return this.loggerProvider=new i1(r.loggerProvider||new e$),Object.prototype.hasOwnProperty.call(r,"logLevel")&&this.loggerProvider.enable(r.logLevel),this.identifiers=new sb({sessionId:r.sessionId,deviceId:r.deviceId}),l=this,[4,(0,eh.__awaiter)(void 0,void 0,void 0,function(){var e;return(0,eh.__generator)(this,function(n){return e=new oi(t,r),[2,new op(new tg(t,e.loggerProvider,e.serverZone,r.configServerUrl),e)]})})];case 1:return l.joinedConfigGenerator=E.sent(),[4,this.joinedConfigGenerator.generateJoinedConfig()];case 2:d=(c=E.sent()).joinedConfig,f=c.localConfig,h=c.remoteConfig,this.config=d,this.setMetadata(r.sessionId,d,f,h,null==(n=r.version)?void 0:n.version,oZ,null==(i=r.version)?void 0:i.type),r.sessionId&&(null==(o=this.config.interactionConfig)?void 0:o.enabled)&&(p=sy.default({sessionId:r.sessionId,type:"interaction"},this.config),this.pageLeaveFns=[p.send(this.getDeviceId.bind(this)).bind(p)],this.scrollHook=p.hook.bind(p),this.clickHandler=new sp(this.loggerProvider,p)),g=[],"idb"!==(v=this.config.storeType)||(null==(s=(0,ej.getGlobalScope)())?void 0:s.indexedDB)||(v="memory",this.loggerProvider.warn("Could not use preferred indexedDB storage, reverting to in memory option.")),this.loggerProvider.log("Using ".concat(v," for event storage.")),E.label=3;case 3:return E.trys.push([3,5,,6]),[4,o9({config:this.config,sessionId:this.identifiers.sessionId,type:"replay",storeType:v})];case 4:return m=E.sent(),g.push({name:"replay",manager:m}),[3,6];case 5:return y=E.sent(),this.loggerProvider.warn("Error occurred while creating replay events manager: ".concat(y.toString())),[3,6];case 6:if(!(null==(a=this.config.interactionConfig)?void 0:a.enabled))return[3,10];b=this.config.interactionConfig.batch?sh:sf,E.label=7;case 7:return E.trys.push([7,9,,10]),[4,o9({config:this.config,sessionId:this.identifiers.sessionId,type:"interaction",minInterval:null!=(u=this.config.interactionConfig.trackEveryNms)?u:3e4,maxInterval:6e4,payloadBatcher:b,storeType:v})];case 8:return _=E.sent(),g.push({name:"interaction",manager:_}),[3,10];case 9:return y=E.sent(),this.loggerProvider.warn("Error occurred while creating interaction events manager: ".concat(y.toString())),[3,10];case 10:if(this.eventsManager=new(se.bind.apply(se,(0,eh.__spreadArray)([void 0],(0,eh.__read)(g),!1))),this.eventCompressor&&this.eventCompressor.terminate(),w=void 0,S=(0,ej.getGlobalScope)(),!(this.config.useWebWorker&&S&&S.Worker))return[3,12];return[4,e.A(286248)];case 11:w=E.sent().compressionScript,E.label=12;case 12:return this.eventCompressor=new oQ(this.eventsManager,this.config,this.getDeviceId(),w),[4,this.initializeNetworkObservers()];case 13:return E.sent(),this.loggerProvider.log("Installing @amplitude/session-replay-browser."),this.teardownEventListeners(!1),[4,this.evaluateTargetingAndCapture({userProperties:r.userProperties},!0)];case 14:return E.sent(),[2]}})})},t.prototype.setSessionId=function(e,t){return eK(this.asyncSetSessionId(e,t))},t.prototype.asyncSetSessionId=function(e,t,r){var n;return(0,eh.__awaiter)(this,void 0,void 0,function(){var i,o,s;return(0,eh.__generator)(this,function(a){switch(a.label){case 0:if(this.sessionTargetingMatch=!1,this.lastShouldRecordDecision=void 0,(i=this.identifiers&&this.identifiers.sessionId)&&this.sendEvents(i),o=t||this.getDeviceId(),this.identifiers=new sb({sessionId:e,deviceId:o}
1),!(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},!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={})[iQ]=r.sessionReplayId?r.sessionReplayId:null,i=e,t.debugMode&&(i[iY]=JSON.stringify({appHash:tE(t.apiKey).toString()}))),this.addCustomRRWebEvent(er.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,eh.__awaiter)(this,void 0,void 0,function(){var r;return(0,eh.__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=ta(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,31*Math.abs(tE(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(er.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,eh.__awaiter)(this,void 0,void 0,function(){var u,l,c,d;return(0,eh.__generator)(this,function(f){switch(f.label){case 0:u=[];try{l=sS({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(805622)];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,eh.__awaiter)(this,void 0,void 0,function(){var t,r;return(0,eh.__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(33287)];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;return void 0===e&&(e=!0),(0,eh.__awaiter)(this,void 0,void 0,function(){var u,l,c,d,f,h,p,g,v,m,y,b,_,w=this;return(0,eh.__generator)(this,function(S){switch(S.label){case 0:if(u=this.config,l=this.getShouldRecord(),c=null==(t=this.identifiers)?void 0:t.sessionId,!l||!c||!u)return[2];return this.stopRecordingEvents(),[4,this.getRecordFunction()];case 1:if(!(d=S.sent()))return[2];return[4,this.initializeNetworkObservers()];case 2:S.sent(),null==(r=this.networkObservers)||r.start(function(e){w.addCustomRRWebEvent(er.FETCH_REQUEST,e)}),f=u.privacyConfig,h=u.interactionConfig,p=u.loggingConfig,g=(null==h?void 0:h.enabled)?{mouseInteraction:this.eventsManager&&(null==(n=this.clickHandler)?void 0:n.createHook({eventsManager:this.eventsManager,sessionId:c,deviceIdFn:this.getDeviceId.bind(this),mirror:d.mirror,ugcFilterRules:null!=(i=h.ugcFilterRules)?i:[],performanceOptions:null==(o=u.performanceConfig)?void 0:o.interaction})),scroll:this.scrollHook}:{},v=(null==h?void 0:h.enabled)&&h.ugcFilterRules?h.ugcFilterRules:[],this.loggerProvider.log("Session Replay capture beginning for ".concat(c,".")),S.label=3;case 3:return S.trys.push([3,5,,6]),m=this,y=d,_={emit:function(e){if(w.shouldOptOut()){w.loggerProvider.log("Opting session ".concat(c," out of recording due to optOut config.")),w.stopRecordingEvents(),w.sendEvents();return}e.type===oo.Meta&&(e.data.href=oe(e.data.href,v)),w.eventCompressor&&w.eventCompressor.enqueueEvent(e,c)},inlineStylesheet:u.shouldInlineStylesheet,hooks:g,maskAllInputs:!0,maskTextClass:i0,blockClass:"amp-block",blockSelector:this.getBlockSelectors(),applyBackgroun
1dColorToBlockedElements:u.applyBackgroundColorToBlockedElements,maskInputFn:i5("input",f),maskTextFn:i5("text",f),maskTextSelector:this.getMaskTextSelectors(),recordCanvas:!1,slimDOMOptions:{script:null==(s=u.omitElementTags)?void 0:s.script,comment:null==(a=u.omitElementTags)?void 0:a.comment},errorHandler:function(e){if(e.message.includes("insertRule")&&e.message.includes("CSSStyleSheet")||e._external_)throw e;return w.loggerProvider.warn("Error while capturing replay: ",e.toString()),!0}},[4,this.getRecordingPlugins(p)];case 4:return m.recordCancelCallback=y.apply(void 0,[(_.plugins=S.sent(),_)]),this.addCustomRRWebEvent(er.DEBUG_INFO),e&&this.addCustomRRWebEvent(er.METADATA,this.metadata),[3,6];case 5:return b=S.sent(),this.loggerProvider.warn("Failed to initialize session replay:",b),[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,eh.__awaiter)(this,void 0,void 0,function(){return(0,eh.__generator)(this,function(r){return[2,null==(t=this.eventsManager)?void 0:t.flush(e)]})})},t.prototype.shutdown=function(){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())?tE(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,eh.__awaiter)(this,void 0,void 0,function(){var i,o;return(0,eh.__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(876412)];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}(),sk=function(e){return function(){var t=e.config||on();return{logger:t.loggerProvider,logLevel:t.logLevel}}};let sx={init:e3((I=new sE).init.bind(I),"init",sk(I)),evaluateTargetingAndCapture:e3(I.evaluateTargetingAndCapture.bind(I),"evaluateTargetingAndRecord",sk(I)),setSessionId:e3(I.setSessionId.bind(I),"setSessionId",sk(I)),getSessionId:e3(I.getSessionId.bind(I),"getSessionId",sk(I)),getSessionReplayProperties:e3(I.getSessionReplayProperties.bind(I),"getSessionReplayProperties",sk(I)),flush:e3(I.flush.bind(I),"flush",sk(I)),shutdown:e3(I.shutdown.bind(I),"shutdown",sk(I))};var sI=sx.init,sT=sx.setSessionId,sP=sx.getSessionId,sC=sx.getSessionReplayProperties,sA=sx.flush,sO=sx.shutdown,sR=sx.evaluateTargetingAndCapture;(T=ea||(ea={})).SET="$set",T.SET_ONCE="$setOnce",T.ADD="$add",T.APPEND="$append",T.PREPEND="$prepend",T.REMOVE="$remove",T.PREINSERT="$preInsert",T.POSTINSERT="$postInsert",T.UNSET="$unset",T.CLEAR_ALL="$clearAll",(P=eu||(eu={})).REVENUE_PRODUCT_ID="$productId",P.REVENUE_QUANTITY="$quantity",P.REVENUE_PRICE="$price",P.REVENUE_TYPE="$revenueType",P.REVENUE_CURRENCY="$currency",P.REVENUE="$revenue",(C=el||(el={})).IDENTIFY="$identify",C.GROUP_IDENTIFY="$groupidentify",C.REVENUE="revenue_amount";var sN=[ea.SET,ea.SET_ONCE,ea.ADD,ea.APPEND,ea.PREPEND,ea.POSTINSERT],sD=function(e){if(e.user_properties){var t={};return Object.keys(e.user_properties).forEach(function(r){if(sN.includes(r)){var n=e.user_properties&&e.user_properties[r];t=(0,eh.__assign)((0,eh.__assign)({},t),n)}}),t}},sM="1.25.4",sj="".concat("[Amplitude]"," Session Replay ID"),sL=function(){function e(t){this.name=e.pluginName,this.type="enrichment",this.config=null,this.sessionReplay={flush:sA,getSessionId:sP,getSessionReplayProperties:sC,init:sI,setSessionId:sT,shutdown:sO,evaluateTargetingAndCapture:sR},this.options=(0,eh.__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,eh.__awaiter)(this,void 0,void 0,function(){var t,c;return(0,eh.__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(sM,".")),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,eh.__assign)((0,eh.__assign)({},e.defaultTracking),{sessions:!0})),t=(void 0===(f=this.config.instanceName)&&(f="$default_instance"),ts.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:sM},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,applyBackgroun
1dColorToBlockedElements: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,eh.__awaiter)(this,void 0,void 0,function(){return(0,eh.__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,eh.__awaiter)(this,void 0,void 0,function(){return(0,eh.__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;return(0,eh.__awaiter)(this,void 0,void 0,function(){var n,i,o,s;return(0,eh.__generator)(this,function(a){switch(a.label){case 0:if(a.trys.push([0,9,,10]),!this.options.customSessionId)return[3,4];if(!(n=this.options.customSessionId(e)))return[3,3];if(n===this.sessionReplay.getSessionId())return[3,2];return[4,this.sessionReplay.setSessionId(n).promise];case 1:a.sent(),a.label=2;case 2:i=this.sessionReplay.getSessionReplayProperties(),e.event_properties=(0,eh.__assign)((0,eh.__assign)({},e.event_properties),i),a.label=3;case 3:return[3,8];case 4:if(!((n=null==(t=this.config)?void 0:t.sessionId)&&n!==this.sessionReplay.getSessionId()))return[3,6];return[4,this.sessionReplay.setSessionId(n).promise];case 5:a.sent(),a.label=6;case 6:if(!(n&&n===e.session_id))return[3,8];return o=void 0,e.event_type===W.IDENTIFY&&(o=sD(e)),[4,this.sessionReplay.evaluateTargetingAndCapture({event:e,userProperties:o})];case 7:a.sent(),i=this.sessionReplay.getSessionReplayProperties(),e.event_properties=(0,eh.__assign)((0,eh.__assign)({},e.event_properties),i),a.label=8;case 8:return e.event_type===W.IDENTIFY&&e.event_properties&&delete e.event_properties[sj],[2,Promise.resolve(e)];case 9:return s=a.sent(),null==(r=this.config)||r.loggerProvider.error("Session Replay: Failed to enrich event due to ".concat(s.message)),[2,Promise.resolve(e)];case 10:return[2]}})})},e.prototype.teardown=function(){var e;return(0,eh.__awaiter)(this,void 0,void 0,function(){return(0,eh.__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}(),sU=e.i(124541),sq=function(e,t){return(sq=Object.setPrototypeOf||({__proto__:[]})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 sF(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}sq(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var sV=function(){return(sV=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 sB(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 sK(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 sz(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);
1if(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 sW(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 sH(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 s$="is not",sG="contains",sJ="does not contain",sQ="less",sX="less or equal",sZ="greater",sY="greater or equal",s0="version less",s1="version less or equal",s2="version greater",s3="version greater or equal",s4="set is",s5="set is not",s6="set contains",s8="set does not contain",s7="set contains any",s9="set does not contain any",ae=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)},at=function(e,t){void 0===t&&(t=0);for(var r=ae(e),n=r.length,i=n>>2,o=t,s=0;s<i;s++)o=ar(ao(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=ai(u=Math.imul(u,-0x3361d2af),15),0x1b873593);break;case 2:u^=r[a+1]<<8,u^=r[a],o^=u=Math.imul(u=ai(u=Math.imul(u,-0x3361d2af),15),0x1b873593);break;case 1:u^=r[a],o^=u=Math.imul(u=ai(u=Math.imul(u,-0x3361d2af),15),0x1b873593)}return an(o^=n)>>>0},ar=function(e,t){var r=e,n=t;return n^=r=Math.imul(r=ai(r=Math.imul(r,-0x3361d2af),15),0x1b873593),(n=Math.imul(n=ai(n,13),5))+-0x19ab949c|0},an=function(e){var t=e;return t^=t>>>16,t=Math.imul(t,-0x7a143595),t^=t>>>13,t=Math.imul(t,-0x3d4d51cb),t^=t>>>16},ai=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},ao=function(e,t){return void 0===t&&(t=0),as(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])},as=function(e){return(-0x1000000&e)>>>24|(0xff0000&e)>>>8|(65280&e)<<8|(255&e)<<24},aa=function(e,t){var r,n;if(t&&0!==t.length){try{for(var i=sz(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}},au="^".concat("(\\d+)\\.(\\d+)","(\\.").concat("(\\d+)").concat("(-(([-\\w]+\\.?)*))?",")?$"),al=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(au).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}(),ac=function(){function e(){}return e.prototype.evaluate=function(e,t){var r,n,i={},o={context:e,result:i};try{for(var s=sz(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.evaluateFlag=function(e,t){try{for(var r,n,i,o=sz(t.segments),s=o.next();!s.done;s=o.next()){var a=s.value;if(i=this.evaluateSegment(e,t,a)){var u=sV(sV(sV({},t.metadata),a.metadata),i.metadata);i=sV(sV({},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.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=sz(t),a=s.next();!a.done;a=s.next()){var u=a.value,l=!0;try{for(var c=(i=void 0,sz(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}}
1finally{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=aa(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 at(e)},e.prototype.bucket=function(e,t){if(!t.bucket)return t.variant;var r,n,i,o,s=this.coerceString(aa(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=sz(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,sz(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 sG:case sQ:case sX:case sZ:case sY:case s0:case s1:case s2:case s3:case s4:case s6:case s7:return r;case s$:case sJ:case s8:case s9:return!r;default:return!1}},e.prototype.matchSet=function(e,t,r){switch(t){case s4:return this.setEquals(e,r);case s5:return!this.setEquals(e,r);case s6:return this.matchesSetContainsAll(e,r);case s8:return!this.matchesSetContainsAll(e,r);case s7:return this.matchesSetContainsAny(e,r);case s9: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 s$:return!this.matchesIs(e,r);case sG:return this.matchesContains(e,r);case sJ:return!this.matchesContains(e,r);case sQ:case sX:case sZ:case sY:return this.matchesComparable(e,t,r,function(e){return n.parseNumber(e)},this.comparator);case s0:case s1:case s2:case s3:return this.matchesComparable(e,t,r,function(e){return al.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=sz(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 sQ:case s0:return e<r;case sX:case s1:return e<=r;case sZ:case s2:return e>r;case sY:case s3:return e>=r;default:return!1}},e.prototype.versionComparator=function(e,t,r){var n=e.compareTo(r);switch(t){case sQ:case s0:return n<0;case sX:case s1:return n<=0;case sZ:case s2:return n>0;case sY:case s3: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)}
1).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 s4:case s5:case s6:case s8:case s7:case s9: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&&sH([],sW(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=sz(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=sz(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}(),ad=function(e,t){var r,n,i=sV({},e),o=[],s=t||Object.keys(i);try{for(var a=sz(s),u=a.next();!u.done;u=a.next()){var l=u.value,c=af(l,i);c&&o.push.apply(o,sH([],sW(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},af=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=af(e,t,r);n&&s.push.apply(s,sH([],sW(n),!1))};try{for(var u=sz(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 ah="function"==typeof sU.Buffer,ap="function"==typeof TextDecoder?new TextDecoder:void 0,ag="function"==typeof TextEncoder?new TextEncoder:void 0,av=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),am=(r={},av.forEach((e,t)=>r[e]=t),r),ay=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,ab=String.fromCharCode.bind(String),a_="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):e=>new Uint8Array(Array.prototype.slice.call(e,0)),aw=e=>e.replace(/=/g,"").replace(/[+\/]/g,e=>"+"==e?"-":"_"),aS="function"==typeof btoa?e=>btoa(e):ah?e=>sU.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+=av[(t=r<<16|n<<8|i)>>18&63]+av[t>>12&63]+av[t>>6&63]+av[63&t]}return s?o.slice(0,s-3)+"===".substring(s):o},aE=ah?e=>sU.Buffer.from(e).toString("base64"):e=>{let t=[];for(let r=0,n=e.length;r<n;r+=4096)t.push(ab.apply(null,e.subarray(r,r+4096)));return aS(t.join(""))},ak=e=>{if(e.length<2){var t=e.charCodeAt(0);return t<128?e:t<2048?ab(192|t>>>6)+ab(128|63&t):ab(224|t>>>12&15)+ab(128|t>>>6&63)+ab(128|63&t)}var t=65536+(e.charCodeAt(0)-55296)*1024+(e.charCodeAt(1)-56320);return ab(240|t>>>18&7)+ab(128|t>>>12&63)+ab(128|t>>>6&63)+ab(128|63&t)},ax=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,aI=ah?e=>sU.Buffer.from(e,"utf8").toString("base64"):ag?e=>aE(ag.encode(e)):e=>aS(e.replace(ax,ak)),aT=(e,t=!1)=>t?aw(aI(e)):aI(e),aP=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,aC=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 ab((t>>>10)+55296)+ab((1023&t)+56320);case 3:return ab((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return ab((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},aA="function"==typeof atob?e=>atob(e.replace(/[^A-Za-z0-9\+\/]/g,"")):ah?e=>sU.Buffer.from(e,"base64").toString("binary"):e=>{if(e=e.replace(/\s+/g,""),!ay.test(e))throw TypeError("malformed base64.");e+="==".slice(2-(3&e.length));let t,r="",n,i;for(let o=0;o<e.length;)t=am[e.charAt(o++)]<<18|am[e.charAt(o++)]<<12|(n=am[e.charAt(o++)])<<6|(i=am[e.charAt(o++)]),r+=64===n?ab(t>>16&255):64===i?ab(t>>16&255,t>>8&255):ab(t>>16&255,t>>8&255,255&t);return r},aO=ah?e=>a_(sU.Buffer.from(e,"base64")):e=>a_(aA(e).split("").map(e=>e.charCodeAt(0))),aR=ah?e=>sU.Buffer.from(e,"base64").toString("utf8"):ap?e=>ap.decode(aO(e)):e=>aA(e).replace(aP,aC);var aN=function(e){function t(r,n){var i=e.call(this,n)||this;return i.statusCode=r,Object.setPrototypeOf(i,t.prototype),i}return sF(t,e),t}(Error),aD=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return sF(t,e),t}(Error),aM=function(){function e(e,t,r){this.deploymentKey=e,this.serverUrl=t,this.httpClient=r}return e.prototype.getVariants=function(e,t){return sB(this,void 0,void 0,function(){var r,n,i,o;return sK(this,function(s){switch(s.label){case 0:return r=aT(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"]=aT(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
1imeoutMillis})];case 1:if(200!=(o=s.sent()).status)throw new aN(o.status,"Fetch error response: status=".concat(o.status));return[2,JSON.parse(o.body)]}})})},e}(),aj=function(){function e(e,t,r){this.deploymentKey=e,this.serverUrl=t,this.httpClient=r}return e.prototype.getFlags=function(e){return sB(this,void 0,void 0,function(){var t,r;return sK(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"]=aT(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}(),aL="undefined"!=typeof globalThis?globalThis:e.g||self,aU=function(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:e.g},aq=function(){var e=aU();if(e)try{var t="EXP_test";return e.localStorage.setItem(t,t),e.localStorage.removeItem(t),!0}catch(e){}return!1},aF=function(){function e(e,t){this.poller=void 0,this.action=e,this.ms=t}return e.prototype.start=function(){this.poller||(this.poller=aL.setInterval(this.action,this.ms),this.action())},e.prototype.stop=function(){this.poller&&(aL.clearInterval(this.poller),this.poller=void 0)},e}(),aV=e.i(484404);function aB(e){this.amplitudeInstance=e}function aK(e){this.amplitudeInstance=e}aB.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()}},aB.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(" ")},aB.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},aK.prototype.track=function(e){this.amplitudeInstance.logEvent(e.name,e.properties)},aK.prototype.setUserProperty=function(e){var t,r;this.amplitudeInstance.setUserProperties(((t={})[e.userProperty]=null==(r=e.variant)?void 0:r.value,t))},aK.prototype.unsetUserProperty=function(e){var t;this.amplitudeInstance._logEvent("$identify",null,null,{$unset:((t={})[e.userProperty]="-",t)})};var az=function(){return(az=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 aW(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 aH(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 a$(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);
1if(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 aG(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 aJ(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 aQ=function(e,t){void 0===t&&(t=!1);var r,n,i=aY(e,t),o=void 0,s=aL.document.cookie.split("; ");try{for(var a=a$(s),u=a.next();!u.done;u=a.next()){var l=u.value,c=aG(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}},aX=function(e){var t=aY(e,!0);try{var r=aL.localStorage.getItem(t);if(!r)return;var n=JSON.parse(r);if("object"!=typeof n)return;return n}catch(e){return}},aZ=function(e){var t=aY(e,!0);try{var r=aL.sessionStorage.getItem(t);if(!r)return;var n=JSON.parse(r);if("object"!=typeof n)return;return n}catch(e){return}},aY=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))},a0=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 aW(this,void 0,void 0,function(){return aH(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=aQ(this.apiKey,!0);return!!(e||(e=aQ(this.apiKey,!1))||(e=aX(this.apiKey))||(e=aZ(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 aW(this,void 0,void 0,function(){var t,r=this;return aH(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){aL.setTimeout(r,e,"Timed out waiting for Amplitude Analytics SDK to initialize.")})])]})})},e}(),a1=aL.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)})},a2=function(){function e(e){this.client=e}return e.prototype.request=function(e){return aW(this,void 0,void 0,function(){return aH(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}(),a3={request:function(e,t,r,n,i){var o;return o=aW(void 0,void 0,void 0,function(){var i,o;return aH(this,function(s){switch(s.label){case 0:return[4,a1(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){aL.setTimeout(function(){t(new aD("Request timeout after "+i+" milliseconds"))},i),o.then(e,t)})}};(A=ec||(ec={}))[A.Disable=0]="Disable",A[A.Error=1]="Error",A[A.Warn=2]="Warn",A[A.Info=3]="Info",A[A.Debug=4]="Debug",A[A.Verbose=5]="Verbose",(O=ed||(ed={})).LocalStorage="localStorage",O.InitialVariants="initialVariants",(R=ef||(ef={})).LocalStorage="storage",R.InitialVariants="initial",R.SecondaryLocalStorage="secondary-storage",R.SecondaryInitialVariants="secondary-initial",R.FallbackInline="fallback-inline",R.FallbackConfig="fallback-config",R.LocalEvaluation="local-evaluation";var a4=function(e){return!e||e===ef.FallbackInline||e===ef.FallbackConfig||e===ef.SecondaryInitialVariants},a5={debug:!1,logLevel:ec.Error,loggerProvider:null,instanceName:"$default_instance",fallbackVariant:{},initialVariants:{},initialFlags:void 0,source:ed.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:a3},a6="1.20.1",a8=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:a5.instanceName;this.queue=new a9(i),this.cache=new a7(i)}return e.prototype.ready=function(){return this.integration?this.isReady:Prom
1ise.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){if(this.cache.shouldTrack(e)){var t=this.getExposureEvent(e);this.queue.push(t)}},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}(),a7=function(){function e(e){this.isSessionStorageAvailable=ue(),this.inMemoryCache={},this.storageKey="EXP_sent_v2_".concat(e),this.isSessionStorageAvailable&&aL.sessionStorage.removeItem("EXP_sent_".concat(e))}return e.prototype.shouldTrack=function(e){if((null==(t=e.metadata)?void 0:t.deliveryMethod)==="web")return!0;this.loadCache();var t,r=this.inMemoryCache[e.flag_key],n=!1;return r&&r.variant===e.variant||(n=!0,this.inMemoryCache[e.flag_key]=e),this.storeCache(),n},e.prototype.loadCache=function(){if(this.isSessionStorageAvailable){var e=aL.sessionStorage.getItem(this.storageKey);this.inMemoryCache=e?JSON.parse(e):{}}},e.prototype.storeCache=function(){this.isSessionStorageAvailable&&aL.sessionStorage.setItem(this.storageKey,JSON.stringify(this.inMemoryCache))},e}(),a9=function(){function e(e,t){void 0===t&&(t=512),this.isLocalStorageAvailable=aq(),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=aL.setInterval(function(){t.loadFlushStore()},1e3),this.loadFlushStore()},e.prototype.flush=function(){var e,t;if(this.tracker&&0!==this.inMemoryQueue.length){try{for(var r=a$(this.inMemoryQueue),n=r.next();!n.done;n=r.next()){var i=n.value;try{if(!this.tracker(i))return}catch(e){return}}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}this.inMemoryQueue=[],this.poller&&(aL.clearInterval(this.poller),this.poller=void 0)}},e.prototype.loadQueue=function(){if(this.isLocalStorageAvailable){var e=aL.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)),aL.localStorage.setItem(this.storageKey,JSON.stringify(this.inMemoryQueue)))},e.prototype.loadFlushStore=function(){this.loadQueue(),this.flush(),this.storeQueue()},e}(),ue=function(){var e=aU();if(e)try{var t="EXP_test";return e.sessionStorage.setItem(t,t),e.sessionStorage.removeItem(t),!0}catch(e){}return!1},ut=function(){function e(e,t){void 0===t&&(t=ec.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>=ec.Error&&(t=this.logger).error.apply(t,aJ([e],aG(r),!1))},e.prototype.warn=function(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];this.logLevel>=ec.Warn&&(t=this.logger).warn.apply(t,aJ([e],aG(r),!1))},e.prototype.info=function(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];this.logLevel>=ec.Info&&(t=this.logger).info.apply(t,aJ([e],aG(r),!1))},e.prototype.debug=function(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];this.logLevel>=ec.Debug&&(t=this.logger).debug.apply(t,aJ([e],aG(r),!1))},e.prototype.verbose=function(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];this.logLevel>=ec.Verbose&&(t=this.logger).verbose.apply(t,aJ([e],aG(r),!1))},e}
1(),ur=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,aJ([e],aG(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,aJ([e],aG(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,aJ([e],aG(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,aJ([e],aG(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,aJ([e],aG(t),!1))},e}(),un=function(){function e(){this.globalScope=aU()}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}(),ui=function(e,t,r){var n=e.substring(e.length-6);return new uu("amp-exp-".concat(t,"-").concat(n),r,ul)},uo=function(e,t,r){void 0===r&&(r=new un);var n=e.substring(e.length-6);return new uu("amp-exp-".concat(t,"-").concat(n,"-flags"),r)},us=function(e,t,r){void 0===r&&(r=new un);var n=e.substring(e.length-6);return new ua("amp-exp-".concat(t,"-").concat(n,"-variants-options"),r)},ua=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}(),uu=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 az({},this.cache)},e.prototype.put=function(e,t){this.cache[e]=t},e.prototype.putAll=function(e){var t,r;try{for(var n=a$(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=a$(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}(),ul=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}},uc=function(){function e(){this.globalScope=aU()}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}(),ud=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)}},uf=function(e){return null==e},uh=function(e){return!!uf(e)||e&&0===Object.keys(e).length},up=function(e){if(!e||"object"!=typeof e)return{};var t,r,n={};try{for(var i=a$(Object.entries(e)),o=i.next();!o.done;o=i.next()){var s=aG(o.value,2),a=s[0],u=s[1];uf(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},ug=function(e){var t;return(null==(t=null==e?void 0:e.metadata)?void 0:t.evaluationMode)==="local"},uv=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 aW(this,void 0,void 0,function(){return aH(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 aW(this,void 0,void 0,function(){var n=this;return aH(this,function(i){return this.done||(this.timeoutHandle=aL.setTimeout(function(){return aW(n,void 0,void 0,function(){var n,i;return aH(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)
1),[3,3];case 3:return[2]}})})},r)),[2]})})},e}(),um=function(e){if(!e)return{};var t,r,n,i,o={user:e},s=aU();s&&(o.page={url:s.location.href});var a={};if(!e.groups)return o;try{for(var u=a$(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},uy=function(e){return null==e?{}:"string"==typeof e?{key:e,value:e}:e},ub=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},u_=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}(),uw=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}(),uS=function(){function e(t,r){var n,i,o,s,a,u=this;this.engine=new ac,this.isRunning=!1,this.apiKey=t,r=up(r),this.config=az(az(az({},a5),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":a5.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":a5.flagsServerUrl),flagConfigPollingIntervalMillis:r.flagConfigPollingIntervalMillis<6e4?6e4:null!=(o=r.flagConfigPollingIntervalMillis)?o:a5.flagConfigPollingIntervalMillis}),this.logger=new ut(this.config.loggerProvider||new ur,e.getLogLevel(r));var l=null==(s=this.config)?void 0:s.internalInstanceNameSuffix;if(this.isWebExperiment="web"===l,this.poller=new aF(function(){return u.doFlags()},this.config.flagConfigPollingIntervalMillis),this.config.initialVariants)for(var c in this.config.initialVariants)this.config.initialVariants[c]=ul(this.config.initialVariants[c]);this.config.userProvider&&(this.userProvider=this.config.userProvider),this.config.analyticsProvider&&(this.analyticsProvider=new u_(this.config.analyticsProvider)),this.config.exposureTrackingProvider&&(this.userSessionExposureTracker=new uw(this.config.exposureTrackingProvider)),this.integrationManager=new a8(this.config,this);var d=new a2(this.config.httpClient||a3);this.flagApi=new aj(this.apiKey,this.config.flagsServerUrl,d),this.evaluationApi=new aM(this.apiKey,this.config.serverUrl,d);var f=l?"".concat(this.config.instanceName,"-").concat(l):this.config.instanceName;a=this.isWebExperiment?new uc:new un,this.variants=ui(this.apiKey,f,a),this.flags=uo(this.apiKey,f,a),this.fetchVariantsOptions=us(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 aW(this,void 0,void 0,function(){var t,r,n;return aH(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 aW(this,arguments,void 0,function(e,t){var r;return void 0===e&&(e=this.user),aH(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 aD?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||{}}
1,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)ug(this.flags.get(t))||delete e[t];return az(az(az({},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 az({},this.user);var e,t=az({},this.user.user_properties);return az(az({},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=az({},e.user_properties);this.user=az(az({},e),{user_properties:r})}else this.user=az({},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=ad(this.flags.getAll(),e),o=um(n),s=this.engine.evaluate(o,i),a={};try{for(var u=a$(Object.keys(s)),l=u.next();!l.done;l=u.next()){var c=l.value;a[c]=ub(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.variantAndSource=function(e,t){var r={};this.config.source===ed.LocalStorage?r=this.localStorageVariantAndSource(e,t):this.config.source===ed.InitialVariants&&(r=this.initialVariantsVariantAndSource(e,t));var n=this.flags.get(e);return(ug(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=ef.LocalEvaluation,a=null==(n=null==o?void 0:o.metadata)?void 0:n.default;if(!uf(o)&&!a)return{variant:uy(o),source:s,hasDefaultVariant:!1};if(a&&(i={variant:uy(o),source:s,hasDefaultVariant:!0}),!uf(r))return{variant:uy(r),source:ef.FallbackInline,hasDefaultVariant:i.hasDefaultVariant};var u=this.config.initialVariants[e];if(!uf(u))return{variant:uy(u),source:ef.SecondaryInitialVariants,hasDefaultVariant:i.hasDefaultVariant};var l=uy(this.config.fallbackVariant),c={variant:l,source:ef.FallbackConfig,hasDefaultVariant:i.hasDefaultVariant};return uh(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(!uf(i)&&!o)return{variant:uy(i),source:ef.LocalStorage,hasDefaultVariant:!1};if(o&&(n={variant:uy(i),source:ef.LocalStorage,hasDefaultVariant:!0}),!uf(t))return{variant:uy(t),source:ef.FallbackInline,hasDefaultVariant:n.hasDefaultVariant};var s=this.config.initialVariants[e];if(!uf(s))return{variant:uy(s),source:ef.SecondaryInitialVariants,hasDefaultVariant:n.hasDefaultVariant};var a=uy(this.config.fallbackVariant),u={variant:a,source:ef.FallbackConfig,hasDefaultVariant:n.hasDefaultVariant};return uh(a)?n:u},e.prototype.initialVariantsVariantAndSource=function(e,t){var r,n={},i=this.config.initialVariants[e];if(!uf(i))return{variant:uy(i),source:ef.InitialVariants,hasDefaultVariant:!1};var o=this.variants.get(e),s=null==(r=null==o?void 0:o.metadata)?void 0:r.default;if(!uf(o)&&!s)return{variant:uy(o),source:ef.LocalStorage,hasDefaultVariant:!1};if(s&&(n={variant:uy(o),source:ef.LocalStorage,hasDefaultVariant:!0}),!uf(t))return{variant:uy(t),source:ef.FallbackInline,hasDefaultVariant:n.hasDefaultVariant};var a=uy(this.config.fallbackVariant),u={variant:a,source:ef.FallbackConfig,hasDefaultVariant:n.hasDefaultVariant};return uh(a)?n:u},e.prototype.fetchInternal=function(e,t,r,n){return aW(this,void 0,void 0,function(){var i,o,s;return aH(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,az({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 aW(this,void 0,void 0,function(){return aH(this,function(t){return this.fetchVariantsOptions.put(az(az({},this.fetchVariantsOptions.get()||{}),{trackingOption:e?"track":"no-track"}
1)),this.fetchVariantsOptions.store(),[2]})})},e.prototype.cleanUserPropsForFetch=function(e){var t=az({},e);return delete t.cookie,t},e.prototype.doFetch=function(e,t,r){return aW(this,void 0,void 0,function(){var n,i,o,s,a,u,l;return aH(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,az({timeoutMillis:t},r))];case 2:n=c.sent(),i={};try{for(s=(o=a$(Object.keys(n))).next();!s.done;s=o.next())i[a=s.value]=ub(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 aW(this,void 0,void 0,function(){var e,t,r;return aH(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:a6,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 aD){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 aW(this,void 0,void 0,function(){var r,n,i,o;return aH(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 aW(this,void 0,void 0,function(){var r=this;return aH(this,function(n){return this.logger.debug("[Experiment] Retry fetch"),this.retriesBackoff=new uv(8,500,1e4,1.5),this.retriesBackoff.start(function(){return aW(r,void 0,void 0,function(){return aH(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=az(az(az({},null==r?void 0:r.user_properties),n.user_properties),null==e?void 0:e.user_properties);return az(az(az(az({library:"experiment-js-client/".concat(a6)},r),n),e),{user_properties:i})},e.prototype.addContextOrWait=function(e){return aW(this,void 0,void 0,function(){return aH(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==ed.LocalStorage?this.variants.getAll():this.config.source==ed.InitialVariants?this.config.initialVariants:void 0},e.prototype.secondaryVariants=function(){return this.config.source==ed.LocalStorage?this.config.initialVariants:this.config.source==ed.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=a4(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=aU();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)}}},e.prototype.legacyExposureInternal=function(e,t,r){var n,i,o,s,a;if(this.analyticsProvider){var u=ud(this.addContext(this.getUser()),e,t,r);!a4(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?ec.Debug:null!=(t=e.logLevel)?t:ec.Error},e.prototype.shouldRetryFetch=function(e){return!(e instanceof aN)||e.statusCode<400||e.statusCode>=500||429===e.statusCode}
1,e.prototype.addPlugin=function(e){"integration"===e.type&&this.integrationManager.setIntegration(e)},e}(),uE=function(){function e(e,t){var r,n,i;this.globalScope=aU(),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 aV.UAParser(this.userAgent).getResult(),this.localStorage=new un,this.sessionStorage=new uc,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 az({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"undefined"!=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=a$(i.searchParams),s=o.next();!s.done;s=o.next()){var a=aG(s.value,2),u=a[0],l=a[1];n[u]=aJ(aJ([],aG(null!=(r=n[u])?r:[]),!1),aG(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=aG(t,2),n=r[0],i=r[1];return e[n]=1==i.length?i[0]:i,e},{})}},e}();aL.experimentInstances={};var uk=aL.experimentInstances,ux=function(e){return(null==e?void 0:e.instanceName)||a5.instanceName},uI=function(e,t){var r=ux(t),n=null==t?void 0:t.internalInstanceNameSuffix;return n?"".concat(r,".").concat(e,".").concat(n):"".concat(r,".").concat(e)},uT=function(e,t,r){var n=uI(e,t),i=uk[n];return i?i:(i=new uS(e,az(az({},t),{userProvider:new uE(null==t?void 0:t.userProvider,e)})),r&&i.addPlugin(r()),uk[n]=i,i)};function uP(){}uP.prototype.getUser=function(){return{}},uP.prototype.start=function(e){return aW(this,void 0,void 0,function(){return aH(this,function(e){return[2]})})},uP.prototype.stop=function(){},uP.prototype.setUser=function(e){},uP.prototype.fetch=function(e,t){return aW(this,void 0,void 0,function(){return aH(this,function(e){return[2,this]})})},uP.prototype.getUserProvider=function(){return null},uP.prototype.setUserProvider=function(e){return this},uP.prototype.variant=function(e,t){return a5.fallbackVariant},uP.prototype.all=function(){return{}},uP.prototype.clear=function(){}
1,uP.prototype.exposure=function(e){};var uC=function(){function e(t){this.name=e.pluginName,this.config=t}return e.prototype.setup=function(e,t){return(0,eh.__awaiter)(this,void 0,void 0,function(){return(0,eh.__generator)(this,function(t){var r,n;return this.experiment=uT(r=e.apiKey,n=this.config,function(){return new a0(r,ts.getInstance(ux(n)),1e4)}),[2]})})},e.pluginName="@amplitude/experiment-analytics-plugin",e}(),uA=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:uO(),platform:"Web",os:void 0,deviceModel:void 0}},e}(),uO=function(){return"u">typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},uR=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}(),uN=function(){return(uN=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 uD(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 uM(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}var uj=function(e,t){var r,n,i=typeof e;if(i!==typeof t)return!1;try{for(var o=uD(["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(!uj(e[l],t[l]))return!1}else{if(!uj(Object.keys(e).sort(),Object.keys(t).sort()))return!1;var c=!0;return Object.keys(e).forEach(function(r){uj(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 uL=function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var e=this,t=uN({},this.identity.userProperties),r=uN(uN({},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=uD(Object.entries(e)),c=l.next();!c.done;c=l.next()){var d=uM(c.value,2),f=d[0],h=d[1];switch(f){case"$set":try{for(var p=(i=void 0,uD(Object.entries(h))),g=p.next();!g.done;g=p.next()){var v=uM(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,uD(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 uN({},this.identity)},e.prototype.setIdentity=function(e){var t=uN({},this.identity);this.identity=uN({},e),uj(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}(),uU="u">typeof globalThis?globalThis:"u">typeof window?window:self,uq=function(){function e(){this.identityStore=new uL,this.eventBridge=new uR,this.applicationContextProvider=new uA}return e.getInstance=function(t){return uU.analyticsConnectorInstances||(uU.analyticsConnectorInstances={}),uU.analyticsConnectorInstances[t]||(uU.analyticsConnectorInstances[t]=new e),uU.analyticsConnectorInstances[t]},e}(),uF=["boot"],uV=((n=uV||{}).Local="https://local.amplitude.com:3010/",n.Staging="https://apps.stag2.amplitude.com/",n.Production="https://app.amplitude.com/",n.ProductionEU="https://app.eu.amplitude.com/",n),uB=((e=>{if("u">typeof window&&window.opener)for(let t of Object.values(uV))window.opener.postMessage({message:e},t)})("ENGAGEMENT_SNIPPET"),N=(e,t,r,n)=>(function(e,t,r,n){for(let i of e){let e=document.createElement("script");e.src=i,e.id="engagement-sdk-bundle",r&&e.setAttribute("nonce",r),t&&e.setAttribute("type",t),n&&(e.onerror=n),document.getElementsByTagName("head")[0].appendChild(e)}})([e||"https://cdn.amplitude.com/engagement-browser/prod/index.min.js.gz"],t,r,n),new Proxy(o={_q:null!=(D=null==(i="u">typeof window?window.engagement:void 0)?void 0:i._q)?D:[],_configuration:{apiKey:null!=(j=null==(M=null==i?void 0:i._configuration)?void 0:M.apiKey)?j:"",serverUrl:null==(L=null==i?void 0:i._configuration)?void 0:L.serverUrl,chatUrl:null==(U=null==i?void 0:i._configuration)?void 0:U.chatUrl,mediaUrl:null==(q=null==i?void 0:i._configuration)?void 0:q.mediaUrl,serverZone:null!=(V=null==(F=null==i?void 0:i._configuration)?void 0:F.serverZone)?V:"US",options:{...null==(B=null==i?void 0:i._configuration)?void 0:B.options}},_sentry:void 0,init(e,t){var r,n,i;let s;if(o._configuration.apiKey)return void console.log("Engagement SDK has already been initialized. Ignoring additional init call.");if(o._configuration={...o._configuration,...t,apiKey:e,options:{splitting:!0,...o._configuration.options,...null==t?void 0:t.options}},null!=(n=null==(r=o._configuration)?void 0:r.options)&&n.logger&&o._configuration.options.logger.enable(null!=(i=o._configuration.options.logLevel)?i:2),null!=t&&t.cdnUrl)s=o._configuration.options.splitting?`${t.cdnUrl}/engagement-browser/prod/split/index.js`:t.cdnUrl+"/engagement-browser/prod/index.min.js.gz";else{let e="EU"===o._configuration.serverZone?"https://cdn.eu.amplitude.com":"https://cdn.amplitude.com";s=o._configuration.options.splitting?`${e}/engagement-browser/prod/split/index.js`:`${e}/engagement-browser/prod/index.min.js.gz`}let a=null,u=()=>
1{if(a&&(clearTimeout(a),a=null),o._q&&o._q.length>0)for(console.warn(`Engagement SDK failed to load within ${l}ms. Resolving pending calls gracefully.`);o._q.length>0;){let e=o._q.shift();if(!e)continue;let t=e[0],r=uF.includes(t);if(console.warn(`Engagement SDK method '${t}' still in queue (isAsyncMethod=${r}); attempting to resolve as no-op.`),r&&e[1]instanceof Function&&e[2]instanceof Function){let r=e[1];console.warn(`Engagement SDK method '${t}' resolved as no-op due to script loading failure`),r(void 0)}}};N(s,o._configuration.options.splitting?"module":void 0,null==t?void 0:t.nonce,u);let l=1e4;a=setTimeout(()=>{u()},1e4)},plugin(e){let t=o.init;return{name:"@amplitude/engagement-browser",type:"enrichment",async setup(r,n){var i;let o=null!=(i=r.instanceName)?i:"$default_instance",s=uq.getInstance(o).identityStore;t(r.apiKey,{serverZone:r.serverZone,...e,options:{logLevel:r.logLevel,logger:r.loggerProvider,...null==e?void 0:e.options}});let a=[{track:e=>{n.track(e)}}];await window.engagement.boot({user:()=>{let e=s.getIdentity();return{user_id:n.getUserId(),device_id:n.getDeviceId(),user_properties:e.userProperties,getSessionId:n.getSessionId}},integrations:a}),s.addIdentityListener(e=>{var t,r,i,o;null!=(t=window.engagement)&&t._.user&&null!=(r=window.engagement)&&r._analytics.hasBooted?(null==(o=null==(i=window.engagement)?void 0:i._.user)?void 0:o.user_id)!==e.userId?(window.engagement.shutdown(),window.engagement.boot({user:()=>{let e=s.getIdentity();return{user_id:n.getUserId(),device_id:n.getDeviceId(),user_properties:e.userProperties,getSessionId:n.getSessionId}},integrations:a})):window.engagement._setUserProperties(e.userProperties):console.warn("Engagement SDK not booted. Ignoring identity change.")})},execute:async e=>(window.engagement.forwardEvent(e),e)}}},{get:function(e,t){return t in o?o[t]:"then"!==t?"gs"===t||"rc"===t?new Proxy({},{get:function(e,r){return function(){let e=Array.from(arguments),n=`${t}.${r}`;e.unshift(n),o._q.push(e)}}}):uF.includes(t)?function(){let e=Array.prototype.slice.call(arguments);return new Promise((r,n)=>{e.unshift(t,r,n),o._q.push(e)})}:function(){let e=Array.prototype.slice.call(arguments);e.unshift(t),o._q.push(e)}:void 0}}));let uK={_setDiagnosticsSampleRate:e3((K=new(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,eh.__extends)(t,e),t.prototype.sessionReplay=function(){return this._sessionReplay},t.prototype.experiment=function(){if(void 0!==this.config){var e=this.plugins(uC);return 0===e.length?void this.config.loggerProvider.debug("".concat(uC.pluginName," plugin is not found.")):1===e.length?e[0].experiment:void this.config.loggerProvider.debug("Multiple instances of ".concat(uC.pluginName," are found."))}},t.prototype.initAll=function(t,r){return(0,eh.__awaiter)(this,void 0,void 0,function(){var n,i;return(0,eh.__generator)(this,function(o){switch(o.label){case 0:return n={serverZone:null==r?void 0:r.serverZone,instanceName:null==r?void 0:r.instanceName},e.prototype.add.call(this,{type:"enrichment",name:"@amplitude/unified-library-plugin",execute:function(e){var t;return(0,eh.__awaiter)(this,void 0,void 0,function(){return(0,eh.__generator)(this,function(r){return e.library="".concat("amplitude-ts-unified","/").concat("1.0.0-beta.9","-").concat(null!=(t=e.library)?t:""),[2,e]})})}}),[4,e.prototype.init.call(this,t,(0,eh.__assign)((0,eh.__assign)({},null==r?void 0:r.analytics),n)).promise];case 1:return o.sent(),[4,e.prototype.add.call(this,new sL((0,eh.__assign)((0,eh.__assign)({},null==r?void 0:r.sessionReplay),n))).promise];case 2:return o.sent(),[4,e.prototype.add.call(this,new uC((0,eh.__assign)((0,eh.__assign)({},null==r?void 0:r.experiment),n))).promise];case 3:let s;return o.sent(),void 0===(i=this.plugin(sL.pluginName))?this.config.loggerProvider.debug("".concat(sL.pluginName," plugin is not found.")):this._sessionReplay=i.sessionReplay,[4,e.prototype.add.call(this,(s=(0,eh.__assign)((0,eh.__assign)({},null==r?void 0:r.engagement),n),"u">typeof window&&!window.engagement&&(window.engagement=uB),uB.plugin(s))).promise];case 4:return o.sent(),[2]}})})},t.prototype.init=function(t,r,n){return void 0===t&&(t=""),e.prototype.init.call(this,t,r,n)},t}(iG)))._setDiagnosticsSampleRate.bind(K),"_setDiagnosticsSampleRate",e0(K),e2(K,["config"])),experiment:e3(K.experiment.bind(K),"experiment",e0(K),e2(K,["config"])),sessionReplay:e3(K.sessionReplay.bind(K),"sessionReplay",e0(K),e2(K,["config"])),initAll:e3(K.initAll.bind(K),"initAll",e
10(K),e2(K,["config"])),init:e3(K.init.bind(K),"init",e0(K),e2(K,["config"])),add:e3(K.add.bind(K),"add",e0(K),e2(K,["config.apiKey","timeline.plugins"])),remove:e3(K.remove.bind(K),"remove",e0(K),e2(K,["config.apiKey","timeline.plugins"])),track:e3(K.track.bind(K),"track",e0(K),e2(K,["config.apiKey","timeline.queue.length"])),logEvent:e3(K.logEvent.bind(K),"logEvent",e0(K),e2(K,["config.apiKey","timeline.queue.length"])),identify:e3(K.identify.bind(K),"identify",e0(K),e2(K,["config.apiKey","timeline.queue.length"])),groupIdentify:e3(K.groupIdentify.bind(K),"groupIdentify",e0(K),e2(K,["config.apiKey","timeline.queue.length"])),setGroup:e3(K.setGroup.bind(K),"setGroup",e0(K),e2(K,["config.apiKey","timeline.queue.length"])),revenue:e3(K.revenue.bind(K),"revenue",e0(K),e2(K,["config.apiKey","timeline.queue.length"])),flush:e3(K.flush.bind(K),"flush",e0(K),e2(K,["config.apiKey","timeline.queue.length"])),getUserId:e3(K.getUserId.bind(K),"getUserId",e0(K),e2(K,["config","config.userId"])),setUserId:e3(K.setUserId.bind(K),"setUserId",e0(K),e2(K,["config","config.userId"])),getDeviceId:e3(K.getDeviceId.bind(K),"getDeviceId",e0(K),e2(K,["config","config.deviceId"])),setDeviceId:e3(K.setDeviceId.bind(K),"setDeviceId",e0(K),e2(K,["config","config.deviceId"])),reset:e3(K.reset.bind(K),"reset",e0(K),e2(K,["config","config.userId","config.deviceId"])),getSessionId:e3(K.getSessionId.bind(K),"getSessionId",e0(K),e2(K,["config"])),setSessionId:e3(K.setSessionId.bind(K),"setSessionId",e0(K),e2(K,["config"])),extendSession:e3(K.extendSession.bind(K),"extendSession",e0(K),e2(K,["config"])),setOptOut:e3(K.setOptOut.bind(K),"setOptOut",e0(K),e2(K,["config"])),getOptOut:e3(K.getOptOut.bind(K),"getOptOut",e0(K),e2(K,["config"])),setTransport:e3(K.setTransport.bind(K),"setTransport",e0(K),e2(K,["config"])),getIdentity:e3(K.getIdentity.bind(K),"getIdentity",e0(K),e2(K,["config"]))};uK._setDiagnosticsSampleRate;var uz=uK.initAll,uW=(uK.experiment,uK.sessionReplay,uK.add,uK.extendSession,uK.flush,uK.getDeviceId,uK.getSessionId,uK.getUserId,uK.groupIdentify,uK.identify),uH=(uK.logEvent,uK.remove,uK.reset,uK.revenue,uK.setDeviceId,uK.setGroup,uK.setOptOut,uK.setSessionId,uK.setTransport,uK.setUserId),u$=uK.track;e.s(["identify",()=>uW,"initAll",()=>uz,"setUserId",()=>uH,"track",()=>u$],29306)},335465,758583,e=>{"use strict";e.i(640211);var t=e.i(371631),r=e.i(550881),n=e.i(101638),i=e.i(650995),o=e.i(29306),s=e.i(776639),a=e.i(975157);let u=r.forwardRef(({className:e,...r},n)=>(0,t.jsx)("span",{ref:n,className:(0,a.cn)("absolute h-px w-px overflow-hidden whitespace-nowrap border-0 p-0 [clip:rect(0,0,0,0)]",e),...r}));u.displayName="VisuallyHidden",e.s(["VisuallyHidden",0,u],758583);var l=e.i(519455),c=e.i(779342),d=e.i(338144),f=e.i(824720);function h({isOpen:e,onClose:a,onSuccess:h}){let p=(0,i.useTranslations)("AuthModal"),[g,v]=(0,r.useState)(!1),[m,y]=(0,r.useState)("email"),[b,_]=(0,r.useState)(""),[w,S]=(0,r.useState)(""),[E,k]=(0,r.useState)(""),[x,I]=(0,r.useState)(null),[T,P]=(0,r.useState)(null),[C,A]=(0,r.useState)("login"),[O,R]=(0,r.useState)(!1),[N,D]=(0,r.useState)(0),M=(0,r.useRef)(null),j=(0,r.useRef)(null),L=(0,r.useRef)(null),U=(0,r.useRef)(null),q=(0,r.useRef)(void 0),F=(0,r.useRef)(e),V=(0,r.useRef)(void 0);F.current=e;let B=(0,r.useCallback)(()=>{y("email"),_(""),S(""),k(""),I(null),P(null),A("login"),R(!1),D(0),q.current&&clearInterval(q.current)},[]);(0,r.useEffect)(()=>(e&&(B(),o.track("Auth Modal Opened"),window.google&&setTimeout(H,100)),()=>{q.current&&clearInterval(q.current)}),[e,B]),(0,r.useEffect)(()=>{y("email"),I(null),P(null),S("")},[C]),(0,r.useEffect)(()=>{"code"===m?setTimeout(()=>j.current?.focus(),100):"email"===m&&"register"===C?setTimeout(()=>U.current?.focus(),100):"email"===m&&setTimeout(()=>L.current?.focus(),100)},[m,C]),(0,r.useEffect)(()=>{if("email"===m&&e&&window.google){R(!1);let e=setTimeout(()=>{H()},100);return()=>clearTimeout(e)}},[m]);let K=["email_required","user_exists","user_not_found","send_failed","email_code_required","invalid_code","name_required","no_user_no_name","verify_failed"],z=(e,t)=>e&&K.includes(e)?{message:p(`apiErrors.${e}`),code:e}:{message:t||p("errors.generic"),code:e??null},W=()=>{if("undefined"==typeof document)return;let e=document.cookie.match(/invite_redirect=([^;
1]+)/);if(e){let t=decodeURIComponent(e[1].trim());if(document.cookie="invite_redirect=; path=/; max-age=0",t&&t.startsWith("/"))return window.location.href=t,!0}return!1};V.current=async e=>{v(!0);try{let t=await fetch("/api/auth/google/one-tap",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({credential:e.credential})}),r=await t.json();if(!t.ok){let{message:e}=z(r.code,r.error);c.toast.error(e);return}if(r.isNewUser?(c.toast.success(p("toasts.accountCreated")),o.track("Registration Completed",{method:"google"})):c.toast.success(p("toasts.loggedIn")),h(r.user),a(),W())return;if(r.needsOnboarding){window.location.href="/onboarding";return}}catch(e){console.error("Google Auth Error:",e),c.toast.error(p("errors.generic"))}finally{v(!1)}};let H=()=>{if(window.google)try{window.google.accounts.id.initialize({client_id:"248660698704-7v1d7pskaa3nds439ekl7v1hbq0imjmg.apps.googleusercontent.com",callback:e=>V.current?.(e),auto_select:!1,cancel_on_tap_outside:!1,context:"signin",ux_mode:"popup"}),M.current&&(window.google.accounts.id.renderButton(M.current,{theme:"outline",size:"large",width:M.current.offsetWidth,text:"continue_with",logo_alignment:"left"}),R(!0))}catch(e){console.error("Error initializing Google Sign-In:",e)}},$=async()=>{v(!0),I(null),P(null),o.track("Auth Attempted",{type:C,step:"send_code"});try{let e=await fetch("/api/auth/send-code",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:b,type:C})}),t=await e.json();if(!e.ok){let{message:e,code:r}=z(t.code,t.error);I(e),P(r),c.toast.error(e);return}y("code"),D(30),q.current&&clearInterval(q.current),q.current=setInterval(()=>{D(e=>e<=1?(clearInterval(q.current),0):e-1)},1e3),c.toast.success(p("toasts.codeSent"))}catch(t){let e=t?.message||p("errors.generic");I(e),c.toast.error(e)}finally{v(!1)}},G=async e=>{e.preventDefault(),await $()},J=async()=>{N>0||g||await $()},Q=async e=>{v(!0),I(null),P(null),o.track("Auth Attempted",{type:C,step:"verify_code"});try{let t=await fetch("/api/auth/verify-code",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:b,code:e,name:E,type:C})}),r=await t.json();if(!t.ok){let{message:e,code:t}=z(r.code,r.error);I(e),P(t),c.toast.error(e);return}if("register"===C?(c.toast.success(p("toasts.accountCreated")),o.track("Registration Completed",{method:"email"})):c.toast.success(p("toasts.loggedIn")),h(r.user),a(),W())return;if(r.needsOnboarding){window.location.href="/onboarding";return}}catch(t){let e=t?.message||p("errors.generic");I(e),c.toast.error(e)}finally{v(!1)}},X=async e=>{e.preventDefault(),await Q(w)},Z=e=>{A(e),I(null),P(null)},Y="w-full h-12 px-4 bg-white border border-[#226240]/15 rounded-xl text-[#226240] placeholder:text-[#226240]/30 focus:outline-none focus:ring-2 focus:ring-[#226240]/20 focus:border-[#226240]/30 transition-all text-sm";return(0,t.jsxs)(s.Dialog,{open:e,onOpenChange:a,children:[(0,t.jsx)(n.default,{src:"https://accounts.google.com/gsi/client",strategy:"lazyOnload",onLoad:()=>{F.current&&H()}}),(0,t.jsxs)(s.DialogContent,{className:"sm:max-w-[420px] overflow-hidden p-0 border border-[#226240]/10 shadow-2xl shadow-[#226240]/10 bg-[#F2F0E9] rounded-3xl",showCloseButton:!1,children:[(0,t.jsx)(u,{children:(0,t.jsx)(s.DialogTitle,{children:p("dialogTitle")})}),(0,t.jsxs)("div",{className:"flex flex-col p-7 sm:p-8",children:[(0,t.jsxs)("div",{className:"text-center mb-6",children:[(0,t.jsx)("div",{className:"flex justify-center mb-4",children:(0,t.jsxs)("svg",{viewBox:"0 0 565 70",className:"h-5 w-auto","aria-label":p("bobrAriaLabel"),children:[(0,t.jsx)("path",{d:"M27.7871 9.2627H134.304V69.4668H0V0H27.7871V9.2627ZM27.7871 30.1025V48.627H106.517V30.1025H27.7871Z",fill:"#FC522E"}),(0,t.jsx)("path",{d:"M277.869 69.4673H143.566V9.26221H277.869V69.4673ZM171.353 30.1021V48.6274H250.082V30.1021H171.353Z",fill:"#2F4173"}),(0,t.jsx)("path",{d:"M314.918 9.2627H421.435V69.4668H287.131V0H314.918V9.2627ZM314.918 30.1025V48.627H393.648V30.1025H314.918Z",fill:"#FF9FAC"}),(0,t.jsx)("path",{d:"M458.484 69.4673V30.1021H565V9.26221H430.697V69.4673H458.484Z",fill:"#226240"}),(0,t.jsx)("rect",{x:"521.004",y:"48.6271",width:"43.9959",height:"20.8402",fill:"#226240"})]})}),(0,t.jsx)("h2",{className:"text-xl font-bold tracking-tight text-[#226240]",children:"code"===m?p("headings.checkEmail"):"login"===C?p("headings.welcomeBack"):p("headings.createAccount")}
1),(0,t.jsx)("p",{className:"text-sm text-[#226240]/50 mt-1.5 font-medium",children:"code"===m?p("subheadings.codeSent",{email:b}):"login"===C?p("subheadings.loginEmail"):p("subheadings.registerCredits")})]}),"email"===m&&(0,t.jsxs)("div",{className:"flex flex-col gap-5",children:[(0,t.jsx)("div",{className:`w-full flex justify-center transition-all duration-200 ${O?"h-[44px]":"h-0 overflow-hidden"}`,children:(0,t.jsx)("div",{ref:M,className:"w-full"})}),O&&(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)("div",{className:"absolute inset-0 flex items-center",children:(0,t.jsx)("span",{className:"w-full border-t border-[#226240]/10"})}),(0,t.jsx)("div",{className:"relative flex justify-center text-xs uppercase",children:(0,t.jsx)("span",{className:"bg-[#F2F0E9] px-3 text-[#226240]/35 font-medium tracking-wider text-[10px]",children:p("orWithEmail")})})]}),(0,t.jsxs)("div",{className:"flex bg-white rounded-xl p-1 border border-[#226240]/10",children:[(0,t.jsx)("button",{type:"button",onClick:()=>Z("login"),className:`flex-1 py-2.5 text-sm font-semibold rounded-lg transition-all ${"login"===C?"bg-[#226240] text-[#F2F0E9] shadow-sm":"text-[#226240]/50 hover:text-[#226240]/70"}`,children:p("tabs.login")}),(0,t.jsx)("button",{type:"button",onClick:()=>Z("register"),className:`flex-1 py-2.5 text-sm font-semibold rounded-lg transition-all ${"register"===C?"bg-[#226240] text-[#F2F0E9] shadow-sm":"text-[#226240]/50 hover:text-[#226240]/70"}`,children:p("tabs.register")})]}),(0,t.jsxs)("form",{onSubmit:G,className:"flex flex-col gap-3",children:["register"===C&&(0,t.jsx)("input",{ref:U,type:"text",placeholder:p("placeholders.name"),className:Y,value:E,onChange:e=>{k(e.target.value),I(null)},required:!0}),(0,t.jsx)("input",{ref:L,type:"email",placeholder:p("placeholders.email"),className:Y,value:b,onChange:e=>{_(e.target.value),I(null)},required:!0}),x&&(0,t.jsxs)("div",{className:"text-sm text-[#FC522E] font-medium bg-[#FC522E]/5 p-3 rounded-xl border border-[#FC522E]/15",children:[(0,t.jsx)("span",{children:x}),"user_not_found"===T&&"login"===C&&(0,t.jsx)("button",{type:"button",onClick:()=>Z("register"),className:"ml-1 underline underline-offset-2 hover:text-[#FC522E]/80 transition-colors",children:p("errors.goToRegister")}),"user_exists"===T&&"register"===C&&(0,t.jsx)("button",{type:"button",onClick:()=>Z("login"),className:"ml-1 underline underline-offset-2 hover:text-[#FC522E]/80 transition-colors",children:p("errors.goToLogin")})]}),(0,t.jsx)("button",{type:"submit",disabled:g,className:"w-full h-12 rounded-xl bg-[#226240] hover:bg-[#1a4a30] text-[#F2F0E9] font-semibold text-sm shadow-lg shadow-[#226240]/10 transition-all hover:scale-[1.01] active:scale-[0.99] disabled:opacity-50 disabled:hover:scale-100 flex items-center justify-center gap-2",children:g?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(d.Loader2,{className:"h-4 w-4 animate-spin"}),p("buttons.sendingCode")]}):p("buttons.continue")})]}),(0,t.jsx)("p",{className:"text-[10px] text-[#226240]/35 text-center leading-relaxed",children:p.rich("legalFooter",{terms:e=>(0,t.jsx)("a",{href:"/terms-of-service",target:"_blank",className:"underline underline-offset-2 hover:text-[#226240]/60 transition-colors",children:e}),privacy:e=>(0,t.jsx)("a",{href:"/privacy-policy",target:"_blank",className:"underline underline-offset-2 hover:text-[#226240]/60 transition-colors",children:e})})})]}),"code"===m&&(0,t.jsx)("div",{className:"flex flex-col gap-4",children:(0,t.jsxs)("form",{onSubmit:X,className:"flex flex-col gap-3",children:[(0,t.jsx)("input",{ref:j,type:"text",inputMode:"numeric",autoComplete:"one-time-code",placeholder:"000000",maxLength:6,className:`${Y} font-mono tracking-[0.3em] text-center text-lg`,value:w,onChange:e=>{let t=e.target.value.replace(/[^0-9]/g,"");S(t),I(null),6===t.length&&Q(t)},required:!0}),x&&(0,t.jsx)("div",{className:"text-sm text-[#FC522E] font-medium bg-[#FC522E]/5 p-3 rounded-xl border border-[#FC522E]/15",children:x}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsxs)(l.Button,{type:"button",onClick:()=>y("email"),disabled:g,className:"flex-1 h-12 rounded-xl bg-white hover:bg-white/80 text-[#226240] border border-[#226240]/15 font-semibold text-sm shadow-none",children:[(0,t.jsx)(f.ArrowLeft,{className:"mr-2 h-4 w-4"}),p("buttons.back")]}),(0,t.jsx)("button",{type:"submit",disabled:g||w.length<6,className:"flex-[2] h-12 rounded-xl bg-[#226240] hover:bg-[#1a4a30] text-[#F2F0E9] font-semibold text-sm shadow-lg shadow-[#226240]/10 transition-all hover:scale-[1.01] active:scale-[0.99] disabled:opacity-50 disabled:hover:scale-100 flex items-center justify-center gap-2",children:g?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(d.Loader2,{className:"h-4 w-4 animate-spin"}),p("buttons.verifying")]}):"login"===C?p("buttons.login"):p("buttons.createAccount")}
1)]}),(0,t.jsx)("div",{className:"text-center pt-1",children:(0,t.jsx)("button",{type:"button",onClick:J,disabled:g||N>0,className:"text-xs text-[#226240]/40 hover:text-[#226240]/70 font-medium transition-colors disabled:hover:text-[#226240]/40",children:N>0?p("buttons.resendIn",{seconds:N}):p("buttons.resendCode")})})]})})]})]})]})}e.s(["AuthModal",()=>h],335465)}]); 2!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="9cdfaa73-e435-5646-9551-5a579996f14f")}catch(e){}}(); 3//# debugId=9cdfaa73-e435-5646-9551-5a579996f14f
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.