@letscooee/web-sdk 9.1.2 → 9.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +62 -19
- package/dist/analytics-sdk.min.js +61 -0
- package/dist/shopify-sdk.min.js +61 -2
- package/dist/widget-sdk.min.js +2 -2
- package/package.json +7 -13
- package/dist/shopify-sdk.min.js.LICENSE.txt +0 -66
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
var ih=Object.create;var wc=Object.defineProperty,oh=Object.defineProperties,sh=Object.getOwnPropertyDescriptor,ah=Object.getOwnPropertyDescriptors,ch=Object.getOwnPropertyNames,Qu=Object.getOwnPropertySymbols,lh=Object.getPrototypeOf,ep=Object.prototype.hasOwnProperty,uh=Object.prototype.propertyIsEnumerable;var Zu=(t,e,r)=>e in t?wc(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,b=(t,e)=>{for(var r in e||={})ep.call(e,r)&&Zu(t,r,e[r]);if(Qu)for(var r of Qu(e))uh.call(e,r)&&Zu(t,r,e[r]);return t},Z=(t,e)=>oh(t,ah(e));var Gi=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var Vi=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var ph=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of ch(e))!ep.call(t,i)&&i!==r&&wc(t,i,{get:()=>e[i],enumerable:!(n=sh(e,i))||n.enumerable});return t};var Xt=(t,e,r)=>(r=t!=null?ih(lh(t)):{},ph(e||!t||!t.__esModule?wc(r,"default",{value:t,enumerable:!0}):r,t));var tn=Vi((tp,Yo)=>{"use strict";(function(t){"use strict";var e={};e.VERSION="1.6.1";var r,n={},i=function(m,p){return function(){return p.apply(m,arguments)}},o=function(){var m=arguments,p=m[0],f,d;for(d=1;d<m.length;d++)for(f in m[d])!(f in p)&&m[d].hasOwnProperty(f)&&(p[f]=m[d][f]);return p},s=function(m,p){return{value:m,name:p}};e.TRACE=s(1,"TRACE"),e.DEBUG=s(2,"DEBUG"),e.INFO=s(3,"INFO"),e.TIME=s(4,"TIME"),e.WARN=s(5,"WARN"),e.ERROR=s(8,"ERROR"),e.OFF=s(99,"OFF");var a=function(m){this.context=m,this.setLevel(m.filterLevel),this.log=this.info};a.prototype={setLevel:function(m){m&&"value"in m&&(this.context.filterLevel=m)},getLevel:function(){return this.context.filterLevel},enabledFor:function(m){var p=this.context.filterLevel;return m.value>=p.value},trace:function(){this.invoke(e.TRACE,arguments)},debug:function(){this.invoke(e.DEBUG,arguments)},info:function(){this.invoke(e.INFO,arguments)},warn:function(){this.invoke(e.WARN,arguments)},error:function(){this.invoke(e.ERROR,arguments)},time:function(m){typeof m=="string"&&m.length>0&&this.invoke(e.TIME,[m,"start"])},timeEnd:function(m){typeof m=="string"&&m.length>0&&this.invoke(e.TIME,[m,"end"])},invoke:function(m,p){r&&this.enabledFor(m)&&r(p,o({level:m},this.context))}};var l=new a({filterLevel:e.OFF});(function(){var m=e;m.enabledFor=i(l,l.enabledFor),m.trace=i(l,l.trace),m.debug=i(l,l.debug),m.time=i(l,l.time),m.timeEnd=i(l,l.timeEnd),m.info=i(l,l.info),m.warn=i(l,l.warn),m.error=i(l,l.error),m.log=m.info})(),e.setHandler=function(m){r=m},e.setLevel=function(m){l.setLevel(m);for(var p in n)n.hasOwnProperty(p)&&n[p].setLevel(m)},e.getLevel=function(){return l.getLevel()},e.get=function(m){return n[m]||(n[m]=new a(o({name:m},l.context)))},e.createDefaultHandler=function(m){m=m||{},m.formatter=m.formatter||function(g,E){E.name&&g.unshift("["+E.name+"]")};var p={},f=function(d,g){Function.prototype.apply.call(d,console,g)};return typeof console>"u"?function(){}:function(d,g){d=Array.prototype.slice.call(d);var E=console.log,N;g.level===e.TIME?(N=(g.name?"["+g.name+"] ":"")+d[0],d[1]==="start"?console.time?console.time(N):p[N]=new Date().getTime():console.timeEnd?console.timeEnd(N):f(E,[N+": "+(new Date().getTime()-p[N])+"ms"])):(g.level===e.WARN&&console.warn?E=console.warn:g.level===e.ERROR&&console.error?E=console.error:g.level===e.INFO&&console.info?E=console.info:g.level===e.DEBUG&&console.debug?E=console.debug:g.level===e.TRACE&&console.trace&&(E=console.trace),m.formatter(d,g),f(E,d))}},e.useDefaults=function(m){e.setLevel(m&&m.defaultLevel||e.DEBUG),e.setHandler(e.createDefaultHandler(m))},e.setDefaults=e.useDefaults,typeof define=="function"&&define.amd?define(e):typeof Yo<"u"&&Yo.exports?Yo.exports=e:(e._prevLogger=t.Logger,e.noConflict=function(){return t.Logger=e._prevLogger,e},t.Logger=e)})(tp)});var Bp=Vi((to,rs)=>{"use strict";(function(t,e){"use strict";var r="1.0.40",n="",i="?",o="function",s="undefined",a="object",l="string",m="major",p="model",f="name",d="type",g="vendor",E="version",N="architecture",P="console",R="mobile",x="tablet",W="smarttv",$="wearable",ie="embedded",k=500,X="Amazon",z="Apple",oe="ASUS",Ce="BlackBerry",de="Browser",be="Chrome",He="Edge",Pe="Firefox",ot="Google",St="Huawei",we="LG",Me="Microsoft",pe="Motorola",te="Opera",ke="Samsung",pt="Sharp",ar="Sony",$r="Xiaomi",en="Zebra",Bn="Facebook",jr="Chromium OS",Un="Mac OS",Mn=" Browser",kn=function(V,J){var G={};for(var he in V)J[he]&&J[he].length%2===0?G[he]=J[he].concat(V[he]):G[he]=V[he];return G},Jt=function(V){for(var J={},G=0;G<V.length;G++)J[V[G].toUpperCase()]=V[G];return J},ft=function(V,J){return typeof V===l?Bt(J).indexOf(Bt(V))!==-1:!1},Bt=function(V){return V.toLowerCase()},Hi=function(V){return typeof V===l?V.replace(/[^\d\.]/g,n).split(".")[0]:e},y=function(V,J){if(typeof V===l)return V=V.replace(/^\s\s*/,n),typeof J===s?V:V.substring(0,k)},c=function(V,J){for(var G=0,he,mt,st,ye,Q,Ct;G<J.length&&!Q;){var Fn=J[G],$i=J[G+1];for(he=mt=0;he<Fn.length&&!Q&&Fn[he];)if(Q=Fn[he++].exec(V),Q)for(st=0;st<$i.length;st++)Ct=Q[++mt],ye=$i[st],typeof ye===a&&ye.length>0?ye.length===2?typeof ye[1]==o?this[ye[0]]=ye[1].call(this,Ct):this[ye[0]]=ye[1]:ye.length===3?typeof ye[1]===o&&!(ye[1].exec&&ye[1].test)?this[ye[0]]=Ct?ye[1].call(this,Ct,ye[2]):e:this[ye[0]]=Ct?Ct.replace(ye[1],ye[2]):e:ye.length===4&&(this[ye[0]]=Ct?ye[3].call(this,Ct.replace(ye[1],ye[2])):e):this[ye]=Ct||e;G+=2}},u=function(V,J){for(var G in J)if(typeof J[G]===a&&J[G].length>0){for(var he=0;he<J[G].length;he++)if(ft(J[G][he],V))return G===i?e:G}else if(ft(J[G],V))return G===i?e:G;return J.hasOwnProperty("*")?J["*"]:V},_={"1.0":"/8","1.2":"/1","1.3":"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"},D={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"},B={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[E,[f,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[E,[f,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[f,E],[/opios[\/ ]+([\w\.]+)/i],[E,[f,te+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[E,[f,te+" GX"]],[/\bopr\/([\w\.]+)/i],[E,[f,te]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[E,[f,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[E,[f,"Maxthon"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon)\/([-\w\.]+)/i,/(heytap|ovi|115)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[f,E],[/quark(?:pc)?\/([-\w\.]+)/i],[E,[f,"Quark"]],[/\bddg\/([\w\.]+)/i],[E,[f,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[E,[f,"UC"+de]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[E,[f,"WeChat"]],[/konqueror\/([\w\.]+)/i],[E,[f,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[E,[f,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[E,[f,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[E,[f,"Smart Lenovo "+de]],[/(avast|avg)\/([\w\.]+)/i],[[f,/(.+)/,"$1 Secure "+de],E],[/\bfocus\/([\w\.]+)/i],[E,[f,Pe+" Focus"]],[/\bopt\/([\w\.]+)/i],[E,[f,te+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[E,[f,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[E,[f,"Dolphin"]],[/coast\/([\w\.]+)/i],[E,[f,te+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[E,[f,"MIUI"+Mn]],[/fxios\/([\w\.-]+)/i],[E,[f,Pe]],[/\bqihoobrowser\/?([\w\.]*)/i],[E,[f,"360"]],[/\b(qq)\/([\w\.]+)/i],[[f,/(.+)/,"$1Browser"],E],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[f,/(.+)/,"$1"+Mn],E],[/samsungbrowser\/([\w\.]+)/i],[E,[f,ke+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[E,[f,"Sogou Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[f,"Sogou Mobile"],E],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[f,E],[/(lbbrowser|rekonq)/i,/\[(linkedin)app\]/i],[f],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[E,f],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[f,Bn],E],[/(Klarna)\/([\w\.]+)/i,/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i],[f,E],[/\bgsa\/([\w\.]+) .*safari\//i],[E,[f,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[E,[f,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[E,[f,be+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[f,be+" WebView"],E],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[E,[f,"Android "+de]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[f,E],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[E,[f,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[E,f],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[f,[E,u,_]],[/(webkit|khtml)\/([\w\.]+)/i],[f,E],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[f,"Netscape"],E],[/(wolvic|librewolf)\/([\w\.]+)/i],[f,E],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[E,[f,Pe+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\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|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[f,[E,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[f,[E,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[N,"amd64"]],[/(ia32(?=;))/i],[[N,Bt]],[/((?:i[346]|x)86)[;\)]/i],[[N,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[N,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[N,"armhf"]],[/windows (ce|mobile); ppc;/i],[[N,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[N,/ower/,n,Bt]],[/(sun4\w)[;\)]/i],[[N,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[N,Bt]]],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],[p,[g,ke],[d,x]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr])[-\w]+)/i,/sec-(sgh\w+)/i],[p,[g,ke],[d,R]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[p,[g,z],[d,R]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[p,[g,z],[d,x]],[/(macintosh);/i],[p,[g,z]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[p,[g,pt],[d,R]],[/(?:honor)([-\w ]+)[;\)]/i],[p,[g,"Honor"],[d,R]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[p,[g,St],[d,x]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[p,[g,St],[d,R]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i],[[p,/_/g," "],[g,$r],[d,R]],[/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[p,/_/g," "],[g,$r],[d,x]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[p,[g,"OPPO"],[d,R]],[/\b(opd2\d{3}a?) bui/i],[p,[g,"OPPO"],[d,x]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[p,[g,"Vivo"],[d,R]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[p,[g,"Realme"],[d,R]],[/\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],[p,[g,pe],[d,R]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[p,[g,pe],[d,x]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[p,[g,we],[d,x]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[p,[g,we],[d,R]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[p,[g,"Lenovo"],[d,x]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[p,/_/g," "],[g,"Nokia"],[d,R]],[/(pixel c)\b/i],[p,[g,ot],[d,x]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[p,[g,ot],[d,R]],[/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],[p,[g,ar],[d,R]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[p,"Xperia Tablet"],[g,ar],[d,x]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[p,[g,"OnePlus"],[d,R]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[p,[g,X],[d,x]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[p,/(.+)/g,"Fire Phone $1"],[g,X],[d,R]],[/(playbook);[-\w\),; ]+(rim)/i],[p,g,[d,x]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[p,[g,Ce],[d,R]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[p,[g,oe],[d,x]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[p,[g,oe],[d,R]],[/(nexus 9)/i],[p,[g,"HTC"],[d,x]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[g,[p,/_/g," "],[d,R]],[/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])\w*(\)| bui)/i],[p,[g,"TCL"],[d,x]],[/(itel) ((\w+))/i],[[g,Bt],p,[d,u,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[p,[g,"Acer"],[d,x]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[p,[g,"Meizu"],[d,R]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[p,[g,"Ulefone"],[d,R]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[p,[g,"Energizer"],[d,R]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[p,[g,"Cat"],[d,R]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[p,[g,"Smartfren"],[d,R]],[/droid.+; (a(?:015|06[35]|142p?))/i],[p,[g,"Nothing"],[d,R]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (imo) ((?!tab)[\w ]+?)(?: bui|\))/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[g,p,[d,R]],[/(imo) (tab \w+)/i,/(kobo)\s(ereader|touch)/i,/(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],[g,p,[d,x]],[/(surface duo)/i],[p,[g,Me],[d,x]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[p,[g,"Fairphone"],[d,R]],[/(u304aa)/i],[p,[g,"AT&T"],[d,R]],[/\bsie-(\w*)/i],[p,[g,"Siemens"],[d,R]],[/\b(rct\w+) b/i],[p,[g,"RCA"],[d,x]],[/\b(venue[\d ]{2,7}) b/i],[p,[g,"Dell"],[d,x]],[/\b(q(?:mv|ta)\w+) b/i],[p,[g,"Verizon"],[d,x]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[p,[g,"Barnes & Noble"],[d,x]],[/\b(tm\d{3}\w+) b/i],[p,[g,"NuVision"],[d,x]],[/\b(k88) b/i],[p,[g,"ZTE"],[d,x]],[/\b(nx\d{3}j) b/i],[p,[g,"ZTE"],[d,R]],[/\b(gen\d{3}) b.+49h/i],[p,[g,"Swiss"],[d,R]],[/\b(zur\d{3}) b/i],[p,[g,"Swiss"],[d,x]],[/\b((zeki)?tb.*\b) b/i],[p,[g,"Zeki"],[d,x]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[g,"Dragon Touch"],p,[d,x]],[/\b(ns-?\w{0,9}) b/i],[p,[g,"Insignia"],[d,x]],[/\b((nxa|next)-?\w{0,9}) b/i],[p,[g,"NextBook"],[d,x]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[g,"Voice"],p,[d,R]],[/\b(lvtel\-)?(v1[12]) b/i],[[g,"LvTel"],p,[d,R]],[/\b(ph-1) /i],[p,[g,"Essential"],[d,R]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[p,[g,"Envizen"],[d,x]],[/\b(trio[-\w\. ]+) b/i],[p,[g,"MachSpeed"],[d,x]],[/\btu_(1491) b/i],[p,[g,"Rotor"],[d,x]],[/(shield[\w ]+) b/i],[p,[g,"Nvidia"],[d,x]],[/(sprint) (\w+)/i],[g,p,[d,R]],[/(kin\.[onetw]{3})/i],[[p,/\./g," "],[g,Me],[d,R]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[p,[g,en],[d,x]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[p,[g,en],[d,R]],[/smart-tv.+(samsung)/i],[g,[d,W]],[/hbbtv.+maple;(\d+)/i],[[p,/^/,"SmartTV"],[g,ke],[d,W]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[g,we],[d,W]],[/(apple) ?tv/i],[g,[p,z+" TV"],[d,W]],[/crkey/i],[[p,be+"cast"],[g,ot],[d,W]],[/droid.+aft(\w+)( bui|\))/i],[p,[g,X],[d,W]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[p,[g,pt],[d,W]],[/(bravia[\w ]+)( bui|\))/i],[p,[g,ar],[d,W]],[/(mitv-\w{5}) bui/i],[p,[g,$r],[d,W]],[/Hbbtv.*(technisat) (.*);/i],[g,p,[d,W]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[g,y],[p,y],[d,W]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[d,W]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[g,p,[d,P]],[/droid.+; (shield) bui/i],[p,[g,"Nvidia"],[d,P]],[/(playstation [345portablevi]+)/i],[p,[g,ar],[d,P]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[p,[g,Me],[d,P]],[/\b(sm-[lr]\d\d[05][fnuw]?s?)\b/i],[p,[g,ke],[d,$]],[/((pebble))app/i],[g,p,[d,$]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[p,[g,z],[d,$]],[/droid.+; (glass) \d/i],[p,[g,ot],[d,$]],[/droid.+; (wt63?0{2,3})\)/i],[p,[g,en],[d,$]],[/droid.+; (glass) \d/i],[p,[g,ot],[d,$]],[/(pico) (4|neo3(?: link|pro)?)/i],[g,p,[d,$]],[/; (quest( \d| pro)?)/i],[p,[g,Bn],[d,$]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[g,[d,ie]],[/(aeobc)\b/i],[p,[g,X],[d,ie]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[p,[d,R]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[p,[d,x]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[d,x]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[d,R]],[/(android[-\w\. ]{0,9});.+buil/i],[p,[g,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[E,[f,He+"HTML"]],[/(arkweb)\/([\w\.]+)/i],[f,E],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[E,[f,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[f,E],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[E,f]],os:[[/microsoft (windows) (vista|xp)/i],[f,E],[/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i],[f,[E,u,D]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[E,u,D],[f,"Windows"]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[E,/_/g,"."],[f,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[f,Un],[E,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[E,f],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish|openharmony)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[f,E],[/\(bb(10);/i],[E,[f,Ce]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[E,[f,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[E,[f,Pe+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[E,[f,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[E,[f,"watchOS"]],[/crkey\/([\d\.]+)/i],[E,[f,be+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[f,jr],E],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(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],[f,E],[/(sunos) ?([\w\.\d]*)/i],[[f,"Solaris"],E],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[f,E]]},L=function(V,J){if(typeof V===a&&(J=V,V=e),!(this instanceof L))return new L(V,J).getResult();var G=typeof t!==s&&t.navigator?t.navigator:e,he=V||(G&&G.userAgent?G.userAgent:n),mt=G&&G.userAgentData?G.userAgentData:e,st=J?kn(B,J):B,ye=G&&G.userAgent==he;return this.getBrowser=function(){var Q={};return Q[f]=e,Q[E]=e,c.call(Q,he,st.browser),Q[m]=Hi(Q[E]),ye&&G&&G.brave&&typeof G.brave.isBrave==o&&(Q[f]="Brave"),Q},this.getCPU=function(){var Q={};return Q[N]=e,c.call(Q,he,st.cpu),Q},this.getDevice=function(){var Q={};return Q[g]=e,Q[p]=e,Q[d]=e,c.call(Q,he,st.device),ye&&!Q[d]&&mt&&mt.mobile&&(Q[d]=R),ye&&Q[p]=="Macintosh"&&G&&typeof G.standalone!==s&&G.maxTouchPoints&&G.maxTouchPoints>2&&(Q[p]="iPad",Q[d]=x),Q},this.getEngine=function(){var Q={};return Q[f]=e,Q[E]=e,c.call(Q,he,st.engine),Q},this.getOS=function(){var Q={};return Q[f]=e,Q[E]=e,c.call(Q,he,st.os),ye&&!Q[f]&&mt&&mt.platform&&mt.platform!="Unknown"&&(Q[f]=mt.platform.replace(/chrome os/i,jr).replace(/macos/i,Un)),Q},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 he},this.setUA=function(Q){return he=typeof Q===l&&Q.length>k?y(Q,k):Q,this},this.setUA(he),this};L.VERSION=r,L.BROWSER=Jt([f,E,m]),L.CPU=Jt([N]),L.DEVICE=Jt([p,g,d,P,R,W,x,$,ie]),L.ENGINE=L.OS=Jt([f,E]),typeof to!==s?(typeof rs!==s&&rs.exports&&(to=rs.exports=L),to.UAParser=L):typeof define===o&&define.amd?define(function(){return L}):typeof t!==s&&(t.UAParser=L);var re=typeof t!==s&&(t.jQuery||t.Zepto);if(re&&!re.ua){var me=new L;re.ua=me.getResult(),re.ua.get=function(){return me.getUA()},re.ua.set=function(V){me.setUA(V);var J=me.getResult();for(var G in J)re.ua[G]=J[G]}}})(typeof window=="object"?window:to)});var kp=Vi((Mp,Yc)=>{"use strict";(function(t){if(typeof Mp=="object"&&typeof Yc<"u")Yc.exports=t();else if(typeof define=="function"&&define.amd)define([],t);else{var e;typeof window<"u"?e=window:typeof global<"u"?e=global:typeof self<"u"?e=self:e=this,e.localforage=t()}})(function(){var t,e,r;return function n(i,o,s){function a(p,f){if(!o[p]){if(!i[p]){var d=typeof Gi=="function"&&Gi;if(!f&&d)return d(p,!0);if(l)return l(p,!0);var g=new Error("Cannot find module '"+p+"'");throw g.code="MODULE_NOT_FOUND",g}var E=o[p]={exports:{}};i[p][0].call(E.exports,function(N){var P=i[p][1][N];return a(P||N)},E,E.exports,n,i,o,s)}return o[p].exports}for(var l=typeof Gi=="function"&&Gi,m=0;m<s.length;m++)a(s[m]);return a}({1:[function(n,i,o){(function(s){"use strict";var a=s.MutationObserver||s.WebKitMutationObserver,l;if(a){var m=0,p=new a(N),f=s.document.createTextNode("");p.observe(f,{characterData:!0}),l=function(){f.data=m=++m%2}}else if(!s.setImmediate&&typeof s.MessageChannel<"u"){var d=new s.MessageChannel;d.port1.onmessage=N,l=function(){d.port2.postMessage(0)}}else"document"in s&&"onreadystatechange"in s.document.createElement("script")?l=function(){var R=s.document.createElement("script");R.onreadystatechange=function(){N(),R.onreadystatechange=null,R.parentNode.removeChild(R),R=null},s.document.documentElement.appendChild(R)}:l=function(){setTimeout(N,0)};var g,E=[];function N(){g=!0;for(var R,x,W=E.length;W;){for(x=E,E=[],R=-1;++R<W;)x[R]();W=E.length}g=!1}i.exports=P;function P(R){E.push(R)===1&&!g&&l()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(n,i,o){"use strict";var s=n(1);function a(){}var l={},m=["REJECTED"],p=["FULFILLED"],f=["PENDING"];i.exports=d;function d(k){if(typeof k!="function")throw new TypeError("resolver must be a function");this.state=f,this.queue=[],this.outcome=void 0,k!==a&&P(this,k)}d.prototype.catch=function(k){return this.then(null,k)},d.prototype.then=function(k,X){if(typeof k!="function"&&this.state===p||typeof X!="function"&&this.state===m)return this;var z=new this.constructor(a);if(this.state!==f){var oe=this.state===p?k:X;E(z,oe,this.outcome)}else this.queue.push(new g(z,k,X));return z};function g(k,X,z){this.promise=k,typeof X=="function"&&(this.onFulfilled=X,this.callFulfilled=this.otherCallFulfilled),typeof z=="function"&&(this.onRejected=z,this.callRejected=this.otherCallRejected)}g.prototype.callFulfilled=function(k){l.resolve(this.promise,k)},g.prototype.otherCallFulfilled=function(k){E(this.promise,this.onFulfilled,k)},g.prototype.callRejected=function(k){l.reject(this.promise,k)},g.prototype.otherCallRejected=function(k){E(this.promise,this.onRejected,k)};function E(k,X,z){s(function(){var oe;try{oe=X(z)}catch(Ce){return l.reject(k,Ce)}oe===k?l.reject(k,new TypeError("Cannot resolve promise with itself")):l.resolve(k,oe)})}l.resolve=function(k,X){var z=R(N,X);if(z.status==="error")return l.reject(k,z.value);var oe=z.value;if(oe)P(k,oe);else{k.state=p,k.outcome=X;for(var Ce=-1,de=k.queue.length;++Ce<de;)k.queue[Ce].callFulfilled(X)}return k},l.reject=function(k,X){k.state=m,k.outcome=X;for(var z=-1,oe=k.queue.length;++z<oe;)k.queue[z].callRejected(X);return k};function N(k){var X=k&&k.then;if(k&&(typeof k=="object"||typeof k=="function")&&typeof X=="function")return function(){X.apply(k,arguments)}}function P(k,X){var z=!1;function oe(He){z||(z=!0,l.reject(k,He))}function Ce(He){z||(z=!0,l.resolve(k,He))}function de(){X(Ce,oe)}var be=R(de);be.status==="error"&&oe(be.value)}function R(k,X){var z={};try{z.value=k(X),z.status="success"}catch(oe){z.status="error",z.value=oe}return z}d.resolve=x;function x(k){return k instanceof this?k:l.resolve(new this(a),k)}d.reject=W;function W(k){var X=new this(a);return l.reject(X,k)}d.all=$;function $(k){var X=this;if(Object.prototype.toString.call(k)!=="[object Array]")return this.reject(new TypeError("must be an array"));var z=k.length,oe=!1;if(!z)return this.resolve([]);for(var Ce=new Array(z),de=0,be=-1,He=new this(a);++be<z;)Pe(k[be],be);return He;function Pe(ot,St){X.resolve(ot).then(we,function(Me){oe||(oe=!0,l.reject(He,Me))});function we(Me){Ce[St]=Me,++de===z&&!oe&&(oe=!0,l.resolve(He,Ce))}}}d.race=ie;function ie(k){var X=this;if(Object.prototype.toString.call(k)!=="[object Array]")return this.reject(new TypeError("must be an array"));var z=k.length,oe=!1;if(!z)return this.resolve([]);for(var Ce=-1,de=new this(a);++Ce<z;)be(k[Ce]);return de;function be(He){X.resolve(He).then(function(Pe){oe||(oe=!0,l.resolve(de,Pe))},function(Pe){oe||(oe=!0,l.reject(de,Pe))})}}},{1:1}],3:[function(n,i,o){(function(s){"use strict";typeof s.Promise!="function"&&(s.Promise=n(2))}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(n,i,o){"use strict";var s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(h){return typeof h}:function(h){return h&&typeof Symbol=="function"&&h.constructor===Symbol&&h!==Symbol.prototype?"symbol":typeof h};function a(h,S){if(!(h instanceof S))throw new TypeError("Cannot call a class as a function")}function l(){try{if(typeof indexedDB<"u")return indexedDB;if(typeof webkitIndexedDB<"u")return webkitIndexedDB;if(typeof mozIndexedDB<"u")return mozIndexedDB;if(typeof OIndexedDB<"u")return OIndexedDB;if(typeof msIndexedDB<"u")return msIndexedDB}catch{return}}var m=l();function p(){try{if(!m||!m.open)return!1;var h=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),S=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!h||S)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function f(h,S){h=h||[],S=S||{};try{return new Blob(h,S)}catch(I){if(I.name!=="TypeError")throw I;for(var v=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,T=new v,C=0;C<h.length;C+=1)T.append(h[C]);return T.getBlob(S.type)}}typeof Promise>"u"&&n(3);var d=Promise;function g(h,S){S&&h.then(function(v){S(null,v)},function(v){S(v)})}function E(h,S,v){typeof S=="function"&&h.then(S),typeof v=="function"&&h.catch(v)}function N(h){return typeof h!="string"&&(console.warn(h+" used as a key, but it is not a string."),h=String(h)),h}function P(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var R="local-forage-detect-blob-support",x=void 0,W={},$=Object.prototype.toString,ie="readonly",k="readwrite";function X(h){for(var S=h.length,v=new ArrayBuffer(S),T=new Uint8Array(v),C=0;C<S;C++)T[C]=h.charCodeAt(C);return v}function z(h){return new d(function(S){var v=h.transaction(R,k),T=f([""]);v.objectStore(R).put(T,"key"),v.onabort=function(C){C.preventDefault(),C.stopPropagation(),S(!1)},v.oncomplete=function(){var C=navigator.userAgent.match(/Chrome\/(\d+)/),I=navigator.userAgent.match(/Edge\//);S(I||!C||parseInt(C[1],10)>=43)}}).catch(function(){return!1})}function oe(h){return typeof x=="boolean"?d.resolve(x):z(h).then(function(S){return x=S,x})}function Ce(h){var S=W[h.name],v={};v.promise=new d(function(T,C){v.resolve=T,v.reject=C}),S.deferredOperations.push(v),S.dbReady?S.dbReady=S.dbReady.then(function(){return v.promise}):S.dbReady=v.promise}function de(h){var S=W[h.name],v=S.deferredOperations.pop();if(v)return v.resolve(),v.promise}function be(h,S){var v=W[h.name],T=v.deferredOperations.pop();if(T)return T.reject(S),T.promise}function He(h,S){return new d(function(v,T){if(W[h.name]=W[h.name]||ar(),h.db)if(S)Ce(h),h.db.close();else return v(h.db);var C=[h.name];S&&C.push(h.version);var I=m.open.apply(m,C);S&&(I.onupgradeneeded=function(O){var U=I.result;try{U.createObjectStore(h.storeName),O.oldVersion<=1&&U.createObjectStore(R)}catch(F){if(F.name==="ConstraintError")console.warn('The database "'+h.name+'" has been upgraded from version '+O.oldVersion+" to version "+O.newVersion+', but the storage "'+h.storeName+'" already exists.');else throw F}}),I.onerror=function(O){O.preventDefault(),T(I.error)},I.onsuccess=function(){var O=I.result;O.onversionchange=function(U){U.target.close()},v(O),de(h)}})}function Pe(h){return He(h,!1)}function ot(h){return He(h,!0)}function St(h,S){if(!h.db)return!0;var v=!h.db.objectStoreNames.contains(h.storeName),T=h.version<h.db.version,C=h.version>h.db.version;if(T&&(h.version!==S&&console.warn('The database "'+h.name+`" can't be downgraded from version `+h.db.version+" to version "+h.version+"."),h.version=h.db.version),C||v){if(v){var I=h.db.version+1;I>h.version&&(h.version=I)}return!0}return!1}function we(h){return new d(function(S,v){var T=new FileReader;T.onerror=v,T.onloadend=function(C){var I=btoa(C.target.result||"");S({__local_forage_encoded_blob:!0,data:I,type:h.type})},T.readAsBinaryString(h)})}function Me(h){var S=X(atob(h.data));return f([S],{type:h.type})}function pe(h){return h&&h.__local_forage_encoded_blob}function te(h){var S=this,v=S._initReady().then(function(){var T=W[S._dbInfo.name];if(T&&T.dbReady)return T.dbReady});return E(v,h,h),v}function ke(h){Ce(h);for(var S=W[h.name],v=S.forages,T=0;T<v.length;T++){var C=v[T];C._dbInfo.db&&(C._dbInfo.db.close(),C._dbInfo.db=null)}return h.db=null,Pe(h).then(function(I){return h.db=I,St(h)?ot(h):I}).then(function(I){h.db=S.db=I;for(var O=0;O<v.length;O++)v[O]._dbInfo.db=I}).catch(function(I){throw be(h,I),I})}function pt(h,S,v,T){T===void 0&&(T=1);try{var C=h.db.transaction(h.storeName,S);v(null,C)}catch(I){if(T>0&&(!h.db||I.name==="InvalidStateError"||I.name==="NotFoundError"))return d.resolve().then(function(){if(!h.db||I.name==="NotFoundError"&&!h.db.objectStoreNames.contains(h.storeName)&&h.version<=h.db.version)return h.db&&(h.version=h.db.version+1),ot(h)}).then(function(){return ke(h).then(function(){pt(h,S,v,T-1)})}).catch(v);v(I)}}function ar(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function $r(h){var S=this,v={db:null};if(h)for(var T in h)v[T]=h[T];var C=W[v.name];C||(C=ar(),W[v.name]=C),C.forages.push(S),S._initReady||(S._initReady=S.ready,S.ready=te);var I=[];function O(){return d.resolve()}for(var U=0;U<C.forages.length;U++){var F=C.forages[U];F!==S&&I.push(F._initReady().catch(O))}var H=C.forages.slice(0);return d.all(I).then(function(){return v.db=C.db,Pe(v)}).then(function(j){return v.db=j,St(v,S._defaultConfig.version)?ot(v):j}).then(function(j){v.db=C.db=j,S._dbInfo=v;for(var Y=0;Y<H.length;Y++){var le=H[Y];le!==S&&(le._dbInfo.db=v.db,le._dbInfo.version=v.version)}})}function en(h,S){var v=this;h=N(h);var T=new d(function(C,I){v.ready().then(function(){pt(v._dbInfo,ie,function(O,U){if(O)return I(O);try{var F=U.objectStore(v._dbInfo.storeName),H=F.get(h);H.onsuccess=function(){var j=H.result;j===void 0&&(j=null),pe(j)&&(j=Me(j)),C(j)},H.onerror=function(){I(H.error)}}catch(j){I(j)}})}).catch(I)});return g(T,S),T}function Bn(h,S){var v=this,T=new d(function(C,I){v.ready().then(function(){pt(v._dbInfo,ie,function(O,U){if(O)return I(O);try{var F=U.objectStore(v._dbInfo.storeName),H=F.openCursor(),j=1;H.onsuccess=function(){var Y=H.result;if(Y){var le=Y.value;pe(le)&&(le=Me(le));var Ie=h(le,Y.key,j++);Ie!==void 0?C(Ie):Y.continue()}else C()},H.onerror=function(){I(H.error)}}catch(Y){I(Y)}})}).catch(I)});return g(T,S),T}function jr(h,S,v){var T=this;h=N(h);var C=new d(function(I,O){var U;T.ready().then(function(){return U=T._dbInfo,$.call(S)==="[object Blob]"?oe(U.db).then(function(F){return F?S:we(S)}):S}).then(function(F){pt(T._dbInfo,k,function(H,j){if(H)return O(H);try{var Y=j.objectStore(T._dbInfo.storeName);F===null&&(F=void 0);var le=Y.put(F,h);j.oncomplete=function(){F===void 0&&(F=null),I(F)},j.onabort=j.onerror=function(){var Ie=le.error?le.error:le.transaction.error;O(Ie)}}catch(Ie){O(Ie)}})}).catch(O)});return g(C,v),C}function Un(h,S){var v=this;h=N(h);var T=new d(function(C,I){v.ready().then(function(){pt(v._dbInfo,k,function(O,U){if(O)return I(O);try{var F=U.objectStore(v._dbInfo.storeName),H=F.delete(h);U.oncomplete=function(){C()},U.onerror=function(){I(H.error)},U.onabort=function(){var j=H.error?H.error:H.transaction.error;I(j)}}catch(j){I(j)}})}).catch(I)});return g(T,S),T}function Mn(h){var S=this,v=new d(function(T,C){S.ready().then(function(){pt(S._dbInfo,k,function(I,O){if(I)return C(I);try{var U=O.objectStore(S._dbInfo.storeName),F=U.clear();O.oncomplete=function(){T()},O.onabort=O.onerror=function(){var H=F.error?F.error:F.transaction.error;C(H)}}catch(H){C(H)}})}).catch(C)});return g(v,h),v}function kn(h){var S=this,v=new d(function(T,C){S.ready().then(function(){pt(S._dbInfo,ie,function(I,O){if(I)return C(I);try{var U=O.objectStore(S._dbInfo.storeName),F=U.count();F.onsuccess=function(){T(F.result)},F.onerror=function(){C(F.error)}}catch(H){C(H)}})}).catch(C)});return g(v,h),v}function Jt(h,S){var v=this,T=new d(function(C,I){if(h<0){C(null);return}v.ready().then(function(){pt(v._dbInfo,ie,function(O,U){if(O)return I(O);try{var F=U.objectStore(v._dbInfo.storeName),H=!1,j=F.openKeyCursor();j.onsuccess=function(){var Y=j.result;if(!Y){C(null);return}h===0||H?C(Y.key):(H=!0,Y.advance(h))},j.onerror=function(){I(j.error)}}catch(Y){I(Y)}})}).catch(I)});return g(T,S),T}function ft(h){var S=this,v=new d(function(T,C){S.ready().then(function(){pt(S._dbInfo,ie,function(I,O){if(I)return C(I);try{var U=O.objectStore(S._dbInfo.storeName),F=U.openKeyCursor(),H=[];F.onsuccess=function(){var j=F.result;if(!j){T(H);return}H.push(j.key),j.continue()},F.onerror=function(){C(F.error)}}catch(j){C(j)}})}).catch(C)});return g(v,h),v}function Bt(h,S){S=P.apply(this,arguments);var v=this.config();h=typeof h!="function"&&h||{},h.name||(h.name=h.name||v.name,h.storeName=h.storeName||v.storeName);var T=this,C;if(!h.name)C=d.reject("Invalid arguments");else{var I=h.name===v.name&&T._dbInfo.db,O=I?d.resolve(T._dbInfo.db):Pe(h).then(function(U){var F=W[h.name],H=F.forages;F.db=U;for(var j=0;j<H.length;j++)H[j]._dbInfo.db=U;return U});h.storeName?C=O.then(function(U){if(U.objectStoreNames.contains(h.storeName)){var F=U.version+1;Ce(h);var H=W[h.name],j=H.forages;U.close();for(var Y=0;Y<j.length;Y++){var le=j[Y];le._dbInfo.db=null,le._dbInfo.version=F}var Ie=new d(function(Te,Ge){var $e=m.open(h.name,F);$e.onerror=function(Ut){var Wi=$e.result;Wi.close(),Ge(Ut)},$e.onupgradeneeded=function(){var Ut=$e.result;Ut.deleteObjectStore(h.storeName)},$e.onsuccess=function(){var Ut=$e.result;Ut.close(),Te(Ut)}});return Ie.then(function(Te){H.db=Te;for(var Ge=0;Ge<j.length;Ge++){var $e=j[Ge];$e._dbInfo.db=Te,de($e._dbInfo)}}).catch(function(Te){throw(be(h,Te)||d.resolve()).catch(function(){}),Te})}}):C=O.then(function(U){Ce(h);var F=W[h.name],H=F.forages;U.close();for(var j=0;j<H.length;j++){var Y=H[j];Y._dbInfo.db=null}var le=new d(function(Ie,Te){var Ge=m.deleteDatabase(h.name);Ge.onerror=function(){var $e=Ge.result;$e&&$e.close(),Te(Ge.error)},Ge.onblocked=function(){console.warn('dropInstance blocked for database "'+h.name+'" until all open connections are closed')},Ge.onsuccess=function(){var $e=Ge.result;$e&&$e.close(),Ie($e)}});return le.then(function(Ie){F.db=Ie;for(var Te=0;Te<H.length;Te++){var Ge=H[Te];de(Ge._dbInfo)}}).catch(function(Ie){throw(be(h,Ie)||d.resolve()).catch(function(){}),Ie})})}return g(C,S),C}var Hi={_driver:"asyncStorage",_initStorage:$r,_support:p(),iterate:Bn,getItem:en,setItem:jr,removeItem:Un,clear:Mn,length:kn,key:Jt,keys:ft,dropInstance:Bt};function y(){return typeof openDatabase=="function"}var c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u="~~local_forage_type~",_=/^~~local_forage_type~([^~]+)~/,D="__lfsc__:",B=D.length,L="arbf",re="blob",me="si08",V="ui08",J="uic8",G="si16",he="si32",mt="ur16",st="ui32",ye="fl32",Q="fl64",Ct=B+L.length,Fn=Object.prototype.toString;function $i(h){var S=h.length*.75,v=h.length,T,C=0,I,O,U,F;h[h.length-1]==="="&&(S--,h[h.length-2]==="="&&S--);var H=new ArrayBuffer(S),j=new Uint8Array(H);for(T=0;T<v;T+=4)I=c.indexOf(h[T]),O=c.indexOf(h[T+1]),U=c.indexOf(h[T+2]),F=c.indexOf(h[T+3]),j[C++]=I<<2|O>>4,j[C++]=(O&15)<<4|U>>2,j[C++]=(U&3)<<6|F&63;return H}function yc(h){var S=new Uint8Array(h),v="",T;for(T=0;T<S.length;T+=3)v+=c[S[T]>>2],v+=c[(S[T]&3)<<4|S[T+1]>>4],v+=c[(S[T+1]&15)<<2|S[T+2]>>6],v+=c[S[T+2]&63];return S.length%3===2?v=v.substring(0,v.length-1)+"=":S.length%3===1&&(v=v.substring(0,v.length-2)+"=="),v}function Ed(h,S){var v="";if(h&&(v=Fn.call(h)),h&&(v==="[object ArrayBuffer]"||h.buffer&&Fn.call(h.buffer)==="[object ArrayBuffer]")){var T,C=D;h instanceof ArrayBuffer?(T=h,C+=L):(T=h.buffer,v==="[object Int8Array]"?C+=me:v==="[object Uint8Array]"?C+=V:v==="[object Uint8ClampedArray]"?C+=J:v==="[object Int16Array]"?C+=G:v==="[object Uint16Array]"?C+=mt:v==="[object Int32Array]"?C+=he:v==="[object Uint32Array]"?C+=st:v==="[object Float32Array]"?C+=ye:v==="[object Float64Array]"?C+=Q:S(new Error("Failed to get type for BinaryArray"))),S(C+yc(T))}else if(v==="[object Blob]"){var I=new FileReader;I.onload=function(){var O=u+h.type+"~"+yc(this.result);S(D+re+O)},I.readAsArrayBuffer(h)}else try{S(JSON.stringify(h))}catch(O){console.error("Couldn't convert value into a JSON string: ",h),S(null,O)}}function Sd(h){if(h.substring(0,B)!==D)return JSON.parse(h);var S=h.substring(Ct),v=h.substring(B,Ct),T;if(v===re&&_.test(S)){var C=S.match(_);T=C[1],S=S.substring(C[0].length)}var I=$i(S);switch(v){case L:return I;case re:return f([I],{type:T});case me:return new Int8Array(I);case V:return new Uint8Array(I);case J:return new Uint8ClampedArray(I);case G:return new Int16Array(I);case mt:return new Uint16Array(I);case he:return new Int32Array(I);case st:return new Uint32Array(I);case ye:return new Float32Array(I);case Q:return new Float64Array(I);default:throw new Error("Unkown type: "+v)}}var vc={serialize:Ed,deserialize:Sd,stringToBuffer:$i,bufferToString:yc};function zu(h,S,v,T){h.executeSql("CREATE TABLE IF NOT EXISTS "+S.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],v,T)}function bd(h){var S=this,v={db:null};if(h)for(var T in h)v[T]=typeof h[T]!="string"?h[T].toString():h[T];var C=new d(function(I,O){try{v.db=openDatabase(v.name,String(v.version),v.description,v.size)}catch(U){return O(U)}v.db.transaction(function(U){zu(U,v,function(){S._dbInfo=v,I()},function(F,H){O(H)})},O)});return v.serializer=vc,C}function Wr(h,S,v,T,C,I){h.executeSql(v,T,C,function(O,U){U.code===U.SYNTAX_ERR?O.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[S.storeName],function(F,H){H.rows.length?I(F,U):zu(F,S,function(){F.executeSql(v,T,C,I)},I)},I):I(O,U)},I)}function wd(h,S){var v=this;h=N(h);var T=new d(function(C,I){v.ready().then(function(){var O=v._dbInfo;O.db.transaction(function(U){Wr(U,O,"SELECT * FROM "+O.storeName+" WHERE key = ? LIMIT 1",[h],function(F,H){var j=H.rows.length?H.rows.item(0).value:null;j&&(j=O.serializer.deserialize(j)),C(j)},function(F,H){I(H)})})}).catch(I)});return g(T,S),T}function Id(h,S){var v=this,T=new d(function(C,I){v.ready().then(function(){var O=v._dbInfo;O.db.transaction(function(U){Wr(U,O,"SELECT * FROM "+O.storeName,[],function(F,H){for(var j=H.rows,Y=j.length,le=0;le<Y;le++){var Ie=j.item(le),Te=Ie.value;if(Te&&(Te=O.serializer.deserialize(Te)),Te=h(Te,Ie.key,le+1),Te!==void 0){C(Te);return}}C()},function(F,H){I(H)})})}).catch(I)});return g(T,S),T}function Yu(h,S,v,T){var C=this;h=N(h);var I=new d(function(O,U){C.ready().then(function(){S===void 0&&(S=null);var F=S,H=C._dbInfo;H.serializer.serialize(S,function(j,Y){Y?U(Y):H.db.transaction(function(le){Wr(le,H,"INSERT OR REPLACE INTO "+H.storeName+" (key, value) VALUES (?, ?)",[h,j],function(){O(F)},function(Ie,Te){U(Te)})},function(le){if(le.code===le.QUOTA_ERR){if(T>0){O(Yu.apply(C,[h,F,v,T-1]));return}U(le)}})})}).catch(U)});return g(I,v),I}function Td(h,S,v){return Yu.apply(this,[h,S,v,1])}function xd(h,S){var v=this;h=N(h);var T=new d(function(C,I){v.ready().then(function(){var O=v._dbInfo;O.db.transaction(function(U){Wr(U,O,"DELETE FROM "+O.storeName+" WHERE key = ?",[h],function(){C()},function(F,H){I(H)})})}).catch(I)});return g(T,S),T}function Cd(h){var S=this,v=new d(function(T,C){S.ready().then(function(){var I=S._dbInfo;I.db.transaction(function(O){Wr(O,I,"DELETE FROM "+I.storeName,[],function(){T()},function(U,F){C(F)})})}).catch(C)});return g(v,h),v}function Dd(h){var S=this,v=new d(function(T,C){S.ready().then(function(){var I=S._dbInfo;I.db.transaction(function(O){Wr(O,I,"SELECT COUNT(key) as c FROM "+I.storeName,[],function(U,F){var H=F.rows.item(0).c;T(H)},function(U,F){C(F)})})}).catch(C)});return g(v,h),v}function Rd(h,S){var v=this,T=new d(function(C,I){v.ready().then(function(){var O=v._dbInfo;O.db.transaction(function(U){Wr(U,O,"SELECT key FROM "+O.storeName+" WHERE id = ? LIMIT 1",[h+1],function(F,H){var j=H.rows.length?H.rows.item(0).key:null;C(j)},function(F,H){I(H)})})}).catch(I)});return g(T,S),T}function Nd(h){var S=this,v=new d(function(T,C){S.ready().then(function(){var I=S._dbInfo;I.db.transaction(function(O){Wr(O,I,"SELECT key FROM "+I.storeName,[],function(U,F){for(var H=[],j=0;j<F.rows.length;j++)H.push(F.rows.item(j).key);T(H)},function(U,F){C(F)})})}).catch(C)});return g(v,h),v}function Od(h){return new d(function(S,v){h.transaction(function(T){T.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(C,I){for(var O=[],U=0;U<I.rows.length;U++)O.push(I.rows.item(U).name);S({db:h,storeNames:O})},function(C,I){v(I)})},function(T){v(T)})})}function Ad(h,S){S=P.apply(this,arguments);var v=this.config();h=typeof h!="function"&&h||{},h.name||(h.name=h.name||v.name,h.storeName=h.storeName||v.storeName);var T=this,C;return h.name?C=new d(function(I){var O;h.name===v.name?O=T._dbInfo.db:O=openDatabase(h.name,"","",0),h.storeName?I({db:O,storeNames:[h.storeName]}):I(Od(O))}).then(function(I){return new d(function(O,U){I.db.transaction(function(F){function H(Ie){return new d(function(Te,Ge){F.executeSql("DROP TABLE IF EXISTS "+Ie,[],function(){Te()},function($e,Ut){Ge(Ut)})})}for(var j=[],Y=0,le=I.storeNames.length;Y<le;Y++)j.push(H(I.storeNames[Y]));d.all(j).then(function(){O()}).catch(function(Ie){U(Ie)})},function(F){U(F)})})}):C=d.reject("Invalid arguments"),g(C,S),C}var Pd={_driver:"webSQLStorage",_initStorage:bd,_support:y(),iterate:Id,getItem:wd,setItem:Td,removeItem:xd,clear:Cd,length:Dd,key:Rd,keys:Nd,dropInstance:Ad};function Ld(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function qu(h,S){var v=h.name+"/";return h.storeName!==S.storeName&&(v+=h.storeName+"/"),v}function Bd(){var h="_localforage_support_test";try{return localStorage.setItem(h,!0),localStorage.removeItem(h),!1}catch{return!0}}function Ud(){return!Bd()||localStorage.length>0}function Md(h){var S=this,v={};if(h)for(var T in h)v[T]=h[T];return v.keyPrefix=qu(h,S._defaultConfig),Ud()?(S._dbInfo=v,v.serializer=vc,d.resolve()):d.reject()}function kd(h){var S=this,v=S.ready().then(function(){for(var T=S._dbInfo.keyPrefix,C=localStorage.length-1;C>=0;C--){var I=localStorage.key(C);I.indexOf(T)===0&&localStorage.removeItem(I)}});return g(v,h),v}function Fd(h,S){var v=this;h=N(h);var T=v.ready().then(function(){var C=v._dbInfo,I=localStorage.getItem(C.keyPrefix+h);return I&&(I=C.serializer.deserialize(I)),I});return g(T,S),T}function Hd(h,S){var v=this,T=v.ready().then(function(){for(var C=v._dbInfo,I=C.keyPrefix,O=I.length,U=localStorage.length,F=1,H=0;H<U;H++){var j=localStorage.key(H);if(j.indexOf(I)===0){var Y=localStorage.getItem(j);if(Y&&(Y=C.serializer.deserialize(Y)),Y=h(Y,j.substring(O),F++),Y!==void 0)return Y}}});return g(T,S),T}function $d(h,S){var v=this,T=v.ready().then(function(){var C=v._dbInfo,I;try{I=localStorage.key(h)}catch{I=null}return I&&(I=I.substring(C.keyPrefix.length)),I});return g(T,S),T}function jd(h){var S=this,v=S.ready().then(function(){for(var T=S._dbInfo,C=localStorage.length,I=[],O=0;O<C;O++){var U=localStorage.key(O);U.indexOf(T.keyPrefix)===0&&I.push(U.substring(T.keyPrefix.length))}return I});return g(v,h),v}function Wd(h){var S=this,v=S.keys().then(function(T){return T.length});return g(v,h),v}function Gd(h,S){var v=this;h=N(h);var T=v.ready().then(function(){var C=v._dbInfo;localStorage.removeItem(C.keyPrefix+h)});return g(T,S),T}function Vd(h,S,v){var T=this;h=N(h);var C=T.ready().then(function(){S===void 0&&(S=null);var I=S;return new d(function(O,U){var F=T._dbInfo;F.serializer.serialize(S,function(H,j){if(j)U(j);else try{localStorage.setItem(F.keyPrefix+h,H),O(I)}catch(Y){(Y.name==="QuotaExceededError"||Y.name==="NS_ERROR_DOM_QUOTA_REACHED")&&U(Y),U(Y)}})})});return g(C,v),C}function zd(h,S){if(S=P.apply(this,arguments),h=typeof h!="function"&&h||{},!h.name){var v=this.config();h.name=h.name||v.name,h.storeName=h.storeName||v.storeName}var T=this,C;return h.name?C=new d(function(I){h.storeName?I(qu(h,T._defaultConfig)):I(h.name+"/")}).then(function(I){for(var O=localStorage.length-1;O>=0;O--){var U=localStorage.key(O);U.indexOf(I)===0&&localStorage.removeItem(U)}}):C=d.reject("Invalid arguments"),g(C,S),C}var Yd={_driver:"localStorageWrapper",_initStorage:Md,_support:Ld(),iterate:Hd,getItem:Fd,setItem:Vd,removeItem:Gd,clear:kd,length:Wd,key:$d,keys:jd,dropInstance:zd},qd=function(S,v){return S===v||typeof S=="number"&&typeof v=="number"&&isNaN(S)&&isNaN(v)},Kd=function(S,v){for(var T=S.length,C=0;C<T;){if(qd(S[C],v))return!0;C++}return!1},Ku=Array.isArray||function(h){return Object.prototype.toString.call(h)==="[object Array]"},ji={},Ju={},Hn={INDEXEDDB:Hi,WEBSQL:Pd,LOCALSTORAGE:Yd},Jd=[Hn.INDEXEDDB._driver,Hn.WEBSQL._driver,Hn.LOCALSTORAGE._driver],zo=["dropInstance"],_c=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(zo),Xd={description:"",driver:Jd.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function Qd(h,S){h[S]=function(){var v=arguments;return h.ready().then(function(){return h[S].apply(h,v)})}}function Ec(){for(var h=1;h<arguments.length;h++){var S=arguments[h];if(S)for(var v in S)S.hasOwnProperty(v)&&(Ku(S[v])?arguments[0][v]=S[v].slice():arguments[0][v]=S[v])}return arguments[0]}var Zd=function(){function h(S){a(this,h);for(var v in Hn)if(Hn.hasOwnProperty(v)){var T=Hn[v],C=T._driver;this[v]=C,ji[C]||this.defineDriver(T)}this._defaultConfig=Ec({},Xd),this._config=Ec({},this._defaultConfig,S),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return h.prototype.config=function(v){if((typeof v>"u"?"undefined":s(v))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var T in v){if(T==="storeName"&&(v[T]=v[T].replace(/\W/g,"_")),T==="version"&&typeof v[T]!="number")return new Error("Database version must be a number.");this._config[T]=v[T]}return"driver"in v&&v.driver?this.setDriver(this._config.driver):!0}else return typeof v=="string"?this._config[v]:this._config},h.prototype.defineDriver=function(v,T,C){var I=new d(function(O,U){try{var F=v._driver,H=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!v._driver){U(H);return}for(var j=_c.concat("_initStorage"),Y=0,le=j.length;Y<le;Y++){var Ie=j[Y],Te=!Kd(zo,Ie);if((Te||v[Ie])&&typeof v[Ie]!="function"){U(H);return}}var Ge=function(){for(var Wi=function(rh){return function(){var nh=new Error("Method "+rh+" is not implemented by the current driver"),Xu=d.reject(nh);return g(Xu,arguments[arguments.length-1]),Xu}},Sc=0,th=zo.length;Sc<th;Sc++){var bc=zo[Sc];v[bc]||(v[bc]=Wi(bc))}};Ge();var $e=function(Wi){ji[F]&&console.info("Redefining LocalForage driver: "+F),ji[F]=v,Ju[F]=Wi,O()};"_support"in v?v._support&&typeof v._support=="function"?v._support().then($e,U):$e(!!v._support):$e(!0)}catch(Ut){U(Ut)}});return E(I,T,C),I},h.prototype.driver=function(){return this._driver||null},h.prototype.getDriver=function(v,T,C){var I=ji[v]?d.resolve(ji[v]):d.reject(new Error("Driver not found."));return E(I,T,C),I},h.prototype.getSerializer=function(v){var T=d.resolve(vc);return E(T,v),T},h.prototype.ready=function(v){var T=this,C=T._driverSet.then(function(){return T._ready===null&&(T._ready=T._initDriver()),T._ready});return E(C,v,v),C},h.prototype.setDriver=function(v,T,C){var I=this;Ku(v)||(v=[v]);var O=this._getSupportedDrivers(v);function U(){I._config.driver=I.driver()}function F(Y){return I._extend(Y),U(),I._ready=I._initStorage(I._config),I._ready}function H(Y){return function(){var le=0;function Ie(){for(;le<Y.length;){var Te=Y[le];return le++,I._dbInfo=null,I._ready=null,I.getDriver(Te).then(F).catch(Ie)}U();var Ge=new Error("No available storage method found.");return I._driverSet=d.reject(Ge),I._driverSet}return Ie()}}var j=this._driverSet!==null?this._driverSet.catch(function(){return d.resolve()}):d.resolve();return this._driverSet=j.then(function(){var Y=O[0];return I._dbInfo=null,I._ready=null,I.getDriver(Y).then(function(le){I._driver=le._driver,U(),I._wrapLibraryMethodsWithReady(),I._initDriver=H(O)})}).catch(function(){U();var Y=new Error("No available storage method found.");return I._driverSet=d.reject(Y),I._driverSet}),E(this._driverSet,T,C),this._driverSet},h.prototype.supports=function(v){return!!Ju[v]},h.prototype._extend=function(v){Ec(this,v)},h.prototype._getSupportedDrivers=function(v){for(var T=[],C=0,I=v.length;C<I;C++){var O=v[C];this.supports(O)&&T.push(O)}return T},h.prototype._wrapLibraryMethodsWithReady=function(){for(var v=0,T=_c.length;v<T;v++)Qd(this,_c[v])},h.prototype.createInstance=function(v){return new h(v)},h}(),eh=new Zd;i.exports=eh},{3:3}]},{},[4])(4)})});var vl=Vi(Os=>{"use strict";Object.defineProperty(Os,"__esModule",{value:!0});Os.URLBuilder=void 0;var kg=function(){function t(e){try{this.base=new URL(e),this.params=new URLSearchParams(this.base.search.slice(1))}catch(r){console.error("Un-parsable URL",r)}}return t.prototype.appendQueryParam=function(e,r){this.params.append(e,r?r.toString():"")},t.prototype.clearQueryParams=function(){return this.params=new URLSearchParams,this},t.prototype.deleteQueryParam=function(e){this.params.delete(e)},t.prototype.getBase=function(){return this.base},t.prototype.getPath=function(){return this.base.pathname},t.prototype.getHostname=function(){return this.base.hostname},t.prototype.getParams=function(){return this.params},t.prototype.getQueryParam=function(e){if(!this.params)return"";var r=this.params.get(e);return!r||r==="undefined"||r==="null"?void 0:r},t.prototype.getQueryString=function(){return this.params.toString()},t.prototype.setPath=function(e){return this.base.pathname=e,this},t.prototype.setQueryParam=function(e,r){return this.params.set(e,r?r.toString():""),this},t.prototype.setQueryString=function(e){if(e)return e[0]==="?"&&(e=e.slice(1)),this.params=new URLSearchParams(e),this},t.prototype.toString=function(){var e=this.params.toString();return e===""?this.base.search="":this.base.search="?"+e,this.base.toString()},t}();Os.URLBuilder=kg});var fd=Vi((Wu,Gu)=>{"use strict";(function(t,e){typeof Wu=="object"&&typeof Gu<"u"?Gu.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self,t.fetchRetry=e())})(Wu,function(){"use strict";var t=function(n,i){if(i=i||{},typeof n!="function")throw new r("fetch must be a function");if(typeof i!="object")throw new r("defaults must be an object");if(i.retries!==void 0&&!e(i.retries))throw new r("retries must be a positive integer");if(i.retryDelay!==void 0&&!e(i.retryDelay)&&typeof i.retryDelay!="function")throw new r("retryDelay must be a positive integer or a function returning a positive integer");if(i.retryOn!==void 0&&!Array.isArray(i.retryOn)&&typeof i.retryOn!="function")throw new r("retryOn property expects an array or function");var o={retries:3,retryDelay:1e3,retryOn:[]};return i=Object.assign(o,i),function(a,l){var m=i.retries,p=i.retryDelay,f=i.retryOn;if(l&&l.retries!==void 0)if(e(l.retries))m=l.retries;else throw new r("retries must be a positive integer");if(l&&l.retryDelay!==void 0)if(e(l.retryDelay)||typeof l.retryDelay=="function")p=l.retryDelay;else throw new r("retryDelay must be a positive integer or a function returning a positive integer");if(l&&l.retryOn)if(Array.isArray(l.retryOn)||typeof l.retryOn=="function")f=l.retryOn;else throw new r("retryOn property expects an array or function");return new Promise(function(d,g){var E=function(P){var R=typeof Request<"u"&&a instanceof Request?a.clone():a;n(R,l).then(function(x){if(Array.isArray(f)&&f.indexOf(x.status)===-1)d(x);else if(typeof f=="function")try{return Promise.resolve(f(P,null,x)).then(function(W){W?N(P,null,x):d(x)}).catch(g)}catch(W){g(W)}else P<m?N(P,null,x):d(x)}).catch(function(x){if(typeof f=="function")try{Promise.resolve(f(P,x,null)).then(function(W){W?N(P,x,null):g(x)}).catch(function(W){g(W)})}catch(W){g(W)}else P<m?N(P,x,null):g(x)})};function N(P,R,x){var W=typeof p=="function"?p(P,R,x):p;setTimeout(function(){E(++P)},W)}E(0)})}};function e(n){return Number.isInteger(n)&&n>=0}function r(n){this.name="ArgumentError",this.message=n}return t})});var Gr={apiURL:"https://api.sdk.letscooee.com",debug:!1,mode:"production"};var Dt=Xt(tn());var rp="9.3.0";var A=class t{static SDK_VERSION=rp;static SDK_VERSION_CODE;static SDK="WEB";static LOG_PREFIX="CooeeSDK";static COOEE="cooee";static SESSION_STORAGE_SCROLL_ID="sleid";static IDLE_TIME_IN_SECONDS=30*60;static IN_APP_WRAPPER_NAME="cooee-wrapper";static IN_APP_CONTAINER_NAME="cooee-container";static IN_APP_DEFAULT_PADDING=15;static EVENT_SCREEN_VIEW="CE Screen View";static EVENT_APP_BACKGROUND="CE App Background";static EVENT_TRIGGER_DISPLAYED="CE Trigger Displayed";static EVENT_CAMPAIGN_HOLDOUT="CE Campaign Holdout";static EVENT_CAMPAIGN_REJECTED="CE Campaign Rejected";static EVENT_CAMPAIGN_FAILED="CE Campaign Failed";static EVENT_TRIGGER_CLOSED="CE Trigger Closed";static EVENT_SCROLL="CE Scroll";static EVENT_TRIGGER_CLICKED="CE Trigger Clicked";static EVENT_FORM_SUBMITTED="CE Form Submitted";static EVENT_ADD_TO_CART="Add To Cart";static EVENT_REMOVE_FROM_CART="Remove From Cart";static EVENT_VIEW_ITEM="View Item";static EVENT_VIEW_CART="View Cart";static EVENT_VIEW_COLLECTION="View Collection";static EVENT_BUY_NOW_CLICKED="Buy Now Clicked";static EVENT_CHECKOUT_STARTED="Checkout Started";static EVENT_REVIEW_CLICKED="Review Clicked";static EVENT_ITEM_THUMBNAIL_CLICKED="Item Thumbnail Clicked";static JS_LOAD_WHITELIST_EVENTS=[this.EVENT_VIEW_ITEM,this.EVENT_VIEW_CART,this.EVENT_VIEW_COLLECTION];static HASH_INITIATE_CHECKOUT="initiate-checkout";static HASH_OPEN_CART_DRAWER="open-cart-drawer";static CTA_EVENT="letscooee:outbound:cta";static ADD_BUNDLE_CTA_INBOUND_EVENT="letscooee:inbound:cta:add-bundle";static CTA_OPEN_CART_EVENT="letscooee:outbound:open-cart";static POPUP_ACTIVITY_EVENT="letscooee:outbound:popup-activities";static THIRD_PARTY_CHECKOUT_EVENT="letscooee:outbound:third-party-initiate-checkout";static CAMPAIGN_DISPLAYED_ACTIVITY="DISPLAYED";static CAMPAIGN_CLICKED_ACTIVITY="CLICKED";static CAMPAIGN_CLOSED_ACTIVITY="CLOSED";static BLACKLISTED_PAGE_NAMES=["collection","product","cart"];static API_CALL_MAX_ATTEMPTS=3;static API_CALL_RETRY_DELAY=1e3;static PLACEHOLDER_IMAGE="https://cdn.global.letscooee.com/images/placeholders/product.png";static CART_UPDATE_BROADCAST="CART_UPDATE";static GRAPHQL_VERSION="2024-10";static GRAPHQL_API_PATH=`/api/${this.GRAPHQL_VERSION}/graphql.json`;static CAMPAIGN_ATTRIBUTE="_letscooee_campaign";static{let e=t.SDK_VERSION.split(".").map(r=>r.padStart(2,"0")).join("");t.SDK_VERSION_CODE=parseInt(e,10)}};var w=class{static log(...e){Dt.default.info(...e)}static debug(...e){Dt.default.debug(...e)}static error(...e){Dt.default.error(...e)}static warn(...e){Dt.default.warn(...e)}static info(...e){Dt.default.info(...e)}static trace(...e){Dt.default.trace(...e)}static configure(e=A.LOG_PREFIX){Dt.default.useDefaults({formatter:function(n){n.unshift(`${e} (v${A.SDK_VERSION}):`)}});let r=this.getDebugParam();(r==="1"||r==="on")&&(localStorage.cooeeLogLevel="TRACE"),localStorage.cooeeLogLevel?Dt.default.setLevel(Dt.default[localStorage.cooeeLogLevel]):Dt.default.setLevel(Gr.debug?Dt.default.TRACE:Dt.default.OFF)}static getDebugParam(){return new URL(location.href).searchParams?.get("cooee-debug")}static logBrand(){let e=`
|
|
2
|
+
display: inline-block;
|
|
3
|
+
font-size: 14px;
|
|
4
|
+
background: linear-gradient(90deg, #d52dc8 25%, #2179e2 82%);
|
|
5
|
+
color: white;
|
|
6
|
+
padding: 4px;
|
|
7
|
+
border-radius: 4px;
|
|
8
|
+
`,r=`
|
|
9
|
+
`;r+=`\u{1F4E3} Drive higher conversions with AI-powered onsite engagement
|
|
10
|
+
`,r+=`\u{1F50D} Track real-time visitor intent & optimize engagement
|
|
11
|
+
`,r+=`\u{1F4CA} Improve Meta Ads ROAS with intent-driven campaigns
|
|
12
|
+
`,r+=`\u{1F6CD}\uFE0F Boost purchases & repeat sales effortlessly
|
|
13
|
+
`,r+=`
|
|
14
|
+
|
|
15
|
+
`,r+=`Learn more: https://www.letscooee.com
|
|
16
|
+
Cooee SDK: v${A.SDK_VERSION}`,console.group("%c Elevate your ecommerce experience with Cooee \u{1F680} ",e),console.log(`%c${r}`,"font-size: 13px; line-height: 1.8;"),console.groupEnd()}};var np=(()=>{class t{static entityMap={'"':"""};static escapeHtml(r){return String(r).replace(/"/g,n=>t.entityMap[n])}}return t})();var qe=class{gaEnabled;gaMeasurementID;pixelPush;website;currencyCount;money;storefrontToken;currency;static get(){return window.CooeeSDK.config}update(e){return e??={},this.gaEnabled=e.gaEnabled,this.gaMeasurementID=e.gaMeasurementID,this.pixelPush=e.pixelPush,this.website=e.website??{},this.currencyCount=e.currencyCount??0,this.money=e.money,this.currency=e.currency,this.storefrontToken=e.storefrontToken,this}};var zi=function(t){return t[t.SINGLE=1]="SINGLE",t[t.EXCLUSION=2]="EXCLUSION",t[t.ABTESTING=3]="ABTESTING",t}(zi||{});var $n=function(t){return t.BEFORE="before",t.AFTER="after",t.INSIDE_FIRST="insideFirst",t.INSIDE_LAST="insideLast",t}($n||{}),cr=function(t){return t.SHOPIFY_CHECKOUT="shopify_checkout",t.THIRD_PARTY_CHECKOUT="third_party_checkout",t.CART_PAGE="cart_page",t.CART_DRAWER="cart_drawer",t}(cr||{});var Yi=function(t){return t.POPUP="POPUP",t.PAGE_EMBED="PAGE_EMBED",t.CART_EMBED="CART_EMBED",t.ANNOUNCEMENT_BAR="ANNOUNCEMENT_BAR",t}(Yi||{}),lr=function(t){return t.PRODUCT_PROMOTION="PRODUCT_PROMOTION",t.BUNDLE_AND_UPSELL="BUNDLE_AND_UPSELL",t.CART_RECOVERY="CART_RECOVERY",t.ANNOUNCEMENT="ANNOUNCEMENT",t.LEAD_GENERATION="LEAD_GENERATION",t.DATA_COLLECTION="DATA_COLLECTION",t.SALE_PROMOTION="SALE_PROMOTION",t.SUBSCRIPTION_UPSELL="SUBSCRIPTION_UPSELL",t.SHOPPABLE_VIDEO="SHOPPABLE_VIDEO",t.BYOB="BYOB",t.PROGRESS_BAR="PROGRESS_BAR",t}(lr||{}),qi=function(t){return t.COOEE="COOEE",t.KLAVIYO="KLAVIYO",t}(qi||{}),Ic=function(t){return t.ICONS="ICONS",t.TILES="TILES",t}(Ic||{}),Tc=function(t){return t.FREE_SHIPPING="FREE_SHIPPING",t.DISCOUNT="DISCOUNT",t.FREE_AUTO_GIFT="FREE_AUTO_GIFT",t.FREE_GIFT_SELECT="FREE_GIFT_SELECT",t}(Tc||{});var ur=function(t){return t[t.NONE=0]="NONE",t[t.STATIC=1]="STATIC",t[t.UNIQUE_FLAT=2]="UNIQUE_FLAT",t[t.UNIQUE_FLAT_ITEMS=3]="UNIQUE_FLAT_ITEMS",t[t.UNIQUE_FIXED_ITEMS=4]="UNIQUE_FIXED_ITEMS",t[t.UNIQUE_CHEAPEST_ITEM_FREE=5]="UNIQUE_CHEAPEST_ITEM_FREE",t}(ur||{});var jn=class t{static of(e,r){return r!==void 0?new Array(e).fill(r):Array.from({length:e},(n,i)=>i)}static remove(e,r){let n=e.indexOf(r);return n===-1?!1:(e.splice(n,1),!0)}static swap(e,r,n){[e[r],e[n]]=[e[n],e[r]]}static sum(e,r){return e.reduce((n,i)=>n+Math.max(r?r(i):+i,0),0)}static unique(e,r){return e.filter((n,i,o)=>o.findIndex(s=>s[r]===n[r])===i)}static shuffle(e){let r=e.length;for(;r!=0;){let n=Math.floor(Math.random()*r);r--,t.swap(e,r,n)}}};var Xo,_e,cp,Rc,rn,ip,lp,xc,up,Nc,Cc,Dc,mh,Ki={},pp=[],dh=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Oc=Array.isArray;function Vr(t,e){for(var r in e)t[r]=e[r];return t}function Ac(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function Ji(t,e,r){var n,i,o,s={};for(o in e)o=="key"?n=e[o]:o=="ref"?i=e[o]:s[o]=e[o];if(arguments.length>2&&(s.children=arguments.length>3?Xo.call(arguments,2):r),typeof t=="function"&&t.defaultProps!=null)for(o in t.defaultProps)s[o]===void 0&&(s[o]=t.defaultProps[o]);return Ko(t,s,n,i,null)}function Ko(t,e,r,n,i){var o={type:t,props:e,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++cp,__i:-1,__u:0};return i==null&&_e.vnode!=null&&_e.vnode(o),o}function fr(t){return t.children}function pr(t,e){this.props=t,this.context=e}function Wn(t,e){if(e==null)return t.__?Wn(t.__,t.__i+1):null;for(var r;e<t.__k.length;e++)if((r=t.__k[e])!=null&&r.__e!=null)return r.__e;return typeof t.type=="function"?Wn(t):null}function fp(t){var e,r;if((t=t.__)!=null&&t.__c!=null){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if((r=t.__k[e])!=null&&r.__e!=null){t.__e=t.__c.base=r.__e;break}return fp(t)}}function op(t){(!t.__d&&(t.__d=!0)&&rn.push(t)&&!Jo.__r++||ip!==_e.debounceRendering)&&((ip=_e.debounceRendering)||lp)(Jo)}function Jo(){var t,e,r,n,i,o,s,a;for(rn.sort(xc);t=rn.shift();)t.__d&&(e=rn.length,n=void 0,o=(i=(r=t).__v).__e,s=[],a=[],r.__P&&((n=Vr({},i)).__v=i.__v+1,_e.vnode&&_e.vnode(n),Pc(r.__P,n,i,r.__n,r.__P.namespaceURI,32&i.__u?[o]:null,s,o??Wn(i),!!(32&i.__u),a),n.__v=i.__v,n.__.__k[n.__i]=n,hp(s,n,a),n.__e!=o&&fp(n)),rn.length>e&&rn.sort(xc));Jo.__r=0}function mp(t,e,r,n,i,o,s,a,l,m,p){var f,d,g,E,N,P,R=n&&n.__k||pp,x=e.length;for(l=hh(r,e,R,l,x),f=0;f<x;f++)(g=r.__k[f])!=null&&(d=g.__i===-1?Ki:R[g.__i]||Ki,g.__i=f,P=Pc(t,g,d,i,o,s,a,l,m,p),E=g.__e,g.ref&&d.ref!=g.ref&&(d.ref&&Lc(d.ref,null,g),p.push(g.ref,g.__c||E,g)),N==null&&E!=null&&(N=E),4&g.__u||d.__k===g.__k?l=dp(g,l,t):typeof g.type=="function"&&P!==void 0?l=P:E&&(l=E.nextSibling),g.__u&=-7);return r.__e=N,l}function hh(t,e,r,n,i){var o,s,a,l,m,p=r.length,f=p,d=0;for(t.__k=new Array(i),o=0;o<i;o++)(s=e[o])!=null&&typeof s!="boolean"&&typeof s!="function"?(l=o+d,(s=t.__k[o]=typeof s=="string"||typeof s=="number"||typeof s=="bigint"||s.constructor==String?Ko(null,s,null,null,null):Oc(s)?Ko(fr,{children:s},null,null,null):s.constructor===void 0&&s.__b>0?Ko(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s).__=t,s.__b=t.__b+1,a=null,(m=s.__i=gh(s,r,l,f))!==-1&&(f--,(a=r[m])&&(a.__u|=2)),a==null||a.__v===null?(m==-1&&d--,typeof s.type!="function"&&(s.__u|=4)):m!=l&&(m==l-1?d--:m==l+1?d++:(m>l?d--:d++,s.__u|=4))):t.__k[o]=null;if(f)for(o=0;o<p;o++)(a=r[o])!=null&&(2&a.__u)==0&&(a.__e==n&&(n=Wn(a)),gp(a,a));return n}function dp(t,e,r){var n,i;if(typeof t.type=="function"){for(n=t.__k,i=0;n&&i<n.length;i++)n[i]&&(n[i].__=t,e=dp(n[i],e,r));return e}t.__e!=e&&(e&&t.type&&!r.contains(e)&&(e=Wn(t)),r.insertBefore(t.__e,e||null),e=t.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function gh(t,e,r,n){var i,o,s=t.key,a=t.type,l=e[r];if(l===null||l&&s==l.key&&a===l.type&&(2&l.__u)==0)return r;if(n>(l!=null&&(2&l.__u)==0?1:0))for(i=r-1,o=r+1;i>=0||o<e.length;){if(i>=0){if((l=e[i])&&(2&l.__u)==0&&s==l.key&&a===l.type)return i;i--}if(o<e.length){if((l=e[o])&&(2&l.__u)==0&&s==l.key&&a===l.type)return o;o++}}return-1}function sp(t,e,r){e[0]=="-"?t.setProperty(e,r??""):t[e]=r==null?"":typeof r!="number"||dh.test(e)?r:r+"px"}function qo(t,e,r,n,i){var o;e:if(e=="style")if(typeof r=="string")t.style.cssText=r;else{if(typeof n=="string"&&(t.style.cssText=n=""),n)for(e in n)r&&e in r||sp(t.style,e,"");if(r)for(e in r)n&&r[e]===n[e]||sp(t.style,e,r[e])}else if(e[0]=="o"&&e[1]=="n")o=e!=(e=e.replace(up,"$1")),e=e.toLowerCase()in t||e=="onFocusOut"||e=="onFocusIn"?e.toLowerCase().slice(2):e.slice(2),t.l||(t.l={}),t.l[e+o]=r,r?n?r.u=n.u:(r.u=Nc,t.addEventListener(e,o?Dc:Cc,o)):t.removeEventListener(e,o?Dc:Cc,o);else{if(i=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in t)try{t[e]=r??"";break e}catch{}typeof r=="function"||(r==null||r===!1&&e[4]!="-"?t.removeAttribute(e):t.setAttribute(e,e=="popover"&&r==1?"":r))}}function ap(t){return function(e){if(this.l){var r=this.l[e.type+t];if(e.t==null)e.t=Nc++;else if(e.t<r.u)return;return r(_e.event?_e.event(e):e)}}}function Pc(t,e,r,n,i,o,s,a,l,m){var p,f,d,g,E,N,P,R,x,W,$,ie,k,X,z,oe,Ce,de=e.type;if(e.constructor!==void 0)return null;128&r.__u&&(l=!!(32&r.__u),o=[a=e.__e=r.__e]),(p=_e.__b)&&p(e);e:if(typeof de=="function")try{if(R=e.props,x="prototype"in de&&de.prototype.render,W=(p=de.contextType)&&n[p.__c],$=p?W?W.props.value:p.__:n,r.__c?P=(f=e.__c=r.__c).__=f.__E:(x?e.__c=f=new de(R,$):(e.__c=f=new pr(R,$),f.constructor=de,f.render=vh),W&&W.sub(f),f.props=R,f.state||(f.state={}),f.context=$,f.__n=n,d=f.__d=!0,f.__h=[],f._sb=[]),x&&f.__s==null&&(f.__s=f.state),x&&de.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=Vr({},f.__s)),Vr(f.__s,de.getDerivedStateFromProps(R,f.__s))),g=f.props,E=f.state,f.__v=e,d)x&&de.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),x&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(x&&de.getDerivedStateFromProps==null&&R!==g&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(R,$),!f.__e&&(f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(R,f.__s,$)===!1||e.__v==r.__v)){for(e.__v!=r.__v&&(f.props=R,f.state=f.__s,f.__d=!1),e.__e=r.__e,e.__k=r.__k,e.__k.some(function(be){be&&(be.__=e)}),ie=0;ie<f._sb.length;ie++)f.__h.push(f._sb[ie]);f._sb=[],f.__h.length&&s.push(f);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(R,f.__s,$),x&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(g,E,N)})}if(f.context=$,f.props=R,f.__P=t,f.__e=!1,k=_e.__r,X=0,x){for(f.state=f.__s,f.__d=!1,k&&k(e),p=f.render(f.props,f.state,f.context),z=0;z<f._sb.length;z++)f.__h.push(f._sb[z]);f._sb=[]}else do f.__d=!1,k&&k(e),p=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++X<25);f.state=f.__s,f.getChildContext!=null&&(n=Vr(Vr({},n),f.getChildContext())),x&&!d&&f.getSnapshotBeforeUpdate!=null&&(N=f.getSnapshotBeforeUpdate(g,E)),a=mp(t,Oc(oe=p!=null&&p.type===fr&&p.key==null?p.props.children:p)?oe:[oe],e,r,n,i,o,s,a,l,m),f.base=e.__e,e.__u&=-161,f.__h.length&&s.push(f),P&&(f.__E=f.__=null)}catch(be){if(e.__v=null,l||o!=null)if(be.then){for(e.__u|=l?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;o[o.indexOf(a)]=null,e.__e=a}else for(Ce=o.length;Ce--;)Ac(o[Ce]);else e.__e=r.__e,e.__k=r.__k;_e.__e(be,e,r)}else o==null&&e.__v==r.__v?(e.__k=r.__k,e.__e=r.__e):a=e.__e=yh(r.__e,e,r,n,i,o,s,l,m);return(p=_e.diffed)&&p(e),128&e.__u?void 0:a}function hp(t,e,r){for(var n=0;n<r.length;n++)Lc(r[n],r[++n],r[++n]);_e.__c&&_e.__c(e,t),t.some(function(i){try{t=i.__h,i.__h=[],t.some(function(o){o.call(i)})}catch(o){_e.__e(o,i.__v)}})}function yh(t,e,r,n,i,o,s,a,l){var m,p,f,d,g,E,N,P=r.props,R=e.props,x=e.type;if(x=="svg"?i="http://www.w3.org/2000/svg":x=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),o!=null){for(m=0;m<o.length;m++)if((g=o[m])&&"setAttribute"in g==!!x&&(x?g.localName==x:g.nodeType==3)){t=g,o[m]=null;break}}if(t==null){if(x==null)return document.createTextNode(R);t=document.createElementNS(i,x,R.is&&R),a&&(_e.__m&&_e.__m(e,o),a=!1),o=null}if(x===null)P===R||a&&t.data===R||(t.data=R);else{if(o=o&&Xo.call(t.childNodes),P=r.props||Ki,!a&&o!=null)for(P={},m=0;m<t.attributes.length;m++)P[(g=t.attributes[m]).name]=g.value;for(m in P)if(g=P[m],m!="children"){if(m=="dangerouslySetInnerHTML")f=g;else if(!(m in R)){if(m=="value"&&"defaultValue"in R||m=="checked"&&"defaultChecked"in R)continue;qo(t,m,null,g,i)}}for(m in R)g=R[m],m=="children"?d=g:m=="dangerouslySetInnerHTML"?p=g:m=="value"?E=g:m=="checked"?N=g:a&&typeof g!="function"||P[m]===g||qo(t,m,g,P[m],i);if(p)a||f&&(p.__html===f.__html||p.__html===t.innerHTML)||(t.innerHTML=p.__html),e.__k=[];else if(f&&(t.innerHTML=""),mp(t,Oc(d)?d:[d],e,r,n,x=="foreignObject"?"http://www.w3.org/1999/xhtml":i,o,s,o?o[0]:r.__k&&Wn(r,0),a,l),o!=null)for(m=o.length;m--;)Ac(o[m]);a||(m="value",x=="progress"&&E==null?t.removeAttribute("value"):E!==void 0&&(E!==t[m]||x=="progress"&&!E||x=="option"&&E!==P[m])&&qo(t,m,E,P[m],i),m="checked",N!==void 0&&N!==t[m]&&qo(t,m,N,P[m],i))}return t}function Lc(t,e,r){try{if(typeof t=="function"){var n=typeof t.__u=="function";n&&t.__u(),n&&e==null||(t.__u=t(e))}else t.current=e}catch(i){_e.__e(i,r)}}function gp(t,e,r){var n,i;if(_e.unmount&&_e.unmount(t),(n=t.ref)&&(n.current&&n.current!==t.__e||Lc(n,null,e)),(n=t.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(o){_e.__e(o,e)}n.base=n.__P=null}if(n=t.__k)for(i=0;i<n.length;i++)n[i]&&gp(n[i],e,r||typeof t.type!="function");r||Ac(t.__e),t.__c=t.__=t.__e=void 0}function vh(t,e,r){return this.constructor(t,r)}function Qo(t,e,r){var n,i,o,s;e==document&&(e=document.documentElement),_e.__&&_e.__(t,e),i=(n=typeof r=="function")?null:r&&r.__k||e.__k,o=[],s=[],Pc(e,t=(!n&&r||e).__k=Ji(fr,null,[t]),i||Ki,Ki,e.namespaceURI,!n&&r?[r]:i?null:e.firstChild?Xo.call(e.childNodes):null,o,!n&&r?r:i?i.__e:e.firstChild,n,s),hp(o,t,s)}Xo=pp.slice,_e={__e:function(t,e,r,n){for(var i,o,s;e=e.__;)if((i=e.__c)&&!i.__)try{if((o=i.constructor)&&o.getDerivedStateFromError!=null&&(i.setState(o.getDerivedStateFromError(t)),s=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(t,n||{}),s=i.__d),s)return i.__E=i}catch(a){t=a}throw t}},cp=0,Rc=function(t){return t!=null&&t.constructor==null},pr.prototype.setState=function(t,e){var r;r=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=Vr({},this.state),typeof t=="function"&&(t=t(Vr({},r),this.props)),t&&Vr(r,t),t!=null&&this.__v&&(e&&this._sb.push(e),op(this))},pr.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),op(this))},pr.prototype.render=fr,rn=[],lp=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,xc=function(t,e){return t.__v.__b-e.__v.__b},Jo.__r=0,up=/(PointerCapture)$|Capture$/i,Nc=0,Cc=ap(!1),Dc=ap(!0),mh=0;var Uc,Rt,Bc,yp,vp=0,xp=[],Ke=_e,_p=Ke.__b,Ep=Ke.__r,Sp=Ke.diffed,bp=Ke.__c,wp=Ke.unmount,Ip=Ke.__;function _h(t,e){Ke.__h&&Ke.__h(Rt,t,vp||e),vp=0;var r=Rt.__H||(Rt.__H={__:[],__h:[]});return t>=r.__.length&&r.__.push({}),r.__[t]}function kc(t,e){var r=_h(Uc++,7);return bh(r.__H,e)&&(r.__=t(),r.__H=e,r.__h=t),r.__}function Eh(){for(var t;t=xp.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(Zo),t.__H.__h.forEach(Mc),t.__H.__h=[]}catch(e){t.__H.__h=[],Ke.__e(e,t.__v)}}Ke.__b=function(t){Rt=null,_p&&_p(t)},Ke.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),Ip&&Ip(t,e)},Ke.__r=function(t){Ep&&Ep(t),Uc=0;var e=(Rt=t.__c).__H;e&&(Bc===Rt?(e.__h=[],Rt.__h=[],e.__.forEach(function(r){r.__N&&(r.__=r.__N),r.i=r.__N=void 0})):(e.__h.forEach(Zo),e.__h.forEach(Mc),e.__h=[],Uc=0)),Bc=Rt},Ke.diffed=function(t){Sp&&Sp(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(xp.push(e)!==1&&yp===Ke.requestAnimationFrame||((yp=Ke.requestAnimationFrame)||Sh)(Eh)),e.__H.__.forEach(function(r){r.i&&(r.__H=r.i),r.i=void 0})),Bc=Rt=null},Ke.__c=function(t,e){e.some(function(r){try{r.__h.forEach(Zo),r.__h=r.__h.filter(function(n){return!n.__||Mc(n)})}catch(n){e.some(function(i){i.__h&&(i.__h=[])}),e=[],Ke.__e(n,r.__v)}}),bp&&bp(t,e)},Ke.unmount=function(t){wp&&wp(t);var e,r=t.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{Zo(n)}catch(i){e=i}}),r.__H=void 0,e&&Ke.__e(e,r.__v))};var Tp=typeof requestAnimationFrame=="function";function Sh(t){var e,r=function(){clearTimeout(n),Tp&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(r,100);Tp&&(e=requestAnimationFrame(r))}function Zo(t){var e=Rt,r=t.__c;typeof r=="function"&&(t.__c=void 0,r()),Rt=e}function Mc(t){var e=Rt;t.__c=t.__(),Rt=e}function bh(t,e){return!t||t.length!==e.length||e.some(function(r,n){return r!==t[n]})}var wh=Symbol.for("preact-signals");function Hc(){if(Gn>1)Gn--;else{for(var t,e=!1;Xi!==void 0;){var r=Xi;for(Xi=void 0,Fc++;r!==void 0;){var n=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&Dp(r))try{r.c()}catch(i){e||(t=i,e=!0)}r=n}}if(Fc=0,Gn--,e)throw t}}var Re=void 0;var Xi=void 0,Gn=0,Fc=0,es=0;function Cp(t){if(Re!==void 0){var e=t.n;if(e===void 0||e.t!==Re)return e={i:0,S:t,p:Re.s,n:void 0,t:Re,e:void 0,x:void 0,r:e},Re.s!==void 0&&(Re.s.n=e),Re.s=e,t.n=e,32&Re.f&&t.S(e),e;if(e.i===-1)return e.i=0,e.n!==void 0&&(e.n.p=e.p,e.p!==void 0&&(e.p.n=e.n),e.p=Re.s,e.n=void 0,Re.s.n=e,Re.s=e),e}}function Je(t){this.v=t,this.i=0,this.n=void 0,this.t=void 0}Je.prototype.brand=wh;Je.prototype.h=function(){return!0};Je.prototype.S=function(t){this.t!==t&&t.e===void 0&&(t.x=this.t,this.t!==void 0&&(this.t.e=t),this.t=t)};Je.prototype.U=function(t){if(this.t!==void 0){var e=t.e,r=t.x;e!==void 0&&(e.x=r,t.e=void 0),r!==void 0&&(r.e=e,t.x=void 0),t===this.t&&(this.t=r)}};Je.prototype.subscribe=function(t){var e=this;return nt(function(){var r=e.value,n=Re;Re=void 0;try{t(r)}finally{Re=n}})};Je.prototype.valueOf=function(){return this.value};Je.prototype.toString=function(){return this.value+""};Je.prototype.toJSON=function(){return this.value};Je.prototype.peek=function(){var t=Re;Re=void 0;try{return this.value}finally{Re=t}};Object.defineProperty(Je.prototype,"value",{get:function(){var t=Cp(this);return t!==void 0&&(t.i=this.i),this.v},set:function(t){if(t!==this.v){if(Fc>100)throw new Error("Cycle detected");this.v=t,this.i++,es++,Gn++;try{for(var e=this.t;e!==void 0;e=e.x)e.t.N()}finally{Hc()}}}});function Qt(t){return new Je(t)}function Dp(t){for(var e=t.s;e!==void 0;e=e.n)if(e.S.i!==e.i||!e.S.h()||e.S.i!==e.i)return!0;return!1}function Rp(t){for(var e=t.s;e!==void 0;e=e.n){var r=e.S.n;if(r!==void 0&&(e.r=r),e.S.n=e,e.i=-1,e.n===void 0){t.s=e;break}}}function Np(t){for(var e=t.s,r=void 0;e!==void 0;){var n=e.p;e.i===-1?(e.S.U(e),n!==void 0&&(n.n=e.n),e.n!==void 0&&(e.n.p=n)):r=e,e.S.n=e.r,e.r!==void 0&&(e.r=void 0),e=n}t.s=r}function Vn(t){Je.call(this,void 0),this.x=t,this.s=void 0,this.g=es-1,this.f=4}(Vn.prototype=new Je).h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===es))return!0;if(this.g=es,this.f|=1,this.i>0&&!Dp(this))return this.f&=-2,!0;var t=Re;try{Rp(this),Re=this;var e=this.x();(16&this.f||this.v!==e||this.i===0)&&(this.v=e,this.f&=-17,this.i++)}catch(r){this.v=r,this.f|=16,this.i++}return Re=t,Np(this),this.f&=-2,!0};Vn.prototype.S=function(t){if(this.t===void 0){this.f|=36;for(var e=this.s;e!==void 0;e=e.n)e.S.S(e)}Je.prototype.S.call(this,t)};Vn.prototype.U=function(t){if(this.t!==void 0&&(Je.prototype.U.call(this,t),this.t===void 0)){this.f&=-33;for(var e=this.s;e!==void 0;e=e.n)e.S.U(e)}};Vn.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var t=this.t;t!==void 0;t=t.x)t.t.N()}};Object.defineProperty(Vn.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var t=Cp(this);if(this.h(),t!==void 0&&(t.i=this.i),16&this.f)throw this.v;return this.v}});function $c(t){return new Vn(t)}function Op(t){var e=t.u;if(t.u=void 0,typeof e=="function"){Gn++;var r=Re;Re=void 0;try{e()}catch(n){throw t.f&=-2,t.f|=8,jc(t),n}finally{Re=r,Hc()}}}function jc(t){for(var e=t.s;e!==void 0;e=e.n)e.S.U(e);t.x=void 0,t.s=void 0,Op(t)}function Ih(t){if(Re!==this)throw new Error("Out-of-order effect");Np(this),Re=t,this.f&=-2,8&this.f&&jc(this),Hc()}function Qi(t){this.x=t,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}Qi.prototype.c=function(){var t=this.S();try{if(8&this.f||this.x===void 0)return;var e=this.x();typeof e=="function"&&(this.u=e)}finally{t()}};Qi.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Op(this),Rp(this),Gn++;var t=Re;return Re=this,Ih.bind(this,t)};Qi.prototype.N=function(){2&this.f||(this.f|=2,this.o=Xi,Xi=this)};Qi.prototype.d=function(){this.f|=8,1&this.f||jc(this)};function nt(t){var e=new Qi(t);try{e.c()}catch(r){throw e.d(),r}return e.d.bind(e)}var Gc,Wc;function zn(t,e){_e[t]=e.bind(null,_e[t]||function(){})}function ts(t){Wc&&Wc(),Wc=t&&t.S()}function Ap(t){var e=this,r=t.data,n=xh(r);n.value=r;var i=kc(function(){for(var o=e.__v;o=o.__;)if(o.__c){o.__c.__$f|=4;break}return e.__$u.c=function(){var s,a=e.__$u.S(),l=i.value;a(),Rc(l)||((s=e.base)==null?void 0:s.nodeType)!==3?(e.__$f|=1,e.setState({})):e.base.data=l},$c(function(){var s=n.value.value;return s===0?0:s===!0?"":s||""})},[]);return i.value}Ap.displayName="_st";Object.defineProperties(Je.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:Ap},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}});zn("__b",function(t,e){if(typeof e.type=="string"){var r,n=e.props;for(var i in n)if(i!=="children"){var o=n[i];o instanceof Je&&(r||(e.__np=r={}),r[i]=o,n[i]=o.peek())}}t(e)});zn("__r",function(t,e){ts();var r,n=e.__c;n&&(n.__$f&=-2,(r=n.__$u)===void 0&&(n.__$u=r=function(i){var o;return nt(function(){o=this}),o.c=function(){n.__$f|=1,n.setState({})},o}())),Gc=n,ts(r),t(e)});zn("__e",function(t,e,r,n){ts(),Gc=void 0,t(e,r,n)});zn("diffed",function(t,e){ts(),Gc=void 0;var r;if(typeof e.type=="string"&&(r=e.__e)){var n=e.__np,i=e.props;if(n){var o=r.U;if(o)for(var s in o){var a=o[s];a!==void 0&&!(s in n)&&(a.d(),o[s]=void 0)}else r.U=o={};for(var l in n){var m=o[l],p=n[l];m===void 0?(m=Th(r,l,p,i),o[l]=m):m.o(p,i)}}}t(e)});function Th(t,e,r,n){var i=e in t&&t.ownerSVGElement===void 0,o=Qt(r);return{o:function(s,a){o.value=s,n=a},d:nt(function(){var s=o.value.value;n[e]!==s&&(n[e]=s,i?t[e]=s:s?t.setAttribute(e,s):t.removeAttribute(e))})}}zn("unmount",function(t,e){if(typeof e.type=="string"){var r=e.__e;if(r){var n=r.U;if(n){r.U=void 0;for(var i in n){var o=n[i];o&&o.d()}}}}else{var s=e.__c;if(s){var a=s.__$u;a&&(s.__$u=void 0,a.d())}}t(e)});zn("__h",function(t,e,r,n){(n<3||n===9)&&(e.__$f|=2),t(e,r,n)});pr.prototype.shouldComponentUpdate=function(t,e){var r=this.__$u,n=r&&r.s!==void 0;for(var i in e)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){if(!(n||2&this.__$f||4&this.__$f)||1&this.__$f)return!0}else if(!(n||4&this.__$f)||3&this.__$f)return!0;for(var o in t)if(o!=="__source"&&t[o]!==this.props[o])return!0;for(var s in this.props)if(!(s in t))return!0;return!1};function xh(t){return kc(function(){return Qt(t)},[])}var Ch=Object.prototype.toString,qn=Array.isArray||function(e){return Ch.call(e)==="[object Array]"};function zc(t){return typeof t=="function"}function Dh(t){return qn(t)?"array":typeof t}function Vc(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Pp(t,e){return t!=null&&typeof t=="object"&&e in t}function Rh(t,e){return t!=null&&typeof t!="object"&&t.hasOwnProperty&&t.hasOwnProperty(e)}var Nh=RegExp.prototype.test;function Oh(t,e){return Nh.call(t,e)}var Ah=/\S/;function Ph(t){return!Oh(Ah,t)}var Lh={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};function Bh(t){return String(t).replace(/[&<>"'`=\/]/g,function(r){return Lh[r]})}var Uh=/\s*/,Mh=/\s+/,Lp=/\s*=/,kh=/\s*\}/,Fh=/#|\^|\/|>|\{|&|=|!/;function Hh(t,e){if(!t)return[];var r=!1,n=[],i=[],o=[],s=!1,a=!1,l="",m=0;function p(){if(s&&!a)for(;o.length;)delete i[o.pop()];else o=[];s=!1,a=!1}var f,d,g;function E(z){if(typeof z=="string"&&(z=z.split(Mh,2)),!qn(z)||z.length!==2)throw new Error("Invalid tags: "+z);f=new RegExp(Vc(z[0])+"\\s*"),d=new RegExp("\\s*"+Vc(z[1])),g=new RegExp("\\s*"+Vc("}"+z[1]))}E(e||Mt.tags);for(var N=new eo(t),P,R,x,W,$,ie;!N.eos();){if(P=N.pos,x=N.scanUntil(f),x)for(var k=0,X=x.length;k<X;++k)W=x.charAt(k),Ph(W)?(o.push(i.length),l+=W):(a=!0,r=!0,l+=" "),i.push(["text",W,P,P+1]),P+=1,W===`
|
|
17
|
+
`&&(p(),l="",m=0,r=!1);if(!N.scan(f))break;if(s=!0,R=N.scan(Fh)||"name",N.scan(Uh),R==="="?(x=N.scanUntil(Lp),N.scan(Lp),N.scanUntil(d)):R==="{"?(x=N.scanUntil(g),N.scan(kh),N.scanUntil(d),R="&"):x=N.scanUntil(d),!N.scan(d))throw new Error("Unclosed tag at "+N.pos);if(R==">"?$=[R,x,P,N.pos,l,m,r]:$=[R,x,P,N.pos],m++,i.push($),R==="#"||R==="^")n.push($);else if(R==="/"){if(ie=n.pop(),!ie)throw new Error('Unopened section "'+x+'" at '+P);if(ie[1]!==x)throw new Error('Unclosed section "'+ie[1]+'" at '+P)}else R==="name"||R==="{"||R==="&"?a=!0:R==="="&&E(x)}if(p(),ie=n.pop(),ie)throw new Error('Unclosed section "'+ie[1]+'" at '+N.pos);return jh($h(i))}function $h(t){for(var e=[],r,n,i=0,o=t.length;i<o;++i)r=t[i],r&&(r[0]==="text"&&n&&n[0]==="text"?(n[1]+=r[1],n[3]=r[3]):(e.push(r),n=r));return e}function jh(t){for(var e=[],r=e,n=[],i,o,s=0,a=t.length;s<a;++s)switch(i=t[s],i[0]){case"#":case"^":r.push(i),n.push(i),r=i[4]=[];break;case"/":o=n.pop(),o[5]=i[2],r=n.length>0?n[n.length-1][4]:e;break;default:r.push(i)}return e}function eo(t){this.string=t,this.tail=t,this.pos=0}eo.prototype.eos=function(){return this.tail===""};eo.prototype.scan=function(e){var r=this.tail.match(e);if(!r||r.index!==0)return"";var n=r[0];return this.tail=this.tail.substring(n.length),this.pos+=n.length,n};eo.prototype.scanUntil=function(e){var r=this.tail.search(e),n;switch(r){case-1:n=this.tail,this.tail="";break;case 0:n="";break;default:n=this.tail.substring(0,r),this.tail=this.tail.substring(r)}return this.pos+=n.length,n};function Yn(t,e){this.view=t,this.cache={".":this.view},this.parent=e}Yn.prototype.push=function(e){return new Yn(e,this)};Yn.prototype.lookup=function(e){var r=this.cache,n;if(r.hasOwnProperty(e))n=r[e];else{for(var i=this,o,s,a,l=!1;i;){if(e.indexOf(".")>0)for(o=i.view,s=e.split("."),a=0;o!=null&&a<s.length;)a===s.length-1&&(l=Pp(o,s[a])||Rh(o,s[a])),o=o[s[a++]];else o=i.view[e],l=Pp(i.view,e);if(l){n=o;break}i=i.parent}r[e]=n}return zc(n)&&(n=n.call(this.view)),n};function dt(){this.templateCache={_cache:{},set:function(e,r){this._cache[e]=r},get:function(e){return this._cache[e]},clear:function(){this._cache={}}}}dt.prototype.clearCache=function(){typeof this.templateCache<"u"&&this.templateCache.clear()};dt.prototype.parse=function(e,r){var n=this.templateCache,i=e+":"+(r||Mt.tags).join(":"),o=typeof n<"u",s=o?n.get(i):void 0;return s==null&&(s=Hh(e,r),o&&n.set(i,s)),s};dt.prototype.render=function(e,r,n,i){var o=this.getConfigTags(i),s=this.parse(e,o),a=r instanceof Yn?r:new Yn(r,void 0);return this.renderTokens(s,a,n,e,i)};dt.prototype.renderTokens=function(e,r,n,i,o){for(var s="",a,l,m,p=0,f=e.length;p<f;++p)m=void 0,a=e[p],l=a[0],l==="#"?m=this.renderSection(a,r,n,i,o):l==="^"?m=this.renderInverted(a,r,n,i,o):l===">"?m=this.renderPartial(a,r,n,o):l==="&"?m=this.unescapedValue(a,r):l==="name"?m=this.escapedValue(a,r,o):l==="text"&&(m=this.rawValue(a)),m!==void 0&&(s+=m);return s};dt.prototype.renderSection=function(e,r,n,i,o){var s=this,a="",l=r.lookup(e[1]);function m(d){return s.render(d,r,n,o)}if(l){if(qn(l))for(var p=0,f=l.length;p<f;++p)a+=this.renderTokens(e[4],r.push(l[p]),n,i,o);else if(typeof l=="object"||typeof l=="string"||typeof l=="number")a+=this.renderTokens(e[4],r.push(l),n,i,o);else if(zc(l)){if(typeof i!="string")throw new Error("Cannot use higher-order sections without the original template");l=l.call(r.view,i.slice(e[3],e[5]),m),l!=null&&(a+=l)}else a+=this.renderTokens(e[4],r,n,i,o);return a}};dt.prototype.renderInverted=function(e,r,n,i,o){var s=r.lookup(e[1]);if(!s||qn(s)&&s.length===0)return this.renderTokens(e[4],r,n,i,o)};dt.prototype.indentPartial=function(e,r,n){for(var i=r.replace(/[^ \t]/g,""),o=e.split(`
|
|
18
|
+
`),s=0;s<o.length;s++)o[s].length&&(s>0||!n)&&(o[s]=i+o[s]);return o.join(`
|
|
19
|
+
`)};dt.prototype.renderPartial=function(e,r,n,i){if(n){var o=this.getConfigTags(i),s=zc(n)?n(e[1]):n[e[1]];if(s!=null){var a=e[6],l=e[5],m=e[4],p=s;l==0&&m&&(p=this.indentPartial(s,m,a));var f=this.parse(p,o);return this.renderTokens(f,r,n,p,i)}}};dt.prototype.unescapedValue=function(e,r){var n=r.lookup(e[1]);if(n!=null)return n};dt.prototype.escapedValue=function(e,r,n){var i=this.getConfigEscape(n)||Mt.escape,o=r.lookup(e[1]);if(o!=null)return typeof o=="number"&&i===Mt.escape?String(o):i(o)};dt.prototype.rawValue=function(e){return e[1]};dt.prototype.getConfigTags=function(e){return qn(e)?e:e&&typeof e=="object"?e.tags:void 0};dt.prototype.getConfigEscape=function(e){if(e&&typeof e=="object"&&!qn(e))return e.escape};var Mt={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(t){Zi.templateCache=t},get templateCache(){return Zi.templateCache}},Zi=new dt;Mt.clearCache=function(){return Zi.clearCache()};Mt.parse=function(e,r){return Zi.parse(e,r)};Mt.render=function(e,r,n,i){if(typeof e!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+Dh(e)+'" was given as the first argument for mustache#render(template, view, partials)');return Zi.render(e,r,n,i)};Mt.escape=Bh;Mt.Scanner=eo;Mt.Context=Yn;Mt.Writer=dt;var Zt=Mt;var Up=Xt(Bp()),Nt=class t{static DOCUMENT_STANDARD_MODE="CSS1Compat";static _instance;parentContainer;scalingFactor=1;doc=document;parser=new Up.default;constructor(){}static get(){return t._instance||(t._instance=new t),t._instance}getUAParser(){return this.parser}getWidth(){return this.parentContainer&&this.parentContainer!==document.body?this.parentContainer.clientWidth:document.compatMode===t.DOCUMENT_STANDARD_MODE?document.documentElement.clientWidth:window.innerWidth}getHeight(){return this.isParentNotBody()?this.parentContainer.clientHeight:document.compatMode===t.DOCUMENT_STANDARD_MODE?document.documentElement.clientHeight:window.innerHeight}isMobile(){return this.parser.getDevice().type==="mobile"}calculateScalingFactor(e){let r=e.max,n=e.cont.w,i=e.cont.h,o=e.spc,s=t.get().getWidth(),a=t.get().getHeight();r&&(s=s?Math.min(s,r):r,a=a?Math.min(a,r):r),a&&(s-=o.getHorizontal(),a-=o.getVertical(),s/a<n/i?this.scalingFactor=s/n:this.scalingFactor=a/i,this.scalingFactor=Math.min(this.scalingFactor,1))}getScalingFactor(){return this.scalingFactor}createElement(e){return this.doc.createElement(e)}appendChild(e,r){e.appendChild(r)}setStyles(e,r){Object.assign(e.style,r)}setStyle(e,r,n){if(r){if(!n){e.style.removeProperty(r);return}e.style.setProperty(r,n,"important")}}setAttribute(e,r,n){e.setAttribute(r,n)}removeInApp(e){let r=document.querySelector(`.${e.rootClassName}`);r&&r.parentElement.removeChild(r)}setParentContainer(e){this.parentContainer=e,this.parentContainer&&this.isParentNotBody()&&this.setStyle(this.parentContainer,"position","relative")}isParentNotBody(){return this.parentContainer!==document.body}};var ne=class{static ID="id";static SESSION_LANDING_PAGE="landing";static SESSION_LAST_USED_TIME="lastUsedTime";static SESSION_SYNCED="synced";static APP_CONFIG="conf";static DEVICE_ID="did";static SDK_TOKEN="token";static FIRST_SEEN="firstSeen";static SESSION_NUMBER="sessionNumber";static GA_CLIENT_ID="gacid";static CURRENT_CART="cart"};var qc=Xt(kp());function Kn(t){return qc.default.createInstance({name:"lc",storeName:t,driver:qc.default.LOCALSTORAGE})}var zr=class{static storage;static async get(e,r){return await this.storage?.getItem(e)??r}static set(e,r){return this.storage?.setItem(e,r)}static remove(e){return this.storage?.removeItem(e)}static clear(){return this.storage?.clear()}static getForage(){return this.storage}};var at=class extends zr{static storeName="ses";static{this.storage=Kn(this.storeName)}};var Ne=class extends zr{static storeName="usr";static{this.storage=Kn(this.storeName)}};var fe=class{isCartDirty=!0;cartEngagements;isGoKwikPopupOpen;previewIDs;previewVariant;pageName;moneyFormat;jsLoadTime=new Date;shopCurrencyCode;inInactive=!1;lastEnterActive=new Date;lastEnterInactive=null;currentItem;_currencyCode;get currencyCode(){return this._currencyCode}set currencyCode(e){this._currencyCode=e}static get(){return window.CooeeSDK.runtimeData}isInactive(){return this.inInactive}async setInactive(){return this.inInactive?0:(this.inInactive=!0,this.lastEnterInactive=new Date,Math.max((this.lastEnterInactive.getTime()-this.lastEnterActive.getTime())/1e3,0))}setActive(){return this.inInactive?(this.inInactive=!1,this.lastEnterActive=new Date,Math.max((this.lastEnterActive.getTime()-this.lastEnterInactive.getTime())/1e3,0)):0}isFirstActive(){return this.lastEnterInactive==null}getCurrentItem(){return this.currentItem}setCurrentItem(e){this.currentItem=e}};var Oe=class{static COOEE_URL_PREFIX="?from=cooee";static isShopify(){return!!window.Shopify}static getShopName(){if(this.isShopify())return window.Shopify.shop?.split(".")?.[0]}static getPageName(){if(!this.isShopify())return;let r=new URL(window.location.href).pathname.slice(1).split("/"),n=r[0];if(n==="")return"home";if(n==="collections")return r[2]==="products"?"product":"collection";if(n==="products")return"product";if(n==="cart")return"cart";if(location.href.includes("thank_you"))return"thank_you"}static getProductSlug(e){let i=(e.includes("://")?new URL(e).pathname:e).match(/\/products\/([^/]+?)(?:\.html)?$/);return i?i[1]:null}static getRootPrefix(){return window.Shopify?.routes?.root??"/"}static getCartURL(e){return this.getRootPrefix()+e+this.COOEE_URL_PREFIX}};var Jn=class{isLocked=!1;queue=[];async acquire(){if(this.isLocked)await new Promise(e=>this.queue.push(e));else{this.isLocked=!0;return}}release(){if(this.queue.length>0){let e=this.queue.shift();e&&e()}else this.isLocked=!1}};var ge=class t{static CURRENT;token;items;total_price;original_total_price;currency;item_count;attributes;lock=new Jn;constructor(){}static getCurrent(){return this.CURRENT||(this.CURRENT=new t),this.CURRENT}async getNormalisedCart(e){await this.fetchCartFromShopify(e);let r=this.convertToCooeeCart();return e&&await Ne.set(ne.CURRENT_CART,r),r}async addCooeeAttributes(){await this.lock.acquire();let e=await at.get(ne.ID),r=await Ne.get(ne.DEVICE_ID);if(this.attributes?.letscooee_did===r&&this.attributes?.letscooee_sid===e){w.debug("Not calling Shopify update.js API.","Current attributes:",this.attributes),this.lock.release();return}let n={letscooee_did:r,letscooee_sid:e,__letscooee_time:new Date().toLocaleString()};w.debug("Updating Shopify cart with attributes:",n);let i=Oe.getCartURL("cart/update.js"),s=await(await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({attributes:n})})).json();w.debug("Updated cart attributes",JSON.stringify(s)),this.update(s),this.lock.release()}update(e){return this.token=e.token,this.items=e.items,this.total_price=e.total_price,this.original_total_price=e.original_total_price,this.currency=e.currency,this.item_count=e.item_count,this.attributes=e.attributes,fe.get().currencyCode=this.currency,w.log("Updated ShopifyCart",this),this}toString(){return`ShopifyCart(token: ${this.token}, itemCount: ${this.item_count})`}convertToCooeeCart(){return{amount:this.total_price/100,originalAmount:this.original_total_price/100,currency:this.currency,itemCount:this.item_count,items:this.normaliseItems(this.items),token:this.token}}normaliseItems(e){if(!e)return w.error("No item received to be sent"),[];Array.isArray(e)||(e=[e]);let r=[];for(let n of e){if(!n.id||!n.title){w.warn("Invalid item received",n);continue}let i={name:n.title,quantity:+n.quantity||1,mID:n.product_id?.toString(),vID:n.id.toString(),price:+n.price/100||0,properties:n.properties},o=n.selling_plan_allocation?.selling_plan;if(!o){r.push(i);continue}i.sellingPlanAllocation={sellingPlan:{fixedSellingPlan:o.fixed_selling_plan,id:o.id,name:o.name,recurringDeliveries:o.recurring_deliveries}},r.push(i)}return r}async fetchCartFromShopify(e){if(!e&&this.token){w.debug("Not fetching cart");return}w.debug("Fetching cart");let r=Oe.getCartURL("cart.js"),n=await(await fetch(r)).json();this.update(n)}};var ns=class{static format(e,r){let n=/{{\s*(\w+)\s*}}/;return r.replace(n,(i,o)=>{switch(o){case"amount":return this.formatWithDelimiters(e,2);case"amount_no_decimals":return this.formatWithDelimiters(e,0);case"amount_with_comma_separator":return this.formatWithDelimiters(e,2,".",",");case"amount_no_decimals_with_comma_separator":return this.formatWithDelimiters(e,0,".",",");case"amount_with_apostrophe_separator":return this.formatWithDelimiters(e,2,"'",".");case"amount_no_decimals_with_space_separator":return this.formatWithDelimiters(e,0," ");case"amount_with_space_separator":return this.formatWithDelimiters(e,2," ",",");case"amount_with_period_and_space_separator":return this.formatWithDelimiters(e,2," ",".");default:return i}})}static formatWithDelimiters(e,r=2,n=",",i="."){if(isNaN(e)||e==null)return"0";let s=(e/100).toFixed(r).split("."),a=s[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+n),l=s[1]?i+s[1]:"";return a+l}};var kt=class{static ISO_WITHOUT_MS_REGEX=new RegExp(/\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)/);static isObject(e){return typeof e=="object"&&!Array.isArray(e)&&e!==null}static parseToAny(e){try{return JSON.parse(e.toString())}catch{}return e.toString().match(this.ISO_WITHOUT_MS_REGEX)?new Date(e.toString()):e}static async sleep(e){return new Promise(r=>setTimeout(r,e))}static hasKeys(e){return e?Object.keys(e).length>=1:!1}static convertObjectToArray(e,r){return r.reduce((n,i)=>(e.hasOwnProperty(i)&&e[i]!=null&&n.push({[i]:e[i]}),n),[])}static removeNullUndefinedKeys(e){return Object.keys(e).reduce((r,n)=>(e[n]!==null&&e[n]!==void 0&&(r[n]=e[n]),r),{})}static stringify(e){return JSON.stringify(e,function(r,n){return n===void 0?null:n})}};var ce=class{static tz;static isValidURL(e){try{return new URL(e)}catch{return}}static isNull(e){return!e||e==="null"||e==="undefined"}static removeFromArray(e,r){let n=e.indexOf(r);return n===-1?!1:(e.splice(n,1),!0)}static formatCurrency(e,r){if(e==0&&r)return"Free";let n=fe.get(),i=qe.get(),o=n.shopCurrencyCode??i.currency,s=n.currencyCode,a=i.money?.format??n.moneyFormat,l;return a&&o===s?l=ns.format(e*100,a):(l=new Intl.NumberFormat(this.getLang(),{style:"currency",currency:s,minimumFractionDigits:0,maximumFractionDigits:2}).format(e),l=l.replace("\u20B9","Rs. "),i.money?.showCurrency&&s!=="INR"&&(l=l.concat(` ${s}`))),l}static formatNumber(e){return new Intl.NumberFormat(this.getLang(),{notation:"compact"}).format(e)}static getLang(){return navigator.languages!==void 0?navigator.languages[0].split("-")[0]:navigator.language??"en"}static getTimezone(){if(this.tz)return this.tz;try{return this.tz=Intl.DateTimeFormat().resolvedOptions().timeZone,this.tz}catch{return""}}static documentReady(e){document.readyState!=="loading"?e():document.addEventListener("DOMContentLoaded",e)}static onDocumentLoaded(e){document.readyState==="complete"?e():document.addEventListener("readystatechange",()=>{document.readyState==="complete"&&e()})}static showSnackbar(e){let r=document.createElement("span");r.id="snackbar",r.innerText=e,document.body.appendChild(r),r.className="show",setTimeout(()=>{r.classList.remove("show"),document.body.removeChild(r)},3e3)}static async retrySelectorForElements(e,r=10,n=document){let i=0,o=document.querySelectorAll("nonexistent-tag");for(;i<r;){let s=Math.min(100*2**i,5e3);if(await kt.sleep(s),o=n.querySelectorAll(e),o.length)return w.debug(`Attempt ${i+1}: ${o.length} elements found with ${e}`),o;w.debug(`Attempt ${i+1}: Elements not found with ${e}. Retrying after ${s}ms.`),i++}return w.warn(`Max attempts reached. Element not found with ${e}.`),o}static async retrySelector(e,r=10,n=document){return(await this.retrySelectorForElements(e,r,n)).item(0)}};function Xn(t,e,r){Object.defineProperty(t,e,{enumerable:!1,configurable:!1,writable:!1,value:r})}var bt=class{id;mID;vID;vName;imageURL;name;link;quantity;price;constructor(e){this.id=e.id,this.mID=e.mID,this.vID=e.vID,this.vName=e.vName,this.imageURL=e.imageURL,this.name=e.name,this.link=e.link,this.quantity=e.quantity,this.price=e.price}};var is=class{url;alt;constructor(e){e.alt&&(this.alt=e.alt),this.url=e.url}};var os=class{d;cmp;effective;constructor(e={}){this.d=e.d,this.cmp=e.cmp,this.effective=e.d}};var Kc=class{id;mID;name;groupID;groupName;isSelected;constructor(e){e??={},this.id=e.id,this.mID=e.mID,this.name=e.name,this.groupID=e.groupID,this.groupName=e.groupName,this.isSelected=e.isSelected??!1}},mr=class{mID;name;imgs;link;price;sku;isAvailable;quantity;sellingPlans;selectedSellingPlan;constructor(e){e=e??{},this.mID=e.mID,this.name=e.name,this.imgs=e.imgs?.map(r=>new is(r))??[],this.link=e.link,this.price=new os(e.price),this.sku=e.sku,this.isAvailable=e.isAvailable,this.quantity=e.quantity,e.sellingPlans?.length&&(this.selectedSellingPlan=Qt(void 0)),this.sellingPlans=e.sellingPlans?.map(r=>{let n=new Kc(r);return n.isSelected&&(this.selectedSellingPlan.value=n),n})}getOneImage(){return this.imgs[0]?.url}changeSellingPlan(e){this.selectedSellingPlan.value=e}};var wt=class{id;mID;name;status;ctg;imgs;videos;portraitVideos;vars;desc;sDesc;link;slug;quantity;category;meta;selectedOrFirstVariant;selected=Qt(!0);constructor(e){this.update(e),this.selectedOrFirstVariant=Qt(this.selectedVariant)}get imageURL(){return this.imgs?.[0]?.url}get secondaryImageURL(){return this.imgs?.[1]?.url}get getVariantImages(){return this.selectedOrFirstVariant.value.imgs}get variantImage(){return this.getVariantImages[0]?.url}get variantSecondaryImage(){return this.getVariantImages[1]?.url}get selectedVariant(){return this.vars.find(e=>e.isAvailable)??this.vars[0]}set variants(e){this.vars=e,this.selectedOrFirstVariant.value=this.selectedVariant}update(e){return this.id=e.id,this.mID=e.mID,this.name=e.name,this.status=e.status,this.ctg=e.ctg,this.imgs=e.imgs,this.desc=e.desc,this.sDesc=e.sDesc,this.link=e.link,this.slug=e.slug,this.quantity=e.quantity,this.meta=e.meta,this.category=e.category,this.videos=e.videos,this.portraitVideos=e.videos?.filter(r=>r.orientation==="PORTRAIT"),e.vars&&(this.vars=e.vars.map(r=>new mr(r))),this}toEmbed(e){return e=e??this.selectedOrFirstVariant.value,new bt({id:this.id,mID:this.mID,vID:e.mID,vName:e.name,name:this.name,link:this.link,slug:this.slug,price:e.price.d,imageURL:e.getOneImage()??this.imgs?.[0].url})}};var ss=class{id;mID;handle;title;imageURL;constructor(e){e??={},this.id=e.id,this.mID=e.mID,this.handle=e.handle,this.title=e.title,this.imageURL=e.imageURL}};var Jc=class{enabled;constructor(e){this.enabled=e.enabled}},Xc=class extends Jc{max;min;constructor(e){e??={},super(e),this.min=e.min,this.max=e.max}},as=class{productQuantity;constructor(e){e??={},this.productQuantity=new Xc(e.productQuantity)}};var nn=class{s;g;i;constructor(e){e.s&&(this.s=new je(e.s)),e.g&&(this.g=new ro(e.g)),this.i=e.i}get solid(){return this.s}get glossy(){return this.g}get img(){return this.i}};var no="a-f\\d",Wh=`#?[${no}]{3}[${no}]?`,Gh=`#?[${no}]{6}([${no}]{2})?`,Vh=new RegExp(`[^#${no}]`,"gi"),zh=new RegExp(`^${Wh}$|^${Gh}$`,"i");function Qc(t,e={}){if(typeof t!="string"||Vh.test(t)||!zh.test(t))throw new TypeError("Expected a valid hex string");t=t.replace(/^#/,"");let r=1;t.length===8&&(r=Number.parseInt(t.slice(6,8),16)/255,t=t.slice(0,6)),t.length===4&&(r=Number.parseInt(t.slice(3,4).repeat(2),16)/255,t=t.slice(0,3)),t.length===3&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]);let n=Number.parseInt(t,16),i=n>>16,o=n>>8&255,s=n&255,a=typeof e.alpha=="number"?e.alpha:r;if(e.format==="array")return[i,o,s,a];if(e.format==="css"){let l=a===1?"":` / ${Number((a*100).toFixed(2))}%`;return`rgb(${i} ${o} ${s}${l})`}return{red:i,green:o,blue:s,alpha:a}}var je=class{h;a=100;g;constructor(e){e??={},this.h=e.h,this.a=e.a,this.g=e.g}get hex(){return this.h}get grad(){return this.g}get rgba(){if(!this.hex)return"";try{return Qc(this.hex,{format:"css",alpha:this.getAlpha()})}catch(e){return console.error("Invalid hex",e),"#000000"}}getAlpha(){return(this.a??100)/100}};var on=class{s;r;w;c;constructor(e){this.s=e.s,this.r=e.r,this.w=e.w,e.c&&(this.c=new je(e.c))}get radius(){return this.r}get width(){return this.w}get color(){return this.c}get style(){return Fp[this.s??1]}},Fp=(r=>(r[r.SOLID=1]="SOLID",r[r.DASHED=2]="DASHED",r))(Fp||{});var ro=class t{static DEFAULT_FALLBACK=new je({h:"#000000",a:50});r;c;fb;constructor(e){this.r=e.r,e.c&&(this.c=new je(e.c)),e.fb&&(this.fb=new je(e.fb))}get radius(){return this.r}get color(){return this.c}get fallback(){return this.fb??t.DEFAULT_FALLBACK}};var io=class{blur;spr;clr;x;y;constructor(e){e=e??{},this.blur=e.blur??0,this.spr=e.spr??0,this.x=e.x??0,this.y=e.y??0,this.clr=new je(e.clr)}getStyle(e){return`${this.x*e}px ${this.y*e}px ${this.blur*e}px ${this.spr*e}px ${this.clr.rgba}`}};var Nr=class{pl;pr;pt;pb;ml;mr;mt;mb;cent;constructor(e){e=e??{},this.pl=e.pl??0,this.pr=e.pr??0,this.pt=e.pt??0,this.pb=e.pb??0,this.ml=e.ml??0,this.mr=e.mr??0,this.mt=e.mt??0,this.mb=e.mb??0,this.cent=e.cent??!1}getHorizontal(){return this.pl+this.pr}getVertical(){return this.pt+this.pb}getPaddingCSS(){return`${this.pt}px ${this.pr}px ${this.pb}px ${this.pl}px`}};var sn=class{rot;constructor(e){e?.rot&&(this.rot=e.rot)}get rotate(){return this.rot}};var Ot=class{t;bg;br;clc;shd;spc;trf;a;w;h;x;y;constructor(e){this.t=e.t,e.bg&&(this.bg=new nn(e.bg)),e.br&&(this.br=new on(e.br)),e.shd&&(this.shd=new io(e.shd)),e.spc&&(this.spc=new Nr(e.spc)),this.trf=new sn(e.trf),this.clc=e.clc,this.w=e.w,this.h=e.h,this.x=e.x,this.y=e.y,this.a=e.a}get alpha(){return this.a??100}get type(){return this.t}get typeAsString(){return Le[this.t]}get click(){return this.clc}},Le=(x=>(x[x.IMAGE=1]="IMAGE",x[x.TEXT=2]="TEXT",x[x.BUTTON=3]="BUTTON",x[x.FLEXBOX=4]="FLEXBOX",x[x.MULTI_COLUMN=5]="MULTI_COLUMN",x[x.CHECKBOX=6]="CHECKBOX",x[x.PRODUCTS=11]="PRODUCTS",x[x.PRODUCT=12]="PRODUCT",x[x.PRODUCT_IMAGE=13]="PRODUCT_IMAGE",x[x.PRODUCT_TITLE=14]="PRODUCT_TITLE",x[x.PRODUCT_VARIATIONS=15]="PRODUCT_VARIATIONS",x[x.PRODUCT_VARIATIONS_SELLING_PLANS=16]="PRODUCT_VARIATIONS_SELLING_PLANS",x[x.PRODUCT_BUTTON=18]="PRODUCT_BUTTON",x[x.EMAIL_INPUT=51]="EMAIL_INPUT",x[x.PHONE_INPUT=52]="PHONE_INPUT",x[x.COUNTDOWN_TIMER=61]="COUNTDOWN_TIMER",x[x.CAROUSEL=62]="CAROUSEL",x[x.SHAPE=100]="SHAPE",x))(Le||{});var an=class extends Ot{constructor(e){super(e)}};var Or=class extends Ot{src;constructor(e){super(e),this.src=e.src}};var Qn=(i=>(i[i.START=0]="START",i[i.CENTER=1]="CENTER",i[i.END=2]="END",i[i.JUSTIFY=3]="JUSTIFY",i))(Qn||{});var cs=class{name;fonts;constructor(e){e=e??{},e.name&&(e.name=e.name!=="Arial"?e.name:""),this.name=e.name,this.fonts=e.fonts?.map(r=>new Zc(r))}},Zc=class{style;url;constructor(e){e=e??{},this.style=e.style,this.url=e.url}getFontDescriptor(){return{style:this.style===2||this.style===4?"italic":"normal",weight:this.style===4||this.style===3?"700":"400"}}getURL(){return`url('${this.url}') format('truetype')`}};var it=class{fw;fs;fam;fmly;lh=1.2;ls;s;tc;ta;td;tdc;constructor(e){this.update(e)}get alignment(){return Qn[this.ta]}get letterSpacing(){return this.ls?this.ls+"px":"normal"}update(e){e=e??{},e.lh&&(this.lh=e.lh),e.tdc&&(this.tdc=new je(e.tdc)),this.td=e.td,this.fs=e.s??e.fs??60,this.tc=new je(e.tc),this.ta=e.ta??1,this.fw=e.fw??400,this.ls=e.ls??0,this.tc.h??="#000000",this.fam=new cs(e.fam??e.fmly)}resize(e){this.s*=e,this.ls*=e}};var dr=class extends Ot{typo;constructor(e){super(e);let r=b(b({},e.f),e.typo);e.alg&&(r.ta=e.alg),e.c&&(r.tc=e.c),this.typo=new it(r)}get color(){return this.typography.tc}get typography(){return this.typo}};var Yr=class extends dr{prs;constructor(e){super(e),this.prs=e.prs}get parts(){return this.prs}};var ls=class extends Ot{o;constructor(e){super(e),this.o=e.o??5,this.w=this.w??1080,this.h=this.h??1920}getOrigin(){return this.o}};var Zn=class{dd;hh;mm;ss;date;constructor(e){e??={},this.dd=e.dd??0,this.hh=e.hh??0,this.mm=e.mm??0,this.ss=e.ss??0,this.date=e.date?new Date(e.date):void 0}start(e,r){let n=new Date;e===2?(n.setSeconds(n.getSeconds()+this.ss),n.setMinutes(n.getMinutes()+this.mm),n.setHours(n.getHours()+this.hh),n.setDate(n.getDate()+this.dd)):n=this.date??new Date;let i=window.setInterval(()=>{let o=new Date().getTime(),s=n.getTime()-o;if(s<1){clearInterval(i);return}let a=Math.floor(s/(1e3*60*60*24)),l=Math.floor(s%(1e3*60*60*24)/(1e3*60*60)),m=Math.floor(s%(1e3*60*60)/(1e3*60)),p=Math.floor(s%(1e3*60)/1e3);r({days:a,hours:l,minutes:m,seconds:p})},1e3);return i}};var ei=class extends dr{gap;timer;timerType;horizontal;lblPos;show;constructor(e){e??={},super(e),this.gap=e.gap,this.timerType=e.type,this.timer=new Zn(e.timer),this.show=e.show??{day:!0,hour:!0,minute:!0,second:!0},this.horizontal=e.horizontal,this.lblPos=e.lblPos}};var us=class{txt;c;constructor(e){e??={},this.txt=e.txt,this.c=new je(e.c??{})}get text(){return this.txt}get color(){return this.c}};var qr=class extends dr{ph;constructor(e){super(e),this.ph=new us(e.ph)}get placeholderText(){return this.ph.text}get placeholderColor(){return this.ph.color.rgba}};var ti=class extends qr{constructor(e){e??={},super(e)}};var ri=class extends qr{};var ni=class extends qr{};var ii=class extends Or{};var cn=(n=>(n[n.LOW=1]="LOW",n[n.MEDIUM=2]="MEDIUM",n[n.HIGH=3]="HIGH",n))(cn||{});var ps=class{en;ex;constructor(e){e=e??{},this.en=e.en,this.ex=e.ex}getEnterAnimation(){switch(this.en){case 2:return[{transform:"translateY(-100%)"},{transform:"translateY(0%)"}];case 3:return[{transform:"translateY(100%)"},{transform:"translateY(0%)"}];case 4:return[{transform:"translateX(-100%)"},{transform:"translateX(0%)"}];case 5:return[{transform:"translateX(100%)"},{transform:"translateX(0%)"}];case 6:return[{transform:"translate(-100%, -100%)"},{transform:"translate(0%, 0%)"}];case 7:return[{transform:"translate(100%, -100%)"},{transform:"translate(0%, 0%)"}];case 8:return[{transform:"translate(-100%, 100%)"},{transform:"translate(0%, 0%)"}];case 9:return[{transform:"translate(100%, 100%)"},{transform:"translate(0%, 0%)"}];case 10:return[{transform:"scale(0.1)"},{transform:"scale(1)"}];default:return[]}}getExitAnimation(){switch(this.ex){case 2:return[{transform:"translateY(0%)"},{transform:"translateY(-100%)"}];case 3:return[{transform:"translateY(0%)"},{transform:"translateY(100%)"}];case 4:return[{transform:"translateX(0%)"},{transform:"translateX(-100%)"}];case 5:return[{transform:"translateX(0%)"},{transform:"translateX(100%)"}];case 6:return[{transform:"translate(0%, 0%)"},{transform:"translate(-100%, -100%)"}];case 7:return[{transform:"translate(0%, 0%)"},{transform:"translate(100%, -100%)"}];case 8:return[{transform:"translate(0%, 0%)"},{transform:"translate(-100%, 100%)"}];case 9:return[{transform:"translate(0%, 0%)"},{transform:"translate(100%, 100%)"}];case 10:return[{transform:"scale(1)"},{transform:"scale(0)"}];default:return[]}}};var oo=class extends Ot{gvt;max;cover;anim;embedded;position;constructor(e){e=e??{},super(e),this.gvt=e.gvt??5,this.max=e.max,this.cover=e.cover??!0,this.anim=new ps(e.anim),this.embedded=e.embedded,this.position=e.position??1,this.spc||(this.spc=new Nr({pl:A.IN_APP_DEFAULT_PADDING,pr:A.IN_APP_DEFAULT_PADDING,pt:A.IN_APP_DEFAULT_PADDING,pb:A.IN_APP_DEFAULT_PADDING}))}isEmbedded(){return this.position===2&&!!this.embedded}getEmbeddedSelector(){return`.letscooee-engagement.container-${this.embedded}`}};var fs=class extends oo{cont;elems=[];mob;constructor(e){e=e??{},super(e),this.cont=new ls(e.cont),this.mob=new oo(e.mob),this.bg||(this.bg=this.cont.bg,delete this.cont.bg),e.elems.forEach(r=>{r.t===1?this.elems.push(new Or(r)):r.t===2?this.elems.push(new Yr(r)):r.t===3?this.elems.push(new Yr(r)):r.t===100?this.elems.push(new an(r)):r.t===51?this.elems.push(new ri(r)):r.t===52?this.elems.push(new ni(r)):r.t===61?this.elems.push(new ei(r)):r.t===15||r.t===16?this.elems.push(new ti(r)):r.t===13&&this.elems.push(new ii(r))})}getStylesForWrapper(){if(this.cover)return{};let e;return this.gvt===1?e={top:0,left:0}:this.gvt===2?e={top:0,left:"50%",transform:"translateX(-50%)"}:this.gvt===3?e={top:0,right:0}:this.gvt===6?e={top:"50%",right:0,transform:"translateY(-50%)"}:this.gvt===9?e={bottom:0,right:0}:this.gvt===8?e={bottom:0,left:"50%",transform:"translateX(-50%)"}:this.gvt===7?e={bottom:0,left:0}:this.gvt===4?e={top:"50%",left:0,transform:"translateY(-50%)"}:e={top:"50%",left:"50%",transform:"translateX(-50%) translateY(-50%)"},e.overflow="visible",e}getFlexStylesForContainer(){let e={display:"flex",flexDirection:"row"},r,n;return this.gvt===1?(r="flex-start",n="flex-start"):this.gvt===2?(r="center",n="flex-start"):this.gvt===3?(r="flex-end",n="flex-start"):this.gvt===4?(r="flex-start",n="center"):this.gvt===6?(r="flex-end",n="center"):this.gvt===7?(r="flex-start",n="flex-end"):this.gvt===8?(r="center",n="flex-end"):this.gvt===9?(r="flex-end",n="flex-end"):(r="center",n="center"),e.alignItems=n,e.justifyContent=r,e.overflow="visible",e}overrideForMobileView(){this.max=this.mob.max??this.max,this.cover=this.mob.cover??this.cover,this.gvt=this.mob.gvt??this.gvt,this.bg=this.mob.bg??this.bg,this.spc=this.mob.spc??this.spc,this.anim=this.mob.anim??this.anim,this.position=this.mob.position??this.position,this.embedded=this.mob.embedded??this.embedded}};var oi=class{gap;dir;wrap;jc;ai;scroll;constructor(e){e??={},this.gap=e.gap??0,this.dir=e.dir??"row",this.wrap=e.wrap??"nowrap",this.jc=e.jc??"flex-start",this.ai=e.ai??"flex-start",this.scroll=e.scroll}};var ms=class{of;disp;pos;top;bottom;left;right;zIndex;constructor(e){e??={},this.of=e.of,this.disp=e.disp,this.pos=e.pos,this.top=e.top,this.bottom=e.bottom,this.left=e.left,this.right=e.right,this.zIndex=e.zIndex}};var ds=class{w;h;maxW;maxH;minW;minH;constructor(e){e??={},this.w=e.w??"100%",this.h=e.h??"auto",this.maxW=e.maxW,this.maxH=e.maxH,this.minW=e.minW,this.minH=e.minH}};var hs=class{size;bg;br;spc;typo;lout;flex;constructor(e){e??={},this.spc=new Nr(e.spc),e.size&&(this.size=new ds(e.size)),e.bg&&(this.bg=new nn(e.bg)),e.br&&(this.br=new on(e.br)),e.typo&&(this.typo=new it(e.typo)),e.lout&&(this.lout=new ms(e.lout)),e.flex&&(this.flex=new oi(e.flex))}},si=class{sm;lg;constructor(e){e??={},this.sm=new hs(e.sm),this.lg=new hs(e.lg)}};var ct=class{t;style;hide;when;clc;constructor(e,r){r??={},this.t=e,this.style=new si(r.style),this.hide=r.hide,r.when?.op&&(this.when=r.when),r.clc&&(this.clc=r.clc)}get stringType(){return Le[this.t]}};var Ve=class extends ct{text;constructor(e,r){e?.style?.lg?.typo?.s&&delete e.style.lg.typo.s,e?.style?.sm?.typo?.s&&delete e.style.sm.typo.s,super(r??2,e),e??={},this.text=e.text}};var ln=class extends Ve{constructor(e,r){super(e,r??3)}};var ai=class extends ct{value;constructor(e){super(6,e),e??={},this.value=e.value}};var ci=class extends Ve{constructor(e=15,r){super(r,e)}};var Hp=Xt(tn());var el=class{enabled;type;color;constructor(e){e??={},this.enabled=e.enabled,this.type=e.type,this.color=new je(e.color)}},tl=class{size;enabled;color;constructor(e){e??={},this.enabled=e.enabled,this.size=e.size,this.color=new je(e.color)}},so=class{navigation;pagination;autoplay;maxInRow;gap;slidesPerView;constructor(e){e??={},this.navigation=new tl(e.navigation),this.pagination=new el(e.pagination),this.autoplay=e.autoplay,this.slidesPerView=e.slidesPerView??1,this.maxInRow=e.maxInRow??e.slidesPerView??4,this.gap=e.gap??0}},gs=class extends ct{conf;slide;formData;values;allowedTypes;constructor(e){super(62,e),e&&this.update(e)}update(e){e??={},this.slide=At.getParsedElement(e.slide),this.formData=e.formData,this.values=e.values,this.conf=new so(e.conf),this.allowedTypes=e.allowedTypes}};var ys=class extends Ve{gap;timer;timerType;horizontal;lblPos;show;constructor(e){e??={},super(e,61),this.gap=e.gap,this.timerType=e.type,this.timer=new Zn(e.timer),this.show=e.show??{days:!0,hours:!0,minutes:!0,seconds:!0},this.horizontal=e.horizontal,this.lblPos=e.lblPos}};var Kr=class extends ct{elems;constructor(e){super(4,e),this.update(e)}update(e){e??={},this.elems??=[],e.elems?.forEach(r=>{let n=At.getParsedElement(r);n&&this.elems.push(n)})}};var un=class extends ct{src;sm;lg;constructor(e,r){super(r??1,e),e&&this.update(e)}update(e){this.src=e.src,this.sm=e.sm,this.lg=e.lg}};var At=class t{static getParsedElements(e){let r=[];return e?.forEach(n=>{let i=t.getParsedElement(n);i&&r.push(i)}),r}static getParsedElement(e){switch(e.t){case 2:return new Ve(e);case 3:return new ln(e);case 6:return new ai(e);case 11:return new vs(e);case 12:return new hr(e);case 61:return new ys(e);case 4:return new Kr(e);case 1:return new un(e);case 13:return new un(e,13);case 14:return new Ve(e,14);case 15:case 16:return new ci(e.t,e);case 18:return new ln(e,18);case 62:return new gs(e);default:Hp.default.error("Unknown element type",e.t);return}}static parseAlignmentToJustifyContent(e){switch(e){case 1:return"center";case 2:return"flex-end";case 0:return"flex-start";default:return"flex-start"}}};var hr=class extends ct{img;title;desc;price;compareAt;btn;variantDD;show;symbol;cBox;elems;noLinks;constructor(e){if(e??={},super(12,e),this.show=e.show,this.elems=At.getParsedElements(e.elems),this.noLinks=e.noLinks,!this.elems.length){e.cBox&&this.elems.push(new ai(e.cBox)),this.elems.push(new un(e.img,13));let r=new Ve(e.title,14);r.hide=!e.show?.title,r.text="{{ product.name }}",this.elems.push(r);let n=new Ve(e.price);n.text="{{ product.price }}",n.hide=!e.show?.price;let i=new Ve(e.compareAt);i.text="{{ product.compare_price }}",i.hide=!e.show?.price,e.compareAt||(i.style=new si(n.style),i.style.lg.typo=new it(Z(b({},i.style.lg.typo),{td:"line-through"})),i.style.sm.typo=new it(Z(b({},i.style.sm.typo),{td:"line-through"})));let o=new Kr({style:{lg:{spc:{mb:10},flex:{dir:"row",gap:10,ai:"center",jc:At.parseAlignmentToJustifyContent(n.style.lg.typo?.ta)}}}});o.elems.push(i),o.elems.push(n),this.elems.push(o);let s=new ci(15,e.variantDD);if(s.hide=!e.show?.variantDD,this.elems.push(s),e.btn){let a=new ln(e.btn,18);a.hide=!e.show?.btn,this.elems.push(a)}}e.symbol&&(this.symbol=new Ve(e.symbol))}};var vs=class extends ct{conf;prod;constructor(e){super(11,e),e??={},this.conf=new rl(e.conf),this.prod=new hr(e.prod)}};var _s=class extends so{disp;maxItems;constructor(e){e??={},super(e),this.disp=e.disp,this.maxItems=e.maxItems}},rl=class{lg;sm;constructor(e){e??={},this.lg=new _s(e.lg),this.sm=new _s(e.sm)}};var Es=class extends Kr{constructor(e){super(e)}};var li=class{cont;elems=[];constructor(e){e=e??{},this.cont=new Es(e.cont),e.elems?.forEach(r=>{this.addRawElement(r)})}addRawElement(e){let r=At.getParsedElement(e);return r&&this.elems.push(r),r}};var nl=class{minValue;rewardType;label;reachingText;reachedText;discount;items;calculatedAlignment;constructor(e){this.minValue=e.minValue,this.rewardType=e.rewardType,this.label=e.label,this.reachingText=e.reachingText,this.reachedText=e.reachedText,this.discount=e.discount,this.items=e.items?.map(r=>new bt(r))}},Ss=class{layout;milestones;constructor(e){this.layout=e.layout??Ic.ICONS,this.milestones=e.milestones?.map(r=>new nl(r))??[]}};var bs=class{applyDiscountOnMinimum;constructor(e){this.applyDiscountOnMinimum=e.applyDiscountOnMinimum}};var il=class{engagementID;shortID;contentType;delay;onsiteDeliveryType;objective;redirectBehaviour;constructor(e){this.shortID=e.shortID,this.contentType=e.contentType,this.engagementID=e.engagementID,this.delay=e.delay??0,this.redirectBehaviour=e.redirectBehaviour,this.onsiteDeliveryType=e.onsiteDeliveryType,this.objective=e.objective}isAnySplit(){return this.isABTesting()||this.isExclusionTesting()}isExclusionTesting(){return this.contentType===zi.EXCLUSION}isABTesting(){return this.contentType===zi.ABTESTING}isSingleContent(){return this.contentType===zi.SINGLE}},Pt=class t extends il{static SWIPER_ELEMENTS=new Set([11,62]);nudgeID;contentID;variation;ian;widget;discount;placement;promotionType;contentSource;manipulation;klaviyoFormID;hasMultiplePlacement;skipSubscribedItems;progressBarConfig;bundleConfig;previewType;occurred;id;currency;props;items;nonMutableItems;embeddedItems;bundleFrom;collections;customerData;discountData=Qt({});constructor(e){super(e),this.id=e.id,this.nudgeID=e.nudgeID,this.currency=fe.get().currencyCode??"USD",this.contentID=e.contentID,this.variation=e.variation,e.widget&&(this.widget=new li(e.widget)),this.previewType=e.previewType,this.occurred=e.occurred??new Date,this.props=e.props,this.embeddedItems=e.embeddedItems?.map(r=>new bt(r)),this.items=e.items?.map(r=>new wt(r))??[],this.nonMutableItems=e.items?.map(r=>new wt(r))??[],this.collections=e.collections?.map(r=>new ss(r))??[],this.discount=e.discount,this.placement=e.placement,this.customerData=e.customerData,this.ian=e.ian?this.processPopup(e.ian):void 0,this.promotionType=e.promotionType,this.manipulation=new as(e.manipulation),this.contentSource=e.contentSource,this.klaviyoFormID=e.klaviyoFormID,this.hasMultiplePlacement=e.hasMultiplePlacement,this.skipSubscribedItems=e.skipSubscribedItems,e.progressBarConfig&&(this.progressBarConfig=new Ss(e.progressBarConfig)),e.bundleConfig&&(this.bundleConfig=new bs(e.bundleConfig)),e.bundleFrom&&(this.bundleFrom=new wt(e.bundleFrom))}shouldDelay(){return this.delay>0}sentryContext(){return{id:this.id,shortID:this.shortID,currency:this.currency,contentType:this.contentType,objective:this.objective,onsiteDeliveryType:this.onsiteDeliveryType,engagementID:this.engagementID,contentID:this.contentID,nudgeID:this.nudgeID,variation:this.variation}}getDelaySeconds(){let e=new Date().getTime()-this.occurred.getTime();return this.delay*1e3-e}isBundle(){return this.objective===lr.BUNDLE_AND_UPSELL}isCartEmbed(){return this.onsiteDeliveryType===Yi.CART_EMBED}isPageEmbed(){return this.onsiteDeliveryType===Yi.PAGE_EMBED}isProgressBar(){return this.objective===lr.PROGRESS_BAR}isSubscriptionUpsell(){return this.objective===lr.SUBSCRIPTION_UPSELL}isCartRecovery(){return this.objective===lr.CART_RECOVERY}isProductPromotion(){return this.objective===lr.PRODUCT_PROMOTION}isProductPromoted(){return this.isProductPromotion()||this.isBundle()||this.isCartRecovery()}isBYOB(){return this.objective===lr.BYOB}isShoppableVideo(){return this.objective===lr.SHOPPABLE_VIDEO}processPopup(e){let r=JSON.stringify(e),n=this.items[0],i={},o={};if(n){let l=n.selectedOrFirstVariant.value;i={name:n.name,id:n.mID,link:n.link,vID:l.mID,image:n.variantImage,price:ce.formatCurrency(l.price.d),comparePrice:ce.formatCurrency(l.price.cmp),quantity:n.quantity},o={quantity:l.quantity}}let s={productCount:ge.getCurrent().item_count},a=Zt.render(r,{product:i,variant:o,cart:s,discount:this.discount,customer:this.customerData});return n&&(a=a.replace(new RegExp(A.PLACEHOLDER_IMAGE,"gi"),n.variantImage??n.imageURL)),new fs(JSON.parse(a))}calculateDiscountData(e,r){let n=jn.sum(e,o=>o.selectedOrFirstVariant.value.price.d),i={actualPrice:n,discountAmount:0,discountPercentage:0,discountedPrice:n};if(!e?.length||!r||!this.discount?.type){this.discountData.value=this.formatCurrencyAndNumber(i);return}if([ur.UNIQUE_FLAT_ITEMS,ur.STATIC].includes(this.discount.type)&&this.discount.values?.length)i.discountPercentage=this.discount.values[0],i.discountAmount=i.actualPrice*i.discountPercentage/100;else if(this.discount.type===ur.UNIQUE_FIXED_ITEMS&&this.discount.values?.length)i.discountAmount=i.actualPrice-this.discount.values[0],i.discountPercentage=i.discountAmount/i.actualPrice*100;else if(this.discount.type===ur.UNIQUE_CHEAPEST_ITEM_FREE){e.sort((s,a)=>a.selectedOrFirstVariant.value.price.d-s.selectedOrFirstVariant.value.price.d);let o=e[e.length-1];o.selectedOrFirstVariant.value.price.effective=0,i.discountAmount=o.selectedOrFirstVariant.value.price.d,i.discountPercentage=i.discountAmount/i.actualPrice*100}i.discountedPrice=i.actualPrice-i.discountAmount,this.discountData.value=this.formatCurrencyAndNumber(i)}getPrivateAttributesForLineItem(){return{_via:"Cooee",[A.CAMPAIGN_ATTRIBUTE]:this.shortID,_letscooee_content:this.contentID}}isBundleDiscount(){return[ur.UNIQUE_FIXED_ITEMS,ur.UNIQUE_FLAT_ITEMS].includes(this.discount.type)}isBundleOnCartDrawer(){return this.onsiteDeliveryType===Yi.CART_EMBED&&this.objective===lr.BUNDLE_AND_UPSELL}hasSwiperElement(){let e=this.widget?.elems.find(n=>t.SWIPER_ELEMENTS.has(n.t));if(!e)return!1;if(e.t===62)return!0;let r=Nt.get().isMobile()?"sm":"lg";return e.conf[r].disp===2}toString(){return`Engagement(id=${this.shortID})`}formatCurrencyAndNumber(e){if(!e)return{};let r={discountPercentage:ce.formatNumber(e.discountPercentage??0),discountCode:this.discount?.code};return["actualPrice","discountAmount","discountedPrice"].map(n=>{r[n]=ce.formatCurrency(e[n])}),r}};function qh(t,e){return e={exports:{}},t(e,e.exports),e.exports}var Kh=Zh,Jh=tg,Xh=ig,yr=[],Ht=[],Qh=typeof Uint8Array<"u"?Uint8Array:Array,ol="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(pn=0,$p=ol.length;pn<$p;++pn)yr[pn]=ol[pn],Ht[ol.charCodeAt(pn)]=pn;var pn,$p;Ht[45]=62;Ht[95]=63;function nf(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function Zh(t){var e=nf(t),r=e[0],n=e[1];return(r+n)*3/4-n}function eg(t,e,r){return(e+r)*3/4-r}function tg(t){var e,r=nf(t),n=r[0],i=r[1],o=new Qh(eg(t,n,i)),s=0,a=i>0?n-4:n,l;for(l=0;l<a;l+=4)e=Ht[t.charCodeAt(l)]<<18|Ht[t.charCodeAt(l+1)]<<12|Ht[t.charCodeAt(l+2)]<<6|Ht[t.charCodeAt(l+3)],o[s++]=e>>16&255,o[s++]=e>>8&255,o[s++]=e&255;return i===2&&(e=Ht[t.charCodeAt(l)]<<2|Ht[t.charCodeAt(l+1)]>>4,o[s++]=e&255),i===1&&(e=Ht[t.charCodeAt(l)]<<10|Ht[t.charCodeAt(l+1)]<<4|Ht[t.charCodeAt(l+2)]>>2,o[s++]=e>>8&255,o[s++]=e&255),o}function rg(t){return yr[t>>18&63]+yr[t>>12&63]+yr[t>>6&63]+yr[t&63]}function ng(t,e,r){for(var n,i=[],o=e;o<r;o+=3)n=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(t[o+2]&255),i.push(rg(n));return i.join("")}function ig(t){for(var e,r=t.length,n=r%3,i=[],o=16383,s=0,a=r-n;s<a;s+=o)i.push(ng(t,s,s+o>a?a:s+o));return n===1?(e=t[r-1],i.push(yr[e>>2]+yr[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(yr[e>>10]+yr[e>>4&63]+yr[e<<2&63]+"=")),i.join("")}var sl={byteLength:Kh,toByteArray:Jh,fromByteArray:Xh};var og=function(e,r,n,i,o){var s,a,l=o*8-i-1,m=(1<<l)-1,p=m>>1,f=-7,d=n?o-1:0,g=n?-1:1,E=e[r+d];for(d+=g,s=E&(1<<-f)-1,E>>=-f,f+=l;f>0;s=s*256+e[r+d],d+=g,f-=8);for(a=s&(1<<-f)-1,s>>=-f,f+=i;f>0;a=a*256+e[r+d],d+=g,f-=8);if(s===0)s=1-p;else{if(s===m)return a?NaN:(E?-1:1)*(1/0);a=a+Math.pow(2,i),s=s-p}return(E?-1:1)*a*Math.pow(2,s-i)},sg=function(e,r,n,i,o,s){var a,l,m,p=s*8-o-1,f=(1<<p)-1,d=f>>1,g=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,E=i?0:s-1,N=i?1:-1,P=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(l=isNaN(r)?1:0,a=f):(a=Math.floor(Math.log(r)/Math.LN2),r*(m=Math.pow(2,-a))<1&&(a--,m*=2),a+d>=1?r+=g/m:r+=g*Math.pow(2,1-d),r*m>=2&&(a++,m/=2),a+d>=f?(l=0,a=f):a+d>=1?(l=(r*m-1)*Math.pow(2,o),a=a+d):(l=r*Math.pow(2,d-1)*Math.pow(2,o),a=0));o>=8;e[n+E]=l&255,E+=N,l/=256,o-=8);for(a=a<<o|l,p+=o;p>0;e[n+E]=a&255,E+=N,a/=256,p-=8);e[n+E-N]|=P*128},ui={read:og,write:sg},Ts=qh(function(t,e){var r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=s,e.SlowBuffer=R,e.INSPECT_MAX_BYTES=50;var n=2147483647;e.kMaxLength=n,s.TYPED_ARRAY_SUPPORT=i(),!s.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function i(){try{var y=new Uint8Array(1),c={foo:function(){return 42}};return Object.setPrototypeOf(c,Uint8Array.prototype),Object.setPrototypeOf(y,c),y.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function o(y){if(y>n)throw new RangeError('The value "'+y+'" is invalid for option "size"');var c=new Uint8Array(y);return Object.setPrototypeOf(c,s.prototype),c}function s(y,c,u){if(typeof y=="number"){if(typeof c=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return p(y)}return a(y,c,u)}s.poolSize=8192;function a(y,c,u){if(typeof y=="string")return f(y,c);if(ArrayBuffer.isView(y))return g(y);if(y==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(y));if(ft(y,ArrayBuffer)||y&&ft(y.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ft(y,SharedArrayBuffer)||y&&ft(y.buffer,SharedArrayBuffer)))return E(y,c,u);if(typeof y=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var _=y.valueOf&&y.valueOf();if(_!=null&&_!==y)return s.from(_,c,u);var D=N(y);if(D)return D;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof y[Symbol.toPrimitive]=="function")return s.from(y[Symbol.toPrimitive]("string"),c,u);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(y))}s.from=function(y,c,u){return a(y,c,u)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function l(y){if(typeof y!="number")throw new TypeError('"size" argument must be of type number');if(y<0)throw new RangeError('The value "'+y+'" is invalid for option "size"')}function m(y,c,u){return l(y),y<=0?o(y):c!==void 0?typeof u=="string"?o(y).fill(c,u):o(y).fill(c):o(y)}s.alloc=function(y,c,u){return m(y,c,u)};function p(y){return l(y),o(y<0?0:P(y)|0)}s.allocUnsafe=function(y){return p(y)},s.allocUnsafeSlow=function(y){return p(y)};function f(y,c){if((typeof c!="string"||c==="")&&(c="utf8"),!s.isEncoding(c))throw new TypeError("Unknown encoding: "+c);var u=x(y,c)|0,_=o(u),D=_.write(y,c);return D!==u&&(_=_.slice(0,D)),_}function d(y){for(var c=y.length<0?0:P(y.length)|0,u=o(c),_=0;_<c;_+=1)u[_]=y[_]&255;return u}function g(y){if(ft(y,Uint8Array)){var c=new Uint8Array(y);return E(c.buffer,c.byteOffset,c.byteLength)}return d(y)}function E(y,c,u){if(c<0||y.byteLength<c)throw new RangeError('"offset" is outside of buffer bounds');if(y.byteLength<c+(u||0))throw new RangeError('"length" is outside of buffer bounds');var _;return c===void 0&&u===void 0?_=new Uint8Array(y):u===void 0?_=new Uint8Array(y,c):_=new Uint8Array(y,c,u),Object.setPrototypeOf(_,s.prototype),_}function N(y){if(s.isBuffer(y)){var c=P(y.length)|0,u=o(c);return u.length===0||y.copy(u,0,0,c),u}if(y.length!==void 0)return typeof y.length!="number"||Bt(y.length)?o(0):d(y);if(y.type==="Buffer"&&Array.isArray(y.data))return d(y.data)}function P(y){if(y>=n)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n.toString(16)+" bytes");return y|0}function R(y){return+y!=y&&(y=0),s.alloc(+y)}s.isBuffer=function(c){return c!=null&&c._isBuffer===!0&&c!==s.prototype},s.compare=function(c,u){if(ft(c,Uint8Array)&&(c=s.from(c,c.offset,c.byteLength)),ft(u,Uint8Array)&&(u=s.from(u,u.offset,u.byteLength)),!s.isBuffer(c)||!s.isBuffer(u))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(c===u)return 0;for(var _=c.length,D=u.length,B=0,L=Math.min(_,D);B<L;++B)if(c[B]!==u[B]){_=c[B],D=u[B];break}return _<D?-1:D<_?1:0},s.isEncoding=function(c){switch(String(c).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(c,u){if(!Array.isArray(c))throw new TypeError('"list" argument must be an Array of Buffers');if(c.length===0)return s.alloc(0);var _;if(u===void 0)for(u=0,_=0;_<c.length;++_)u+=c[_].length;var D=s.allocUnsafe(u),B=0;for(_=0;_<c.length;++_){var L=c[_];if(ft(L,Uint8Array))B+L.length>D.length?s.from(L).copy(D,B):Uint8Array.prototype.set.call(D,L,B);else if(s.isBuffer(L))L.copy(D,B);else throw new TypeError('"list" argument must be an Array of Buffers');B+=L.length}return D};function x(y,c){if(s.isBuffer(y))return y.length;if(ArrayBuffer.isView(y)||ft(y,ArrayBuffer))return y.byteLength;if(typeof y!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+babelHelpers.typeof(y));var u=y.length,_=arguments.length>2&&arguments[2]===!0;if(!_&&u===0)return 0;for(var D=!1;;)switch(c){case"ascii":case"latin1":case"binary":return u;case"utf8":case"utf-8":return jr(y).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return u*2;case"hex":return u>>>1;case"base64":return kn(y).length;default:if(D)return _?-1:jr(y).length;c=(""+c).toLowerCase(),D=!0}}s.byteLength=x;function W(y,c,u){var _=!1;if((c===void 0||c<0)&&(c=0),c>this.length||((u===void 0||u>this.length)&&(u=this.length),u<=0)||(u>>>=0,c>>>=0,u<=c))return"";for(y||(y="utf8");;)switch(y){case"hex":return Me(this,c,u);case"utf8":case"utf-8":return He(this,c,u);case"ascii":return St(this,c,u);case"latin1":case"binary":return we(this,c,u);case"base64":return be(this,c,u);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return pe(this,c,u);default:if(_)throw new TypeError("Unknown encoding: "+y);y=(y+"").toLowerCase(),_=!0}}s.prototype._isBuffer=!0;function $(y,c,u){var _=y[c];y[c]=y[u],y[u]=_}s.prototype.swap16=function(){var c=this.length;if(c%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var u=0;u<c;u+=2)$(this,u,u+1);return this},s.prototype.swap32=function(){var c=this.length;if(c%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var u=0;u<c;u+=4)$(this,u,u+3),$(this,u+1,u+2);return this},s.prototype.swap64=function(){var c=this.length;if(c%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var u=0;u<c;u+=8)$(this,u,u+7),$(this,u+1,u+6),$(this,u+2,u+5),$(this,u+3,u+4);return this},s.prototype.toString=function(){var c=this.length;return c===0?"":arguments.length===0?He(this,0,c):W.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(c){if(!s.isBuffer(c))throw new TypeError("Argument must be a Buffer");return this===c?!0:s.compare(this,c)===0},s.prototype.inspect=function(){var c="",u=e.INSPECT_MAX_BYTES;return c=this.toString("hex",0,u).replace(/(.{2})/g,"$1 ").trim(),this.length>u&&(c+=" ... "),"<Buffer "+c+">"},r&&(s.prototype[r]=s.prototype.inspect),s.prototype.compare=function(c,u,_,D,B){if(ft(c,Uint8Array)&&(c=s.from(c,c.offset,c.byteLength)),!s.isBuffer(c))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+babelHelpers.typeof(c));if(u===void 0&&(u=0),_===void 0&&(_=c?c.length:0),D===void 0&&(D=0),B===void 0&&(B=this.length),u<0||_>c.length||D<0||B>this.length)throw new RangeError("out of range index");if(D>=B&&u>=_)return 0;if(D>=B)return-1;if(u>=_)return 1;if(u>>>=0,_>>>=0,D>>>=0,B>>>=0,this===c)return 0;for(var L=B-D,re=_-u,me=Math.min(L,re),V=this.slice(D,B),J=c.slice(u,_),G=0;G<me;++G)if(V[G]!==J[G]){L=V[G],re=J[G];break}return L<re?-1:re<L?1:0};function ie(y,c,u,_,D){if(y.length===0)return-1;if(typeof u=="string"?(_=u,u=0):u>2147483647?u=2147483647:u<-2147483648&&(u=-2147483648),u=+u,Bt(u)&&(u=D?0:y.length-1),u<0&&(u=y.length+u),u>=y.length){if(D)return-1;u=y.length-1}else if(u<0)if(D)u=0;else return-1;if(typeof c=="string"&&(c=s.from(c,_)),s.isBuffer(c))return c.length===0?-1:k(y,c,u,_,D);if(typeof c=="number")return c=c&255,typeof Uint8Array.prototype.indexOf=="function"?D?Uint8Array.prototype.indexOf.call(y,c,u):Uint8Array.prototype.lastIndexOf.call(y,c,u):k(y,[c],u,_,D);throw new TypeError("val must be string, number or Buffer")}function k(y,c,u,_,D){var B=1,L=y.length,re=c.length;if(_!==void 0&&(_=String(_).toLowerCase(),_==="ucs2"||_==="ucs-2"||_==="utf16le"||_==="utf-16le")){if(y.length<2||c.length<2)return-1;B=2,L/=2,re/=2,u/=2}function me(mt,st){return B===1?mt[st]:mt.readUInt16BE(st*B)}var V;if(D){var J=-1;for(V=u;V<L;V++)if(me(y,V)===me(c,J===-1?0:V-J)){if(J===-1&&(J=V),V-J+1===re)return J*B}else J!==-1&&(V-=V-J),J=-1}else for(u+re>L&&(u=L-re),V=u;V>=0;V--){for(var G=!0,he=0;he<re;he++)if(me(y,V+he)!==me(c,he)){G=!1;break}if(G)return V}return-1}s.prototype.includes=function(c,u,_){return this.indexOf(c,u,_)!==-1},s.prototype.indexOf=function(c,u,_){return ie(this,c,u,_,!0)},s.prototype.lastIndexOf=function(c,u,_){return ie(this,c,u,_,!1)};function X(y,c,u,_){u=Number(u)||0;var D=y.length-u;_?(_=Number(_),_>D&&(_=D)):_=D;var B=c.length;_>B/2&&(_=B/2);for(var L=0;L<_;++L){var re=parseInt(c.substr(L*2,2),16);if(Bt(re))return L;y[u+L]=re}return L}function z(y,c,u,_){return Jt(jr(c,y.length-u),y,u,_)}function oe(y,c,u,_){return Jt(Un(c),y,u,_)}function Ce(y,c,u,_){return Jt(kn(c),y,u,_)}function de(y,c,u,_){return Jt(Mn(c,y.length-u),y,u,_)}s.prototype.write=function(c,u,_,D){if(u===void 0)D="utf8",_=this.length,u=0;else if(_===void 0&&typeof u=="string")D=u,_=this.length,u=0;else if(isFinite(u))u=u>>>0,isFinite(_)?(_=_>>>0,D===void 0&&(D="utf8")):(D=_,_=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var B=this.length-u;if((_===void 0||_>B)&&(_=B),c.length>0&&(_<0||u<0)||u>this.length)throw new RangeError("Attempt to write outside buffer bounds");D||(D="utf8");for(var L=!1;;)switch(D){case"hex":return X(this,c,u,_);case"utf8":case"utf-8":return z(this,c,u,_);case"ascii":case"latin1":case"binary":return oe(this,c,u,_);case"base64":return Ce(this,c,u,_);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return de(this,c,u,_);default:if(L)throw new TypeError("Unknown encoding: "+D);D=(""+D).toLowerCase(),L=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function be(y,c,u){return c===0&&u===y.length?sl.fromByteArray(y):sl.fromByteArray(y.slice(c,u))}function He(y,c,u){u=Math.min(y.length,u);for(var _=[],D=c;D<u;){var B=y[D],L=null,re=B>239?4:B>223?3:B>191?2:1;if(D+re<=u){var me,V,J,G;switch(re){case 1:B<128&&(L=B);break;case 2:me=y[D+1],(me&192)===128&&(G=(B&31)<<6|me&63,G>127&&(L=G));break;case 3:me=y[D+1],V=y[D+2],(me&192)===128&&(V&192)===128&&(G=(B&15)<<12|(me&63)<<6|V&63,G>2047&&(G<55296||G>57343)&&(L=G));break;case 4:me=y[D+1],V=y[D+2],J=y[D+3],(me&192)===128&&(V&192)===128&&(J&192)===128&&(G=(B&15)<<18|(me&63)<<12|(V&63)<<6|J&63,G>65535&&G<1114112&&(L=G))}}L===null?(L=65533,re=1):L>65535&&(L-=65536,_.push(L>>>10&1023|55296),L=56320|L&1023),_.push(L),D+=re}return ot(_)}var Pe=4096;function ot(y){var c=y.length;if(c<=Pe)return String.fromCharCode.apply(String,y);for(var u="",_=0;_<c;)u+=String.fromCharCode.apply(String,y.slice(_,_+=Pe));return u}function St(y,c,u){var _="";u=Math.min(y.length,u);for(var D=c;D<u;++D)_+=String.fromCharCode(y[D]&127);return _}function we(y,c,u){var _="";u=Math.min(y.length,u);for(var D=c;D<u;++D)_+=String.fromCharCode(y[D]);return _}function Me(y,c,u){var _=y.length;(!c||c<0)&&(c=0),(!u||u<0||u>_)&&(u=_);for(var D="",B=c;B<u;++B)D+=Hi[y[B]];return D}function pe(y,c,u){for(var _=y.slice(c,u),D="",B=0;B<_.length-1;B+=2)D+=String.fromCharCode(_[B]+_[B+1]*256);return D}s.prototype.slice=function(c,u){var _=this.length;c=~~c,u=u===void 0?_:~~u,c<0?(c+=_,c<0&&(c=0)):c>_&&(c=_),u<0?(u+=_,u<0&&(u=0)):u>_&&(u=_),u<c&&(u=c);var D=this.subarray(c,u);return Object.setPrototypeOf(D,s.prototype),D};function te(y,c,u){if(y%1!==0||y<0)throw new RangeError("offset is not uint");if(y+c>u)throw new RangeError("Trying to access beyond buffer length")}s.prototype.readUintLE=s.prototype.readUIntLE=function(c,u,_){c=c>>>0,u=u>>>0,_||te(c,u,this.length);for(var D=this[c],B=1,L=0;++L<u&&(B*=256);)D+=this[c+L]*B;return D},s.prototype.readUintBE=s.prototype.readUIntBE=function(c,u,_){c=c>>>0,u=u>>>0,_||te(c,u,this.length);for(var D=this[c+--u],B=1;u>0&&(B*=256);)D+=this[c+--u]*B;return D},s.prototype.readUint8=s.prototype.readUInt8=function(c,u){return c=c>>>0,u||te(c,1,this.length),this[c]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(c,u){return c=c>>>0,u||te(c,2,this.length),this[c]|this[c+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(c,u){return c=c>>>0,u||te(c,2,this.length),this[c]<<8|this[c+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(c,u){return c=c>>>0,u||te(c,4,this.length),(this[c]|this[c+1]<<8|this[c+2]<<16)+this[c+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(c,u){return c=c>>>0,u||te(c,4,this.length),this[c]*16777216+(this[c+1]<<16|this[c+2]<<8|this[c+3])},s.prototype.readIntLE=function(c,u,_){c=c>>>0,u=u>>>0,_||te(c,u,this.length);for(var D=this[c],B=1,L=0;++L<u&&(B*=256);)D+=this[c+L]*B;return B*=128,D>=B&&(D-=Math.pow(2,8*u)),D},s.prototype.readIntBE=function(c,u,_){c=c>>>0,u=u>>>0,_||te(c,u,this.length);for(var D=u,B=1,L=this[c+--D];D>0&&(B*=256);)L+=this[c+--D]*B;return B*=128,L>=B&&(L-=Math.pow(2,8*u)),L},s.prototype.readInt8=function(c,u){return c=c>>>0,u||te(c,1,this.length),this[c]&128?(255-this[c]+1)*-1:this[c]},s.prototype.readInt16LE=function(c,u){c=c>>>0,u||te(c,2,this.length);var _=this[c]|this[c+1]<<8;return _&32768?_|4294901760:_},s.prototype.readInt16BE=function(c,u){c=c>>>0,u||te(c,2,this.length);var _=this[c+1]|this[c]<<8;return _&32768?_|4294901760:_},s.prototype.readInt32LE=function(c,u){return c=c>>>0,u||te(c,4,this.length),this[c]|this[c+1]<<8|this[c+2]<<16|this[c+3]<<24},s.prototype.readInt32BE=function(c,u){return c=c>>>0,u||te(c,4,this.length),this[c]<<24|this[c+1]<<16|this[c+2]<<8|this[c+3]},s.prototype.readFloatLE=function(c,u){return c=c>>>0,u||te(c,4,this.length),ui.read(this,c,!0,23,4)},s.prototype.readFloatBE=function(c,u){return c=c>>>0,u||te(c,4,this.length),ui.read(this,c,!1,23,4)},s.prototype.readDoubleLE=function(c,u){return c=c>>>0,u||te(c,8,this.length),ui.read(this,c,!0,52,8)},s.prototype.readDoubleBE=function(c,u){return c=c>>>0,u||te(c,8,this.length),ui.read(this,c,!1,52,8)};function ke(y,c,u,_,D,B){if(!s.isBuffer(y))throw new TypeError('"buffer" argument must be a Buffer instance');if(c>D||c<B)throw new RangeError('"value" argument is out of bounds');if(u+_>y.length)throw new RangeError("Index out of range")}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(c,u,_,D){if(c=+c,u=u>>>0,_=_>>>0,!D){var B=Math.pow(2,8*_)-1;ke(this,c,u,_,B,0)}var L=1,re=0;for(this[u]=c&255;++re<_&&(L*=256);)this[u+re]=c/L&255;return u+_},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(c,u,_,D){if(c=+c,u=u>>>0,_=_>>>0,!D){var B=Math.pow(2,8*_)-1;ke(this,c,u,_,B,0)}var L=_-1,re=1;for(this[u+L]=c&255;--L>=0&&(re*=256);)this[u+L]=c/re&255;return u+_},s.prototype.writeUint8=s.prototype.writeUInt8=function(c,u,_){return c=+c,u=u>>>0,_||ke(this,c,u,1,255,0),this[u]=c&255,u+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(c,u,_){return c=+c,u=u>>>0,_||ke(this,c,u,2,65535,0),this[u]=c&255,this[u+1]=c>>>8,u+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(c,u,_){return c=+c,u=u>>>0,_||ke(this,c,u,2,65535,0),this[u]=c>>>8,this[u+1]=c&255,u+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(c,u,_){return c=+c,u=u>>>0,_||ke(this,c,u,4,4294967295,0),this[u+3]=c>>>24,this[u+2]=c>>>16,this[u+1]=c>>>8,this[u]=c&255,u+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(c,u,_){return c=+c,u=u>>>0,_||ke(this,c,u,4,4294967295,0),this[u]=c>>>24,this[u+1]=c>>>16,this[u+2]=c>>>8,this[u+3]=c&255,u+4},s.prototype.writeIntLE=function(c,u,_,D){if(c=+c,u=u>>>0,!D){var B=Math.pow(2,8*_-1);ke(this,c,u,_,B-1,-B)}var L=0,re=1,me=0;for(this[u]=c&255;++L<_&&(re*=256);)c<0&&me===0&&this[u+L-1]!==0&&(me=1),this[u+L]=(c/re>>0)-me&255;return u+_},s.prototype.writeIntBE=function(c,u,_,D){if(c=+c,u=u>>>0,!D){var B=Math.pow(2,8*_-1);ke(this,c,u,_,B-1,-B)}var L=_-1,re=1,me=0;for(this[u+L]=c&255;--L>=0&&(re*=256);)c<0&&me===0&&this[u+L+1]!==0&&(me=1),this[u+L]=(c/re>>0)-me&255;return u+_},s.prototype.writeInt8=function(c,u,_){return c=+c,u=u>>>0,_||ke(this,c,u,1,127,-128),c<0&&(c=255+c+1),this[u]=c&255,u+1},s.prototype.writeInt16LE=function(c,u,_){return c=+c,u=u>>>0,_||ke(this,c,u,2,32767,-32768),this[u]=c&255,this[u+1]=c>>>8,u+2},s.prototype.writeInt16BE=function(c,u,_){return c=+c,u=u>>>0,_||ke(this,c,u,2,32767,-32768),this[u]=c>>>8,this[u+1]=c&255,u+2},s.prototype.writeInt32LE=function(c,u,_){return c=+c,u=u>>>0,_||ke(this,c,u,4,2147483647,-2147483648),this[u]=c&255,this[u+1]=c>>>8,this[u+2]=c>>>16,this[u+3]=c>>>24,u+4},s.prototype.writeInt32BE=function(c,u,_){return c=+c,u=u>>>0,_||ke(this,c,u,4,2147483647,-2147483648),c<0&&(c=4294967295+c+1),this[u]=c>>>24,this[u+1]=c>>>16,this[u+2]=c>>>8,this[u+3]=c&255,u+4};function pt(y,c,u,_,D,B){if(u+_>y.length)throw new RangeError("Index out of range");if(u<0)throw new RangeError("Index out of range")}function ar(y,c,u,_,D){return c=+c,u=u>>>0,D||pt(y,c,u,4),ui.write(y,c,u,_,23,4),u+4}s.prototype.writeFloatLE=function(c,u,_){return ar(this,c,u,!0,_)},s.prototype.writeFloatBE=function(c,u,_){return ar(this,c,u,!1,_)};function $r(y,c,u,_,D){return c=+c,u=u>>>0,D||pt(y,c,u,8),ui.write(y,c,u,_,52,8),u+8}s.prototype.writeDoubleLE=function(c,u,_){return $r(this,c,u,!0,_)},s.prototype.writeDoubleBE=function(c,u,_){return $r(this,c,u,!1,_)},s.prototype.copy=function(c,u,_,D){if(!s.isBuffer(c))throw new TypeError("argument should be a Buffer");if(_||(_=0),!D&&D!==0&&(D=this.length),u>=c.length&&(u=c.length),u||(u=0),D>0&&D<_&&(D=_),D===_||c.length===0||this.length===0)return 0;if(u<0)throw new RangeError("targetStart out of bounds");if(_<0||_>=this.length)throw new RangeError("Index out of range");if(D<0)throw new RangeError("sourceEnd out of bounds");D>this.length&&(D=this.length),c.length-u<D-_&&(D=c.length-u+_);var B=D-_;return this===c&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(u,_,D):Uint8Array.prototype.set.call(c,this.subarray(_,D),u),B},s.prototype.fill=function(c,u,_,D){if(typeof c=="string"){if(typeof u=="string"?(D=u,u=0,_=this.length):typeof _=="string"&&(D=_,_=this.length),D!==void 0&&typeof D!="string")throw new TypeError("encoding must be a string");if(typeof D=="string"&&!s.isEncoding(D))throw new TypeError("Unknown encoding: "+D);if(c.length===1){var B=c.charCodeAt(0);(D==="utf8"&&B<128||D==="latin1")&&(c=B)}}else typeof c=="number"?c=c&255:typeof c=="boolean"&&(c=Number(c));if(u<0||this.length<u||this.length<_)throw new RangeError("Out of range index");if(_<=u)return this;u=u>>>0,_=_===void 0?this.length:_>>>0,c||(c=0);var L;if(typeof c=="number")for(L=u;L<_;++L)this[L]=c;else{var re=s.isBuffer(c)?c:s.from(c,D),me=re.length;if(me===0)throw new TypeError('The value "'+c+'" is invalid for argument "value"');for(L=0;L<_-u;++L)this[L+u]=re[L%me]}return this};var en=/[^+/0-9A-Za-z-_]/g;function Bn(y){if(y=y.split("=")[0],y=y.trim().replace(en,""),y.length<2)return"";for(;y.length%4!==0;)y=y+"=";return y}function jr(y,c){c=c||1/0;for(var u,_=y.length,D=null,B=[],L=0;L<_;++L){if(u=y.charCodeAt(L),u>55295&&u<57344){if(!D){if(u>56319){(c-=3)>-1&&B.push(239,191,189);continue}else if(L+1===_){(c-=3)>-1&&B.push(239,191,189);continue}D=u;continue}if(u<56320){(c-=3)>-1&&B.push(239,191,189),D=u;continue}u=(D-55296<<10|u-56320)+65536}else D&&(c-=3)>-1&&B.push(239,191,189);if(D=null,u<128){if((c-=1)<0)break;B.push(u)}else if(u<2048){if((c-=2)<0)break;B.push(u>>6|192,u&63|128)}else if(u<65536){if((c-=3)<0)break;B.push(u>>12|224,u>>6&63|128,u&63|128)}else if(u<1114112){if((c-=4)<0)break;B.push(u>>18|240,u>>12&63|128,u>>6&63|128,u&63|128)}else throw new Error("Invalid code point")}return B}function Un(y){for(var c=[],u=0;u<y.length;++u)c.push(y.charCodeAt(u)&255);return c}function Mn(y,c){for(var u,_,D,B=[],L=0;L<y.length&&!((c-=2)<0);++L)u=y.charCodeAt(L),_=u>>8,D=u%256,B.push(D),B.push(_);return B}function kn(y){return sl.toByteArray(Bn(y))}function Jt(y,c,u,_){for(var D=0;D<_&&!(D+u>=c.length||D>=y.length);++D)c[D+u]=y[D];return D}function ft(y,c){return y instanceof c||y!=null&&y.constructor!=null&&y.constructor.name!=null&&y.constructor.name===c.name}function Bt(y){return y!==y}var Hi=function(){for(var y="0123456789abcdef",c=new Array(256),u=0;u<16;++u)for(var _=u*16,D=0;D<16;++D)c[_+D]=y[u]+y[D];return c}()}),Ee=Ts.Buffer;Ts.SlowBuffer;Ts.INSPECT_MAX_BYTES;Ts.kMaxLength;var pl=function(e,r){return pl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},pl(e,r)};function xs(t,e){pl(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var mn=function(t){xs(e,t);function e(r){var n=t.call(this,r)||this;return Object.setPrototypeOf(n,e.prototype),n}return Object.defineProperty(e.prototype,"name",{get:function(){return"BSONError"},enumerable:!1,configurable:!0}),e}(Error),Fe=function(t){xs(e,t);function e(r){var n=t.call(this,r)||this;return Object.setPrototypeOf(n,e.prototype),n}return Object.defineProperty(e.prototype,"name",{get:function(){return"BSONTypeError"},enumerable:!1,configurable:!0}),e}(TypeError);function ws(t){return t&&t.Math==Math&&t}function of(){return ws(typeof globalThis=="object"&&globalThis)||ws(typeof window=="object"&&window)||ws(typeof self=="object"&&self)||ws(typeof global=="object"&&global)||Function("return this")()}function ag(){var t=of();return typeof t.navigator=="object"&&t.navigator.product==="ReactNative"}var cg=function(e){var r=ag()?"BSON: For React Native please polyfill crypto.getRandomValues, e.g. using: https://www.npmjs.com/package/react-native-get-random-values.":"BSON: No cryptographic implementation for random bytes present, falling back to a less secure implementation.";console.warn(r);for(var n=Ee.alloc(e),i=0;i<e;++i)n[i]=Math.floor(Math.random()*256);return n},lg=function(){{if(typeof window<"u"){var t=window.crypto||window.msCrypto;if(t&&t.getRandomValues)return function(e){return t.getRandomValues(Ee.alloc(e))}}return typeof global<"u"&&global.crypto&&global.crypto.getRandomValues?function(e){return global.crypto.getRandomValues(Ee.alloc(e))}:cg}},sf=lg();function ug(t){return["[object ArrayBuffer]","[object SharedArrayBuffer]"].includes(Object.prototype.toString.call(t))}function ml(t){return Object.prototype.toString.call(t)==="[object Uint8Array]"}function pg(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function fg(t){return uo(t)&&Object.prototype.toString.call(t)==="[object Date]"}function uo(t){return typeof t=="object"&&t!==null}function Cs(t,e){var r=!1;function n(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];return r||(console.warn(e),r=!0),t.apply(this,i)}return n}function Is(t){if(ArrayBuffer.isView(t))return Ee.from(t.buffer,t.byteOffset,t.byteLength);if(ug(t))return Ee.from(t);throw new Fe("Must use either Buffer or TypedArray")}var mg=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|[0-9a-f]{12}4[0-9a-f]{3}[89ab][0-9a-f]{15})$/i,af=function(t){return typeof t=="string"&&mg.test(t)},fl=function(t){if(!af(t))throw new Fe('UUID string representations must be a 32 or 36 character hex string (dashes excluded/included). Format: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" or "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".');var e=t.replace(/-/g,"");return Ee.from(e,"hex")},jp=function(t,e){return e===void 0&&(e=!0),e?t.toString("hex",0,4)+"-"+t.toString("hex",4,6)+"-"+t.toString("hex",6,8)+"-"+t.toString("hex",8,10)+"-"+t.toString("hex",10,16):t.toString("hex")};var Z0=Math.pow(2,63)-1,eI=-Math.pow(2,63),dg=Math.pow(2,53),hg=-Math.pow(2,53);var cf=4;var dn=function(){function t(e,r){if(!(this instanceof t))return new t(e,r);if(e!=null&&typeof e!="string"&&!ArrayBuffer.isView(e)&&!(e instanceof ArrayBuffer)&&!Array.isArray(e))throw new Fe("Binary can only be constructed from string, Buffer, TypedArray, or Array<number>");this.sub_type=r??t.BSON_BINARY_SUBTYPE_DEFAULT,e==null?(this.buffer=Ee.alloc(t.BUFFER_SIZE),this.position=0):(typeof e=="string"?this.buffer=Ee.from(e,"binary"):Array.isArray(e)?this.buffer=Ee.from(e):this.buffer=Is(e),this.position=this.buffer.byteLength)}return t.prototype.put=function(e){if(typeof e=="string"&&e.length!==1)throw new Fe("only accepts single character String");if(typeof e!="number"&&e.length!==1)throw new Fe("only accepts single character Uint8Array or Array");var r;if(typeof e=="string"?r=e.charCodeAt(0):typeof e=="number"?r=e:r=e[0],r<0||r>255)throw new Fe("only accepts number in a valid unsigned byte range 0-255");if(this.buffer.length>this.position)this.buffer[this.position++]=r;else{var n=Ee.alloc(t.BUFFER_SIZE+this.buffer.length);this.buffer.copy(n,0,0,this.buffer.length),this.buffer=n,this.buffer[this.position++]=r}},t.prototype.write=function(e,r){if(r=typeof r=="number"?r:this.position,this.buffer.length<r+e.length){var n=Ee.alloc(this.buffer.length+e.length);this.buffer.copy(n,0,0,this.buffer.length),this.buffer=n}ArrayBuffer.isView(e)?(this.buffer.set(Is(e),r),this.position=r+e.byteLength>this.position?r+e.length:this.position):typeof e=="string"&&(this.buffer.write(e,r,e.length,"binary"),this.position=r+e.length>this.position?r+e.length:this.position)},t.prototype.read=function(e,r){return r=r&&r>0?r:this.position,this.buffer.slice(e,e+r)},t.prototype.value=function(e){return e=!!e,e&&this.buffer.length===this.position?this.buffer:e?this.buffer.slice(0,this.position):this.buffer.toString("binary",0,this.position)},t.prototype.length=function(){return this.position},t.prototype.toJSON=function(){return this.buffer.toString("base64")},t.prototype.toString=function(e){return this.buffer.toString(e)},t.prototype.toExtendedJSON=function(e){e=e||{};var r=this.buffer.toString("base64"),n=Number(this.sub_type).toString(16);return e.legacy?{$binary:r,$type:n.length===1?"0"+n:n}:{$binary:{base64:r,subType:n.length===1?"0"+n:n}}},t.prototype.toUUID=function(){if(this.sub_type===t.SUBTYPE_UUID)return new Wp(this.buffer.slice(0,this.position));throw new mn('Binary sub_type "'.concat(this.sub_type,'" is not supported for converting to UUID. Only "').concat(t.SUBTYPE_UUID,'" is currently supported.'))},t.fromExtendedJSON=function(e,r){r=r||{};var n,i;if("$binary"in e?r.legacy&&typeof e.$binary=="string"&&"$type"in e?(i=e.$type?parseInt(e.$type,16):0,n=Ee.from(e.$binary,"base64")):typeof e.$binary!="string"&&(i=e.$binary.subType?parseInt(e.$binary.subType,16):0,n=Ee.from(e.$binary.base64,"base64")):"$uuid"in e&&(i=4,n=fl(e.$uuid)),!n)throw new Fe("Unexpected Binary Extended JSON format ".concat(JSON.stringify(e)));return i===cf?new Wp(n):new t(n,i)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var e=this.value(!0);return'new Binary(Buffer.from("'.concat(e.toString("hex"),'", "hex"), ').concat(this.sub_type,")")},t.BSON_BINARY_SUBTYPE_DEFAULT=0,t.BUFFER_SIZE=256,t.SUBTYPE_DEFAULT=0,t.SUBTYPE_FUNCTION=1,t.SUBTYPE_BYTE_ARRAY=2,t.SUBTYPE_UUID_OLD=3,t.SUBTYPE_UUID=4,t.SUBTYPE_MD5=5,t.SUBTYPE_ENCRYPTED=6,t.SUBTYPE_COLUMN=7,t.SUBTYPE_USER_DEFINED=128,t}();Object.defineProperty(dn.prototype,"_bsontype",{value:"Binary"});var al=16,Wp=function(t){xs(e,t);function e(r){var n=this,i,o;if(r==null)i=e.generate();else if(r instanceof e)i=Ee.from(r.buffer),o=r.__id;else if(ArrayBuffer.isView(r)&&r.byteLength===al)i=Is(r);else if(typeof r=="string")i=fl(r);else throw new Fe("Argument passed in UUID constructor must be a UUID, a 16 byte Buffer or a 32/36 character hex string (dashes excluded/included, format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).");return n=t.call(this,i,cf)||this,n.__id=o,n}return Object.defineProperty(e.prototype,"id",{get:function(){return this.buffer},set:function(r){this.buffer=r,e.cacheHexString&&(this.__id=jp(r))},enumerable:!1,configurable:!0}),e.prototype.toHexString=function(r){if(r===void 0&&(r=!0),e.cacheHexString&&this.__id)return this.__id;var n=jp(this.id,r);return e.cacheHexString&&(this.__id=n),n},e.prototype.toString=function(r){return r?this.id.toString(r):this.toHexString()},e.prototype.toJSON=function(){return this.toHexString()},e.prototype.equals=function(r){if(!r)return!1;if(r instanceof e)return r.id.equals(this.id);try{return new e(r).id.equals(this.id)}catch{return!1}},e.prototype.toBinary=function(){return new dn(this.id,dn.SUBTYPE_UUID)},e.generate=function(){var r=sf(al);return r[6]=r[6]&15|64,r[8]=r[8]&63|128,Ee.from(r)},e.isValid=function(r){return r?r instanceof e?!0:typeof r=="string"?af(r):ml(r)?r.length!==al?!1:(r[6]&240)===64&&(r[8]&128)===128:!1:!1},e.createFromHexString=function(r){var n=fl(r);return new e(n)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return'new UUID("'.concat(this.toHexString(),'")')},e}(dn),Ds=function(){function t(e,r){if(!(this instanceof t))return new t(e,r);this.code=e,this.scope=r}return t.prototype.toJSON=function(){return{code:this.code,scope:this.scope}},t.prototype.toExtendedJSON=function(){return this.scope?{$code:this.code,$scope:this.scope}:{$code:this.code}},t.fromExtendedJSON=function(e){return new t(e.$code,e.$scope)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var e=this.toJSON();return'new Code("'.concat(String(e.code),'"').concat(e.scope?", ".concat(JSON.stringify(e.scope)):"",")")},t}();Object.defineProperty(Ds.prototype,"_bsontype",{value:"Code"});function gg(t){return uo(t)&&t.$id!=null&&typeof t.$ref=="string"&&(t.$db==null||typeof t.$db=="string")}var co=function(){function t(e,r,n,i){if(!(this instanceof t))return new t(e,r,n,i);var o=e.split(".");o.length===2&&(n=o.shift(),e=o.shift()),this.collection=e,this.oid=r,this.db=n,this.fields=i||{}}return Object.defineProperty(t.prototype,"namespace",{get:function(){return this.collection},set:function(e){this.collection=e},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){var e=Object.assign({$ref:this.collection,$id:this.oid},this.fields);return this.db!=null&&(e.$db=this.db),e},t.prototype.toExtendedJSON=function(e){e=e||{};var r={$ref:this.collection,$id:this.oid};return e.legacy||(this.db&&(r.$db=this.db),r=Object.assign(r,this.fields)),r},t.fromExtendedJSON=function(e){var r=Object.assign({},e);return delete r.$ref,delete r.$id,delete r.$db,new t(e.$ref,e.$id,e.$db,r)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var e=this.oid===void 0||this.oid.toString===void 0?this.oid:this.oid.toString();return'new DBRef("'.concat(this.namespace,'", new ObjectId("').concat(String(e),'")').concat(this.db?', "'.concat(this.db,'"'):"",")")},t}();Object.defineProperty(co.prototype,"_bsontype",{value:"DBRef"});var Ft=void 0;try{Ft=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}var Gp=65536,yg=1<<24,fi=Gp*Gp,lf=fi*fi,Vp=lf/2,zp={},Yp={},K=function(){function t(e,r,n){if(e===void 0&&(e=0),!(this instanceof t))return new t(e,r,n);typeof e=="bigint"?Object.assign(this,t.fromBigInt(e,!!r)):typeof e=="string"?Object.assign(this,t.fromString(e,!!r)):(this.low=e|0,this.high=r|0,this.unsigned=!!n),Object.defineProperty(this,"__isLong__",{value:!0,configurable:!1,writable:!1,enumerable:!1})}return t.fromBits=function(e,r,n){return new t(e,r,n)},t.fromInt=function(e,r){var n,i,o;return r?(e>>>=0,(o=0<=e&&e<256)&&(i=Yp[e],i)?i:(n=t.fromBits(e,(e|0)<0?-1:0,!0),o&&(Yp[e]=n),n)):(e|=0,(o=-128<=e&&e<128)&&(i=zp[e],i)?i:(n=t.fromBits(e,e<0?-1:0,!1),o&&(zp[e]=n),n))},t.fromNumber=function(e,r){if(isNaN(e))return r?t.UZERO:t.ZERO;if(r){if(e<0)return t.UZERO;if(e>=lf)return t.MAX_UNSIGNED_VALUE}else{if(e<=-Vp)return t.MIN_VALUE;if(e+1>=Vp)return t.MAX_VALUE}return e<0?t.fromNumber(-e,r).neg():t.fromBits(e%fi|0,e/fi|0,r)},t.fromBigInt=function(e,r){return t.fromString(e.toString(),r)},t.fromString=function(e,r,n){if(e.length===0)throw Error("empty string");if(e==="NaN"||e==="Infinity"||e==="+Infinity"||e==="-Infinity")return t.ZERO;if(typeof r=="number"?(n=r,r=!1):r=!!r,n=n||10,n<2||36<n)throw RangeError("radix");var i;if((i=e.indexOf("-"))>0)throw Error("interior hyphen");if(i===0)return t.fromString(e.substring(1),r,n).neg();for(var o=t.fromNumber(Math.pow(n,8)),s=t.ZERO,a=0;a<e.length;a+=8){var l=Math.min(8,e.length-a),m=parseInt(e.substring(a,a+l),n);if(l<8){var p=t.fromNumber(Math.pow(n,l));s=s.mul(p).add(t.fromNumber(m))}else s=s.mul(o),s=s.add(t.fromNumber(m))}return s.unsigned=r,s},t.fromBytes=function(e,r,n){return n?t.fromBytesLE(e,r):t.fromBytesBE(e,r)},t.fromBytesLE=function(e,r){return new t(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,r)},t.fromBytesBE=function(e,r){return new t(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],r)},t.isLong=function(e){return uo(e)&&e.__isLong__===!0},t.fromValue=function(e,r){return typeof e=="number"?t.fromNumber(e,r):typeof e=="string"?t.fromString(e,r):t.fromBits(e.low,e.high,typeof r=="boolean"?r:e.unsigned)},t.prototype.add=function(e){t.isLong(e)||(e=t.fromValue(e));var r=this.high>>>16,n=this.high&65535,i=this.low>>>16,o=this.low&65535,s=e.high>>>16,a=e.high&65535,l=e.low>>>16,m=e.low&65535,p=0,f=0,d=0,g=0;return g+=o+m,d+=g>>>16,g&=65535,d+=i+l,f+=d>>>16,d&=65535,f+=n+a,p+=f>>>16,f&=65535,p+=r+s,p&=65535,t.fromBits(d<<16|g,p<<16|f,this.unsigned)},t.prototype.and=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low&e.low,this.high&e.high,this.unsigned)},t.prototype.compare=function(e){if(t.isLong(e)||(e=t.fromValue(e)),this.eq(e))return 0;var r=this.isNegative(),n=e.isNegative();return r&&!n?-1:!r&&n?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},t.prototype.comp=function(e){return this.compare(e)},t.prototype.divide=function(e){if(t.isLong(e)||(e=t.fromValue(e)),e.isZero())throw Error("division by zero");if(Ft){if(!this.unsigned&&this.high===-2147483648&&e.low===-1&&e.high===-1)return this;var r=(this.unsigned?Ft.div_u:Ft.div_s)(this.low,this.high,e.low,e.high);return t.fromBits(r,Ft.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?t.UZERO:t.ZERO;var n,i,o;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return t.UZERO;if(e.gt(this.shru(1)))return t.UONE;o=t.UZERO}else{if(this.eq(t.MIN_VALUE)){if(e.eq(t.ONE)||e.eq(t.NEG_ONE))return t.MIN_VALUE;if(e.eq(t.MIN_VALUE))return t.ONE;var s=this.shr(1);return n=s.div(e).shl(1),n.eq(t.ZERO)?e.isNegative()?t.ONE:t.NEG_ONE:(i=this.sub(e.mul(n)),o=n.add(i.div(e)),o)}else if(e.eq(t.MIN_VALUE))return this.unsigned?t.UZERO:t.ZERO;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();o=t.ZERO}for(i=this;i.gte(e);){n=Math.max(1,Math.floor(i.toNumber()/e.toNumber()));for(var a=Math.ceil(Math.log(n)/Math.LN2),l=a<=48?1:Math.pow(2,a-48),m=t.fromNumber(n),p=m.mul(e);p.isNegative()||p.gt(i);)n-=l,m=t.fromNumber(n,this.unsigned),p=m.mul(e);m.isZero()&&(m=t.ONE),o=o.add(m),i=i.sub(p)}return o},t.prototype.div=function(e){return this.divide(e)},t.prototype.equals=function(e){return t.isLong(e)||(e=t.fromValue(e)),this.unsigned!==e.unsigned&&this.high>>>31===1&&e.high>>>31===1?!1:this.high===e.high&&this.low===e.low},t.prototype.eq=function(e){return this.equals(e)},t.prototype.getHighBits=function(){return this.high},t.prototype.getHighBitsUnsigned=function(){return this.high>>>0},t.prototype.getLowBits=function(){return this.low},t.prototype.getLowBitsUnsigned=function(){return this.low>>>0},t.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.eq(t.MIN_VALUE)?64:this.neg().getNumBitsAbs();var e=this.high!==0?this.high:this.low,r;for(r=31;r>0&&(e&1<<r)===0;r--);return this.high!==0?r+33:r+1},t.prototype.greaterThan=function(e){return this.comp(e)>0},t.prototype.gt=function(e){return this.greaterThan(e)},t.prototype.greaterThanOrEqual=function(e){return this.comp(e)>=0},t.prototype.gte=function(e){return this.greaterThanOrEqual(e)},t.prototype.ge=function(e){return this.greaterThanOrEqual(e)},t.prototype.isEven=function(){return(this.low&1)===0},t.prototype.isNegative=function(){return!this.unsigned&&this.high<0},t.prototype.isOdd=function(){return(this.low&1)===1},t.prototype.isPositive=function(){return this.unsigned||this.high>=0},t.prototype.isZero=function(){return this.high===0&&this.low===0},t.prototype.lessThan=function(e){return this.comp(e)<0},t.prototype.lt=function(e){return this.lessThan(e)},t.prototype.lessThanOrEqual=function(e){return this.comp(e)<=0},t.prototype.lte=function(e){return this.lessThanOrEqual(e)},t.prototype.modulo=function(e){if(t.isLong(e)||(e=t.fromValue(e)),Ft){var r=(this.unsigned?Ft.rem_u:Ft.rem_s)(this.low,this.high,e.low,e.high);return t.fromBits(r,Ft.get_high(),this.unsigned)}return this.sub(this.div(e).mul(e))},t.prototype.mod=function(e){return this.modulo(e)},t.prototype.rem=function(e){return this.modulo(e)},t.prototype.multiply=function(e){if(this.isZero())return t.ZERO;if(t.isLong(e)||(e=t.fromValue(e)),Ft){var r=Ft.mul(this.low,this.high,e.low,e.high);return t.fromBits(r,Ft.get_high(),this.unsigned)}if(e.isZero())return t.ZERO;if(this.eq(t.MIN_VALUE))return e.isOdd()?t.MIN_VALUE:t.ZERO;if(e.eq(t.MIN_VALUE))return this.isOdd()?t.MIN_VALUE:t.ZERO;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(t.TWO_PWR_24)&&e.lt(t.TWO_PWR_24))return t.fromNumber(this.toNumber()*e.toNumber(),this.unsigned);var n=this.high>>>16,i=this.high&65535,o=this.low>>>16,s=this.low&65535,a=e.high>>>16,l=e.high&65535,m=e.low>>>16,p=e.low&65535,f=0,d=0,g=0,E=0;return E+=s*p,g+=E>>>16,E&=65535,g+=o*p,d+=g>>>16,g&=65535,g+=s*m,d+=g>>>16,g&=65535,d+=i*p,f+=d>>>16,d&=65535,d+=o*m,f+=d>>>16,d&=65535,d+=s*l,f+=d>>>16,d&=65535,f+=n*p+i*m+o*l+s*a,f&=65535,t.fromBits(g<<16|E,f<<16|d,this.unsigned)},t.prototype.mul=function(e){return this.multiply(e)},t.prototype.negate=function(){return!this.unsigned&&this.eq(t.MIN_VALUE)?t.MIN_VALUE:this.not().add(t.ONE)},t.prototype.neg=function(){return this.negate()},t.prototype.not=function(){return t.fromBits(~this.low,~this.high,this.unsigned)},t.prototype.notEquals=function(e){return!this.equals(e)},t.prototype.neq=function(e){return this.notEquals(e)},t.prototype.ne=function(e){return this.notEquals(e)},t.prototype.or=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low|e.low,this.high|e.high,this.unsigned)},t.prototype.shiftLeft=function(e){return t.isLong(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?t.fromBits(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):t.fromBits(0,this.low<<e-32,this.unsigned)},t.prototype.shl=function(e){return this.shiftLeft(e)},t.prototype.shiftRight=function(e){return t.isLong(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?t.fromBits(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):t.fromBits(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},t.prototype.shr=function(e){return this.shiftRight(e)},t.prototype.shiftRightUnsigned=function(e){if(t.isLong(e)&&(e=e.toInt()),e&=63,e===0)return this;var r=this.high;if(e<32){var n=this.low;return t.fromBits(n>>>e|r<<32-e,r>>>e,this.unsigned)}else return e===32?t.fromBits(r,0,this.unsigned):t.fromBits(r>>>e-32,0,this.unsigned)},t.prototype.shr_u=function(e){return this.shiftRightUnsigned(e)},t.prototype.shru=function(e){return this.shiftRightUnsigned(e)},t.prototype.subtract=function(e){return t.isLong(e)||(e=t.fromValue(e)),this.add(e.neg())},t.prototype.sub=function(e){return this.subtract(e)},t.prototype.toInt=function(){return this.unsigned?this.low>>>0:this.low},t.prototype.toNumber=function(){return this.unsigned?(this.high>>>0)*fi+(this.low>>>0):this.high*fi+(this.low>>>0)},t.prototype.toBigInt=function(){return BigInt(this.toString())},t.prototype.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},t.prototype.toBytesLE=function(){var e=this.high,r=this.low;return[r&255,r>>>8&255,r>>>16&255,r>>>24,e&255,e>>>8&255,e>>>16&255,e>>>24]},t.prototype.toBytesBE=function(){var e=this.high,r=this.low;return[e>>>24,e>>>16&255,e>>>8&255,e&255,r>>>24,r>>>16&255,r>>>8&255,r&255]},t.prototype.toSigned=function(){return this.unsigned?t.fromBits(this.low,this.high,!1):this},t.prototype.toString=function(e){if(e=e||10,e<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(t.MIN_VALUE)){var r=t.fromNumber(e),n=this.div(r),i=n.mul(r).sub(this);return n.toString(e)+i.toInt().toString(e)}else return"-"+this.neg().toString(e);for(var o=t.fromNumber(Math.pow(e,6),this.unsigned),s=this,a="";;){var l=s.div(o),m=s.sub(l.mul(o)).toInt()>>>0,p=m.toString(e);if(s=l,s.isZero())return p+a;for(;p.length<6;)p="0"+p;a=""+p+a}},t.prototype.toUnsigned=function(){return this.unsigned?this:t.fromBits(this.low,this.high,!0)},t.prototype.xor=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low^e.low,this.high^e.high,this.unsigned)},t.prototype.eqz=function(){return this.isZero()},t.prototype.le=function(e){return this.lessThanOrEqual(e)},t.prototype.toExtendedJSON=function(e){return e&&e.relaxed?this.toNumber():{$numberLong:this.toString()}},t.fromExtendedJSON=function(e,r){var n=t.fromString(e.$numberLong);return r&&r.relaxed?n.toNumber():n},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new Long("'.concat(this.toString(),'"').concat(this.unsigned?", true":"",")")},t.TWO_PWR_24=t.fromInt(yg),t.MAX_UNSIGNED_VALUE=t.fromBits(-1,-1,!0),t.ZERO=t.fromInt(0),t.UZERO=t.fromInt(0,!0),t.ONE=t.fromInt(1),t.UONE=t.fromInt(1,!0),t.NEG_ONE=t.fromInt(-1),t.MAX_VALUE=t.fromBits(-1,2147483647,!1),t.MIN_VALUE=t.fromBits(0,-2147483648,!1),t}();Object.defineProperty(K.prototype,"__isLong__",{value:!0});Object.defineProperty(K.prototype,"_bsontype",{value:"Long"});var vg=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,_g=/^(\+|-)?(Infinity|inf)$/i,Eg=/^(\+|-)?NaN$/i,ao=6111,cl=-6176,qp=6176,Sg=34,ll=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Kp=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Jp=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),bg=/^([-+])?(\d+)?$/,wg=31,Xp=16383,Ig=30,Tg=31;function Qp(t){return!isNaN(parseInt(t,10))}function xg(t){var e=K.fromNumber(1e9),r=K.fromNumber(0);if(!t.parts[0]&&!t.parts[1]&&!t.parts[2]&&!t.parts[3])return{quotient:t,rem:r};for(var n=0;n<=3;n++)r=r.shiftLeft(32),r=r.add(new K(t.parts[n],0)),t.parts[n]=r.div(e).low,r=r.modulo(e);return{quotient:t,rem:r}}function Cg(t,e){if(!t&&!e)return{high:K.fromNumber(0),low:K.fromNumber(0)};var r=t.shiftRightUnsigned(32),n=new K(t.getLowBits(),0),i=e.shiftRightUnsigned(32),o=new K(e.getLowBits(),0),s=r.multiply(i),a=r.multiply(o),l=n.multiply(i),m=n.multiply(o);return s=s.add(a.shiftRightUnsigned(32)),a=new K(a.getLowBits(),0).add(l).add(m.shiftRightUnsigned(32)),s=s.add(a.shiftRightUnsigned(32)),m=a.shiftLeft(32).add(new K(m.getLowBits(),0)),{high:s,low:m}}function Dg(t,e){var r=t.high>>>0,n=e.high>>>0;if(r<n)return!0;if(r===n){var i=t.low>>>0,o=e.low>>>0;if(i<o)return!0}return!1}function pi(t,e){throw new Fe('"'.concat(t,'" is not a valid Decimal128 string - ').concat(e))}var dl=function(){function t(e){if(!(this instanceof t))return new t(e);if(typeof e=="string")this.bytes=t.fromString(e).bytes;else if(ml(e)){if(e.byteLength!==16)throw new Fe("Decimal128 must take a Buffer of 16 bytes");this.bytes=e}else throw new Fe("Decimal128 must take a Buffer or string")}return t.fromString=function(e){var r=!1,n=!1,i=!1,o=0,s=0,a=0,l=0,m=0,p=[0],f=0,d=0,g=0,E=0,N=0,P=0,R=new K(0,0),x=new K(0,0),W=0,$=0;if(e.length>=7e3)throw new Fe(""+e+" not a valid Decimal128 string");var ie=e.match(vg),k=e.match(_g),X=e.match(Eg);if(!ie&&!k&&!X||e.length===0)throw new Fe(""+e+" not a valid Decimal128 string");if(ie){var z=ie[2],oe=ie[4],Ce=ie[5],de=ie[6];oe&&de===void 0&&pi(e,"missing exponent power"),oe&&z===void 0&&pi(e,"missing exponent base"),oe===void 0&&(Ce||de)&&pi(e,"missing e before exponent")}if((e[$]==="+"||e[$]==="-")&&(r=e[$++]==="-"),!Qp(e[$])&&e[$]!=="."){if(e[$]==="i"||e[$]==="I")return new t(Ee.from(r?Kp:Jp));if(e[$]==="N")return new t(Ee.from(ll))}for(;Qp(e[$])||e[$]===".";){if(e[$]==="."){n&&pi(e,"contains multiple periods"),n=!0,$=$+1;continue}f<34&&(e[$]!=="0"||i)&&(i||(m=s),i=!0,p[d++]=parseInt(e[$],10),f=f+1),i&&(a=a+1),n&&(l=l+1),s=s+1,$=$+1}if(n&&!s)throw new Fe(""+e+" not a valid Decimal128 string");if(e[$]==="e"||e[$]==="E"){var be=e.substr(++$).match(bg);if(!be||!be[2])return new t(Ee.from(ll));N=parseInt(be[0],10),$=$+be[0].length}if(e[$])return new t(Ee.from(ll));if(g=0,!f)g=0,E=0,p[0]=0,a=1,f=1,o=0;else if(E=f-1,o=a,o!==1)for(;p[m+o-1]===0;)o=o-1;for(N<=l&&l-N>16384?N=cl:N=N-l;N>ao;){if(E=E+1,E-g>Sg){var He=p.join("");if(He.match(/^0+$/)){N=ao;break}pi(e,"overflow")}N=N-1}for(;N<cl||f<a;){if(E===0&&o<f){N=cl,o=0;break}if(f<a?a=a-1:E=E-1,N<ao)N=N+1;else{var He=p.join("");if(He.match(/^0+$/)){N=ao;break}pi(e,"overflow")}}if(E-g+1<o){var Pe=s;n&&(m=m+1,Pe=Pe+1),r&&(m=m+1,Pe=Pe+1);var ot=parseInt(e[m+E+1],10),St=0;if(ot>=5&&(St=1,ot===5)){for(St=p[E]%2===1?1:0,P=m+E+2;P<Pe;P++)if(parseInt(e[P],10)){St=1;break}}if(St){for(var we=E;we>=0;we--)if(++p[we]>9&&(p[we]=0,we===0))if(N<ao)N=N+1,p[we]=1;else return new t(Ee.from(r?Kp:Jp))}}if(R=K.fromNumber(0),x=K.fromNumber(0),o===0)R=K.fromNumber(0),x=K.fromNumber(0);else if(E-g<17){var we=g;for(x=K.fromNumber(p[we++]),R=new K(0,0);we<=E;we++)x=x.multiply(K.fromNumber(10)),x=x.add(K.fromNumber(p[we]))}else{var we=g;for(R=K.fromNumber(p[we++]);we<=E-17;we++)R=R.multiply(K.fromNumber(10)),R=R.add(K.fromNumber(p[we]));for(x=K.fromNumber(p[we++]);we<=E;we++)x=x.multiply(K.fromNumber(10)),x=x.add(K.fromNumber(p[we]))}var Me=Cg(R,K.fromString("100000000000000000"));Me.low=Me.low.add(x),Dg(Me.low,x)&&(Me.high=Me.high.add(K.fromNumber(1))),W=N+qp;var pe={low:K.fromNumber(0),high:K.fromNumber(0)};Me.high.shiftRightUnsigned(49).and(K.fromNumber(1)).equals(K.fromNumber(1))?(pe.high=pe.high.or(K.fromNumber(3).shiftLeft(61)),pe.high=pe.high.or(K.fromNumber(W).and(K.fromNumber(16383).shiftLeft(47))),pe.high=pe.high.or(Me.high.and(K.fromNumber(0x7fffffffffff)))):(pe.high=pe.high.or(K.fromNumber(W&16383).shiftLeft(49)),pe.high=pe.high.or(Me.high.and(K.fromNumber(562949953421311)))),pe.low=Me.low,r&&(pe.high=pe.high.or(K.fromString("9223372036854775808")));var te=Ee.alloc(16);return $=0,te[$++]=pe.low.low&255,te[$++]=pe.low.low>>8&255,te[$++]=pe.low.low>>16&255,te[$++]=pe.low.low>>24&255,te[$++]=pe.low.high&255,te[$++]=pe.low.high>>8&255,te[$++]=pe.low.high>>16&255,te[$++]=pe.low.high>>24&255,te[$++]=pe.high.low&255,te[$++]=pe.high.low>>8&255,te[$++]=pe.high.low>>16&255,te[$++]=pe.high.low>>24&255,te[$++]=pe.high.high&255,te[$++]=pe.high.high>>8&255,te[$++]=pe.high.high>>16&255,te[$++]=pe.high.high>>24&255,new t(te)},t.prototype.toString=function(){for(var e,r=0,n=new Array(36),i=0;i<n.length;i++)n[i]=0;var o=0,s=!1,a,l={parts:[0,0,0,0]},m,p,f=[];o=0;var d=this.bytes,g=d[o++]|d[o++]<<8|d[o++]<<16|d[o++]<<24,E=d[o++]|d[o++]<<8|d[o++]<<16|d[o++]<<24,N=d[o++]|d[o++]<<8|d[o++]<<16|d[o++]<<24,P=d[o++]|d[o++]<<8|d[o++]<<16|d[o++]<<24;o=0;var R={low:new K(g,E),high:new K(N,P)};R.high.lessThan(K.ZERO)&&f.push("-");var x=P>>26&wg;if(x>>3===3){if(x===Ig)return f.join("")+"Infinity";if(x===Tg)return"NaN";e=P>>15&Xp,a=8+(P>>14&1)}else a=P>>14&7,e=P>>17&Xp;var W=e-qp;if(l.parts[0]=(P&16383)+((a&15)<<14),l.parts[1]=N,l.parts[2]=E,l.parts[3]=g,l.parts[0]===0&&l.parts[1]===0&&l.parts[2]===0&&l.parts[3]===0)s=!0;else for(p=3;p>=0;p--){var $=0,ie=xg(l);if(l=ie.quotient,$=ie.rem.low,!!$)for(m=8;m>=0;m--)n[p*9+m]=$%10,$=Math.floor($/10)}if(s)r=1,n[o]=0;else for(r=36;!n[o];)r=r-1,o=o+1;var k=r-1+W;if(k>=34||k<=-7||W>0){if(r>34)return f.push("".concat(0)),W>0?f.push("E+".concat(W)):W<0&&f.push("E".concat(W)),f.join("");f.push("".concat(n[o++])),r=r-1,r&&f.push(".");for(var i=0;i<r;i++)f.push("".concat(n[o++]));f.push("E"),k>0?f.push("+".concat(k)):f.push("".concat(k))}else if(W>=0)for(var i=0;i<r;i++)f.push("".concat(n[o++]));else{var X=r+W;if(X>0)for(var i=0;i<X;i++)f.push("".concat(n[o++]));else f.push("0");for(f.push(".");X++<0;)f.push("0");for(var i=0;i<r-Math.max(X-1,0);i++)f.push("".concat(n[o++]))}return f.join("")},t.prototype.toJSON=function(){return{$numberDecimal:this.toString()}},t.prototype.toExtendedJSON=function(){return{$numberDecimal:this.toString()}},t.fromExtendedJSON=function(e){return t.fromString(e.$numberDecimal)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new Decimal128("'.concat(this.toString(),'")')},t}();Object.defineProperty(dl.prototype,"_bsontype",{value:"Decimal128"});var Rs=function(){function t(e){if(!(this instanceof t))return new t(e);e instanceof Number&&(e=e.valueOf()),this.value=+e}return t.prototype.valueOf=function(){return this.value},t.prototype.toJSON=function(){return this.value},t.prototype.toString=function(e){return this.value.toString(e)},t.prototype.toExtendedJSON=function(e){return e&&(e.legacy||e.relaxed&&isFinite(this.value))?this.value:Object.is(Math.sign(this.value),-0)?{$numberDouble:"-".concat(this.value.toFixed(1))}:{$numberDouble:Number.isInteger(this.value)?this.value.toFixed(1):this.value.toString()}},t.fromExtendedJSON=function(e,r){var n=parseFloat(e.$numberDouble);return r&&r.relaxed?n:new t(n)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var e=this.toExtendedJSON();return"new Double(".concat(e.$numberDouble,")")},t}();Object.defineProperty(Rs.prototype,"_bsontype",{value:"Double"});var Ns=function(){function t(e){if(!(this instanceof t))return new t(e);e instanceof Number&&(e=e.valueOf()),this.value=+e|0}return t.prototype.valueOf=function(){return this.value},t.prototype.toString=function(e){return this.value.toString(e)},t.prototype.toJSON=function(){return this.value},t.prototype.toExtendedJSON=function(e){return e&&(e.relaxed||e.legacy)?this.value:{$numberInt:this.value.toString()}},t.fromExtendedJSON=function(e,r){return r&&r.relaxed?parseInt(e.$numberInt,10):new t(e.$numberInt)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new Int32(".concat(this.valueOf(),")")},t}();Object.defineProperty(Ns.prototype,"_bsontype",{value:"Int32"});var hl=function(){function t(){if(!(this instanceof t))return new t}return t.prototype.toExtendedJSON=function(){return{$maxKey:1}},t.fromExtendedJSON=function(){return new t},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new MaxKey()"},t}();Object.defineProperty(hl.prototype,"_bsontype",{value:"MaxKey"});var gl=function(){function t(){if(!(this instanceof t))return new t}return t.prototype.toExtendedJSON=function(){return{$minKey:1}},t.fromExtendedJSON=function(){return new t},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new MinKey()"},t}();Object.defineProperty(gl.prototype,"_bsontype",{value:"MinKey"});var Rg=new RegExp("^[0-9a-fA-F]{24}$"),fn=null,gr=Symbol("id"),Xe=function(){function t(e){if(!(this instanceof t))return new t(e);var r;if(typeof e=="object"&&e&&"id"in e){if(typeof e.id!="string"&&!ArrayBuffer.isView(e.id))throw new Fe("Argument passed in must have an id that is of type string or Buffer");"toHexString"in e&&typeof e.toHexString=="function"?r=Ee.from(e.toHexString(),"hex"):r=e.id}else r=e;if(r==null||typeof r=="number")this[gr]=t.generate(typeof r=="number"?r:void 0);else if(ArrayBuffer.isView(r)&&r.byteLength===12)this[gr]=r instanceof Ee?r:Is(r);else if(typeof r=="string")if(r.length===12){var n=Ee.from(r);if(n.byteLength===12)this[gr]=n;else throw new Fe("Argument passed in must be a string of 12 bytes")}else if(r.length===24&&Rg.test(r))this[gr]=Ee.from(r,"hex");else throw new Fe("Argument passed in must be a string of 12 bytes or a string of 24 hex characters or an integer");else throw new Fe("Argument passed in does not match the accepted types");t.cacheHexString&&(this.__id=this.id.toString("hex"))}return Object.defineProperty(t.prototype,"id",{get:function(){return this[gr]},set:function(e){this[gr]=e,t.cacheHexString&&(this.__id=e.toString("hex"))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"generationTime",{get:function(){return this.id.readInt32BE(0)},set:function(e){this.id.writeUInt32BE(e,0)},enumerable:!1,configurable:!0}),t.prototype.toHexString=function(){if(t.cacheHexString&&this.__id)return this.__id;var e=this.id.toString("hex");return t.cacheHexString&&!this.__id&&(this.__id=e),e},t.getInc=function(){return t.index=(t.index+1)%16777215},t.generate=function(e){typeof e!="number"&&(e=Math.floor(Date.now()/1e3));var r=t.getInc(),n=Ee.alloc(12);return n.writeUInt32BE(e,0),fn===null&&(fn=sf(5)),n[4]=fn[0],n[5]=fn[1],n[6]=fn[2],n[7]=fn[3],n[8]=fn[4],n[11]=r&255,n[10]=r>>8&255,n[9]=r>>16&255,n},t.prototype.toString=function(e){return e?this.id.toString(e):this.toHexString()},t.prototype.toJSON=function(){return this.toHexString()},t.prototype.equals=function(e){if(e==null)return!1;if(e instanceof t)return this[gr][11]===e[gr][11]&&this[gr].equals(e[gr]);if(typeof e=="string"&&t.isValid(e)&&e.length===12&&ml(this.id))return e===Ee.prototype.toString.call(this.id,"latin1");if(typeof e=="string"&&t.isValid(e)&&e.length===24)return e.toLowerCase()===this.toHexString();if(typeof e=="string"&&t.isValid(e)&&e.length===12)return Ee.from(e).equals(this.id);if(typeof e=="object"&&"toHexString"in e&&typeof e.toHexString=="function"){var r=e.toHexString(),n=this.toHexString().toLowerCase();return typeof r=="string"&&r.toLowerCase()===n}return!1},t.prototype.getTimestamp=function(){var e=new Date,r=this.id.readUInt32BE(0);return e.setTime(Math.floor(r)*1e3),e},t.createPk=function(){return new t},t.createFromTime=function(e){var r=Ee.from([0,0,0,0,0,0,0,0,0,0,0,0]);return r.writeUInt32BE(e,0),new t(r)},t.createFromHexString=function(e){if(typeof e>"u"||e!=null&&e.length!==24)throw new Fe("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");return new t(Ee.from(e,"hex"))},t.isValid=function(e){if(e==null)return!1;try{return new t(e),!0}catch{return!1}},t.prototype.toExtendedJSON=function(){return this.toHexString?{$oid:this.toHexString()}:{$oid:this.toString("hex")}},t.fromExtendedJSON=function(e){return new t(e.$oid)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new ObjectId("'.concat(this.toHexString(),'")')},t.index=Math.floor(Math.random()*16777215),t}();Object.defineProperty(Xe.prototype,"generate",{value:Cs(function(t){return Xe.generate(t)},"Please use the static `ObjectId.generate(time)` instead")});Object.defineProperty(Xe.prototype,"getInc",{value:Cs(function(){return Xe.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(Xe.prototype,"get_inc",{value:Cs(function(){return Xe.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(Xe,"get_inc",{value:Cs(function(){return Xe.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(Xe.prototype,"_bsontype",{value:"ObjectID"});function Ng(t){return t.split("").sort().join("")}var lo=function(){function t(e,r){if(!(this instanceof t))return new t(e,r);if(this.pattern=e,this.options=Ng(r??""),this.pattern.indexOf("\0")!==-1)throw new mn("BSON Regex patterns cannot contain null bytes, found: ".concat(JSON.stringify(this.pattern)));if(this.options.indexOf("\0")!==-1)throw new mn("BSON Regex options cannot contain null bytes, found: ".concat(JSON.stringify(this.options)));for(var n=0;n<this.options.length;n++)if(!(this.options[n]==="i"||this.options[n]==="m"||this.options[n]==="x"||this.options[n]==="l"||this.options[n]==="s"||this.options[n]==="u"))throw new mn("The regular expression option [".concat(this.options[n],"] is not supported"))}return t.parseOptions=function(e){return e?e.split("").sort().join(""):""},t.prototype.toExtendedJSON=function(e){return e=e||{},e.legacy?{$regex:this.pattern,$options:this.options}:{$regularExpression:{pattern:this.pattern,options:this.options}}},t.fromExtendedJSON=function(e){if("$regex"in e)if(typeof e.$regex!="string"){if(e.$regex._bsontype==="BSONRegExp")return e}else return new t(e.$regex,t.parseOptions(e.$options));if("$regularExpression"in e)return new t(e.$regularExpression.pattern,t.parseOptions(e.$regularExpression.options));throw new Fe("Unexpected BSONRegExp EJSON object form: ".concat(JSON.stringify(e)))},t}();Object.defineProperty(lo.prototype,"_bsontype",{value:"BSONRegExp"});var yl=function(){function t(e){if(!(this instanceof t))return new t(e);this.value=e}return t.prototype.valueOf=function(){return this.value},t.prototype.toString=function(){return this.value},t.prototype.inspect=function(){return'new BSONSymbol("'.concat(this.value,'")')},t.prototype.toJSON=function(){return this.value},t.prototype.toExtendedJSON=function(){return{$symbol:this.value}},t.fromExtendedJSON=function(e){return new t(e.$symbol)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t}();Object.defineProperty(yl.prototype,"_bsontype",{value:"Symbol"});var Og=K,uf=function(t){xs(e,t);function e(r,n){var i=this;return i instanceof e?(K.isLong(r)?i=t.call(this,r.low,r.high,!0)||this:uo(r)&&typeof r.t<"u"&&typeof r.i<"u"?i=t.call(this,r.i,r.t,!0)||this:i=t.call(this,r,n,!0)||this,Object.defineProperty(i,"_bsontype",{value:"Timestamp",writable:!1,configurable:!1,enumerable:!1}),i):new e(r,n)}return e.prototype.toJSON=function(){return{$timestamp:this.toString()}},e.fromInt=function(r){return new e(K.fromInt(r,!0))},e.fromNumber=function(r){return new e(K.fromNumber(r,!0))},e.fromBits=function(r,n){return new e(r,n)},e.fromString=function(r,n){return new e(K.fromString(r,!0,n))},e.prototype.toExtendedJSON=function(){return{$timestamp:{t:this.high>>>0,i:this.low>>>0}}},e.fromExtendedJSON=function(r){return new e(r.$timestamp)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return"new Timestamp({ t: ".concat(this.getHighBits(),", i: ").concat(this.getLowBits()," })")},e.MAX_VALUE=K.MAX_UNSIGNED_VALUE,e}(Og);function Ag(t){return uo(t)&&Reflect.has(t,"_bsontype")&&typeof t._bsontype=="string"}var pf=2147483647,ff=-2147483648,mf=9223372036854776e3,df=-9223372036854776e3,Pg={$oid:Xe,$binary:dn,$uuid:dn,$symbol:yl,$numberInt:Ns,$numberDecimal:dl,$numberDouble:Rs,$numberLong:K,$minKey:gl,$maxKey:hl,$regex:lo,$regularExpression:lo,$timestamp:uf};function hf(t,e){if(e===void 0&&(e={}),typeof t=="number"){if(e.relaxed||e.legacy)return t;if(Math.floor(t)===t){if(t>=ff&&t<=pf)return new Ns(t);if(t>=df&&t<=mf)return K.fromNumber(t)}return new Rs(t)}if(t==null||typeof t!="object")return t;if(t.$undefined)return null;for(var r=Object.keys(t).filter(function(f){return f.startsWith("$")&&t[f]!=null}),n=0;n<r.length;n++){var i=Pg[r[n]];if(i)return i.fromExtendedJSON(t,e)}if(t.$date!=null){var o=t.$date,s=new Date;return e.legacy?typeof o=="number"?s.setTime(o):typeof o=="string"&&s.setTime(Date.parse(o)):typeof o=="string"?s.setTime(Date.parse(o)):K.isLong(o)?s.setTime(o.toNumber()):typeof o=="number"&&e.relaxed&&s.setTime(o),s}if(t.$code!=null){var a=Object.assign({},t);return t.$scope&&(a.$scope=hf(t.$scope)),Ds.fromExtendedJSON(t)}if(gg(t)||t.$dbPointer){var l=t.$ref?t:t.$dbPointer;if(l instanceof co)return l;var m=Object.keys(l).filter(function(f){return f.startsWith("$")}),p=!0;if(m.forEach(function(f){["$ref","$id","$db"].indexOf(f)===-1&&(p=!1)}),p)return co.fromExtendedJSON(l)}return t}function Lg(t,e){return t.map(function(r,n){e.seenObjects.push({propertyName:"index ".concat(n),obj:null});try{return Jr(r,e)}finally{e.seenObjects.pop()}})}function Zp(t){var e=t.toISOString();return t.getUTCMilliseconds()!==0?e:e.slice(0,-5)+"Z"}function Jr(t,e){if((typeof t=="object"||typeof t=="function")&&t!==null){var r=e.seenObjects.findIndex(function(R){return R.obj===t});if(r!==-1){var n=e.seenObjects.map(function(R){return R.propertyName}),i=n.slice(0,r).map(function(R){return"".concat(R," -> ")}).join(""),o=n[r],s=" -> "+n.slice(r+1,n.length-1).map(function(R){return"".concat(R," -> ")}).join(""),a=n[n.length-1],l=" ".repeat(i.length+o.length/2),m="-".repeat(s.length+(o.length+a.length)/2-1);throw new Fe(`Converting circular structure to EJSON:
|
|
20
|
+
`+" ".concat(i).concat(o).concat(s).concat(a,`
|
|
21
|
+
`)+" ".concat(l,"\\").concat(m,"/"))}e.seenObjects[e.seenObjects.length-1].obj=t}if(Array.isArray(t))return Lg(t,e);if(t===void 0)return null;if(t instanceof Date||fg(t)){var p=t.getTime(),f=p>-1&&p<2534023188e5;return e.legacy?e.relaxed&&f?{$date:t.getTime()}:{$date:Zp(t)}:e.relaxed&&f?{$date:Zp(t)}:{$date:{$numberLong:t.getTime().toString()}}}if(typeof t=="number"&&(!e.relaxed||!isFinite(t))){if(Math.floor(t)===t){var d=t>=ff&&t<=pf,g=t>=df&&t<=mf;if(d)return{$numberInt:t.toString()};if(g)return{$numberLong:t.toString()}}return{$numberDouble:t.toString()}}if(t instanceof RegExp||pg(t)){var E=t.flags;if(E===void 0){var N=t.toString().match(/[gimuy]*$/);N&&(E=N[0])}var P=new lo(t.source,E);return P.toExtendedJSON(e)}return t!=null&&typeof t=="object"?Ug(t,e):t}var Bg={Binary:function(t){return new dn(t.value(),t.sub_type)},Code:function(t){return new Ds(t.code,t.scope)},DBRef:function(t){return new co(t.collection||t.namespace,t.oid,t.db,t.fields)},Decimal128:function(t){return new dl(t.bytes)},Double:function(t){return new Rs(t.value)},Int32:function(t){return new Ns(t.value)},Long:function(t){return K.fromBits(t.low!=null?t.low:t.low_,t.low!=null?t.high:t.high_,t.low!=null?t.unsigned:t.unsigned_)},MaxKey:function(){return new hl},MinKey:function(){return new gl},ObjectID:function(t){return new Xe(t)},ObjectId:function(t){return new Xe(t)},BSONRegExp:function(t){return new lo(t.pattern,t.options)},Symbol:function(t){return new yl(t.value)},Timestamp:function(t){return uf.fromBits(t.low,t.high)}};function Ug(t,e){if(t==null||typeof t!="object")throw new mn("not an object instance");var r=t._bsontype;if(typeof r>"u"){var n={};for(var i in t){e.seenObjects.push({propertyName:i,obj:null});try{var o=Jr(t[i],e);i==="__proto__"?Object.defineProperty(n,i,{value:o,writable:!0,enumerable:!0,configurable:!0}):n[i]=o}finally{e.seenObjects.pop()}}return n}else if(Ag(t)){var s=t;if(typeof s.toExtendedJSON!="function"){var a=Bg[t._bsontype];if(!a)throw new Fe("Unrecognized or invalid _bsontype: "+t._bsontype);s=a(s)}return r==="Code"&&s.scope?s=new Ds(s.code,Jr(s.scope,e)):r==="DBRef"&&s.oid&&(s=new co(Jr(s.collection,e),Jr(s.oid,e),Jr(s.db,e),Jr(s.fields,e))),s.toExtendedJSON(e)}else throw new mn("_bsontype must be a string, but was: "+typeof r)}var ef;(function(t){function e(o,s){var a=Object.assign({},{relaxed:!0,legacy:!1},s);return typeof a.relaxed=="boolean"&&(a.strict=!a.relaxed),typeof a.strict=="boolean"&&(a.relaxed=!a.strict),JSON.parse(o,function(l,m){if(l.indexOf("\0")!==-1)throw new mn("BSON Document field names cannot contain null bytes, found: ".concat(JSON.stringify(l)));return hf(m,a)})}t.parse=e;function r(o,s,a,l){a!=null&&typeof a=="object"&&(l=a,a=0),s!=null&&typeof s=="object"&&!Array.isArray(s)&&(l=s,s=void 0,a=0);var m=Object.assign({relaxed:!0,legacy:!1},l,{seenObjects:[{propertyName:"(root)",obj:null}]}),p=Jr(o,m);return JSON.stringify(p,s,a)}t.stringify=r;function n(o,s){return s=s||{},JSON.parse(r(o,s))}t.serialize=n;function i(o,s){return s=s||{},e(JSON.stringify(o),s)}t.deserialize=i})(ef||(ef={}));var tf,rf=of();rf.Map?tf=rf.Map:tf=function(){function t(e){e===void 0&&(e=[]),this._keys=[],this._values={};for(var r=0;r<e.length;r++)if(e[r]!=null){var n=e[r],i=n[0],o=n[1];this._keys.push(i),this._values[i]={v:o,i:this._keys.length-1}}}return t.prototype.clear=function(){this._keys=[],this._values={}},t.prototype.delete=function(e){var r=this._values[e];return r==null?!1:(delete this._values[e],this._keys.splice(r.i,1),!0)},t.prototype.entries=function(){var e=this,r=0;return{next:function(){var n=e._keys[r++];return{value:n!==void 0?[n,e._values[n].v]:void 0,done:n===void 0}}}},t.prototype.forEach=function(e,r){r=r||this;for(var n=0;n<this._keys.length;n++){var i=this._keys[n];e.call(r,this._values[i].v,i,r)}},t.prototype.get=function(e){return this._values[e]?this._values[e].v:void 0},t.prototype.has=function(e){return this._values[e]!=null},t.prototype.keys=function(){var e=this,r=0;return{next:function(){var n=e._keys[r++];return{value:n!==void 0?n:void 0,done:n===void 0}}}},t.prototype.set=function(e,r){return this._values[e]?(this._values[e].v=r,this):(this._keys.push(e),this._values[e]={v:r,i:this._keys.length-1},this)},t.prototype.values=function(){var e=this,r=0;return{next:function(){var n=e._keys[r++];return{value:n!==void 0?e._values[n].v:void 0,done:n===void 0}}}},Object.defineProperty(t.prototype,"size",{get:function(){return this._keys.length},enumerable:!1,configurable:!0}),t}();var tI=K.fromNumber(dg),rI=K.fromNumber(hg);var ul=new Uint8Array(8),nI=new DataView(ul.buffer,ul.byteOffset,ul.byteLength);var Mg=1024*1024*17,iI=Ee.alloc(Mg);var mi=class{triggerID;nudgeID;engagementID;contentID;shortID;contentType;variation;props;objective;onsiteDeliveryType;holdout;constructor(e){e=e||{},this.triggerID=e.id||e.triggerID,this.nudgeID=e.nudgeID,this.shortID=e.shortID,this.contentType=e.contentType,this.engagementID=e.engagementID,this.contentID=e.contentID,this.variation=e.variation,this.props=e.props,this.objective=e.objective,this.onsiteDeliveryType=e.onsiteDeliveryType,this.holdout=e.holdout}};var ve=class{constructor(e,r={},n,i){this.name=e;this.properties=r;this.id=i?new Xe(i):new Xe,this.occurred=new Date,n&&(this.trigger=new mi(n)),this.newEvent=!i}trigger;items;id;newEvent;cart;currentItem;deviceProps;landingPage;occurred;page;sessionID;sessionNumber};var It=class{static injectScriptURL(e,r){if(!e)return;let n=document.createElement("script");n.id=r??"",n.src=e,n.defer=!0,e.includes("localhost")&&(n.type="module"),document.head.appendChild(n)}static injectRawScript(e){if(!e)return;let r=document.createElement("script");r.id="cooee-app-script",r.innerHTML=e,document.head.appendChild(r)}static injectRawCSS(e,r=document.head){if(!e)return;let n=document.createElement("style");n.textContent=e,r.appendChild(n)}static injectStylesheet(e,r=document.head){if(!e)return;let n=document.createElement("link");n.rel="stylesheet",n.href=e,r.appendChild(n)}};var se=class{static storage=new Map;static get(e){return this.storage.has(e)||this.storage.set(e,e.getInstance()),this.storage.get(e)}};var gf=Xt(vl());var po=class{static UTM_PARAMS=["utm_source","utm_medium","utm_campaign","utm_term","utm_content","utm_id"];static TW_PARAMS={utm_source:"tw_source",utm_campaign:"tw_campaign"};static getReferrer(){if(document.referrer)return document.referrer.replace(location.origin,"")}static getUTMParams(){let e;try{e=new gf.URLBuilder(location.href)}catch{return{}}let r={};this.UTM_PARAMS.forEach(i=>{let o=e.getQueryParam(i);o&&(r[i]=o)});let n={};return Object.keys(this.TW_PARAMS).forEach(i=>{let o=e.getQueryParam(this.TW_PARAMS[i]);o&&(n[i]=o)}),b(b({},n),r)}};var vr=class t{origin;path;qs;name;referrer;utmSource;utmMedium;utmCampaign;utmId;utmTerm;utmContent;constructor(e){this.name=e.name,this.path=e.path,this.qs=e.qs,this.referrer=e.referrer,this.utmSource=e.utmSource||e.utm_source,this.utmMedium=e.utmMedium||e.utm_medium,this.utmCampaign=e.utmCampaign||e.utm_campaign,this.utmId=e.utmId||e.utm_id,this.utmTerm=e.utmTerm||e.utm_term,this.utmContent=e.utmContent||e.utm_content}static parseFromCurrent(){let e=location.pathname==="/"?location.pathname:location.pathname.replace(/\/+$/,"");return new t(b({origin:location.origin,path:e,qs:location.search,referrer:po.getReferrer(),name:fe.get().pageName},po.getUTMParams()))}};function ae(t){return typeof t=="function"}function As(t){let r=t(n=>{Error.call(n),n.stack=new Error().stack});return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var Ps=As(t=>function(r){t(this),this.message=r?`${r.length} errors occurred during unsubscription:
|
|
22
|
+
${r.map((n,i)=>`${i+1}) ${n.toString()}`).join(`
|
|
23
|
+
`)}`:"",this.name="UnsubscriptionError",this.errors=r});function hn(t,e){if(t){let r=t.indexOf(e);0<=r&&t.splice(r,1)}}var $t=class t{constructor(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}unsubscribe(){let e;if(!this.closed){this.closed=!0;let{_parentage:r}=this;if(r)if(this._parentage=null,Array.isArray(r))for(let o of r)o.remove(this);else r.remove(this);let{initialTeardown:n}=this;if(ae(n))try{n()}catch(o){e=o instanceof Ps?o.errors:[o]}let{_finalizers:i}=this;if(i){this._finalizers=null;for(let o of i)try{yf(o)}catch(s){e=e??[],s instanceof Ps?e=[...e,...s.errors]:e.push(s)}}if(e)throw new Ps(e)}}add(e){var r;if(e&&e!==this)if(this.closed)yf(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(e)}}_hasParent(e){let{_parentage:r}=this;return r===e||Array.isArray(r)&&r.includes(e)}_addParent(e){let{_parentage:r}=this;this._parentage=Array.isArray(r)?(r.push(e),r):r?[r,e]:e}_removeParent(e){let{_parentage:r}=this;r===e?this._parentage=null:Array.isArray(r)&&hn(r,e)}remove(e){let{_finalizers:r}=this;r&&hn(r,e),e instanceof t&&e._removeParent(this)}};$t.EMPTY=(()=>{let t=new $t;return t.closed=!0,t})();var _l=$t.EMPTY;function Ls(t){return t instanceof $t||t&&"closed"in t&&ae(t.remove)&&ae(t.add)&&ae(t.unsubscribe)}function yf(t){ae(t)?t():t.unsubscribe()}var er={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var di={setTimeout(t,e,...r){let{delegate:n}=di;return n?.setTimeout?n.setTimeout(t,e,...r):setTimeout(t,e,...r)},clearTimeout(t){let{delegate:e}=di;return(e?.clearTimeout||clearTimeout)(t)},delegate:void 0};function Bs(t){di.setTimeout(()=>{let{onUnhandledError:e}=er;if(e)e(t);else throw t})}function El(){}var vf=Sl("C",void 0,void 0);function _f(t){return Sl("E",void 0,t)}function Ef(t){return Sl("N",t,void 0)}function Sl(t,e,r){return{kind:t,value:e,error:r}}var gn=null;function hi(t){if(er.useDeprecatedSynchronousErrorHandling){let e=!gn;if(e&&(gn={errorThrown:!1,error:null}),t(),e){let{errorThrown:r,error:n}=gn;if(gn=null,r)throw n}}else t()}function Sf(t){er.useDeprecatedSynchronousErrorHandling&&gn&&(gn.errorThrown=!0,gn.error=t)}var yn=class extends $t{constructor(e){super(),this.isStopped=!1,e?(this.destination=e,Ls(e)&&e.add(this)):this.destination=$g}static create(e,r,n){return new gi(e,r,n)}next(e){this.isStopped?wl(Ef(e),this):this._next(e)}error(e){this.isStopped?wl(_f(e),this):(this.isStopped=!0,this._error(e))}complete(){this.isStopped?wl(vf,this):(this.isStopped=!0,this._complete())}unsubscribe(){this.closed||(this.isStopped=!0,super.unsubscribe(),this.destination=null)}_next(e){this.destination.next(e)}_error(e){try{this.destination.error(e)}finally{this.unsubscribe()}}_complete(){try{this.destination.complete()}finally{this.unsubscribe()}}},Fg=Function.prototype.bind;function bl(t,e){return Fg.call(t,e)}var Il=class{constructor(e){this.partialObserver=e}next(e){let{partialObserver:r}=this;if(r.next)try{r.next(e)}catch(n){Us(n)}}error(e){let{partialObserver:r}=this;if(r.error)try{r.error(e)}catch(n){Us(n)}else Us(e)}complete(){let{partialObserver:e}=this;if(e.complete)try{e.complete()}catch(r){Us(r)}}},gi=class extends yn{constructor(e,r,n){super();let i;if(ae(e)||!e)i={next:e??void 0,error:r??void 0,complete:n??void 0};else{let o;this&&er.useDeprecatedNextContext?(o=Object.create(e),o.unsubscribe=()=>this.unsubscribe(),i={next:e.next&&bl(e.next,o),error:e.error&&bl(e.error,o),complete:e.complete&&bl(e.complete,o)}):i=e}this.destination=new Il(i)}};function Us(t){er.useDeprecatedSynchronousErrorHandling?Sf(t):Bs(t)}function Hg(t){throw t}function wl(t,e){let{onStoppedNotification:r}=er;r&&di.setTimeout(()=>r(t,e))}var $g={closed:!0,next:El,error:Hg,complete:El};var yi=typeof Symbol=="function"&&Symbol.observable||"@@observable";function Ms(t){return t}function bf(t){return t.length===0?Ms:t.length===1?t[0]:function(r){return t.reduce((n,i)=>i(n),r)}}var tt=(()=>{class t{constructor(r){r&&(this._subscribe=r)}lift(r){let n=new t;return n.source=this,n.operator=r,n}subscribe(r,n,i){let o=Wg(r)?r:new gi(r,n,i);return hi(()=>{let{operator:s,source:a}=this;o.add(s?s.call(o,a):a?this._subscribe(o):this._trySubscribe(o))}),o}_trySubscribe(r){try{return this._subscribe(r)}catch(n){r.error(n)}}forEach(r,n){return n=wf(n),new n((i,o)=>{let s=new gi({next:a=>{try{r(a)}catch(l){o(l),s.unsubscribe()}},error:o,complete:i});this.subscribe(s)})}_subscribe(r){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(r)}[yi](){return this}pipe(...r){return bf(r)(this)}toPromise(r){return r=wf(r),new r((n,i)=>{let o;this.subscribe(s=>o=s,s=>i(s),()=>n(o))})}}return t.create=e=>new t(e),t})();function wf(t){var e;return(e=t??er.Promise)!==null&&e!==void 0?e:Promise}function jg(t){return t&&ae(t.next)&&ae(t.error)&&ae(t.complete)}function Wg(t){return t&&t instanceof yn||jg(t)&&Ls(t)}function Gg(t){return ae(t?.lift)}function jt(t){return e=>{if(Gg(e))return e.lift(function(r){try{return t(r,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}function Ar(t,e,r,n,i){return new Tl(t,e,r,n,i)}var Tl=class extends yn{constructor(e,r,n,i,o,s){super(e),this.onFinalize=o,this.shouldUnsubscribe=s,this._next=r?function(a){try{r(a)}catch(l){e.error(l)}}:super._next,this._error=i?function(a){try{i(a)}catch(l){e.error(l)}finally{this.unsubscribe()}}:super._error,this._complete=n?function(){try{n()}catch(a){e.error(a)}finally{this.unsubscribe()}}:super._complete}unsubscribe(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){let{closed:r}=this;super.unsubscribe(),!r&&((e=this.onFinalize)===null||e===void 0||e.call(this))}}};var If=As(t=>function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"});var ht=(()=>{class t extends tt{constructor(){super(),this.closed=!1,this.currentObservers=null,this.observers=[],this.isStopped=!1,this.hasError=!1,this.thrownError=null}lift(r){let n=new ks(this,this);return n.operator=r,n}_throwIfClosed(){if(this.closed)throw new If}next(r){hi(()=>{if(this._throwIfClosed(),!this.isStopped){this.currentObservers||(this.currentObservers=Array.from(this.observers));for(let n of this.currentObservers)n.next(r)}})}error(r){hi(()=>{if(this._throwIfClosed(),!this.isStopped){this.hasError=this.isStopped=!0,this.thrownError=r;let{observers:n}=this;for(;n.length;)n.shift().error(r)}})}complete(){hi(()=>{if(this._throwIfClosed(),!this.isStopped){this.isStopped=!0;let{observers:r}=this;for(;r.length;)r.shift().complete()}})}unsubscribe(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null}get observed(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0}_trySubscribe(r){return this._throwIfClosed(),super._trySubscribe(r)}_subscribe(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)}_innerSubscribe(r){let{hasError:n,isStopped:i,observers:o}=this;return n||i?_l:(this.currentObservers=null,o.push(r),new $t(()=>{this.currentObservers=null,hn(o,r)}))}_checkFinalizedStatuses(r){let{hasError:n,thrownError:i,isStopped:o}=this;n?r.error(i):o&&r.complete()}asObservable(){let r=new tt;return r.source=this,r}}return t.create=(e,r)=>new ks(e,r),t})(),ks=class extends ht{constructor(e,r){super(),this.destination=e,this.source=r}next(e){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.next)===null||n===void 0||n.call(r,e)}error(e){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.error)===null||n===void 0||n.call(r,e)}complete(){var e,r;(r=(e=this.destination)===null||e===void 0?void 0:e.complete)===null||r===void 0||r.call(e)}_subscribe(e){var r,n;return(n=(r=this.source)===null||r===void 0?void 0:r.subscribe(e))!==null&&n!==void 0?n:_l}};var fo=class extends ht{constructor(e){super(),this._value=e}get value(){return this.getValue()}_subscribe(e){let r=super._subscribe(e);return!r.closed&&e.next(this._value),r}getValue(){let{hasError:e,thrownError:r,_value:n}=this;if(e)throw r;return this._throwIfClosed(),n}next(e){super.next(this._value=e)}};var mo={now(){return(mo.delegate||Date).now()},delegate:void 0};var ho=class extends ht{constructor(e=1/0,r=1/0,n=mo){super(),this._bufferSize=e,this._windowTime=r,this._timestampProvider=n,this._buffer=[],this._infiniteTimeWindow=!0,this._infiniteTimeWindow=r===1/0,this._bufferSize=Math.max(1,e),this._windowTime=Math.max(1,r)}next(e){let{isStopped:r,_buffer:n,_infiniteTimeWindow:i,_timestampProvider:o,_windowTime:s}=this;r||(n.push(e),!i&&n.push(o.now()+s)),this._trimBuffer(),super.next(e)}_subscribe(e){this._throwIfClosed(),this._trimBuffer();let r=this._innerSubscribe(e),{_infiniteTimeWindow:n,_buffer:i}=this,o=i.slice();for(let s=0;s<o.length&&!e.closed;s+=n?1:2)e.next(o[s]);return this._checkFinalizedStatuses(e),r}_trimBuffer(){let{_bufferSize:e,_timestampProvider:r,_buffer:n,_infiniteTimeWindow:i}=this,o=(i?1:2)*e;if(e<1/0&&o<n.length&&n.splice(0,n.length-o),!i){let s=r.now(),a=0;for(let l=1;l<n.length&&n[l]<=s;l+=2)a=l;a&&n.splice(0,a+1)}}};var Fs=class extends $t{constructor(e,r){super()}schedule(e,r=0){return this}};var go={setInterval(t,e,...r){let{delegate:n}=go;return n?.setInterval?n.setInterval(t,e,...r):setInterval(t,e,...r)},clearInterval(t){let{delegate:e}=go;return(e?.clearInterval||clearInterval)(t)},delegate:void 0};var Hs=class extends Fs{constructor(e,r){super(e,r),this.scheduler=e,this.work=r,this.pending=!1}schedule(e,r=0){var n;if(this.closed)return this;this.state=e;let i=this.id,o=this.scheduler;return i!=null&&(this.id=this.recycleAsyncId(o,i,r)),this.pending=!0,this.delay=r,this.id=(n=this.id)!==null&&n!==void 0?n:this.requestAsyncId(o,this.id,r),this}requestAsyncId(e,r,n=0){return go.setInterval(e.flush.bind(e,this),n)}recycleAsyncId(e,r,n=0){if(n!=null&&this.delay===n&&this.pending===!1)return r;r!=null&&go.clearInterval(r)}execute(e,r){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;let n=this._execute(e,r);if(n)return n;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))}_execute(e,r){let n=!1,i;try{this.work(e)}catch(o){n=!0,i=o||new Error("Scheduled action threw falsy error")}if(n)return this.unsubscribe(),i}unsubscribe(){if(!this.closed){let{id:e,scheduler:r}=this,{actions:n}=r;this.work=this.state=this.scheduler=null,this.pending=!1,hn(n,this),e!=null&&(this.id=this.recycleAsyncId(r,e,null)),this.delay=null,super.unsubscribe()}}};var vi=class t{constructor(e,r=t.now){this.schedulerActionCtor=e,this.now=r}schedule(e,r=0,n){return new this.schedulerActionCtor(this,e).schedule(n,r)}};vi.now=mo.now;var $s=class extends vi{constructor(e,r=vi.now){super(e,r),this.actions=[],this._active=!1}flush(e){let{actions:r}=this;if(this._active){r.push(e);return}let n;this._active=!0;do if(n=e.execute(e.state,e.delay))break;while(e=r.shift());if(this._active=!1,n){for(;e=r.shift();)e.unsubscribe();throw n}}};var Tf=new $s(Hs);function xf(t){return t&&ae(t.schedule)}function Vg(t){return t[t.length-1]}function js(t){return xf(Vg(t))?t.pop():void 0}function Df(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(p){try{m(n.next(p))}catch(f){s(f)}}function l(p){try{m(n.throw(p))}catch(f){s(f)}}function m(p){p.done?o(p.value):i(p.value).then(a,l)}m((n=n.apply(t,e||[])).next())})}function Cf(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(t){return this instanceof vn?(this.v=t,this):new vn(t)}function Rf(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,o=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",s),i[Symbol.asyncIterator]=function(){return this},i;function s(g){return function(E){return Promise.resolve(E).then(g,f)}}function a(g,E){n[g]&&(i[g]=function(N){return new Promise(function(P,R){o.push([g,N,P,R])>1||l(g,N)})},E&&(i[g]=E(i[g])))}function l(g,E){try{m(n[g](E))}catch(N){d(o[0][3],N)}}function m(g){g.value instanceof vn?Promise.resolve(g.value.v).then(p,f):d(o[0][2],g)}function p(g){l("next",g)}function f(g){l("throw",g)}function d(g,E){g(E),o.shift(),o.length&&l(o[0][0],o[0][1])}}function Nf(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof Cf=="function"?Cf(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(o){r[o]=t[o]&&function(s){return new Promise(function(a,l){s=t[o](s),i(a,l,s.done,s.value)})}}function i(o,s,a,l){Promise.resolve(l).then(function(m){o({value:m,done:a})},s)}}var _i=t=>t&&typeof t.length=="number"&&typeof t!="function";function Ws(t){return ae(t?.then)}function Gs(t){return ae(t[yi])}function Vs(t){return Symbol.asyncIterator&&ae(t?.[Symbol.asyncIterator])}function zs(t){return new TypeError(`You provided ${t!==null&&typeof t=="object"?"an invalid object":`'${t}'`} where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.`)}function zg(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Ys=zg();function qs(t){return ae(t?.[Ys])}function Ks(t){return Rf(this,arguments,function*(){let r=t.getReader();try{for(;;){let{value:n,done:i}=yield vn(r.read());if(i)return yield vn(void 0);yield yield vn(n)}}finally{r.releaseLock()}})}function Js(t){return ae(t?.getReader)}function Wt(t){if(t instanceof tt)return t;if(t!=null){if(Gs(t))return Yg(t);if(_i(t))return qg(t);if(Ws(t))return Kg(t);if(Vs(t))return Of(t);if(qs(t))return Jg(t);if(Js(t))return Xg(t)}throw zs(t)}function Yg(t){return new tt(e=>{let r=t[yi]();if(ae(r.subscribe))return r.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function qg(t){return new tt(e=>{for(let r=0;r<t.length&&!e.closed;r++)e.next(t[r]);e.complete()})}function Kg(t){return new tt(e=>{t.then(r=>{e.closed||(e.next(r),e.complete())},r=>e.error(r)).then(null,Bs)})}function Jg(t){return new tt(e=>{for(let r of t)if(e.next(r),e.closed)return;e.complete()})}function Of(t){return new tt(e=>{Qg(t,e).catch(r=>e.error(r))})}function Xg(t){return Of(Ks(t))}function Qg(t,e){var r,n,i,o;return Df(this,void 0,void 0,function*(){try{for(r=Nf(t);n=yield r.next(),!n.done;){let s=n.value;if(e.next(s),e.closed)return}}catch(s){i={error:s}}finally{try{n&&!n.done&&(o=r.return)&&(yield o.call(r))}finally{if(i)throw i.error}}e.complete()})}function Gt(t,e,r,n=0,i=!1){let o=e.schedule(function(){r(),i?t.add(this.schedule(null,n)):this.unsubscribe()},n);if(t.add(o),!i)return o}function Xs(t,e=0){return jt((r,n)=>{r.subscribe(Ar(n,i=>Gt(n,t,()=>n.next(i),e),()=>Gt(n,t,()=>n.complete(),e),i=>Gt(n,t,()=>n.error(i),e)))})}function Qs(t,e=0){return jt((r,n)=>{n.add(t.schedule(()=>r.subscribe(n),e))})}function Af(t,e){return Wt(t).pipe(Qs(e),Xs(e))}function Pf(t,e){return Wt(t).pipe(Qs(e),Xs(e))}function Lf(t,e){return new tt(r=>{let n=0;return e.schedule(function(){n===t.length?r.complete():(r.next(t[n++]),r.closed||this.schedule())})})}function Bf(t,e){return new tt(r=>{let n;return Gt(r,e,()=>{n=t[Ys](),Gt(r,e,()=>{let i,o;try{({value:i,done:o}=n.next())}catch(s){r.error(s);return}o?r.complete():r.next(i)},0,!0)}),()=>ae(n?.return)&&n.return()})}function Zs(t,e){if(!t)throw new Error("Iterable cannot be null");return new tt(r=>{Gt(r,e,()=>{let n=t[Symbol.asyncIterator]();Gt(r,e,()=>{n.next().then(i=>{i.done?r.complete():r.next(i.value)})},0,!0)})})}function Uf(t,e){return Zs(Ks(t),e)}function Mf(t,e){if(t!=null){if(Gs(t))return Af(t,e);if(_i(t))return Lf(t,e);if(Ws(t))return Pf(t,e);if(Vs(t))return Zs(t,e);if(qs(t))return Bf(t,e);if(Js(t))return Uf(t,e)}throw zs(t)}function kf(t,e){return e?Mf(t,e):Wt(t)}function _n(t,e){return jt((r,n)=>{let i=0;r.subscribe(Ar(n,o=>{n.next(t.call(e,o,i++))}))})}var{isArray:Zg}=Array;function ey(t,e){return Zg(e)?t(...e):t(e)}function Ff(t){return _n(e=>ey(t,e))}function Hf(t,e,r,n,i,o,s,a){let l=[],m=0,p=0,f=!1,d=()=>{f&&!l.length&&!m&&e.complete()},g=N=>m<n?E(N):l.push(N),E=N=>{o&&e.next(N),m++;let P=!1;Wt(r(N,p++)).subscribe(Ar(e,R=>{i?.(R),o?g(R):e.next(R)},()=>{P=!0},void 0,()=>{if(P)try{for(m--;l.length&&m<n;){let R=l.shift();s?Gt(e,s,()=>E(R)):E(R)}d()}catch(R){e.error(R)}}))};return t.subscribe(Ar(e,g,()=>{f=!0,d()})),()=>{a?.()}}function yo(t,e,r=1/0){return ae(e)?yo((n,i)=>_n((o,s)=>e(n,o,i,s))(Wt(t(n,i))),r):(typeof e=="number"&&(r=e),jt((n,i)=>Hf(n,i,t,r)))}function $f(t=1/0){return yo(Ms,t)}function jf(){return $f(1)}function xl(...t){return jf()(kf(t,js(t)))}var ty=["addListener","removeListener"],ry=["addEventListener","removeEventListener"],ny=["on","off"];function En(t,e,r,n){if(ae(r)&&(n=r,r=void 0),n)return En(t,e,r).pipe(Ff(n));let[i,o]=sy(t)?ry.map(s=>a=>t[s](e,a,r)):iy(t)?ty.map(Wf(t,e)):oy(t)?ny.map(Wf(t,e)):[];if(!i&&_i(t))return yo(s=>En(s,e,r))(Wt(t));if(!i)throw new TypeError("Invalid event target");return new tt(s=>{let a=(...l)=>s.next(1<l.length?l:l[0]);return i(a),()=>o(a)})}function Wf(t,e){return r=>n=>t[r](e,n)}function iy(t){return ae(t.addListener)&&ae(t.removeListener)}function oy(t){return ae(t.on)&&ae(t.off)}function sy(t){return ae(t.addEventListener)&&ae(t.removeEventListener)}function tr(t,e=Tf){return jt((r,n)=>{let i=null,o=null,s=null,a=()=>{if(i){i.unsubscribe(),i=null;let m=o;o=null,n.next(m)}};function l(){let m=s+t,p=e.now();if(p<m){i=this.schedule(void 0,m-p),n.add(i);return}a()}r.subscribe(Ar(n,m=>{o=m,s=e.now(),i||(i=e.schedule(l,t),n.add(i))},()=>{a(),n.complete()},void 0,()=>{o=i=null}))})}function Cl(...t){let e=js(t);return jt((r,n)=>{(e?xl(t,r,e):xl(t,r)).subscribe(n)})}var ay=" daum[ /]| deusu/| yadirectfetcher|(?:^|[^g])news(?!sapphire)|(?<! (?:channel/|google/))google(?!(app|/google| pixel))|(?<! cu)bots?(?:\\b|_)|(?<!(?:lib))http|(?<![hg]m)score|@[a-z][\\w-]+\\.|\\(\\)|\\.com\\b|\\btime/|^<|^[\\w \\.\\-\\(?:\\):%]+(?:/v?\\d+(?:\\.\\d+)?(?:\\.\\d{1,10})*?)?(?:,|$)|^[^ ]{50,}$|^\\d+\\b|^\\w*search\\b|^\\w+/[\\w\\(\\)]*$|^active|^ad muncher|^amaya|^avsdevicesdk/|^biglotron|^bot|^bw/|^clamav[ /]|^client/|^cobweb/|^custom|^ddg[_-]android|^discourse|^dispatch/\\d|^downcast/|^duckduckgo|^email|^facebook|^getright/|^gozilla/|^hobbit|^hotzonu|^hwcdn/|^igetter/|^jeode/|^jetty/|^jigsaw|^microsoft bits|^movabletype|^mozilla/5\\.0\\s[a-z\\.-]+$|^mozilla/\\d\\.\\d \\(compatible;?\\)$|^mozilla/\\d\\.\\d \\w*$|^navermailapp|^netsurf|^offline|^openai/|^owler|^php|^postman|^python|^rank|^read|^reed|^rest|^rss|^snapchat|^space bison|^svn|^swcd |^taringa|^thumbor/|^track|^w3c|^webbandit/|^webcopier|^wget|^whatsapp|^wordpress|^xenu link sleuth|^yahoo|^yandex|^zdm/\\d|^zoom marketplace/|^{{.*}}$|adscanner/|analyzer|archive|ask jeeves/teoma|audit|bit\\.ly/|bluecoat drtr|browsex|burpcollaborator|capture|catch|check\\b|checker|chrome-lighthouse|chromeframe|classifier|cloudflare|convertify|cookiehubscan|crawl|cypress/|dareboost|datanyze|dejaclick|detect|dmbrowser|download|evc-batch/|exaleadcloudview|feed|firephp|functionize|gomezagent|headless|httrack|hubspot marketing grader|hydra|ibisbrowser|images|infrawatch|insight|inspect|iplabel|ips-agent|java(?!;)|jsjcw_scanner|library|linkcheck|mail\\.ru/|manager|measure|neustar wpm|node|nutch|offbyone|optimize|pageburst|pagespeed|parser|perl|phantomjs|pingdom|powermarks|preview|proxy|ptst[ /]\\d|reputation|resolver|retriever|rexx;|rigor|rss\\b|scanner\\.|scrape|server|sogou|sparkler/|speedcurve|spider|splash|statuscake|supercleaner|synapse|synthetic|tools|torrent|trace|transcoder|url|validator|virtuoso|wappalyzer|webglance|webkit2png|whatcms/|zgrab",cy=/bot|crawl|http|lighthouse|scan|search|spider/i,vo;function ly(){if(vo instanceof RegExp)return vo;try{vo=new RegExp(ay,"i")}catch{vo=cy}return vo}function Gf(t){return!!t&&ly().test(t)}var Vf=Object.prototype.toString;function Sn(t){switch(Vf.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return _r(t,Error)}}function Ei(t,e){return Vf.call(t)===`[object ${e}]`}function ea(t){return Ei(t,"ErrorEvent")}function ta(t){return Ei(t,"DOMError")}function Dl(t){return Ei(t,"DOMException")}function gt(t){return Ei(t,"String")}function Si(t){return typeof t=="object"&&t!==null&&"__sentry_template_string__"in t&&"__sentry_template_values__"in t}function bn(t){return t===null||Si(t)||typeof t!="object"&&typeof t!="function"}function rr(t){return Ei(t,"Object")}function wn(t){return typeof Event<"u"&&_r(t,Event)}function Rl(t){return typeof Element<"u"&&_r(t,Element)}function Nl(t){return Ei(t,"RegExp")}function Pr(t){return!!(t&&t.then&&typeof t.then=="function")}function Ol(t){return rr(t)&&"nativeEvent"in t&&"preventDefault"in t&&"stopPropagation"in t}function _r(t,e){try{return t instanceof e}catch{return!1}}function _o(t){return!!(typeof t=="object"&&t!==null&&(t.__isVue||t._isVue))}function Er(t,e=0){return typeof t!="string"||e===0||t.length<=e?t:`${t.slice(0,e)}...`}function ra(t,e){if(!Array.isArray(t))return"";let r=[];for(let n=0;n<t.length;n++){let i=t[n];try{_o(i)?r.push("[VueViewModel]"):r.push(String(i))}catch{r.push("[value cannot be serialized]")}}return r.join(e)}function zf(t,e,r=!1){return gt(t)?Nl(e)?e.test(t):gt(e)?r?t===e:t.includes(e):!1:!1}function bi(t,e=[],r=!1){return e.some(n=>zf(t,n,r))}function Pl(t,e,r=250,n,i,o,s){if(!o.exception||!o.exception.values||!s||!_r(s.originalException,Error))return;let a=o.exception.values.length>0?o.exception.values[o.exception.values.length-1]:void 0;a&&(o.exception.values=uy(Al(t,e,i,s.originalException,n,o.exception.values,a,0),r))}function Al(t,e,r,n,i,o,s,a){if(o.length>=r+1)return o;let l=[...o];if(_r(n[i],Error)){Yf(s,a);let m=t(e,n[i]),p=l.length;qf(m,i,p,a),l=Al(t,e,r,n[i],i,[m,...l],m,p)}return Array.isArray(n.errors)&&n.errors.forEach((m,p)=>{if(_r(m,Error)){Yf(s,a);let f=t(e,m),d=l.length;qf(f,`errors[${p}]`,d,a),l=Al(t,e,r,m,i,[f,...l],f,d)}}),l}function Yf(t,e){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism=Z(b(b({},t.mechanism),t.type==="AggregateError"&&{is_exception_group:!0}),{exception_id:e})}function qf(t,e,r,n){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism=Z(b({},t.mechanism),{type:"chained",source:e,exception_id:r,parent_id:n})}function uy(t,e){return t.map(r=>(r.value&&(r.value=Er(r.value,e)),r))}var Vt="8.18.0";var ee=globalThis;function wi(t,e,r){let n=r||ee,i=n.__SENTRY__=n.__SENTRY__||{},o=i[Vt]=i[Vt]||{};return o[t]||(o[t]=e())}var Ll=ee,py=80;function Eo(t,e={}){if(!t)return"<unknown>";try{let r=t,n=5,i=[],o=0,s=0,a=" > ",l=a.length,m,p=Array.isArray(e)?e:e.keyAttrs,f=!Array.isArray(e)&&e.maxStringLength||py;for(;r&&o++<n&&(m=fy(r,p),!(m==="html"||o>1&&s+i.length*l+m.length>=f));)i.push(m),s+=m.length,r=r.parentNode;return i.reverse().join(a)}catch{return"<unknown>"}}function fy(t,e){let r=t,n=[];if(!r||!r.tagName)return"";if(Ll.HTMLElement&&r instanceof HTMLElement&&r.dataset){if(r.dataset.sentryComponent)return r.dataset.sentryComponent;if(r.dataset.sentryElement)return r.dataset.sentryElement}n.push(r.tagName.toLowerCase());let i=e&&e.length?e.filter(s=>r.getAttribute(s)).map(s=>[s,r.getAttribute(s)]):null;if(i&&i.length)i.forEach(s=>{n.push(`[${s[0]}="${s[1]}"]`)});else{r.id&&n.push(`#${r.id}`);let s=r.className;if(s&>(s)){let a=s.split(/\s+/);for(let l of a)n.push(`.${l}`)}}let o=["aria-label","type","name","title","alt"];for(let s of o){let a=r.getAttribute(s);a&&n.push(`[${s}="${a}"]`)}return n.join("")}function Bl(){try{return Ll.document.location.href}catch{return""}}function Ul(t){if(!Ll.HTMLElement)return null;let e=t,r=5;for(let n=0;n<r;n++){if(!e)return null;if(e instanceof HTMLElement){if(e.dataset.sentryComponent)return e.dataset.sentryComponent;if(e.dataset.sentryElement)return e.dataset.sentryElement}e=e.parentNode}return null}var Sr=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var my="Sentry Logger ",So=["debug","info","warn","error","log","assert","trace"],Ii={};function Ti(t){if(!("console"in ee))return t();let e=ee.console,r={},n=Object.keys(Ii);n.forEach(i=>{let o=Ii[i];r[i]=e[i],e[i]=o});try{return t()}finally{n.forEach(i=>{e[i]=r[i]})}}function dy(){let t=!1,e={enable:()=>{t=!0},disable:()=>{t=!1},isEnabled:()=>t};return Sr?So.forEach(r=>{e[r]=(...n)=>{t&&Ti(()=>{ee.console[r](`${my}[${r}]:`,...n)})}}):So.forEach(r=>{e[r]=()=>{}}),e}var q=dy();var hy=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function gy(t){return t==="http"||t==="https"}function br(t,e=!1){let{host:r,path:n,pass:i,port:o,projectId:s,protocol:a,publicKey:l}=t;return`${a}://${l}${e&&i?`:${i}`:""}@${r}${o?`:${o}`:""}/${n&&`${n}/`}${s}`}function Kf(t){let e=hy.exec(t);if(!e){Ti(()=>{console.error(`Invalid Sentry Dsn: ${t}`)});return}let[r,n,i="",o="",s="",a=""]=e.slice(1),l="",m=a,p=m.split("/");if(p.length>1&&(l=p.slice(0,-1).join("/"),m=p.pop()),m){let f=m.match(/^\d+/);f&&(m=f[0])}return Jf({host:o,pass:i,path:l,projectId:m,port:s,protocol:r,publicKey:n})}function Jf(t){return{protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function yy(t){if(!Sr)return!0;let{port:e,projectId:r,protocol:n}=t;return["protocol","publicKey","host","projectId"].find(s=>t[s]?!1:(q.error(`Invalid Sentry Dsn: ${s} missing`),!0))?!1:r.match(/^\d+$/)?gy(n)?e&&isNaN(parseInt(e,10))?(q.error(`Invalid Sentry Dsn: Invalid port ${e}`),!1):!0:(q.error(`Invalid Sentry Dsn: Invalid protocol ${n}`),!1):(q.error(`Invalid Sentry Dsn: Invalid projectId ${r}`),!1)}function na(t){let e=typeof t=="string"?Kf(t):Jf(t);if(!(!e||!yy(e)))return e}var lt=class extends Error{constructor(e,r="warn"){super(e),this.message=e,this.name=new.target.prototype.constructor.name,Object.setPrototypeOf(this,new.target.prototype),this.logLevel=r}};function Ae(t,e,r){if(!(e in t))return;let n=t[e],i=r(n);typeof i=="function"&&ia(i,n),t[e]=i}function yt(t,e,r){try{Object.defineProperty(t,e,{value:r,writable:!0,configurable:!0})}catch{Sr&&q.log(`Failed to add non-enumerable property "${e}" to object`,t)}}function ia(t,e){try{let r=e.prototype||{};t.prototype=e.prototype=r,yt(t,"__sentry_original__",e)}catch{}}function In(t){return t.__sentry_original__}function kl(t){return Object.keys(t).map(e=>`${encodeURIComponent(e)}=${encodeURIComponent(t[e])}`).join("&")}function oa(t){if(Sn(t))return b({message:t.message,name:t.name,stack:t.stack},Qf(t));if(wn(t)){let e=b({type:t.type,target:Xf(t.target),currentTarget:Xf(t.currentTarget)},Qf(t));return typeof CustomEvent<"u"&&_r(t,CustomEvent)&&(e.detail=t.detail),e}else return t}function Xf(t){try{return Rl(t)?Eo(t):Object.prototype.toString.call(t)}catch{return"<unknown>"}}function Qf(t){if(typeof t=="object"&&t!==null){let e={};for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}else return{}}function Fl(t,e=40){let r=Object.keys(oa(t));r.sort();let n=r[0];if(!n)return"[object has no keys]";if(n.length>=e)return Er(n,e);for(let i=r.length;i>0;i--){let o=r.slice(0,i).join(", ");if(!(o.length>e))return i===r.length?o:Er(o,e)}return""}function Qe(t){return Ml(t,new Map)}function Ml(t,e){if(vy(t)){let r=e.get(t);if(r!==void 0)return r;let n={};e.set(t,n);for(let i of Object.keys(t))typeof t[i]<"u"&&(n[i]=Ml(t[i],e));return n}if(Array.isArray(t)){let r=e.get(t);if(r!==void 0)return r;let n=[];return e.set(t,n),t.forEach(i=>{n.push(Ml(i,e))}),n}return t}function vy(t){if(!rr(t))return!1;try{let e=Object.getPrototypeOf(t).constructor.name;return!e||e==="Object"}catch{return!0}}var wr="?",Zf=/\(error: (.*)\)/,em=/captureMessage|captureException/;function $l(...t){let e=t.sort((r,n)=>r[0]-n[0]).map(r=>r[1]);return(r,n=0,i=0)=>{let o=[],s=r.split(`
|
|
24
|
+
`);for(let a=n;a<s.length;a++){let l=s[a];if(l.length>1024)continue;let m=Zf.test(l)?l.replace(Zf,"$1"):l;if(!m.match(/\S*Error: /)){for(let p of e){let f=p(m);if(f){o.push(f);break}}if(o.length>=50+i)break}}return tm(o.slice(i))}}function tm(t){if(!t.length)return[];let e=Array.from(t);return/sentryWrapped/.test(sa(e).function||"")&&e.pop(),e.reverse(),em.test(sa(e).function||"")&&(e.pop(),em.test(sa(e).function||"")&&e.pop()),e.slice(0,50).map(r=>Z(b({},r),{filename:r.filename||sa(e).filename,function:r.function||wr}))}function sa(t){return t[t.length-1]||{}}var Hl="<anonymous>";function zt(t){try{return!t||typeof t!="function"?Hl:t.name||Hl}catch{return Hl}}function aa(t){let e=t.exception;if(e){let r=[];try{return e.values.forEach(n=>{n.stacktrace.frames&&r.push(...n.stacktrace.frames)}),r}catch{return}}}var ca={},rm={};function vt(t,e){ca[t]=ca[t]||[],ca[t].push(e)}function _t(t,e){rm[t]||(e(),rm[t]=!0)}function Ze(t,e){let r=t&&ca[t];if(r)for(let n of r)try{n(e)}catch(i){Sr&&q.error(`Error while triggering instrumentation handler.
|
|
25
|
+
Type: ${t}
|
|
26
|
+
Name: ${zt(n)}
|
|
27
|
+
Error:`,i)}}function jl(t){let e="console";vt(e,t),_t(e,_y)}function _y(){"console"in ee&&So.forEach(function(t){t in ee.console&&Ae(ee.console,t,function(e){return Ii[t]=e,function(...r){Ze("console",{args:r,level:t});let i=Ii[t];i&&i.apply(ee.console,r)}})})}var Wl=ee;function nm(){if(!("fetch"in Wl))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}function bo(t){return t&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(t.toString())}function Gl(){if(typeof EdgeRuntime=="string")return!0;if(!nm())return!1;if(bo(Wl.fetch))return!0;let t=!1,e=Wl.document;if(e&&typeof e.createElement=="function")try{let r=e.createElement("iframe");r.hidden=!0,e.head.appendChild(r),r.contentWindow&&r.contentWindow.fetch&&(t=bo(r.contentWindow.fetch)),e.head.removeChild(r)}catch(r){Sr&&q.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",r)}return t}var im=1e3;function Ir(){return Date.now()/im}function Ey(){let{performance:t}=ee;if(!t||!t.now)return Ir;let e=Date.now()-t.now(),r=t.timeOrigin==null?e:t.timeOrigin;return()=>(r+t.now())/im}var Lt=Ey(),wo,Sy=(()=>{let{performance:t}=ee;if(!t||!t.now){wo="none";return}let e=3600*1e3,r=t.now(),n=Date.now(),i=t.timeOrigin?Math.abs(t.timeOrigin+r-n):e,o=i<e,s=t.timing&&t.timing.navigationStart,l=typeof s=="number"?Math.abs(s+r-n):e,m=l<e;return o||m?i<=l?(wo="timeOrigin",t.timeOrigin):(wo="navigationStart",s):(wo="dateNow",n)})();function zl(t){let e="fetch";vt(e,t),_t(e,by)}function by(){Gl()&&Ae(ee,"fetch",function(t){return function(...e){let{method:r,url:n}=wy(e),i={args:e,fetchData:{method:r,url:n},startTimestamp:Lt()*1e3};Ze("fetch",b({},i));let o=new Error().stack;return t.apply(ee,e).then(s=>{let a=Z(b({},i),{endTimestamp:Lt()*1e3,response:s});return Ze("fetch",a),s},s=>{let a=Z(b({},i),{endTimestamp:Lt()*1e3,error:s});throw Ze("fetch",a),Sn(s)&&s.stack===void 0&&(s.stack=o,yt(s,"framesToPop",1)),s})}})}function Vl(t,e){return!!t&&typeof t=="object"&&!!t[e]}function om(t){return typeof t=="string"?t:t?Vl(t,"url")?t.url:t.toString?t.toString():"":""}function wy(t){if(t.length===0)return{method:"GET",url:""};if(t.length===2){let[r,n]=t;return{url:om(r),method:Vl(n,"method")?String(n.method).toUpperCase():"GET"}}let e=t[0];return{url:om(e),method:Vl(e,"method")?String(e.method).toUpperCase():"GET"}}var la=null;function Yl(t){let e="error";vt(e,t),_t(e,Iy)}function Iy(){la=ee.onerror,ee.onerror=function(t,e,r,n,i){return Ze("error",{column:n,error:i,line:r,msg:t,url:e}),la&&!la.__SENTRY_LOADER__?la.apply(this,arguments):!1},ee.onerror.__SENTRY_INSTRUMENTED__=!0}var ua=null;function ql(t){let e="unhandledrejection";vt(e,t),_t(e,Ty)}function Ty(){ua=ee.onunhandledrejection,ee.onunhandledrejection=function(t){return Ze("unhandledrejection",t),ua&&!ua.__SENTRY_LOADER__?ua.apply(this,arguments):!0},ee.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}function Kl(){return"npm"}function sm(){let t=typeof WeakSet=="function",e=t?new WeakSet:[];function r(i){if(t)return e.has(i)?!0:(e.add(i),!1);for(let o=0;o<e.length;o++)if(e[o]===i)return!0;return e.push(i),!1}function n(i){if(t)e.delete(i);else for(let o=0;o<e.length;o++)if(e[o]===i){e.splice(o,1);break}}return[r,n]}function rt(){let t=ee,e=t.crypto||t.msCrypto,r=()=>Math.random()*16;try{if(e&&e.randomUUID)return e.randomUUID().replace(/-/g,"");e&&e.getRandomValues&&(r=()=>{let n=new Uint8Array(1);return e.getRandomValues(n),n[0]})}catch{}return("10000000100040008000"+1e11).replace(/[018]/g,n=>(n^(r()&15)>>n/4).toString(16))}function am(t){return t.exception&&t.exception.values?t.exception.values[0]:void 0}function nr(t){let{message:e,event_id:r}=t;if(e)return e;let n=am(t);return n?n.type&&n.value?`${n.type}: ${n.value}`:n.type||n.value||r||"<unknown>":r||"<unknown>"}function xi(t,e,r){let n=t.exception=t.exception||{},i=n.values=n.values||[],o=i[0]=i[0]||{};o.value||(o.value=e||""),o.type||(o.type=r||"Error")}function Lr(t,e){let r=am(t);if(!r)return;let n={type:"generic",handled:!0},i=r.mechanism;if(r.mechanism=b(b(b({},n),i),e),e&&"data"in e){let o=b(b({},i&&i.data),e.data);r.mechanism.data=o}}function pa(t){if(t&&t.__sentry_captured__)return!0;try{yt(t,"__sentry_captured__",!0)}catch{}return!1}function fa(t){return Array.isArray(t)?t:[t]}function ir(t,e=100,r=1/0){try{return Jl("",t,e,r)}catch(n){return{ERROR:`**non-serializable** (${n})`}}}function ma(t,e=3,r=100*1024){let n=ir(t,e);return Ry(n)>r?ma(t,e-1,r):n}function Jl(t,e,r=1/0,n=1/0,i=sm()){let[o,s]=i;if(e==null||["number","boolean","string"].includes(typeof e)&&!Number.isNaN(e))return e;let a=xy(t,e);if(!a.startsWith("[object "))return a;if(e.__sentry_skip_normalization__)return e;let l=typeof e.__sentry_override_normalization_depth__=="number"?e.__sentry_override_normalization_depth__:r;if(l===0)return a.replace("object ","");if(o(e))return"[Circular ~]";let m=e;if(m&&typeof m.toJSON=="function")try{let g=m.toJSON();return Jl("",g,l-1,n,i)}catch{}let p=Array.isArray(e)?[]:{},f=0,d=oa(e);for(let g in d){if(!Object.prototype.hasOwnProperty.call(d,g))continue;if(f>=n){p[g]="[MaxProperties ~]";break}let E=d[g];p[g]=Jl(g,E,l-1,n,i),f++}return s(e),p}function xy(t,e){try{if(t==="domain"&&e&&typeof e=="object"&&e._events)return"[Domain]";if(t==="domainEmitter")return"[DomainEmitter]";if(typeof global<"u"&&e===global)return"[Global]";if(typeof window<"u"&&e===window)return"[Window]";if(typeof document<"u"&&e===document)return"[Document]";if(_o(e))return"[VueViewModel]";if(Ol(e))return"[SyntheticEvent]";if(typeof e=="number"&&e!==e)return"[NaN]";if(typeof e=="function")return`[Function: ${zt(e)}]`;if(typeof e=="symbol")return`[${String(e)}]`;if(typeof e=="bigint")return`[BigInt: ${String(e)}]`;let r=Cy(e);return/^HTML(\w*)Element$/.test(r)?`[HTMLElement: ${r}]`:`[object ${r}]`}catch(r){return`**non-serializable** (${r})`}}function Cy(t){let e=Object.getPrototypeOf(t);return e?e.constructor.name:"null prototype"}function Dy(t){return~-encodeURI(t).split(/%..|./).length}function Ry(t){return Dy(JSON.stringify(t))}var Br;(function(t){t[t.PENDING=0]="PENDING";let r=1;t[t.RESOLVED=r]="RESOLVED";let n=2;t[t.REJECTED=n]="REJECTED"})(Br||(Br={}));function Yt(t){return new or(e=>{e(t)})}function Xr(t){return new or((e,r)=>{r(t)})}var or=class t{constructor(e){t.prototype.__init.call(this),t.prototype.__init2.call(this),t.prototype.__init3.call(this),t.prototype.__init4.call(this),this._state=Br.PENDING,this._handlers=[];try{e(this._resolve,this._reject)}catch(r){this._reject(r)}}then(e,r){return new t((n,i)=>{this._handlers.push([!1,o=>{if(!e)n(o);else try{n(e(o))}catch(s){i(s)}},o=>{if(!r)i(o);else try{n(r(o))}catch(s){i(s)}}]),this._executeHandlers()})}catch(e){return this.then(r=>r,e)}finally(e){return new t((r,n)=>{let i,o;return this.then(s=>{o=!1,i=s,e&&e()},s=>{o=!0,i=s,e&&e()}).then(()=>{if(o){n(i);return}r(i)})})}__init(){this._resolve=e=>{this._setResult(Br.RESOLVED,e)}}__init2(){this._reject=e=>{this._setResult(Br.REJECTED,e)}}__init3(){this._setResult=(e,r)=>{if(this._state===Br.PENDING){if(Pr(r)){r.then(this._resolve,this._reject);return}this._state=e,this._value=r,this._executeHandlers()}}}__init4(){this._executeHandlers=()=>{if(this._state===Br.PENDING)return;let e=this._handlers.slice();this._handlers=[],e.forEach(r=>{r[0]||(this._state===Br.RESOLVED&&r[1](this._value),this._state===Br.REJECTED&&r[2](this._value),r[0]=!0)})}}};function Xl(t){let e=[];function r(){return t===void 0||e.length<t}function n(s){return e.splice(e.indexOf(s),1)[0]||Promise.resolve(void 0)}function i(s){if(!r())return Xr(new lt("Not adding Promise because buffer limit was reached."));let a=s();return e.indexOf(a)===-1&&e.push(a),a.then(()=>n(a)).then(null,()=>n(a).then(null,()=>{})),a}function o(s){return new or((a,l)=>{let m=e.length;if(!m)return a(!0);let p=setTimeout(()=>{s&&s>0&&a(!1)},s);e.forEach(f=>{Yt(f).then(()=>{--m||(clearTimeout(p),a(!0))},l)})})}return{$:e,add:i,drain:o}}function Io(t){if(!t)return{};let e=t.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!e)return{};let r=e[6]||"",n=e[8]||"";return{host:e[4],path:e[5],protocol:e[2],search:r,hash:n,relative:e[5]+r+n}}var cm=["fatal","error","warning","log","info","debug"];function Ql(t){return t==="warn"?"warning":cm.includes(t)?t:"log"}var um="sentry-",pm=/^sentry-/;function Zl(t){let e=fm(t);if(!e)return;let r=Object.entries(e).reduce((n,[i,o])=>{if(i.match(pm)){let s=i.slice(um.length);n[s]=o}return n},{});if(Object.keys(r).length>0)return r}function fm(t){if(!(!t||!gt(t)&&!Array.isArray(t)))return Array.isArray(t)?t.reduce((e,r)=>{let n=lm(r);return Object.entries(n).forEach(([i,o])=>{e[i]=o}),e},{}):lm(t)}function lm(t){return t.split(",").map(e=>e.split("=").map(r=>decodeURIComponent(r.trim()))).reduce((e,[r,n])=>(r&&n&&(e[r]=n),e),{})}function Tr(t,e=[]){return[t,e]}function tu(t,e){let[r,n]=t;return[r,[...n,e]]}function da(t,e){let r=t[1];for(let n of r){let i=n[0].type;if(e(n,i))return!0}return!1}function eu(t){return ee.__SENTRY__&&ee.__SENTRY__.encodePolyfill?ee.__SENTRY__.encodePolyfill(t):new TextEncoder().encode(t)}function ru(t){let[e,r]=t,n=JSON.stringify(e);function i(o){typeof n=="string"?n=typeof o=="string"?n+o:[eu(n),o]:n.push(typeof o=="string"?eu(o):o)}for(let o of r){let[s,a]=o;if(i(`
|
|
28
|
+
${JSON.stringify(s)}
|
|
29
|
+
`),typeof a=="string"||a instanceof Uint8Array)i(a);else{let l;try{l=JSON.stringify(a)}catch{l=JSON.stringify(ir(a))}i(l)}}return typeof n=="string"?n:Ny(n)}function Ny(t){let e=t.reduce((i,o)=>i+o.length,0),r=new Uint8Array(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return r}function nu(t){let e=typeof t.data=="string"?eu(t.data):t.data;return[Qe({type:"attachment",length:e.length,filename:t.filename,content_type:t.contentType,attachment_type:t.attachmentType}),e]}var Oy={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",statsd:"metric_bucket"};function ha(t){return Oy[t]}function ga(t){if(!t||!t.sdk)return;let{name:e,version:r}=t.sdk;return{name:e,version:r}}function iu(t,e,r,n){let i=t.sdkProcessingMetadata&&t.sdkProcessingMetadata.dynamicSamplingContext;return b(b(b({event_id:t.event_id,sent_at:new Date().toISOString()},e&&{sdk:e}),!!r&&n&&{dsn:br(n)}),i&&{trace:Qe(b({},i))})}function ou(t,e,r){let n=[{type:"client_report"},{timestamp:r||Ir(),discarded_events:t}];return Tr(e?{dsn:e}:{},[n])}function mm(t,e=Date.now()){let r=parseInt(`${t}`,10);if(!isNaN(r))return r*1e3;let n=Date.parse(`${t}`);return isNaN(n)?6e4:n-e}function dm(t,e){return t[e]||t.all||0}function su(t,e,r=Date.now()){return dm(t,e)>r}function au(t,{statusCode:e,headers:r},n=Date.now()){let i=b({},t),o=r&&r["x-sentry-rate-limits"],s=r&&r["retry-after"];if(o)for(let a of o.trim().split(",")){let[l,m,,,p]=a.split(":",5),f=parseInt(l,10),d=(isNaN(f)?60:f)*1e3;if(!m)i.all=n+d;else for(let g of m.split(";"))g==="metric_bucket"?(!p||p.split(";").includes("custom"))&&(i[g]=n+d):i[g]=n+d}else s?i.all=n+mm(s,n):e===429&&(i.all=n+60*1e3);return i}function ya(){return{traceId:rt(),spanId:rt().substring(16)}}var va=ee;function cu(){let t=va.chrome,e=t&&t.app&&t.app.runtime,r="history"in va&&!!va.history.pushState&&!!va.history.replaceState;return!e&&r}var xe=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function Tn(){return To(ee),ee}function To(t){let e=t.__SENTRY__=t.__SENTRY__||{};return e.version=e.version||Vt,e[Vt]=e[Vt]||{}}function xo(t,e={}){if(e.user&&(!t.ipAddress&&e.user.ip_address&&(t.ipAddress=e.user.ip_address),!t.did&&!e.did&&(t.did=e.user.id||e.user.email||e.user.username)),t.timestamp=e.timestamp||Lt(),e.abnormal_mechanism&&(t.abnormal_mechanism=e.abnormal_mechanism),e.ignoreDuration&&(t.ignoreDuration=e.ignoreDuration),e.sid&&(t.sid=e.sid.length===32?e.sid:rt()),e.init!==void 0&&(t.init=e.init),!t.did&&e.did&&(t.did=`${e.did}`),typeof e.started=="number"&&(t.started=e.started),t.ignoreDuration)t.duration=void 0;else if(typeof e.duration=="number")t.duration=e.duration;else{let r=t.timestamp-t.started;t.duration=r>=0?r:0}e.release&&(t.release=e.release),e.environment&&(t.environment=e.environment),!t.ipAddress&&e.ipAddress&&(t.ipAddress=e.ipAddress),!t.userAgent&&e.userAgent&&(t.userAgent=e.userAgent),typeof e.errors=="number"&&(t.errors=e.errors),e.status&&(t.status=e.status)}var lu="_sentrySpan";function uu(t,e){e?yt(t,lu,e):delete t[lu]}function pu(t){return t[lu]}var Ly=100,fu=class t{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext=ya()}clone(){let e=new t;return e._breadcrumbs=[...this._breadcrumbs],e._tags=b({},this._tags),e._extra=b({},this._extra),e._contexts=b({},this._contexts),e._user=this._user,e._level=this._level,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._requestSession=this._requestSession,e._attachments=[...this._attachments],e._sdkProcessingMetadata=b({},this._sdkProcessingMetadata),e._propagationContext=b({},this._propagationContext),e._client=this._client,e._lastEventId=this._lastEventId,uu(e,pu(this)),e}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&xo(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){return this._requestSession}setRequestSession(e){return this._requestSession=e,this}setTags(e){return this._tags=b(b({},this._tags),e),this._notifyScopeListeners(),this}setTag(e,r){return this._tags=Z(b({},this._tags),{[e]:r}),this._notifyScopeListeners(),this}setExtras(e){return this._extra=b(b({},this._extra),e),this._notifyScopeListeners(),this}setExtra(e,r){return this._extra=Z(b({},this._extra),{[e]:r}),this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,r){return r===null?delete this._contexts[e]:this._contexts[e]=r,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;let r=typeof e=="function"?e(this):e,[n,i]=r instanceof ut?[r.getScopeData(),r.getRequestSession()]:rr(r)?[e,e.requestSession]:[],{tags:o,extra:s,user:a,contexts:l,level:m,fingerprint:p=[],propagationContext:f}=n||{};return this._tags=b(b({},this._tags),o),this._extra=b(b({},this._extra),s),this._contexts=b(b({},this._contexts),l),a&&Object.keys(a).length&&(this._user=a),m&&(this._level=m),p.length&&(this._fingerprint=p),f&&(this._propagationContext=f),i&&(this._requestSession=i),this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._requestSession=void 0,this._session=void 0,uu(this,void 0),this._attachments=[],this._propagationContext=ya(),this._notifyScopeListeners(),this}addBreadcrumb(e,r){let n=typeof r=="number"?r:Ly;if(n<=0)return this;let i=b({timestamp:Ir()},e),o=this._breadcrumbs;return o.push(i),this._breadcrumbs=o.length>n?o.slice(-n):o,this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:pu(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=b(b({},this._sdkProcessingMetadata),e),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,r){let n=r&&r.event_id?r.event_id:rt();if(!this._client)return q.warn("No client configured on scope - will not capture exception!"),n;let i=new Error("Sentry syntheticException");return this._client.captureException(e,Z(b({originalException:e,syntheticException:i},r),{event_id:n}),this),n}captureMessage(e,r,n){let i=n&&n.event_id?n.event_id:rt();if(!this._client)return q.warn("No client configured on scope - will not capture message!"),i;let o=new Error(e);return this._client.captureMessage(e,r,Z(b({originalException:e,syntheticException:o},n),{event_id:i}),this),i}captureEvent(e,r){let n=r&&r.event_id?r.event_id:rt();return this._client?(this._client.captureEvent(e,Z(b({},r),{event_id:n}),this),n):(q.warn("No client configured on scope - will not capture event!"),n)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),this._notifyingListeners=!1)}},ut=fu;function hm(){return wi("defaultCurrentScope",()=>new ut)}function gm(){return wi("defaultIsolationScope",()=>new ut)}var mu=class{constructor(e,r){let n;e?n=e:n=new ut;let i;r?i=r:i=new ut,this._stack=[{scope:n}],this._isolationScope=i}withScope(e){let r=this._pushScope(),n;try{n=e(r)}catch(i){throw this._popScope(),i}return Pr(n)?n.then(i=>(this._popScope(),i),i=>{throw this._popScope(),i}):(this._popScope(),n)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){let e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}};function Ci(){let t=Tn(),e=To(t);return e.stack=e.stack||new mu(hm(),gm())}function By(t){return Ci().withScope(t)}function Uy(t,e){let r=Ci();return r.withScope(()=>(r.getStackTop().scope=t,e(t)))}function ym(t){return Ci().withScope(()=>t(Ci().getIsolationScope()))}function vm(){return{withIsolationScope:ym,withScope:By,withSetScope:Uy,withSetIsolationScope:(t,e)=>ym(e),getCurrentScope:()=>Ci().getScope(),getIsolationScope:()=>Ci().getIsolationScope()}}function Ea(t){let e=To(t);return e.acs?e.acs:vm()}function xn(){let t=Tn();return Ea(t).getCurrentScope()}function Cn(){let t=Tn();return Ea(t).getIsolationScope()}function Sa(){return wi("globalScope",()=>new ut)}function ba(...t){let e=Tn(),r=Ea(e);if(t.length===2){let[n,i]=t;return n?r.withSetScope(n,i):r.withScope(i)}return r.withScope(t[0])}function Be(){return xn().getClient()}var My="_sentryMetrics";function _m(t){let e=t[My];if(!e)return;let r={};for(let[,[n,i]]of e)(r[n]||(r[n]=[])).push(Qe(i));return r}var du="sentry.source",hu="sentry.sample_rate",gu="sentry.op",yu="sentry.origin";var ky=1;function bm(t){let{spanId:e,traceId:r}=t.spanContext(),{parent_span_id:n}=Dn(t);return Qe({parent_span_id:n,span_id:e,trace_id:r})}function Em(t){return typeof t=="number"?Sm(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?Sm(t.getTime()):Lt()}function Sm(t){return t>9999999999?t/1e3:t}function Dn(t){if(Hy(t))return t.getSpanJSON();try{let{spanId:e,traceId:r}=t.spanContext();if(Fy(t)){let{attributes:n,startTime:i,name:o,endTime:s,parentSpanId:a,status:l}=t;return Qe({span_id:e,trace_id:r,data:n,description:o,parent_span_id:a,start_timestamp:Em(i),timestamp:Em(s)||void 0,status:$y(l),op:n[gu],origin:n[yu],_metrics_summary:_m(t)})}return{span_id:e,trace_id:r}}catch{return{}}}function Fy(t){let e=t;return!!e.attributes&&!!e.startTime&&!!e.name&&!!e.endTime&&!!e.status}function Hy(t){return typeof t.getSpanJSON=="function"}function wm(t){let{traceFlags:e}=t.spanContext();return e===ky}function $y(t){if(!(!t||t.code===0))return t.code===1?"ok":t.message||"unknown_error"}var jy="_sentryRootSpan";function Co(t){return t[jy]||t}var wa="production";var Wy="_frozenDsc";function vu(t,e){let r=e.getOptions(),{publicKey:n}=e.getDsn()||{},i=Qe({environment:r.environment||wa,release:r.release,public_key:n,trace_id:t});return e.emit("createDsc",i),i}function Im(t){let e=Be();if(!e)return{};let r=vu(Dn(t).trace_id||"",e),n=Co(t),i=n[Wy];if(i)return i;let o=n.spanContext().traceState,s=o&&o.get("sentry.dsc"),a=s&&Zl(s);if(a)return a;let l=Dn(n),m=l.data||{},p=m[hu];p!=null&&(r.sample_rate=`${p}`);let f=m[du],d=l.description;return f!=="url"&&d&&(r.transaction=d),r.sampled=String(wm(n)),e.emit("createDsc",r,n),r}function Tm(t){if(typeof t=="boolean")return Number(t);let e=typeof t=="string"?parseFloat(t):t;if(typeof e!="number"||isNaN(e)||e<0||e>1){xe&&q.warn(`[Tracing] Given sample rate is invalid. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(t)} of type ${JSON.stringify(typeof t)}.`);return}return e}function Gy(t,e){return e&&(t.sdk=t.sdk||{},t.sdk.name=t.sdk.name||e.name,t.sdk.version=t.sdk.version||e.version,t.sdk.integrations=[...t.sdk.integrations||[],...e.integrations||[]],t.sdk.packages=[...t.sdk.packages||[],...e.packages||[]]),t}function xm(t,e,r,n){let i=ga(r),o=b(b({sent_at:new Date().toISOString()},i&&{sdk:i}),!!n&&e&&{dsn:br(e)}),s="aggregates"in t?[{type:"sessions"},t]:[{type:"session"},t.toJSON()];return Tr(o,[s])}function Cm(t,e,r,n){let i=ga(r),o=t.type&&t.type!=="replay_event"?t.type:"event";Gy(t,r&&r.sdk);let s=iu(t,i,n,e);return delete t.sdkProcessingMetadata,Tr(s,[[{type:o},t]])}function Ia(t,e,r,n=0){return new or((i,o)=>{let s=t[n];if(e===null||typeof s!="function")i(e);else{let a=s(b({},e),r);xe&&s.id&&a===null&&q.log(`Event processor "${s.id}" dropped event`),Pr(a)?a.then(l=>Ia(t,l,r,n+1).then(i)).then(null,o):Ia(t,a,r,n+1).then(i).then(null,o)}})}function Dm(t,e){let{fingerprint:r,span:n,breadcrumbs:i,sdkProcessingMetadata:o}=e;Vy(t,e),n&&qy(t,n),Ky(t,r),zy(t,i),Yy(t,o)}function _u(t,e){let{extra:r,tags:n,user:i,contexts:o,level:s,sdkProcessingMetadata:a,breadcrumbs:l,fingerprint:m,eventProcessors:p,attachments:f,propagationContext:d,transactionName:g,span:E}=e;Do(t,"extra",r),Do(t,"tags",n),Do(t,"user",i),Do(t,"contexts",o),Do(t,"sdkProcessingMetadata",a),s&&(t.level=s),g&&(t.transactionName=g),E&&(t.span=E),l.length&&(t.breadcrumbs=[...t.breadcrumbs,...l]),m.length&&(t.fingerprint=[...t.fingerprint,...m]),p.length&&(t.eventProcessors=[...t.eventProcessors,...p]),f.length&&(t.attachments=[...t.attachments,...f]),t.propagationContext=b(b({},t.propagationContext),d)}function Do(t,e,r){if(r&&Object.keys(r).length){t[e]=b({},t[e]);for(let n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[e][n]=r[n])}}function Vy(t,e){let{extra:r,tags:n,user:i,contexts:o,level:s,transactionName:a}=e,l=Qe(r);l&&Object.keys(l).length&&(t.extra=b(b({},l),t.extra));let m=Qe(n);m&&Object.keys(m).length&&(t.tags=b(b({},m),t.tags));let p=Qe(i);p&&Object.keys(p).length&&(t.user=b(b({},p),t.user));let f=Qe(o);f&&Object.keys(f).length&&(t.contexts=b(b({},f),t.contexts)),s&&(t.level=s),a&&t.type!=="transaction"&&(t.transaction=a)}function zy(t,e){let r=[...t.breadcrumbs||[],...e];t.breadcrumbs=r.length?r:void 0}function Yy(t,e){t.sdkProcessingMetadata=b(b({},t.sdkProcessingMetadata),e)}function qy(t,e){t.contexts=b({trace:bm(e)},t.contexts),t.sdkProcessingMetadata=b({dynamicSamplingContext:Im(e)},t.sdkProcessingMetadata);let r=Co(e),n=Dn(r).description;n&&!t.transaction&&t.type==="transaction"&&(t.transaction=n)}function Ky(t,e){t.fingerprint=t.fingerprint?fa(t.fingerprint):[],e&&(t.fingerprint=t.fingerprint.concat(e)),t.fingerprint&&!t.fingerprint.length&&delete t.fingerprint}function Nm(t,e,r,n,i,o){let{normalizeDepth:s=3,normalizeMaxBreadth:a=1e3}=t,l=Z(b({},e),{event_id:e.event_id||r.event_id||rt(),timestamp:e.timestamp||Ir()}),m=r.integrations||t.integrations.map(P=>P.name);Jy(l,t),Zy(l,m),i&&i.emit("applyFrameMetadata",e),e.type===void 0&&Xy(l,t.stackParser);let p=tv(n,r.captureContext);r.mechanism&&Lr(l,r.mechanism);let f=i?i.getEventProcessors():[],d=Sa().getScopeData();if(o){let P=o.getScopeData();_u(d,P)}if(p){let P=p.getScopeData();_u(d,P)}let g=[...r.attachments||[],...d.attachments];g.length&&(r.attachments=g),Dm(l,d);let E=[...f,...d.eventProcessors];return Ia(E,l,r).then(P=>(P&&Qy(P),typeof s=="number"&&s>0?ev(P,s,a):P))}function Jy(t,e){let{environment:r,release:n,dist:i,maxValueLength:o=250}=e;"environment"in t||(t.environment="environment"in e?r:wa),t.release===void 0&&n!==void 0&&(t.release=n),t.dist===void 0&&i!==void 0&&(t.dist=i),t.message&&(t.message=Er(t.message,o));let s=t.exception&&t.exception.values&&t.exception.values[0];s&&s.value&&(s.value=Er(s.value,o));let a=t.request;a&&a.url&&(a.url=Er(a.url,o))}var Rm=new WeakMap;function Xy(t,e){let r=ee._sentryDebugIds;if(!r)return;let n,i=Rm.get(e);i?n=i:(n=new Map,Rm.set(e,n));let o=Object.entries(r).reduce((s,[a,l])=>{let m,p=n.get(a);p?m=p:(m=e(a),n.set(a,m));for(let f=m.length-1;f>=0;f--){let d=m[f];if(d.filename){s[d.filename]=l;break}}return s},{});try{t.exception.values.forEach(s=>{s.stacktrace.frames.forEach(a=>{a.filename&&(a.debug_id=o[a.filename])})})}catch{}}function Qy(t){let e={};try{t.exception.values.forEach(n=>{n.stacktrace.frames.forEach(i=>{i.debug_id&&(i.abs_path?e[i.abs_path]=i.debug_id:i.filename&&(e[i.filename]=i.debug_id),delete i.debug_id)})})}catch{}if(Object.keys(e).length===0)return;t.debug_meta=t.debug_meta||{},t.debug_meta.images=t.debug_meta.images||[];let r=t.debug_meta.images;Object.entries(e).forEach(([n,i])=>{r.push({type:"sourcemap",code_file:n,debug_id:i})})}function Zy(t,e){e.length>0&&(t.sdk=t.sdk||{},t.sdk.integrations=[...t.sdk.integrations||[],...e])}function ev(t,e,r){if(!t)return null;let n=b(b(b(b(b({},t),t.breadcrumbs&&{breadcrumbs:t.breadcrumbs.map(i=>b(b({},i),i.data&&{data:ir(i.data,e,r)}))}),t.user&&{user:ir(t.user,e,r)}),t.contexts&&{contexts:ir(t.contexts,e,r)}),t.extra&&{extra:ir(t.extra,e,r)});return t.contexts&&t.contexts.trace&&n.contexts&&(n.contexts.trace=t.contexts.trace,t.contexts.trace.data&&(n.contexts.trace.data=ir(t.contexts.trace.data,e,r))),t.spans&&(n.spans=t.spans.map(i=>b(b({},i),i.data&&{data:ir(i.data,e,r)}))),n}function tv(t,e){if(!e)return t;let r=t?t.clone():new ut;return r.update(e),r}function Om(t){if(t)return rv(t)?{captureContext:t}:iv(t)?{captureContext:t}:t}function rv(t){return t instanceof ut||typeof t=="function"}var nv=["user","level","extra","contexts","tags","fingerprint","requestSession","propagationContext"];function iv(t){return Object.keys(t).some(e=>nv.includes(e))}function Ta(t,e){return xn().captureException(t,Om(e))}function Ro(t,e){return xn().captureEvent(t,e)}var ov="7";function sv(t){let e=t.protocol?`${t.protocol}:`:"",r=t.port?`:${t.port}`:"";return`${e}//${t.host}${r}${t.path?`/${t.path}`:""}/api/`}function av(t){return`${sv(t)}${t.projectId}/envelope/`}function cv(t,e){return kl(b({sentry_key:t.publicKey,sentry_version:ov},e&&{sentry_client:`${e.name}/${e.version}`}))}function Pm(t,e,r){return e||`${av(t)}?${cv(t,r)}`}var Lm=[];function Bm(t,e){let r={};return e.forEach(n=>{n&&Su(t,n,r)}),r}function Eu(t,e){for(let r of e)r&&r.afterAllSetup&&r.afterAllSetup(t)}function Su(t,e,r){if(r[e.name]){xe&&q.log(`Integration skipped because it was already installed: ${e.name}`);return}if(r[e.name]=e,Lm.indexOf(e.name)===-1&&typeof e.setupOnce=="function"&&(e.setupOnce(),Lm.push(e.name)),e.setup&&typeof e.setup=="function"&&e.setup(t),typeof e.preprocessEvent=="function"){let n=e.preprocessEvent.bind(e);t.on("preprocessEvent",(i,o)=>n(i,o,t))}if(typeof e.processEvent=="function"){let n=e.processEvent.bind(e),i=Object.assign((o,s)=>n(o,s,t),{id:e.name});t.addEventProcessor(i)}xe&&q.log(`Integration installed: ${e.name}`)}var Um="Not capturing exception because it's already been captured.",No=class{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],e.dsn?this._dsn=na(e.dsn):xe&&q.warn("No DSN provided, client will not send events."),this._dsn){let r=Pm(this._dsn,e.tunnel,e._metadata?e._metadata.sdk:void 0);this._transport=e.transport(Z(b({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this)},e.transportOptions),{url:r}))}}captureException(e,r,n){let i=rt();if(pa(e))return xe&&q.log(Um),i;let o=b({event_id:i},r);return this._process(this.eventFromException(e,o).then(s=>this._captureEvent(s,o,n))),o.event_id}captureMessage(e,r,n,i){let o=b({event_id:rt()},n),s=Si(e)?e:String(e),a=bn(e)?this.eventFromMessage(s,r,o):this.eventFromException(e,o);return this._process(a.then(l=>this._captureEvent(l,o,i))),o.event_id}captureEvent(e,r,n){let i=rt();if(r&&r.originalException&&pa(r.originalException))return xe&&q.log(Um),i;let o=b({event_id:i},r),a=(e.sdkProcessingMetadata||{}).capturedSpanScope;return this._process(this._captureEvent(e,o,a||n)),o.event_id}captureSession(e){typeof e.release!="string"?xe&&q.warn("Discarded session because of missing or non-string release"):(this.sendSession(e),xo(e,{init:!1}))}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}flush(e){let r=this._transport;return r?(this.emit("flush"),this._isClientDoneProcessing(e).then(n=>r.flush(e).then(i=>n&&i))):Yt(!0)}close(e){return this.flush(e).then(r=>(this.getOptions().enabled=!1,this.emit("close"),r))}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}init(){this._isEnabled()&&this._setupIntegrations()}getIntegrationByName(e){return this._integrations[e]}addIntegration(e){let r=this._integrations[e.name];Su(this,e,this._integrations),r||Eu(this,[e])}sendEvent(e,r={}){this.emit("beforeSendEvent",e,r);let n=Cm(e,this._dsn,this._options._metadata,this._options.tunnel);for(let o of r.attachments||[])n=tu(n,nu(o));let i=this.sendEnvelope(n);i&&i.then(o=>this.emit("afterSendEvent",e,o),null)}sendSession(e){let r=xm(e,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(r)}recordDroppedEvent(e,r,n){if(this._options.sendClientReports){let i=`${e}:${r}`;xe&&q.log(`Adding outcome: "${i}"`),this._outcomes[i]=(this._outcomes[i]||0)+1}}on(e,r){let n=this._hooks[e]=this._hooks[e]||[];return n.push(r),()=>{let i=n.indexOf(r);i>-1&&n.splice(i,1)}}emit(e,...r){let n=this._hooks[e];n&&n.forEach(i=>i(...r))}sendEnvelope(e){return this.emit("beforeEnvelope",e),this._isEnabled()&&this._transport?this._transport.send(e).then(null,r=>(xe&&q.error("Error while sending event:",r),r)):(xe&&q.error("Transport disabled"),Yt({}))}_setupIntegrations(){let{integrations:e}=this._options;this._integrations=Bm(this,e),Eu(this,e)}_updateSessionFromEvent(e,r){let n=!1,i=!1,o=r.exception&&r.exception.values;if(o){i=!0;for(let l of o){let m=l.mechanism;if(m&&m.handled===!1){n=!0;break}}}let s=e.status==="ok";(s&&e.errors===0||s&&n)&&(xo(e,Z(b({},n&&{status:"crashed"}),{errors:e.errors||Number(i||n)})),this.captureSession(e))}_isClientDoneProcessing(e){return new or(r=>{let n=0,i=1,o=setInterval(()=>{this._numProcessing==0?(clearInterval(o),r(!0)):(n+=i,e&&n>=e&&(clearInterval(o),r(!1)))},i)})}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(e,r,n,i=Cn()){let o=this.getOptions(),s=Object.keys(this._integrations);return!r.integrations&&s.length>0&&(r.integrations=s),this.emit("preprocessEvent",e,r),e.type||i.setLastEventId(e.event_id||r.event_id),Nm(o,e,r,n,this,i).then(a=>{if(a===null)return a;let l=b(b({},i.getPropagationContext()),n?n.getPropagationContext():void 0);if(!(a.contexts&&a.contexts.trace)&&l){let{traceId:p,spanId:f,parentSpanId:d,dsc:g}=l;a.contexts=b({trace:Qe({trace_id:p,span_id:f,parent_span_id:d})},a.contexts);let E=g||vu(p,this);a.sdkProcessingMetadata=b({dynamicSamplingContext:E},a.sdkProcessingMetadata)}return a})}_captureEvent(e,r={},n){return this._processEvent(e,r,n).then(i=>i.event_id,i=>{if(xe){let o=i;o.logLevel==="log"?q.log(o.message):q.warn(o)}})}_processEvent(e,r,n){let i=this.getOptions(),{sampleRate:o}=i,s=bu(e),a=Mm(e),l=e.type||"error",m=`before send for type \`${l}\``,p=typeof o>"u"?void 0:Tm(o);if(a&&typeof p=="number"&&Math.random()>p)return this.recordDroppedEvent("sample_rate","error",e),Xr(new lt(`Discarding event because it's not included in the random sample (sampling rate = ${o})`,"log"));let f=l==="replay_event"?"replay":l,g=(e.sdkProcessingMetadata||{}).capturedSpanIsolationScope;return this._prepareEvent(e,r,n,g).then(E=>{if(E===null)throw this.recordDroppedEvent("event_processor",f,e),new lt("An event processor returned `null`, will not send event.","log");if(r.data&&r.data.__sentry__===!0)return E;let P=uv(this,i,E,r);return lv(P,m)}).then(E=>{if(E===null){if(this.recordDroppedEvent("before_send",f,e),bu(e)){let x=1+(e.spans||[]).length;this._outcomes.span=(this._outcomes.span||0)+x}throw new lt(`${m} returned \`null\`, will not send event.`,"log")}let N=n&&n.getSession();!s&&N&&this._updateSessionFromEvent(N,E);let P=E.transaction_info;if(s&&P&&E.transaction!==e.transaction){let R="custom";E.transaction_info=Z(b({},P),{source:R})}return this.sendEvent(E,r),E}).then(null,E=>{throw E instanceof lt?E:(this.captureException(E,{data:{__sentry__:!0},originalException:E}),new lt(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
|
|
30
|
+
Reason: ${E}`))})}_process(e){this._numProcessing++,e.then(r=>(this._numProcessing--,r),r=>(this._numProcessing--,r))}_clearOutcomes(){let e=this._outcomes;return this._outcomes={},Object.entries(e).map(([r,n])=>{let[i,o]=r.split(":");return{reason:i,category:o,quantity:n}})}};function lv(t,e){let r=`${e} must return \`null\` or a valid event.`;if(Pr(t))return t.then(n=>{if(!rr(n)&&n!==null)throw new lt(r);return n},n=>{throw new lt(`${e} rejected with ${n}`)});if(!rr(t)&&t!==null)throw new lt(r);return t}function uv(t,e,r,n){let{beforeSend:i,beforeSendTransaction:o,beforeSendSpan:s}=e;if(Mm(r)&&i)return i(r,n);if(bu(r)){if(r.spans&&s){let a=[];for(let l of r.spans){let m=s(l);m?a.push(m):t.recordDroppedEvent("before_send","span")}r.spans=a}if(o)return o(r,n)}return r}function Mm(t){return t.type===void 0}function bu(t){return t.type==="transaction"}var pv=64;function xa(t,e,r=Xl(t.bufferSize||pv)){let n={},i=s=>r.drain(s);function o(s){let a=[];if(da(s,(f,d)=>{let g=ha(d);if(su(n,g)){let E=km(f,d);t.recordDroppedEvent("ratelimit_backoff",g,E)}else a.push(f)}),a.length===0)return Yt({});let l=Tr(s[0],a),m=f=>{da(l,(d,g)=>{let E=km(d,g);t.recordDroppedEvent(f,ha(g),E)})},p=()=>e({body:ru(l)}).then(f=>(f.statusCode!==void 0&&(f.statusCode<200||f.statusCode>=300)&&xe&&q.warn(`Sentry responded with status code ${f.statusCode} to sent event.`),n=au(n,f),f),f=>{throw m("network_error"),f});return r.add(p).then(f=>f,f=>{if(f instanceof lt)return xe&&q.error("Skipped sending event because buffer is full."),m("queue_overflow"),Yt({});throw f})}return{send:o,flush:i}}function km(t,e){if(!(e!=="event"&&e!=="transaction"))return Array.isArray(t)?t[1]:void 0}function wu(t,e,r=[e],n="npm"){let i=t._metadata||{};i.sdk||(i.sdk={name:`sentry.javascript.${e}`,packages:r.map(o=>({name:`${n}:@sentry/${o}`,version:Vt})),version:Vt}),t._metadata=i}var fv=100;function xr(t,e){let r=Be(),n=Cn();if(!r)return;let{beforeBreadcrumb:i=null,maxBreadcrumbs:o=fv}=r.getOptions();if(o<=0)return;let s=Ir(),a=b({timestamp:s},t),l=i?Ti(()=>i(a,e)):a;l!==null&&(r.emit&&r.emit("beforeAddBreadcrumb",l,e),n.addBreadcrumb(l,o))}var Fm,mv="FunctionToString",Hm=new WeakMap,dv=()=>({name:mv,setupOnce(){Fm=Function.prototype.toString;try{Function.prototype.toString=function(...t){let e=In(this),r=Hm.has(Be())&&e!==void 0?e:this;return Fm.apply(r,t)}}catch{}},setup(t){Hm.set(t,!0)}}),Ca=dv;var hv=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,"undefined is not an object (evaluating 'a.L')",`can't redefine non-configurable property "solana"`,"vv().getRestrictions is not a function. (In 'vv().getRestrictions(1,a)', 'vv().getRestrictions' is undefined)","Can't find variable: _AutofillCallbackHandler"],gv="InboundFilters",yv=(t={})=>({name:gv,processEvent(e,r,n){let i=n.getOptions(),o=vv(t,i);return _v(e,o)?null:e}}),Ra=yv;function vv(t={},e={}){return{allowUrls:[...t.allowUrls||[],...e.allowUrls||[]],denyUrls:[...t.denyUrls||[],...e.denyUrls||[]],ignoreErrors:[...t.ignoreErrors||[],...e.ignoreErrors||[],...t.disableErrorDefaults?[]:hv],ignoreTransactions:[...t.ignoreTransactions||[],...e.ignoreTransactions||[]],ignoreInternal:t.ignoreInternal!==void 0?t.ignoreInternal:!0}}function _v(t,e){return e.ignoreInternal&&Tv(t)?(xe&&q.warn(`Event dropped due to being internal Sentry Error.
|
|
31
|
+
Event: ${nr(t)}`),!0):Ev(t,e.ignoreErrors)?(xe&&q.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
|
|
32
|
+
Event: ${nr(t)}`),!0):Cv(t)?(xe&&q.warn(`Event dropped due to not having an error message, error type or stacktrace.
|
|
33
|
+
Event: ${nr(t)}`),!0):Sv(t,e.ignoreTransactions)?(xe&&q.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
|
|
34
|
+
Event: ${nr(t)}`),!0):bv(t,e.denyUrls)?(xe&&q.warn(`Event dropped due to being matched by \`denyUrls\` option.
|
|
35
|
+
Event: ${nr(t)}.
|
|
36
|
+
Url: ${Da(t)}`),!0):wv(t,e.allowUrls)?!1:(xe&&q.warn(`Event dropped due to not being matched by \`allowUrls\` option.
|
|
37
|
+
Event: ${nr(t)}.
|
|
38
|
+
Url: ${Da(t)}`),!0)}function Ev(t,e){return t.type||!e||!e.length?!1:Iv(t).some(r=>bi(r,e))}function Sv(t,e){if(t.type!=="transaction"||!e||!e.length)return!1;let r=t.transaction;return r?bi(r,e):!1}function bv(t,e){if(!e||!e.length)return!1;let r=Da(t);return r?bi(r,e):!1}function wv(t,e){if(!e||!e.length)return!0;let r=Da(t);return r?bi(r,e):!0}function Iv(t){let e=[];t.message&&e.push(t.message);let r;try{r=t.exception.values[t.exception.values.length-1]}catch{}return r&&r.value&&(e.push(r.value),r.type&&e.push(`${r.type}: ${r.value}`)),e}function Tv(t){try{return t.exception.values[0].type==="SentryError"}catch{}return!1}function xv(t=[]){for(let e=t.length-1;e>=0;e--){let r=t[e];if(r&&r.filename!=="<anonymous>"&&r.filename!=="[native code]")return r.filename||null}return null}function Da(t){try{let e;try{e=t.exception.values[0].stacktrace.frames}catch{}return e?xv(e):null}catch{return xe&&q.error(`Cannot extract url for event ${nr(t)}`),null}}function Cv(t){return t.type||!t.exception||!t.exception.values||t.exception.values.length===0?!1:!t.message&&!t.exception.values.some(e=>e.stacktrace||e.type&&e.type!=="Error"||e.value)}var Dv="Dedupe",Rv=()=>{let t;return{name:Dv,processEvent(e){if(e.type)return e;try{if(Nv(e,t))return xe&&q.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return t=e}}},Na=Rv;function Nv(t,e){return e?!!(Ov(t,e)||Av(t,e)):!1}function Ov(t,e){let r=t.message,n=e.message;return!(!r&&!n||r&&!n||!r&&n||r!==n||!Wm(t,e)||!jm(t,e))}function Av(t,e){let r=$m(e),n=$m(t);return!(!r||!n||r.type!==n.type||r.value!==n.value||!Wm(t,e)||!jm(t,e))}function jm(t,e){let r=aa(t),n=aa(e);if(!r&&!n)return!0;if(r&&!n||!r&&n||(r=r,n=n,n.length!==r.length))return!1;for(let i=0;i<n.length;i++){let o=n[i],s=r[i];if(o.filename!==s.filename||o.lineno!==s.lineno||o.colno!==s.colno||o.function!==s.function)return!1}return!0}function Wm(t,e){let r=t.fingerprint,n=e.fingerprint;if(!r&&!n)return!0;if(r&&!n||!r&&n)return!1;r=r,n=n;try{return r.join("")===n.join("")}catch{return!1}}function $m(t){return t.exception&&t.exception.values&&t.exception.values[0]}var We=ee,Iu=0;function Tu(){return Iu>0}function Vv(){Iu++,setTimeout(()=>{Iu--})}function Rn(t,e={},r){if(typeof t!="function")return t;try{let i=t.__sentry_wrapped__;if(i)return i;if(In(t))return t}catch{return t}let n=function(){let i=Array.prototype.slice.call(arguments);try{r&&typeof r=="function"&&r.apply(this,arguments);let o=i.map(s=>Rn(s,e));return t.apply(this,o)}catch(o){throw Vv(),ba(s=>{s.addEventProcessor(a=>(e.mechanism&&(xi(a,void 0,void 0),Lr(a,e.mechanism)),a.extra=Z(b({},a.extra),{arguments:i}),a)),Ta(o)}),o}};try{for(let i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i])}catch{}ia(n,t),yt(t,"__sentry_wrapped__",n);try{Object.getOwnPropertyDescriptor(n,"name").configurable&&Object.defineProperty(n,"name",{get(){return t.name}})}catch{}return n}var Ur=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function Oa(t,e){let r=Du(t,e),n={type:e&&e.name,value:Jv(e)};return r.length&&(n.stacktrace={frames:r}),n.type===void 0&&n.value===""&&(n.value="Unrecoverable error caught"),n}function zv(t,e,r,n){let i=Be(),o=i&&i.getOptions().normalizeDepth,s=Zv(e),a={__serialized__:ma(e,o)};if(s)return{exception:{values:[Oa(t,s)]},extra:a};let l={exception:{values:[{type:wn(e)?e.constructor.name:n?"UnhandledRejection":"Error",value:Xv(e,{isUnhandledRejection:n})}]},extra:a};if(r){let m=Du(t,r);m.length&&(l.exception.values[0].stacktrace={frames:m})}return l}function xu(t,e){return{exception:{values:[Oa(t,e)]}}}function Du(t,e){let r=e.stacktrace||e.stack||"",n=qv(e),i=Kv(e);try{return t(r,n,i)}catch{}return[]}var Yv=/Minified React error #\d+;/i;function qv(t){return t&&Yv.test(t.message)?1:0}function Kv(t){return typeof t.framesToPop=="number"?t.framesToPop:0}function Jv(t){let e=t&&t.message;return e?e.error&&typeof e.error.message=="string"?e.error.message:e:"No error message"}function Ym(t,e,r,n){let i=r&&r.syntheticException||void 0,o=Aa(t,e,i,n);return Lr(o),o.level="error",r&&r.event_id&&(o.event_id=r.event_id),Yt(o)}function qm(t,e,r="info",n,i){let o=n&&n.syntheticException||void 0,s=Cu(t,e,o,i);return s.level=r,n&&n.event_id&&(s.event_id=n.event_id),Yt(s)}function Aa(t,e,r,n,i){let o;if(ea(e)&&e.error)return xu(t,e.error);if(ta(e)||Dl(e)){let s=e;if("stack"in e)o=xu(t,e);else{let a=s.name||(ta(s)?"DOMError":"DOMException"),l=s.message?`${a}: ${s.message}`:a;o=Cu(t,l,r,n),xi(o,l)}return"code"in s&&(o.tags=Z(b({},o.tags),{"DOMException.code":`${s.code}`})),o}return Sn(e)?xu(t,e):rr(e)||wn(e)?(o=zv(t,e,r,i),Lr(o,{synthetic:!0}),o):(o=Cu(t,e,r,n),xi(o,`${e}`,void 0),Lr(o,{synthetic:!0}),o)}function Cu(t,e,r,n){let i={};if(n&&r){let o=Du(t,r);o.length&&(i.exception={values:[{value:e,stacktrace:{frames:o}}]})}if(Si(e)){let{__sentry_template_string__:o,__sentry_template_values__:s}=e;return i.logentry={message:o,params:s},i}return i.message=e,i}function Xv(t,{isUnhandledRejection:e}){let r=Fl(t),n=e?"promise rejection":"exception";return ea(t)?`Event \`ErrorEvent\` captured as ${n} with message \`${t.message}\``:wn(t)?`Event \`${Qv(t)}\` (type=${t.type}) captured as ${n}`:`Object captured as ${n} with keys: ${r}`}function Qv(t){try{let e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch{}}function Zv(t){for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)){let r=t[e];if(r instanceof Error)return r}}function Km(t,{metadata:e,tunnel:r,dsn:n}){let i=b(b({event_id:t.event_id,sent_at:new Date().toISOString()},e&&e.sdk&&{sdk:{name:e.sdk.name,version:e.sdk.version}}),!!r&&!!n&&{dsn:br(n)}),o=e_(t);return Tr(i,[o])}function e_(t){return[{type:"user_report"},t]}var Oo=class extends No{constructor(e){let r=b({parentSpanIsAlwaysRootSpan:!0},e),n=We.SENTRY_SDK_SOURCE||Kl();wu(r,"browser",["browser"],n),super(r),r.sendClientReports&&We.document&&We.document.addEventListener("visibilitychange",()=>{We.document.visibilityState==="hidden"&&this._flushOutcomes()})}eventFromException(e,r){return Ym(this._options.stackParser,e,r,this._options.attachStacktrace)}eventFromMessage(e,r="info",n){return qm(this._options.stackParser,e,r,n,this._options.attachStacktrace)}captureUserFeedback(e){if(!this._isEnabled()){Ur&&q.warn("SDK not enabled, will not capture user feedback.");return}let r=Km(e,{metadata:this.getSdkMetadata(),dsn:this.getDsn(),tunnel:this.getOptions().tunnel});this.sendEnvelope(r)}_prepareEvent(e,r,n){return e.platform=e.platform||"javascript",super._prepareEvent(e,r,n)}_flushOutcomes(){let e=this._clearOutcomes();if(e.length===0){Ur&&q.log("No outcomes to send");return}if(!this._dsn){Ur&&q.log("No dsn provided, will not send outcomes");return}Ur&&q.log("Sending outcomes:",e);let r=ou(e,this._options.tunnel&&br(this._dsn));this.sendEnvelope(r)}};var Jm=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var ze=ee;var t_=1e3,Xm,Ru,Nu;function Ou(t){let e="dom";vt(e,t),_t(e,r_)}function r_(){if(!ze.document)return;let t=Ze.bind(null,"dom"),e=Qm(t,!0);ze.document.addEventListener("click",e,!1),ze.document.addEventListener("keypress",e,!1),["EventTarget","Node"].forEach(r=>{let n=ze[r]&&ze[r].prototype;!n||!n.hasOwnProperty||!n.hasOwnProperty("addEventListener")||(Ae(n,"addEventListener",function(i){return function(o,s,a){if(o==="click"||o=="keypress")try{let l=this,m=l.__sentry_instrumentation_handlers__=l.__sentry_instrumentation_handlers__||{},p=m[o]=m[o]||{refCount:0};if(!p.handler){let f=Qm(t);p.handler=f,i.call(this,o,f,a)}p.refCount++}catch{}return i.call(this,o,s,a)}}),Ae(n,"removeEventListener",function(i){return function(o,s,a){if(o==="click"||o=="keypress")try{let l=this,m=l.__sentry_instrumentation_handlers__||{},p=m[o];p&&(p.refCount--,p.refCount<=0&&(i.call(this,o,p.handler,a),p.handler=void 0,delete m[o]),Object.keys(m).length===0&&delete l.__sentry_instrumentation_handlers__)}catch{}return i.call(this,o,s,a)}}))})}function n_(t){if(t.type!==Ru)return!1;try{if(!t.target||t.target._sentryId!==Nu)return!1}catch{}return!0}function i_(t,e){return t!=="keypress"?!1:!e||!e.tagName?!0:!(e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable)}function Qm(t,e=!1){return r=>{if(!r||r._sentryCaptured)return;let n=o_(r);if(i_(r.type,n))return;yt(r,"_sentryCaptured",!0),n&&!n._sentryId&&yt(n,"_sentryId",rt());let i=r.type==="keypress"?"input":r.type;n_(r)||(t({event:r,name:i,global:e}),Ru=r.type,Nu=n?n._sentryId:void 0),clearTimeout(Xm),Xm=ze.setTimeout(()=>{Nu=void 0,Ru=void 0},t_)}}function o_(t){try{return t.target}catch{return null}}var Pa;function Au(t){let e="history";vt(e,t),_t(e,s_)}function s_(){if(!cu())return;let t=ze.onpopstate;ze.onpopstate=function(...r){let n=ze.location.href,i=Pa;if(Pa=n,Ze("history",{from:i,to:n}),t)try{return t.apply(this,r)}catch{}};function e(r){return function(...n){let i=n.length>2?n[2]:void 0;if(i){let o=Pa,s=String(i);Pa=s,Ze("history",{from:o,to:s})}return r.apply(this,n)}}Ae(ze.history,"pushState",e),Ae(ze.history,"replaceState",e)}var La={};function Pu(t){let e=La[t];if(e)return e;let r=ze[t];if(bo(r))return La[t]=r.bind(ze);let n=ze.document;if(n&&typeof n.createElement=="function")try{let i=n.createElement("iframe");i.hidden=!0,n.head.appendChild(i);let o=i.contentWindow;o&&o[t]&&(r=o[t]),n.head.removeChild(i)}catch(i){Jm&&q.warn(`Could not create sandbox iframe for ${t} check, bailing to window.${t}: `,i)}return r&&(La[t]=r.bind(ze))}function Ba(t){La[t]=void 0}var Nn="__sentry_xhr_v3__";function Lu(t){let e="xhr";vt(e,t),_t(e,a_)}function a_(){if(!ze.XMLHttpRequest)return;let t=XMLHttpRequest.prototype;Ae(t,"open",function(e){return function(...r){let n=Lt()*1e3,i=gt(r[0])?r[0].toUpperCase():void 0,o=c_(r[1]);if(!i||!o)return e.apply(this,r);this[Nn]={method:i,url:o,request_headers:{}},i==="POST"&&o.match(/sentry_key/)&&(this.__sentry_own_request__=!0);let s=()=>{let a=this[Nn];if(a&&this.readyState===4){try{a.status_code=this.status}catch{}let l={endTimestamp:Lt()*1e3,startTimestamp:n,xhr:this};Ze("xhr",l)}};return"onreadystatechange"in this&&typeof this.onreadystatechange=="function"?Ae(this,"onreadystatechange",function(a){return function(...l){return s(),a.apply(this,l)}}):this.addEventListener("readystatechange",s),Ae(this,"setRequestHeader",function(a){return function(...l){let[m,p]=l,f=this[Nn];return f&>(m)&>(p)&&(f.request_headers[m.toLowerCase()]=p),a.apply(this,l)}}),e.apply(this,r)}}),Ae(t,"send",function(e){return function(...r){let n=this[Nn];if(!n)return e.apply(this,r);r[0]!==void 0&&(n.body=r[0]);let i={startTimestamp:Lt()*1e3,xhr:this};return Ze("xhr",i),e.apply(this,r)}})}function c_(t){if(gt(t))return t;try{return t.toString()}catch{}}function Bu(t,e=Pu("fetch")){let r=0,n=0;function i(o){let s=o.body.length;r+=s,n++;let a=b({body:o.body,method:"POST",referrerPolicy:"origin",headers:t.headers,keepalive:r<=6e4&&n<15},t.fetchOptions);if(!e)return Ba("fetch"),Xr("No fetch implementation available");try{return e(t.url,a).then(l=>(r-=s,n--,{statusCode:l.status,headers:{"x-sentry-rate-limits":l.headers.get("X-Sentry-Rate-Limits"),"retry-after":l.headers.get("Retry-After")}}))}catch(l){return Ba("fetch"),r-=s,n--,Xr(l)}}return xa(t,i)}var l_=30;var u_=50;function Uu(t,e,r,n){let i={filename:t,function:e==="<anonymous>"?wr:e,in_app:!0};return r!==void 0&&(i.lineno=r),n!==void 0&&(i.colno=n),i}var p_=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,f_=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,m_=/\((\S*)(?::(\d+))(?::(\d+))\)/,d_=t=>{let e=p_.exec(t);if(e){let[,n,i,o]=e;return Uu(n,wr,+i,+o)}let r=f_.exec(t);if(r){if(r[2]&&r[2].indexOf("eval")===0){let s=m_.exec(r[2]);s&&(r[2]=s[1],r[3]=s[2],r[4]=s[3])}let[i,o]=rd(r[1]||wr,r[2]);return Uu(o,i,r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},Zm=[l_,d_],h_=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,g_=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,y_=t=>{let e=h_.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){let o=g_.exec(e[3]);o&&(e[1]=e[1]||"eval",e[3]=o[1],e[4]=o[2],e[5]="")}let n=e[3],i=e[1]||wr;return[i,n]=rd(i,n),Uu(n,i,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},ed=[u_,y_];var td=[Zm,ed],Mu=$l(...td),rd=(t,e)=>{let r=t.indexOf("safari-extension")!==-1,n=t.indexOf("safari-web-extension")!==-1;return r||n?[t.indexOf("@")!==-1?t.split("@")[0]:wr,r?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]};var Ua=1024,__="Breadcrumbs",E_=(t={})=>{let e=b({console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0},t);return{name:__,setup(r){e.console&&jl(w_(r)),e.dom&&Ou(b_(r,e.dom)),e.xhr&&Lu(I_(r)),e.fetch&&zl(T_(r)),e.history&&Au(x_(r)),e.sentry&&r.on("beforeSendEvent",S_(r))}}},nd=E_;function S_(t){return function(r){Be()===t&&xr({category:`sentry.${r.type==="transaction"?"transaction":"event"}`,event_id:r.event_id,level:r.level,message:nr(r)},{event:r})}}function b_(t,e){return function(n){if(Be()!==t)return;let i,o,s=typeof e=="object"?e.serializeAttribute:void 0,a=typeof e=="object"&&typeof e.maxStringLength=="number"?e.maxStringLength:void 0;a&&a>Ua&&(Ur&&q.warn(`\`dom.maxStringLength\` cannot exceed ${Ua}, but a value of ${a} was configured. Sentry will use ${Ua} instead.`),a=Ua),typeof s=="string"&&(s=[s]);try{let m=n.event,p=C_(m)?m.target:m;i=Eo(p,{keyAttrs:s,maxStringLength:a}),o=Ul(p)}catch{i="<unknown>"}if(i.length===0)return;let l={category:`ui.${n.name}`,message:i};o&&(l.data={"ui.component_name":o}),xr(l,{event:n.event,name:n.name,global:n.global})}}function w_(t){return function(r){if(Be()!==t)return;let n={category:"console",data:{arguments:r.args,logger:"console"},level:Ql(r.level),message:ra(r.args," ")};if(r.level==="assert")if(r.args[0]===!1)n.message=`Assertion failed: ${ra(r.args.slice(1)," ")||"console.assert"}`,n.data.arguments=r.args.slice(1);else return;xr(n,{input:r.args,level:r.level})}}function I_(t){return function(r){if(Be()!==t)return;let{startTimestamp:n,endTimestamp:i}=r,o=r.xhr[Nn];if(!n||!i||!o)return;let{method:s,url:a,status_code:l,body:m}=o,p={method:s,url:a,status_code:l},f={xhr:r.xhr,input:m,startTimestamp:n,endTimestamp:i};xr({category:"xhr",data:p,type:"http"},f)}}function T_(t){return function(r){if(Be()!==t)return;let{startTimestamp:n,endTimestamp:i}=r;if(i&&!(r.fetchData.url.match(/sentry_key/)&&r.fetchData.method==="POST"))if(r.error){let o=r.fetchData,s={data:r.error,input:r.args,startTimestamp:n,endTimestamp:i};xr({category:"fetch",data:o,level:"error",type:"http"},s)}else{let o=r.response,s=Z(b({},r.fetchData),{status_code:o&&o.status}),a={input:r.args,response:o,startTimestamp:n,endTimestamp:i};xr({category:"fetch",data:s,type:"http"},a)}}}function x_(t){return function(r){if(Be()!==t)return;let n=r.from,i=r.to,o=Io(We.location.href),s=n?Io(n):void 0,a=Io(i);(!s||!s.path)&&(s=o),o.protocol===a.protocol&&o.host===a.host&&(i=a.relative),o.protocol===s.protocol&&o.host===s.host&&(n=s.relative),xr({category:"navigation",data:{from:n,to:i}})}}function C_(t){return!!t&&!!t.target}var D_=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","BroadcastChannel","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","SharedWorker","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],R_="BrowserApiErrors",N_=(t={})=>{let e=b({XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0},t);return{name:R_,setupOnce(){e.setTimeout&&Ae(We,"setTimeout",id),e.setInterval&&Ae(We,"setInterval",id),e.requestAnimationFrame&&Ae(We,"requestAnimationFrame",O_),e.XMLHttpRequest&&"XMLHttpRequest"in We&&Ae(XMLHttpRequest.prototype,"send",A_);let r=e.eventTarget;r&&(Array.isArray(r)?r:D_).forEach(P_)}}},od=N_;function id(t){return function(...e){let r=e[0];return e[0]=Rn(r,{mechanism:{data:{function:zt(t)},handled:!1,type:"instrument"}}),t.apply(this,e)}}function O_(t){return function(e){return t.apply(this,[Rn(e,{mechanism:{data:{function:"requestAnimationFrame",handler:zt(t)},handled:!1,type:"instrument"}})])}}function A_(t){return function(...e){let r=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(i=>{i in r&&typeof r[i]=="function"&&Ae(r,i,function(o){let s={mechanism:{data:{function:i,handler:zt(o)},handled:!1,type:"instrument"}},a=In(o);return a&&(s.mechanism.data.handler=zt(a)),Rn(o,s)})}),t.apply(this,e)}}function P_(t){let e=We,r=e[t]&&e[t].prototype;!r||!r.hasOwnProperty||!r.hasOwnProperty("addEventListener")||(Ae(r,"addEventListener",function(n){return function(i,o,s){try{typeof o.handleEvent=="function"&&(o.handleEvent=Rn(o.handleEvent,{mechanism:{data:{function:"handleEvent",handler:zt(o),target:t},handled:!1,type:"instrument"}}))}catch{}return n.apply(this,[i,Rn(o,{mechanism:{data:{function:"addEventListener",handler:zt(o),target:t},handled:!1,type:"instrument"}}),s])}}),Ae(r,"removeEventListener",function(n){return function(i,o,s){let a=o;try{let l=a&&a.__sentry_wrapped__;l&&n.call(this,i,l,s)}catch{}return n.call(this,i,a,s)}}))}var L_="GlobalHandlers",B_=(t={})=>{let e=b({onerror:!0,onunhandledrejection:!0},t);return{name:L_,setupOnce(){Error.stackTraceLimit=50},setup(r){e.onerror&&(U_(r),sd("onerror")),e.onunhandledrejection&&(M_(r),sd("onunhandledrejection"))}}},ad=B_;function U_(t){Yl(e=>{let{stackParser:r,attachStacktrace:n}=cd();if(Be()!==t||Tu())return;let{msg:i,url:o,line:s,column:a,error:l}=e,m=H_(Aa(r,l||i,void 0,n,!1),o,s,a);m.level="error",Ro(m,{originalException:l,mechanism:{handled:!1,type:"onerror"}})})}function M_(t){ql(e=>{let{stackParser:r,attachStacktrace:n}=cd();if(Be()!==t||Tu())return;let i=k_(e),o=bn(i)?F_(i):Aa(r,i,void 0,n,!0);o.level="error",Ro(o,{originalException:i,mechanism:{handled:!1,type:"onunhandledrejection"}})})}function k_(t){if(bn(t))return t;try{if("reason"in t)return t.reason;if("detail"in t&&"reason"in t.detail)return t.detail.reason}catch{}return t}function F_(t){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(t)}`}]}}}function H_(t,e,r,n){let i=t.exception=t.exception||{},o=i.values=i.values||[],s=o[0]=o[0]||{},a=s.stacktrace=s.stacktrace||{},l=a.frames=a.frames||[],m=isNaN(parseInt(n,10))?void 0:n,p=isNaN(parseInt(r,10))?void 0:r,f=gt(e)&&e.length>0?e:Bl();return l.length===0&&l.push({colno:m,filename:f,function:wr,in_app:!0,lineno:p}),t}function sd(t){Ur&&q.log(`Global Handler attached: ${t}`)}function cd(){let t=Be();return t&&t.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}var ld=()=>({name:"HttpContext",preprocessEvent(t){if(!We.navigator&&!We.location&&!We.document)return;let e=t.request&&t.request.url||We.location&&We.location.href,{referrer:r}=We.document||{},{userAgent:n}=We.navigator||{},i=b(b(b({},t.request&&t.request.headers),r&&{Referer:r}),n&&{"User-Agent":n}),o=Z(b(b({},t.request),e&&{url:e}),{headers:i});t.request=o}});var $_="cause",j_=5,W_="LinkedErrors",G_=(t={})=>{let e=t.limit||j_,r=t.key||$_;return{name:W_,preprocessEvent(n,i,o){let s=o.getOptions();Pl(Oa,s.stackParser,s.maxValueLength,r,e,n,i)}}},ud=G_;function ku(t){return[Ra(),Ca(),od(),nd(),ad(),ud(),Na(),ld()]}var Fu=class extends Error{cause;constructor(e,r){super(e),this.cause=r}},Ue=class t{static INSTANCE;contexts={};tags;client;user;constructor(){this.init()}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}captureException(e,r,n){w.error(e),this.getNewScope(r,n).captureException(e)}captureMessage(e,r,n,i){this.getNewScope(n,i).captureMessage(e,r??"error")}captureError(e,r,n,i){w.error(e,r);let o=this.getNewScope(n,i),s=new Fu(e,r);o.captureException(s)}setGlobalContext(e,r){this.contexts[e]=b({context:r},this.contexts[e])}setUser(e){this.user=e}setTags(e){this.tags=e}getNewScope(e,r){let n=new ut;if(n.setClient(this.client),n.setUser(this.user),e?.triggerContext){let i=e.triggerContext;n.setExtras(i.triggerData.sentryContext()),delete e.triggerContext}return e&&n.setExtras(e),this.tags&&n.setTags(this.tags),r&&n.setTags(r),Object.keys(this.contexts).forEach(i=>{n.setContext(i,this.contexts[i])}),n.setTag("language",navigator.language),n.setTag("timezone",ce.getTimezone()),n}init(){let e=ku({}).filter(r=>!["BrowserApiErrors","Breadcrumbs","GlobalHandlers"].includes(r.name));this.client=new Oo({dsn:"https://1bc3dda4c861f60cd6be1b67584f4bc6@o559187.ingest.us.sentry.io/4507626484203520",transport:Bu,stackParser:Mu,integrations:e,environment:Gr.mode,release:`web-sdk@${A.SDK_VERSION}`,debug:Gr.debug}),this.client.init()}};var Hu={d:(t,e)=>{for(var r in e)Hu.o(e,r)&&!Hu.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},$u={};Hu.d($u,{A:()=>Y_,k:()=>ju});var V_=function(t,e,r,n){return new(r||(r=Promise))(function(i,o){function s(m){try{l(n.next(m))}catch(p){o(p)}}function a(m){try{l(n.throw(m))}catch(p){o(p)}}function l(m){var p;m.done?i(m.value):(p=m.value,p instanceof r?p:new r(function(f){f(p)})).then(s,a)}l((n=n.apply(t,e||[])).next())})},z_=function(t,e){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(m){return function(p){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,p[0]&&(s=0)),s;)try{if(r=1,n&&(i=2&p[0]?n.return:p[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,p[1])).done)return i;switch(n=0,i&&(p=[2&p[0],i.value]),p[0]){case 0:case 1:i=p;break;case 4:return s.label++,{value:p[1],done:!1};case 5:s.label++,n=p[1],p=[0];continue;case 7:p=s.ops.pop(),s.trys.pop();continue;default:if(i=s.trys,!((i=i.length>0&&i[i.length-1])||p[0]!==6&&p[0]!==2)){s=0;continue}if(p[0]===3&&(!i||p[1]>i[0]&&p[1]<i[3])){s.label=p[1];break}if(p[0]===6&&s.label<i[1]){s.label=i[1],i=p;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(p);break}i[2]&&s.ops.pop(),s.trys.pop();continue}p=e.call(t,s)}catch(f){p=[6,f],n=0}finally{r=i=0}if(5&p[0])throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}([l,m])}}};function ju(){return V_(this,void 0,Promise,function(){return z_(this,function(_a){switch(_a.label){case 0:return[4,new Promise(function(resolve,reject){var browserName="Unknown";function __callback(t){resolve({isPrivate:t,browserName})}function identifyChromium(){var t=navigator.userAgent;return t.match(/Chrome/)?navigator.brave!==void 0?"Brave":t.match(/Edg/)?"Edge":t.match(/OPR/)?"Opera":"Chrome":"Chromium"}function assertEvalToString(t){return t===eval.toString().length}function feid(){var toFixedEngineID=0;try{eval("(-1).toFixed(-1);")}catch(t){toFixedEngineID=t.message.length}return toFixedEngineID}function isSafari(){return feid()===44}function isChrome(){return feid()===51}function isFirefox(){return feid()===25}function isMSIE(){return navigator.msSaveBlob!==void 0&&assertEvalToString(39)}function newSafariTest(){var t=String(Math.random());try{window.indexedDB.open(t,1).onupgradeneeded=function(e){var r,n,i=(r=e.target)===null||r===void 0?void 0:r.result;try{i.createObjectStore("test",{autoIncrement:!0}).put(new Blob),__callback(!1)}catch(s){var o=s;return s instanceof Error&&(o=(n=s.message)!==null&&n!==void 0?n:s),typeof o!="string"?void __callback(!1):void __callback(o.includes("BlobURLs are not yet supported"))}finally{i.close(),window.indexedDB.deleteDatabase(t)}}}catch{__callback(!1)}}function oldSafariTest(){var t=window.openDatabase,e=window.localStorage;try{t(null,null,null,null)}catch{return void __callback(!0)}try{e.setItem("test","1"),e.removeItem("test")}catch{return void __callback(!0)}__callback(!1)}function safariPrivateTest(){navigator.maxTouchPoints!==void 0?newSafariTest():oldSafariTest()}function getQuotaLimit(){var t=window;return t.performance!==void 0&&t.performance.memory!==void 0&&t.performance.memory.jsHeapSizeLimit!==void 0?performance.memory.jsHeapSizeLimit:1073741824}function storageQuotaChromePrivateTest(){navigator.webkitTemporaryStorage.queryUsageAndQuota(function(t,e){__callback(Math.round(e/1048576)<2*Math.round(getQuotaLimit()/1048576))},function(t){reject(new Error("detectIncognito somehow failed to query storage quota: "+t.message))})}function oldChromePrivateTest(){(0,window.webkitRequestFileSystem)(0,1,function(){__callback(!1)},function(){__callback(!0)})}function chromePrivateTest(){self.Promise!==void 0&&self.Promise.allSettled!==void 0?storageQuotaChromePrivateTest():oldChromePrivateTest()}function firefoxPrivateTest(){__callback(navigator.serviceWorker===void 0)}function msiePrivateTest(){__callback(window.indexedDB===void 0)}function main(){isSafari()?(browserName="Safari",safariPrivateTest()):isChrome()?(browserName=identifyChromium(),chromePrivateTest()):isFirefox()?(browserName="Firefox",firefoxPrivateTest()):isMSIE()?(browserName="Internet Explorer",msiePrivateTest()):reject(new Error("detectIncognito cannot determine the browser"))}main()})];case 1:return[2,_a.sent()]}})})}typeof window<"u"&&(window.detectIncognito=ju);var Y_=ju,pd=$u.A,OL=$u.k;var hd=Xt(tn());var Ma=class{parser;result={};constructor(){this.parser=Nt.get().getUAParser()}async get(){let e=this.result;return this.getDeviceMemory(),this.getNetworkType(),this.getOrientation(),await this.getBatteryInfo(),await this.getLocation(),e.locale=navigator.language,e.display={w:screen.width,h:screen.height,pd:screen.pixelDepth,dpi:this.getDPI()},e.win={ow:window.outerWidth,oh:window.outerHeight,iw:window.innerWidth,ih:window.innerHeight,dpr:window.devicePixelRatio},e.browser={name:this.parser.getBrowser().name,ver:this.parser.getBrowser().version},e.device={model:this.parser.getDevice().model,type:this.parser.getDevice().type,vendor:this.parser.getDevice().vendor},e.os={name:this.parser.getOS().name,ver:this.parser.getOS().version},e.navigatorUA=navigator.userAgent,e.isHeadless=navigator.webdriver,e}getDeviceMemory(){let e=navigator;if(!e.deviceMemory)return;let r=e.deviceMemory;this.result.mem={tot:r*1024}}getNetworkType(){let e=navigator,r=e.connection||e.mozConnection||e.webkitConnection;r?.effectiveType&&(this.result.net={type:r.effectiveType})}getOrientation(){let e=screen.orientation?.type;e&&(this.result.orientation=e)}getDPI(){let e=document.createElement("div");e.setAttribute("style","height: 1in; left: -100%; position: absolute; top: -100%; width: 1in;"),document.body.appendChild(e);let r=window.devicePixelRatio||1,n=e.offsetWidth*r;return document.body.removeChild(e),n}async getLocation(){if(!(!navigator.geolocation||!navigator.permissions||(await navigator.permissions.query({name:"geolocation"})).state!="granted"))return new Promise(r=>{navigator.geolocation.getCurrentPosition(n=>{this.result.coords=[n.coords.latitude,n.coords.longitude],r()},()=>r())})}async getBatteryInfo(){if("getBattery"in navigator)try{let r=await navigator.getBattery();this.result.bat={l:r.level*100,c:r.charging}}catch{}}};var Di=class{static trackDeviceID(e){this.isInstalled()}static trackIntent(e){if(!this.isInstalled())return;let r=cn[e]?.toLowerCase();r&&(w.debug(`Sending ${r} intent to MS Clarity`),window.clarity("set","Cooee Intent",r))}static isInstalled(){return window.clarity&&typeof window.clarity=="function"}};var Ri=class{constructor(e,r){this._startTime=e;this._triggerData=r}intervals=[];selectedEmbeddedItems;renderer;closeCallback;inputFields=[];get startTime(){return this._startTime}get triggerData(){return this._triggerData}get inputs(){return this.inputFields}get rootClassName(){let e=this.triggerData.shortID??this.triggerData.id.slice(-6);return e==="test"&&(e="test-"+this.startTime.getTime().toString()),A.IN_APP_WRAPPER_NAME+"-"+e}get selectedItems(){return this.triggerData.items.filter(e=>e.selected.value)}get shouldGiveFBTDiscount(){let e=this.selectedItems.length;return this.triggerData.bundleConfig?.applyDiscountOnMinimum?this.triggerData.bundleConfig.applyDiscountOnMinimum<=e:e===this.triggerData.items.length}onClose(e){this.closeCallback=e}closeInApp(e,r){r??={};let n=(new Date().getTime()-this.startTime.getTime())/1e3,i=b({eventName:e,duration:n},r);this.stopIntervals(),this.closeCallback&&this.closeCallback(i)}addInputField(e,r){this.inputFields.push({id:e,type:r,isValid:!1})}updateValidation(e,r){this.inputFields.forEach(n=>{if(n.id===e){n.isValid=r;return}})}hasManipulatedProductQuantity(){let e=this.triggerData.manipulation.productQuantity;return e.enabled&&e.min!=null&&e.max!=null}getManipulatedQuantity(e){let{min:r=1,max:n=100}=this.triggerData.manipulation.productQuantity;if(r>n)return w.error("Invalid range: min should be less than or equal to max."),e;if(e>=r&&e<=n)return e;let i=e%100;return i<r?r:i>n?n:i}stopIntervals(){this.intervals.forEach(e=>clearInterval(e))}};var ka=class{loadedFonts=[];async loadAllFonts(e){e.elems?.forEach(r=>{r instanceof dr&&this.loadFamily(r.typography?.fam)})}async loadFamily(e){if(!e?.fonts||this.loadedFonts.indexOf(e.name)>-1)return;let r=[];e.fonts.forEach(i=>{if(i.url){let o=new FontFace(A.COOEE+e.name,i.getURL(),i.getFontDescriptor());r.push(o.load())}}),this.loadedFonts.push(e.name),(await Promise.all(r)).forEach(i=>{document.fonts.add(i)})}};var Fa=class{static updateIdentity(e){if(!this.isInstalled())return;let r={};e.email&&(r.email=e.email),e.mobile&&(r.phone_number=e.mobile),w.debug("Sending email/mobile to Klaviyo"),window.klaviyo.push(["identify",r])}static isInstalled(){return window.klaviyo&&typeof window.klaviyo=="object"}};var Ha=class{apiService;action;triggerContext;constructor(e,r){this.action=e,this.apiService=ue.getInstance(),this.triggerContext=r}async execute(){let e=this.containsCTA()?A.EVENT_TRIGGER_CLICKED:A.EVENT_TRIGGER_CLOSED;switch(this.action.at!==106&&this.closeTriggerAndSendEvent(e),this.action.at){case 2:break;case 4:this.gotoURLAction();break;case 5:this.shareAction();break;case 106:this.collectFormData();break;case void 0:case 105:break;default:w.error("Received an invalid ClickActionType: ",this.action.at);return}}externalAction(){this.action.ext?.u&&window.open(this.action.ext.u,"_blank")?.focus()}gotoURLAction(){if(this.action.gu?.u){let e=this.action.gu.u;ce.isValidURL(e)||(e=`//${e}`),window.open(e,"_self")}}prompt(){let e=this.action.pmpt;e&&(e===2&&this.promptLocationPermission(),e===3&&this.promptPushNotificationPermission(),e===1&&this.promptCameraPermission())}closeTriggerAndSendEvent(e,r){this.triggerContext.closeInApp(e,r),this.dispatchEvent()}shareAction(){if(!this.action.share)return;if(!navigator.share){w.warn("Navigator.share is not compatible with this browser");return}navigator.share({text:this.action.share.text,title:"Share"}).then(r=>console.log(r)).catch(r=>console.error(r))}containsCTA(){return this.action.at&&this.action.at!==1?!0:!(this.isEmpty(this.action.custKV)&&this.isEmpty(this.action.up))}isEmpty(e){return e?Object.keys(e).length===0:!0}promptLocationPermission(){!navigator.geolocation||!navigator.permissions||navigator.geolocation.getCurrentPosition(e=>{this.apiService.updateDeviceProps({coords:[e.coords.latitude,e.coords.longitude]}),this.sendPermissionData()})}promptPushNotificationPermission(){if(!("Notification"in window)){w.warn("This browser does not support desktop notification");return}if(Notification.permission!=="default"){this.apiService.updateDeviceProps({pnPerm:Notification.permission});return}Notification.requestPermission().then(()=>{this.sendPermissionData()})}promptCameraPermission(){navigator.mediaDevices&&navigator.mediaDevices.getUserMedia({video:!0}).finally(()=>{this.sendPermissionData()})}checkPermission(e){return navigator.permissions.query({name:e}).then(r=>r.state.toString())}async checkAllPermission(){let e=await this.checkPermission("camera"),r=await this.checkPermission("geolocation"),n=Notification.permission;return{camera:e,location:r,notification:n}}sendPermissionData(){this.checkAllPermission().then(e=>{this.apiService.updateDeviceProps({perm:e})})}collectFormData(){let e={};for(let r of this.triggerContext.inputs){if(!r.isValid)return;let i=document.getElementById(r.id).value;r.type===51?e.email=i:r.type===52&&(e.mobile=i)}this.closeTriggerAndSendEvent(A.EVENT_FORM_SUBMITTED,{form:e}),ce.showSnackbar("Coupon applied on cart"),Fa.updateIdentity(e)}dispatchEvent(){let e=this.triggerContext.triggerData,r={clickAction:this.action,items:this.triggerContext.selectedEmbeddedItems??e.embeddedItems??e.items,collections:e.collections,triggerData:e};document.dispatchEvent(new CustomEvent(A.CTA_EVENT,{detail:r}));let n={action:this.containsCTA()?A.CAMPAIGN_CLICKED_ACTIVITY:A.CAMPAIGN_CLOSED_ACTIVITY};document.dispatchEvent(new CustomEvent(A.POPUP_ACTIVITY_EVENT,{detail:n}))}};var Ni=class{constructor(e){this.scalingFactor=e}getLayoutStyles(e){if(!e)return{display:"block"};let r={display:e.disp};return e.of&&(r.objectFit=e.of),e.pos==="absolute"&&(r.width="auto !important",r.position="absolute",r.right=e.right+"px",r.left=e.left+"px",r.top=e.top+"px",r.bottom=e.bottom+"px"),r}getSizeStyles(e){let r={};return e?.w&&(r.width=e.w),e?.h&&(r.height=e.h),e?.maxW&&(r.maxWidth=e.maxW),e?.maxH&&(r.maxHeight=e.maxH),e?.minW&&(r.minWidth=e.minW),e?.minH&&(r.minHeight=e.minH),r}getBorderStyles(e){if(!e)return{};let r={};return e.radius&&e.radius>0&&(r.borderRadius=this.getSizePx(e.radius)),e.width&&e.width>0&&(r.borderWidth=this.getSizePx(e.width),r.borderStyle=e.style?.toLowerCase(),e.color?this.getColourStyles(e.color,"border-color",r):r.borderColor="black"),r}getFlexStyles(e){return e?{gap:e.gap+"px",flexWrap:e.wrap,flexDirection:e.dir,justifyContent:e.jc,alignItems:e.ai,width:"100%"}:{}}getSpaceStyles(e){let r={};return e?(r.paddingTop=this.getSizePx(e.pt),r.paddingBottom=this.getSizePx(e.pb),r.paddingLeft=this.getSizePx(e.pl),r.paddingRight=this.getSizePx(e.pr),r.marginTop=this.getSizePx(e.mt),r.marginBottom=this.getSizePx(e.mb),r.marginLeft=e.cent?"auto":this.getSizePx(e.ml),r.marginRight=e.cent?"auto":this.getSizePx(e.mr),r):(r.margin="0 !important",r.padding="unset",r)}getBackgroundStyles(e){if(!e)return{};let r={};if(e.glossy){let n="backdrop-filter",i="-webkit-"+n,o=`blur(${e.glossy.radius}px)`;if(!CSS.supports(i,o)&&!CSS.supports(n,o))return{background:e.glossy.fallback.rgba};if(r[i]=o,r[n]=o,e.glossy.color)return this.getColourStyles(e.glossy.color,"background",r)}else if(e.solid){if(e.solid.grad)return this.getGradientStyles(e.solid.grad,"background",r);if(e.solid.hex)return{backgroundColor:e.solid.rgba}}else if(e.img){if(!e.img.src)return{};let n=(e.img.a??0)/100;r.background=`linear-gradient(rgba(0, 0, 0, ${n}), rgba(0, 0, 0, ${n})),url("${e.img.src}") no-repeat center`,r.backgroundSize="cover",e.img.a&&(r["-webkit-backdrop-filter"]=`opacity(${e.img.a})`,r.backdropFilter=`opacity(${e.img.a})`)}return r}getGradientStyles(e,r,n){if(n??={},e.type==="LINEAR"){let i=`linear-gradient(${e.ang}deg, ${e.c1}, ${e.c2}`;e.c3&&(i+=`, ${e.c3}`),i+=")",n[r]=i}return n}getColourStyles(e,r="color",n){return n??={},e?e.grad?this.getGradientStyles(e.grad,r,n):(e.hex&&(n[r]=e.rgba),n):n}getSizePx(e){return this.getScaledSize(e)+"px"}getScaledSize(e){return(e??0)*this.scalingFactor}};var qt=class{renderer=Nt.get();parentHTMLEl;inappElement;inappHTMLEl;triggerContext;stylesConverter;scalingFactor;constructor(e,r,n){this.parentHTMLEl=e,this.inappElement=r,this.triggerContext=n,this.stylesConverter=new Ni(this.renderer.getScalingFactor())}getHTMLElement(){return this.inappHTMLEl}insertElement(){this.renderer.appendChild(this.parentHTMLEl,this.inappHTMLEl)}processCommonBlocks(){this.processWidthAndHeight(),this.processPositionBlock(),this.processTransformBlock(),this.processTransparency(),this.processShadow(),this.registerAction();let e=Z(b(b(b(b({},this.getDisplayStyles()),this.getSpaceStyles()),this.getBorderStyles()),this.getBackgroundStyles()),{boxSizing:"border-box",outline:"none"});this.renderer.setStyles(this.inappHTMLEl,e)}getDisplayStyles(){return{display:"block"}}processWidthAndHeight(){this.inappElement.w&&this.renderer.setStyle(this.inappHTMLEl,"width",this.stylesConverter.getSizePx(this.inappElement.w)),this.inappElement.h&&this.renderer.setStyle(this.inappHTMLEl,"height",this.stylesConverter.getSizePx(this.inappElement.h))}processPositionBlock(){let e={position:"absolute",left:this.stylesConverter.getSizePx(this.inappElement.x),top:this.stylesConverter.getSizePx(this.inappElement.y)};this.renderer.setStyles(this.inappHTMLEl,e)}getBorderStyles(){return this.stylesConverter.getBorderStyles(this.inappElement.br)}getSpaceStyles(){return this.stylesConverter.getSpaceStyles(this.inappElement.spc)}processTransparency(){let e=this.inappElement.alpha;if(!isNaN(e)){let r=(e/100).toFixed(2);this.renderer.setStyle(this.inappHTMLEl,"opacity",r)}}processShadow(){let e=this.inappElement.shd;e?this.renderer.setStyle(this.inappHTMLEl,"box-shadow",e.getStyle(this.scalingFactor)):this.renderer.setStyle(this.inappHTMLEl,"box-shadow","unset")}processTransformBlock(){let e=new sn(this.inappElement.trf);e&&e.rotate&&this.renderer.setStyle(this.inappHTMLEl,"transform",`rotate(${e.rotate}deg)`)}registerAction(){let e=this.inappElement.clc;!e||Object.keys(e).length===0||(this.inappHTMLEl.addEventListener("click",r=>{r.stopPropagation(),new Ha(e,this.triggerContext).execute()}),this.renderer.setStyle(this.inappHTMLEl,"cursor","pointer"))}getBackgroundStyles(){return this.stylesConverter.getBackgroundStyles(this.inappElement.bg)}};var Cr=class extends qt{constructor(e,r,n){super(e,r,n)}processCommonBlocks(){super.processCommonBlocks(),this.processFontBlock(),this.processAlignment()}processFontBlock(){let e={},r=this.inappElement.typography;return r&&(e.fontSize=this.stylesConverter.getSizePx(r.fs),e.fontFamily=A.COOEE+r.fam?.name,e.lineHeight=`${r.lh}`,e.letterSpacing=r.letterSpacing),this.stylesConverter.getColourStyles(this.inappElement.color,"color",e),this.renderer.setStyles(this.inappHTMLEl,e),e}processPart(e,r){let n=[];r.u&&n.push("underline"),r.st&&n.push("line-through"),n.length||n.push("normal"),this.renderer.setStyle(e,"font-weight",r.b?"bold":"normal"),this.renderer.setStyle(e,"font-style",r.i?"italic":"normal"),this.renderer.setStyle(e,"text-decoration",n.join(" ")),this.renderer.setStyle(e,"color",r.c??"inherit"),this.renderer.setStyle(e,"font-family","inherit")}processAlignment(){let e=this.inappElement.typography.ta,r=e?Qn[e]?.toLowerCase():this.inappElement.typography.alignment;r||(r="start"),this.renderer.setStyle(this.inappHTMLEl,"text-align",r)}};var Ao=class extends Cr{constructor(e,r,n){super(e,r,n),this.inappHTMLEl=this.renderer.createElement("div"),this.insertElement()}render(){this.inappElement.parts?.forEach(e=>{let r=this.renderer.createElement("span");r.innerHTML=e.txt?.toString()?.replace(/\n/g,"<br />"),this.processPart(r,e),this.renderer.appendChild(this.inappHTMLEl,r)}),this.processCommonBlocks()}};var Po=class extends qt{constructor(e,r,n){super(e,r,n),this.inappHTMLEl=this.renderer.createElement("div"),this.insertElement()}render(){this.processCommonBlocks()}};var On=class extends qt{constructor(e,r,n){super(e,r,n),this.inappHTMLEl=this.renderer.createElement("img"),this.insertElement()}render(){this.renderer.setAttribute(this.inappHTMLEl,"src",this.inappElement.src),this.renderer.setStyle(this.inappHTMLEl,"max-width","none"),this.renderer.setStyle(this.inappHTMLEl,"max-height","none"),this.renderer.setStyle(this.inappHTMLEl,"margin","0 auto"),this.processCommonBlocks()}};var Lo=class t extends qt{constructor(r,n,i){super(r,n,i);this.parent=r;this.inappHTMLEl=this.renderer.createElement("div")}static MAX_Z_INDEX="2147483647";render(){return this.parent||this.renderer.removeInApp(this.triggerContext),this.insertElement(),this.processCommonBlocks(),this.inappHTMLEl.classList.add(A.IN_APP_WRAPPER_NAME),this.inappHTMLEl.classList.add(this.triggerContext.rootClassName),this.renderer.setStyle(this.inappHTMLEl,"z-index",t.MAX_Z_INDEX),this.inappHTMLEl}getBackgroundStyles(){return this.inappElement.cover?super.getBackgroundStyles():{}}processWidthAndHeight(){let r=this.inappElement.cont;if(this.inappElement.cover)this.renderer.isParentNotBody()?(this.renderer.setStyle(this.inappHTMLEl,"width","100%"),this.renderer.setStyle(this.inappHTMLEl,"height","100%")):(this.renderer.setStyle(this.inappHTMLEl,"width","100vw"),this.renderer.setStyle(this.inappHTMLEl,"height","100vh")),this.renderer.setStyle(this.inappHTMLEl,"top","0"),this.renderer.setStyle(this.inappHTMLEl,"left","0");else{let n=this.inappElement.spc,i=this.stylesConverter.getScaledSize(r.w)+n.getHorizontal(),o=this.stylesConverter.getScaledSize(r.h)+n.getVertical();this.renderer.setStyle(this.inappHTMLEl,"width",i+"px"),this.renderer.setStyle(this.inappHTMLEl,"height",o+"px")}}getSpaceStyles(){return{padding:this.inappElement.spc.getPaddingCSS()}}getDisplayStyles(){return b(b({display:"flex"},this.inappElement.getStylesForWrapper()),this.inappElement.getFlexStylesForContainer())}processPositionBlock(){if(this.renderer.isParentNotBody()){if(this.triggerContext.triggerData.ian?.isEmbedded()){this.renderer.setStyle(this.inappHTMLEl,"position","block");return}this.renderer.setStyle(this.inappHTMLEl,"position","absolute")}else this.renderer.setStyle(this.inappHTMLEl,"position","fixed")}getBorderStyles(){return{}}processTransparency(){}processTransformBlock(){}processShadow(){}};var ja=class extends qt{constructor(e,r,n){super(e,r,n),this.inappHTMLEl=this.renderer.createElement("div"),this.insertElement()}render(){return this.processCommonBlocks(),this.renderer.setStyle(this.inappHTMLEl,"position","relative"),this.renderer.setStyle(this.inappHTMLEl,"overflow","hidden"),this.inappHTMLEl.classList.add(A.IN_APP_CONTAINER_NAME),this}};var Oi=class extends Cr{borderColor="";constructor(e,r,n){super(e,r,n),this.inappHTMLEl=this.renderer.createElement("input"),this.insertElement()}render(){let e=this.setInputType();this.renderer.setAttribute(this.inappHTMLEl,"placeholder",this.inappElement.placeholderText),this.renderer.setStyle(this.inappHTMLEl,"background","#ffffff00"),this.renderer.setStyle(this.inappHTMLEl,"outline","none"),this.inappHTMLEl.addEventListener("click",r=>{r.stopPropagation()}),this.processCommonBlocks(),this.addListener(this.inappHTMLEl,e),this.triggerContext.addInputField(e,this.inappElement.t)}};var Wa=class t extends Oi{static EMAIL_REGEX=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;constructor(e,r,n){super(e,r,n)}setInputType(){let e=`coo-${this.inappElement.t}`;return this.renderer.setAttribute(this.inappHTMLEl,"type","email"),this.renderer.setAttribute(this.inappHTMLEl,"id",e),e}addListener(e,r){e.addEventListener("keydown",n=>{this.borderColor||(this.borderColor=this.inappHTMLEl.style.borderColor),e.value.match(t.EMAIL_REGEX)?(this.renderer.setStyle(this.inappHTMLEl,"border-color",this.borderColor),this.triggerContext.updateValidation(r,!0)):(this.renderer.setStyle(this.inappHTMLEl,"border-color","red"),this.triggerContext.updateValidation(r,!1)),n.stopPropagation()})}};var Ga=class t extends Oi{static MOBILE_REGEX=/^\d+$/;constructor(e,r,n){super(e,r,n)}setInputType(){let e=`coo-${this.inappElement.t}`;return this.renderer.setAttribute(this.inappHTMLEl,"type","tel"),this.renderer.setAttribute(this.inappHTMLEl,"id",e),e}addListener(e,r){e.addEventListener("keydown",n=>{this.borderColor||(this.borderColor=this.inappHTMLEl.style.borderColor),e.value.match(t.MOBILE_REGEX)?(this.renderer.setStyle(this.inappHTMLEl,"border-color",this.borderColor),this.triggerContext.updateValidation(r,!0)):(this.renderer.setStyle(this.inappHTMLEl,"border-color","red"),this.triggerContext.updateValidation(r,!1)),n.stopPropagation()})}};var Va=class t extends Cr{static DAYS="Days";static HOURS="Hours";static MINUTES="Minutes";static SECONDS="Seconds";elements;spans=[];constructor(e,r,n){super(e,r,n),this.inappHTMLEl=this.renderer.createElement("div"),this.insertElement()}render(){this.addTimerChildren(),this.processAndStartTimer(),this.processCommonBlocks();let e=Z(b(b(b({flex:"1 1 0"},this.stylesConverter.getBackgroundStyles(this.inappElement.bg)),this.stylesConverter.getBorderStyles(this.inappElement.br)),this.stylesConverter.getSpaceStyles(this.inappElement.spc)),{marginLeft:this.stylesConverter.getSizePx(this.inappElement.gap),marginRight:this.stylesConverter.getSizePx(this.inappElement.gap)});this.addStylesToTimer(e)}getBackgroundStyles(){return{}}processFontBlock(){let e=super.processFontBlock();return this.stylesConverter.getColourStyles(this.inappElement.color,"color",e),this.addStylesToTimer(e),e}getSpaceStyles(){return{}}getBorderStyles(){return{}}getDisplayStyles(){return{display:"flex",flexWrap:"nowrap",justifyContent:"center"}}addStylesToTimer(e){this.elements.forEach(r=>this.renderer.setStyles(r,e))}addTimerChildren(){let e=this.inappElement.show;this.elements=[],e.day&&this.elements.push(this.getChild(t.DAYS)),e.hour&&this.elements.push(this.getChild(t.HOURS)),e.minute&&this.elements.push(this.getChild(t.MINUTES)),e.second&&this.elements.push(this.getChild(t.SECONDS)),this.elements.forEach(r=>this.inappHTMLEl.appendChild(r))}getChild(e){let r=this.renderer.createElement("div"),n=this.renderer.createElement("span"),i=this.renderer.createElement("span");return i.innerText=e,n.innerText="00",n.id=`lc-${e}`,this.renderer.setStyle(i,"font-size","0.5em"),this.renderer.setStyle(i,"text-align","center"),this.renderer.setStyle(i,"font-family","inherit"),this.renderer.setStyle(n,"text-align","center"),this.renderer.setStyle(n,"font-family","inherit"),this.inappElement.lblPos==="start"?(r.appendChild(i),r.appendChild(n)):(r.appendChild(n),r.appendChild(i)),this.renderer.setStyle(r,"display","flex"),this.renderer.setStyle(r,"flex-direction",this.inappElement.horizontal?"":"column"),this.renderer.setStyle(r,"justify-content","center"),this.renderer.setStyle(r,"align-items","center"),this.renderer.setStyle(r,"gap","5px"),this.spans.push(n),r}processAndStartTimer(){let e=this.inappElement.timer.start(this.inappElement.timerType,r=>{this.spans.forEach(n=>{n.id===`lc-${t.DAYS}`?n.innerText=String(r.days).padStart(2,"0"):n.id===`lc-${t.HOURS}`?n.innerText=String(r.hours).padStart(2,"0"):n.id===`lc-${t.MINUTES}`?n.innerText=String(r.minutes).padStart(2,"0"):n.id===`lc-${t.SECONDS}`&&(n.innerText=String(r.seconds).padStart(2,"0"))})});this.triggerContext.intervals.push(e)}};var za=class extends Cr{constructor(e,r,n){super(e,r,n),this.inappHTMLEl=this.renderer.createElement("select"),this.insertElement()}render(){this.renderer.setStyle(this.inappHTMLEl,"background","#ffffff00"),this.renderer.setStyle(this.inappHTMLEl,"outline","none"),this.processCommonBlocks(),this.addListener(this.inappHTMLEl),this.addOptions()}addListener(e){this.triggerContext.selectedEmbeddedItems?.length||this.updateItems(this.triggerContext.triggerData.items[0].vars[0]),e.addEventListener("click",r=>{r.stopPropagation()}),e.addEventListener("change",()=>{let r=new mr(JSON.parse(e.value));this.updateItems(r)})}updateItems(e){let r=this.triggerContext.triggerData.items[0];this.triggerContext.selectedEmbeddedItems=[r.toEmbed(e)];let n=this.parentHTMLEl.querySelector("#coo-13");if(!n)return;let i=e.imgs[0]??r.imgs?.at(0);i?.url&&n.setAttribute("src",i.url)}addOptions(){let e=this.triggerContext.triggerData.items,r=this.inappHTMLEl;if(!e?.length){r.add(this.createOption(this.inappElement.placeholderText));return}let n=this.triggerContext.selectedEmbeddedItems?.at(0);e[0].vars.forEach(i=>{r.add(this.createOption(i.name??"Default",i,i.mID===n?.vID))})}createOption(e,r,n){let i=this.renderer.createElement("option");return i.text=e,i.value=JSON.stringify(r),n&&(i.selected=!0),r||(i.disabled=!0),i}};var Ya=class extends On{constructor(e,r,n){super(e,r,n)}render(){super.render(),this.inappHTMLEl.setAttribute("id",`coo-${this.inappElement.type}`)}};var qa=Xt(tn());var Dr=class t{static INSTANCE=new t;topics={};constructor(){}static get(){return this.INSTANCE}broadcast(e,r){this.topics[e]||(this.topics[e]=new ht),this.topics[e].next(r)}subscriber(e){return this.topics[e]||(this.topics[e]=new ht),this.topics[e].asObservable()}};var et=class t{static DEFAULT_SELECTOR="cart-drawer";static _instance;inShadow=!1;cartDrawerElement;cartDrawerShadowElement;configWebsite=qe.get().website??{};currentState=!1;drawerSubject=new fo({open:!1,firstOpen:!1});mutationObserver;firstOpen=!0;selector;shadowParentElementSelector;iconSelector=['button[drawer-to-open="cart-drawer"]','a[href="/cart"]',".header__icon--cart","#cart-icon-bubble",".cart-icon-bubble",".cart-count"].join(",");cartSelector=[t.DEFAULT_SELECTOR,"#halo-cart-sidebar",'[role="dialog"][class*="cart" i]','[id*="section-cart" i]',"#sidebar-cart","#rebuy-cart","#mini-cart","#flo-cart-wrapper","#drawer-cart","#UpcartPopupBackDrop",'[id$="CartDrawer" i]'].join(",");constructor(){this.initialize()}get element(){return this.cartDrawerElement}static get(){return t._instance||(t._instance=new t),t._instance}static forceUpdate(){t._instance=new t}isOpen(){let e=this.inShadow?this.isPresent():this.isVisible();return qa.default.log(`Cart drawer is currently ${e?"open":"close"}`),e}open(){if(console.log(`
|
|
39
|
+
|
|
40
|
+
cooee_debug CartDrawer:open:97`,this.cartDrawerElement,`
|
|
41
|
+
|
|
42
|
+
`),this.isOpen()){w.log("Drawer is already open");return}document.dispatchEvent(new CustomEvent(A.CTA_OPEN_CART_EVENT));let e=document.querySelector(this.iconSelector);if(!e){w.debug("No clickable cart icon found with selector",this.iconSelector);return}e.click()}onToggle(){return this.drawerSubject}isShopifyDefaultDrawer(){return this.element?.tagName.toLowerCase()===t.DEFAULT_SELECTOR}isMiniCart(){return this.isShopifyDefaultDrawer()&&this.element?.id==="mini-cart"}refreshUI(e,r=!0){this.isMiniCart()&&this.element?._rerenderCart?this.element._rerenderCart({detail:{cart:e}}):this.isShopifyDefaultDrawer()?this.element?.renderContents&&e&&(this.element.classList.remove("is-empty"),this.element.renderContents?.(e)):this.element?.onCartDrawerUpdate?this.element.onCartDrawerUpdate():window.icartCartActivityEvent?window.icartCartActivityEvent():window.theme?.CartDrawer?new window.theme.CartDrawer().init():window.Hs_CartDrawer?.updateSlideCart?window.Hs_CartDrawer.updateSlideCart():window.theme?.fetch_side_cart?window.theme.fetch_side_cart():window.theme?.Cart?.updateCart?window.theme.Cart.updateCart():window.cartUpdate?window.cartUpdate():this.element?._onCartRefresh?this.element._onCartRefresh():this.element?.tagName?.toLowerCase()==="cart-drawer-component"?document.dispatchEvent(new CustomEvent("action:cart:updateCartandShowCart")):this.element?.id==="sidebar-cart"?document.body.dispatchEvent(new CustomEvent("cart:refresh",{bubbles:!0,detail:{}})):w.info("No method found to update the cart without refreshing"),r&&Dr.get().broadcast(A.CART_UPDATE_BROADCAST)}async initialize(){let e=this.configWebsite.cartDrawerSelector;if(!e){await this.findCartDrawer();return}let r=e.split(":shadow");r.length===1?(this.selector=r[0],await this.findCartDrawer()):(this.inShadow=!0,this.shadowParentElementSelector=r[0]?.trim(),this.selector=r[1]?.trim(),await this.findCartDrawerWithShadow())}async findCartDrawer(){if(!Oe.isShopify())return;let e=this.selector||this.cartSelector;if(this.cartDrawerElement=await ce.retrySelector(e),!this.cartDrawerElement){qa.default.warn("Max attempts exhausted to find cart drawer");return}qa.default.log("Found",this.cartDrawerElement,`from selector: ${e}`),this.createMutationObserver()}async findCartDrawerWithShadow(){if(!Oe.isShopify()||!this.shadowParentElementSelector)return;let r=(await ce.retrySelector(this.shadowParentElementSelector))?.shadowRoot;r?.mode==="open"&&(this.cartDrawerShadowElement=r,this.createMutationObserver())}isVisible(){if(!this.cartDrawerElement)return!1;let e=this.cartDrawerElement.getBoundingClientRect(),r=(window.innerHeight||document.documentElement.clientHeight)+.5,n=(window.innerWidth||document.documentElement.clientWidth)+.5,i=e.top<=r&&e.bottom>=0,o=e.left<=n&&e.right>=0,s=i&&o,a=this.cartDrawerElement.tagName.toLowerCase()===t.DEFAULT_SELECTOR&&this.cartDrawerElement.open,l=getComputedStyle(this.cartDrawerElement),m=l.display!=="none"&&l.visibility!=="hidden"&&parseFloat(l.opacity)>0,p=!this.cartDrawerElement.hidden,f=this.cartDrawerElement.offsetWidth>0||this.cartDrawerElement.offsetHeight>0||this.cartDrawerElement.getClientRects().length>0,d=l.transform.match(/matrix\(([^)]+)\)/),g=0,E=0;if(d){let ie=d[1].split(", ").map(parseFloat);g=ie[4],E=ie[5]}let N=g+e.left>n||g+e.right<0||E+e.top>r||E+e.bottom<0,P=Math.max(0,Math.min(e.right,n)-Math.max(e.left,0)),R=Math.max(0,Math.min(e.bottom,r)-Math.max(e.top,0)),x=P*R,W=e.width*e.height,$=W>0&&x/W>=.1;return(s||a||!N)&&m&&p&&f&&$}createMutationObserver(){if(!this.cartDrawerElement&&!this.cartDrawerShadowElement)return;let e=this.cartDrawerElement||this.cartDrawerShadowElement,r=new ht;this.mutationObserver=new MutationObserver(()=>{r.next()}),this.mutationObserver.observe(e,{attributes:!0,subtree:!0,childList:this.inShadow}),r.pipe(tr(500)).subscribe(()=>{let n=this.isOpen();this.currentState!==n&&(this.currentState=n,this.drawerSubject.next({open:n,firstOpen:this.firstOpen}),this.firstOpen&&(this.firstOpen=!1))})}isPresent(){return!this.selector||!this.cartDrawerShadowElement?!1:!!this.cartDrawerShadowElement.querySelector(this.selector)}};var Ai=class t{static ACTIVE_TRIGGER_DATA;renderer=Nt.get();safeHTTP;parent;rootContainer;containerHTMLElement;ian;triggerContext;resizeListener;cartDrawerToggleSubscription;constructor(e){this.safeHTTP=ue.getInstance(),this.resizeListener=()=>this.screenResized(),this.setParentContainer(e)}setParentContainer(e){this.parent=e??document.body,this.renderer.setParentContainer(this.parent)}render(e){this.renderEngagement(new Pt(e))}async renderEngagement(e){if(!e.previewType&&t.ACTIVE_TRIGGER_DATA){let r={triggerShown:new mi(t.ACTIVE_TRIGGER_DATA??{})};this.skipTrigger(e,r);return}if(t.ACTIVE_TRIGGER_DATA=e,this.triggerContext=new Ri(new Date,e),this.triggerContext.onClose(r=>{this.closeInApp(r)}),this.ian=e.ian,(this.renderer.isMobile()||e.previewType==="mobile")&&this.ian.overrideForMobileView(),this.ian.isEmbedded()){let r=document.querySelector(this.ian.getEmbeddedSelector());this.setParentContainer(r)}await this.preloadImages(e),e.shouldDelay()?window.setTimeout(()=>{this.withCartDrawerClosed()},e.getDelaySeconds()):this.withCartDrawerClosed()}withCartDrawerClosed(){if(!et.get().isOpen()||!this.renderer.isMobile()){this.startRenderingOnce();return}this.cartDrawerToggleSubscription=et.get().onToggle().subscribe(({open:r})=>{!r&&this.startRenderingOnce()})}startRenderingOnce(){if(fe.get().isGoKwikPopupOpen){this.skipTrigger(this.triggerContext.triggerData,{reason:"GoKwik popup is open"});return}try{this.startRendering()}catch(e){Ue.getInstance().captureException(e,{triggerData:JSON.stringify(this.triggerContext.triggerData)});return}this.sendTriggerDisplayed(),this.renderer.isMobile()||window.addEventListener("resize",this.resizeListener),this.cartDrawerToggleSubscription?.unsubscribe()}startRendering(){this.renderer.calculateScalingFactor(this.ian),this.rootContainer=new Lo(this.parent,this.ian,this.triggerContext).render();try{this.renderContainer(this.triggerContext)}catch(e){throw w.error(e),e}}sendTriggerDisplayed(){let e={};this.triggerContext.triggerData.items?.length&&(e.promotedMIDs=this.triggerContext.triggerData.items?.map(i=>i.mID));let r=new ve(A.EVENT_TRIGGER_DISPLAYED,e,this.triggerContext.triggerData);this.safeHTTP.sendEvent(r);let n={action:A.CAMPAIGN_DISPLAYED_ACTIVITY};document.dispatchEvent(new CustomEvent(A.POPUP_ACTIVITY_EVENT,{detail:n}))}sendTriggerClosed(e){let r=e.eventName;delete e.eventName;let n=new ve(r,e,this.triggerContext.triggerData);n.name===A.EVENT_TRIGGER_CLICKED&&(n.items=this.triggerContext.selectedEmbeddedItems??this.triggerContext.triggerData.items?.map(i=>i.toEmbed())),this.safeHTTP.sendEvent(n)}addEnterAnimation(e){this.containerHTMLElement.animate(e.getEnterAnimation(),{duration:500})}renderElement(e,r,n){r instanceof ri?new Wa(e,r,n).render():r instanceof ni?new Ga(e,r,n).render():r instanceof Yr?new Ao(e,r,n).render():r instanceof ii?new Ya(e,r,n).render():r instanceof Or?new On(e,r,n).render():r instanceof an?new Po(e,r,n).render():r instanceof ei?new Va(e,r,n).render():r instanceof ti?new za(e,r,n).render():w.error("Unsupported element type- "+r.type)}renderContainer(e){let r=this.ian?.cont;r&&(this.containerHTMLElement=new ja(this.rootContainer,r,e).render().getHTMLElement(),new ka().loadAllFonts(this.ian),this.ian.elems?.forEach(async n=>{await this.renderElement(this.containerHTMLElement,n,e)}),this.addEnterAnimation(this.ian.anim))}closeInApp(e){let r=this.ian.anim.getExitAnimation();this.sendTriggerClosed(e),t.ACTIVE_TRIGGER_DATA=void 0;let n=this.containerHTMLElement.animate(r,{duration:500,easing:"ease-in-out"});n.onfinish=()=>{this.removeInApp(),window.removeEventListener("resize",this.resizeListener)}}screenResized(){this.removeInApp(),this.startRendering()}removeInApp(){Nt.get().removeInApp(this.triggerContext)}skipTrigger(e,r){let n=new ve(A.EVENT_CAMPAIGN_REJECTED,r,e);this.safeHTTP.sendEvent(n)}async preloadImages(e){let r=e.ian;if(!r)return;let n=[];r.elems.forEach(i=>{let o=i.bg?.img?.src;if(o&&n.push(this.getPromise(o)),i.t===1){let s=i.src;if(!s)return;n.push(this.getPromise(s))}}),r.bg?.img?.src&&n.push(this.getPromise(r.bg.img.src)),r.cont.bg?.img?.src&&n.push(this.getPromise(r.cont.bg.img.src)),await Promise.all(n)}getPromise(e){return new Promise(r=>{let n=new Image;n.onload=r,n.src=e,n.style.display="none"})}};var Ka=class{triggerData;safeHttpService=ue.getInstance();render(e){e.contentSource===qi.KLAVIYO&&(this.triggerData=e,window.addEventListener("klaviyoForms",this.handleKlaviyoEvents.bind(this)),window._klOnsite=window._klOnsite||[],window._klOnsite.push(["openForm",e.klaviyoFormID]))}handleKlaviyoEvents(e){if(e.type!=="klaviyoForms")return;let r=e.detail;if(r.formId!==this.triggerData.klaviyoFormID){w.warn("Received invalid trigger callback");return}switch(r.type){case"open":this.safeHttpService.sendEvent(new ve(A.EVENT_TRIGGER_DISPLAYED,{form:{id:r.formId}},this.triggerData));break;case"stepSubmit":{let n=this.getFormDetails(r);this.safeHttpService.sendEvent(new ve(A.EVENT_FORM_SUBMITTED,{form:n},this.triggerData)),this.safeHttpService.updateProfile(n);break}case"close":window.removeEventListener("klaviyoForms",this.handleKlaviyoEvents.bind(this)),this.safeHttpService.sendEvent(new ve(A.EVENT_TRIGGER_CLOSED,{form:{id:r.formId}},this.triggerData));break}}getFormDetails(e){let r={id:e.formId},n=e.metaData;if(kt.hasKeys(n)){let i=["email","phone_number","first_name","last_name","$email","$phone_number","$first_name","$last_name"];Object.keys(n).forEach(a=>{i.includes(a)||(r[a]=n[a])}),r.email=n.$email??n.email,r.mobile=n.$phone_number??n.phone_number;let o=n.$first_name??n.first_name,s=n.$last_name??n.last_name;(o?.length||s?.length)&&(r.name=o+" "+s)}return r}};var Ja=class{static trackIntent(e){if(!this.isInstalled()){w.log("Facebook pixel not installed");return}if(!qe.get().pixelPush){w.log("Facebook pixel push not enabled");return}let n=cn[e.intent]?.toLowerCase(),i=e.segmentName;!n&&!i||(w.debug(`Sending ${n} intent and ${i} segment to Facebook Pixel`),window.fbq("trackCustom","CooeeIntent",{intent_value:n,segment_value:e.segmentName}))}static isInstalled(){return window.fbq&&typeof window.fbq=="function"}};var md=Xt(fd());var An=class{static _flags={};static getFlags(){return this._flags}static setFlags(e){this._flags=e??{}}static isECommerceApp(){return Oe.isShopify()}};var q_=(0,md.default)(fetch),K_={retryDelay:A.API_CALL_RETRY_DELAY,retryOn:(t,e,r)=>t>=A.API_CALL_MAX_ATTEMPTS?!1:!!(e!==null||r?.status&&r?.status>=500)},Tt=class t{static INSTANCE;apiToken="";firstSeen="";constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}async validateSession(e){return this.post("/v1/event/validate-session",e)}updateUserData(e){this.put("/v1/user/update",e).then(async r=>{w.log("Updated user profile"),await Pn.getInstance().storeAndPopulateAuthData(r)}).catch(r=>{w.error("Error saving user profile",r)})}trackOrder(e){this.post("/v1/event/track-order",e).then(()=>{w.log("Sent Order")}).catch(r=>{w.error("Error sending track order",r)})}generateDiscount(e){return this.post("/v1/event/generate-discount",e)}updateDeviceProps(e){this.put("/v1/device/update",e).then(()=>{w.log("Updated device property")}).catch(async r=>{w.error("Error saving device property",r)})}setAPIToken(e){this.apiToken=e??""}setFirstSeen(e){this.firstSeen=e?.toUTCString()??""}get(e){return this.requestBackend("GET",e)}post(e,r){return this.requestBackend("POST",e,r)}put(e,r){return this.requestBackend("PUT",e,r)}async requestBackend(e,r,n){if(!An.isECommerceApp()&&!An.getFlags().allowEvents)return w.log(`Rejecting ${e} ${r} as this is not e-commerce app`),Promise.reject();r.startsWith("http")||(r=Gr.apiURL+r);let i=this.getDefaultHeaders(),o="keepalive"in new Request("");if(n&&!o&&JSON.stringify(n).includes("CE App Background"))try{return this.performXMLHttpRequest(r,i,n)}catch(a){return Ue.getInstance().captureException(a,{body:JSON.stringify(n)}),{}}let s={method:e,headers:i,keepalive:!0};return n&&(s.body=JSON.stringify(n)),this.request(r,s)}async request(e,r){let n=b(b({},K_),r),i=await q_(e,n);if(!i.ok)throw i;return i.json()}performXMLHttpRequest(e,r,n){return new Promise((i,o)=>{let s=new XMLHttpRequest;s.open("POST",e,!0),r.forEach((a,l)=>{s.setRequestHeader(l,a)}),s.onreadystatechange=()=>{if(s.readyState===XMLHttpRequest.DONE)if(s.status>=200&&s.status<300)try{s.getResponseHeader("Content-Type")?.includes("application/json")?i(JSON.parse(s.responseText)):o(new Error("Content-Type of response header is not json"))}catch(a){o(a)}else o(new Error(`Received status - ${s.status}(${s.statusText})`))},s.onerror=()=>{o(new Error("Network error occurred during the request."))},s.send(JSON.stringify(n))})}getDefaultHeaders(){let e=new Headers;return e.set("content-type","application/json"),e.set("cooee-sdk",A.SDK),e.set("cooee-sdk-code",A.SDK_VERSION_CODE.toString()),e.set("cooee-sdk-version",A.SDK_VERSION),e.set("cooee-first-seen",this.firstSeen),this.apiToken&&e.append("cooee-sdk-token",this.apiToken),Gr.debug&&e.set("cooee-sdk-debug",String(1)),e}};var Pi=class{static sentryService=Ue.getInstance();static httpApiService=Tt.getInstance();static async refreshItems(e){if(e.isCartEmbed()&&!e.isSubscriptionUpsell()){let a=(await ge.getCurrent().getNormalisedCart()).items.map(l=>l.mID);e.items=e.items.filter(l=>!a.includes(l.mID))}if(e.isCartRecovery()){let s=ge.getCurrent().items,a=[];for(let l of e.items)for(let m of l.vars){let p=s.find(g=>g.variant_id.toString()===m.mID);if(!p)continue;let f=new wt(l);f.name=p.title;let d=new mr(m);d.name=p.variant_title,d.price.d=p.discounted_price/100,f.variants=[d],a.push(f)}return a}if(qe.get().currencyCount<=1)return e.items;let r=e.items.length,n=e.items.map(s=>this.updatedItem(s,e.engagementID)),o=(await Promise.all(n)).filter(s=>s!=null);if(r&&!o.length){let s="Failed to fetch any product from Ajax API",a=new ve(A.EVENT_CAMPAIGN_FAILED,{reason:s,currency:e.currency},e);throw ue.getInstance().sendEvent(a),new Error(s)}return o}static async updatedItem(e,r){let n=e,i,o=Oe.getRootPrefix()+`products/${n.slug}.js`;try{i=await this.httpApiService.request(o)}catch(s){return w.error(`Failed to fetch ${o}`,s),s instanceof Response?this.sentryService.captureMessage(`Shopify product fetch failed ${s.status}`,"error",{item:n,path:o},{"engagement.id":r}):this.sentryService.captureException(s,{item:n,path:o},{"engagement.id":r}),null}return i?(n.name=i.title,n.vars.map(s=>{let a=i.variants.find(l=>l.id===+s.mID);s.name=a.title,s.price.d=a.price?a.price/100:a.price,s.price.cmp=a.compare_at_price?a.compare_at_price/100:a.compare_at_price}),n):(w.error("Item not found after AJAX call for:",n),null)}};var Xa=class t{static INSTANCE;httpService=se.get(Tt);sentryService=se.get(Ue);sessionManager=se.get(Ye);runtime=fe.get();constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}sendSilently(e){this.send(e).catch(r=>w.error(`Failed to send ${e.name}`,r))}async send(e){if(w.debug(`Sending event ${e.name}`),Kt.prepend(`Sending event <strong>${e.name}</strong> with id ${e.id}`),this.shouldReject(e)){w.warn(`Rejecting event ${e.name}`);return}await Promise.all([this.addSessionContext(e),this.addShopifyContext(e)]),this.addShopifyAttributes(),e.name!==A.EVENT_APP_BACKGROUND&&this.runtime.setActive(),e.currentItem=this.runtime.getCurrentItem(),this.httpService.post("/v1/event/track",e).then(async r=>{w.log("\u2705 Event tracked:",e.name),Kt.prepend(`\u2705 Event <strong>${r.eventName}</strong> tracked`),this.processEventResponse(e,r)}).catch(r=>{w.error(`Error sending event ${e.name} to server`,r)})}shouldReject(e){return e.trigger?.triggerID==="test"||e.trigger?.triggerID==="preview"?(w.warn("Not sending event as this is a test trigger"),!0):!1}async addSessionContext(e){let r=await this.sessionManager.checkSessionAndGetContext();e.sessionID=r[0],e.sessionNumber=r[1],e.landingPage=r[2],e.page=vr.parseFromCurrent()}async addShopifyContext(e){if(Oe.isShopify())try{e.cart=await ge.getCurrent().getNormalisedCart()}catch(r){w.error("Error fetching Shopify cart before sending the event",r)}}processEventResponse(e,r){this.renderWidgetIfAny(e,r).catch(n=>{w.error("Failed to display a campaign",n,e,r),this.sentryService.captureException(n,{event:e,response:r})}),this.utiliseIntentIfCalculated(r)}async renderWidgetIfAny(e,r){if(!r.triggerData){w.log(`Nothing to engage after ${e.name}`);return}w.log(`\u{1F4E3} Engagement(id=${r.triggerData.shortID}) will be shown`,r.triggerData);let n=new Pt(r.triggerData);n.occurred=e.occurred;let i;try{i=await Pi.refreshItems(n)}catch(o){w.error("Failed to refresh the products",o);return}if(n.items=i,n.contentSource===qi.KLAVIYO){new Ka().render(n);return}new Ai().renderEngagement(n).catch(o=>{w.error("Failed to render popup",o),this.sentryService.captureException(o,{event:e,triggerData:n})})}utiliseIntentIfCalculated(e){e.intent&&(Di.trackIntent(e.intent),Ja.trackIntent(e),Kt.prepend(`Intent is <strong>${cn[e.intent]}</strong>`))}addShopifyAttributes(){Oe.isShopify()&&ge.getCurrent().addCooeeAttributes().catch(e=>{w.error("Fail to add attributes in cart",e)})}};var ue=class t{static INSTANCE;httpApiService=Tt.getInstance();eventAPIService=Xa.getInstance();constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}sendEvent(e){w.debug(`Waiting for auth to send event ${e.name}`),Ye.replaySubject.subscribe(async()=>{this.eventAPIService.sendSilently(e)})}updateProfile(e){Ye.replaySubject.subscribe(()=>{this.httpApiService.updateUserData(e??{})})}trackOrder(e){Ye.replaySubject.subscribe(()=>{this.httpApiService.trackOrder(e)})}updateDeviceProps(e){Ye.replaySubject.subscribe(()=>{this.httpApiService.updateDeviceProps({props:e})})}generateDiscount(e){return this.httpApiService.generateDiscount(e)}};var Kt=class{static isOn=!1;static element;static watch(){let e=w.getDebugParam();(e==="1"||e==="on")&&ue.getInstance().updateDeviceProps({debugTill:this.getDebugMillis()}),e==="on"?sessionStorage.cooeeDebug="1":e==="off"&&sessionStorage.removeItem("cooeeDebug"),sessionStorage.cooeeDebug&&(this.isOn=!0,this.renderDebugBar())}static prepend(e){if(!this.isOn)return;let r=document.createElement("div");r.innerHTML="• "+new Date().toLocaleString()+" - "+e,this.element.prepend(r)}static renderDebugBar(){this.element=document.createElement("div"),this.element.id="cooee-debugger",this.element.setAttribute("draggable","true"),document.body.appendChild(this.element)}static dragElement(){let e=0,r=0,n=0,i=0,o=l=>{l=l||window.event,l.preventDefault(),n=l.clientX,i=l.clientY,document.onmouseup=a,document.onmousemove=s},s=l=>{l=l||window.event,l.preventDefault(),e=n-l.clientX,r=i-l.clientY,n=l.clientX,i=l.clientY,this.element.style.top=this.element.offsetTop-r+"px",this.element.style.left=this.element.offsetLeft-e+"px"},a=()=>{document.onmouseup=null,document.onmousemove=null};this.element.onmousedown=o}static getDebugMillis(){return new Date().getTime()+6*60*60*1e3}};var Bo=class extends zr{static storeName="app";static{this.storage=Kn(this.storeName)}};var Qa=class{static processConfiguration(){let e=qe.get();!e.gaMeasurementID||!e.gaEnabled||this.sendClientID()}static async sendClientID(){let e=await this.getClientID();e&&ue.getInstance().updateDeviceProps({gaClientID:e})}static async getClientID(){let e=await Ne.get(ne.GA_CLIENT_ID),r=await this.getClientIDViaGTag();if(e!==r)return await Ne.set(ne.GA_CLIENT_ID,r),r}static async getClientIDViaGTag(){let r=qe.get().gaMeasurementID;if(!(!r||!window.gtag))return new Promise(n=>{window.gtag("get",r,"client_id",i=>{n(i)})})}};var Za=class t{static INSTANCE;constructor(){this.init()}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}init(){Bo.get(ne.APP_CONFIG,{}).then(e=>this.updateGlobalConfig(e))}async processAppConfigurations(e){w.log("Received app configuration",e),e.currencyCount=e.currencies?.length;let r=this.updateGlobalConfig(e);Bo.set(ne.APP_CONFIG,r).catch(n=>w.error(n)),Qa.processConfiguration(),r.website&&(It.injectRawScript(r.website.commonJS),It.injectRawCSS(r.website.commonCSS)),et.get().onToggle().subscribe(async({open:n})=>{w.info("Cart drawer is now",n?"open":"closed"),n&&(se.get(sr).loadOrRenderWidgetsAfterCartChange(),await this.trackViewCartEvent())})}updateGlobalConfig(e){let r=Se.globalRef.config.update(e);return et.forceUpdate(),w.debug("App configurations",r),r}async trackViewCartEvent(){let e=await ge.getCurrent().getNormalisedCart(),r={value:e.amount,currency:e.currency},n={items:e.items,amount:r,drawer:!0};ue.getInstance().sendEvent(new ve(A.EVENT_VIEW_CART,n))}};var dd=Xt(vl()),ec=class t{static META_REQUIRED_FIELDS=["ad_id","campaign_id","fbclid"];static GOOGLE_REQUIRED_FIELDS=["gad_source","gclid"];source;adID;campaignID;adName;campaignName;constructor(e){this.adID=e.adID,this.campaignID=e.campaignID,this.source=e.source}static getAdParams(){let e;try{e=new dd.URLBuilder(location.href)}catch{return{}}let r={};if(this.META_REQUIRED_FIELDS.every(o=>Array.from(e.getParams().keys()).includes(o)))return r={source:"META",adID:e.getQueryParam("ad_id")?.trim(),campaignID:e.getQueryParam("campaign_id")?.trim()},new t(r);if(this.GOOGLE_REQUIRED_FIELDS.every(o=>Array.from(e.getParams().keys()).includes(o)))return r={source:"GOOGLE"},new t(r)}};var Pn=class t{static INSTANCE=new t;httpAPIService=Tt.getInstance();coreService=Za.getInstance();sentryService=Ue.getInstance();sdkToken="";userID="";deviceID="";appID="";shopifyShop="";constructor(){}static getInstance(){return this.INSTANCE}init(e){this.appID=e.appID,this.shopifyShop=e.shopifyShop}async storeAndPopulateAuthData(e){e&&(e.userID&&(this.userID=e.userID,await Ne.set(ne.ID,e.userID)),e.deviceID&&(this.deviceID=e.deviceID,await Ne.set(ne.DEVICE_ID,e.deviceID)),e.sdkToken&&(this.sdkToken=e.sdkToken,await Ne.set(ne.SDK_TOKEN,e.sdkToken)),this.updateAPIClient())}async validateSession(e){await this.populateFirstSeen(),await this.populateUserDataFromStorage(),w.log("Validating session with server");let r=await this.getSessionValidateData(e);try{let n=await this.httpAPIService.validateSession(r);w.log("Validating session Response",n),await this.coreService.processAppConfigurations(n.appSettings),await this.storeAndPopulateAuthData(n)}catch(n){throw w.error(n),n}}async populateUserDataFromStorage(){if(this.sdkToken=await Ne.get(ne.SDK_TOKEN),!this.sdkToken){w.warn("No SDK token found in local storage");return}this.userID=await Ne.get(ne.ID),this.deviceID=await Ne.get(ne.DEVICE_ID),this.updateAPIClient()}updateAPIClient(){w.debug("SDK Token:",this.sdkToken),w.log("Device ID:",this.deviceID),w.log("User ID:",this.userID),Di.trackDeviceID(this.deviceID),Kt.prepend(`Device ID: <strong>${this.deviceID}</strong>`),this.httpAPIService.setAPIToken(this.sdkToken),this.sentryService.setGlobalContext("Visitor Info",{device_id:this.deviceID,user_id:this.userID}),this.sentryService.setUser({id:this.deviceID})}async getSessionValidateData(e){let r=await new Ma().get();r.host=location.origin;try{(await pd())?.isPrivate&&(r.private=!0)}catch(i){hd.default.error("Unable to detect private/incognito window",i)}let n=await Ne.get(ne.DEVICE_ID);return n||(n=new Xe().toHexString(),await Ne.set(ne.DEVICE_ID,n)),Z(b({deviceID:n,deviceProps:r,appID:this.appID,shopifyShop:this.shopifyShop},e),{sdk:A.SDK,page:vr.parseFromCurrent(),ad:ec.getAdParams(),occurred:this.getSessionStartTime(fe.get().jsLoadTime),currentItem:fe.get().getCurrentItem(),cart:await ge.getCurrent().getNormalisedCart(),properties:{}})}async populateFirstSeen(){let e=await Ne.get(ne.FIRST_SEEN),r=e?new Date(e):new Date;e||await Ne.set(ne.FIRST_SEEN,r.toISOString()),this.httpAPIService.setFirstSeen(r),this.sentryService.setGlobalContext("Visitor Info",{first_seen:r.toISOString()})}getSessionStartTime(e){return(new Date().getTime()-e.getTime())/1e3>A.IDLE_TIME_IN_SECONDS?new Date:e}};var Ye=class t{static replaySubject=new ho(1);static INSTANCE;sentryService=se.get(Ue);lock=new Jn;constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}init(e){if(w.debug("Initialising SDK",e),Gf(navigator.userAgent)){w.info("This seems to be a bot. Disabling SDK");return}Pn.getInstance().init(e),t.INSTANCE.checkForNewSession(!0).then(async()=>{t.replaySubject.next(!0),t.replaySubject.complete()}).catch(r=>w.error("Unable to perform device init",r))}getCurrentSessionID(){return at.set(ne.SESSION_LAST_USED_TIME,new Date().getTime()),at.get(ne.ID,"")}async checkSessionAndGetContext(){return await this.checkForNewSession(),this.getContext()}async getContext(){let e=await Promise.all([this.getCurrentSessionID(),this.getCurrentSessionNumber(),this.getLandingPage()]);return this.sentryService.setGlobalContext("Visitor Session",{id:e[0],number:e[1],landing_page:e[2]}),e}async checkForNewSession(e){await this.lock.acquire();let r=!1;if(await this.isNewSessionRequired()?(await this.startNewSession(),e=!0,r=!0):await this.notSynced()&&(r=!0),e){let n=await this.getContext();await Pn.getInstance().validateSession({sessionID:n[0],sessionNumber:n[1],landingPage:n[2],newSession:r}),await at.set(ne.SESSION_SYNCED,!0)}this.lock.release()}async startNewSession(){w.debug("Starting new session"),await at.clear(),w.debug("Cleared SessionStorage before starting new session");let e=new Date,r=new Xe().toHexString();w.debug("New session ID to be used",r);let n=await Ne.get(ne.SESSION_NUMBER,0)+1;Kt.prepend(`New Session ID: <strong>${r}</strong> & number: ${n}`),await Promise.all([Ne.set(ne.SESSION_NUMBER,n),at.set(ne.ID,r),at.set(ne.SESSION_LAST_USED_TIME,e.getTime()),at.set(ne.SESSION_LANDING_PAGE,vr.parseFromCurrent())])}getLandingPage(){return at.get(ne.SESSION_LANDING_PAGE,{})}getCurrentSessionNumber(){return Ne.get(ne.SESSION_NUMBER,1)}async isNewSessionRequired(){if(!await at.get(ne.ID))return!0;let e=await at.get(ne.SESSION_LAST_USED_TIME,0);return e?(new Date().getTime()-e)/1e3>A.IDLE_TIME_IN_SECONDS:!0}async notSynced(){return!await at.get(ne.SESSION_SYNCED,!1)}};var yd=Xt(tn());var gd=Xt(tn());var J_=`
|
|
43
|
+
mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]) {
|
|
44
|
+
cartDiscountCodesUpdate(cartId: $cartId, discountCodes: $discountCodes) {
|
|
45
|
+
cart {
|
|
46
|
+
id
|
|
47
|
+
}
|
|
48
|
+
userErrors {
|
|
49
|
+
field
|
|
50
|
+
message
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
`,Qr=class{static navigate(e,r,n){let i=`${location.origin}/discount/${e}`;switch(w.log(`Applying discount code ${e}`,r,n),r){case cr.CART_PAGE:location.href=`${i}?redirect=/cart`;break;case cr.CART_DRAWER:location.href=`${i}?redirect=${location.pathname}#${A.HASH_OPEN_CART_DRAWER}=1`;break;case cr.SHOPIFY_CHECKOUT:location.href=`${i}?redirect=/checkout`;break;case cr.THIRD_PARTY_CHECKOUT:location.href=`${i}?redirect=/cart#${A.HASH_INITIATE_CHECKOUT}=1`;break;default:location.href=`${i}?redirect=${n||location.pathname}`}}static navigateWithoutDiscount(e,r){switch(e){case cr.CART_PAGE:location.href="/cart";break;case cr.SHOPIFY_CHECKOUT:location.href="/checkout";break;case cr.THIRD_PARTY_CHECKOUT:location.href=`/cart#${A.HASH_INITIATE_CHECKOUT}=1`;break;case cr.CART_DRAWER:default:{let n=et.get();!n.isOpen()&&n.open(),n.refreshUI(r)}}}static async applyWithStorefront(e){let r=qe.get().storefrontToken;if(!r)throw new Error("Storefront token not set for the store");let n=new Headers;n.append("Content-Type","application/json"),n.append("X-Shopify-Storefront-Access-Token",r);let i=JSON.stringify({query:J_,variables:{cartId:`gid://shopify/Cart/${ge.getCurrent().token}`,discountCodes:[e]}}),o={method:"POST",headers:n,body:i};await Tt.getInstance().request(A.GRAPHQL_API_PATH,o)}};var Mr=class{listen(){document.addEventListener(A.CTA_EVENT,async e=>{await this.processEvent(e)},!1)}async performAddToCart(e,r){if(!e.length)return;let n=e.map(l=>{let{vID:m,quantity:p}=this.getVIDAndQuantity(l);return{id:m?+m:+l.mID,quantity:p,properties:r.getPrivateAttributesForLineItem()}}),i=Oe.getCartURL("cart/add.js"),o={items:n},s=et.get();s.isMiniCart()?o.sections=["mini-cart"]:s.isShopifyDefaultDrawer()&&(o.sections=s.element.getSectionsToRender?.().map(l=>l.section??l.id));let a=JSON.stringify(o);try{let l=await fetch(i,{body:a,method:"post",headers:{"Content-Type":"application/json"}});if(l.status===200||l.status===302)return w.log(`Added ${e.length} items to Cart`),ce.showSnackbar("Product added to your cart"),l.json()}catch(l){w.error("Failed to add product in cart",l)}}async performUpdate(e,r){if(!kt.hasKeys(r)){w.warn("No update fields provided");return}let n=Oe.getCartURL("cart/change.js"),i=b({id:+e.vID},r),o=JSON.stringify(i);try{let s=await fetch(n,{body:o,method:"post",headers:{"Content-Type":"application/json"}});(s.status===200||s.status===302)&&(w.log(`Updated ${e}`),ge.getCurrent().update(s.json()))}catch(s){w.error("Failed to update item in cart",s,e)}}async performCopyCoupon(e){if(e)try{await navigator.clipboard.writeText(e),w.log(`Code-${e} copied`),ce.showSnackbar("Discount code copied")}catch(r){w.error("Failed to copy code",r)}}performGoToItem(e){if(!e?.link)return;let r=Oe.getProductSlug(e.link);r&&(location.pathname=Oe.getRootPrefix()+"products/"+r)}async upgradeToSubscription(e,r){if(!e){w.warn("Trying to upgrade to subscription with no item");return}let n=await ge.getCurrent().getNormalisedCart(),i=e.selectedOrFirstVariant.value,o=n.items.findIndex(p=>p.vID===i.mID),s=i.selectedSellingPlan.value,a=Oe.getCartURL("cart/change.js"),l={line:o+1,selling_plan:s?.mID||null,properties:r.getPrivateAttributesForLineItem()},m=JSON.stringify(l);try{let p=await fetch(a,{body:m,method:"post",headers:{"Content-Type":"application/json"}});(p.status===200||p.status===302)&&(w.log(`Upgraded ${e} selling plan`),ce.showSnackbar("Line item updated"),ge.getCurrent().update(p.json()))}catch(p){w.error("Failed to update subscription for item in cart",p)}}async processEvent(e){let r=e?.detail;if(!r)return;let n=r.clickAction,i=r.items,o=r.triggerData;if(n.at){let s=n;if(w.log(`Performing ${JSON.stringify(s)} action`),s.at===101)i?.length&&this.performGoToItem(i[0]);else if(s.at===102)i?.length&&await this.performAddToCart(i,o);else if(s.at===103)await this.performCopyCoupon(o.discount.code);else if(s.at===105)et.get().open();else if(s.at===104){let a=r.collections;if(!a?.length)return;location.pathname=Oe.getRootPrefix()+"collections/"+a[0].handle}}n.applyDiscount&&o.discount?.code&&Qr.navigate(o.discount.code,o.redirectBehaviour)}getVIDAndQuantity(e){let r,n;if(e instanceof bt)r=e.vID,n=e.quantity??1;else{if(!e.vars?.length)return{};r=e.selectedOrFirstVariant.value.mID,n=1}return{vID:r,quantity:n}}};var Li=class{constructor(e,r){this.triggerContext=e;this.element=r}safeHTTP=ue.getInstance();async execute(e){let r=e.clickAction||this.element?.clc;if(!r)return;let n=e.item,i=this.triggerContext,o=new Mr,s=i.triggerData.redirectBehaviour,a=!!i.triggerData.discount.type&&!!r?.applyDiscount,l={selectedVariants:i.triggerData.nonMutableItems.map(N=>({itemMID:N.mID,mID:N.selectedOrFirstVariant.value.mID})),eID:i.triggerData.engagementID,cID:i.triggerData.contentID},m="",p=[],f=n?[n.toEmbed()]:[];if(r.at===108){let N=i.selectedItems;if(f=e.embeddedItems??N.map(P=>P.toEmbed()),i.shouldGiveFBTDiscount||e.embeddedItems?.length){let P;e.embeddedItems?P=e.embeddedItems.map(x=>({itemMID:x.mID,mID:x.vID,quantity:x.quantity})):P=N.map(x=>({itemMID:x.mID,mID:x.selectedOrFirstVariant.value.mID}));let R=i.triggerData.bundleFrom;i.triggerData.isBundleOnCartDrawer()&&R&&P.push({itemMID:R.mID,mID:R.selectedOrFirstVariant.value.mID}),l.selectedVariants=P}else l=void 0;p=e.embeddedItems??N}else if(r.at===107){let N=await ge.getCurrent().getNormalisedCart();f=N.items,l.selectedVariants=N.items.map(P=>({itemMID:P.mID,mID:P.vID}))}else if(r.at===102)p=[n];else if(r.at===101)m=Oe.getRootPrefix()+"products/"+n.slug;else if(r.at===4){let N=ce.isValidURL(r.gu?.u);N&&(m=N.pathname+N.search+N.hash)}else r.at===109&&(await o.upgradeToSubscription(n,i.triggerData),this.triggerContext.triggerData.skipSubscribedItems&&this.triggerContext.renderer.destroy());if(this.sendTriggerClicked(f,{from:"button"}),w.debug({redirectPath:m,redirectBehaviour:s,hasDiscount:a}),!a&&m){location.href=m;return}let d,g=!1;try{d=await this.getOrGenerateDiscountCode(l),w.debug("Discount code (if any) to apply",d)}catch(N){if(!this.triggerContext.triggerData.isBYOB()){gd.default.error("Unable to get a discount code",N);return}}d&&r.at===103&&await new Mr().performCopyCoupon(d);try{d&&await Qr.applyWithStorefront(d)}catch(N){w.error(N),g=!0}let E;if(p?.length&&(E=await o.performAddToCart(p,i.triggerData)),g&&d){Qr.navigate(d,s,m);return}if(m){location.href=m;return}Qr.navigateWithoutDiscount(s,E)}sendTriggerClicked(e,r){let n=A.EVENT_TRIGGER_CLICKED,i=new ve(n,r,this.triggerContext.triggerData);i.items=e,this.safeHTTP.sendEvent(i)}async getOrGenerateDiscountCode(e){let r=this.triggerContext.triggerData.discount;if(!r?.type)return;let n="";if(r.type===ur.STATIC){if(!r.code)throw Ue.getInstance().captureMessage("No discount code found","warning",{triggerContext:this.triggerContext}),new Error("No discount code found");return r.code}if(e){if(n=await this.generateDiscount(e),!n)throw w.error("No discount code found",e),new Error("Discount code not found or generated");return n}}async generateDiscount(e){try{return(await this.safeHTTP.generateDiscount(e))?.code}catch(r){throw ce.showSnackbar("Failed to generate a discount code"),w.error("Error generating discount code",r,e),Ue.getInstance().captureMessage("Failed to generate discount code","error",{discountData:JSON.stringify(e),triggerContext:this.triggerContext,error:r}),r}}};var De=class extends pr{stylesConverter=new Ni(1);renderer=Nt.get();mediaStyle={};deviceTypeKey;clickExecutor;componentWillMount(){this.deviceTypeKey=this.renderer.isMobile()?"sm":"lg",this.clickExecutor=new Li(this.props.triggerContext,this.props.element)}getCompiledStyles(){return this.putStyleAccordingToDevice(),b(b(Z(b(b(b(b(b(b({},this.stylesConverter.getFlexStyles(this.mediaStyle.flex)),this.stylesConverter.getBackgroundStyles(this.mediaStyle.bg)),this.stylesConverter.getBorderStyles(this.mediaStyle.br)),this.stylesConverter.getSizeStyles(this.mediaStyle.size)),this.stylesConverter.getSpaceStyles(this.mediaStyle.spc)),this.stylesConverter.getLayoutStyles(this.mediaStyle.lout)),{boxSizing:"border-box",outline:"none"}),this.getComponentStyles()),this.props.style)}matchWhenCondition(e){if(!e?.op)return!0;let{lhs:r,rhs:n}=e;switch(e.op){case"eq":return r===n;case"gt":return+r>+n;case"gte":return+r>=+n;case"lt":return+r<+n;case"lte":return+r<=+n;case"ne":return r!==n;case"null":return r==null;case"empty":return r.trim()==="";default:return w.error(`Invalid operator found for when condition - ${e.op}`),!1}}putStyleAccordingToDevice(){let e=this.props.element;this.mediaStyle=e.style.lg,this.renderer.isMobile()&&e.style.sm&&Object.keys(e.style.sm).length&&(this.mediaStyle=b(b({},this.mediaStyle),e.style.sm))}sendTriggerClicked(e,r){this.clickExecutor.sendTriggerClicked(e,r)}async onClick(e){await this.clickExecutor.execute(e)}};var X_=0,NF=Array.isArray;function M(t,e,r,n,i,o){e||(e={});var s,a,l=e;if("ref"in l)for(a in l={},e)a=="ref"?s=e[a]:l[a]=e[a];var m={type:t,props:l,key:r,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--X_,__i:-1,__u:0,__source:i,__self:o};if(typeof t=="function"&&(s=t.defaultProps))for(a in s)l[a]===void 0&&(l[a]=s[a]);return _e.vnode&&_e.vnode(m),m}var Et=class extends De{componentDidMount(){this.setState(()=>({text:this.props.element.text})),nt(this.onChange.bind(this))}componentWillReceiveProps(e){this.props.element=e.element,this.onChange()}render(){let e=this.getCompiledStyles(),r=this.state.text;return r||(e.display="none",r=""),M("div",{style:e,onClick:this.customOnClick.bind(this),className:"lc-text",children:M("span",{style:this.getSpanStyle(),dangerouslySetInnerHTML:{__html:r}})})}customOnClick(){this.props.onClick&&this.props.onClick("title")}onChange(){if(this.props.element.text==null)return;let e=this.props.triggerContext.triggerData,r={bundle:e.discountData.value,customer:e.customerData},n=Zt.render(JSON.stringify(this.props.element),r),i=new Ve(JSON.parse(n));if(!this.matchWhenCondition(i.when)){this.setState(()=>({text:""}));return}this.setState(()=>({text:i.text}))}getTypoStyles(){let e={},r=this.mediaStyle.typo??new it;return e.letterSpacing=r.letterSpacing,e.fontSize=r.fs+"px",e.lineHeight=r.lh,e.fontFamily=r.fam.name||"inherit",e.textAlign=r.alignment,e.fontWeight=r.fw,e.textDecoration=r.td??"none",this.stylesConverter.getColourStyles(r.tc,"color",e),e}getComponentStyles(){return b({},this.getTypoStyles())}getSpanStyle(){return{overflow:"hidden",display:"-webkit-box",webkitBoxOrient:"vertical",webkitLineClamp:2,color:"inherit",fontSize:"inherit",fontWeight:"inherit",fontFamily:"inherit"}}};var Ln=class extends Et{render(){return M("div",{style:this.getCompiledStyles(),className:"lc-button",onClick:()=>this.onClick({item:this.props.item}),children:M("span",{style:this.getSpanStyle(),dangerouslySetInnerHTML:{__html:this.props.element.text}})})}getComponentStyles(){return Z(b({},super.getComponentStyles()),{cursor:"pointer"})}};var Vu=class extends pr{render(){if(this.props.element.show[this.props.label.toLowerCase()])return this.props.element.lblPos==="end"?M("div",{style:b(b({},this.getElementStyle()),this.props.styles),children:[M("span",{children:this.props.time}),M("span",{style:this.getTimeLabelStyle(),children:this.props.label})]}):M("div",{style:b(b({},this.getElementStyle()),this.props.styles),children:[M("span",{style:this.getTimeLabelStyle(),children:this.props.label}),M("span",{children:this.props.time})]})}getDesign(){}getTimeLabelStyle(){return{fontSize:"0.5em",alignContent:"center"}}getElementStyle(){let e={display:"flex",flexDirection:"column",placeContent:"center center",textAlign:"center"};return this.props.element.horizontal&&(e.gridTemplateColumns="repeat(2, minmax(0, 1fr))"),e}},Uo=class extends Et{labels={Days:"00",Hours:"00",Minutes:"00",Seconds:"00"};componentWillMount(){super.componentWillMount(),this.setState(()=>b({},this.labels)),this.processAndStartTimer()}render(){return M("div",{style:this.getLabelsParentStyle(),children:Object.keys(this.labels).map(e=>M(Vu,{styles:this.getCompiledStyles(),label:e,time:this.state[e],element:this.props.element}))})}getLabelsParentStyle(){return{display:"grid",justifyContent:"center",gridTemplateColumns:"repeat(4, auto)",gap:this.stylesConverter.getSizePx(this.props.element.gap)}}getDisplayStyles(){return{display:"grid",placeContent:"center center"}}getComponentStyles(){return b(b({},super.getComponentStyles()),this.getDisplayStyles())}processAndStartTimer(){this.props.element.timer.start(this.props.element.timerType,e=>{this.labels.Days=String(e.days).padStart(2,"0"),this.labels.Hours=String(e.hours).padStart(2,"0"),this.labels.Minutes=String(e.minutes).padStart(2,"0"),this.labels.Seconds=String(e.seconds).padStart(2,"0"),this.setState(()=>b({},this.labels))})}};var Mo=class extends De{componentDidMount(){nt(()=>{this.setState(()=>({checked:this.props.item.selected.value}))})}render(){return M("div",{style:this.getCompiledStyles(),className:"lc-checkbox",children:M("input",{type:"checkbox",checked:this.state.checked,onChange:this.onChange.bind(this),style:{appearance:"auto"}})})}onChange(e){let{checked:r}=e.target;this.props.item.selected.value=r}getTypoStyles(){let e={},r=this.mediaStyle.typo??new it;return e.textAlign=r.alignment,e.justifyContent=r.alignment,e}getComponentStyles(){return Z(b({},this.getTypoStyles()),{display:"flex"})}};var kr=class extends De{constructor(e,r){super(e,r)}render(){let e=this.props.element[this.deviceTypeKey],r=e?.src||this.props.element.src||this.props.element.lg?.src;return M("img",{onClick:this.customOnClick.bind(this),className:"lc-image",alt:e?.name||"Image",onMouseEnter:this.handleMouseEnter.bind(this),onMouseLeave:this.handleMouseLeave.bind(this),src:r,style:this.getCompiledStyles()})}customOnClick(){this.props.onClick&&this.props.onClick("image")}getComponentStyles(){let e=this.mediaStyle.lout;if(!e||e.pos!=="absolute")return{};let r={zIndex:e.zIndex};return this.mediaStyle.size?.w&&(r.width=this.mediaStyle.size.w),this.mediaStyle.size?.h&&(r.height=this.mediaStyle.size.h),r}handleMouseEnter(e){let r=this.props.element[this.deviceTypeKey]?.secondarySrc;r&&(e.currentTarget.src=r)}handleMouseLeave(e){e.currentTarget.src=this.props.element[this.deviceTypeKey]?.src}};var Fr=class extends De{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return M("div",{style:this.getCompiledStyles(),class:"lc-flexbox",children:M(Zr,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})})}getComponentStyles(){let e=this.mediaStyle.flex??new oi,r={display:"flex",gap:e.gap+"px",flexWrap:e.wrap,flexDirection:e.dir,justifyContent:e.jc,alignItems:e.ai};return e.wrap==="nowrap"&&e.scroll&&(e.dir==="column"?r["overflow-y"]="auto":r["overflow-x"]="auto"),r}};var ko=class extends Fr{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return M("div",{style:this.getCompiledStyles(),class:"lc-flexbox",children:M(Bi,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext,item:this.props.item,noLinks:this.props.noLinks})})}};var Fo=class extends De{render(){return M("select",{style:this.getCompiledStyles(),value:this.props.selectedVariant.selectedSellingPlan.value?.mID??"",onChange:this.onChange.bind(this),disabled:this.state.disabled,className:"lc-dropdown",children:this.createSelectItems()})}componentDidMount(){nt(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:!1}))})}getTypoStyles(){let e={},r=this.mediaStyle.typo??new it;return e.letterSpacing=r.letterSpacing,e.fontSize=r.fs+"px",e.lineHeight=r.lh,e.fontFamily="inherit",e.textAlign=r.alignment,e.fontWeight=r.fw,this.stylesConverter.getColourStyles(r.tc,"color",e),e.boxShadow="none",e}getComponentStyles(){let e={};return this.props.selectedVariant.sellingPlans?.length||(e.visibility="hidden"),b(b({},e),this.getTypoStyles())}createSelectItems(){let e=[],r=this.props.selectedVariant;if(!r.sellingPlans?.length)return[];this.props.triggerContext.triggerData.skipSubscribedItems?r.selectedSellingPlan.value||(r.sellingPlans[0].isSelected=!0,r.changeSellingPlan(r.sellingPlans[0])):e.push(M("option",{value:"",selected:!r.selectedSellingPlan,children:"One time purchase"}));for(let n of r.sellingPlans??[])e.push(M("option",{value:n.mID,selected:n.isSelected,children:n.name}));return e}onChange(e){let r=e.target.value;r?this.props.selectedVariant.selectedSellingPlan.value=this.props.selectedVariant.sellingPlans.find(n=>n.mID===r):this.props.selectedVariant.selectedSellingPlan.value=void 0}};var Ho=class extends De{render(){return M("select",{style:this.getCompiledStyles(),value:this.props.item.selectedOrFirstVariant.value.mID,onChange:this.onChange.bind(this),disabled:this.state.disabled,className:"lc-dropdown",children:this.createSelectItems()})}componentDidMount(){nt(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:!1}))})}getTypoStyles(){let e={},r=this.mediaStyle.typo??new it;return e.letterSpacing=r.letterSpacing,e.fontSize=r.fs+"px",e.lineHeight=r.lh,e.fontFamily="inherit",e.textAlign=r.alignment,e.fontWeight=r.fw,this.stylesConverter.getColourStyles(r.tc,"color",e),e.boxShadow="none",e}getComponentStyles(){let e={};return this.props.item.vars?.length===1&&this.props.item.vars[0].name==="Default Title"&&(e.visibility="hidden"),b(b({},e),this.getTypoStyles())}createSelectItems(){let e=[];for(let r of this.props.item.vars)e.push(M("option",{value:r.mID,disabled:!r.isAvailable,children:r.name}));return e}onChange(e){let r=e.target.value;this.props.item.selectedOrFirstVariant.value=this.props.item.vars.find(n=>n.mID===r)}};var Bi=class extends De{constructor(e,r){super(e,r),this.setState(()=>({decoration:"unset"}))}renderElement(e){if(!(e.hide||!this.matchWhenCondition(e.when))){if(e.t===4){let r=e;return M(ko,{element:r,triggerContext:this.props.triggerContext,elements:r.elems,item:this.props.item,noLinks:this.props.noLinks})}if(e.t===6)return this.props.triggerContext.triggerData.isBundle()?M(Mo,{element:e,item:this.props.item,triggerContext:this.props.triggerContext}):void 0;if(e.t===13){let r=e,n=this.props.item,i=n.variantImage??n.imageURL,o=n.variantSecondaryImage??n.secondaryImageURL;r.lg=r.sm={src:i,name:n.name,secondarySrc:o};let s=M(kr,{element:r,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?s:M("a",{href:this.props.item.selectedOrFirstVariant.value.link,style:{display:"block"},children:s})}if(e.t===14)return this.renderProductTitle(e);if(e.t===15){let r=e;return this.props.triggerContext.triggerData.isCartEmbed()&&this.props.item.vars?.length===1&&this.props.item.vars[0].name==="Default Title"?void 0:M(Ho,{element:r,item:this.props.item,triggerContext:this.props.triggerContext})}return e.t===16?M(Fo,{element:e,selectedVariant:this.props.item.selectedOrFirstVariant.value,item:this.props.item,triggerContext:this.props.triggerContext}):e.t===18||e.t===3?M(Ln,{element:e,item:this.props.item,triggerContext:this.props.triggerContext}):M(Zr,{elements:[e],element:this.props.element,triggerContext:this.props.triggerContext})}}render(){return this.props.elements.map(e=>this.renderElement(e))}getComponentStyles(){return{}}renderProductTitle(e){let r=M(Et,{element:e,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?r:M("a",{href:this.props.item.selectedOrFirstVariant.value.link,style:{display:"block",textDecoration:this.state.decoration},onMouseEnter:this.onMouseEnter.bind(this),onMouseLeave:this.onMouseLeave.bind(this),children:r})}customOnClick(e){this.sendTriggerClicked([this.props.item.toEmbed()],{from:e})}onMouseEnter(){this.setState(()=>({decoration:"underline"}))}onMouseLeave(){this.setState(()=>({decoration:"unset"}))}};var Hr=class extends De{productElement;constructor(e,r){super(e,r),this.setState(()=>({decoration:"unset"}))}render(){let e=JSON.stringify(this.props.element),r=Zt.render(e,this.getProductData());if(this.productElement=new hr(JSON.parse(r)),!(this.productElement.hide||!this.matchWhenCondition(this.productElement.when)))return M("div",{style:b({},this.getCompiledStyles()),class:"lc-single-product",children:M(Bi,{element:this.productElement,elements:this.productElement.elems,triggerContext:this.props.triggerContext,item:this.props.item,noLinks:this.productElement.noLinks})})}getComponentStyles(){return{flexShrink:0}}getProductData(){if(!this.props.item)return{};let e=this.props.item.selectedOrFirstVariant.value,r=e.price,n=this.props.item.name,i=this.props.item.category,o=ce.formatCurrency(r.d,!0),s=this.props.item.variantImage??this.props.item.imageURL,a=this.props.item.meta,l=r.cmp&&r.cmp>r.d,m=this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(this.props.item.quantity):this.props.item.quantity,p=r.effective,f={name:n,price:o,quantity:m,image_url:s,meta:a,effective_price:p,category:i};if(l){f.compare_price=ce.formatCurrency(r.cmp);let g=r.cmp-r.d;f.discount_percent=(g/r.cmp*100).toFixed(0),f.discount_price=ce.formatCurrency(g)}let d={name:e.name,quantity:this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(e.quantity):e.quantity};return{product:f,variant:d}}};function tc(){return new Promise(t=>{let e="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.js";if(Array.from(document.scripts).some(n=>n.src.includes(e))){t();return}let r=document.createElement("script");r.src=e,r.onload=()=>{t()},document.body.appendChild(r)})}function rc(t,e){if(!t||!window.Swiper)return;let r=new window.Swiper(t,{loop:!0,slidesPerView:e.maxInRow,spaceBetween:e.gap+"px",pagination:{type:e.pagination.type,el:t.querySelector(".swiper-pagination"),clickable:!0,renderBullet:(n,i)=>`
|
|
55
|
+
<span class="${i}"
|
|
56
|
+
style="background-color: ${e.pagination.color?.rgba};"></span>
|
|
57
|
+
`,renderProgressbar:n=>`
|
|
58
|
+
<span class="${n}"
|
|
59
|
+
style="background-color: ${e.pagination.color?.rgba};">
|
|
60
|
+
</span>
|
|
61
|
+
`},navigation:{nextEl:t.querySelector(".swiper-button-next"),prevEl:t.querySelector(".swiper-button-prev")},autoplay:e.autoplay?.enabled?{delay:e.autoplay?.delay,disableOnInteraction:!1}:!1,autoHeight:!0});return t.style.setProperty("--swiper-navigation-size",`${e.navigation.size}px`),r}function nc(t,e,r){let n={color:t.navigation.color?.rgba};return t.pagination.enabled&&(n.transform="translateY(-25%)"),M("div",{class:"swiper-container",ref:e,children:[M("div",{class:"swiper-wrapper",children:r()}),t.navigation.enabled&&M("div",{class:"swiper-button-next",style:n,children:M("span",{})}),t.navigation.enabled&&M("div",{class:"swiper-button-prev",style:n,children:M("span",{})}),t.pagination.enabled&&M("div",{className:"swiper-pagination",style:{bottom:0,top:"unset",position:"relative",color:t.pagination.color?.rgba}})]})}var $o=class extends De{swiperRef=null;swiperInstance=null;configuration;gap;constructor(e,r){super(e,r),this.configuration=this.renderer.isMobile()?this.props.element.conf.sm:this.props.element.conf.lg,this.gap=(this.configuration.gap??15)+"px"}componentDidMount(){this.props.element.conf[this.deviceTypeKey].disp===2&&tc().then(()=>{this.swiperInstance=rc(this.swiperRef,this.props.element.conf[this.deviceTypeKey])})}componentWillUnmount(){this.swiperInstance&&this.swiperInstance.destroy()}render(){let e=this.props.triggerContext.triggerData.items;e.splice(this.configuration.maxItems??10);let r;if(this.configuration.disp===2){let n=o=>{this.swiperRef=o},i=()=>e?.map(o=>M("div",{class:"swiper-slide",children:this.getProductFragment(o)}));r=M("div",{style:Z(b({},this.getCompiledStyles()),{display:"block"}),class:"lc-product-swiper-list",children:nc(this.configuration,n,i)})}else r=M("div",{style:this.getCompiledStyles(),class:"lc-product-list",children:e?.map((n,i)=>this.getProductFragment(n,i!==e.length-1))});return r}getComponentStyles(){let e=[0,2].includes(this.configuration.disp),r={display:e?"flex":"grid",justifyContent:"safe "+(this.mediaStyle.flex?.jc??"center"),gap:this.gap,flexDirection:this.mediaStyle.flex?.dir??"row"};if(r.flexDirection==="row"){if(e)r.maxWidth="100%",r.overflowY="auto";else if(this.configuration.disp===1){let n=this.props.triggerContext.triggerData,i=n.items.length,o;n.isBundle()?o=this.props.element.prod.symbol?.hide!==!0?i*2-1:i:o=this.props.element.conf[this.deviceTypeKey].maxInRow,r.gridTemplateColumns=`repeat(${o}, auto)`}}return r}getProductFragment(e,r=!1){return M(fr,{children:[M(Hr,{element:this.props.element.prod,item:e,triggerContext:this.props.triggerContext}),this.props.triggerContext.triggerData.isBundle()&&r&&this.props.element.prod.symbol&&!this.props.element.prod.symbol.hide&&M("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:M(Et,{element:this.props.element.prod.symbol,triggerContext:this.props.triggerContext})})]},e.mID)}};var jo=class extends De{swiperRef=null;swiperInstance=null;constructor(e,r){super(e,r)}componentDidMount(){tc().then(()=>{this.swiperInstance=rc(this.swiperRef,this.props.element.conf)})}componentWillUnmount(){this.swiperInstance&&this.swiperInstance.destroy()}render(){let e=this.props.element,r=i=>{this.swiperRef=i},n=()=>e.values?.map(i=>M("div",{class:"swiper-slide",onClick:()=>this.onClick({clickAction:this.getClickAction(i)}),children:this.renderElement(i)}));return nc(e.conf,r,n)}getComponentStyles(){return{}}renderElement(e){let r=this.valueAddedSlide(this.props.element.slide,e);switch(r?.t){case 1:return M(kr,{element:r,triggerContext:this.props.triggerContext});case 4:return M(Fr,{elements:r.elems,element:r,triggerContext:this.props.triggerContext});default:w.warn("Unknown slide type for carousal")}}valueAddedSlide(e,r){let n=JSON.stringify(e),i=Zt.render(n,{form:r});return At.getParsedElement(JSON.parse(i))}getClickAction(e){let r=b({},this.props.element.clc),n=JSON.stringify(r),i=Zt.render(n,{form:e});return JSON.parse(i)}};var Zr=class extends De{constructor(e,r){super(e,r),this.setState(()=>({decoration:"unset"})),nt(()=>{this.setState(()=>({showButton:!this.props.triggerContext.triggerData.isBundle()||!!this.props.triggerContext.selectedItems.length}))})}renderElement(e){if(!e.hide){if(e.t===4){let r=e;return M(Fr,{element:r,triggerContext:this.props.triggerContext,elements:r.elems})}if(e.t===61)return M(Uo,{element:e,triggerContext:this.props.triggerContext});if(e.t===3)return this.state.showButton?M(Ln,{element:e,triggerContext:this.props.triggerContext}):void 0;if(e.t===2)return M(Et,{element:e,triggerContext:this.props.triggerContext});if(e.t===1)return M(kr,{element:e,triggerContext:this.props.triggerContext});if(e.t===11)return M($o,{element:e,triggerContext:this.props.triggerContext});if(e.t===12)return M(Hr,{element:e,item:this.props.triggerContext.triggerData.items[0],triggerContext:this.props.triggerContext});if(e.t===62)return M(jo,{element:e,triggerContext:this.props.triggerContext})}}render(){return this.props.elements.map(e=>this.renderElement(e))}getComponentStyles(){return{}}};var Wo=class extends De{clickAction;isClickable;constructor(e,r){super(e,r),this.clickAction=this.props.element.clc,this.isClickable=this.clickAction?.at===4&&this.clickAction.gu?.u}componentDidMount(){nt(()=>{let e=this.props.triggerContext.triggerData,r=this.props.triggerContext.selectedItems;e.calculateDiscountData(r,this.props.triggerContext.shouldGiveFBTDiscount)})}render(){return M(fr,{children:[M("div",{style:this.getCompiledStyles(),class:"lc-container",onClick:()=>{this.onClick({clickAction:this.clickAction})},children:M(Zr,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})}),this.props.triggerContext.triggerData.id==="preview"&&M("div",{class:"letscooee-preview-badge",children:["#",this.props.triggerContext.triggerData.shortID," preview"]})]})}getComponentStyles(){let e={position:"relative",overflow:"hidden",display:"block"};return this.isClickable&&(e.cursor="pointer"),e}async onClick(e){if(this.isClickable)return super.onClick(e)}};var xt=class t{constructor(e){this.engagementTrigger=e;this.triggerContext=new Ri(new Date,this.engagementTrigger)}static renderedEngagements=[];static engagementIDsWithTrackedDisplay=new Set;static DEBOUNCE_TIME=1e3;rootContainer;widgetElement;widget;triggerContext;observers=[];runtimeData=fe.get();widgetAPIService=se.get(sr);safeHTTPService=se.get(ue);scrollSubscription;variation;isExclusionWithBVariation;renderSilently(){this.render().catch(e=>Ue.getInstance().captureException(e,b({},this.engagementTrigger.sentryContext())))}destroy(){w.log(`${this.engagementTrigger} will be destroyed`),this.scrollSubscription?.unsubscribe(),this.observers.forEach(e=>{e?.disconnect&&e.disconnect()}),this.rootContainer?.remove(),t.engagementIDsWithTrackedDisplay.delete(this.engagementTrigger.shortID)}async render(){if(this.engagementTrigger.hasMultiplePlacement){let e=await this.getVariation();this.handleVariationResponse(e)}if(this.rootContainer=await this.getWidgetContainer(!0),!this.rootContainer){w.warn(`${this.engagementTrigger} no section found to render the widget`);return}this.widget=this.engagementTrigger.widget,await this.getVariationIfRequired(),!this.shouldStopRendering()&&(await this.startRendering(),this.attachScroll(),await this.checkAndSendEvent(),this.triggerContext.renderer=this)}isSameTrigger(e){return this.engagementTrigger.shortID===e.shortID}update(e){yd.default.log(`${this.engagementTrigger} will be updated`),this.updateItems(e.items,this.engagementTrigger.items)}shouldStopRendering(){return!this.widget&&!this.isExclusionWithBVariation}async getVariationIfRequired(){if(this.engagementTrigger.isSingleContent()||this.engagementTrigger.widget){w.log(`${this.engagementTrigger} already has required data to render widget`);return}let e=await this.observeWidgetContainerInViewport();this.handleVariationResponse(e)}handleVariationResponse(e){e&&(w.log(`${this.engagementTrigger} visitor has been assigned to variation ${e.variation}`),e.items?.length&&(this.engagementTrigger.items=e.items.map(r=>new wt(r)),this.engagementTrigger.nonMutableItems=e.items.map(r=>new wt(r))),e.bundleFrom&&(this.engagementTrigger.bundleFrom=new wt(e.bundleFrom)),e.discount&&(this.engagementTrigger.discount=e.discount),e.placement&&(this.triggerContext.triggerData.placement=e.placement),e.props&&kt.hasKeys(e.props)&&(this.engagementTrigger.props=b(b({},this.engagementTrigger.props),e.props)),this.triggerContext.triggerData.widget=this.widget=new li(e.widget),this.triggerContext.triggerData.contentID=e.contentID,this.triggerContext.triggerData.variation=this.variation=e.variation,this.triggerContext.triggerData.placement=e.placement,this.isExclusionWithBVariation=this.engagementTrigger.isExclusionTesting()&&this.variation==="b",this.isExclusionWithBVariation&&(this.rootContainer.style.height="0.5px"))}addToRendered(){t.renderedEngagements.push(this)}async getVariation(){w.log(`${this.engagementTrigger} get variation`);let e={engagementID:this.engagementTrigger.engagementID,isPreview:this.engagementTrigger.id==="preview"};try{return await this.widgetAPIService.getVariation(e)}catch(r){w.error(`${this.engagementTrigger} unable to get the variation`,r);return}}async observeWidgetContainerInViewport(){if(!this.rootContainer){w.warn(`${this.engagementTrigger} No root container found to watch for viewport`);return}let e=window.innerHeight*.3,r={root:null,rootMargin:`-${e}px 0px ${e}px 0px`,threshold:0};return await this.isInViewport()?this.getVariation():new Promise(n=>{let i=new IntersectionObserver((o,s)=>{o.forEach(async a=>{if(a.isIntersecting){w.log(`${this.engagementTrigger} root container is near the viewport. Fetching variation`);let l=await this.getVariation();n(l),s.unobserve(this.rootContainer)}})},r);i.observe(this.rootContainer),this.observers.push(i)})}attachScroll(){this.scrollSubscription=En(window,"scroll").pipe(tr(t.DEBOUNCE_TIME)).subscribe(()=>{this.checkAndSendEvent()})}async checkAndSendEvent(){let e=this.engagementTrigger.shortID;if(t.engagementIDsWithTrackedDisplay.has(e)||!await this.isInViewport())return;let n={};this.triggerContext.triggerData.items?.length&&(n.promotedMIDs=this.engagementTrigger.items?.map(s=>s.mID));let i=this.isExclusionWithBVariation?A.EVENT_CAMPAIGN_HOLDOUT:A.EVENT_TRIGGER_DISPLAYED,o=new ve(i,n,this.engagementTrigger);o.name===A.EVENT_CAMPAIGN_HOLDOUT&&(o.trigger.holdout=!0),this.safeHTTPService.sendEvent(o),t.engagementIDsWithTrackedDisplay.add(e),this.scrollSubscription.unsubscribe()}generateParentElementID(){return`letscooee-${this.engagementTrigger.shortID}`}async isInViewport(){let e=(await this.getWidgetContainer())?.getBoundingClientRect();if(!e)return!1;let r=window.innerHeight||document.documentElement.clientHeight,i=(Math.min(e.bottom,r)-Math.max(e.top,0))*e.width,o=e.width*e.height,s=i/o*100;return this.engagementTrigger.isAnySplit()?s>0:s>=30}async getWidgetContainer(e){if(this.rootContainer?.isConnected)return this.rootContainer;let r=await this.createParentElementWithPlacement(e);if(r)return r;let n=`.letscooee[data-engagement-id="${this.triggerContext.triggerData.shortID}"]`;return document.querySelector(n)}async createParentElementWithPlacement(e){let r=this.engagementTrigger.placement;if(!r?.selector)return w.warn(`${this.engagementTrigger} does not have a selector`),null;w.debug(`${this.engagementTrigger} attempt to render ${r.position}-${r.selector}`);let n=await ce.retrySelector(r.selector);if(!n)return w.warn(`${this.engagementTrigger} no placement found with ${r.selector}`),null;let i=this.generateParentElementID(),o=this.getParentElement(i);if(!e)return o;switch(r.position){case $n.BEFORE:{n.parentElement?.insertBefore(o,n);break}case $n.INSIDE_FIRST:{n.insertBefore(o,n.firstChild);break}case $n.INSIDE_LAST:{n.appendChild(o);break}case $n.AFTER:default:n.parentElement?.insertBefore(o,n.nextSibling)}return o}async startRendering(){let e;try{e=await Pi.refreshItems(this.engagementTrigger)}catch(r){w.error(`${this.engagementTrigger} error refreshing the items`,r);return}if(!e?.length&&this.engagementTrigger.isProductPromoted()){w.warn(`${this.engagementTrigger} is of ${this.engagementTrigger.objective} but no product found`);return}this.engagementTrigger.items=e,this.renderContainer()}getParentElement(e){let r=document.getElementById(e);if(r)return r;let n=this.engagementTrigger.shortID;return r=document.createElement("div"),r.id=e,r.className=`letscooee letscooee-engagement engagement-${n}`,r.dataset.engagementId=n,this.engagementTrigger.id==="preview"&&(r.className+=" letscooee-preview"),r.style.display="block",r.style.minHeight="0.5px",r}renderContainer(){if(!this.widget)return;let e=this.rootContainer;if(this.triggerContext.triggerData.hasSwiperElement()){let n=this.rootContainer?.shadowRoot||this.rootContainer?.attachShadow({mode:"open"}),i=qe.get().website.commonCSS;i&&It.injectRawCSS(i,n),It.injectStylesheet("https://cdn.jsdelivr.net/npm/@letscooee/web-sdk@latest/dist/widget-sdk.min.css",n),It.injectStylesheet("https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css",n),e=n}Qo(Ji(Wo,{element:this.widget.cont,triggerContext:this.triggerContext,elements:this.widget.elems}),e),this.addToRendered()}updateItems(e,r){let n=this.getItemDiff(e,r),i=this.getItemDiff(r,e);r.push(...n);for(let o of i)jn.remove(r,o)}getItemDiff(e,r){return e.filter(n=>!r.some(i=>i.selectedOrFirstVariant.value.mID===n.selectedOrFirstVariant.value.mID))}};var Rr=class t extends xt{static renderedEngagements=[];constructor(e){super(e)}addToRendered(){t.renderedEngagements.push(this)}observeWidgetContainerInViewport(){return this.getVariation()}generateParentElementID(){let e=super.generateParentElementID();return this.engagementTrigger.isSubscriptionUpsell()&&(e+=`-${this.engagementTrigger.items[0].selectedOrFirstVariant.value.mID}`),e}async checkAndSendEvent(){if(!et.get().isOpen()&&this.runtimeData.pageName!=="cart"){w.log("Do not send display event as neither the cart drawer nor the cart page is open.");return}return super.checkAndSendEvent()}};var ic=class t{constructor(e,r){this.engagementTrigger=e;this.element=r;this.cartItems=ge.getCurrent().items}cartItems;static renderCartUpsell(e){let r=e.placement;if(!r?.selector){w.warn(`No placement available for ${e.objective}`,e.shortID);return}let n=Array.from(document.querySelectorAll(r.selector));if(!n?.length){w.warn(`No placement found for ${e.objective}`,e.shortID);return}for(let i of n)new t(e,i).render()}render(){let e=this.findCartItemFromHTMLElement();if(!e||this.engagementTrigger.skipSubscribedItems&&e.selling_plan_allocation)return;let r=this.engagementTrigger.items.find(p=>p.mID===e.product_id.toString());if(!r)return;let n=r.vars.find(p=>p.mID===e.id.toString());if(!n)return;let i=new mr(n),o=e.selling_plan_allocation?.selling_plan;if(o)for(let p of i.sellingPlans??[])p.mID===o.id.toString()&&(p.isSelected=!0,i.changeSellingPlan(p));let s=new wt(r);s.vars=[i],s.selectedOrFirstVariant.value=i;let a=`lc-cart-item-${this.engagementTrigger.shortID}-${r.mID}`;this.element.classList.add(a);let l=new Pt(this.engagementTrigger);l.placement.selector=`.${a}`,l.items=[s];let m=new Rr(l);m.renderSilently(),this.watchForCartItemDeletion(m,a)}watchForCartItemDeletion(e,r){let n=new MutationObserver(i=>{i.forEach(o=>{o.removedNodes.forEach(s=>{s===this.element&&(w.debug(`${r} has been removed`),e.destroy(),n.disconnect())})})});n.observe(this.element.parentElement,{childList:!0,subtree:!0})}findCartItemFromHTMLElement(){let e=this.element.innerHTML;return this.cartItems.find(r=>{if(!(e.includes(r.url)||e.includes(r.variant_id))&&(!e.includes(r.product_title)||r.variant_title&&!e.includes(r.variant_title)))return!1;let n=r.selling_plan_allocation?.selling_plan?.name;return!(n&&!e.includes(n))})}};var oc=class extends Rr{ctaListener=new Mr;constructor(e){super(e),Dr.get().subscriber(A.CART_UPDATE_BROADCAST).pipe(Cl(null)).subscribe(this.checkMilestone.bind(this))}update(e){super.update(e),this.widgetElement.update()}shouldStopRendering(){return!1}renderContainer(){if(this.widgetElement?.isConnected){this.addToRendered();return}let e=this.widgetElement=document.createElement("cooee-progressbar");e.className="cooee-root",e.cart=ge.getCurrent(),e.engagementTrigger=this.engagementTrigger,e.setAttribute("engagement",this.engagementTrigger.shortID),this.rootContainer.appendChild(e),this.addToRendered()}async checkMilestone(){let e=await ge.getCurrent().getNormalisedCart(),i=[...this.engagementTrigger.progressBarConfig.milestones].reverse().find(o=>o.minValue<e.amount);if(!i){w.log("No milestone achieved yet");return}if(w.log("Current milestone",i),i.rewardType===Tc.FREE_AUTO_GIFT){let o=i.items[0];if(e.items.find(a=>a.vID===o.vID||a.mID===o.mID)){w.log(`Item(vID:${o.vID}) already present in the cart. Updating item's properties`),await this.ctaListener.performUpdate(o,{properties:this.engagementTrigger.getPrivateAttributesForLineItem()});return}else{let a=await this.ctaListener.performAddToCart([o],this.engagementTrigger);et.get().refreshUI(a,!1),await this.removeOtherFreeGifts(o)}}}async removeOtherFreeGifts(e){let n=(await ge.getCurrent().getNormalisedCart()).items.filter(i=>i.vID!==e?.vID&&i.properties[A.CAMPAIGN_ATTRIBUTE]===this.engagementTrigger.shortID);if(n.length)for(let i of n)await this.ctaListener.performUpdate(i,{quantity:0})}};var vd=new hr({t:12,style:{lg:{spc:{p:5,pl:5,pr:5,pt:5,pb:5},size:{w:"100%",h:"auto"},br:{r:4,w:0,s:1,c:{h:"#94a3b8",a:100}}},sm:{spc:{p:5,pl:5,pr:5,pt:5,pb:5},size:{w:"240px",h:"auto"},br:{r:0,w:0,s:1,c:{h:"#94a3b8",a:100}}}},elems:[{t:4,style:{lg:{spc:{},lout:{of:"cover",disp:"flex"},flex:{gap:10,dir:"row",wrap:"nowrap",jc:"center",ai:"center"}},sm:{spc:{},lout:{of:"cover",disp:"flex"},flex:{gap:10,dir:"row",wrap:"nowrap",jc:"center",ai:"center"}}},clc:{},elems:[{t:13,style:{lg:{spc:{mb:5},size:{w:"70px",h:"auto"},lout:{of:"cover"}},sm:{spc:{mb:5},size:{w:"80px",h:"auto"},lout:{of:"cover"}}},src:"{{{ product.image_url }}}"},{t:4,style:{lg:{spc:{mb:10},lout:{of:"cover",disp:"flex"},flex:{gap:5,dir:"column",wrap:"nowrap",jc:"start",ai:"start"}},sm:{spc:{mb:10},lout:{of:"cover",disp:"flex"},flex:{gap:7,dir:"column",wrap:"nowrap",jc:"start",ai:"start"}}},clc:{},elems:[{t:14,style:{lg:{spc:{},size:{w:"auto",h:"auto"},typo:{italic:!1,bold:!1,lh:1.2,fs:13,tc:{h:"#313131",a:100},ta:0,fw:600,ls:0,fam:{name:"Arial",g:!0}}},sm:{spc:{},size:{w:"auto",h:"auto"},typo:{italic:!1,bold:!1,lh:1.2,fs:12,tc:{h:"#575757",a:100},ta:0,fw:500,ls:0,fam:{name:"Arial",g:!0}}}},text:"{{ product.name }}"},{t:4,style:{lg:{spc:{},lout:{of:"cover",disp:"flex"},flex:{gap:10,dir:"row",wrap:"nowrap",jc:"start",ai:"start"}},sm:{spc:{},lout:{of:"cover",disp:"flex"},flex:{gap:10,dir:"row",wrap:"nowrap",jc:"start",ai:"center"}}},clc:{},elems:[{t:2,style:{lg:{spc:{},typo:{italic:!1,bold:!1,lh:1.2,td:"line-through",fs:14,tc:{h:"#64748b",a:100},ta:1,fw:400,ls:0,fam:{name:"Arial",g:!0}}},sm:{spc:{},typo:{italic:!1,bold:!1,lh:1.2,td:"line-through",fs:12,tc:{h:"#64748b",a:100},ta:1,fw:400,ls:0,fam:{name:"Arial",g:!0}}}},text:"{{ product.compare_price }}"},{t:2,style:{lg:{spc:{},typo:{italic:!1,bold:!1,lh:1.2,fs:14,tc:{h:"#000000",a:100},ta:1,fw:500,ls:0,fam:{name:"Arial",g:!0}}},sm:{spc:{},typo:{italic:!1,bold:!1,lh:1.2,fs:13,tc:{h:"#000000",a:100},ta:1,fw:500,ls:0,fam:{name:"Arial",g:!0}}}},text:"{{ product.price }}"},{t:2,style:{lg:{spc:{p:0,pl:0,pr:0,pt:0,pb:0,m:0,ml:0,mr:10,mt:0,mb:0},typo:{italic:!1,bold:!1,lh:1.2,fs:18,tc:{h:"#64748b",a:100},ta:1,fw:600,ls:0}},sm:{spc:{p:0,m:0,mr:10},typo:{italic:!1,bold:!1,lh:1.2,fs:18,tc:{h:"#64748b",a:100},ta:1,fw:600,ls:0}}},hide:!0,text:"Save {{ product.discount_price }}",when:{lhs:"{{ product.discount_price }}",op:"gt",rhs:0}},{t:2,style:{lg:{spc:{p:0,pl:0,pr:0,pt:0,pb:0,m:0,ml:0,mr:10,mt:0,mb:0},typo:{italic:!1,bold:!1,lh:1.2,fs:12,tc:{h:"#0d8d00",a:100},ta:1,fw:400,ls:0,fam:{name:"DINNextRoundedLTPro-Medium"}}},sm:{spc:{p:0,m:0,mr:10},typo:{italic:!1,bold:!1,lh:1.2,fs:18,tc:{h:"#64748b",a:100},ta:1,fw:600,ls:0}}},hide:!0,text:"({{ product.discount_percent }}% off)",when:{lhs:"{{ product.discount_percent }}",op:"gt",rhs:0}}]},{t:4,style:{lg:{spc:{},lout:{of:"cover",disp:"flex"},flex:{gap:5,dir:"row",wrap:"nowrap",jc:"start",ai:"center"}},sm:{spc:{},lout:{of:"cover",disp:"flex"},flex:{gap:5,dir:"row",wrap:"nowrap",jc:"start",ai:"center"}}},clc:{},elems:[{t:3,style:{lg:{spc:{p:7,pl:7,pr:7,pt:7,pb:7},size:{w:"100%",h:"auto"},bg:{s:{h:"#000000",a:100}},br:{r:0,w:0,s:1,c:{a:100}},typo:{italic:!1,bold:!1,lh:1.2,fs:12,tc:{h:"#ffffff",a:100},ta:1,fw:400,ls:0,fam:{name:"Arial",g:!0}}},sm:{spc:{p:7,pl:7,pr:7,pt:8,pb:8},size:{w:"70%",h:"auto"},bg:{s:{h:"#000000",a:100}},br:{r:0,w:0,s:1,c:{a:100}},typo:{italic:!1,bold:!1,lh:1.2,fs:12,tc:{h:"#ffffff",a:100},ta:1,fw:400,ls:0,fam:{name:"Arial",g:!0}}}},text:"Add",clc:{at:102},allowedTypes:[102]}]}]}]}]}),_d=new Ve({t:2,style:{lg:{spc:{mb:15},typo:{italic:!1,bold:!1,lh:1.2,fs:16,tc:{h:"#333333",a:100},ta:1,fw:700,ls:.5,fam:{name:"Arial",g:!0}}},sm:{spc:{mb:15},typo:{italic:!1,bold:!1,lh:1.2,fs:16,tc:{h:"#333333",a:100},ta:1,fw:700,ls:.5,fam:{name:"Arial",g:!0}}}},text:"WATCH & SHOP - NEW LAUNCHES"});var Go=class extends De{render(){return M("div",{style:{marginTop:30},class:"lc-container",children:[M(Et,{element:_d,triggerContext:this.props.triggerContext}),M("div",{style:this.getComponentStyles(),children:this.props.triggerContext.triggerData.items.map(e=>{if(e.portraitVideos?.length)return M("div",{class:"lc-shoppable-video",style:{flex:"1 1 0",width:"260px"},children:[M("a",{href:e.link,onClick:()=>{this.sendTriggerClicked([new bt(e)],{from:"video"})},children:M("video",{width:"100%",autoplay:!0,muted:!0,loop:!0,children:this.getSources(e.portraitVideos[0].sources)})}),M(Hr,{element:vd,item:e,triggerContext:this.props.triggerContext})]})})})]})}getSources(e){let r=e.map(o=>M("source",{src:o.url,type:o.mimeType,media:`(max-width:${o.width}px)`})),n=e.filter(o=>o.format==="mp4").sort((o,s)=>s.width-o.width)[0];n&&r.push(M("source",{src:n.url,type:n.mimeType}));let i=e.filter(o=>o.format==="m3u8").sort((o,s)=>s.width-o.width)[0];return i&&r.push(M("source",{src:i.url,type:i.mimeType})),r}getComponentStyles(){return{display:"flex",gap:10,overflowX:"auto",margin:10}}};var sc=class extends xt{constructor(e){super(e)}shouldStopRendering(){return!1}renderContainer(){Qo(Ji(Go,{element:this.widget?.cont,triggerContext:this.triggerContext}),this.rootContainer)}};var ac=class extends xt{constructor(e){super(e)}shouldStopRendering(){return!1}renderContainer(){let e=this.getParentElement(`inner-letscooee-${this.engagementTrigger.shortID}`);this.rootContainer.appendChild(e),document.addEventListener(A.ADD_BUNDLE_CTA_INBOUND_EVENT,this.inboundCTAListener.bind(this),!1)}async inboundCTAListener(e){let r=this.engagementTrigger,n=`Engagement(id: ${r.engagementID}, shortID: ${r.shortID})`,i=e.detail;if(!kt.hasKeys(i)){w.error(`No detail received for ${n}`);return}w.log("Detail received for BYOB",i);let o=i.campaignID??i.campaignId??i.campaign_id;if(o!==r.shortID&&o!==r.engagementID){w.warn(`Current ${n} is not BYOB. Received: ${o}`);return}let s=i.items;if(!s?.length)return;let a=s.map(l=>new bt({mID:l.product_id,vID:l.variant_id,quantity:l.quantity||1}));await new Li(this.triggerContext).execute({embeddedItems:a,clickAction:{at:108,applyDiscount:!0}})}};var Ui=class{runtimeData=fe.get();processCartWidgetResponse(e){this.runtimeData.isCartDirty=!1,this.runtimeData.cartEngagements=e;let r=[...Rr.renderedEngagements];Rr.renderedEngagements.length=0;for(let n of e)w.log(`\u{1F4E3} ${n} received as cart embed`),!this.findAndUpdateCurrent(n,r)&&(w.log(`${n} is new`),n.isProgressBar()?new oc(n).renderSilently():n.isSubscriptionUpsell()?ic.renderCartUpsell(n):new Rr(n).renderSilently());this.removeOldWidgets(r)}processPageWidgetResponse(e){let r=[...xt.renderedEngagements];xt.renderedEngagements.length=0;for(let n of e)w.log(`\u{1F4E3} ${n} received as page embed`),!this.findAndUpdateCurrent(n,r)&&(w.log(`${n} is new`),n.isShoppableVideo()?new sc(n).renderSilently():n.isBYOB()?new ac(n).renderSilently():new xt(n).renderSilently());this.removeOldWidgets(r)}findAndUpdateCurrent(e,r){let n=r.findIndex(i=>i.isSameTrigger(e));return n<0||e.isSubscriptionUpsell()?!1:(r[n].update(e),r[n].renderSilently(),r.splice(n,1),!0)}removeOldWidgets(e){for(let r of e)r.destroy()}};var sr=class t{static INSTANCE;httpService=se.get(Tt);sessionManager=se.get(Ye);runtimeData=fe.get();loadWidgetsSubject=new ht;constructor(){this.loadWidgetsSubject.pipe(tr(300)).subscribe(()=>{this.loadCartWidgets().catch(e=>w.error("Unable to initiate cart widgets",e)),this.loadPageWidgets().catch(e=>w.error("Unable to initiate page widgets",e))}),Dr.get().subscriber(A.CART_UPDATE_BROADCAST).subscribe(()=>this.loadWidgetsSubject.next())}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}loadOrRenderWidgetsAfterCartChange(){this.runtimeData.isCartDirty?this.loadWidgetsSilently():this.renderCachedCartWidgets()}loadPageWidgetsSilently(){Ye.replaySubject.subscribe(async()=>{this.loadPageWidgets().catch(e=>w.error("Unable to initiate load page widgets",e))})}loadCartWidgetsSilently(){Ye.replaySubject.subscribe(async()=>{this.loadCartWidgets().catch(e=>w.error("Unable to initiate cart widgets",e))})}loadWidgetsSilently(){Ye.replaySubject.subscribe(async()=>{this.loadWidgetsSubject.next()})}async loadPageWidgets(){let e=await this.getWidgetProps();w.log("Load widgets",e),this.httpService.post("/v1/engagement/page-widgets",e).then(async r=>{let n=r.widgets.map(i=>new Pt(i));new Ui().processPageWidgetResponse(n)}).catch(r=>{w.error("Error sending widget getter",r)})}async loadCartWidgets(){let e=await this.getWidgetProps();w.log("Load cart widgets",e),this.httpService.post("/v1/engagement/cart-widgets",e).then(async r=>{let n=r.widgets.map(i=>new Pt(i));new Ui().processCartWidgetResponse(n)}).catch(r=>{w.error("Error sending widget getter",r)})}async getVariation(e){let r=await this.getWidgetProps();return this.httpService.post("/v1/engagement/get-variant",b(b({},e),r))}renderCachedCartWidgets(){new Ui().processCartWidgetResponse(this.runtimeData.cartEngagements)}async addSessionContext(e){let r=await this.sessionManager.checkSessionAndGetContext();e.sessionID=r[0],e.sessionNumber=r[1],e.landingPage=r[2],e.page=vr.parseFromCurrent()}addAvailableEngagementShortIDs(){let e=document.querySelectorAll(".letscooee-engagement"),r=[];return e.forEach(n=>{let i=n.dataset.engagementId;i&&+i&&r.push(i)}),r}async getWidgetProps(){let e={};e.engagementIDs=this.addAvailableEngagementShortIDs(),await this.addSessionContext(e),e.currentItem=this.runtimeData.getCurrentItem();try{e.cart=await ge.getCurrent().getNormalisedCart()}catch(o){w.error("Error fetching Shopify cart before sending widget call",o)}let r=new URLSearchParams(location.search),n=r.get("cooee-preview");n?e.previewIDs=n.trim().split(",").filter(o=>Number.isInteger(+o)):this.runtimeData.previewIDs?.length&&(e.previewIDs=this.runtimeData.previewIDs);let i=r.get("cooee-variant");return i?e.previewVariant=i:this.runtimeData.previewVariant&&(e.previewVariant=this.runtimeData.previewVariant),e}};var cc=class{runtimeData=fe.get();widgetAPIService=se.get(sr);meddle(){let e=Se.globalRef;e.account=e.account??[],e.profile=e.profile??[],e.events=e.events??[],e.screen=e.screen??[],e.page=e.page??[],this.meddlePage(),this.meddleAccount(),this.meddleEvents(),this.meddleProfile(),this.meddleScreen(),this.exposeMethods()}exposeMethods(){let e=Se.globalRef;e.loadPageWidgets=()=>{this.widgetAPIService.loadPageWidgetsSilently()},e.loadCartWidgets=()=>{this.widgetAPIService.loadCartWidgetsSilently()},e.previewWidget=Se.previewWidget.bind(Se),e.previewPopup=Se.previewPopup.bind(Se)}overwritePush(e,r){Xn(e,"push",r)}meddleAccount(){this.overwritePush(Se.globalRef.account,(...e)=>{this.processAccount(e[0])}),Se.globalRef.account.forEach(this.processAccount.bind(this))}meddleEvents(){this.overwritePush(Se.globalRef.events,(...e)=>{this.processEvent(e[0])}),Se.globalRef.events.forEach(this.processEvent.bind(this))}meddleProfile(){this.overwritePush(Se.globalRef.profile,(...e)=>{this.processProfile(e[0])}),Se.globalRef.profile.forEach(this.processProfile.bind(this))}meddleScreen(){this.overwritePush(Se.globalRef.screen,(...e)=>{this.processPageName(e[0])}),Se.globalRef.screen.forEach(this.processPageName.bind(this))}processAccount(e){e&&(e.appID&&Se.authenticate(e),e.flags&&An.setFlags(e.flags))}processEvent(e){e&&(A.JS_LOAD_WHITELIST_EVENTS.includes(e[0])?Se.sendEvent(e[0],e[1],this.runtimeData.jsLoadTime):Se.sendEvent(e[0],e[1]))}processProfile(e){e&&Se.updateProfile(e)}processPageName(e){e&&Se.setPageName(e)}meddlePage(){this.overwritePush(Se.globalRef.page,(...e)=>{this.processPage(e[0])}),Se.globalRef.page.forEach(this.processPage.bind(this))}processPage(e){e.currentItem&&this.runtimeData.setCurrentItem(e.currentItem),e.currency&&(this.runtimeData.currencyCode=e.currency),e.shopCurrency&&(this.runtimeData.shopCurrencyCode=e.shopCurrency),e.moneyFormat&&(this.runtimeData.moneyFormat=e.moneyFormat),e.jsLoad&&(this.runtimeData.jsLoadTime=e.jsLoad),e.pageName&&Se.setPageName(e.pageName)}};var Mi=class{static SESSION_STORAGE=window.sessionStorage;static SESSION_STORAGE_KEY_PREFIX=A.COOEE.concat("-");static getString(e,r){return this.getItem(e)||r}static setString(e,r){this.setItem(e,r)}static remove(e){this.removeItem(e)}static getItem(e){return this.SESSION_STORAGE.getItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e))}static setItem(e,r){this.SESSION_STORAGE.setItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e),r)}static removeItem(e){this.SESSION_STORAGE.removeItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e))}};var ki=class t{static INSTANCE;static DEBOUNCE_TIME=1e3;static THRESHOLD=10;safeHttpService=se.get(ue);_lastScreenOrScroll=new Date;lastPercent=0;constructor(){}set lastScreenOrScroll(e){this._lastScreenOrScroll=e}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}resetScrollID(e){Mi.remove(A.SESSION_STORAGE_SCROLL_ID),this.lastScreenOrScroll=e??new Date}listen(){if(window.scrollY){let e=this.getPercentScrolledY();this.shouldSendScroll(e)&&this.sendScroll(e)}ce.onDocumentLoaded(()=>{this.observeWindowScroll()})}observeWindowScroll(){En(window,"scroll").pipe(tr(t.DEBOUNCE_TIME),_n(()=>{let e=this.getPercentScrolledY();if(e>100){w.warn("Received scroll percent is more than 100",e);return}if(this.shouldSendScroll(e))return e})).subscribe(e=>{this.sendScroll(e)})}shouldSendScroll(e){return Math.abs(this.lastPercent-e)>=t.THRESHOLD||this.lastPercent!==e&&e===100}sendScroll(e){if(e==null)return;let r={percent:e,timeMS:new Date().getTime()-this._lastScreenOrScroll.getTime()};this.lastPercent=e;let n=Mi.getString(A.SESSION_STORAGE_SCROLL_ID,""),i=new ve(A.EVENT_SCROLL,r,null,n);this.safeHttpService.sendEvent(i),Mi.setString(A.SESSION_STORAGE_SCROLL_ID,i.id.toHexString()),this._lastScreenOrScroll=new Date(i.occurred)}getPercentScrolledY(){let e=window.document.body.scrollHeight,r=window.innerHeight;return Math.ceil((window.scrollY+r)/e*100)}};var lc=class t{static ACTIVE_DURATION="aDur";static INACTIVE_DURATION="iaDur";apiService=se.get(ue);runtimeData=fe.get();listen(){document.onvisibilitychange=()=>{document.visibilityState==="visible"?this.onVisible():document.visibilityState==="hidden"&&this.onHidden()}}async onVisible(){}async onHidden(){let e=await this.runtimeData.setInactive();if(e===0){w.info("Not sending background event as user was inactive on website");return}w.info(`Sending background event with ${e} seconds`);let r={};r[t.ACTIVE_DURATION]=e,this.apiService.sendEvent(new ve(A.EVENT_APP_BACKGROUND,r))}};var uc=class{compareCartItemSubject=new ht;constructor(){this.compareCartItemSubject.pipe(tr(100)).subscribe(this.compareCartItems.bind(this))}listen(){this.compareCartItemSubject.next(),this.overwriteXMLHttpRequest(),this.overwriteFetchMethod()}overwriteXMLHttpRequest(){let e=this,r=window.XMLHttpRequest.prototype.send;window.XMLHttpRequest.prototype.send=function(){return this.addEventListener("load",function(){e.performEvent(this._url).catch(n=>w.error("Unable to process cart change in XMLHttpRequest",n))}),r.apply(this,arguments)},w.debug("Securely overwritten window.XMLHttpRequest.send method")}overwriteFetchMethod(){let e=this,r=window.fetch;window.fetch=function(n){return r.apply(window,arguments).then(i=>(e.performEvent(n.toString()).catch(o=>w.error("Unable to process cart change in fetch",o)),i))},w.debug("Securely overwritten window.fetch method")}async performEvent(e){this.isCartManipulationURL(e)&&(fe.get().isCartDirty=!0,this.compareCartItemSubject.next())}isCartManipulationURL(e){return/\/cart\/(add|change|update|clear)/.test(e)}sendChangesAsEvents(e,r){let n=e?.items,i=r.items,o=[],s=[];if(w.debug(`Comparing cart change with old count ${n?.length} to new count ${i.length}`),i?.forEach(a=>{let l=n?.find(m=>m.vID===a.vID);if(l){if(l.quantity!==a.quantity){let m=l.quantity<a.quantity,p=Math.abs(l.quantity-a.quantity),f=Z(b({},a),{quantity:p});m?o.push(f):s.push(f)}n&&ce.removeFromArray(n,l)}else o.push(a)}),n)for(let a of n)s.push(a);w.debug(`Cart delta: added: ${o.length}, removed: ${s.length}`),o.length&&this.sendEvent(A.EVENT_ADD_TO_CART,{items:o}),s.length&&e.token===r.token&&this.sendEvent(A.EVENT_REMOVE_FROM_CART,{items:s}),(s.length||o.length)&&Dr.get().broadcast(A.CART_UPDATE_BROADCAST,{itemsAdded:o,itemsRemoved:s})}sendEvent(e,r){let n=new ve(e,r);se.get(ue).sendEvent(n)}async compareCartItems(){let e=await Ne.get(ne.CURRENT_CART,{}),r=await ge.getCurrent().getNormalisedCart(!0);this.sendChangesAsEvents(e,r)}};var pc=class{listen(){return this.overwriteFetchMethod(),this}overwriteFetchMethod(){let e=this,r=window.fetch;window.fetch=async function(n,i){try{await e.modifyRequest(n,i)}catch(o){Ue.getInstance().captureError("Failed to modify graphql request",o,{body:JSON.stringify(i?.body)})}return r(n,i)},w.debug("Securely overwritten window.fetch method for graphql query")}async modifyRequest(e,r){let n=typeof e=="string"?e:e instanceof Request?e.url:"";if(!(n.includes("graphql.json")&&r?.method==="POST")||!r.body)return;w.log("Intercepted fetch request of:",n);let i=typeof r.body=="string"?JSON.parse(r.body):r.body;i.query.includes("cartCreate")&&(r.body=await this.updatedBody(i),this.sendBuyNowEvent())}async updatedBody(e){let r=await Ne.get(ne.DEVICE_ID),n=await se.get(Ye).getCurrentSessionID(),i=e.variables.input.attributes??[],o=[{key:"letscooee_did",value:r},{key:"letscooee_sid",value:n},{key:"__letscooee_time",value:new Date().toLocaleString()},{key:"__letscooee_via",value:"Buy Now"}];return e.variables.input.attributes=[...i,...o],JSON.stringify(e)}sendBuyNowEvent(){let e=fe.get().getCurrentItem();if(!e)return;let r=new ve(A.EVENT_BUY_NOW_CLICKED,{items:[e]});ue.getInstance().sendEvent(r)}};var Fi=class{constructor(e,r){this.selectors=e;this.eventName=r;this.selectorString=e.join(",")}static INSTANCE;elements;selectorString;clickListenerCallback=e=>{let r=e.currentTarget,n=new ve(this.eventName,{class:r.className||void 0,tagName:r.tagName||void 0,id:r.id||void 0});ue.getInstance().sendEvent(n),this.removeClickListener(this.clickListenerCallback)};listenSilently(){this.listen().catch(e=>w.error(e))}async listen(){this.elements=await ce.retrySelectorForElements(this.selectorString),this.elements.forEach(e=>{e.addEventListener("click",this.clickListenerCallback)})}removeClickListener(e){this.elements?.forEach(r=>{r.removeEventListener("click",e)})}};var fc=class t extends Fi{static selectors=[".product__thumbnail-list-inner > button","product-gallery-navigation > button",".product-media--thumb-container",".product-images-inner > img",".m-product-media",".swiper-button-control",".media__thumb",".slick-arrow",".productView-img-container.product-single__media",".product-gallery__thumbnail_item_inner"];constructor(){super(t.selectors,A.EVENT_ITEM_THUMBNAIL_CLICKED)}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}};var mc=class t extends Fi{static selectors=[".jdgm-widget.jdgm-preview-badge.jdgm-preview-badge--with-link.jdgm--done-setup","reviewsio-product-ratings",".ruk_rating_snippet.tracked:not(.hidden)","a > .loox-rating",".yotpo-reviews-star-ratings-widget",".yotpo.lp-hero__reviews",".pr-rating > a",".rivyoReviewWidget"];constructor(){super(t.selectors,A.EVENT_REVIEW_CLICKED)}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}};var dc=class{selector=[".gokwik-checkout button","button.cart__checkout-button","button.cart__checkout","button#checkout","button#checkout2",'button[id*="checkout" i]','button[name*="checkout" i]','button[class*="checkout" i]'].join(",");listen(){ce.onDocumentLoaded(()=>{w.debug("Execution order:","document ready"),this.useLocationHash()})}useLocationHash(){let e=window.location.hash?.substring(1);if(e)if(e.includes(A.HASH_INITIATE_CHECKOUT)){document.dispatchEvent(new Event(A.THIRD_PARTY_CHECKOUT_EVENT));let r=document.querySelector(this.selector);if(!r){w.debug("No clickable cart checkout button found");return}w.debug("Clickable cart checkout button found",r),r.click()}else e.includes(A.HASH_OPEN_CART_DRAWER)&&et.get().open()}};var hc=class{trackSilently(){this.track().catch(e=>Ue.getInstance().captureException(e))}async track(){let e=window.Shopify?.checkout,r=window.Shopify?.Checkout;if(!e&&!r)return;let n={};this.processSmallCheckout(e,n),this.processBigCheckout(r,n);let i=this.getTokenFromCurrentURLPath();if(i&&(n.urlToken=i),!Object.keys(n).length){w.warn("No processable data found in",e,r);return}n.referrer=document.referrer,n.url=location.href;let o=await se.get(Ye).checkSessionAndGetContext();n.sessionID=o[0],this.trackOrder(n)}processSmallCheckout(e,r){e&&(e.order_id&&(r.orderID=e.order_id.toString()),e.token&&(r.checkoutToken=e.token.toString()),e.customer_id&&(r.customerID=e.customer_id.toString()))}processBigCheckout(e,r){e&&(e.token&&!r.checkoutToken&&(r.checkoutToken=e.token.toString()),e.cartToken&&(r.cartToken=e.cartToken.toString()))}trackOrder(e){w.info("Found order to be send",e),ue.getInstance().trackOrder(e)}getTokenFromCurrentURLPath(){let e=new RegExp("[A-Fa-f0-9]{28,32}");return location.pathname?.split("/").find(r=>r.length&&e.test(r))}};var Vo=class{static attachCheckoutListener(){window.gokwikSdk&&window.gokwikSdk.on("checkout_initiated",async()=>{let e=await ge.getCurrent().getNormalisedCart(),r={via:"GoKwik",items:e.items,cartToken:e.token,amount:{value:e.amount,currency:e.currency}},n=new ve(A.EVENT_CHECKOUT_STARTED,r);ue.getInstance().sendEvent(n)})}};var gc=class{async migrate(){}};Zt.escape=np.escapeHtml;var Se=class{static globalRef;static authenticated;static async initForMerchantWebsiteOnly(){window.cooeeSDKPreview||(this.initGlobalReference(),await new gc().migrate(),this.autoAuthenticate(),new cc().meddle(),new lc().listen(),new hc().trackSilently(),new Mr().listen(),new uc().listen(),new pc().listen(),new dc().listen(),se.get(ki).listen(),se.get(mc).listenSilently(),se.get(fc).listenSilently(),se.get(sr).loadPageWidgetsSilently(),this.attachGoKwikListeners(),this.storePreviewParams(),this.setupPreviewListeners(),Kt.watch())}static async initForAll(){this.injectWidgetAssets()}static initGlobalReference(){window.CooeeSDK||Xn(window,"CooeeSDK",{}),this.globalRef=window.CooeeSDK,Xn(this.globalRef,"config",new qe),Xn(this.globalRef,"runtimeData",new fe),w.debug("Global reference initialised")}static injectWidgetAssets(){if(document.currentScript.src.indexOf("localhost")){let r="http://localhost:8002";It.injectScriptURL(`${r}/main.js`),It.injectStylesheet(`${r}/styles.css`)}else{let n=`https://cdn.jsdelivr.net/npm/@letscooee/web-sdk@${A.SDK_VERSION}`;It.injectScriptURL(`${n}/dist/widget-sdk.min.js`,"cooee-widget-sdk"),It.injectStylesheet(`${n}/dist/widget-sdk.min.css`)}}static autoAuthenticate(){let e=Oe.getShopName();e&&this.authenticate({shopifyShop:e})}static authenticate(e){if(this.authenticated)return;let r=e.appID?.trim(),n=e.shopifyShop;if((ce.isNull(r)||r.length!==24)&&ce.isNull(n)){w.warn("Cooee App ID or Shop name is not configured");return}this.authenticated=!0,se.get(Ye).init(e)}static sendEvent(e,r,n){for(let o in r)if(o.length>3&&o.toLowerCase().startsWith("ce "))throw new Error("Event property name cannot start with 'CE '");let i=new ve(e,r);i.occurred=n??new Date,se.get(ue).sendEvent(i)}static updateProfile(e){for(let r in e)if(r.toLowerCase().startsWith("ce "))throw new Error("User property name cannot start with 'CE '");se.get(ue).updateProfile(e)}static setPageName(e){if(!e)return;let r=fe.get(),n=r.pageName;if(e===n)return;if(r.pageName=e,e==="cart"&&se.get(sr).loadOrRenderWidgetsAfterCartChange(),A.BLACKLISTED_PAGE_NAMES.some(s=>e.includes(s))){se.get(ki).resetScrollID();return}let i={};n&&(i.ps=n);let o=new ve(A.EVENT_SCREEN_VIEW,i);o.occurred=r.jsLoadTime,se.get(ue).sendEvent(o),se.get(ki).resetScrollID(o.occurred)}static previewPopup(e,r){new Ai(r).render(e)}static previewWidget(e){new xt(new Pt(e)).render()}static setupPreviewListeners(){if(window.opener){try{window.opener.postMessage({action:"COOEE_READY_FOR_PREVIEW"},"*")}catch(e){w.error(e)}window.addEventListener("message",e=>{if(w.debug("Received event",e),!e.origin.includes("letscooee.com")&&!e.origin.includes("localhost"))return;let r=e.data;typeof r=="object"&&(r.action==="POPUP_PREVIEW"?(this.previewPopup(r.engagementTrigger),e.source?.postMessage({action:"PREVIEW_SUCCESSFUL"},e.origin)):r.action==="WIDGET_PREVIEW"&&(this.previewWidget(r.engagementTrigger),e.source?.postMessage({action:"PREVIEW_SUCCESSFUL"},e.origin)))})}}static attachGoKwikListeners(){let e=fe.get();window.addEventListener("kp-modal:opened",()=>{e.isGoKwikPopupOpen=!0}),window.addEventListener("user-loggedin",r=>{let{token:n}=r.detail;n&&this.updateProfile({goKwikToken:n})}),window.gokwikSdk?Vo.attachCheckoutListener():window.addEventListener("gokwikLoaded",Vo.attachCheckoutListener)}static storePreviewParams(){let e=fe.get(),r=new URLSearchParams(location.search),n=r.get("cooee-preview");n&&(e.previewIDs=n.trim().split(",").filter(o=>Number.isInteger(+o)));let i=r.get("cooee-variant");i&&(e.previewVariant=i)}};w.configure();w.logBrand();w.debug("Execution order:","top");window.cooeeShopifyScriptLoaded||(window.cooeeShopifyScriptLoaded=!0,(async()=>(w.debug("Execution order:","IIFE start"),await Se.initForMerchantWebsiteOnly(),await Se.initForAll(),w.debug("Execution order:","IIFE end")))());w.debug("Execution order:","bottom");
|