@letscooee/web-sdk 9.3.27 → 9.3.29
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/dist/analytics-sdk.min.js +33 -33
- package/dist/widget-sdk.min.js +32 -32
- package/package.json +3 -3
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
"use strict";(()=>{var sh=Object.create,xc=Object.defineProperty,ah=Object.defineProperties,ch=Object.getOwnPropertyDescriptor,lh=Object.getOwnPropertyDescriptors,uh=Object.getOwnPropertyNames,tp=Object.getOwnPropertySymbols,ph=Object.getPrototypeOf,np=Object.prototype.hasOwnProperty,fh=Object.prototype.propertyIsEnumerable,rp=(t,e,r)=>e in t?xc(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,w=(t,e)=>{for(var r in e||={})np.call(e,r)&&rp(t,r,e[r]);if(tp)for(var r of tp(e))fh.call(e,r)&&rp(t,r,e[r]);return t},Z=(t,e)=>ah(t,lh(e)),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')}),Vi=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),mh=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of uh(e))!np.call(t,i)&&i!==r&&xc(t,i,{get:()=>e[i],enumerable:!(n=ch(e,i))||n.enumerable});return t},Zt=(t,e,r)=>(r=t!=null?sh(ph(t)):{},mh(e||!t||!t.__esModule?xc(r,"default",{value:t,enumerable:!0}):r,t)),tn=Vi((t,e)=>{"use strict";(function(r){"use strict";var n={};n.VERSION="1.6.1";var i,s={},o=function(h,v){return function(){return v.apply(h,arguments)}},c=function(){var h=arguments,v=h[0],_,g;for(g=1;g<h.length;g++)for(_ in h[g])!(_ in v)&&h[g].hasOwnProperty(_)&&(v[_]=h[g][_]);return v},u=function(h,v){return{value:h,name:v}};n.TRACE=u(1,"TRACE"),n.DEBUG=u(2,"DEBUG"),n.INFO=u(3,"INFO"),n.TIME=u(4,"TIME"),n.WARN=u(5,"WARN"),n.ERROR=u(8,"ERROR"),n.OFF=u(99,"OFF");var d=function(h){this.context=h,this.setLevel(h.filterLevel),this.log=this.info};d.prototype={setLevel:function(h){h&&"value"in h&&(this.context.filterLevel=h)},getLevel:function(){return this.context.filterLevel},enabledFor:function(h){var v=this.context.filterLevel;return h.value>=v.value},trace:function(){this.invoke(n.TRACE,arguments)},debug:function(){this.invoke(n.DEBUG,arguments)},info:function(){this.invoke(n.INFO,arguments)},warn:function(){this.invoke(n.WARN,arguments)},error:function(){this.invoke(n.ERROR,arguments)},time:function(h){typeof h=="string"&&h.length>0&&this.invoke(n.TIME,[h,"start"])},timeEnd:function(h){typeof h=="string"&&h.length>0&&this.invoke(n.TIME,[h,"end"])},invoke:function(h,v){i&&this.enabledFor(h)&&i(v,c({level:h},this.context))}};var m=new d({filterLevel:n.OFF});(function(){var h=n;h.enabledFor=o(m,m.enabledFor),h.trace=o(m,m.trace),h.debug=o(m,m.debug),h.time=o(m,m.time),h.timeEnd=o(m,m.timeEnd),h.info=o(m,m.info),h.warn=o(m,m.warn),h.error=o(m,m.error),h.log=h.info})(),n.setHandler=function(h){i=h},n.setLevel=function(h){m.setLevel(h);for(var v in s)s.hasOwnProperty(v)&&s[v].setLevel(h)},n.getLevel=function(){return m.getLevel()},n.get=function(h){return s[h]||(s[h]=new d(c({name:h},m.context)))},n.createDefaultHandler=function(h){h=h||{},h.formatter=h.formatter||function(g,y){y.name&&g.unshift("["+y.name+"]")};var v={},_=function(g,y){Function.prototype.apply.call(g,console,y)};return typeof console>"u"?function(){}:function(g,y){g=Array.prototype.slice.call(g);var C=console.log,O;y.level===n.TIME?(O=(y.name?"["+y.name+"] ":"")+g[0],g[1]==="start"?console.time?console.time(O):v[O]=new Date().getTime():console.timeEnd?console.timeEnd(O):_(C,[O+": "+(new Date().getTime()-v[O])+"ms"])):(y.level===n.WARN&&console.warn?C=console.warn:y.level===n.ERROR&&console.error?C=console.error:y.level===n.INFO&&console.info?C=console.info:y.level===n.DEBUG&&console.debug?C=console.debug:y.level===n.TRACE&&console.trace&&(C=console.trace),h.formatter(g,y),_(C,g))}},n.useDefaults=function(h){n.setLevel(h&&h.defaultLevel||n.DEBUG),n.setHandler(n.createDefaultHandler(h))},n.setDefaults=n.useDefaults,typeof define=="function"&&define.amd?define(n):typeof e<"u"&&e.exports?e.exports=n:(n._prevLogger=r.Logger,n.noConflict=function(){return r.Logger=n._prevLogger,n},r.Logger=n)})(t)}),kp=Vi((t,e)=>{"use strict";(function(r,n){"use strict";var i="1.0.40",s="",o="?",c="function",u="undefined",d="object",m="string",h="major",v="model",_="name",g="type",y="vendor",C="version",O="architecture",H="console",L="mobile",P="tablet",V="smarttv",kt="wearable",fe="embedded",j=500,ct="Amazon",Y="Apple",at="ASUS",Qt="BlackBerry",ge="Browser",de="Chrome",xe="Edge",be="Firefox",Ut="Google",De="Huawei",ht="LG",Q="Microsoft",we="Motorola",cr="Opera",jr="Samsung",Ue="Sharp",en="Sony",Hn="Xiaomi",kn="Zebra",Hi="Facebook",Wi="Chromium OS",ji="Mac OS",Mn=" Browser",je=function(G,dt){var J={};for(var se in G)dt[se]&&dt[se].length%2===0?J[se]=dt[se].concat(G[se]):J[se]=G[se];return J},$r=function(G){for(var dt={},J=0;J<G.length;J++)dt[G[J].toUpperCase()]=G[J];return dt},is=function(G,dt){return typeof G===m?a(dt).indexOf(a(G))!==-1:!1},a=function(G){return G.toLowerCase()},l=function(G){return typeof G===m?G.replace(/[^\d\.]/g,s).split(".")[0]:n},p=function(G,dt){if(typeof G===m)return G=G.replace(/^\s\s*/,s),typeof dt===u?G:G.substring(0,j)},I=function(G,dt){for(var J=0,se,He,Fe,re,X,We;J<dt.length&&!X;){var to=dt[J],ga=dt[J+1];for(se=He=0;se<to.length&&!X&&to[se];)if(X=to[se++].exec(G),X)for(Fe=0;Fe<ga.length;Fe++)We=X[++He],re=ga[Fe],typeof re===d&&re.length>0?re.length===2?typeof re[1]==c?this[re[0]]=re[1].call(this,We):this[re[0]]=re[1]:re.length===3?typeof re[1]===c&&!(re[1].exec&&re[1].test)?this[re[0]]=We?re[1].call(this,We,re[2]):n:this[re[0]]=We?We.replace(re[1],re[2]):n:re.length===4&&(this[re[0]]=We?re[3].call(this,We.replace(re[1],re[2])):n):this[re]=We||n;J+=2}},A=function(G,dt){for(var J in dt)if(typeof dt[J]===d&&dt[J].length>0){for(var se=0;se<dt[J].length;se++)if(is(dt[J][se],G))return J===o?n:J}else if(is(dt[J],G))return J===o?n:J;return dt.hasOwnProperty("*")?dt["*"]:G},M={"1.0":"/8","1.2":"/1","1.3":"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"},W={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2","8.1":"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},te={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[C,[_,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[C,[_,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[_,C],[/opios[\/ ]+([\w\.]+)/i],[C,[_,cr+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[C,[_,cr+" GX"]],[/\bopr\/([\w\.]+)/i],[C,[_,cr]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[C,[_,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[C,[_,"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],[_,C],[/quark(?:pc)?\/([-\w\.]+)/i],[C,[_,"Quark"]],[/\bddg\/([\w\.]+)/i],[C,[_,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[C,[_,"UC"+ge]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[C,[_,"WeChat"]],[/konqueror\/([\w\.]+)/i],[C,[_,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[C,[_,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[C,[_,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[C,[_,"Smart Lenovo "+ge]],[/(avast|avg)\/([\w\.]+)/i],[[_,/(.+)/,"$1 Secure "+ge],C],[/\bfocus\/([\w\.]+)/i],[C,[_,be+" Focus"]],[/\bopt\/([\w\.]+)/i],[C,[_,cr+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[C,[_,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[C,[_,"Dolphin"]],[/coast\/([\w\.]+)/i],[C,[_,cr+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[C,[_,"MIUI"+Mn]],[/fxios\/([\w\.-]+)/i],[C,[_,be]],[/\bqihoobrowser\/?([\w\.]*)/i],[C,[_,"360"]],[/\b(qq)\/([\w\.]+)/i],[[_,/(.+)/,"$1Browser"],C],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[_,/(.+)/,"$1"+Mn],C],[/samsungbrowser\/([\w\.]+)/i],[C,[_,jr+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[C,[_,"Sogou Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[_,"Sogou Mobile"],C],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[_,C],[/(lbbrowser|rekonq)/i,/\[(linkedin)app\]/i],[_],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[C,_],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[_,Hi],C],[/(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],[_,C],[/\bgsa\/([\w\.]+) .*safari\//i],[C,[_,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[C,[_,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[C,[_,de+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[_,de+" WebView"],C],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[C,[_,"Android "+ge]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[_,C],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[C,[_,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[C,_],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[_,[C,A,M]],[/(webkit|khtml)\/([\w\.]+)/i],[_,C],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[_,"Netscape"],C],[/(wolvic|librewolf)\/([\w\.]+)/i],[_,C],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[C,[_,be+" 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],[_,[C,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[_,[C,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[O,"amd64"]],[/(ia32(?=;))/i],[[O,a]],[/((?:i[346]|x)86)[;\)]/i],[[O,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[O,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[O,"armhf"]],[/windows (ce|mobile); ppc;/i],[[O,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[O,/ower/,s,a]],[/(sun4\w)[;\)]/i],[[O,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[O,a]]],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],[v,[y,jr],[g,P]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr])[-\w]+)/i,/sec-(sgh\w+)/i],[v,[y,jr],[g,L]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[v,[y,Y],[g,L]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[v,[y,Y],[g,P]],[/(macintosh);/i],[v,[y,Y]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[v,[y,Ue],[g,L]],[/(?:honor)([-\w ]+)[;\)]/i],[v,[y,"Honor"],[g,L]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[v,[y,De],[g,P]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[v,[y,De],[g,L]],[/\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],[[v,/_/g," "],[y,Hn],[g,L]],[/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[v,/_/g," "],[y,Hn],[g,P]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[v,[y,"OPPO"],[g,L]],[/\b(opd2\d{3}a?) bui/i],[v,[y,"OPPO"],[g,P]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[v,[y,"Vivo"],[g,L]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[v,[y,"Realme"],[g,L]],[/\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],[v,[y,we],[g,L]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[v,[y,we],[g,P]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[v,[y,ht],[g,P]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[v,[y,ht],[g,L]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[v,[y,"Lenovo"],[g,P]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[v,/_/g," "],[y,"Nokia"],[g,L]],[/(pixel c)\b/i],[v,[y,Ut],[g,P]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[v,[y,Ut],[g,L]],[/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],[v,[y,en],[g,L]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[v,"Xperia Tablet"],[y,en],[g,P]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[v,[y,"OnePlus"],[g,L]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[v,[y,ct],[g,P]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[v,/(.+)/g,"Fire Phone $1"],[y,ct],[g,L]],[/(playbook);[-\w\),; ]+(rim)/i],[v,y,[g,P]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[v,[y,Qt],[g,L]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[v,[y,at],[g,P]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[v,[y,at],[g,L]],[/(nexus 9)/i],[v,[y,"HTC"],[g,P]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[y,[v,/_/g," "],[g,L]],[/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],[v,[y,"TCL"],[g,P]],[/(itel) ((\w+))/i],[[y,a],v,[g,A,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[v,[y,"Acer"],[g,P]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[v,[y,"Meizu"],[g,L]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[v,[y,"Ulefone"],[g,L]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[v,[y,"Energizer"],[g,L]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[v,[y,"Cat"],[g,L]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[v,[y,"Smartfren"],[g,L]],[/droid.+; (a(?:015|06[35]|142p?))/i],[v,[y,"Nothing"],[g,L]],[/(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],[y,v,[g,L]],[/(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],[y,v,[g,P]],[/(surface duo)/i],[v,[y,Q],[g,P]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[v,[y,"Fairphone"],[g,L]],[/(u304aa)/i],[v,[y,"AT&T"],[g,L]],[/\bsie-(\w*)/i],[v,[y,"Siemens"],[g,L]],[/\b(rct\w+) b/i],[v,[y,"RCA"],[g,P]],[/\b(venue[\d ]{2,7}) b/i],[v,[y,"Dell"],[g,P]],[/\b(q(?:mv|ta)\w+) b/i],[v,[y,"Verizon"],[g,P]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[v,[y,"Barnes & Noble"],[g,P]],[/\b(tm\d{3}\w+) b/i],[v,[y,"NuVision"],[g,P]],[/\b(k88) b/i],[v,[y,"ZTE"],[g,P]],[/\b(nx\d{3}j) b/i],[v,[y,"ZTE"],[g,L]],[/\b(gen\d{3}) b.+49h/i],[v,[y,"Swiss"],[g,L]],[/\b(zur\d{3}) b/i],[v,[y,"Swiss"],[g,P]],[/\b((zeki)?tb.*\b) b/i],[v,[y,"Zeki"],[g,P]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[y,"Dragon Touch"],v,[g,P]],[/\b(ns-?\w{0,9}) b/i],[v,[y,"Insignia"],[g,P]],[/\b((nxa|next)-?\w{0,9}) b/i],[v,[y,"NextBook"],[g,P]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[y,"Voice"],v,[g,L]],[/\b(lvtel\-)?(v1[12]) b/i],[[y,"LvTel"],v,[g,L]],[/\b(ph-1) /i],[v,[y,"Essential"],[g,L]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[v,[y,"Envizen"],[g,P]],[/\b(trio[-\w\. ]+) b/i],[v,[y,"MachSpeed"],[g,P]],[/\btu_(1491) b/i],[v,[y,"Rotor"],[g,P]],[/(shield[\w ]+) b/i],[v,[y,"Nvidia"],[g,P]],[/(sprint) (\w+)/i],[y,v,[g,L]],[/(kin\.[onetw]{3})/i],[[v,/\./g," "],[y,Q],[g,L]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[v,[y,kn],[g,P]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[v,[y,kn],[g,L]],[/smart-tv.+(samsung)/i],[y,[g,V]],[/hbbtv.+maple;(\d+)/i],[[v,/^/,"SmartTV"],[y,jr],[g,V]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[y,ht],[g,V]],[/(apple) ?tv/i],[y,[v,Y+" TV"],[g,V]],[/crkey/i],[[v,de+"cast"],[y,Ut],[g,V]],[/droid.+aft(\w+)( bui|\))/i],[v,[y,ct],[g,V]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[v,[y,Ue],[g,V]],[/(bravia[\w ]+)( bui|\))/i],[v,[y,en],[g,V]],[/(mitv-\w{5}) bui/i],[v,[y,Hn],[g,V]],[/Hbbtv.*(technisat) (.*);/i],[y,v,[g,V]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[y,p],[v,p],[g,V]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[g,V]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[y,v,[g,H]],[/droid.+; (shield) bui/i],[v,[y,"Nvidia"],[g,H]],[/(playstation [345portablevi]+)/i],[v,[y,en],[g,H]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[v,[y,Q],[g,H]],[/\b(sm-[lr]\d\d[05][fnuw]?s?)\b/i],[v,[y,jr],[g,kt]],[/((pebble))app/i],[y,v,[g,kt]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[v,[y,Y],[g,kt]],[/droid.+; (glass) \d/i],[v,[y,Ut],[g,kt]],[/droid.+; (wt63?0{2,3})\)/i],[v,[y,kn],[g,kt]],[/droid.+; (glass) \d/i],[v,[y,Ut],[g,kt]],[/(pico) (4|neo3(?: link|pro)?)/i],[y,v,[g,kt]],[/; (quest( \d| pro)?)/i],[v,[y,Hi],[g,kt]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[y,[g,fe]],[/(aeobc)\b/i],[v,[y,ct],[g,fe]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[v,[g,L]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[v,[g,P]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[g,P]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[g,L]],[/(android[-\w\. ]{0,9});.+buil/i],[v,[y,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[C,[_,xe+"HTML"]],[/(arkweb)\/([\w\.]+)/i],[_,C],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[C,[_,"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],[_,C],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[C,_]],os:[[/microsoft (windows) (vista|xp)/i],[_,C],[/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i],[_,[C,A,W]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[C,A,W],[_,"Windows"]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[C,/_/g,"."],[_,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[_,ji],[C,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[C,_],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish|openharmony)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[_,C],[/\(bb(10);/i],[C,[_,Qt]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[C,[_,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[C,[_,be+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[C,[_,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[C,[_,"watchOS"]],[/crkey\/([\d\.]+)/i],[C,[_,de+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[_,Wi],C],[/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],[_,C],[/(sunos) ?([\w\.\d]*)/i],[[_,"Solaris"],C],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[_,C]]},Tt=function(G,dt){if(typeof G===d&&(dt=G,G=n),!(this instanceof Tt))return new Tt(G,dt).getResult();var J=typeof r!==u&&r.navigator?r.navigator:n,se=G||(J&&J.userAgent?J.userAgent:s),He=J&&J.userAgentData?J.userAgentData:n,Fe=dt?je(te,dt):te,re=J&&J.userAgent==se;return this.getBrowser=function(){var X={};return X[_]=n,X[C]=n,I.call(X,se,Fe.browser),X[h]=l(X[C]),re&&J&&J.brave&&typeof J.brave.isBrave==c&&(X[_]="Brave"),X},this.getCPU=function(){var X={};return X[O]=n,I.call(X,se,Fe.cpu),X},this.getDevice=function(){var X={};return X[y]=n,X[v]=n,X[g]=n,I.call(X,se,Fe.device),re&&!X[g]&&He&&He.mobile&&(X[g]=L),re&&X[v]=="Macintosh"&&J&&typeof J.standalone!==u&&J.maxTouchPoints&&J.maxTouchPoints>2&&(X[v]="iPad",X[g]=P),X},this.getEngine=function(){var X={};return X[_]=n,X[C]=n,I.call(X,se,Fe.engine),X},this.getOS=function(){var X={};return X[_]=n,X[C]=n,I.call(X,se,Fe.os),re&&!X[_]&&He&&He.platform&&He.platform!="Unknown"&&(X[_]=He.platform.replace(/chrome os/i,Wi).replace(/macos/i,ji)),X},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 se},this.setUA=function(X){return se=typeof X===m&&X.length>j?p(X,j):X,this},this.setUA(se),this};Tt.VERSION=i,Tt.BROWSER=$r([_,C,h]),Tt.CPU=$r([O]),Tt.DEVICE=$r([v,y,g,H,L,V,P,kt,fe]),Tt.ENGINE=Tt.OS=$r([_,C]),typeof t!==u?(typeof e!==u&&e.exports&&(t=e.exports=Tt),t.UAParser=Tt):typeof define===c&&define.amd?define(function(){return Tt}):typeof r!==u&&(r.UAParser=Tt);var Dt=typeof r!==u&&(r.jQuery||r.Zepto);if(Dt&&!Dt.ua){var ce=new Tt;Dt.ua=ce.getResult(),Dt.ua.get=function(){return ce.getUA()},Dt.ua.set=function(G){ce.setUA(G);var dt=ce.getResult();for(var J in dt)Dt.ua[J]=dt[J]}}})(typeof window=="object"?window:t)}),Hp=Vi((t,e)=>{"use strict";(function(r){if(typeof t=="object"&&typeof e<"u")e.exports=r();else if(typeof define=="function"&&define.amd)define([],r);else{var n;typeof window<"u"?n=window:typeof global<"u"?n=global:typeof self<"u"?n=self:n=this,n.localforage=r()}})(function(){var r,n,i;return function s(o,c,u){function d(v,_){if(!c[v]){if(!o[v]){var g=typeof Gi=="function"&&Gi;if(!_&&g)return g(v,!0);if(m)return m(v,!0);var y=new Error("Cannot find module '"+v+"'");throw y.code="MODULE_NOT_FOUND",y}var C=c[v]={exports:{}};o[v][0].call(C.exports,function(O){var H=o[v][1][O];return d(H||O)},C,C.exports,s,o,c,u)}return c[v].exports}for(var m=typeof Gi=="function"&&Gi,h=0;h<u.length;h++)d(u[h]);return d}({1:[function(s,o,c){(function(u){"use strict";var d=u.MutationObserver||u.WebKitMutationObserver,m;if(d){var h=0,v=new d(O),_=u.document.createTextNode("");v.observe(_,{characterData:!0}),m=function(){_.data=h=++h%2}}else if(!u.setImmediate&&typeof u.MessageChannel<"u"){var g=new u.MessageChannel;g.port1.onmessage=O,m=function(){g.port2.postMessage(0)}}else"document"in u&&"onreadystatechange"in u.document.createElement("script")?m=function(){var L=u.document.createElement("script");L.onreadystatechange=function(){O(),L.onreadystatechange=null,L.parentNode.removeChild(L),L=null},u.document.documentElement.appendChild(L)}:m=function(){setTimeout(O,0)};var y,C=[];function O(){y=!0;for(var L,P,V=C.length;V;){for(P=C,C=[],L=-1;++L<V;)P[L]();V=C.length}y=!1}o.exports=H;function H(L){C.push(L)===1&&!y&&m()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(s,o,c){"use strict";var u=s(1);function d(){}var m={},h=["REJECTED"],v=["FULFILLED"],_=["PENDING"];o.exports=g;function g(j){if(typeof j!="function")throw new TypeError("resolver must be a function");this.state=_,this.queue=[],this.outcome=void 0,j!==d&&H(this,j)}g.prototype.catch=function(j){return this.then(null,j)},g.prototype.then=function(j,ct){if(typeof j!="function"&&this.state===v||typeof ct!="function"&&this.state===h)return this;var Y=new this.constructor(d);if(this.state!==_){var at=this.state===v?j:ct;C(Y,at,this.outcome)}else this.queue.push(new y(Y,j,ct));return Y};function y(j,ct,Y){this.promise=j,typeof ct=="function"&&(this.onFulfilled=ct,this.callFulfilled=this.otherCallFulfilled),typeof Y=="function"&&(this.onRejected=Y,this.callRejected=this.otherCallRejected)}y.prototype.callFulfilled=function(j){m.resolve(this.promise,j)},y.prototype.otherCallFulfilled=function(j){C(this.promise,this.onFulfilled,j)},y.prototype.callRejected=function(j){m.reject(this.promise,j)},y.prototype.otherCallRejected=function(j){C(this.promise,this.onRejected,j)};function C(j,ct,Y){u(function(){var at;try{at=ct(Y)}catch(Qt){return m.reject(j,Qt)}at===j?m.reject(j,new TypeError("Cannot resolve promise with itself")):m.resolve(j,at)})}m.resolve=function(j,ct){var Y=L(O,ct);if(Y.status==="error")return m.reject(j,Y.value);var at=Y.value;if(at)H(j,at);else{j.state=v,j.outcome=ct;for(var Qt=-1,ge=j.queue.length;++Qt<ge;)j.queue[Qt].callFulfilled(ct)}return j},m.reject=function(j,ct){j.state=h,j.outcome=ct;for(var Y=-1,at=j.queue.length;++Y<at;)j.queue[Y].callRejected(ct);return j};function O(j){var ct=j&&j.then;if(j&&(typeof j=="object"||typeof j=="function")&&typeof ct=="function")return function(){ct.apply(j,arguments)}}function H(j,ct){var Y=!1;function at(xe){Y||(Y=!0,m.reject(j,xe))}function Qt(xe){Y||(Y=!0,m.resolve(j,xe))}function ge(){ct(Qt,at)}var de=L(ge);de.status==="error"&&at(de.value)}function L(j,ct){var Y={};try{Y.value=j(ct),Y.status="success"}catch(at){Y.status="error",Y.value=at}return Y}g.resolve=P;function P(j){return j instanceof this?j:m.resolve(new this(d),j)}g.reject=V;function V(j){var ct=new this(d);return m.reject(ct,j)}g.all=kt;function kt(j){var ct=this;if(Object.prototype.toString.call(j)!=="[object Array]")return this.reject(new TypeError("must be an array"));var Y=j.length,at=!1;if(!Y)return this.resolve([]);for(var Qt=new Array(Y),ge=0,de=-1,xe=new this(d);++de<Y;)be(j[de],de);return xe;function be(Ut,De){ct.resolve(Ut).then(ht,function(Q){at||(at=!0,m.reject(xe,Q))});function ht(Q){Qt[De]=Q,++ge===Y&&!at&&(at=!0,m.resolve(xe,Qt))}}}g.race=fe;function fe(j){var ct=this;if(Object.prototype.toString.call(j)!=="[object Array]")return this.reject(new TypeError("must be an array"));var Y=j.length,at=!1;if(!Y)return this.resolve([]);for(var Qt=-1,ge=new this(d);++Qt<Y;)de(j[Qt]);return ge;function de(xe){ct.resolve(xe).then(function(be){at||(at=!0,m.resolve(ge,be))},function(be){at||(at=!0,m.reject(ge,be))})}}},{1:1}],3:[function(s,o,c){(function(u){"use strict";typeof u.Promise!="function"&&(u.Promise=s(2))}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(s,o,c){"use strict";var u=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(f){return typeof f}:function(f){return f&&typeof Symbol=="function"&&f.constructor===Symbol&&f!==Symbol.prototype?"symbol":typeof f};function d(f,E){if(!(f instanceof E))throw new TypeError("Cannot call a class as a function")}function m(){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 h=m();function v(){try{if(!h||!h.open)return!1;var f=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),E=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!f||E)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function _(f,E){f=f||[],E=E||{};try{return new Blob(f,E)}catch(D){if(D.name!=="TypeError")throw D;for(var S=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,x=new S,T=0;T<f.length;T+=1)x.append(f[T]);return x.getBlob(E.type)}}typeof Promise>"u"&&s(3);var g=Promise;function y(f,E){E&&f.then(function(S){E(null,S)},function(S){E(S)})}function C(f,E,S){typeof E=="function"&&f.then(E),typeof S=="function"&&f.catch(S)}function O(f){return typeof f!="string"&&(console.warn(f+" used as a key, but it is not a string."),f=String(f)),f}function H(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var L="local-forage-detect-blob-support",P=void 0,V={},kt=Object.prototype.toString,fe="readonly",j="readwrite";function ct(f){for(var E=f.length,S=new ArrayBuffer(E),x=new Uint8Array(S),T=0;T<E;T++)x[T]=f.charCodeAt(T);return S}function Y(f){return new g(function(E){var S=f.transaction(L,j),x=_([""]);S.objectStore(L).put(x,"key"),S.onabort=function(T){T.preventDefault(),T.stopPropagation(),E(!1)},S.oncomplete=function(){var T=navigator.userAgent.match(/Chrome\/(\d+)/),D=navigator.userAgent.match(/Edge\//);E(D||!T||parseInt(T[1],10)>=43)}}).catch(function(){return!1})}function at(f){return typeof P=="boolean"?g.resolve(P):Y(f).then(function(E){return P=E,P})}function Qt(f){var E=V[f.name],S={};S.promise=new g(function(x,T){S.resolve=x,S.reject=T}),E.deferredOperations.push(S),E.dbReady?E.dbReady=E.dbReady.then(function(){return S.promise}):E.dbReady=S.promise}function ge(f){var E=V[f.name],S=E.deferredOperations.pop();if(S)return S.resolve(),S.promise}function de(f,E){var S=V[f.name],x=S.deferredOperations.pop();if(x)return x.reject(E),x.promise}function xe(f,E){return new g(function(S,x){if(V[f.name]=V[f.name]||en(),f.db)if(E)Qt(f),f.db.close();else return S(f.db);var T=[f.name];E&&T.push(f.version);var D=h.open.apply(h,T);E&&(D.onupgradeneeded=function(R){var U=D.result;try{U.createObjectStore(f.storeName),R.oldVersion<=1&&U.createObjectStore(L)}catch(F){if(F.name==="ConstraintError")console.warn('The database "'+f.name+'" has been upgraded from version '+R.oldVersion+" to version "+R.newVersion+', but the storage "'+f.storeName+'" already exists.');else throw F}}),D.onerror=function(R){R.preventDefault(),x(D.error)},D.onsuccess=function(){var R=D.result;R.onversionchange=function(U){U.target.close()},S(R),ge(f)}})}function be(f){return xe(f,!1)}function Ut(f){return xe(f,!0)}function De(f,E){if(!f.db)return!0;var S=!f.db.objectStoreNames.contains(f.storeName),x=f.version<f.db.version,T=f.version>f.db.version;if(x&&(f.version!==E&&console.warn('The database "'+f.name+`" can't be downgraded from version `+f.db.version+" to version "+f.version+"."),f.version=f.db.version),T||S){if(S){var D=f.db.version+1;D>f.version&&(f.version=D)}return!0}return!1}function ht(f){return new g(function(E,S){var x=new FileReader;x.onerror=S,x.onloadend=function(T){var D=btoa(T.target.result||"");E({__local_forage_encoded_blob:!0,data:D,type:f.type})},x.readAsBinaryString(f)})}function Q(f){var E=ct(atob(f.data));return _([E],{type:f.type})}function we(f){return f&&f.__local_forage_encoded_blob}function cr(f){var E=this,S=E._initReady().then(function(){var x=V[E._dbInfo.name];if(x&&x.dbReady)return x.dbReady});return C(S,f,f),S}function jr(f){Qt(f);for(var E=V[f.name],S=E.forages,x=0;x<S.length;x++){var T=S[x];T._dbInfo.db&&(T._dbInfo.db.close(),T._dbInfo.db=null)}return f.db=null,be(f).then(function(D){return f.db=D,De(f)?Ut(f):D}).then(function(D){f.db=E.db=D;for(var R=0;R<S.length;R++)S[R]._dbInfo.db=D}).catch(function(D){throw de(f,D),D})}function Ue(f,E,S,x){x===void 0&&(x=1);try{var T=f.db.transaction(f.storeName,E);S(null,T)}catch(D){if(x>0&&(!f.db||D.name==="InvalidStateError"||D.name==="NotFoundError"))return g.resolve().then(function(){if(!f.db||D.name==="NotFoundError"&&!f.db.objectStoreNames.contains(f.storeName)&&f.version<=f.db.version)return f.db&&(f.version=f.db.version+1),Ut(f)}).then(function(){return jr(f).then(function(){Ue(f,E,S,x-1)})}).catch(S);S(D)}}function en(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function Hn(f){var E=this,S={db:null};if(f)for(var x in f)S[x]=f[x];var T=V[S.name];T||(T=en(),V[S.name]=T),T.forages.push(E),E._initReady||(E._initReady=E.ready,E.ready=cr);var D=[];function R(){return g.resolve()}for(var U=0;U<T.forages.length;U++){var F=T.forages[U];F!==E&&D.push(F._initReady().catch(R))}var $=T.forages.slice(0);return g.all(D).then(function(){return S.db=T.db,be(S)}).then(function(B){return S.db=B,De(S,E._defaultConfig.version)?Ut(S):B}).then(function(B){S.db=T.db=B,E._dbInfo=S;for(var z=0;z<$.length;z++){var gt=$[z];gt!==E&&(gt._dbInfo.db=S.db,gt._dbInfo.version=S.version)}})}function kn(f,E){var S=this;f=O(f);var x=new g(function(T,D){S.ready().then(function(){Ue(S._dbInfo,fe,function(R,U){if(R)return D(R);try{var F=U.objectStore(S._dbInfo.storeName),$=F.get(f);$.onsuccess=function(){var B=$.result;B===void 0&&(B=null),we(B)&&(B=Q(B)),T(B)},$.onerror=function(){D($.error)}}catch(B){D(B)}})}).catch(D)});return y(x,E),x}function Hi(f,E){var S=this,x=new g(function(T,D){S.ready().then(function(){Ue(S._dbInfo,fe,function(R,U){if(R)return D(R);try{var F=U.objectStore(S._dbInfo.storeName),$=F.openCursor(),B=1;$.onsuccess=function(){var z=$.result;if(z){var gt=z.value;we(gt)&&(gt=Q(gt));var he=f(gt,z.key,B++);he!==void 0?T(he):z.continue()}else T()},$.onerror=function(){D($.error)}}catch(z){D(z)}})}).catch(D)});return y(x,E),x}function Wi(f,E,S){var x=this;f=O(f);var T=new g(function(D,R){var U;x.ready().then(function(){return U=x._dbInfo,kt.call(E)==="[object Blob]"?at(U.db).then(function(F){return F?E:ht(E)}):E}).then(function(F){Ue(x._dbInfo,j,function($,B){if($)return R($);try{var z=B.objectStore(x._dbInfo.storeName);F===null&&(F=void 0);var gt=z.put(F,f);B.oncomplete=function(){F===void 0&&(F=null),D(F)},B.onabort=B.onerror=function(){var he=gt.error?gt.error:gt.transaction.error;R(he)}}catch(he){R(he)}})}).catch(R)});return y(T,S),T}function ji(f,E){var S=this;f=O(f);var x=new g(function(T,D){S.ready().then(function(){Ue(S._dbInfo,j,function(R,U){if(R)return D(R);try{var F=U.objectStore(S._dbInfo.storeName),$=F.delete(f);U.oncomplete=function(){T()},U.onerror=function(){D($.error)},U.onabort=function(){var B=$.error?$.error:$.transaction.error;D(B)}}catch(B){D(B)}})}).catch(D)});return y(x,E),x}function Mn(f){var E=this,S=new g(function(x,T){E.ready().then(function(){Ue(E._dbInfo,j,function(D,R){if(D)return T(D);try{var U=R.objectStore(E._dbInfo.storeName),F=U.clear();R.oncomplete=function(){x()},R.onabort=R.onerror=function(){var $=F.error?F.error:F.transaction.error;T($)}}catch($){T($)}})}).catch(T)});return y(S,f),S}function je(f){var E=this,S=new g(function(x,T){E.ready().then(function(){Ue(E._dbInfo,fe,function(D,R){if(D)return T(D);try{var U=R.objectStore(E._dbInfo.storeName),F=U.count();F.onsuccess=function(){x(F.result)},F.onerror=function(){T(F.error)}}catch($){T($)}})}).catch(T)});return y(S,f),S}function $r(f,E){var S=this,x=new g(function(T,D){if(f<0){T(null);return}S.ready().then(function(){Ue(S._dbInfo,fe,function(R,U){if(R)return D(R);try{var F=U.objectStore(S._dbInfo.storeName),$=!1,B=F.openKeyCursor();B.onsuccess=function(){var z=B.result;if(!z){T(null);return}f===0||$?T(z.key):($=!0,z.advance(f))},B.onerror=function(){D(B.error)}}catch(z){D(z)}})}).catch(D)});return y(x,E),x}function is(f){var E=this,S=new g(function(x,T){E.ready().then(function(){Ue(E._dbInfo,fe,function(D,R){if(D)return T(D);try{var U=R.objectStore(E._dbInfo.storeName),F=U.openKeyCursor(),$=[];F.onsuccess=function(){var B=F.result;if(!B){x($);return}$.push(B.key),B.continue()},F.onerror=function(){T(F.error)}}catch(B){T(B)}})}).catch(T)});return y(S,f),S}function a(f,E){E=H.apply(this,arguments);var S=this.config();f=typeof f!="function"&&f||{},f.name||(f.name=f.name||S.name,f.storeName=f.storeName||S.storeName);var x=this,T;if(!f.name)T=g.reject("Invalid arguments");else{var D=f.name===S.name&&x._dbInfo.db,R=D?g.resolve(x._dbInfo.db):be(f).then(function(U){var F=V[f.name],$=F.forages;F.db=U;for(var B=0;B<$.length;B++)$[B]._dbInfo.db=U;return U});f.storeName?T=R.then(function(U){if(U.objectStoreNames.contains(f.storeName)){var F=U.version+1;Qt(f);var $=V[f.name],B=$.forages;U.close();for(var z=0;z<B.length;z++){var gt=B[z];gt._dbInfo.db=null,gt._dbInfo.version=F}var he=new g(function(oe,Ie){var ye=h.open(f.name,F);ye.onerror=function(ze){var Ku=ye.result;Ku.close(),Ie(ze)},ye.onupgradeneeded=function(){var ze=ye.result;ze.deleteObjectStore(f.storeName)},ye.onsuccess=function(){var ze=ye.result;ze.close(),oe(ze)}});return he.then(function(oe){$.db=oe;for(var Ie=0;Ie<B.length;Ie++){var ye=B[Ie];ye._dbInfo.db=oe,ge(ye._dbInfo)}}).catch(function(oe){throw(de(f,oe)||g.resolve()).catch(function(){}),oe})}}):T=R.then(function(U){Qt(f);var F=V[f.name],$=F.forages;U.close();for(var B=0;B<$.length;B++){var z=$[B];z._dbInfo.db=null}var gt=new g(function(he,oe){var Ie=h.deleteDatabase(f.name);Ie.onerror=function(){var ye=Ie.result;ye&&ye.close(),oe(Ie.error)},Ie.onblocked=function(){console.warn('dropInstance blocked for database "'+f.name+'" until all open connections are closed')},Ie.onsuccess=function(){var ye=Ie.result;ye&&ye.close(),he(ye)}});return gt.then(function(he){F.db=he;for(var oe=0;oe<$.length;oe++){var Ie=$[oe];ge(Ie._dbInfo)}}).catch(function(he){throw(de(f,he)||g.resolve()).catch(function(){}),he})})}return y(T,E),T}var l={_driver:"asyncStorage",_initStorage:Hn,_support:v(),iterate:Hi,getItem:kn,setItem:Wi,removeItem:ji,clear:Mn,length:je,key:$r,keys:is,dropInstance:a};function p(){return typeof openDatabase=="function"}var I="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",A="~~local_forage_type~",M=/^~~local_forage_type~([^~]+)~/,W="__lfsc__:",te=W.length,Tt="arbf",Dt="blob",ce="si08",G="ui08",dt="uic8",J="si16",se="si32",He="ur16",Fe="ui32",re="fl32",X="fl64",We=te+Tt.length,to=Object.prototype.toString;function ga(f){var E=f.length*.75,S=f.length,x,T=0,D,R,U,F;f[f.length-1]==="="&&(E--,f[f.length-2]==="="&&E--);var $=new ArrayBuffer(E),B=new Uint8Array($);for(x=0;x<S;x+=4)D=I.indexOf(f[x]),R=I.indexOf(f[x+1]),U=I.indexOf(f[x+2]),F=I.indexOf(f[x+3]),B[T++]=D<<2|R>>4,B[T++]=(R&15)<<4|U>>2,B[T++]=(U&3)<<6|F&63;return $}function Ic(f){var E=new Uint8Array(f),S="",x;for(x=0;x<E.length;x+=3)S+=I[E[x]>>2],S+=I[(E[x]&3)<<4|E[x+1]>>4],S+=I[(E[x+1]&15)<<2|E[x+2]>>6],S+=I[E[x+2]&63];return E.length%3===2?S=S.substring(0,S.length-1)+"=":E.length%3===1&&(S=S.substring(0,S.length-2)+"=="),S}function Fd(f,E){var S="";if(f&&(S=to.call(f)),f&&(S==="[object ArrayBuffer]"||f.buffer&&to.call(f.buffer)==="[object ArrayBuffer]")){var x,T=W;f instanceof ArrayBuffer?(x=f,T+=Tt):(x=f.buffer,S==="[object Int8Array]"?T+=ce:S==="[object Uint8Array]"?T+=G:S==="[object Uint8ClampedArray]"?T+=dt:S==="[object Int16Array]"?T+=J:S==="[object Uint16Array]"?T+=He:S==="[object Int32Array]"?T+=se:S==="[object Uint32Array]"?T+=Fe:S==="[object Float32Array]"?T+=re:S==="[object Float64Array]"?T+=X:E(new Error("Failed to get type for BinaryArray"))),E(T+Ic(x))}else if(S==="[object Blob]"){var D=new FileReader;D.onload=function(){var R=A+f.type+"~"+Ic(this.result);E(W+Dt+R)},D.readAsArrayBuffer(f)}else try{E(JSON.stringify(f))}catch(R){console.error("Couldn't convert value into a JSON string: ",f),E(null,R)}}function Hd(f){if(f.substring(0,te)!==W)return JSON.parse(f);var E=f.substring(We),S=f.substring(te,We),x;if(S===Dt&&M.test(E)){var T=E.match(M);x=T[1],E=E.substring(T[0].length)}var D=ga(E);switch(S){case Tt:return D;case Dt:return _([D],{type:x});case ce:return new Int8Array(D);case G:return new Uint8Array(D);case dt:return new Uint8ClampedArray(D);case J:return new Int16Array(D);case He:return new Uint16Array(D);case se:return new Int32Array(D);case Fe:return new Uint32Array(D);case re:return new Float32Array(D);case X:return new Float64Array(D);default:throw new Error("Unkown type: "+S)}}var Tc={serialize:Fd,deserialize:Hd,stringToBuffer:ga,bufferToString:Ic};function eh(f,E,S,x){f.executeSql("CREATE TABLE IF NOT EXISTS "+E.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],S,x)}function Vd(f){var E=this,S={db:null};if(f)for(var x in f)S[x]=typeof f[x]!="string"?f[x].toString():f[x];var T=new g(function(D,R){try{S.db=openDatabase(S.name,String(S.version),S.description,S.size)}catch(U){return R(U)}S.db.transaction(function(U){eh(U,S,function(){E._dbInfo=S,D()},function(F,$){R($)})},R)});return S.serializer=Tc,T}function Fn(f,E,S,x,T,D){f.executeSql(S,x,T,function(R,U){U.code===U.SYNTAX_ERR?R.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[E.storeName],function(F,$){$.rows.length?D(F,U):eh(F,E,function(){F.executeSql(S,x,T,D)},D)},D):D(R,U)},D)}function qd(f,E){var S=this;f=O(f);var x=new g(function(T,D){S.ready().then(function(){var R=S._dbInfo;R.db.transaction(function(U){Fn(U,R,"SELECT * FROM "+R.storeName+" WHERE key = ? LIMIT 1",[f],function(F,$){var B=$.rows.length?$.rows.item(0).value:null;B&&(B=R.serializer.deserialize(B)),T(B)},function(F,$){D($)})})}).catch(D)});return y(x,E),x}function Wd(f,E){var S=this,x=new g(function(T,D){S.ready().then(function(){var R=S._dbInfo;R.db.transaction(function(U){Fn(U,R,"SELECT * FROM "+R.storeName,[],function(F,$){for(var B=$.rows,z=B.length,gt=0;gt<z;gt++){var he=B.item(gt),oe=he.value;if(oe&&(oe=R.serializer.deserialize(oe)),oe=f(oe,he.key,gt+1),oe!==void 0){T(oe);return}}T()},function(F,$){D($)})})}).catch(D)});return y(x,E),x}function rh(f,E,S,x){var T=this;f=O(f);var D=new g(function(R,U){T.ready().then(function(){E===void 0&&(E=null);var F=E,$=T._dbInfo;$.serializer.serialize(E,function(B,z){z?U(z):$.db.transaction(function(gt){Fn(gt,$,"INSERT OR REPLACE INTO "+$.storeName+" (key, value) VALUES (?, ?)",[f,B],function(){R(F)},function(he,oe){U(oe)})},function(gt){if(gt.code===gt.QUOTA_ERR){if(x>0){R(rh.apply(T,[f,F,S,x-1]));return}U(gt)}})})}).catch(U)});return y(D,S),D}function Gd(f,E,S){return rh.apply(this,[f,E,S,1])}function zd(f,E){var S=this;f=O(f);var x=new g(function(T,D){S.ready().then(function(){var R=S._dbInfo;R.db.transaction(function(U){Fn(U,R,"DELETE FROM "+R.storeName+" WHERE key = ?",[f],function(){T()},function(F,$){D($)})})}).catch(D)});return y(x,E),x}function Kd(f){var E=this,S=new g(function(x,T){E.ready().then(function(){var D=E._dbInfo;D.db.transaction(function(R){Fn(R,D,"DELETE FROM "+D.storeName,[],function(){x()},function(U,F){T(F)})})}).catch(T)});return y(S,f),S}function Yd(f){var E=this,S=new g(function(x,T){E.ready().then(function(){var D=E._dbInfo;D.db.transaction(function(R){Fn(R,D,"SELECT COUNT(key) as c FROM "+D.storeName,[],function(U,F){var $=F.rows.item(0).c;x($)},function(U,F){T(F)})})}).catch(T)});return y(S,f),S}function Jd(f,E){var S=this,x=new g(function(T,D){S.ready().then(function(){var R=S._dbInfo;R.db.transaction(function(U){Fn(U,R,"SELECT key FROM "+R.storeName+" WHERE id = ? LIMIT 1",[f+1],function(F,$){var B=$.rows.length?$.rows.item(0).key:null;T(B)},function(F,$){D($)})})}).catch(D)});return y(x,E),x}function Xd(f){var E=this,S=new g(function(x,T){E.ready().then(function(){var D=E._dbInfo;D.db.transaction(function(R){Fn(R,D,"SELECT key FROM "+D.storeName,[],function(U,F){for(var $=[],B=0;B<F.rows.length;B++)$.push(F.rows.item(B).key);x($)},function(U,F){T(F)})})}).catch(T)});return y(S,f),S}function Zd(f){return new g(function(E,S){f.transaction(function(x){x.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(T,D){for(var R=[],U=0;U<D.rows.length;U++)R.push(D.rows.item(U).name);E({db:f,storeNames:R})},function(T,D){S(D)})},function(x){S(x)})})}function Qd(f,E){E=H.apply(this,arguments);var S=this.config();f=typeof f!="function"&&f||{},f.name||(f.name=f.name||S.name,f.storeName=f.storeName||S.storeName);var x=this,T;return f.name?T=new g(function(D){var R;f.name===S.name?R=x._dbInfo.db:R=openDatabase(f.name,"","",0),f.storeName?D({db:R,storeNames:[f.storeName]}):D(Zd(R))}).then(function(D){return new g(function(R,U){D.db.transaction(function(F){function $(he){return new g(function(oe,Ie){F.executeSql("DROP TABLE IF EXISTS "+he,[],function(){oe()},function(ye,ze){Ie(ze)})})}for(var B=[],z=0,gt=D.storeNames.length;z<gt;z++)B.push($(D.storeNames[z]));g.all(B).then(function(){R()}).catch(function(he){U(he)})},function(F){U(F)})})}):T=g.reject("Invalid arguments"),y(T,E),T}var Rf={_driver:"webSQLStorage",_initStorage:Vd,_support:p(),iterate:Wd,getItem:qd,setItem:Gd,removeItem:zd,clear:Kd,length:Yd,key:Jd,keys:Xd,dropInstance:Qd};function jf(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function nh(f,E){var S=f.name+"/";return f.storeName!==E.storeName&&(S+=f.storeName+"/"),S}function $f(){var f="_localforage_support_test";try{return localStorage.setItem(f,!0),localStorage.removeItem(f),!1}catch{return!0}}function Wf(){return!$f()||localStorage.length>0}function dg(f){var E=this,S={};if(f)for(var x in f)S[x]=f[x];return S.keyPrefix=nh(f,E._defaultConfig),Wf()?(E._dbInfo=S,S.serializer=Tc,g.resolve()):g.reject()}function mg(f){var E=this,S=E.ready().then(function(){for(var x=E._dbInfo.keyPrefix,T=localStorage.length-1;T>=0;T--){var D=localStorage.key(T);D.indexOf(x)===0&&localStorage.removeItem(D)}});return y(S,f),S}function Av(f,E){var S=this;f=O(f);var x=S.ready().then(function(){var T=S._dbInfo,D=localStorage.getItem(T.keyPrefix+f);return D&&(D=T.serializer.deserialize(D)),D});return y(x,E),x}function hy(f,E){var S=this,x=S.ready().then(function(){for(var T=S._dbInfo,D=T.keyPrefix,R=D.length,U=localStorage.length,F=1,$=0;$<U;$++){var B=localStorage.key($);if(B.indexOf(D)===0){var z=localStorage.getItem(B);if(z&&(z=T.serializer.deserialize(z)),z=f(z,B.substring(R),F++),z!==void 0)return z}}});return y(x,E),x}function dy(f,E){var S=this,x=S.ready().then(function(){var T=S._dbInfo,D;try{D=localStorage.key(f)}catch{D=null}return D&&(D=D.substring(T.keyPrefix.length)),D});return y(x,E),x}function gy(f){var E=this,S=E.ready().then(function(){for(var x=E._dbInfo,T=localStorage.length,D=[],R=0;R<T;R++){var U=localStorage.key(R);U.indexOf(x.keyPrefix)===0&&D.push(U.substring(x.keyPrefix.length))}return D});return y(S,f),S}function vy(f){var E=this,S=E.keys().then(function(x){return x.length});return y(S,f),S}function yy(f,E){var S=this;f=O(f);var x=S.ready().then(function(){var T=S._dbInfo;localStorage.removeItem(T.keyPrefix+f)});return y(x,E),x}function by(f,E,S){var x=this;f=O(f);var T=x.ready().then(function(){E===void 0&&(E=null);var D=E;return new g(function(R,U){var F=x._dbInfo;F.serializer.serialize(E,function($,B){if(B)U(B);else try{localStorage.setItem(F.keyPrefix+f,$),R(D)}catch(z){(z.name==="QuotaExceededError"||z.name==="NS_ERROR_DOM_QUOTA_REACHED")&&U(z),U(z)}})})});return y(T,S),T}function wy(f,E){if(E=H.apply(this,arguments),f=typeof f!="function"&&f||{},!f.name){var S=this.config();f.name=f.name||S.name,f.storeName=f.storeName||S.storeName}var x=this,T;return f.name?T=new g(function(D){f.storeName?D(nh(f,x._defaultConfig)):D(f.name+"/")}).then(function(D){for(var R=localStorage.length-1;R>=0;R--){var U=localStorage.key(R);U.indexOf(D)===0&&localStorage.removeItem(U)}}):T=g.reject("Invalid arguments"),y(T,E),T}var _y={_driver:"localStorageWrapper",_initStorage:dg,_support:jf(),iterate:hy,getItem:Av,setItem:by,removeItem:yy,clear:mg,length:vy,key:dy,keys:gy,dropInstance:wy},Ey=function(f,E){return f===E||typeof f=="number"&&typeof E=="number"&&isNaN(f)&&isNaN(E)},Sy=function(f,E){for(var S=f.length,x=0;x<S;){if(Ey(f[x],E))return!0;x++}return!1},ih=Array.isArray||function(f){return Object.prototype.toString.call(f)==="[object Array]"},Ga={},oh={},qo={INDEXEDDB:l,WEBSQL:Rf,LOCALSTORAGE:_y},Iy=[qo.INDEXEDDB._driver,qo.WEBSQL._driver,qo.LOCALSTORAGE._driver],Ec=["dropInstance"],Jc=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Ec),Ty={description:"",driver:Iy.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function Zy(f,E){f[E]=function(){var S=arguments;return f.ready().then(function(){return f[E].apply(f,S)})}}function zu(){for(var f=1;f<arguments.length;f++){var E=arguments[f];if(E)for(var S in E)E.hasOwnProperty(S)&&(ih(E[S])?arguments[0][S]=E[S].slice():arguments[0][S]=E[S])}return arguments[0]}var tb=function(){function f(E){d(this,f);for(var S in qo)if(qo.hasOwnProperty(S)){var x=qo[S],T=x._driver;this[S]=T,Ga[T]||this.defineDriver(x)}this._defaultConfig=zu({},Ty),this._config=zu({},this._defaultConfig,E),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return f.prototype.config=function(E){if((typeof E>"u"?"undefined":u(E))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var S in E){if(S==="storeName"&&(E[S]=E[S].replace(/\W/g,"_")),S==="version"&&typeof E[S]!="number")return new Error("Database version must be a number.");this._config[S]=E[S]}return"driver"in E&&E.driver?this.setDriver(this._config.driver):!0}else return typeof E=="string"?this._config[E]:this._config},f.prototype.defineDriver=function(E,S,x){var T=new g(function(D,R){try{var U=E._driver,F=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!E._driver){R(F);return}for(var $=Jc.concat("_initStorage"),B=0,z=$.length;B<z;B++){var gt=$[B],he=!Sy(Ec,gt);if((he||E[gt])&&typeof E[gt]!="function"){R(F);return}}var oe=function(){for(var ye=function(rb){return function(){var nb=new Error("Method "+rb+" is not implemented by the current driver"),dh=g.reject(nb);return y(dh,arguments[arguments.length-1]),dh}},ze=0,Ku=Ec.length;ze<Ku;ze++){var Yu=Ec[ze];E[Yu]||(E[Yu]=ye(Yu))}};oe();var Ie=function(ye){Ga[U]&&console.info("Redefining LocalForage driver: "+U),Ga[U]=E,oh[U]=ye,D()};"_support"in E?E._support&&typeof E._support=="function"?E._support().then(Ie,R):Ie(!!E._support):Ie(!0)}catch(ye){R(ye)}});return C(T,S,x),T},f.prototype.driver=function(){return this._driver||null},f.prototype.getDriver=function(E,S,x){var T=Ga[E]?g.resolve(Ga[E]):g.reject(new Error("Driver not found."));return C(T,S,x),T},f.prototype.getSerializer=function(E){var S=g.resolve(Tc);return C(S,E),S},f.prototype.ready=function(E){var S=this,x=S._driverSet.then(function(){return S._ready===null&&(S._ready=S._initDriver()),S._ready});return C(x,E,E),x},f.prototype.setDriver=function(E,S,x){var T=this;ih(E)||(E=[E]);var D=this._getSupportedDrivers(E);function R(){T._config.driver=T.driver()}function U(B){return T._extend(B),R(),T._ready=T._initStorage(T._config),T._ready}function F(B){return function(){var z=0;function gt(){for(;z<B.length;){var he=B[z];return z++,T._dbInfo=null,T._ready=null,T.getDriver(he).then(U).catch(gt)}R();var oe=new Error("No available storage method found.");return T._driverSet=g.reject(oe),T._driverSet}return gt()}}var $=this._driverSet!==null?this._driverSet.catch(function(){return g.resolve()}):g.resolve();return this._driverSet=$.then(function(){var B=D[0];return T._dbInfo=null,T._ready=null,T.getDriver(B).then(function(z){T._driver=z._driver,R(),T._wrapLibraryMethodsWithReady(),T._initDriver=F(D)})}).catch(function(){R();var B=new Error("No available storage method found.");return T._driverSet=g.reject(B),T._driverSet}),C(this._driverSet,S,x),this._driverSet},f.prototype.supports=function(E){return!!oh[E]},f.prototype._extend=function(E){zu(this,E)},f.prototype._getSupportedDrivers=function(E){for(var S=[],x=0,T=E.length;x<T;x++){var D=E[x];this.supports(D)&&S.push(D)}return S},f.prototype._wrapLibraryMethodsWithReady=function(){for(var E=0,S=Jc.length;E<S;E++)Zy(this,Jc[E])},f.prototype.createInstance=function(E){return new f(E)},f}(),eb=new tb;o.exports=eb},{3:3}]},{},[4])(4)})}),Pu=Vi(t=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.URLBuilder=void 0;var e=function(){function r(n){try{this.base=new URL(n),this.params=new URLSearchParams(this.base.search.slice(1))}catch(i){console.error("Un-parsable URL",i)}}return r.prototype.appendQueryParam=function(n,i){this.params.append(n,i?i.toString():"")},r.prototype.clearQueryParams=function(){return this.params=new URLSearchParams,this},r.prototype.deleteQueryParam=function(n){this.params.delete(n)},r.prototype.getBase=function(){return this.base},r.prototype.getPath=function(){return this.base.pathname},r.prototype.getHostname=function(){return this.base.hostname},r.prototype.getParams=function(){return this.params},r.prototype.getQueryParam=function(n){if(!this.params)return"";var i=this.params.get(n);return!i||i==="undefined"||i==="null"?void 0:i},r.prototype.getQueryString=function(){return this.params.toString()},r.prototype.setPath=function(n){return this.base.pathname=n,this},r.prototype.setQueryParam=function(n,i){return this.params.set(n,i?i.toString():""),this},r.prototype.setQueryString=function(n){if(n)return n[0]==="?"&&(n=n.slice(1)),this.params=new URLSearchParams(n),this},r.prototype.toString=function(){var n=this.params.toString();return n===""?this.base.search="":this.base.search="?"+n,this.base.toString()},r}();t.URLBuilder=e}),dd=Vi((t,e)=>{"use strict";(function(r,n){typeof t=="object"&&typeof e<"u"?e.exports=n():typeof define=="function"&&define.amd?define(n):(r=typeof globalThis<"u"?globalThis:r||self,r.fetchRetry=n())})(t,function(){"use strict";var r=function(s,o){if(o=o||{},typeof s!="function")throw new i("fetch must be a function");if(typeof o!="object")throw new i("defaults must be an object");if(o.retries!==void 0&&!n(o.retries))throw new i("retries must be a positive integer");if(o.retryDelay!==void 0&&!n(o.retryDelay)&&typeof o.retryDelay!="function")throw new i("retryDelay must be a positive integer or a function returning a positive integer");if(o.retryOn!==void 0&&!Array.isArray(o.retryOn)&&typeof o.retryOn!="function")throw new i("retryOn property expects an array or function");var c={retries:3,retryDelay:1e3,retryOn:[]};return o=Object.assign(c,o),function(u,d){var m=o.retries,h=o.retryDelay,v=o.retryOn;if(d&&d.retries!==void 0)if(n(d.retries))m=d.retries;else throw new i("retries must be a positive integer");if(d&&d.retryDelay!==void 0)if(n(d.retryDelay)||typeof d.retryDelay=="function")h=d.retryDelay;else throw new i("retryDelay must be a positive integer or a function returning a positive integer");if(d&&d.retryOn)if(Array.isArray(d.retryOn)||typeof d.retryOn=="function")v=d.retryOn;else throw new i("retryOn property expects an array or function");return new Promise(function(_,g){var y=function(O){var H=typeof Request<"u"&&u instanceof Request?u.clone():u;s(H,d).then(function(L){if(Array.isArray(v)&&v.indexOf(L.status)===-1)_(L);else if(typeof v=="function")try{return Promise.resolve(v(O,null,L)).then(function(P){P?C(O,null,L):_(L)}).catch(g)}catch(P){g(P)}else O<m?C(O,null,L):_(L)}).catch(function(L){if(typeof v=="function")try{Promise.resolve(v(O,L,null)).then(function(P){P?C(O,L,null):g(L)}).catch(function(P){g(P)})}catch(P){g(P)}else O<m?C(O,L,null):g(L)})};function C(O,H,L){var P=typeof h=="function"?h(O,H,L):h;setTimeout(function(){y(++O)},P)}y(0)})}};function n(s){return Number.isInteger(s)&&s>=0}function i(s){this.name="ArgumentError",this.message=s}return r})}),ip="9.3.27",N=class Ju{static SDK_VERSION=ip;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 CTA_AFTER_REFRESH_UI="letscooee:outbound:refresh-ui";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 SHADOW_SPLITTER=":shadow";static CAMPAIGN_ATTRIBUTE="_letscooee_campaign";static CONTENT_ATTRIBUTE="_letscooee_content";static VIA="_via";static PAYMENT_MODAL_DETAILS=[{identifier:"#flo-checkout-wrapper",gateway:"Shopflow"},{identifier:"#fastrr-main-container",gateway:"Shiprocket"},{identifier:"#gokwik-modal-wrapper",gateway:"Gokwik"},{identifier:"#zecpe",gateway:"Ecom 360"}];static{let e=Ju.SDK_VERSION.split(".").map(r=>r.padStart(2,"0")).join("");Ju.SDK_VERSION_CODE=parseInt(e,10)}},er={apiURL:"https://api.sdk.letscooee.com",debug:!1,mode:"production",styleURL:`https://cdn.jsdelivr.net/npm/@letscooee/web-sdk@${N.SDK_VERSION}/dist/widget-sdk.min.css`},Rt=Zt(tn()),b=class{static log(...t){Rt.default.info(...t)}static debug(...t){Rt.default.debug(...t)}static error(...t){Rt.default.error(...t)}static warn(...t){Rt.default.warn(...t)}static info(...t){Rt.default.info(...t)}static trace(...t){Rt.default.trace(...t)}static configure(t=N.LOG_PREFIX){Rt.default.useDefaults({formatter:function(r){r.unshift(`${t} (v${N.SDK_VERSION}):`)}});let e=this.getDebugParam();(e==="1"||e==="on")&&(localStorage.cooeeLogLevel="TRACE"),localStorage.cooeeLogLevel?Rt.default.setLevel(Rt.default[localStorage.cooeeLogLevel]):Rt.default.setLevel(er.debug?Rt.default.TRACE:Rt.default.OFF)}static getDebugParam(){return new URL(location.href).searchParams?.get("cooee-debug")}static logBrand(){let t=`
|
|
1
|
+
"use strict";(()=>{var ig=Object.create,Ac=Object.defineProperty,og=Object.defineProperties,sg=Object.getOwnPropertyDescriptor,ag=Object.getOwnPropertyDescriptors,cg=Object.getOwnPropertyNames,ap=Object.getOwnPropertySymbols,lg=Object.getPrototypeOf,lp=Object.prototype.hasOwnProperty,ug=Object.prototype.propertyIsEnumerable,cp=(e,t,r)=>t in e?Ac(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,w=(e,t)=>{for(var r in t||={})lp.call(t,r)&&cp(e,r,t[r]);if(ap)for(var r of ap(t))ug.call(t,r)&&cp(e,r,t[r]);return e},ee=(e,t)=>og(e,ag(t)),zi=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),ur=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),pg=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of cg(t))!lp.call(e,i)&&i!==r&&Ac(e,i,{get:()=>t[i],enumerable:!(n=sg(t,i))||n.enumerable});return e},Ce=(e,t,r)=>(r=e!=null?ig(lg(e)):{},pg(t||!e||!e.__esModule?Ac(r,"default",{value:e,enumerable:!0}):r,e)),nn=ur((e,t)=>{"use strict";(function(r){"use strict";var n={};n.VERSION="1.6.1";var i,s={},o=function(h,y){return function(){return y.apply(h,arguments)}},c=function(){var h=arguments,y=h[0],E,v;for(v=1;v<h.length;v++)for(E in h[v])!(E in y)&&h[v].hasOwnProperty(E)&&(y[E]=h[v][E]);return y},u=function(h,y){return{value:h,name:y}};n.TRACE=u(1,"TRACE"),n.DEBUG=u(2,"DEBUG"),n.INFO=u(3,"INFO"),n.TIME=u(4,"TIME"),n.WARN=u(5,"WARN"),n.ERROR=u(8,"ERROR"),n.OFF=u(99,"OFF");var p=function(h){this.context=h,this.setLevel(h.filterLevel),this.log=this.info};p.prototype={setLevel:function(h){h&&"value"in h&&(this.context.filterLevel=h)},getLevel:function(){return this.context.filterLevel},enabledFor:function(h){var y=this.context.filterLevel;return h.value>=y.value},trace:function(){this.invoke(n.TRACE,arguments)},debug:function(){this.invoke(n.DEBUG,arguments)},info:function(){this.invoke(n.INFO,arguments)},warn:function(){this.invoke(n.WARN,arguments)},error:function(){this.invoke(n.ERROR,arguments)},time:function(h){typeof h=="string"&&h.length>0&&this.invoke(n.TIME,[h,"start"])},timeEnd:function(h){typeof h=="string"&&h.length>0&&this.invoke(n.TIME,[h,"end"])},invoke:function(h,y){i&&this.enabledFor(h)&&i(y,c({level:h},this.context))}};var m=new p({filterLevel:n.OFF});(function(){var h=n;h.enabledFor=o(m,m.enabledFor),h.trace=o(m,m.trace),h.debug=o(m,m.debug),h.time=o(m,m.time),h.timeEnd=o(m,m.timeEnd),h.info=o(m,m.info),h.warn=o(m,m.warn),h.error=o(m,m.error),h.log=h.info})(),n.setHandler=function(h){i=h},n.setLevel=function(h){m.setLevel(h);for(var y in s)s.hasOwnProperty(y)&&s[y].setLevel(h)},n.getLevel=function(){return m.getLevel()},n.get=function(h){return s[h]||(s[h]=new p(c({name:h},m.context)))},n.createDefaultHandler=function(h){h=h||{},h.formatter=h.formatter||function(v,_){_.name&&v.unshift("["+_.name+"]")};var y={},E=function(v,_){Function.prototype.apply.call(v,console,_)};return typeof console>"u"?function(){}:function(v,_){v=Array.prototype.slice.call(v);var x=console.log,P;_.level===n.TIME?(P=(_.name?"["+_.name+"] ":"")+v[0],v[1]==="start"?console.time?console.time(P):y[P]=new Date().getTime():console.timeEnd?console.timeEnd(P):E(x,[P+": "+(new Date().getTime()-y[P])+"ms"])):(_.level===n.WARN&&console.warn?x=console.warn:_.level===n.ERROR&&console.error?x=console.error:_.level===n.INFO&&console.info?x=console.info:_.level===n.DEBUG&&console.debug?x=console.debug:_.level===n.TRACE&&console.trace&&(x=console.trace),h.formatter(v,_),E(x,v))}},n.useDefaults=function(h){n.setLevel(h&&h.defaultLevel||n.DEBUG),n.setHandler(n.createDefaultHandler(h))},n.setDefaults=n.useDefaults,typeof define=="function"&&define.amd?define(n):typeof t<"u"&&t.exports?t.exports=n:(n._prevLogger=r.Logger,n.noConflict=function(){return r.Logger=n._prevLogger,n},r.Logger=n)})(e)}),Nc=ur(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MustacheUtils=void 0;var t=class Ih{static escapeHtml(n){return String(n).replace(/"/g,i=>Ih.entityMap[i])}};e.MustacheUtils=t,t.entityMap={'"':"""}}),Gr=ur(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MilestoneRewardType=e.ProgressBarLayout=e.EngagementContentSource=e.EngagementObjective=e.OnsiteDeliveryType=e.ClickActionType=e.FrequencyGapUnit=e.FrequencyType=e.RedirectBehaviour=e.EngagementPlacementPosition=e.EngagementCollectionSource=e.PromotionType=e.CartFilterEnum=e.CartCurrencyOperator=e.CartCriteria=e.URLCriteria=e.UTMCriteria=e.CartItemSource=e.EngagementItemSource=e.PurchasedVisitor=e.LoggedInVisitor=e.VisitorType=e.SessionType=e.EngagementContentType=e.TriggerType=e.EngagementType=e.EngagementStatus=e.TimePreference=e.ScheduleFrequency=e.CriteriaFrequency=void 0;var t=function(d){return d[d.ONCE_PER_USER=1]="ONCE_PER_USER",d[d.ONCE_PER_SESSION=2]="ONCE_PER_SESSION",d[d.EVERY_TIME=3]="EVERY_TIME",d}(t||(e.CriteriaFrequency=t={})),r=function(d){return d[d.ONE_TIME=1]="ONE_TIME",d[d.MULTIPLE=2]="MULTIPLE",d[d.RECURRING=3]="RECURRING",d}(r||(e.ScheduleFrequency=r={})),n=function(d){return d[d.NOW=1]="NOW",d[d.LATER=2]="LATER",d[d.NEVER=3]="NEVER",d}(n||(e.TimePreference=n={})),i=function(d){return d[d.PUBLISHED=1]="PUBLISHED",d[d.DRAFT=2]="DRAFT",d[d.PAUSED=3]="PAUSED",d[d.FAILED=4]="FAILED",d[d.STOPPED=5]="STOPPED",d[d.COMPLETED=6]="COMPLETED",d[d.ARCHIVED=7]="ARCHIVED",d[d.UNINSTALLED=8]="UNINSTALLED",d}(i||(e.EngagementStatus=i={})),s=function(d){return d[d.POPUP=1]="POPUP",d[d.LEAD_GENERATION=2]="LEAD_GENERATION",d[d.PRODUCT_WIDGET=3]="PRODUCT_WIDGET",d[d.PRODUCT_BUNDLE=4]="PRODUCT_BUNDLE",d[d.ANNOUNCEMENT_BAR=5]="ANNOUNCEMENT_BAR",d[d.CART_REMINDER=6]="CART_REMINDER",d[d.CRO_COPILOT=10]="CRO_COPILOT",d[d.OTHER=11]="OTHER",d}(s||(e.EngagementType=s={})),o=function(d){return d[d.NONE=0]="NONE",d[d.RULE_BASED=1]="RULE_BASED",d[d.INTENT_BASED=2]="INTENT_BASED",d}(o||(e.TriggerType=o={})),c=function(d){return d[d.SINGLE=1]="SINGLE",d[d.EXCLUSION=2]="EXCLUSION",d[d.ABTESTING=3]="ABTESTING",d}(c||(e.EngagementContentType=c={})),u=function(d){return d[d.ALL=0]="ALL",d[d.NEW_ONLY=1]="NEW_ONLY",d[d.RETURNING_ONLY=2]="RETURNING_ONLY",d}(u||(e.SessionType=u={})),p=function(d){return d[d.ALL=0]="ALL",d[d.LOGGED_IN_ONLY=3]="LOGGED_IN_ONLY",d[d.NON_LOGGED_IN_ONLY=4]="NON_LOGGED_IN_ONLY",d[d.PURCHASED=5]="PURCHASED",d[d.NON_PURCHASED=6]="NON_PURCHASED",d[d.ABANDON_CART=7]="ABANDON_CART",d[d.RETURNING_AND_NON_PURCHASED=8]="RETURNING_AND_NON_PURCHASED",d}(p||(e.VisitorType=p={})),m=function(d){return d.ALL="ALL",d.LOGGED_IN="LOGGED_IN",d.NON_LOGGED_IN="NON_LOGGED_IN",d}(m||(e.LoggedInVisitor=m={})),h=function(d){return d.ALL="ALL",d.PURCHASED="PURCHASED",d.NON_PURCHASED="NON_PURCHASED",d}(h||(e.PurchasedVisitor=h={})),y=function(d){return d[d.NONE=0]="NONE",d[d.ITEM_RECOMMENDATION=1]="ITEM_RECOMMENDATION",d[d.MULTIPLE_ITEMS=2]="MULTIPLE_ITEMS",d[d.SINGLE_ITEM=3]="SINGLE_ITEM",d[d.TOP_SELLING=4]="TOP_SELLING",d[d.STOCK_CLEARANCE=5]="STOCK_CLEARANCE",d[d.NEW_ARRIVALS=6]="NEW_ARRIVALS",d[d.RECENTLY_VIEWED=7]="RECENTLY_VIEWED",d[d.EVENT_ITEM=8]="EVENT_ITEM",d[d.CART_ITEM=9]="CART_ITEM",d[d.BUNDLE=10]="BUNDLE",d[d.CURRENT_ITEM=11]="CURRENT_ITEM",d[d.PURCHASED_PREVIOUSLY=12]="PURCHASED_PREVIOUSLY",d[d.COLLECTION_ITEMS=13]="COLLECTION_ITEMS",d[d.TRENDING_ITEMS=14]="TRENDING_ITEMS",d}(y||(e.EngagementItemSource=y={})),E=function(d){return d[d.LAST_ADDED=1]="LAST_ADDED",d[d.FIRST_ADDED=2]="FIRST_ADDED",d[d.HIGHEST_PRICE=3]="HIGHEST_PRICE",d[d.LOWEST_PRICE=4]="LOWEST_PRICE",d[d.FIRST_MATCHING_TAG=5]="FIRST_MATCHING_TAG",d[d.ALL=6]="ALL",d}(E||(e.CartItemSource=E={})),v=function(d){return d[d.ALL=0]="ALL",d[d.ONLY_ORGANIC=1]="ONLY_ORGANIC",d[d.ONLY_NON_ORGANIC=2]="ONLY_NON_ORGANIC",d[d.INCLUDES=3]="INCLUDES",d[d.EXCLUDES=4]="EXCLUDES",d}(v||(e.UTMCriteria=v={})),_=function(d){return d[d.NONE=0]="NONE",d[d.LIKE=1]="LIKE",d[d.NOT_LIKE=2]="NOT_LIKE",d[d.EQUALS=3]="EQUALS",d[d.NOT_EQUALS=4]="NOT_EQUALS",d}(_||(e.URLCriteria=_={})),x=function(d){return d[d.NONE=0]="NONE",d[d.LESS_THAN=1]="LESS_THAN",d[d.GREATER_THAN=2]="GREATER_THAN",d[d.BETWEEN=3]="BETWEEN",d[d.EQUALS=4]="EQUALS",d}(x||(e.CartCriteria=x={})),P=function(d){return d[d.ALL=0]="ALL",d[d.INCLUDES=1]="INCLUDES",d[d.EXCLUDES=2]="EXCLUDES",d}(P||(e.CartCurrencyOperator=P={})),B=function(d){return d[d.NONE=0]="NONE",d[d.AMOUNT=1]="AMOUNT",d[d.TOTAL_PRODUCT=2]="TOTAL_PRODUCT",d[d.UNIQUE_PRODUCT=3]="UNIQUE_PRODUCT",d}(B||(e.CartFilterEnum=B={})),U=function(d){return d[d.NONE=0]="NONE",d[d.ITEM=1]="ITEM",d[d.COLLECTION=2]="COLLECTION",d}(U||(e.PromotionType=U={})),R=function(d){return d[d.NONE=0]="NONE",d[d.SINGLE=1]="SINGLE",d[d.MULTIPLE=2]="MULTIPLE",d}(R||(e.EngagementCollectionSource=R={})),G=function(d){return d.BEFORE="before",d.AFTER="after",d.INSIDE_FIRST="insideFirst",d.INSIDE_LAST="insideLast",d}(G||(e.EngagementPlacementPosition=G={})),ue=function(d){return d.SHOPIFY_CHECKOUT="shopify_checkout",d.THIRD_PARTY_CHECKOUT="third_party_checkout",d.CART_PAGE="cart_page",d.CART_DRAWER="cart_drawer",d}(ue||(e.RedirectBehaviour=ue={})),Me=function(d){return d.ONCE_IN_SESSION="ONCE_IN_SESSION",d.ACROSS_SESSIONS="ACROSS_SESSIONS",d}(Me||(e.FrequencyType=Me={})),j=function(d){return d.DAYS="DAYS",d.HOURS="HOURS",d.MINUTES="MINUTES",d.SECONDS="SECONDS",d}(j||(e.FrequencyGapUnit=j={})),Q=function(d){return d[d.NONE=0]="NONE",d[d.REJECT_POPUP=1]="REJECT_POPUP",d[d.ACCEPT_POPUP=2]="ACCEPT_POPUP",d[d.GO_TO_URL=4]="GO_TO_URL",d[d.SHARE=5]="SHARE",d[d.KEY_VALUE=100]="KEY_VALUE",d[d.GO_TO_PRODUCT=101]="GO_TO_PRODUCT",d[d.ADD_TO_CART=102]="ADD_TO_CART",d[d.COPY_COUPON_CODE=103]="COPY_COUPON_CODE",d[d.GO_TO_COLLECTION=104]="GO_TO_COLLECTION",d[d.OPEN_CART=105]="OPEN_CART",d[d.SUBMIT_FORM=106]="SUBMIT_FORM",d[d.INITIATE_CHECKOUT=107]="INITIATE_CHECKOUT",d[d.ADD_BUNDLE=108]="ADD_BUNDLE",d[d.UPGRADE_TO_SUBSCRIPTION=109]="UPGRADE_TO_SUBSCRIPTION",d}(Q||(e.ClickActionType=Q={})),z=function(d){return d.POPUP="POPUP",d.PAGE_EMBED="PAGE_EMBED",d.CART_EMBED="CART_EMBED",d.ANNOUNCEMENT_BAR="ANNOUNCEMENT_BAR",d}(z||(e.OnsiteDeliveryType=z={})),J=function(d){return d.PRODUCT_PROMOTION="PRODUCT_PROMOTION",d.BUNDLE_AND_UPSELL="BUNDLE_AND_UPSELL",d.CART_RECOVERY="CART_RECOVERY",d.ANNOUNCEMENT="ANNOUNCEMENT",d.LEAD_GENERATION="LEAD_GENERATION",d.DATA_COLLECTION="DATA_COLLECTION",d.SALE_PROMOTION="SALE_PROMOTION",d.SUBSCRIPTION_UPSELL="SUBSCRIPTION_UPSELL",d.SHOPPABLE_VIDEO="SHOPPABLE_VIDEO",d.BYOB="BYOB",d.PROGRESS_BAR="PROGRESS_BAR",d.BUY_NOW="BUY_NOW",d}(J||(e.EngagementObjective=J={})),ge=function(d){return d.COOEE="COOEE",d.KLAVIYO="KLAVIYO",d}(ge||(e.EngagementContentSource=ge={})),je=function(d){return d.ICONS="ICONS",d.TILES="TILES",d}(je||(e.ProgressBarLayout=je={})),De=function(d){return d.FREE_SHIPPING="FREE_SHIPPING",d.DISCOUNT="DISCOUNT",d.FREE_AUTO_GIFT="FREE_AUTO_GIFT",d.FREE_GIFT_SELECT="FREE_GIFT_SELECT",d}(De||(e.MilestoneRewardType=De={}))}),Jo=ur(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PriceRuleType=e.DiscountType=void 0;var t=function(n){return n[n.NONE=0]="NONE",n[n.STATIC=1]="STATIC",n[n.UNIQUE_FLAT=2]="UNIQUE_FLAT",n[n.UNIQUE_FLAT_ITEMS=3]="UNIQUE_FLAT_ITEMS",n[n.UNIQUE_FIXED_ITEMS=4]="UNIQUE_FIXED_ITEMS",n[n.UNIQUE_CHEAPEST_ITEM_FREE=5]="UNIQUE_CHEAPEST_ITEM_FREE",n[n.BXGY=6]="BXGY",n}(t||(e.DiscountType=t={})),r=function(n){return n.FIXED_AMOUNT="fixed_amount",n.PERCENTAGE="percentage",n}(r||(e.PriceRuleType=r={}))}),Pc=ur(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ArrayUtils=void 0;var t=class Th{static of(n,i){return i!==void 0?new Array(n).fill(i):Array.from({length:n},(s,o)=>o)}static remove(n,i){let s=n.indexOf(i);return s===-1?!1:(n.splice(s,1),!0)}static swap(n,i,s){[n[i],n[s]]=[n[s],n[i]]}static sum(n,i){return n.reduce((s,o)=>s+Math.max(i?i(o):+o,0),0)}static unique(n,i){return n.filter((s,o,c)=>c.findIndex(u=>u[i]===s[i])===o)}static shuffle(n){let i=n.length;for(;i!=0;){let s=Math.floor(Math.random()*i);i--,Th.swap(n,i,s)}}};e.ArrayUtils=t}),wf=ur((e,t)=>{"use strict";(function(r,n){"use strict";var i="1.0.40",s="",o="?",c="function",u="undefined",p="object",m="string",h="major",y="model",E="name",v="type",_="vendor",x="version",P="architecture",B="console",U="mobile",R="tablet",G="smarttv",ue="wearable",Me="embedded",j=500,Q="Amazon",z="Apple",J="ASUS",ge="BlackBerry",je="Browser",De="Chrome",d="Edge",qe="Firefox",ve="Google",gt="Huawei",se="LG",ie="Microsoft",lt="Motorola",er="Opera",lr="Samsung",yt="Sharp",Wr="Sony",Fn="Xiaomi",rn="Zebra",Qn="Facebook",Vi="Chromium OS",Hn="Mac OS",kn=" Browser",vt=function(q,ae){var Z={};for(var Te in q)ae[Te]&&ae[Te].length%2===0?Z[Te]=ae[Te].concat(q[Te]):Z[Te]=q[Te];return Z},jr=function(q){for(var ae={},Z=0;Z<q.length;Z++)ae[q[Z].toUpperCase()]=q[Z];return ae},Gi=function(q,ae){return typeof q===m?a(ae).indexOf(a(q))!==-1:!1},a=function(q){return q.toLowerCase()},l=function(q){return typeof q===m?q.replace(/[^\d\.]/g,s).split(".")[0]:n},f=function(q,ae){if(typeof q===m)return q=q.replace(/^\s\s*/,s),typeof ae===u?q:q.substring(0,j)},T=function(q,ae){for(var Z=0,Te,Dt,Nt,Ie,ne,Ft;Z<ae.length&&!ne;){var Wi=ae[Z],ls=ae[Z+1];for(Te=Dt=0;Te<Wi.length&&!ne&&Wi[Te];)if(ne=Wi[Te++].exec(q),ne)for(Nt=0;Nt<ls.length;Nt++)Ft=ne[++Dt],Ie=ls[Nt],typeof Ie===p&&Ie.length>0?Ie.length===2?typeof Ie[1]==c?this[Ie[0]]=Ie[1].call(this,Ft):this[Ie[0]]=Ie[1]:Ie.length===3?typeof Ie[1]===c&&!(Ie[1].exec&&Ie[1].test)?this[Ie[0]]=Ft?Ie[1].call(this,Ft,Ie[2]):n:this[Ie[0]]=Ft?Ft.replace(Ie[1],Ie[2]):n:Ie.length===4&&(this[Ie[0]]=Ft?Ie[3].call(this,Ft.replace(Ie[1],Ie[2])):n):this[Ie]=Ft||n;Z+=2}},A=function(q,ae){for(var Z in ae)if(typeof ae[Z]===p&&ae[Z].length>0){for(var Te=0;Te<ae[Z].length;Te++)if(Gi(ae[Z][Te],q))return Z===o?n:Z}else if(Gi(ae[Z],q))return Z===o?n:Z;return ae.hasOwnProperty("*")?ae["*"]:q},M={"1.0":"/8","1.2":"/1","1.3":"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"},W={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2","8.1":"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},be={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[x,[E,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[x,[E,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[E,x],[/opios[\/ ]+([\w\.]+)/i],[x,[E,er+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[x,[E,er+" GX"]],[/\bopr\/([\w\.]+)/i],[x,[E,er]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[x,[E,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[x,[E,"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],[E,x],[/quark(?:pc)?\/([-\w\.]+)/i],[x,[E,"Quark"]],[/\bddg\/([\w\.]+)/i],[x,[E,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[x,[E,"UC"+je]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[x,[E,"WeChat"]],[/konqueror\/([\w\.]+)/i],[x,[E,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[x,[E,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[x,[E,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[x,[E,"Smart Lenovo "+je]],[/(avast|avg)\/([\w\.]+)/i],[[E,/(.+)/,"$1 Secure "+je],x],[/\bfocus\/([\w\.]+)/i],[x,[E,qe+" Focus"]],[/\bopt\/([\w\.]+)/i],[x,[E,er+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[x,[E,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[x,[E,"Dolphin"]],[/coast\/([\w\.]+)/i],[x,[E,er+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[x,[E,"MIUI"+kn]],[/fxios\/([\w\.-]+)/i],[x,[E,qe]],[/\bqihoobrowser\/?([\w\.]*)/i],[x,[E,"360"]],[/\b(qq)\/([\w\.]+)/i],[[E,/(.+)/,"$1Browser"],x],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[E,/(.+)/,"$1"+kn],x],[/samsungbrowser\/([\w\.]+)/i],[x,[E,lr+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[x,[E,"Sogou Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[E,"Sogou Mobile"],x],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[E,x],[/(lbbrowser|rekonq)/i,/\[(linkedin)app\]/i],[E],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[x,E],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[E,Qn],x],[/(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],[E,x],[/\bgsa\/([\w\.]+) .*safari\//i],[x,[E,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[x,[E,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[x,[E,De+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[E,De+" WebView"],x],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[x,[E,"Android "+je]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[E,x],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[x,[E,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[x,E],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[E,[x,A,M]],[/(webkit|khtml)\/([\w\.]+)/i],[E,x],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[E,"Netscape"],x],[/(wolvic|librewolf)\/([\w\.]+)/i],[E,x],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[x,[E,qe+" 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],[E,[x,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[E,[x,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[P,"amd64"]],[/(ia32(?=;))/i],[[P,a]],[/((?:i[346]|x)86)[;\)]/i],[[P,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[P,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[P,"armhf"]],[/windows (ce|mobile); ppc;/i],[[P,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[P,/ower/,s,a]],[/(sun4\w)[;\)]/i],[[P,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[P,a]]],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],[y,[_,lr],[v,R]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr])[-\w]+)/i,/sec-(sgh\w+)/i],[y,[_,lr],[v,U]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[y,[_,z],[v,U]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[y,[_,z],[v,R]],[/(macintosh);/i],[y,[_,z]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[y,[_,yt],[v,U]],[/(?:honor)([-\w ]+)[;\)]/i],[y,[_,"Honor"],[v,U]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[y,[_,gt],[v,R]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[y,[_,gt],[v,U]],[/\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],[[y,/_/g," "],[_,Fn],[v,U]],[/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[y,/_/g," "],[_,Fn],[v,R]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[y,[_,"OPPO"],[v,U]],[/\b(opd2\d{3}a?) bui/i],[y,[_,"OPPO"],[v,R]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[y,[_,"Vivo"],[v,U]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[y,[_,"Realme"],[v,U]],[/\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],[y,[_,lt],[v,U]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[y,[_,lt],[v,R]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[y,[_,se],[v,R]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[y,[_,se],[v,U]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[y,[_,"Lenovo"],[v,R]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[y,/_/g," "],[_,"Nokia"],[v,U]],[/(pixel c)\b/i],[y,[_,ve],[v,R]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[y,[_,ve],[v,U]],[/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],[y,[_,Wr],[v,U]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[y,"Xperia Tablet"],[_,Wr],[v,R]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[y,[_,"OnePlus"],[v,U]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[y,[_,Q],[v,R]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[y,/(.+)/g,"Fire Phone $1"],[_,Q],[v,U]],[/(playbook);[-\w\),; ]+(rim)/i],[y,_,[v,R]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[y,[_,ge],[v,U]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[y,[_,J],[v,R]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[y,[_,J],[v,U]],[/(nexus 9)/i],[y,[_,"HTC"],[v,R]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[_,[y,/_/g," "],[v,U]],[/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],[y,[_,"TCL"],[v,R]],[/(itel) ((\w+))/i],[[_,a],y,[v,A,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[y,[_,"Acer"],[v,R]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[y,[_,"Meizu"],[v,U]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[y,[_,"Ulefone"],[v,U]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[y,[_,"Energizer"],[v,U]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[y,[_,"Cat"],[v,U]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[y,[_,"Smartfren"],[v,U]],[/droid.+; (a(?:015|06[35]|142p?))/i],[y,[_,"Nothing"],[v,U]],[/(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],[_,y,[v,U]],[/(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],[_,y,[v,R]],[/(surface duo)/i],[y,[_,ie],[v,R]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[y,[_,"Fairphone"],[v,U]],[/(u304aa)/i],[y,[_,"AT&T"],[v,U]],[/\bsie-(\w*)/i],[y,[_,"Siemens"],[v,U]],[/\b(rct\w+) b/i],[y,[_,"RCA"],[v,R]],[/\b(venue[\d ]{2,7}) b/i],[y,[_,"Dell"],[v,R]],[/\b(q(?:mv|ta)\w+) b/i],[y,[_,"Verizon"],[v,R]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[y,[_,"Barnes & Noble"],[v,R]],[/\b(tm\d{3}\w+) b/i],[y,[_,"NuVision"],[v,R]],[/\b(k88) b/i],[y,[_,"ZTE"],[v,R]],[/\b(nx\d{3}j) b/i],[y,[_,"ZTE"],[v,U]],[/\b(gen\d{3}) b.+49h/i],[y,[_,"Swiss"],[v,U]],[/\b(zur\d{3}) b/i],[y,[_,"Swiss"],[v,R]],[/\b((zeki)?tb.*\b) b/i],[y,[_,"Zeki"],[v,R]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[_,"Dragon Touch"],y,[v,R]],[/\b(ns-?\w{0,9}) b/i],[y,[_,"Insignia"],[v,R]],[/\b((nxa|next)-?\w{0,9}) b/i],[y,[_,"NextBook"],[v,R]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[_,"Voice"],y,[v,U]],[/\b(lvtel\-)?(v1[12]) b/i],[[_,"LvTel"],y,[v,U]],[/\b(ph-1) /i],[y,[_,"Essential"],[v,U]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[y,[_,"Envizen"],[v,R]],[/\b(trio[-\w\. ]+) b/i],[y,[_,"MachSpeed"],[v,R]],[/\btu_(1491) b/i],[y,[_,"Rotor"],[v,R]],[/(shield[\w ]+) b/i],[y,[_,"Nvidia"],[v,R]],[/(sprint) (\w+)/i],[_,y,[v,U]],[/(kin\.[onetw]{3})/i],[[y,/\./g," "],[_,ie],[v,U]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[y,[_,rn],[v,R]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[y,[_,rn],[v,U]],[/smart-tv.+(samsung)/i],[_,[v,G]],[/hbbtv.+maple;(\d+)/i],[[y,/^/,"SmartTV"],[_,lr],[v,G]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[_,se],[v,G]],[/(apple) ?tv/i],[_,[y,z+" TV"],[v,G]],[/crkey/i],[[y,De+"cast"],[_,ve],[v,G]],[/droid.+aft(\w+)( bui|\))/i],[y,[_,Q],[v,G]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[y,[_,yt],[v,G]],[/(bravia[\w ]+)( bui|\))/i],[y,[_,Wr],[v,G]],[/(mitv-\w{5}) bui/i],[y,[_,Fn],[v,G]],[/Hbbtv.*(technisat) (.*);/i],[_,y,[v,G]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[_,f],[y,f],[v,G]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[v,G]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[_,y,[v,B]],[/droid.+; (shield) bui/i],[y,[_,"Nvidia"],[v,B]],[/(playstation [345portablevi]+)/i],[y,[_,Wr],[v,B]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[y,[_,ie],[v,B]],[/\b(sm-[lr]\d\d[05][fnuw]?s?)\b/i],[y,[_,lr],[v,ue]],[/((pebble))app/i],[_,y,[v,ue]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[y,[_,z],[v,ue]],[/droid.+; (glass) \d/i],[y,[_,ve],[v,ue]],[/droid.+; (wt63?0{2,3})\)/i],[y,[_,rn],[v,ue]],[/droid.+; (glass) \d/i],[y,[_,ve],[v,ue]],[/(pico) (4|neo3(?: link|pro)?)/i],[_,y,[v,ue]],[/; (quest( \d| pro)?)/i],[y,[_,Qn],[v,ue]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[_,[v,Me]],[/(aeobc)\b/i],[y,[_,Q],[v,Me]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[y,[v,U]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[y,[v,R]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[v,R]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[v,U]],[/(android[-\w\. ]{0,9});.+buil/i],[y,[_,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[x,[E,d+"HTML"]],[/(arkweb)\/([\w\.]+)/i],[E,x],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[x,[E,"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],[E,x],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[x,E]],os:[[/microsoft (windows) (vista|xp)/i],[E,x],[/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i],[E,[x,A,W]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[x,A,W],[E,"Windows"]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[x,/_/g,"."],[E,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[E,Hn],[x,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[x,E],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish|openharmony)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[E,x],[/\(bb(10);/i],[x,[E,ge]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[x,[E,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[x,[E,qe+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[x,[E,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[x,[E,"watchOS"]],[/crkey\/([\d\.]+)/i],[x,[E,De+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[E,Vi],x],[/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],[E,x],[/(sunos) ?([\w\.\d]*)/i],[[E,"Solaris"],x],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[E,x]]},me=function(q,ae){if(typeof q===p&&(ae=q,q=n),!(this instanceof me))return new me(q,ae).getResult();var Z=typeof r!==u&&r.navigator?r.navigator:n,Te=q||(Z&&Z.userAgent?Z.userAgent:s),Dt=Z&&Z.userAgentData?Z.userAgentData:n,Nt=ae?vt(be,ae):be,Ie=Z&&Z.userAgent==Te;return this.getBrowser=function(){var ne={};return ne[E]=n,ne[x]=n,T.call(ne,Te,Nt.browser),ne[h]=l(ne[x]),Ie&&Z&&Z.brave&&typeof Z.brave.isBrave==c&&(ne[E]="Brave"),ne},this.getCPU=function(){var ne={};return ne[P]=n,T.call(ne,Te,Nt.cpu),ne},this.getDevice=function(){var ne={};return ne[_]=n,ne[y]=n,ne[v]=n,T.call(ne,Te,Nt.device),Ie&&!ne[v]&&Dt&&Dt.mobile&&(ne[v]=U),Ie&&ne[y]=="Macintosh"&&Z&&typeof Z.standalone!==u&&Z.maxTouchPoints&&Z.maxTouchPoints>2&&(ne[y]="iPad",ne[v]=R),ne},this.getEngine=function(){var ne={};return ne[E]=n,ne[x]=n,T.call(ne,Te,Nt.engine),ne},this.getOS=function(){var ne={};return ne[E]=n,ne[x]=n,T.call(ne,Te,Nt.os),Ie&&!ne[E]&&Dt&&Dt.platform&&Dt.platform!="Unknown"&&(ne[E]=Dt.platform.replace(/chrome os/i,Vi).replace(/macos/i,Hn)),ne},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 Te},this.setUA=function(ne){return Te=typeof ne===m&&ne.length>j?f(ne,j):ne,this},this.setUA(Te),this};me.VERSION=i,me.BROWSER=jr([E,x,h]),me.CPU=jr([P]),me.DEVICE=jr([y,_,v,B,U,G,R,ue,Me]),me.ENGINE=me.OS=jr([E,x]),typeof e!==u?(typeof t!==u&&t.exports&&(e=t.exports=me),e.UAParser=me):typeof define===c&&define.amd?define(function(){return me}):typeof r!==u&&(r.UAParser=me);var ye=typeof r!==u&&(r.jQuery||r.Zepto);if(ye&&!ye.ua){var $e=new me;ye.ua=$e.getResult(),ye.ua.get=function(){return $e.getUA()},ye.ua.set=function(q){$e.setUA(q);var ae=$e.getResult();for(var Z in ae)ye.ua[Z]=ae[Z]}}})(typeof window=="object"?window:e)}),Tf=ur((e,t)=>{"use strict";(function(r){if(typeof e=="object"&&typeof t<"u")t.exports=r();else if(typeof define=="function"&&define.amd)define([],r);else{var n;typeof window<"u"?n=window:typeof global<"u"?n=global:typeof self<"u"?n=self:n=this,n.localforage=r()}})(function(){var r,n,i;return function s(o,c,u){function p(y,E){if(!c[y]){if(!o[y]){var v=typeof zi=="function"&&zi;if(!E&&v)return v(y,!0);if(m)return m(y,!0);var _=new Error("Cannot find module '"+y+"'");throw _.code="MODULE_NOT_FOUND",_}var x=c[y]={exports:{}};o[y][0].call(x.exports,function(P){var B=o[y][1][P];return p(B||P)},x,x.exports,s,o,c,u)}return c[y].exports}for(var m=typeof zi=="function"&&zi,h=0;h<u.length;h++)p(u[h]);return p}({1:[function(s,o,c){(function(u){"use strict";var p=u.MutationObserver||u.WebKitMutationObserver,m;if(p){var h=0,y=new p(P),E=u.document.createTextNode("");y.observe(E,{characterData:!0}),m=function(){E.data=h=++h%2}}else if(!u.setImmediate&&typeof u.MessageChannel<"u"){var v=new u.MessageChannel;v.port1.onmessage=P,m=function(){v.port2.postMessage(0)}}else"document"in u&&"onreadystatechange"in u.document.createElement("script")?m=function(){var U=u.document.createElement("script");U.onreadystatechange=function(){P(),U.onreadystatechange=null,U.parentNode.removeChild(U),U=null},u.document.documentElement.appendChild(U)}:m=function(){setTimeout(P,0)};var _,x=[];function P(){_=!0;for(var U,R,G=x.length;G;){for(R=x,x=[],U=-1;++U<G;)R[U]();G=x.length}_=!1}o.exports=B;function B(U){x.push(U)===1&&!_&&m()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(s,o,c){"use strict";var u=s(1);function p(){}var m={},h=["REJECTED"],y=["FULFILLED"],E=["PENDING"];o.exports=v;function v(j){if(typeof j!="function")throw new TypeError("resolver must be a function");this.state=E,this.queue=[],this.outcome=void 0,j!==p&&B(this,j)}v.prototype.catch=function(j){return this.then(null,j)},v.prototype.then=function(j,Q){if(typeof j!="function"&&this.state===y||typeof Q!="function"&&this.state===h)return this;var z=new this.constructor(p);if(this.state!==E){var J=this.state===y?j:Q;x(z,J,this.outcome)}else this.queue.push(new _(z,j,Q));return z};function _(j,Q,z){this.promise=j,typeof Q=="function"&&(this.onFulfilled=Q,this.callFulfilled=this.otherCallFulfilled),typeof z=="function"&&(this.onRejected=z,this.callRejected=this.otherCallRejected)}_.prototype.callFulfilled=function(j){m.resolve(this.promise,j)},_.prototype.otherCallFulfilled=function(j){x(this.promise,this.onFulfilled,j)},_.prototype.callRejected=function(j){m.reject(this.promise,j)},_.prototype.otherCallRejected=function(j){x(this.promise,this.onRejected,j)};function x(j,Q,z){u(function(){var J;try{J=Q(z)}catch(ge){return m.reject(j,ge)}J===j?m.reject(j,new TypeError("Cannot resolve promise with itself")):m.resolve(j,J)})}m.resolve=function(j,Q){var z=U(P,Q);if(z.status==="error")return m.reject(j,z.value);var J=z.value;if(J)B(j,J);else{j.state=y,j.outcome=Q;for(var ge=-1,je=j.queue.length;++ge<je;)j.queue[ge].callFulfilled(Q)}return j},m.reject=function(j,Q){j.state=h,j.outcome=Q;for(var z=-1,J=j.queue.length;++z<J;)j.queue[z].callRejected(Q);return j};function P(j){var Q=j&&j.then;if(j&&(typeof j=="object"||typeof j=="function")&&typeof Q=="function")return function(){Q.apply(j,arguments)}}function B(j,Q){var z=!1;function J(d){z||(z=!0,m.reject(j,d))}function ge(d){z||(z=!0,m.resolve(j,d))}function je(){Q(ge,J)}var De=U(je);De.status==="error"&&J(De.value)}function U(j,Q){var z={};try{z.value=j(Q),z.status="success"}catch(J){z.status="error",z.value=J}return z}v.resolve=R;function R(j){return j instanceof this?j:m.resolve(new this(p),j)}v.reject=G;function G(j){var Q=new this(p);return m.reject(Q,j)}v.all=ue;function ue(j){var Q=this;if(Object.prototype.toString.call(j)!=="[object Array]")return this.reject(new TypeError("must be an array"));var z=j.length,J=!1;if(!z)return this.resolve([]);for(var ge=new Array(z),je=0,De=-1,d=new this(p);++De<z;)qe(j[De],De);return d;function qe(ve,gt){Q.resolve(ve).then(se,function(ie){J||(J=!0,m.reject(d,ie))});function se(ie){ge[gt]=ie,++je===z&&!J&&(J=!0,m.resolve(d,ge))}}}v.race=Me;function Me(j){var Q=this;if(Object.prototype.toString.call(j)!=="[object Array]")return this.reject(new TypeError("must be an array"));var z=j.length,J=!1;if(!z)return this.resolve([]);for(var ge=-1,je=new this(p);++ge<z;)De(j[ge]);return je;function De(d){Q.resolve(d).then(function(qe){J||(J=!0,m.resolve(je,qe))},function(qe){J||(J=!0,m.reject(je,qe))})}}},{1:1}],3:[function(s,o,c){(function(u){"use strict";typeof u.Promise!="function"&&(u.Promise=s(2))}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(s,o,c){"use strict";var u=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(g){return typeof g}:function(g){return g&&typeof Symbol=="function"&&g.constructor===Symbol&&g!==Symbol.prototype?"symbol":typeof g};function p(g,S){if(!(g instanceof S))throw new TypeError("Cannot call a class as a function")}function m(){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 h=m();function y(){try{if(!h||!h.open)return!1;var g=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(!g||S)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function E(g,S){g=g||[],S=S||{};try{return new Blob(g,S)}catch(O){if(O.name!=="TypeError")throw O;for(var I=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,D=new I,C=0;C<g.length;C+=1)D.append(g[C]);return D.getBlob(S.type)}}typeof Promise>"u"&&s(3);var v=Promise;function _(g,S){S&&g.then(function(I){S(null,I)},function(I){S(I)})}function x(g,S,I){typeof S=="function"&&g.then(S),typeof I=="function"&&g.catch(I)}function P(g){return typeof g!="string"&&(console.warn(g+" used as a key, but it is not a string."),g=String(g)),g}function B(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var U="local-forage-detect-blob-support",R=void 0,G={},ue=Object.prototype.toString,Me="readonly",j="readwrite";function Q(g){for(var S=g.length,I=new ArrayBuffer(S),D=new Uint8Array(I),C=0;C<S;C++)D[C]=g.charCodeAt(C);return I}function z(g){return new v(function(S){var I=g.transaction(U,j),D=E([""]);I.objectStore(U).put(D,"key"),I.onabort=function(C){C.preventDefault(),C.stopPropagation(),S(!1)},I.oncomplete=function(){var C=navigator.userAgent.match(/Chrome\/(\d+)/),O=navigator.userAgent.match(/Edge\//);S(O||!C||parseInt(C[1],10)>=43)}}).catch(function(){return!1})}function J(g){return typeof R=="boolean"?v.resolve(R):z(g).then(function(S){return R=S,R})}function ge(g){var S=G[g.name],I={};I.promise=new v(function(D,C){I.resolve=D,I.reject=C}),S.deferredOperations.push(I),S.dbReady?S.dbReady=S.dbReady.then(function(){return I.promise}):S.dbReady=I.promise}function je(g){var S=G[g.name],I=S.deferredOperations.pop();if(I)return I.resolve(),I.promise}function De(g,S){var I=G[g.name],D=I.deferredOperations.pop();if(D)return D.reject(S),D.promise}function d(g,S){return new v(function(I,D){if(G[g.name]=G[g.name]||Wr(),g.db)if(S)ge(g),g.db.close();else return I(g.db);var C=[g.name];S&&C.push(g.version);var O=h.open.apply(h,C);S&&(O.onupgradeneeded=function(L){var $=O.result;try{$.createObjectStore(g.storeName),L.oldVersion<=1&&$.createObjectStore(U)}catch(V){if(V.name==="ConstraintError")console.warn('The database "'+g.name+'" has been upgraded from version '+L.oldVersion+" to version "+L.newVersion+', but the storage "'+g.storeName+'" already exists.');else throw V}}),O.onerror=function(L){L.preventDefault(),D(O.error)},O.onsuccess=function(){var L=O.result;L.onversionchange=function($){$.target.close()},I(L),je(g)}})}function qe(g){return d(g,!1)}function ve(g){return d(g,!0)}function gt(g,S){if(!g.db)return!0;var I=!g.db.objectStoreNames.contains(g.storeName),D=g.version<g.db.version,C=g.version>g.db.version;if(D&&(g.version!==S&&console.warn('The database "'+g.name+`" can't be downgraded from version `+g.db.version+" to version "+g.version+"."),g.version=g.db.version),C||I){if(I){var O=g.db.version+1;O>g.version&&(g.version=O)}return!0}return!1}function se(g){return new v(function(S,I){var D=new FileReader;D.onerror=I,D.onloadend=function(C){var O=btoa(C.target.result||"");S({__local_forage_encoded_blob:!0,data:O,type:g.type})},D.readAsBinaryString(g)})}function ie(g){var S=Q(atob(g.data));return E([S],{type:g.type})}function lt(g){return g&&g.__local_forage_encoded_blob}function er(g){var S=this,I=S._initReady().then(function(){var D=G[S._dbInfo.name];if(D&&D.dbReady)return D.dbReady});return x(I,g,g),I}function lr(g){ge(g);for(var S=G[g.name],I=S.forages,D=0;D<I.length;D++){var C=I[D];C._dbInfo.db&&(C._dbInfo.db.close(),C._dbInfo.db=null)}return g.db=null,qe(g).then(function(O){return g.db=O,gt(g)?ve(g):O}).then(function(O){g.db=S.db=O;for(var L=0;L<I.length;L++)I[L]._dbInfo.db=O}).catch(function(O){throw De(g,O),O})}function yt(g,S,I,D){D===void 0&&(D=1);try{var C=g.db.transaction(g.storeName,S);I(null,C)}catch(O){if(D>0&&(!g.db||O.name==="InvalidStateError"||O.name==="NotFoundError"))return v.resolve().then(function(){if(!g.db||O.name==="NotFoundError"&&!g.db.objectStoreNames.contains(g.storeName)&&g.version<=g.db.version)return g.db&&(g.version=g.db.version+1),ve(g)}).then(function(){return lr(g).then(function(){yt(g,S,I,D-1)})}).catch(I);I(O)}}function Wr(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function Fn(g){var S=this,I={db:null};if(g)for(var D in g)I[D]=g[D];var C=G[I.name];C||(C=Wr(),G[I.name]=C),C.forages.push(S),S._initReady||(S._initReady=S.ready,S.ready=er);var O=[];function L(){return v.resolve()}for(var $=0;$<C.forages.length;$++){var V=C.forages[$];V!==S&&O.push(V._initReady().catch(L))}var H=C.forages.slice(0);return v.all(O).then(function(){return I.db=C.db,qe(I)}).then(function(F){return I.db=F,gt(I,S._defaultConfig.version)?ve(I):F}).then(function(F){I.db=C.db=F,S._dbInfo=I;for(var Y=0;Y<H.length;Y++){var he=H[Y];he!==S&&(he._dbInfo.db=I.db,he._dbInfo.version=I.version)}})}function rn(g,S){var I=this;g=P(g);var D=new v(function(C,O){I.ready().then(function(){yt(I._dbInfo,Me,function(L,$){if(L)return O(L);try{var V=$.objectStore(I._dbInfo.storeName),H=V.get(g);H.onsuccess=function(){var F=H.result;F===void 0&&(F=null),lt(F)&&(F=ie(F)),C(F)},H.onerror=function(){O(H.error)}}catch(F){O(F)}})}).catch(O)});return _(D,S),D}function Qn(g,S){var I=this,D=new v(function(C,O){I.ready().then(function(){yt(I._dbInfo,Me,function(L,$){if(L)return O(L);try{var V=$.objectStore(I._dbInfo.storeName),H=V.openCursor(),F=1;H.onsuccess=function(){var Y=H.result;if(Y){var he=Y.value;lt(he)&&(he=ie(he));var Ve=g(he,Y.key,F++);Ve!==void 0?C(Ve):Y.continue()}else C()},H.onerror=function(){O(H.error)}}catch(Y){O(Y)}})}).catch(O)});return _(D,S),D}function Vi(g,S,I){var D=this;g=P(g);var C=new v(function(O,L){var $;D.ready().then(function(){return $=D._dbInfo,ue.call(S)==="[object Blob]"?J($.db).then(function(V){return V?S:se(S)}):S}).then(function(V){yt(D._dbInfo,j,function(H,F){if(H)return L(H);try{var Y=F.objectStore(D._dbInfo.storeName);V===null&&(V=void 0);var he=Y.put(V,g);F.oncomplete=function(){V===void 0&&(V=null),O(V)},F.onabort=F.onerror=function(){var Ve=he.error?he.error:he.transaction.error;L(Ve)}}catch(Ve){L(Ve)}})}).catch(L)});return _(C,I),C}function Hn(g,S){var I=this;g=P(g);var D=new v(function(C,O){I.ready().then(function(){yt(I._dbInfo,j,function(L,$){if(L)return O(L);try{var V=$.objectStore(I._dbInfo.storeName),H=V.delete(g);$.oncomplete=function(){C()},$.onerror=function(){O(H.error)},$.onabort=function(){var F=H.error?H.error:H.transaction.error;O(F)}}catch(F){O(F)}})}).catch(O)});return _(D,S),D}function kn(g){var S=this,I=new v(function(D,C){S.ready().then(function(){yt(S._dbInfo,j,function(O,L){if(O)return C(O);try{var $=L.objectStore(S._dbInfo.storeName),V=$.clear();L.oncomplete=function(){D()},L.onabort=L.onerror=function(){var H=V.error?V.error:V.transaction.error;C(H)}}catch(H){C(H)}})}).catch(C)});return _(I,g),I}function vt(g){var S=this,I=new v(function(D,C){S.ready().then(function(){yt(S._dbInfo,Me,function(O,L){if(O)return C(O);try{var $=L.objectStore(S._dbInfo.storeName),V=$.count();V.onsuccess=function(){D(V.result)},V.onerror=function(){C(V.error)}}catch(H){C(H)}})}).catch(C)});return _(I,g),I}function jr(g,S){var I=this,D=new v(function(C,O){if(g<0){C(null);return}I.ready().then(function(){yt(I._dbInfo,Me,function(L,$){if(L)return O(L);try{var V=$.objectStore(I._dbInfo.storeName),H=!1,F=V.openKeyCursor();F.onsuccess=function(){var Y=F.result;if(!Y){C(null);return}g===0||H?C(Y.key):(H=!0,Y.advance(g))},F.onerror=function(){O(F.error)}}catch(Y){O(Y)}})}).catch(O)});return _(D,S),D}function Gi(g){var S=this,I=new v(function(D,C){S.ready().then(function(){yt(S._dbInfo,Me,function(O,L){if(O)return C(O);try{var $=L.objectStore(S._dbInfo.storeName),V=$.openKeyCursor(),H=[];V.onsuccess=function(){var F=V.result;if(!F){D(H);return}H.push(F.key),F.continue()},V.onerror=function(){C(V.error)}}catch(F){C(F)}})}).catch(C)});return _(I,g),I}function a(g,S){S=B.apply(this,arguments);var I=this.config();g=typeof g!="function"&&g||{},g.name||(g.name=g.name||I.name,g.storeName=g.storeName||I.storeName);var D=this,C;if(!g.name)C=v.reject("Invalid arguments");else{var O=g.name===I.name&&D._dbInfo.db,L=O?v.resolve(D._dbInfo.db):qe(g).then(function($){var V=G[g.name],H=V.forages;V.db=$;for(var F=0;F<H.length;F++)H[F]._dbInfo.db=$;return $});g.storeName?C=L.then(function($){if($.objectStoreNames.contains(g.storeName)){var V=$.version+1;ge(g);var H=G[g.name],F=H.forages;$.close();for(var Y=0;Y<F.length;Y++){var he=F[Y];he._dbInfo.db=null,he._dbInfo.version=V}var Ve=new v(function(Ae,ut){var Ge=h.open(g.name,V);Ge.onerror=function(Ht){var Tc=Ge.result;Tc.close(),ut(Ht)},Ge.onupgradeneeded=function(){var Ht=Ge.result;Ht.deleteObjectStore(g.storeName)},Ge.onsuccess=function(){var Ht=Ge.result;Ht.close(),Ae(Ht)}});return Ve.then(function(Ae){H.db=Ae;for(var ut=0;ut<F.length;ut++){var Ge=F[ut];Ge._dbInfo.db=Ae,je(Ge._dbInfo)}}).catch(function(Ae){throw(De(g,Ae)||v.resolve()).catch(function(){}),Ae})}}):C=L.then(function($){ge(g);var V=G[g.name],H=V.forages;$.close();for(var F=0;F<H.length;F++){var Y=H[F];Y._dbInfo.db=null}var he=new v(function(Ve,Ae){var ut=h.deleteDatabase(g.name);ut.onerror=function(){var Ge=ut.result;Ge&&Ge.close(),Ae(ut.error)},ut.onblocked=function(){console.warn('dropInstance blocked for database "'+g.name+'" until all open connections are closed')},ut.onsuccess=function(){var Ge=ut.result;Ge&&Ge.close(),Ve(Ge)}});return he.then(function(Ve){V.db=Ve;for(var Ae=0;Ae<H.length;Ae++){var ut=H[Ae];je(ut._dbInfo)}}).catch(function(Ve){throw(De(g,Ve)||v.resolve()).catch(function(){}),Ve})})}return _(C,S),C}var l={_driver:"asyncStorage",_initStorage:Fn,_support:y(),iterate:Qn,getItem:rn,setItem:Vi,removeItem:Hn,clear:kn,length:vt,key:jr,keys:Gi,dropInstance:a};function f(){return typeof openDatabase=="function"}var T="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",A="~~local_forage_type~",M=/^~~local_forage_type~([^~]+)~/,W="__lfsc__:",be=W.length,me="arbf",ye="blob",$e="si08",q="ui08",ae="uic8",Z="si16",Te="si32",Dt="ur16",Nt="ui32",Ie="fl32",ne="fl64",Ft=be+me.length,Wi=Object.prototype.toString;function ls(g){var S=g.length*.75,I=g.length,D,C=0,O,L,$,V;g[g.length-1]==="="&&(S--,g[g.length-2]==="="&&S--);var H=new ArrayBuffer(S),F=new Uint8Array(H);for(D=0;D<I;D+=4)O=T.indexOf(g[D]),L=T.indexOf(g[D+1]),$=T.indexOf(g[D+2]),V=T.indexOf(g[D+3]),F[C++]=O<<2|L>>4,F[C++]=(L&15)<<4|$>>2,F[C++]=($&3)<<6|V&63;return H}function Qo(g){var S=new Uint8Array(g),I="",D;for(D=0;D<S.length;D+=3)I+=T[S[D]>>2],I+=T[(S[D]&3)<<4|S[D+1]>>4],I+=T[(S[D+1]&15)<<2|S[D+2]>>6],I+=T[S[D+2]&63];return S.length%3===2?I=I.substring(0,I.length-1)+"=":S.length%3===1&&(I=I.substring(0,I.length-2)+"=="),I}function Kh(g,S){var I="";if(g&&(I=Wi.call(g)),g&&(I==="[object ArrayBuffer]"||g.buffer&&Wi.call(g.buffer)==="[object ArrayBuffer]")){var D,C=W;g instanceof ArrayBuffer?(D=g,C+=me):(D=g.buffer,I==="[object Int8Array]"?C+=$e:I==="[object Uint8Array]"?C+=q:I==="[object Uint8ClampedArray]"?C+=ae:I==="[object Int16Array]"?C+=Z:I==="[object Uint16Array]"?C+=Dt:I==="[object Int32Array]"?C+=Te:I==="[object Uint32Array]"?C+=Nt:I==="[object Float32Array]"?C+=Ie:I==="[object Float64Array]"?C+=ne:S(new Error("Failed to get type for BinaryArray"))),S(C+Qo(D))}else if(I==="[object Blob]"){var O=new FileReader;O.onload=function(){var L=A+g.type+"~"+Qo(this.result);S(W+ye+L)},O.readAsArrayBuffer(g)}else try{S(JSON.stringify(g))}catch(L){console.error("Couldn't convert value into a JSON string: ",g),S(null,L)}}function Yh(g){if(g.substring(0,be)!==W)return JSON.parse(g);var S=g.substring(Ft),I=g.substring(be,Ft),D;if(I===ye&&M.test(S)){var C=S.match(M);D=C[1],S=S.substring(C[0].length)}var O=ls(S);switch(I){case me:return O;case ye:return E([O],{type:D});case $e:return new Int8Array(O);case q:return new Uint8Array(O);case ae:return new Uint8ClampedArray(O);case Z:return new Int16Array(O);case Dt:return new Uint16Array(O);case Te:return new Int32Array(O);case Nt:return new Uint32Array(O);case Ie:return new Float32Array(O);case ne:return new Float64Array(O);default:throw new Error("Unkown type: "+I)}}var Sa={serialize:Kh,deserialize:Yh,stringToBuffer:ls,bufferToString:Qo};function Qu(g,S,I,D){g.executeSql("CREATE TABLE IF NOT EXISTS "+S.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],I,D)}function zh(g){var S=this,I={db:null};if(g)for(var D in g)I[D]=typeof g[D]!="string"?g[D].toString():g[D];var C=new v(function(O,L){try{I.db=openDatabase(I.name,String(I.version),I.description,I.size)}catch($){return L($)}I.db.transaction(function($){Qu($,I,function(){S._dbInfo=I,O()},function(V,H){L(H)})},L)});return I.serializer=Sa,C}function $n(g,S,I,D,C,O){g.executeSql(I,D,C,function(L,$){$.code===$.SYNTAX_ERR?L.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[S.storeName],function(V,H){H.rows.length?O(V,$):Qu(V,S,function(){V.executeSql(I,D,C,O)},O)},O):O(L,$)},O)}function Xh(g,S){var I=this;g=P(g);var D=new v(function(C,O){I.ready().then(function(){var L=I._dbInfo;L.db.transaction(function($){$n($,L,"SELECT * FROM "+L.storeName+" WHERE key = ? LIMIT 1",[g],function(V,H){var F=H.rows.length?H.rows.item(0).value:null;F&&(F=L.serializer.deserialize(F)),C(F)},function(V,H){O(H)})})}).catch(O)});return _(D,S),D}function Jh(g,S){var I=this,D=new v(function(C,O){I.ready().then(function(){var L=I._dbInfo;L.db.transaction(function($){$n($,L,"SELECT * FROM "+L.storeName,[],function(V,H){for(var F=H.rows,Y=F.length,he=0;he<Y;he++){var Ve=F.item(he),Ae=Ve.value;if(Ae&&(Ae=L.serializer.deserialize(Ae)),Ae=g(Ae,Ve.key,he+1),Ae!==void 0){C(Ae);return}}C()},function(V,H){O(H)})})}).catch(O)});return _(D,S),D}function Zu(g,S,I,D){var C=this;g=P(g);var O=new v(function(L,$){C.ready().then(function(){S===void 0&&(S=null);var V=S,H=C._dbInfo;H.serializer.serialize(S,function(F,Y){Y?$(Y):H.db.transaction(function(he){$n(he,H,"INSERT OR REPLACE INTO "+H.storeName+" (key, value) VALUES (?, ?)",[g,F],function(){L(V)},function(Ve,Ae){$(Ae)})},function(he){if(he.code===he.QUOTA_ERR){if(D>0){L(Zu.apply(C,[g,V,I,D-1]));return}$(he)}})})}).catch($)});return _(O,I),O}function Qh(g,S,I){return Zu.apply(this,[g,S,I,1])}function Zh(g,S){var I=this;g=P(g);var D=new v(function(C,O){I.ready().then(function(){var L=I._dbInfo;L.db.transaction(function($){$n($,L,"DELETE FROM "+L.storeName+" WHERE key = ?",[g],function(){C()},function(V,H){O(H)})})}).catch(O)});return _(D,S),D}function tp(g){var S=this,I=new v(function(D,C){S.ready().then(function(){var O=S._dbInfo;O.db.transaction(function(L){$n(L,O,"DELETE FROM "+O.storeName,[],function(){D()},function($,V){C(V)})})}).catch(C)});return _(I,g),I}function rp(g){var S=this,I=new v(function(D,C){S.ready().then(function(){var O=S._dbInfo;O.db.transaction(function(L){$n(L,O,"SELECT COUNT(key) as c FROM "+O.storeName,[],function($,V){var H=V.rows.item(0).c;D(H)},function($,V){C(V)})})}).catch(C)});return _(I,g),I}function np(g,S){var I=this,D=new v(function(C,O){I.ready().then(function(){var L=I._dbInfo;L.db.transaction(function($){$n($,L,"SELECT key FROM "+L.storeName+" WHERE id = ? LIMIT 1",[g+1],function(V,H){var F=H.rows.length?H.rows.item(0).key:null;C(F)},function(V,H){O(H)})})}).catch(O)});return _(D,S),D}function ip(g){var S=this,I=new v(function(D,C){S.ready().then(function(){var O=S._dbInfo;O.db.transaction(function(L){$n(L,O,"SELECT key FROM "+O.storeName,[],function($,V){for(var H=[],F=0;F<V.rows.length;F++)H.push(V.rows.item(F).key);D(H)},function($,V){C(V)})})}).catch(C)});return _(I,g),I}function sp(g){return new v(function(S,I){g.transaction(function(D){D.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(C,O){for(var L=[],$=0;$<O.rows.length;$++)L.push(O.rows.item($).name);S({db:g,storeNames:L})},function(C,O){I(O)})},function(D){I(D)})})}function op(g,S){S=B.apply(this,arguments);var I=this.config();g=typeof g!="function"&&g||{},g.name||(g.name=g.name||I.name,g.storeName=g.storeName||I.storeName);var D=this,C;return g.name?C=new v(function(O){var L;g.name===I.name?L=D._dbInfo.db:L=openDatabase(g.name,"","",0),g.storeName?O({db:L,storeNames:[g.storeName]}):O(sp(L))}).then(function(O){return new v(function(L,$){O.db.transaction(function(V){function H(Ve){return new v(function(Ae,ut){V.executeSql("DROP TABLE IF EXISTS "+Ve,[],function(){Ae()},function(Ge,Ht){ut(Ht)})})}for(var F=[],Y=0,he=O.storeNames.length;Y<he;Y++)F.push(H(O.storeNames[Y]));v.all(F).then(function(){L()}).catch(function(Ve){$(Ve)})},function(V){$(V)})})}):C=v.reject("Invalid arguments"),_(C,S),C}var hp={_driver:"webSQLStorage",_initStorage:zh,_support:f(),iterate:Jh,getItem:Xh,setItem:Qh,removeItem:Zh,clear:tp,length:rp,key:np,keys:ip,dropInstance:op};function pp(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function wh(g,S){var I=g.name+"/";return g.storeName!==S.storeName&&(I+=g.storeName+"/"),I}function dp(){var g="_localforage_support_test";try{return localStorage.setItem(g,!0),localStorage.removeItem(g),!1}catch{return!0}}function fp(){return!dp()||localStorage.length>0}function gp(g){var S=this,I={};if(g)for(var D in g)I[D]=g[D];return I.keyPrefix=wh(g,S._defaultConfig),fp()?(S._dbInfo=I,I.serializer=Sa,v.resolve()):v.reject()}function mp(g){var S=this,I=S.ready().then(function(){for(var D=S._dbInfo.keyPrefix,C=localStorage.length-1;C>=0;C--){var O=localStorage.key(C);O.indexOf(D)===0&&localStorage.removeItem(O)}});return _(I,g),I}function yp(g,S){var I=this;g=P(g);var D=I.ready().then(function(){var C=I._dbInfo,O=localStorage.getItem(C.keyPrefix+g);return O&&(O=C.serializer.deserialize(O)),O});return _(D,S),D}function vp(g,S){var I=this,D=I.ready().then(function(){for(var C=I._dbInfo,O=C.keyPrefix,L=O.length,$=localStorage.length,V=1,H=0;H<$;H++){var F=localStorage.key(H);if(F.indexOf(O)===0){var Y=localStorage.getItem(F);if(Y&&(Y=C.serializer.deserialize(Y)),Y=g(Y,F.substring(L),V++),Y!==void 0)return Y}}});return _(D,S),D}function wp(g,S){var I=this,D=I.ready().then(function(){var C=I._dbInfo,O;try{O=localStorage.key(g)}catch{O=null}return O&&(O=O.substring(C.keyPrefix.length)),O});return _(D,S),D}function bp(g){var S=this,I=S.ready().then(function(){for(var D=S._dbInfo,C=localStorage.length,O=[],L=0;L<C;L++){var $=localStorage.key(L);$.indexOf(D.keyPrefix)===0&&O.push($.substring(D.keyPrefix.length))}return O});return _(I,g),I}function _p(g){var S=this,I=S.keys().then(function(D){return D.length});return _(I,g),I}function Ep(g,S){var I=this;g=P(g);var D=I.ready().then(function(){var C=I._dbInfo;localStorage.removeItem(C.keyPrefix+g)});return _(D,S),D}function Sp(g,S,I){var D=this;g=P(g);var C=D.ready().then(function(){S===void 0&&(S=null);var O=S;return new v(function(L,$){var V=D._dbInfo;V.serializer.serialize(S,function(H,F){if(F)$(F);else try{localStorage.setItem(V.keyPrefix+g,H),L(O)}catch(Y){(Y.name==="QuotaExceededError"||Y.name==="NS_ERROR_DOM_QUOTA_REACHED")&&$(Y),$(Y)}})})});return _(C,I),C}function Ip(g,S){if(S=B.apply(this,arguments),g=typeof g!="function"&&g||{},!g.name){var I=this.config();g.name=g.name||I.name,g.storeName=g.storeName||I.storeName}var D=this,C;return g.name?C=new v(function(O){g.storeName?O(wh(g,D._defaultConfig)):O(g.name+"/")}).then(function(O){for(var L=localStorage.length-1;L>=0;L--){var $=localStorage.key(L);$.indexOf(O)===0&&localStorage.removeItem($)}}):C=v.reject("Invalid arguments"),_(C,S),C}var Tp={_driver:"localStorageWrapper",_initStorage:gp,_support:pp(),iterate:vp,getItem:yp,setItem:Sp,removeItem:Ep,clear:mp,length:_p,key:wp,keys:bp,dropInstance:Ip},Cp=function(g,S){return g===S||typeof g=="number"&&typeof S=="number"&&isNaN(g)&&isNaN(S)},Np=function(g,S){for(var I=g.length,D=0;D<I;){if(Cp(g[D],S))return!0;D++}return!1},bh=Array.isArray||function(g){return Object.prototype.toString.call(g)==="[object Array]"},eo={},Eh={},Yi={INDEXEDDB:l,WEBSQL:hp,LOCALSTORAGE:Tp},xp=[Yi.INDEXEDDB._driver,Yi.WEBSQL._driver,Yi.LOCALSTORAGE._driver],zo=["dropInstance"],qa=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(zo),Dp={description:"",driver:xp.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function Op(g,S){g[S]=function(){var I=arguments;return g.ready().then(function(){return g[S].apply(g,I)})}}function Ic(){for(var g=1;g<arguments.length;g++){var S=arguments[g];if(S)for(var I in S)S.hasOwnProperty(I)&&(bh(S[I])?arguments[0][I]=S[I].slice():arguments[0][I]=S[I])}return arguments[0]}var Ap=function(){function g(S){p(this,g);for(var I in Yi)if(Yi.hasOwnProperty(I)){var D=Yi[I],C=D._driver;this[I]=C,eo[C]||this.defineDriver(D)}this._defaultConfig=Ic({},Dp),this._config=Ic({},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 g.prototype.config=function(S){if((typeof S>"u"?"undefined":u(S))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var I in S){if(I==="storeName"&&(S[I]=S[I].replace(/\W/g,"_")),I==="version"&&typeof S[I]!="number")return new Error("Database version must be a number.");this._config[I]=S[I]}return"driver"in S&&S.driver?this.setDriver(this._config.driver):!0}else return typeof S=="string"?this._config[S]:this._config},g.prototype.defineDriver=function(S,I,D){var C=new v(function(O,L){try{var $=S._driver,V=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!S._driver){L(V);return}for(var H=qa.concat("_initStorage"),F=0,Y=H.length;F<Y;F++){var he=H[F],Ve=!Np(zo,he);if((Ve||S[he])&&typeof S[he]!="function"){L(V);return}}var Ae=function(){for(var Ge=function(Pp){return function(){var Rp=new Error("Method "+Pp+" is not implemented by the current driver"),Sh=v.reject(Rp);return _(Sh,arguments[arguments.length-1]),Sh}},Ht=0,Tc=zo.length;Ht<Tc;Ht++){var Cc=zo[Ht];S[Cc]||(S[Cc]=Ge(Cc))}};Ae();var ut=function(Ge){eo[$]&&console.info("Redefining LocalForage driver: "+$),eo[$]=S,Eh[$]=Ge,O()};"_support"in S?S._support&&typeof S._support=="function"?S._support().then(ut,L):ut(!!S._support):ut(!0)}catch(Ge){L(Ge)}});return x(C,I,D),C},g.prototype.driver=function(){return this._driver||null},g.prototype.getDriver=function(S,I,D){var C=eo[S]?v.resolve(eo[S]):v.reject(new Error("Driver not found."));return x(C,I,D),C},g.prototype.getSerializer=function(S){var I=v.resolve(Sa);return x(I,S),I},g.prototype.ready=function(S){var I=this,D=I._driverSet.then(function(){return I._ready===null&&(I._ready=I._initDriver()),I._ready});return x(D,S,S),D},g.prototype.setDriver=function(S,I,D){var C=this;bh(S)||(S=[S]);var O=this._getSupportedDrivers(S);function L(){C._config.driver=C.driver()}function $(F){return C._extend(F),L(),C._ready=C._initStorage(C._config),C._ready}function V(F){return function(){var Y=0;function he(){for(;Y<F.length;){var Ve=F[Y];return Y++,C._dbInfo=null,C._ready=null,C.getDriver(Ve).then($).catch(he)}L();var Ae=new Error("No available storage method found.");return C._driverSet=v.reject(Ae),C._driverSet}return he()}}var H=this._driverSet!==null?this._driverSet.catch(function(){return v.resolve()}):v.resolve();return this._driverSet=H.then(function(){var F=O[0];return C._dbInfo=null,C._ready=null,C.getDriver(F).then(function(Y){C._driver=Y._driver,L(),C._wrapLibraryMethodsWithReady(),C._initDriver=V(O)})}).catch(function(){L();var F=new Error("No available storage method found.");return C._driverSet=v.reject(F),C._driverSet}),x(this._driverSet,I,D),this._driverSet},g.prototype.supports=function(S){return!!Eh[S]},g.prototype._extend=function(S){Ic(this,S)},g.prototype._getSupportedDrivers=function(S){for(var I=[],D=0,C=S.length;D<C;D++){var O=S[D];this.supports(O)&&I.push(O)}return I},g.prototype._wrapLibraryMethodsWithReady=function(){for(var S=0,I=qa.length;S<I;S++)Op(this,qa[S])},g.prototype.createInstance=function(S){return new g(S)},g}(),kp=new Ap;o.exports=kp},{3:3}]},{},[4])(4)})}),Zn=ur(e=>{"use strict";var t=e&&e.__awaiter||function(n,i,s,o){function c(u){return u instanceof s?u:new s(function(p){p(u)})}return new(s||(s=Promise))(function(u,p){function m(E){try{y(o.next(E))}catch(v){p(v)}}function h(E){try{y(o.throw(E))}catch(v){p(v)}}function y(E){E.done?u(E.value):c(E.value).then(m,h)}y((o=o.apply(n,i||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.JSUtils=void 0;var r=class{static isObject(n){return typeof n=="object"&&!Array.isArray(n)&&n!==null}static parseToAny(n){try{return JSON.parse(n.toString())}catch{}return n.toString().match(this.ISO_WITHOUT_MS_REGEX)?new Date(n.toString()):n}static sleep(n){return t(this,void 0,void 0,function*(){return new Promise(i=>setTimeout(i,n))})}static hasKeys(n){return n?Object.keys(n).length>=1:!1}static convertObjectToArray(n,i){return i.reduce((s,o)=>(n.hasOwnProperty(o)&&n[o]!=null&&s.push({[o]:n[o]}),s),[])}static removeNullUndefinedKeys(n){return Object.keys(n).reduce((i,s)=>(n[s]!==null&&n[s]!==void 0&&(i[s]=n[s]),i),{})}static stringify(n){return JSON.stringify(n,function(i,s){return s===void 0?null:s})}};e.JSUtils=r,r.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)/)}),Fu=ur(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.URLBuilder=void 0;var t=function(){function r(n){try{this.base=new URL(n),this.params=new URLSearchParams(this.base.search.slice(1))}catch(i){console.error("Un-parsable URL",i)}}return r.prototype.appendQueryParam=function(n,i){this.params.append(n,i?i.toString():"")},r.prototype.clearQueryParams=function(){return this.params=new URLSearchParams,this},r.prototype.deleteQueryParam=function(n){this.params.delete(n)},r.prototype.getBase=function(){return this.base},r.prototype.getPath=function(){return this.base.pathname},r.prototype.getHostname=function(){return this.base.hostname},r.prototype.getParams=function(){return this.params},r.prototype.getQueryParam=function(n){if(!this.params)return"";var i=this.params.get(n);return!i||i==="undefined"||i==="null"?void 0:i},r.prototype.getQueryString=function(){return this.params.toString()},r.prototype.setPath=function(n){return this.base.pathname=n,this},r.prototype.setQueryParam=function(n,i){return this.params.set(n,i?i.toString():""),this},r.prototype.setQueryString=function(n){if(n)return n[0]==="?"&&(n=n.slice(1)),this.params=new URLSearchParams(n),this},r.prototype.toString=function(){var n=this.params.toString();return n===""?this.base.search="":this.base.search="?"+n,this.base.toString()},r}();e.URLBuilder=t}),rh=ur((e,t)=>{"use strict";(function(r,n){typeof e=="object"&&typeof t<"u"?t.exports=n():typeof define=="function"&&define.amd?define(n):(r=typeof globalThis<"u"?globalThis:r||self,r.fetchRetry=n())})(e,function(){"use strict";var r=function(s,o){if(o=o||{},typeof s!="function")throw new i("fetch must be a function");if(typeof o!="object")throw new i("defaults must be an object");if(o.retries!==void 0&&!n(o.retries))throw new i("retries must be a positive integer");if(o.retryDelay!==void 0&&!n(o.retryDelay)&&typeof o.retryDelay!="function")throw new i("retryDelay must be a positive integer or a function returning a positive integer");if(o.retryOn!==void 0&&!Array.isArray(o.retryOn)&&typeof o.retryOn!="function")throw new i("retryOn property expects an array or function");var c={retries:3,retryDelay:1e3,retryOn:[]};return o=Object.assign(c,o),function(u,p){var m=o.retries,h=o.retryDelay,y=o.retryOn;if(p&&p.retries!==void 0)if(n(p.retries))m=p.retries;else throw new i("retries must be a positive integer");if(p&&p.retryDelay!==void 0)if(n(p.retryDelay)||typeof p.retryDelay=="function")h=p.retryDelay;else throw new i("retryDelay must be a positive integer or a function returning a positive integer");if(p&&p.retryOn)if(Array.isArray(p.retryOn)||typeof p.retryOn=="function")y=p.retryOn;else throw new i("retryOn property expects an array or function");return new Promise(function(E,v){var _=function(P){var B=typeof Request<"u"&&u instanceof Request?u.clone():u;s(B,p).then(function(U){if(Array.isArray(y)&&y.indexOf(U.status)===-1)E(U);else if(typeof y=="function")try{return Promise.resolve(y(P,null,U)).then(function(R){R?x(P,null,U):E(U)}).catch(v)}catch(R){v(R)}else P<m?x(P,null,U):E(U)}).catch(function(U){if(typeof y=="function")try{Promise.resolve(y(P,U,null)).then(function(R){R?x(P,U,null):v(U)}).catch(function(R){v(R)})}catch(R){v(R)}else P<m?x(P,U,null):v(U)})};function x(P,B,U){var R=typeof h=="function"?h(P,B,U):h;setTimeout(function(){_(++P)},R)}_(0)})}};function n(s){return Number.isInteger(s)&&s>=0}function i(s){this.name="ArgumentError",this.message=s}return r})}),up="9.3.29",N=class xc{static SDK_VERSION=up;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 CTA_AFTER_REFRESH_UI="letscooee:outbound:refresh-ui";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 SHADOW_SPLITTER=":shadow";static CAMPAIGN_ATTRIBUTE="_letscooee_campaign";static CONTENT_ATTRIBUTE="_letscooee_content";static VIA="_via";static PAYMENT_MODAL_DETAILS=[{identifier:"#flo-checkout-wrapper",gateway:"Shopflow"},{identifier:"#fastrr-main-container",gateway:"Shiprocket"},{identifier:"#gokwik-modal-wrapper",gateway:"Gokwik"},{identifier:"#zecpe",gateway:"Ecom 360"}];static{let t=xc.SDK_VERSION.split(".").map(r=>r.padStart(2,"0")).join("");xc.SDK_VERSION_CODE=parseInt(t,10)}},tr={apiURL:"https://api.sdk.letscooee.com",debug:!1,mode:"production",styleURL:`https://cdn.jsdelivr.net/npm/@letscooee/web-sdk@${N.SDK_VERSION}/dist/widget-sdk.min.css`},Ot=Ce(nn()),b=class{static log(...e){Ot.default.info(...e)}static debug(...e){Ot.default.debug(...e)}static error(...e){Ot.default.error(...e)}static warn(...e){Ot.default.warn(...e)}static info(...e){Ot.default.info(...e)}static trace(...e){Ot.default.trace(...e)}static configure(e=N.LOG_PREFIX){Ot.default.useDefaults({formatter:function(r){r.unshift(`${e} (v${N.SDK_VERSION}):`)}});let t=this.getDebugParam();(t==="1"||t==="on")&&(localStorage.cooeeLogLevel="TRACE"),localStorage.cooeeLogLevel?Ot.default.setLevel(Ot.default[localStorage.cooeeLogLevel]):Ot.default.setLevel(tr.debug?Ot.default.TRACE:Ot.default.OFF)}static getDebugParam(){return new URL(location.href).searchParams?.get("cooee-debug")}static logBrand(){let e=`
|
|
2
2
|
display: inline-block;
|
|
3
3
|
font-size: 14px;
|
|
4
4
|
background: linear-gradient(90deg, #d52dc8 25%, #2179e2 82%);
|
|
5
5
|
color: white;
|
|
6
6
|
padding: 4px;
|
|
7
7
|
border-radius: 4px;
|
|
8
|
-
`,
|
|
9
|
-
`;
|
|
10
|
-
`,
|
|
11
|
-
`,
|
|
12
|
-
`,
|
|
13
|
-
`,
|
|
8
|
+
`,t=`
|
|
9
|
+
`;t+=`\u{1F4E3} Drive higher conversions with AI-powered onsite engagement
|
|
10
|
+
`,t+=`\u{1F50D} Track real-time visitor intent & optimize engagement
|
|
11
|
+
`,t+=`\u{1F4CA} Improve Meta Ads ROAS with intent-driven campaigns
|
|
12
|
+
`,t+=`\u{1F6CD}\uFE0F Boost purchases & repeat sales effortlessly
|
|
13
|
+
`,t+=`
|
|
14
14
|
|
|
15
|
-
`,
|
|
16
|
-
Cooee SDK: v${N.SDK_VERSION}`,console.group("%c Elevate your ecommerce experience with Cooee \u{1F680} ",t),console.log(`%c${e}`,"font-size: 13px; line-height: 1.8;"),console.groupEnd()}},Ko=(()=>{class t{static entityMap={'"':"""};static escapeHtml(r){return String(r).replace(/"/g,n=>t.entityMap[n])}}return t})(),Oe=class{gaEnabled;gaMeasurementID;pixelPush;website;currencyCount;money;storefrontToken;skipItemAttribute;currency;static get(){return window.CooeeSDK.config}update(t){return t??={},this.gaEnabled=t.gaEnabled,this.gaMeasurementID=t.gaMeasurementID,this.pixelPush=t.pixelPush,this.website=t.website??{},this.currencyCount=t.currencyCount??0,this.money=t.money,this.currency=t.currency,this.storefrontToken=t.storefrontToken,this.skipItemAttribute=t.skipItemAttribute,this}},zi=function(t){return t[t.SINGLE=1]="SINGLE",t[t.EXCLUSION=2]="EXCLUSION",t[t.ABTESTING=3]="ABTESTING",t}(zi||{}),$n=function(t){return t.BEFORE="before",t.AFTER="after",t.INSIDE_FIRST="insideFirst",t.INSIDE_LAST="insideLast",t}($n||{}),lr=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}(lr||{}),Yi=function(t){return t.POPUP="POPUP",t.PAGE_EMBED="PAGE_EMBED",t.CART_EMBED="CART_EMBED",t.ANNOUNCEMENT_BAR="ANNOUNCEMENT_BAR",t}(Yi||{}),ur=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}(ur||{}),qi=function(t){return t.COOEE="COOEE",t.KLAVIYO="KLAVIYO",t}(qi||{}),Cc=function(t){return t.ICONS="ICONS",t.TILES="TILES",t}(Cc||{}),Dc=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}(Dc||{}),pr=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}(pr||{}),jn=class ep{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,s)=>s.findIndex(o=>o[r]===n[r])===i)}static shuffle(e){let r=e.length;for(;r!=0;){let n=Math.floor(Math.random()*r);r--,ep.swap(e,r,n)}}},Zo,_e,up,Oc,rn,sp,pp,Rc,fp,Pc,Ac,Nc,hh,Ki={},mp=[],gh=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Lc=Array.isArray;function Gr(t,e){for(var r in e)t[r]=e[r];return t}function Bc(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function Ji(t,e,r){var n,i,s,o={};for(s in e)s=="key"?n=e[s]:s=="ref"?i=e[s]:o[s]=e[s];if(arguments.length>2&&(o.children=arguments.length>3?Zo.call(arguments,2):r),typeof t=="function"&&t.defaultProps!=null)for(s in t.defaultProps)o[s]===void 0&&(o[s]=t.defaultProps[s]);return Xo(t,o,n,i,null)}function Xo(t,e,r,n,i){var s={type:t,props:e,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++up,__i:-1,__u:0};return i==null&&_e.vnode!=null&&_e.vnode(s),s}function mr(t){return t.children}function fr(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 dp(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 dp(t)}}function ap(t){(!t.__d&&(t.__d=!0)&&rn.push(t)&&!Qo.__r++||sp!==_e.debounceRendering)&&((sp=_e.debounceRendering)||pp)(Qo)}function Qo(){var t,e,r,n,i,s,o,c;for(rn.sort(Rc);t=rn.shift();)t.__d&&(e=rn.length,n=void 0,s=(i=(r=t).__v).__e,o=[],c=[],r.__P&&((n=Gr({},i)).__v=i.__v+1,_e.vnode&&_e.vnode(n),Uc(r.__P,n,i,r.__n,r.__P.namespaceURI,32&i.__u?[s]:null,o,s??Wn(i),!!(32&i.__u),c),n.__v=i.__v,n.__.__k[n.__i]=n,yp(o,n,c),n.__e!=s&&dp(n)),rn.length>e&&rn.sort(Rc));Qo.__r=0}function hp(t,e,r,n,i,s,o,c,u,d,m){var h,v,_,g,y,C,O=n&&n.__k||mp,H=e.length;for(u=yh(r,e,O,u,H),h=0;h<H;h++)(_=r.__k[h])!=null&&(v=_.__i===-1?Ki:O[_.__i]||Ki,_.__i=h,C=Uc(t,_,v,i,s,o,c,u,d,m),g=_.__e,_.ref&&v.ref!=_.ref&&(v.ref&&kc(v.ref,null,_),m.push(_.ref,_.__c||g,_)),y==null&&g!=null&&(y=g),4&_.__u||v.__k===_.__k?u=gp(_,u,t):typeof _.type=="function"&&C!==void 0?u=C:g&&(u=g.nextSibling),_.__u&=-7);return r.__e=y,u}function yh(t,e,r,n,i){var s,o,c,u,d,m=r.length,h=m,v=0;for(t.__k=new Array(i),s=0;s<i;s++)(o=e[s])!=null&&typeof o!="boolean"&&typeof o!="function"?(u=s+v,(o=t.__k[s]=typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?Xo(null,o,null,null,null):Lc(o)?Xo(mr,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?Xo(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=t,o.__b=t.__b+1,c=null,(d=o.__i=vh(o,r,u,h))!==-1&&(h--,(c=r[d])&&(c.__u|=2)),c==null||c.__v===null?(d==-1&&v--,typeof o.type!="function"&&(o.__u|=4)):d!=u&&(d==u-1?v--:d==u+1?v++:(d>u?v--:v++,o.__u|=4))):t.__k[s]=null;if(h)for(s=0;s<m;s++)(c=r[s])!=null&&(2&c.__u)==0&&(c.__e==n&&(n=Wn(c)),vp(c,c));return n}function gp(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=gp(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 vh(t,e,r,n){var i,s,o=t.key,c=t.type,u=e[r];if(u===null||u&&o==u.key&&c===u.type&&(2&u.__u)==0)return r;if(n>(u!=null&&(2&u.__u)==0?1:0))for(i=r-1,s=r+1;i>=0||s<e.length;){if(i>=0){if((u=e[i])&&(2&u.__u)==0&&o==u.key&&c===u.type)return i;i--}if(s<e.length){if((u=e[s])&&(2&u.__u)==0&&o==u.key&&c===u.type)return s;s++}}return-1}function cp(t,e,r){e[0]=="-"?t.setProperty(e,r??""):t[e]=r==null?"":typeof r!="number"||gh.test(e)?r:r+"px"}function Jo(t,e,r,n,i){var s;t: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||cp(t.style,e,"");if(r)for(e in r)n&&r[e]===n[e]||cp(t.style,e,r[e])}else if(e[0]=="o"&&e[1]=="n")s=e!=(e=e.replace(fp,"$1")),e=e.toLowerCase()in t||e=="onFocusOut"||e=="onFocusIn"?e.toLowerCase().slice(2):e.slice(2),t.l||(t.l={}),t.l[e+s]=r,r?n?r.u=n.u:(r.u=Pc,t.addEventListener(e,s?Nc:Ac,s)):t.removeEventListener(e,s?Nc:Ac,s);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 t}catch{}typeof r=="function"||(r==null||r===!1&&e[4]!="-"?t.removeAttribute(e):t.setAttribute(e,e=="popover"&&r==1?"":r))}}function lp(t){return function(e){if(this.l){var r=this.l[e.type+t];if(e.t==null)e.t=Pc++;else if(e.t<r.u)return;return r(_e.event?_e.event(e):e)}}}function Uc(t,e,r,n,i,s,o,c,u,d){var m,h,v,_,g,y,C,O,H,L,P,V,kt,fe,j,ct,Y,at=e.type;if(e.constructor!==void 0)return null;128&r.__u&&(u=!!(32&r.__u),s=[c=e.__e=r.__e]),(m=_e.__b)&&m(e);t:if(typeof at=="function")try{if(O=e.props,H="prototype"in at&&at.prototype.render,L=(m=at.contextType)&&n[m.__c],P=m?L?L.props.value:m.__:n,r.__c?C=(h=e.__c=r.__c).__=h.__E:(H?e.__c=h=new at(O,P):(e.__c=h=new fr(O,P),h.constructor=at,h.render=Eh),L&&L.sub(h),h.props=O,h.state||(h.state={}),h.context=P,h.__n=n,v=h.__d=!0,h.__h=[],h._sb=[]),H&&h.__s==null&&(h.__s=h.state),H&&at.getDerivedStateFromProps!=null&&(h.__s==h.state&&(h.__s=Gr({},h.__s)),Gr(h.__s,at.getDerivedStateFromProps(O,h.__s))),_=h.props,g=h.state,h.__v=e,v)H&&at.getDerivedStateFromProps==null&&h.componentWillMount!=null&&h.componentWillMount(),H&&h.componentDidMount!=null&&h.__h.push(h.componentDidMount);else{if(H&&at.getDerivedStateFromProps==null&&O!==_&&h.componentWillReceiveProps!=null&&h.componentWillReceiveProps(O,P),!h.__e&&(h.shouldComponentUpdate!=null&&h.shouldComponentUpdate(O,h.__s,P)===!1||e.__v==r.__v)){for(e.__v!=r.__v&&(h.props=O,h.state=h.__s,h.__d=!1),e.__e=r.__e,e.__k=r.__k,e.__k.some(function(Qt){Qt&&(Qt.__=e)}),V=0;V<h._sb.length;V++)h.__h.push(h._sb[V]);h._sb=[],h.__h.length&&o.push(h);break t}h.componentWillUpdate!=null&&h.componentWillUpdate(O,h.__s,P),H&&h.componentDidUpdate!=null&&h.__h.push(function(){h.componentDidUpdate(_,g,y)})}if(h.context=P,h.props=O,h.__P=t,h.__e=!1,kt=_e.__r,fe=0,H){for(h.state=h.__s,h.__d=!1,kt&&kt(e),m=h.render(h.props,h.state,h.context),j=0;j<h._sb.length;j++)h.__h.push(h._sb[j]);h._sb=[]}else do h.__d=!1,kt&&kt(e),m=h.render(h.props,h.state,h.context),h.state=h.__s;while(h.__d&&++fe<25);h.state=h.__s,h.getChildContext!=null&&(n=Gr(Gr({},n),h.getChildContext())),H&&!v&&h.getSnapshotBeforeUpdate!=null&&(y=h.getSnapshotBeforeUpdate(_,g)),c=hp(t,Lc(ct=m!=null&&m.type===mr&&m.key==null?m.props.children:m)?ct:[ct],e,r,n,i,s,o,c,u,d),h.base=e.__e,e.__u&=-161,h.__h.length&&o.push(h),C&&(h.__E=h.__=null)}catch(Qt){if(e.__v=null,u||s!=null)if(Qt.then){for(e.__u|=u?160:128;c&&c.nodeType==8&&c.nextSibling;)c=c.nextSibling;s[s.indexOf(c)]=null,e.__e=c}else for(Y=s.length;Y--;)Bc(s[Y]);else e.__e=r.__e,e.__k=r.__k;_e.__e(Qt,e,r)}else s==null&&e.__v==r.__v?(e.__k=r.__k,e.__e=r.__e):c=e.__e=_h(r.__e,e,r,n,i,s,o,u,d);return(m=_e.diffed)&&m(e),128&e.__u?void 0:c}function yp(t,e,r){for(var n=0;n<r.length;n++)kc(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(s){s.call(i)})}catch(s){_e.__e(s,i.__v)}})}function _h(t,e,r,n,i,s,o,c,u){var d,m,h,v,_,g,y,C=r.props,O=e.props,H=e.type;if(H=="svg"?i="http://www.w3.org/2000/svg":H=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),s!=null){for(d=0;d<s.length;d++)if((_=s[d])&&"setAttribute"in _==!!H&&(H?_.localName==H:_.nodeType==3)){t=_,s[d]=null;break}}if(t==null){if(H==null)return document.createTextNode(O);t=document.createElementNS(i,H,O.is&&O),c&&(_e.__m&&_e.__m(e,s),c=!1),s=null}if(H===null)C===O||c&&t.data===O||(t.data=O);else{if(s=s&&Zo.call(t.childNodes),C=r.props||Ki,!c&&s!=null)for(C={},d=0;d<t.attributes.length;d++)C[(_=t.attributes[d]).name]=_.value;for(d in C)if(_=C[d],d!="children"){if(d=="dangerouslySetInnerHTML")h=_;else if(!(d in O)){if(d=="value"&&"defaultValue"in O||d=="checked"&&"defaultChecked"in O)continue;Jo(t,d,null,_,i)}}for(d in O)_=O[d],d=="children"?v=_:d=="dangerouslySetInnerHTML"?m=_:d=="value"?g=_:d=="checked"?y=_:c&&typeof _!="function"||C[d]===_||Jo(t,d,_,C[d],i);if(m)c||h&&(m.__html===h.__html||m.__html===t.innerHTML)||(t.innerHTML=m.__html),e.__k=[];else if(h&&(t.innerHTML=""),hp(t,Lc(v)?v:[v],e,r,n,H=="foreignObject"?"http://www.w3.org/1999/xhtml":i,s,o,s?s[0]:r.__k&&Wn(r,0),c,u),s!=null)for(d=s.length;d--;)Bc(s[d]);c||(d="value",H=="progress"&&g==null?t.removeAttribute("value"):g!==void 0&&(g!==t[d]||H=="progress"&&!g||H=="option"&&g!==C[d])&&Jo(t,d,g,C[d],i),d="checked",y!==void 0&&y!==t[d]&&Jo(t,d,y,C[d],i))}return t}function kc(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 vp(t,e,r){var n,i;if(_e.unmount&&_e.unmount(t),(n=t.ref)&&(n.current&&n.current!==t.__e||kc(n,null,e)),(n=t.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(s){_e.__e(s,e)}n.base=n.__P=null}if(n=t.__k)for(i=0;i<n.length;i++)n[i]&&vp(n[i],e,r||typeof t.type!="function");r||Bc(t.__e),t.__c=t.__=t.__e=void 0}function Eh(t,e,r){return this.constructor(t,r)}function es(t,e,r){var n,i,s,o;e==document&&(e=document.documentElement),_e.__&&_e.__(t,e),i=(n=typeof r=="function")?null:r&&r.__k||e.__k,s=[],o=[],Uc(e,t=(!n&&r||e).__k=Ji(mr,null,[t]),i||Ki,Ki,e.namespaceURI,!n&&r?[r]:i?null:e.firstChild?Zo.call(e.childNodes):null,s,!n&&r?r:i?i.__e:e.firstChild,n,o),yp(s,t,o)}Zo=mp.slice,_e={__e:function(t,e,r,n){for(var i,s,o;e=e.__;)if((i=e.__c)&&!i.__)try{if((s=i.constructor)&&s.getDerivedStateFromError!=null&&(i.setState(s.getDerivedStateFromError(t)),o=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(t,n||{}),o=i.__d),o)return i.__E=i}catch(c){t=c}throw t}},up=0,Oc=function(t){return t!=null&&t.constructor==null},fr.prototype.setState=function(t,e){var r;r=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=Gr({},this.state),typeof t=="function"&&(t=t(Gr({},r),this.props)),t&&Gr(r,t),t!=null&&this.__v&&(e&&this._sb.push(e),ap(this))},fr.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),ap(this))},fr.prototype.render=mr,rn=[],pp=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Rc=function(t,e){return t.__v.__b-e.__v.__b},Qo.__r=0,fp=/(PointerCapture)$|Capture$/i,Pc=0,Ac=lp(!1),Nc=lp(!0),hh=0;var Fc,At,Mc,_p,Ep=0,Dp=[],Ke=_e,Sp=Ke.__b,wp=Ke.__r,bp=Ke.diffed,Ip=Ke.__c,Tp=Ke.unmount,xp=Ke.__;function Sh(t,e){Ke.__h&&Ke.__h(At,t,Ep||e),Ep=0;var r=At.__H||(At.__H={__:[],__h:[]});return t>=r.__.length&&r.__.push({}),r.__[t]}function $c(t,e){var r=Sh(Fc++,7);return Ih(r.__H,e)&&(r.__=t(),r.__H=e,r.__h=t),r.__}function wh(){for(var t;t=Dp.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(ts),t.__H.__h.forEach(Hc),t.__H.__h=[]}catch(e){t.__H.__h=[],Ke.__e(e,t.__v)}}Ke.__b=function(t){At=null,Sp&&Sp(t)},Ke.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),xp&&xp(t,e)},Ke.__r=function(t){wp&&wp(t),Fc=0;var e=(At=t.__c).__H;e&&(Mc===At?(e.__h=[],At.__h=[],e.__.forEach(function(r){r.__N&&(r.__=r.__N),r.i=r.__N=void 0})):(e.__h.forEach(ts),e.__h.forEach(Hc),e.__h=[],Fc=0)),Mc=At},Ke.diffed=function(t){bp&&bp(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(Dp.push(e)!==1&&_p===Ke.requestAnimationFrame||((_p=Ke.requestAnimationFrame)||bh)(wh)),e.__H.__.forEach(function(r){r.i&&(r.__H=r.i),r.i=void 0})),Mc=At=null},Ke.__c=function(t,e){e.some(function(r){try{r.__h.forEach(ts),r.__h=r.__h.filter(function(n){return!n.__||Hc(n)})}catch(n){e.some(function(i){i.__h&&(i.__h=[])}),e=[],Ke.__e(n,r.__v)}}),Ip&&Ip(t,e)},Ke.unmount=function(t){Tp&&Tp(t);var e,r=t.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{ts(n)}catch(i){e=i}}),r.__H=void 0,e&&Ke.__e(e,r.__v))};var Cp=typeof requestAnimationFrame=="function";function bh(t){var e,r=function(){clearTimeout(n),Cp&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(r,100);Cp&&(e=requestAnimationFrame(r))}function ts(t){var e=At,r=t.__c;typeof r=="function"&&(t.__c=void 0,r()),At=e}function Hc(t){var e=At;t.__c=t.__(),At=e}function Ih(t,e){return!t||t.length!==e.length||e.some(function(r,n){return r!==t[n]})}var Th=Symbol.for("preact-signals");function Wc(){if(Gn>1)Gn--;else{for(var t,e=!1;Xi!==void 0;){var r=Xi;for(Xi=void 0,jc++;r!==void 0;){var n=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&Ap(r))try{r.c()}catch(i){e||(t=i,e=!0)}r=n}}if(jc=0,Gn--,e)throw t}}var Re=void 0,Xi=void 0,Gn=0,jc=0,rs=0;function Rp(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=Th;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 ot(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=Rp(this);return t!==void 0&&(t.i=this.i),this.v},set:function(t){if(t!==this.v){if(jc>100)throw new Error("Cycle detected");this.v=t,this.i++,rs++,Gn++;try{for(var e=this.t;e!==void 0;e=e.x)e.t.N()}finally{Wc()}}}});function Mt(t){return new Je(t)}function Ap(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 Np(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 Op(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=rs-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===rs))return!0;if(this.g=rs,this.f|=1,this.i>0&&!Ap(this))return this.f&=-2,!0;var t=Re;try{Np(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,Op(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=Rp(this);if(this.h(),t!==void 0&&(t.i=this.i),16&this.f)throw this.v;return this.v}});function Gc(t){return new Vn(t)}function Pp(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,Vc(t),n}finally{Re=r,Wc()}}}function Vc(t){for(var e=t.s;e!==void 0;e=e.n)e.S.U(e);t.x=void 0,t.s=void 0,Pp(t)}function xh(t){if(Re!==this)throw new Error("Out-of-order effect");Op(this),Re=t,this.f&=-2,8&this.f&&Vc(this),Wc()}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,Pp(this),Np(this),Gn++;var t=Re;return Re=this,xh.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||Vc(this)};function ot(t){var e=new Qi(t);try{e.c()}catch(r){throw e.d(),r}return e.d.bind(e)}var Yc,zc;function zn(t,e){_e[t]=e.bind(null,_e[t]||function(){})}function ns(t){zc&&zc(),zc=t&&t.S()}function Lp(t){var e=this,r=t.data,n=Dh(r);n.value=r;var i=$c(function(){for(var s=e.__v;s=s.__;)if(s.__c){s.__c.__$f|=4;break}return e.__$u.c=function(){var o,c=e.__$u.S(),u=i.value;c(),Oc(u)||((o=e.base)==null?void 0:o.nodeType)!==3?(e.__$f|=1,e.setState({})):e.base.data=u},Gc(function(){var o=n.value.value;return o===0?0:o===!0?"":o||""})},[]);return i.value}Lp.displayName="_st";Object.defineProperties(Je.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:Lp},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 s=n[i];s instanceof Je&&(r||(e.__np=r={}),r[i]=s,n[i]=s.peek())}}t(e)});zn("__r",function(t,e){ns();var r,n=e.__c;n&&(n.__$f&=-2,(r=n.__$u)===void 0&&(n.__$u=r=function(i){var s;return ot(function(){s=this}),s.c=function(){n.__$f|=1,n.setState({})},s}())),Yc=n,ns(r),t(e)});zn("__e",function(t,e,r,n){ns(),Yc=void 0,t(e,r,n)});zn("diffed",function(t,e){ns(),Yc=void 0;var r;if(typeof e.type=="string"&&(r=e.__e)){var n=e.__np,i=e.props;if(n){var s=r.U;if(s)for(var o in s){var c=s[o];c!==void 0&&!(o in n)&&(c.d(),s[o]=void 0)}else r.U=s={};for(var u in n){var d=s[u],m=n[u];d===void 0?(d=Ch(r,u,m,i),s[u]=d):d.o(m,i)}}}t(e)});function Ch(t,e,r,n){var i=e in t&&t.ownerSVGElement===void 0,s=Mt(r);return{o:function(o,c){s.value=o,n=c},d:ot(function(){var o=s.value.value;n[e]!==o&&(n[e]=o,i?t[e]=o:o?t.setAttribute(e,o):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 s=n[i];s&&s.d()}}}}else{var o=e.__c;if(o){var c=o.__$u;c&&(o.__$u=void 0,c.d())}}t(e)});zn("__h",function(t,e,r,n){(n<3||n===9)&&(e.__$f|=2),t(e,r,n)});fr.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 s in t)if(s!=="__source"&&t[s]!==this.props[s])return!0;for(var o in this.props)if(!(o in t))return!0;return!1};function Dh(t){return $c(function(){return Mt(t)},[])}var Rh=Object.prototype.toString,qn=Array.isArray||function(t){return Rh.call(t)==="[object Array]"};function Kc(t){return typeof t=="function"}function Ah(t){return qn(t)?"array":typeof t}function qc(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Bp(t,e){return t!=null&&typeof t=="object"&&e in t}function Nh(t,e){return t!=null&&typeof t!="object"&&t.hasOwnProperty&&t.hasOwnProperty(e)}var Oh=RegExp.prototype.test;function Ph(t,e){return Oh.call(t,e)}var Lh=/\S/;function Bh(t){return!Ph(Lh,t)}var Uh={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};function kh(t){return String(t).replace(/[&<>"'`=\/]/g,function(e){return Uh[e]})}var Mh=/\s*/,Fh=/\s+/,Up=/\s*=/,Hh=/\s*\}/,$h=/#|\^|\/|>|\{|&|=|!/;function jh(t,e){if(!t)return[];var r=!1,n=[],i=[],s=[],o=!1,c=!1,u="",d=0;function m(){if(o&&!c)for(;s.length;)delete i[s.pop()];else s=[];o=!1,c=!1}var h,v,_;function g(j){if(typeof j=="string"&&(j=j.split(Fh,2)),!qn(j)||j.length!==2)throw new Error("Invalid tags: "+j);h=new RegExp(qc(j[0])+"\\s*"),v=new RegExp("\\s*"+qc(j[1])),_=new RegExp("\\s*"+qc("}"+j[1]))}g(e||Ft.tags);for(var y=new eo(t),C,O,H,L,P,V;!y.eos();){if(C=y.pos,H=y.scanUntil(h),H)for(var kt=0,fe=H.length;kt<fe;++kt)L=H.charAt(kt),Bh(L)?(s.push(i.length),u+=L):(c=!0,r=!0,u+=" "),i.push(["text",L,C,C+1]),C+=1,L===`
|
|
17
|
-
`&&(m(),u="",
|
|
15
|
+
`,t+=`Learn more: https://www.letscooee.com
|
|
16
|
+
Cooee SDK: v${N.SDK_VERSION}`,console.group("%c Elevate your ecommerce experience with Cooee \u{1F680} ",e),console.log(`%c${t}`,"font-size: 13px; line-height: 1.8;"),console.groupEnd()}},_h=Ce(Nc()),Le=class{gaEnabled;gaMeasurementID;pixelPush;website;currencyCount;money;storefrontToken;skipItemAttribute;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.skipItemAttribute=e.skipItemAttribute,this}},Tt=Ce(Gr()),Jr=Ce(Jo()),Iu=Ce(Pc()),rs,Ee,qp,kc,on,Gp,Kp,Lc,Xp,Mc,Bc,Uc,mg,qi={},Jp=[],dg=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Fc=Array.isArray;function Vr(e,t){for(var r in t)e[r]=t[r];return e}function Hc(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Ki(e,t,r){var n,i,s,o={};for(s in t)s=="key"?n=t[s]:s=="ref"?i=t[s]:o[s]=t[s];if(arguments.length>2&&(o.children=arguments.length>3?rs.call(arguments,2):r),typeof e=="function"&&e.defaultProps!=null)for(s in e.defaultProps)o[s]===void 0&&(o[s]=e.defaultProps[s]);return es(e,o,n,i,null)}function es(e,t,r,n,i){var s={type:e,props:t,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++qp,__i:-1,__u:0};return i==null&&Ee.vnode!=null&&Ee.vnode(s),s}function fr(e){return e.children}function pr(e,t){this.props=e,this.context=t}function Gn(e,t){if(t==null)return e.__?Gn(e.__,e.__i+1):null;for(var r;t<e.__k.length;t++)if((r=e.__k[t])!=null&&r.__e!=null)return r.__e;return typeof e.type=="function"?Gn(e):null}function Qp(e){var t,r;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((r=e.__k[t])!=null&&r.__e!=null){e.__e=e.__c.base=r.__e;break}return Qp(e)}}function Vp(e){(!e.__d&&(e.__d=!0)&&on.push(e)&&!ts.__r++||Gp!==Ee.debounceRendering)&&((Gp=Ee.debounceRendering)||Kp)(ts)}function ts(){var e,t,r,n,i,s,o,c;for(on.sort(Lc);e=on.shift();)e.__d&&(t=on.length,n=void 0,s=(i=(r=e).__v).__e,o=[],c=[],r.__P&&((n=Vr({},i)).__v=i.__v+1,Ee.vnode&&Ee.vnode(n),$c(r.__P,n,i,r.__n,r.__P.namespaceURI,32&i.__u?[s]:null,o,s??Gn(i),!!(32&i.__u),c),n.__v=i.__v,n.__.__k[n.__i]=n,tf(o,n,c),n.__e!=s&&Qp(n)),on.length>t&&on.sort(Lc));ts.__r=0}function Zp(e,t,r,n,i,s,o,c,u,p,m){var h,y,E,v,_,x,P=n&&n.__k||Jp,B=t.length;for(u=hg(r,t,P,u,B),h=0;h<B;h++)(E=r.__k[h])!=null&&(y=E.__i===-1?qi:P[E.__i]||qi,E.__i=h,x=$c(e,E,y,i,s,o,c,u,p,m),v=E.__e,E.ref&&y.ref!=E.ref&&(y.ref&&jc(y.ref,null,E),m.push(E.ref,E.__c||v,E)),_==null&&v!=null&&(_=v),4&E.__u||y.__k===E.__k?u=ef(E,u,e):typeof E.type=="function"&&x!==void 0?u=x:v&&(u=v.nextSibling),E.__u&=-7);return r.__e=_,u}function hg(e,t,r,n,i){var s,o,c,u,p,m=r.length,h=m,y=0;for(e.__k=new Array(i),s=0;s<i;s++)(o=t[s])!=null&&typeof o!="boolean"&&typeof o!="function"?(u=s+y,(o=e.__k[s]=typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?es(null,o,null,null,null):Fc(o)?es(fr,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?es(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=e,o.__b=e.__b+1,c=null,(p=o.__i=gg(o,r,u,h))!==-1&&(h--,(c=r[p])&&(c.__u|=2)),c==null||c.__v===null?(p==-1&&y--,typeof o.type!="function"&&(o.__u|=4)):p!=u&&(p==u-1?y--:p==u+1?y++:(p>u?y--:y++,o.__u|=4))):e.__k[s]=null;if(h)for(s=0;s<m;s++)(c=r[s])!=null&&(2&c.__u)==0&&(c.__e==n&&(n=Gn(c)),rf(c,c));return n}function ef(e,t,r){var n,i;if(typeof e.type=="function"){for(n=e.__k,i=0;n&&i<n.length;i++)n[i]&&(n[i].__=e,t=ef(n[i],t,r));return t}e.__e!=t&&(t&&e.type&&!r.contains(t)&&(t=Gn(e)),r.insertBefore(e.__e,t||null),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function gg(e,t,r,n){var i,s,o=e.key,c=e.type,u=t[r];if(u===null||u&&o==u.key&&c===u.type&&(2&u.__u)==0)return r;if(n>(u!=null&&(2&u.__u)==0?1:0))for(i=r-1,s=r+1;i>=0||s<t.length;){if(i>=0){if((u=t[i])&&(2&u.__u)==0&&o==u.key&&c===u.type)return i;i--}if(s<t.length){if((u=t[s])&&(2&u.__u)==0&&o==u.key&&c===u.type)return s;s++}}return-1}function Yp(e,t,r){t[0]=="-"?e.setProperty(t,r??""):e[t]=r==null?"":typeof r!="number"||dg.test(t)?r:r+"px"}function Zo(e,t,r,n,i){var s;e:if(t=="style")if(typeof r=="string")e.style.cssText=r;else{if(typeof n=="string"&&(e.style.cssText=n=""),n)for(t in n)r&&t in r||Yp(e.style,t,"");if(r)for(t in r)n&&r[t]===n[t]||Yp(e.style,t,r[t])}else if(t[0]=="o"&&t[1]=="n")s=t!=(t=t.replace(Xp,"$1")),t=t.toLowerCase()in e||t=="onFocusOut"||t=="onFocusIn"?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+s]=r,r?n?r.u=n.u:(r.u=Mc,e.addEventListener(t,s?Uc:Bc,s)):e.removeEventListener(t,s?Uc:Bc,s);else{if(i=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=r??"";break e}catch{}typeof r=="function"||(r==null||r===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&r==1?"":r))}}function zp(e){return function(t){if(this.l){var r=this.l[t.type+e];if(t.t==null)t.t=Mc++;else if(t.t<r.u)return;return r(Ee.event?Ee.event(t):t)}}}function $c(e,t,r,n,i,s,o,c,u,p){var m,h,y,E,v,_,x,P,B,U,R,G,ue,Me,j,Q,z,J=t.type;if(t.constructor!==void 0)return null;128&r.__u&&(u=!!(32&r.__u),s=[c=t.__e=r.__e]),(m=Ee.__b)&&m(t);e:if(typeof J=="function")try{if(P=t.props,B="prototype"in J&&J.prototype.render,U=(m=J.contextType)&&n[m.__c],R=m?U?U.props.value:m.__:n,r.__c?x=(h=t.__c=r.__c).__=h.__E:(B?t.__c=h=new J(P,R):(t.__c=h=new pr(P,R),h.constructor=J,h.render=vg),U&&U.sub(h),h.props=P,h.state||(h.state={}),h.context=R,h.__n=n,y=h.__d=!0,h.__h=[],h._sb=[]),B&&h.__s==null&&(h.__s=h.state),B&&J.getDerivedStateFromProps!=null&&(h.__s==h.state&&(h.__s=Vr({},h.__s)),Vr(h.__s,J.getDerivedStateFromProps(P,h.__s))),E=h.props,v=h.state,h.__v=t,y)B&&J.getDerivedStateFromProps==null&&h.componentWillMount!=null&&h.componentWillMount(),B&&h.componentDidMount!=null&&h.__h.push(h.componentDidMount);else{if(B&&J.getDerivedStateFromProps==null&&P!==E&&h.componentWillReceiveProps!=null&&h.componentWillReceiveProps(P,R),!h.__e&&(h.shouldComponentUpdate!=null&&h.shouldComponentUpdate(P,h.__s,R)===!1||t.__v==r.__v)){for(t.__v!=r.__v&&(h.props=P,h.state=h.__s,h.__d=!1),t.__e=r.__e,t.__k=r.__k,t.__k.some(function(ge){ge&&(ge.__=t)}),G=0;G<h._sb.length;G++)h.__h.push(h._sb[G]);h._sb=[],h.__h.length&&o.push(h);break e}h.componentWillUpdate!=null&&h.componentWillUpdate(P,h.__s,R),B&&h.componentDidUpdate!=null&&h.__h.push(function(){h.componentDidUpdate(E,v,_)})}if(h.context=R,h.props=P,h.__P=e,h.__e=!1,ue=Ee.__r,Me=0,B){for(h.state=h.__s,h.__d=!1,ue&&ue(t),m=h.render(h.props,h.state,h.context),j=0;j<h._sb.length;j++)h.__h.push(h._sb[j]);h._sb=[]}else do h.__d=!1,ue&&ue(t),m=h.render(h.props,h.state,h.context),h.state=h.__s;while(h.__d&&++Me<25);h.state=h.__s,h.getChildContext!=null&&(n=Vr(Vr({},n),h.getChildContext())),B&&!y&&h.getSnapshotBeforeUpdate!=null&&(_=h.getSnapshotBeforeUpdate(E,v)),c=Zp(e,Fc(Q=m!=null&&m.type===fr&&m.key==null?m.props.children:m)?Q:[Q],t,r,n,i,s,o,c,u,p),h.base=t.__e,t.__u&=-161,h.__h.length&&o.push(h),x&&(h.__E=h.__=null)}catch(ge){if(t.__v=null,u||s!=null)if(ge.then){for(t.__u|=u?160:128;c&&c.nodeType==8&&c.nextSibling;)c=c.nextSibling;s[s.indexOf(c)]=null,t.__e=c}else for(z=s.length;z--;)Hc(s[z]);else t.__e=r.__e,t.__k=r.__k;Ee.__e(ge,t,r)}else s==null&&t.__v==r.__v?(t.__k=r.__k,t.__e=r.__e):c=t.__e=yg(r.__e,t,r,n,i,s,o,u,p);return(m=Ee.diffed)&&m(t),128&t.__u?void 0:c}function tf(e,t,r){for(var n=0;n<r.length;n++)jc(r[n],r[++n],r[++n]);Ee.__c&&Ee.__c(t,e),e.some(function(i){try{e=i.__h,i.__h=[],e.some(function(s){s.call(i)})}catch(s){Ee.__e(s,i.__v)}})}function yg(e,t,r,n,i,s,o,c,u){var p,m,h,y,E,v,_,x=r.props,P=t.props,B=t.type;if(B=="svg"?i="http://www.w3.org/2000/svg":B=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),s!=null){for(p=0;p<s.length;p++)if((E=s[p])&&"setAttribute"in E==!!B&&(B?E.localName==B:E.nodeType==3)){e=E,s[p]=null;break}}if(e==null){if(B==null)return document.createTextNode(P);e=document.createElementNS(i,B,P.is&&P),c&&(Ee.__m&&Ee.__m(t,s),c=!1),s=null}if(B===null)x===P||c&&e.data===P||(e.data=P);else{if(s=s&&rs.call(e.childNodes),x=r.props||qi,!c&&s!=null)for(x={},p=0;p<e.attributes.length;p++)x[(E=e.attributes[p]).name]=E.value;for(p in x)if(E=x[p],p!="children"){if(p=="dangerouslySetInnerHTML")h=E;else if(!(p in P)){if(p=="value"&&"defaultValue"in P||p=="checked"&&"defaultChecked"in P)continue;Zo(e,p,null,E,i)}}for(p in P)E=P[p],p=="children"?y=E:p=="dangerouslySetInnerHTML"?m=E:p=="value"?v=E:p=="checked"?_=E:c&&typeof E!="function"||x[p]===E||Zo(e,p,E,x[p],i);if(m)c||h&&(m.__html===h.__html||m.__html===e.innerHTML)||(e.innerHTML=m.__html),t.__k=[];else if(h&&(e.innerHTML=""),Zp(e,Fc(y)?y:[y],t,r,n,B=="foreignObject"?"http://www.w3.org/1999/xhtml":i,s,o,s?s[0]:r.__k&&Gn(r,0),c,u),s!=null)for(p=s.length;p--;)Hc(s[p]);c||(p="value",B=="progress"&&v==null?e.removeAttribute("value"):v!==void 0&&(v!==e[p]||B=="progress"&&!v||B=="option"&&v!==x[p])&&Zo(e,p,v,x[p],i),p="checked",_!==void 0&&_!==e[p]&&Zo(e,p,_,x[p],i))}return e}function jc(e,t,r){try{if(typeof e=="function"){var n=typeof e.__u=="function";n&&e.__u(),n&&t==null||(e.__u=e(t))}else e.current=t}catch(i){Ee.__e(i,r)}}function rf(e,t,r){var n,i;if(Ee.unmount&&Ee.unmount(e),(n=e.ref)&&(n.current&&n.current!==e.__e||jc(n,null,t)),(n=e.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(s){Ee.__e(s,t)}n.base=n.__P=null}if(n=e.__k)for(i=0;i<n.length;i++)n[i]&&rf(n[i],t,r||typeof e.type!="function");r||Hc(e.__e),e.__c=e.__=e.__e=void 0}function vg(e,t,r){return this.constructor(e,r)}function ns(e,t,r){var n,i,s,o;t==document&&(t=document.documentElement),Ee.__&&Ee.__(e,t),i=(n=typeof r=="function")?null:r&&r.__k||t.__k,s=[],o=[],$c(t,e=(!n&&r||t).__k=Ki(fr,null,[e]),i||qi,qi,t.namespaceURI,!n&&r?[r]:i?null:t.firstChild?rs.call(t.childNodes):null,s,!n&&r?r:i?i.__e:t.firstChild,n,o),tf(s,e,o)}rs=Jp.slice,Ee={__e:function(e,t,r,n){for(var i,s,o;t=t.__;)if((i=t.__c)&&!i.__)try{if((s=i.constructor)&&s.getDerivedStateFromError!=null&&(i.setState(s.getDerivedStateFromError(e)),o=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,n||{}),o=i.__d),o)return i.__E=i}catch(c){e=c}throw e}},qp=0,kc=function(e){return e!=null&&e.constructor==null},pr.prototype.setState=function(e,t){var r;r=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=Vr({},this.state),typeof e=="function"&&(e=e(Vr({},r),this.props)),e&&Vr(r,e),e!=null&&this.__v&&(t&&this._sb.push(t),Vp(this))},pr.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Vp(this))},pr.prototype.render=fr,on=[],Kp=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Lc=function(e,t){return e.__v.__b-t.__v.__b},ts.__r=0,Xp=/(PointerCapture)$|Capture$/i,Mc=0,Bc=zp(!1),Uc=zp(!0),mg=0;var Gc,Pt,Wc,nf,of=0,mf=[],Je=Ee,sf=Je.__b,af=Je.__r,cf=Je.diffed,lf=Je.__c,uf=Je.unmount,pf=Je.__;function _g(e,t){Je.__h&&Je.__h(Pt,e,of||t),of=0;var r=Pt.__H||(Pt.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function Yc(e,t){var r=_g(Gc++,7);return wg(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function Eg(){for(var e;e=mf.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(is),e.__H.__h.forEach(Vc),e.__H.__h=[]}catch(t){e.__H.__h=[],Je.__e(t,e.__v)}}Je.__b=function(e){Pt=null,sf&&sf(e)},Je.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),pf&&pf(e,t)},Je.__r=function(e){af&&af(e),Gc=0;var t=(Pt=e.__c).__H;t&&(Wc===Pt?(t.__h=[],Pt.__h=[],t.__.forEach(function(r){r.__N&&(r.__=r.__N),r.i=r.__N=void 0})):(t.__h.forEach(is),t.__h.forEach(Vc),t.__h=[],Gc=0)),Wc=Pt},Je.diffed=function(e){cf&&cf(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(mf.push(t)!==1&&nf===Je.requestAnimationFrame||((nf=Je.requestAnimationFrame)||Sg)(Eg)),t.__H.__.forEach(function(r){r.i&&(r.__H=r.i),r.i=void 0})),Wc=Pt=null},Je.__c=function(e,t){t.some(function(r){try{r.__h.forEach(is),r.__h=r.__h.filter(function(n){return!n.__||Vc(n)})}catch(n){t.some(function(i){i.__h&&(i.__h=[])}),t=[],Je.__e(n,r.__v)}}),lf&&lf(e,t)},Je.unmount=function(e){uf&&uf(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{is(n)}catch(i){t=i}}),r.__H=void 0,t&&Je.__e(t,r.__v))};var ff=typeof requestAnimationFrame=="function";function Sg(e){var t,r=function(){clearTimeout(n),ff&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(r,100);ff&&(t=requestAnimationFrame(r))}function is(e){var t=Pt,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),Pt=t}function Vc(e){var t=Pt;e.__c=e.__(),Pt=t}function wg(e,t){return!e||e.length!==t.length||t.some(function(r,n){return r!==e[n]})}var bg=Symbol.for("preact-signals");function qc(){if(Vn>1)Vn--;else{for(var e,t=!1;Xi!==void 0;){var r=Xi;for(Xi=void 0,zc++;r!==void 0;){var n=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&hf(r))try{r.c()}catch(i){t||(e=i,t=!0)}r=n}}if(zc=0,Vn--,t)throw e}}var Ne=void 0,Xi=void 0,Vn=0,zc=0,os=0;function df(e){if(Ne!==void 0){var t=e.n;if(t===void 0||t.t!==Ne)return t={i:0,S:e,p:Ne.s,n:void 0,t:Ne,e:void 0,x:void 0,r:t},Ne.s!==void 0&&(Ne.s.n=t),Ne.s=t,e.n=t,32&Ne.f&&e.S(t),t;if(t.i===-1)return t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=Ne.s,t.n=void 0,Ne.s.n=t,Ne.s=t),t}}function Qe(e){this.v=e,this.i=0,this.n=void 0,this.t=void 0}Qe.prototype.brand=bg;Qe.prototype.h=function(){return!0};Qe.prototype.S=function(e){this.t!==e&&e.e===void 0&&(e.x=this.t,this.t!==void 0&&(this.t.e=e),this.t=e)};Qe.prototype.U=function(e){if(this.t!==void 0){var t=e.e,r=e.x;t!==void 0&&(t.x=r,e.e=void 0),r!==void 0&&(r.e=t,e.x=void 0),e===this.t&&(this.t=r)}};Qe.prototype.subscribe=function(e){var t=this;return at(function(){var r=t.value,n=Ne;Ne=void 0;try{e(r)}finally{Ne=n}})};Qe.prototype.valueOf=function(){return this.value};Qe.prototype.toString=function(){return this.value+""};Qe.prototype.toJSON=function(){return this.value};Qe.prototype.peek=function(){var e=Ne;Ne=void 0;try{return this.value}finally{Ne=e}};Object.defineProperty(Qe.prototype,"value",{get:function(){var e=df(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(zc>100)throw new Error("Cycle detected");this.v=e,this.i++,os++,Vn++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{qc()}}}});function $t(e){return new Qe(e)}function hf(e){for(var t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function gf(e){for(var t=e.s;t!==void 0;t=t.n){var r=t.S.n;if(r!==void 0&&(t.r=r),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function yf(e){for(var t=e.s,r=void 0;t!==void 0;){var n=t.p;t.i===-1?(t.S.U(t),n!==void 0&&(n.n=t.n),t.n!==void 0&&(t.n.p=n)):r=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=n}e.s=r}function Yn(e){Qe.call(this,void 0),this.x=e,this.s=void 0,this.g=os-1,this.f=4}(Yn.prototype=new Qe).h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===os))return!0;if(this.g=os,this.f|=1,this.i>0&&!hf(this))return this.f&=-2,!0;var e=Ne;try{gf(this),Ne=this;var t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(r){this.v=r,this.f|=16,this.i++}return Ne=e,yf(this),this.f&=-2,!0};Yn.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(var t=this.s;t!==void 0;t=t.n)t.S.S(t)}Qe.prototype.S.call(this,e)};Yn.prototype.U=function(e){if(this.t!==void 0&&(Qe.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(var t=this.s;t!==void 0;t=t.n)t.S.U(t)}};Yn.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;e!==void 0;e=e.x)e.t.N()}};Object.defineProperty(Yn.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=df(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function Kc(e){return new Yn(e)}function vf(e){var t=e.u;if(e.u=void 0,typeof t=="function"){Vn++;var r=Ne;Ne=void 0;try{t()}catch(n){throw e.f&=-2,e.f|=8,Xc(e),n}finally{Ne=r,qc()}}}function Xc(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,vf(e)}function Ig(e){if(Ne!==this)throw new Error("Out-of-order effect");yf(this),Ne=e,this.f&=-2,8&this.f&&Xc(this),qc()}function Ji(e){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}Ji.prototype.c=function(){var e=this.S();try{if(8&this.f||this.x===void 0)return;var t=this.x();typeof t=="function"&&(this.u=t)}finally{e()}};Ji.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,vf(this),gf(this),Vn++;var e=Ne;return Ne=this,Ig.bind(this,e)};Ji.prototype.N=function(){2&this.f||(this.f|=2,this.o=Xi,Xi=this)};Ji.prototype.d=function(){this.f|=8,1&this.f||Xc(this)};function at(e){var t=new Ji(e);try{t.c()}catch(r){throw t.d(),r}return t.d.bind(t)}var Qc,Jc;function zn(e,t){Ee[e]=t.bind(null,Ee[e]||function(){})}function ss(e){Jc&&Jc(),Jc=e&&e.S()}function _f(e){var t=this,r=e.data,n=Cg(r);n.value=r;var i=Yc(function(){for(var s=t.__v;s=s.__;)if(s.__c){s.__c.__$f|=4;break}return t.__$u.c=function(){var o,c=t.__$u.S(),u=i.value;c(),kc(u)||((o=t.base)==null?void 0:o.nodeType)!==3?(t.__$f|=1,t.setState({})):t.base.data=u},Kc(function(){var o=n.value.value;return o===0?0:o===!0?"":o||""})},[]);return i.value}_f.displayName="_st";Object.defineProperties(Qe.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:_f},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}});zn("__b",function(e,t){if(typeof t.type=="string"){var r,n=t.props;for(var i in n)if(i!=="children"){var s=n[i];s instanceof Qe&&(r||(t.__np=r={}),r[i]=s,n[i]=s.peek())}}e(t)});zn("__r",function(e,t){ss();var r,n=t.__c;n&&(n.__$f&=-2,(r=n.__$u)===void 0&&(n.__$u=r=function(i){var s;return at(function(){s=this}),s.c=function(){n.__$f|=1,n.setState({})},s}())),Qc=n,ss(r),e(t)});zn("__e",function(e,t,r,n){ss(),Qc=void 0,e(t,r,n)});zn("diffed",function(e,t){ss(),Qc=void 0;var r;if(typeof t.type=="string"&&(r=t.__e)){var n=t.__np,i=t.props;if(n){var s=r.U;if(s)for(var o in s){var c=s[o];c!==void 0&&!(o in n)&&(c.d(),s[o]=void 0)}else r.U=s={};for(var u in n){var p=s[u],m=n[u];p===void 0?(p=Tg(r,u,m,i),s[u]=p):p.o(m,i)}}}e(t)});function Tg(e,t,r,n){var i=t in e&&e.ownerSVGElement===void 0,s=$t(r);return{o:function(o,c){s.value=o,n=c},d:at(function(){var o=s.value.value;n[t]!==o&&(n[t]=o,i?e[t]=o:o?e.setAttribute(t,o):e.removeAttribute(t))})}}zn("unmount",function(e,t){if(typeof t.type=="string"){var r=t.__e;if(r){var n=r.U;if(n){r.U=void 0;for(var i in n){var s=n[i];s&&s.d()}}}}else{var o=t.__c;if(o){var c=o.__$u;c&&(o.__$u=void 0,c.d())}}e(t)});zn("__h",function(e,t,r,n){(n<3||n===9)&&(t.__$f|=2),e(t,r,n)});pr.prototype.shouldComponentUpdate=function(e,t){var r=this.__$u,n=r&&r.s!==void 0;for(var i in t)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 s in e)if(s!=="__source"&&e[s]!==this.props[s])return!0;for(var o in this.props)if(!(o in e))return!0;return!1};function Cg(e){return Yc(function(){return $t(e)},[])}var xg=Object.prototype.toString,Kn=Array.isArray||function(e){return xg.call(e)==="[object Array]"};function el(e){return typeof e=="function"}function Dg(e){return Kn(e)?"array":typeof e}function Zc(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Ef(e,t){return e!=null&&typeof e=="object"&&t in e}function Rg(e,t){return e!=null&&typeof e!="object"&&e.hasOwnProperty&&e.hasOwnProperty(t)}var Ag=RegExp.prototype.test;function Ng(e,t){return Ag.call(e,t)}var Og=/\S/;function Pg(e){return!Ng(Og,e)}var Lg={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};function Bg(e){return String(e).replace(/[&<>"'`=\/]/g,function(t){return Lg[t]})}var Ug=/\s*/,kg=/\s+/,Sf=/\s*=/,Mg=/\s*\}/,Fg=/#|\^|\/|>|\{|&|=|!/;function Hg(e,t){if(!e)return[];var r=!1,n=[],i=[],s=[],o=!1,c=!1,u="",p=0;function m(){if(o&&!c)for(;s.length;)delete i[s.pop()];else s=[];o=!1,c=!1}var h,y,E;function v(j){if(typeof j=="string"&&(j=j.split(kg,2)),!Kn(j)||j.length!==2)throw new Error("Invalid tags: "+j);h=new RegExp(Zc(j[0])+"\\s*"),y=new RegExp("\\s*"+Zc(j[1])),E=new RegExp("\\s*"+Zc("}"+j[1]))}v(t||jt.tags);for(var _=new Zi(e),x,P,B,U,R,G;!_.eos();){if(x=_.pos,B=_.scanUntil(h),B)for(var ue=0,Me=B.length;ue<Me;++ue)U=B.charAt(ue),Pg(U)?(s.push(i.length),u+=U):(c=!0,r=!0,u+=" "),i.push(["text",U,x,x+1]),x+=1,U===`
|
|
17
|
+
`&&(m(),u="",p=0,r=!1);if(!_.scan(h))break;if(o=!0,P=_.scan(Fg)||"name",_.scan(Ug),P==="="?(B=_.scanUntil(Sf),_.scan(Sf),_.scanUntil(y)):P==="{"?(B=_.scanUntil(E),_.scan(Mg),_.scanUntil(y),P="&"):B=_.scanUntil(y),!_.scan(y))throw new Error("Unclosed tag at "+_.pos);if(P==">"?R=[P,B,x,_.pos,u,p,r]:R=[P,B,x,_.pos],p++,i.push(R),P==="#"||P==="^")n.push(R);else if(P==="/"){if(G=n.pop(),!G)throw new Error('Unopened section "'+B+'" at '+x);if(G[1]!==B)throw new Error('Unclosed section "'+G[1]+'" at '+x)}else P==="name"||P==="{"||P==="&"?c=!0:P==="="&&v(B)}if(m(),G=n.pop(),G)throw new Error('Unclosed section "'+G[1]+'" at '+_.pos);return jg($g(i))}function $g(e){for(var t=[],r,n,i=0,s=e.length;i<s;++i)r=e[i],r&&(r[0]==="text"&&n&&n[0]==="text"?(n[1]+=r[1],n[3]=r[3]):(t.push(r),n=r));return t}function jg(e){for(var t=[],r=t,n=[],i,s,o=0,c=e.length;o<c;++o)switch(i=e[o],i[0]){case"#":case"^":r.push(i),n.push(i),r=i[4]=[];break;case"/":s=n.pop(),s[5]=i[2],r=n.length>0?n[n.length-1][4]:t;break;default:r.push(i)}return t}function Zi(e){this.string=e,this.tail=e,this.pos=0}Zi.prototype.eos=function(){return this.tail===""};Zi.prototype.scan=function(e){var t=this.tail.match(e);if(!t||t.index!==0)return"";var r=t[0];return this.tail=this.tail.substring(r.length),this.pos+=r.length,r};Zi.prototype.scanUntil=function(e){var t=this.tail.search(e),r;switch(t){case-1:r=this.tail,this.tail="";break;case 0:r="";break;default:r=this.tail.substring(0,t),this.tail=this.tail.substring(t)}return this.pos+=r.length,r};function qn(e,t){this.view=e,this.cache={".":this.view},this.parent=t}qn.prototype.push=function(e){return new qn(e,this)};qn.prototype.lookup=function(e){var t=this.cache,r;if(t.hasOwnProperty(e))r=t[e];else{for(var n=this,i,s,o,c=!1;n;){if(e.indexOf(".")>0)for(i=n.view,s=e.split("."),o=0;i!=null&&o<s.length;)o===s.length-1&&(c=Ef(i,s[o])||Rg(i,s[o])),i=i[s[o++]];else i=n.view[e],c=Ef(n.view,e);if(c){r=i;break}n=n.parent}t[e]=r}return el(r)&&(r=r.call(this.view)),r};function _t(){this.templateCache={_cache:{},set:function(e,t){this._cache[e]=t},get:function(e){return this._cache[e]},clear:function(){this._cache={}}}}_t.prototype.clearCache=function(){typeof this.templateCache<"u"&&this.templateCache.clear()};_t.prototype.parse=function(e,t){var r=this.templateCache,n=e+":"+(t||jt.tags).join(":"),i=typeof r<"u",s=i?r.get(n):void 0;return s==null&&(s=Hg(e,t),i&&r.set(n,s)),s};_t.prototype.render=function(e,t,r,n){var i=this.getConfigTags(n),s=this.parse(e,i),o=t instanceof qn?t:new qn(t,void 0);return this.renderTokens(s,o,r,e,n)};_t.prototype.renderTokens=function(e,t,r,n,i){for(var s="",o,c,u,p=0,m=e.length;p<m;++p)u=void 0,o=e[p],c=o[0],c==="#"?u=this.renderSection(o,t,r,n,i):c==="^"?u=this.renderInverted(o,t,r,n,i):c===">"?u=this.renderPartial(o,t,r,i):c==="&"?u=this.unescapedValue(o,t):c==="name"?u=this.escapedValue(o,t,i):c==="text"&&(u=this.rawValue(o)),u!==void 0&&(s+=u);return s};_t.prototype.renderSection=function(e,t,r,n,i){var s=this,o="",c=t.lookup(e[1]);function u(h){return s.render(h,t,r,i)}if(c){if(Kn(c))for(var p=0,m=c.length;p<m;++p)o+=this.renderTokens(e[4],t.push(c[p]),r,n,i);else if(typeof c=="object"||typeof c=="string"||typeof c=="number")o+=this.renderTokens(e[4],t.push(c),r,n,i);else if(el(c)){if(typeof n!="string")throw new Error("Cannot use higher-order sections without the original template");c=c.call(t.view,n.slice(e[3],e[5]),u),c!=null&&(o+=c)}else o+=this.renderTokens(e[4],t,r,n,i);return o}};_t.prototype.renderInverted=function(e,t,r,n,i){var s=t.lookup(e[1]);if(!s||Kn(s)&&s.length===0)return this.renderTokens(e[4],t,r,n,i)};_t.prototype.indentPartial=function(e,t,r){for(var n=t.replace(/[^ \t]/g,""),i=e.split(`
|
|
18
18
|
`),s=0;s<i.length;s++)i[s].length&&(s>0||!r)&&(i[s]=n+i[s]);return i.join(`
|
|
19
|
-
`)};yt.prototype.renderPartial=function(t,e,r,n){if(r){var i=this.getConfigTags(n),s=Kc(r)?r(t[1]):r[t[1]];if(s!=null){var o=t[6],c=t[5],u=t[4],d=s;c==0&&u&&(d=this.indentPartial(s,u,o));var m=this.parse(d,i);return this.renderTokens(m,e,r,d,n)}}};yt.prototype.unescapedValue=function(t,e){var r=e.lookup(t[1]);if(r!=null)return r};yt.prototype.escapedValue=function(t,e,r){var n=this.getConfigEscape(r)||Ft.escape,i=e.lookup(t[1]);if(i!=null)return typeof i=="number"&&n===Ft.escape?String(i):n(i)};yt.prototype.rawValue=function(t){return t[1]};yt.prototype.getConfigTags=function(t){return qn(t)?t:t&&typeof t=="object"?t.tags:void 0};yt.prototype.getConfigEscape=function(t){if(t&&typeof t=="object"&&!qn(t))return t.escape};var Ft={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 yt;Ft.clearCache=function(){return Zi.clearCache()};Ft.parse=function(t,e){return Zi.parse(t,e)};Ft.render=function(t,e,r,n){if(typeof t!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+Ah(t)+'" was given as the first argument for mustache#render(template, view, partials)');return Zi.render(t,e,r,n)};Ft.escape=kh;Ft.Scanner=eo;Ft.Context=Yn;Ft.Writer=yt;var vt=Ft,Mp=Zt(kp()),Nt=class Un{static DOCUMENT_STANDARD_MODE="CSS1Compat";static _instance;parentContainer;scalingFactor=1;doc=document;parser=new Mp.default;constructor(){}static get(){return Un._instance||(Un._instance=new Un),Un._instance}getUAParser(){return this.parser}getWidth(){return this.parentContainer&&this.parentContainer!==document.body?this.parentContainer.clientWidth:document.compatMode===Un.DOCUMENT_STANDARD_MODE?document.documentElement.clientWidth:window.innerWidth}getHeight(){return this.isParentNotBody()?this.parentContainer.clientHeight:document.compatMode===Un.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,s=e.spc,o=Un.get().getWidth(),c=Un.get().getHeight();r&&(o=o?Math.min(o,r):r,c=c?Math.min(c,r):r),c&&(o-=s.getHorizontal(),c-=s.getVertical(),o/c<n/i?this.scalingFactor=o/n:this.scalingFactor=c/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}},ie=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"},Xc=Zt(Hp());function Kn(t){return Xc.default.createInstance({name:"lc",storeName:t,driver:Xc.default.LOCALSTORAGE})}var Vr=class{static storage;static async get(t,e){return await this.storage?.getItem(t)??e}static set(t,e){return this.storage?.setItem(t,e)}static remove(t){return this.storage?.removeItem(t)}static clear(){return this.storage?.clear()}static getForage(){return this.storage}},et=class extends Vr{static storeName="ses";static{this.storage=Kn(this.storeName)}},Ae=class extends Vr{static storeName="usr";static{this.storage=Kn(this.storeName)}},lt=class{id;mID;vID;vName;imageURL;name;link;quantity;price;constructor(t){this.id=t.id,this.mID=t.mID,this.vID=t.vID,this.vName=t.vName,this.imageURL=t.imageURL,this.name=t.name,this.link=t.link,this.quantity=t.quantity,this.price=t.price}},le=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(t){this._currencyCode=t}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(t){this.currentItem=new lt(t)}},Ne=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 t=new URL(window.location.href).pathname.slice(1).split("/"),e=t[0];if(e==="")return"home";if(e==="collections")return t[2]==="products"?"product":"collection";if(e==="products")return"product";if(e==="cart")return"cart";if(location.href.includes("thank_you"))return"thank_you"}static getProductSlug(t){let e=(t.includes("://")?new URL(t).pathname:t).match(/\/products\/([^/]+?)(?:\.html)?$/);return e?e[1]:null}static getRootPrefix(){return window.Shopify?.routes?.root??"/"}static getCartURL(t){return this.getRootPrefix()+t+this.COOEE_URL_PREFIX}},Jn=class{isLocked=!1;queue=[];async acquire(){if(this.isLocked)await new Promise(t=>this.queue.push(t));else{this.isLocked=!0;return}}release(){if(this.queue.length>0){let t=this.queue.shift();t&&t()}else this.isLocked=!1}},me=class op{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 op),this.CURRENT}async getNormalisedCart(e){await this.fetchCartFromShopify(e);let r=this.convertToCooeeCart();return e&&await Ae.set(ie.CURRENT_CART,r),r}async addCooeeAttributes(){await this.lock.acquire();let e=await et.get(ie.ID),r=await Ae.get(ie.DEVICE_ID);if(this.attributes?.letscooee_did===r&&this.attributes?.letscooee_sid===e){b.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()};b.debug("Updating Shopify cart with attributes:",n);let i=Ne.getCartURL("cart/update.js"),s=await(await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({attributes:n})})).json();b.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,le.get().currencyCode=this.currency,b.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 b.error("No item received to be sent"),[];Array.isArray(e)||(e=[e]);let r=[];for(let n of e){if(!n.id||!n.title){b.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},s=n.selling_plan_allocation?.selling_plan;if(!s){r.push(i);continue}i.sellingPlanAllocation={sellingPlan:{fixedSellingPlan:s.fixed_selling_plan,id:s.id,name:s.name,recurringDeliveries:s.recurring_deliveries}},r.push(i)}return r}async fetchCartFromShopify(e){if(!e&&this.token){b.debug("Not fetching cart");return}b.debug("Fetching cart");let r=Ne.getCartURL("cart.js"),n=await(await fetch(r)).json();this.update(n)}},os=class{static format(t,e){let r=/{{\s*(\w+)\s*}}/;return e.replace(r,(n,i)=>{switch(i){case"amount":return this.formatWithDelimiters(t,2);case"amount_no_decimals":return this.formatWithDelimiters(t,0);case"amount_with_comma_separator":return this.formatWithDelimiters(t,2,".",",");case"amount_no_decimals_with_comma_separator":return this.formatWithDelimiters(t,0,".",",");case"amount_with_apostrophe_separator":return this.formatWithDelimiters(t,2,"'",".");case"amount_no_decimals_with_space_separator":return this.formatWithDelimiters(t,0," ");case"amount_with_space_separator":return this.formatWithDelimiters(t,2," ",",");case"amount_with_period_and_space_separator":return this.formatWithDelimiters(t,2," ",".");default:return n}})}static formatWithDelimiters(t,e=2,r=",",n="."){if(isNaN(t)||t==null)return"0";let i=(t/100).toFixed(e).split("."),s=i[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+r),o=i[1]?n+i[1]:"";return s+o}},Ht=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(t){return typeof t=="object"&&!Array.isArray(t)&&t!==null}static parseToAny(t){try{return JSON.parse(t.toString())}catch{}return t.toString().match(this.ISO_WITHOUT_MS_REGEX)?new Date(t.toString()):t}static async sleep(t){return new Promise(e=>setTimeout(e,t))}static hasKeys(t){return t?Object.keys(t).length>=1:!1}static convertObjectToArray(t,e){return e.reduce((r,n)=>(t.hasOwnProperty(n)&&t[n]!=null&&r.push({[n]:t[n]}),r),[])}static removeNullUndefinedKeys(t){return Object.keys(t).reduce((e,r)=>(t[r]!==null&&t[r]!==void 0&&(e[r]=t[r]),e),{})}static stringify(t){return JSON.stringify(t,function(e,r){return r===void 0?null:r})}},$p=Object.prototype.toString;function nn(t){switch($p.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return dr(t,Error)}}function Xn(t,e){return $p.call(t)===`[object ${e}]`}function ss(t){return Xn(t,"ErrorEvent")}function as(t){return Xn(t,"DOMError")}function Qc(t){return Xn(t,"DOMException")}function _t(t){return Xn(t,"String")}function Qn(t){return typeof t=="object"&&t!==null&&"__sentry_template_string__"in t&&"__sentry_template_values__"in t}function on(t){return t===null||Qn(t)||typeof t!="object"&&typeof t!="function"}function tr(t){return Xn(t,"Object")}function sn(t){return typeof Event<"u"&&dr(t,Event)}function Zc(t){return typeof Element<"u"&&dr(t,Element)}function el(t){return Xn(t,"RegExp")}function Nr(t){return!!(t&&t.then&&typeof t.then=="function")}function tl(t){return tr(t)&&"nativeEvent"in t&&"preventDefault"in t&&"stopPropagation"in t}function dr(t,e){try{return t instanceof e}catch{return!1}}function ro(t){return!!(typeof t=="object"&&t!==null&&(t.__isVue||t._isVue))}function hr(t,e=0){return typeof t!="string"||e===0||t.length<=e?t:`${t.slice(0,e)}...`}function cs(t,e){if(!Array.isArray(t))return"";let r=[];for(let n=0;n<t.length;n++){let i=t[n];try{ro(i)?r.push("[VueViewModel]"):r.push(String(i))}catch{r.push("[value cannot be serialized]")}}return r.join(e)}function jp(t,e,r=!1){return _t(t)?el(e)?e.test(t):_t(e)?r?t===e:t.includes(e):!1:!1}function Zn(t,e=[],r=!1){return e.some(n=>jp(t,n,r))}function nl(t,e,r=250,n,i,s,o){if(!s.exception||!s.exception.values||!o||!dr(o.originalException,Error))return;let c=s.exception.values.length>0?s.exception.values[s.exception.values.length-1]:void 0;c&&(s.exception.values=Vh(rl(t,e,i,o.originalException,n,s.exception.values,c,0),r))}function rl(t,e,r,n,i,s,o,c){if(s.length>=r+1)return s;let u=[...s];if(dr(n[i],Error)){Wp(o,c);let d=t(e,n[i]),m=u.length;Gp(d,i,m,c),u=rl(t,e,r,n[i],i,[d,...u],d,m)}return Array.isArray(n.errors)&&n.errors.forEach((d,m)=>{if(dr(d,Error)){Wp(o,c);let h=t(e,d),v=u.length;Gp(h,`errors[${m}]`,v,c),u=rl(t,e,r,d,i,[h,...u],h,v)}}),u}function Wp(t,e){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism=Z(w(w({},t.mechanism),t.type==="AggregateError"&&{is_exception_group:!0}),{exception_id:e})}function Gp(t,e,r,n){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism=Z(w({},t.mechanism),{type:"chained",source:e,exception_id:r,parent_id:n})}function Vh(t,e){return t.map(r=>(r.value&&(r.value=hr(r.value,e)),r))}var $t="8.18.0",ee=globalThis;function ei(t,e,r){let n=r||ee,i=n.__SENTRY__=n.__SENTRY__||{},s=i[$t]=i[$t]||{};return s[t]||(s[t]=e())}var il=ee,zh=80;function no(t,e={}){if(!t)return"<unknown>";try{let r=t,n=5,i=[],s=0,o=0,c=" > ",u=c.length,d,m=Array.isArray(e)?e:e.keyAttrs,h=!Array.isArray(e)&&e.maxStringLength||zh;for(;r&&s++<n&&(d=Yh(r,m),!(d==="html"||s>1&&o+i.length*u+d.length>=h));)i.push(d),o+=d.length,r=r.parentNode;return i.reverse().join(c)}catch{return"<unknown>"}}function Yh(t,e){let r=t,n=[];if(!r||!r.tagName)return"";if(il.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(o=>r.getAttribute(o)).map(o=>[o,r.getAttribute(o)]):null;if(i&&i.length)i.forEach(o=>{n.push(`[${o[0]}="${o[1]}"]`)});else{r.id&&n.push(`#${r.id}`);let o=r.className;if(o&&_t(o)){let c=o.split(/\s+/);for(let u of c)n.push(`.${u}`)}}let s=["aria-label","type","name","title","alt"];for(let o of s){let c=r.getAttribute(o);c&&n.push(`[${o}="${c}"]`)}return n.join("")}function ol(){try{return il.document.location.href}catch{return""}}function sl(t){if(!il.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 gr=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,qh="Sentry Logger ",io=["debug","info","warn","error","log","assert","trace"],ti={};function ri(t){if(!("console"in ee))return t();let e=ee.console,r={},n=Object.keys(ti);n.forEach(i=>{let s=ti[i];r[i]=e[i],e[i]=s});try{return t()}finally{n.forEach(i=>{e[i]=r[i]})}}function Kh(){let t=!1,e={enable:()=>{t=!0},disable:()=>{t=!1},isEnabled:()=>t};return gr?io.forEach(r=>{e[r]=(...n)=>{t&&ri(()=>{ee.console[r](`${qh}[${r}]:`,...n)})}}):io.forEach(r=>{e[r]=()=>{}}),e}var q=Kh(),Jh=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function Xh(t){return t==="http"||t==="https"}function yr(t,e=!1){let{host:r,path:n,pass:i,port:s,projectId:o,protocol:c,publicKey:u}=t;return`${c}://${u}${e&&i?`:${i}`:""}@${r}${s?`:${s}`:""}/${n&&`${n}/`}${o}`}function Vp(t){let e=Jh.exec(t);if(!e){ri(()=>{console.error(`Invalid Sentry Dsn: ${t}`)});return}let[r,n,i="",s="",o="",c=""]=e.slice(1),u="",d=c,m=d.split("/");if(m.length>1&&(u=m.slice(0,-1).join("/"),d=m.pop()),d){let h=d.match(/^\d+/);h&&(d=h[0])}return zp({host:s,pass:i,path:u,projectId:d,port:o,protocol:r,publicKey:n})}function zp(t){return{protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function Qh(t){if(!gr)return!0;let{port:e,projectId:r,protocol:n}=t;return["protocol","publicKey","host","projectId"].find(i=>t[i]?!1:(q.error(`Invalid Sentry Dsn: ${i} missing`),!0))?!1:r.match(/^\d+$/)?Xh(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 ls(t){let e=typeof t=="string"?Vp(t):zp(t);if(!(!e||!Qh(e)))return e}var ut=class extends Error{constructor(t,e="warn"){super(t),this.message=t,this.name=new.target.prototype.constructor.name,Object.setPrototypeOf(this,new.target.prototype),this.logLevel=e}};function Le(t,e,r){if(!(e in t))return;let n=t[e],i=r(n);typeof i=="function"&&us(i,n),t[e]=i}function Et(t,e,r){try{Object.defineProperty(t,e,{value:r,writable:!0,configurable:!0})}catch{gr&&q.log(`Failed to add non-enumerable property "${e}" to object`,t)}}function us(t,e){try{let r=e.prototype||{};t.prototype=e.prototype=r,Et(t,"__sentry_original__",e)}catch{}}function an(t){return t.__sentry_original__}function cl(t){return Object.keys(t).map(e=>`${encodeURIComponent(e)}=${encodeURIComponent(t[e])}`).join("&")}function ps(t){if(nn(t))return w({message:t.message,name:t.name,stack:t.stack},qp(t));if(sn(t)){let e=w({type:t.type,target:Yp(t.target),currentTarget:Yp(t.currentTarget)},qp(t));return typeof CustomEvent<"u"&&dr(t,CustomEvent)&&(e.detail=t.detail),e}else return t}function Yp(t){try{return Zc(t)?no(t):Object.prototype.toString.call(t)}catch{return"<unknown>"}}function qp(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 ll(t,e=40){let r=Object.keys(ps(t));r.sort();let n=r[0];if(!n)return"[object has no keys]";if(n.length>=e)return hr(n,e);for(let i=r.length;i>0;i--){let s=r.slice(0,i).join(", ");if(!(s.length>e))return i===r.length?s:hr(s,e)}return""}function Xe(t){return al(t,new Map)}function al(t,e){if(Zh(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]=al(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(al(i,e))}),n}return t}function Zh(t){if(!tr(t))return!1;try{let e=Object.getPrototypeOf(t).constructor.name;return!e||e==="Object"}catch{return!0}}var vr="?",Kp=/\(error: (.*)\)/,Jp=/captureMessage|captureException/;function pl(...t){let e=t.sort((r,n)=>r[0]-n[0]).map(r=>r[1]);return(r,n=0,i=0)=>{let s=[],o=r.split(`
|
|
20
|
-
`);for(let c=n;c<o.length;c++){let u=o[c];if(u.length>1024)continue;let
|
|
21
|
-
Type: ${
|
|
22
|
-
Name: ${
|
|
23
|
-
Error:`,i)}}function
|
|
19
|
+
`)};_t.prototype.renderPartial=function(e,t,r,n){if(r){var i=this.getConfigTags(n),s=el(r)?r(e[1]):r[e[1]];if(s!=null){var o=e[6],c=e[5],u=e[4],p=s;c==0&&u&&(p=this.indentPartial(s,u,o));var m=this.parse(p,i);return this.renderTokens(m,t,r,p,n)}}};_t.prototype.unescapedValue=function(e,t){var r=t.lookup(e[1]);if(r!=null)return r};_t.prototype.escapedValue=function(e,t,r){var n=this.getConfigEscape(r)||jt.escape,i=t.lookup(e[1]);if(i!=null)return typeof i=="number"&&n===jt.escape?String(i):n(i)};_t.prototype.rawValue=function(e){return e[1]};_t.prototype.getConfigTags=function(e){return Kn(e)?e:e&&typeof e=="object"?e.tags:void 0};_t.prototype.getConfigEscape=function(e){if(e&&typeof e=="object"&&!Kn(e))return e.escape};var jt={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(e){Qi.templateCache=e},get templateCache(){return Qi.templateCache}},Qi=new _t;jt.clearCache=function(){return Qi.clearCache()};jt.parse=function(e,t){return Qi.parse(e,t)};jt.render=function(e,t,r,n){if(typeof e!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+Dg(e)+'" was given as the first argument for mustache#render(template, view, partials)');return Qi.render(e,t,r,n)};jt.escape=Bg;jt.Scanner=Zi;jt.Context=qn;jt.Writer=_t;var Et=jt,bf=Ce(wf()),Lt=class Mn{static DOCUMENT_STANDARD_MODE="CSS1Compat";static _instance;parentContainer;scalingFactor=1;doc=document;parser=new bf.default;constructor(){}static get(){return Mn._instance||(Mn._instance=new Mn),Mn._instance}getUAParser(){return this.parser}getWidth(){return this.parentContainer&&this.parentContainer!==document.body?this.parentContainer.clientWidth:document.compatMode===Mn.DOCUMENT_STANDARD_MODE?document.documentElement.clientWidth:window.innerWidth}getHeight(){return this.isParentNotBody()?this.parentContainer.clientHeight:document.compatMode===Mn.DOCUMENT_STANDARD_MODE?document.documentElement.clientHeight:window.innerHeight}isMobile(){return this.parser.getDevice().type==="mobile"}calculateScalingFactor(t){let r=t.max,n=t.cont.w,i=t.cont.h,s=t.spc,o=Mn.get().getWidth(),c=Mn.get().getHeight();r&&(o=o?Math.min(o,r):r,c=c?Math.min(c,r):r),c&&(o-=s.getHorizontal(),c-=s.getVertical(),o/c<n/i?this.scalingFactor=o/n:this.scalingFactor=c/i,this.scalingFactor=Math.min(this.scalingFactor,1))}getScalingFactor(){return this.scalingFactor}createElement(t){return this.doc.createElement(t)}appendChild(t,r){t.appendChild(r)}setStyles(t,r){Object.assign(t.style,r)}setStyle(t,r,n){if(r){if(!n){t.style.removeProperty(r);return}t.style.setProperty(r,n,"important")}}setAttribute(t,r,n){t.setAttribute(r,n)}removeInApp(t){let r=document.querySelector(`.${t.rootClassName}`);r&&r.parentElement.removeChild(r)}setParentContainer(t){this.parentContainer=t,this.parentContainer&&this.isParentNotBody()&&this.setStyle(this.parentContainer,"position","relative")}isParentNotBody(){return this.parentContainer!==document.body}},oe=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"},rl=Ce(Tf());function Xn(e){return rl.default.createInstance({name:"lc",storeName:e,driver:rl.default.LOCALSTORAGE})}var Yr=class{static storage;static async get(e,t){return await this.storage?.getItem(e)??t}static set(e,t){return this.storage?.setItem(e,t)}static remove(e){return this.storage?.removeItem(e)}static clear(){return this.storage?.clear()}static getForage(){return this.storage}},rt=class extends Yr{static storeName="ses";static{this.storage=Xn(this.storeName)}},Oe=class extends Yr{static storeName="usr";static{this.storage=Xn(this.storeName)}},pt=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}},le=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=new pt(e)}},Pe=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 e=new URL(window.location.href).pathname.slice(1).split("/"),t=e[0];if(t==="")return"home";if(t==="collections")return e[2]==="products"?"product":"collection";if(t==="products")return"product";if(t==="cart")return"cart";if(location.href.includes("thank_you"))return"thank_you"}static getProductSlug(e){let t=(e.includes("://")?new URL(e).pathname:e).match(/\/products\/([^/]+?)(?:\.html)?$/);return t?t[1]:null}static getRootPrefix(){return window.Shopify?.routes?.root??"/"}static getCartURL(e){return this.getRootPrefix()+e+this.COOEE_URL_PREFIX}},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}},de=class Ch{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 Ch),this.CURRENT}async getNormalisedCart(t){await this.fetchCartFromShopify(t);let r=this.convertToCooeeCart();return t&&await Oe.set(oe.CURRENT_CART,r),r}async addCooeeAttributes(){await this.lock.acquire();let t=await rt.get(oe.ID),r=await Oe.get(oe.DEVICE_ID);if(this.attributes?.letscooee_did===r&&this.attributes?.letscooee_sid===t){b.debug("Not calling Shopify update.js API.","Current attributes:",this.attributes),this.lock.release();return}let n={letscooee_did:r,letscooee_sid:t,__letscooee_time:new Date().toLocaleString()};b.debug("Updating Shopify cart with attributes:",n);let i=Pe.getCartURL("cart/update.js"),s=await(await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({attributes:n})})).json();b.debug("Updated cart attributes",JSON.stringify(s)),this.update(s),this.lock.release()}update(t){return this.token=t.token,this.items=t.items,this.total_price=t.total_price,this.original_total_price=t.original_total_price,this.currency=t.currency,this.item_count=t.item_count,this.attributes=t.attributes,le.get().currencyCode=this.currency,b.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(t){if(!t)return b.error("No item received to be sent"),[];Array.isArray(t)||(t=[t]);let r=[];for(let n of t){if(!n.id||!n.title){b.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},s=n.selling_plan_allocation?.selling_plan;if(!s){r.push(i);continue}i.sellingPlanAllocation={sellingPlan:{fixedSellingPlan:s.fixed_selling_plan,id:s.id,name:s.name,recurringDeliveries:s.recurring_deliveries}},r.push(i)}return r}async fetchCartFromShopify(t){if(!t&&this.token){b.debug("Not fetching cart");return}b.debug("Fetching cart");let r=Pe.getCartURL("cart.js"),n=await(await fetch(r)).json();this.update(n)}},cs=class{static format(e,t){let r=/{{\s*(\w+)\s*}}/;return t.replace(r,(n,i)=>{switch(i){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 n}})}static formatWithDelimiters(e,t=2,r=",",n="."){if(isNaN(e)||e==null)return"0";let i=(e/100).toFixed(t).split("."),s=i[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+r),o=i[1]?n+i[1]:"";return s+o}},Ym=Ce(Zn()),Cf=Object.prototype.toString;function sn(e){switch(Cf.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return mr(e,Error)}}function ei(e,t){return Cf.call(e)===`[object ${t}]`}function us(e){return ei(e,"ErrorEvent")}function ps(e){return ei(e,"DOMError")}function nl(e){return ei(e,"DOMException")}function St(e){return ei(e,"String")}function ti(e){return typeof e=="object"&&e!==null&&"__sentry_template_string__"in e&&"__sentry_template_values__"in e}function an(e){return e===null||ti(e)||typeof e!="object"&&typeof e!="function"}function rr(e){return ei(e,"Object")}function cn(e){return typeof Event<"u"&&mr(e,Event)}function il(e){return typeof Element<"u"&&mr(e,Element)}function ol(e){return ei(e,"RegExp")}function Ar(e){return!!(e&&e.then&&typeof e.then=="function")}function sl(e){return rr(e)&&"nativeEvent"in e&&"preventDefault"in e&&"stopPropagation"in e}function mr(e,t){try{return e instanceof t}catch{return!1}}function to(e){return!!(typeof e=="object"&&e!==null&&(e.__isVue||e._isVue))}function dr(e,t=0){return typeof e!="string"||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function fs(e,t){if(!Array.isArray(e))return"";let r=[];for(let n=0;n<e.length;n++){let i=e[n];try{to(i)?r.push("[VueViewModel]"):r.push(String(i))}catch{r.push("[value cannot be serialized]")}}return r.join(t)}function xf(e,t,r=!1){return St(e)?ol(t)?t.test(e):St(t)?r?e===t:e.includes(t):!1:!1}function ri(e,t=[],r=!1){return t.some(n=>xf(e,n,r))}function cl(e,t,r=250,n,i,s,o){if(!s.exception||!s.exception.values||!o||!mr(o.originalException,Error))return;let c=s.exception.values.length>0?s.exception.values[s.exception.values.length-1]:void 0;c&&(s.exception.values=Gg(al(e,t,i,o.originalException,n,s.exception.values,c,0),r))}function al(e,t,r,n,i,s,o,c){if(s.length>=r+1)return s;let u=[...s];if(mr(n[i],Error)){Df(o,c);let p=e(t,n[i]),m=u.length;Rf(p,i,m,c),u=al(e,t,r,n[i],i,[p,...u],p,m)}return Array.isArray(n.errors)&&n.errors.forEach((p,m)=>{if(mr(p,Error)){Df(o,c);let h=e(t,p),y=u.length;Rf(h,`errors[${m}]`,y,c),u=al(e,t,r,p,i,[h,...u],h,y)}}),u}function Df(e,t){e.mechanism=e.mechanism||{type:"generic",handled:!0},e.mechanism=ee(w(w({},e.mechanism),e.type==="AggregateError"&&{is_exception_group:!0}),{exception_id:t})}function Rf(e,t,r,n){e.mechanism=e.mechanism||{type:"generic",handled:!0},e.mechanism=ee(w({},e.mechanism),{type:"chained",source:t,exception_id:r,parent_id:n})}function Gg(e,t){return e.map(r=>(r.value&&(r.value=dr(r.value,t)),r))}var Wt="8.18.0",te=globalThis;function ni(e,t,r){let n=r||te,i=n.__SENTRY__=n.__SENTRY__||{},s=i[Wt]=i[Wt]||{};return s[e]||(s[e]=t())}var ll=te,Vg=80;function ro(e,t={}){if(!e)return"<unknown>";try{let r=e,n=5,i=[],s=0,o=0,c=" > ",u=c.length,p,m=Array.isArray(t)?t:t.keyAttrs,h=!Array.isArray(t)&&t.maxStringLength||Vg;for(;r&&s++<n&&(p=Yg(r,m),!(p==="html"||s>1&&o+i.length*u+p.length>=h));)i.push(p),o+=p.length,r=r.parentNode;return i.reverse().join(c)}catch{return"<unknown>"}}function Yg(e,t){let r=e,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=t&&t.length?t.filter(o=>r.getAttribute(o)).map(o=>[o,r.getAttribute(o)]):null;if(i&&i.length)i.forEach(o=>{n.push(`[${o[0]}="${o[1]}"]`)});else{r.id&&n.push(`#${r.id}`);let o=r.className;if(o&&St(o)){let c=o.split(/\s+/);for(let u of c)n.push(`.${u}`)}}let s=["aria-label","type","name","title","alt"];for(let o of s){let c=r.getAttribute(o);c&&n.push(`[${o}="${c}"]`)}return n.join("")}function ul(){try{return ll.document.location.href}catch{return""}}function pl(e){if(!ll.HTMLElement)return null;let t=e,r=5;for(let n=0;n<r;n++){if(!t)return null;if(t instanceof HTMLElement){if(t.dataset.sentryComponent)return t.dataset.sentryComponent;if(t.dataset.sentryElement)return t.dataset.sentryElement}t=t.parentNode}return null}var hr=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,zg="Sentry Logger ",no=["debug","info","warn","error","log","assert","trace"],ii={};function oi(e){if(!("console"in te))return e();let t=te.console,r={},n=Object.keys(ii);n.forEach(i=>{let s=ii[i];r[i]=t[i],t[i]=s});try{return e()}finally{n.forEach(i=>{t[i]=r[i]})}}function qg(){let e=!1,t={enable:()=>{e=!0},disable:()=>{e=!1},isEnabled:()=>e};return hr?no.forEach(r=>{t[r]=(...n)=>{e&&oi(()=>{te.console[r](`${zg}[${r}]:`,...n)})}}):no.forEach(r=>{t[r]=()=>{}}),t}var K=qg(),Kg=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function Xg(e){return e==="http"||e==="https"}function gr(e,t=!1){let{host:r,path:n,pass:i,port:s,projectId:o,protocol:c,publicKey:u}=e;return`${c}://${u}${t&&i?`:${i}`:""}@${r}${s?`:${s}`:""}/${n&&`${n}/`}${o}`}function Af(e){let t=Kg.exec(e);if(!t){oi(()=>{console.error(`Invalid Sentry Dsn: ${e}`)});return}let[r,n,i="",s="",o="",c=""]=t.slice(1),u="",p=c,m=p.split("/");if(m.length>1&&(u=m.slice(0,-1).join("/"),p=m.pop()),p){let h=p.match(/^\d+/);h&&(p=h[0])}return Nf({host:s,pass:i,path:u,projectId:p,port:o,protocol:r,publicKey:n})}function Nf(e){return{protocol:e.protocol,publicKey:e.publicKey||"",pass:e.pass||"",host:e.host,port:e.port||"",path:e.path||"",projectId:e.projectId}}function Jg(e){if(!hr)return!0;let{port:t,projectId:r,protocol:n}=e;return["protocol","publicKey","host","projectId"].find(i=>e[i]?!1:(K.error(`Invalid Sentry Dsn: ${i} missing`),!0))?!1:r.match(/^\d+$/)?Xg(n)?t&&isNaN(parseInt(t,10))?(K.error(`Invalid Sentry Dsn: Invalid port ${t}`),!1):!0:(K.error(`Invalid Sentry Dsn: Invalid protocol ${n}`),!1):(K.error(`Invalid Sentry Dsn: Invalid projectId ${r}`),!1)}function ms(e){let t=typeof e=="string"?Af(e):Nf(e);if(!(!t||!Jg(t)))return t}var ft=class extends Error{constructor(e,t="warn"){super(e),this.message=e,this.name=new.target.prototype.constructor.name,Object.setPrototypeOf(this,new.target.prototype),this.logLevel=t}};function Ue(e,t,r){if(!(t in e))return;let n=e[t],i=r(n);typeof i=="function"&&ds(i,n),e[t]=i}function wt(e,t,r){try{Object.defineProperty(e,t,{value:r,writable:!0,configurable:!0})}catch{hr&&K.log(`Failed to add non-enumerable property "${t}" to object`,e)}}function ds(e,t){try{let r=t.prototype||{};e.prototype=t.prototype=r,wt(e,"__sentry_original__",t)}catch{}}function ln(e){return e.__sentry_original__}function ml(e){return Object.keys(e).map(t=>`${encodeURIComponent(t)}=${encodeURIComponent(e[t])}`).join("&")}function hs(e){if(sn(e))return w({message:e.message,name:e.name,stack:e.stack},Pf(e));if(cn(e)){let t=w({type:e.type,target:Of(e.target),currentTarget:Of(e.currentTarget)},Pf(e));return typeof CustomEvent<"u"&&mr(e,CustomEvent)&&(t.detail=e.detail),t}else return e}function Of(e){try{return il(e)?ro(e):Object.prototype.toString.call(e)}catch{return"<unknown>"}}function Pf(e){if(typeof e=="object"&&e!==null){let t={};for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}else return{}}function dl(e,t=40){let r=Object.keys(hs(e));r.sort();let n=r[0];if(!n)return"[object has no keys]";if(n.length>=t)return dr(n,t);for(let i=r.length;i>0;i--){let s=r.slice(0,i).join(", ");if(!(s.length>t))return i===r.length?s:dr(s,t)}return""}function Ze(e){return fl(e,new Map)}function fl(e,t){if(Qg(e)){let r=t.get(e);if(r!==void 0)return r;let n={};t.set(e,n);for(let i of Object.keys(e))typeof e[i]<"u"&&(n[i]=fl(e[i],t));return n}if(Array.isArray(e)){let r=t.get(e);if(r!==void 0)return r;let n=[];return t.set(e,n),e.forEach(i=>{n.push(fl(i,t))}),n}return e}function Qg(e){if(!rr(e))return!1;try{let t=Object.getPrototypeOf(e).constructor.name;return!t||t==="Object"}catch{return!0}}var yr="?",Lf=/\(error: (.*)\)/,Bf=/captureMessage|captureException/;function gl(...e){let t=e.sort((r,n)=>r[0]-n[0]).map(r=>r[1]);return(r,n=0,i=0)=>{let s=[],o=r.split(`
|
|
20
|
+
`);for(let c=n;c<o.length;c++){let u=o[c];if(u.length>1024)continue;let p=Lf.test(u)?u.replace(Lf,"$1"):u;if(!p.match(/\S*Error: /)){for(let m of t){let h=m(p);if(h){s.push(h);break}}if(s.length>=50+i)break}}return Uf(s.slice(i))}}function Uf(e){if(!e.length)return[];let t=Array.from(e);return/sentryWrapped/.test(gs(t).function||"")&&t.pop(),t.reverse(),Bf.test(gs(t).function||"")&&(t.pop(),Bf.test(gs(t).function||"")&&t.pop()),t.slice(0,50).map(r=>ee(w({},r),{filename:r.filename||gs(t).filename,function:r.function||yr}))}function gs(e){return e[e.length-1]||{}}var hl="<anonymous>";function Gt(e){try{return!e||typeof e!="function"?hl:e.name||hl}catch{return hl}}function ys(e){let t=e.exception;if(t){let r=[];try{return t.values.forEach(n=>{n.stacktrace.frames&&r.push(...n.stacktrace.frames)}),r}catch{return}}}var vs={},kf={};function bt(e,t){vs[e]=vs[e]||[],vs[e].push(t)}function It(e,t){kf[e]||(t(),kf[e]=!0)}function et(e,t){let r=e&&vs[e];if(r)for(let n of r)try{n(t)}catch(i){hr&&K.error(`Error while triggering instrumentation handler.
|
|
21
|
+
Type: ${e}
|
|
22
|
+
Name: ${Gt(n)}
|
|
23
|
+
Error:`,i)}}function yl(e){let t="console";bt(t,e),It(t,Zg)}function Zg(){"console"in te&&no.forEach(function(e){e in te.console&&Ue(te.console,e,function(t){return ii[e]=t,function(...r){et("console",{args:r,level:e});let n=ii[e];n&&n.apply(te.console,r)}})})}var vl=te;function Mf(){if(!("fetch"in vl))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}function io(e){return e&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(e.toString())}function _l(){if(typeof EdgeRuntime=="string")return!0;if(!Mf())return!1;if(io(vl.fetch))return!0;let e=!1,t=vl.document;if(t&&typeof t.createElement=="function")try{let r=t.createElement("iframe");r.hidden=!0,t.head.appendChild(r),r.contentWindow&&r.contentWindow.fetch&&(e=io(r.contentWindow.fetch)),t.head.removeChild(r)}catch(r){hr&&K.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",r)}return e}var Ff=1e3;function vr(){return Date.now()/Ff}function ey(){let{performance:e}=te;if(!e||!e.now)return vr;let t=Date.now()-e.now(),r=e.timeOrigin==null?t:e.timeOrigin;return()=>(r+e.now())/Ff}var Bt=ey(),oo,ty=(()=>{let{performance:e}=te;if(!e||!e.now){oo="none";return}let t=3600*1e3,r=e.now(),n=Date.now(),i=e.timeOrigin?Math.abs(e.timeOrigin+r-n):t,s=i<t,o=e.timing&&e.timing.navigationStart,c=typeof o=="number"?Math.abs(o+r-n):t,u=c<t;return s||u?i<=c?(oo="timeOrigin",e.timeOrigin):(oo="navigationStart",o):(oo="dateNow",n)})();function Sl(e){let t="fetch";bt(t,e),It(t,ry)}function ry(){_l()&&Ue(te,"fetch",function(e){return function(...t){let{method:r,url:n}=ny(t),i={args:t,fetchData:{method:r,url:n},startTimestamp:Bt()*1e3};et("fetch",w({},i));let s=new Error().stack;return e.apply(te,t).then(o=>{let c=ee(w({},i),{endTimestamp:Bt()*1e3,response:o});return et("fetch",c),o},o=>{let c=ee(w({},i),{endTimestamp:Bt()*1e3,error:o});throw et("fetch",c),sn(o)&&o.stack===void 0&&(o.stack=s,wt(o,"framesToPop",1)),o})}})}function El(e,t){return!!e&&typeof e=="object"&&!!e[t]}function Hf(e){return typeof e=="string"?e:e?El(e,"url")?e.url:e.toString?e.toString():"":""}function ny(e){if(e.length===0)return{method:"GET",url:""};if(e.length===2){let[r,n]=e;return{url:Hf(r),method:El(n,"method")?String(n.method).toUpperCase():"GET"}}let t=e[0];return{url:Hf(t),method:El(t,"method")?String(t.method).toUpperCase():"GET"}}var _s=null;function wl(e){let t="error";bt(t,e),It(t,iy)}function iy(){_s=te.onerror,te.onerror=function(e,t,r,n,i){return et("error",{column:n,error:i,line:r,msg:e,url:t}),_s&&!_s.__SENTRY_LOADER__?_s.apply(this,arguments):!1},te.onerror.__SENTRY_INSTRUMENTED__=!0}var Es=null;function bl(e){let t="unhandledrejection";bt(t,e),It(t,oy)}function oy(){Es=te.onunhandledrejection,te.onunhandledrejection=function(e){return et("unhandledrejection",e),Es&&!Es.__SENTRY_LOADER__?Es.apply(this,arguments):!0},te.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}function Il(){return"npm"}function $f(){let e=typeof WeakSet=="function",t=e?new WeakSet:[];function r(i){if(e)return t.has(i)?!0:(t.add(i),!1);for(let s=0;s<t.length;s++)if(t[s]===i)return!0;return t.push(i),!1}function n(i){if(e)t.delete(i);else for(let s=0;s<t.length;s++)if(t[s]===i){t.splice(s,1);break}}return[r,n]}function nt(){let e=te,t=e.crypto||e.msCrypto,r=()=>Math.random()*16;try{if(t&&t.randomUUID)return t.randomUUID().replace(/-/g,"");t&&t.getRandomValues&&(r=()=>{let n=new Uint8Array(1);return t.getRandomValues(n),n[0]})}catch{}return("10000000100040008000"+1e11).replace(/[018]/g,n=>(n^(r()&15)>>n/4).toString(16))}function jf(e){return e.exception&&e.exception.values?e.exception.values[0]:void 0}function nr(e){let{message:t,event_id:r}=e;if(t)return t;let n=jf(e);return n?n.type&&n.value?`${n.type}: ${n.value}`:n.type||n.value||r||"<unknown>":r||"<unknown>"}function si(e,t,r){let n=e.exception=e.exception||{},i=n.values=n.values||[],s=i[0]=i[0]||{};s.value||(s.value=t||""),s.type||(s.type=r||"Error")}function Nr(e,t){let r=jf(e);if(!r)return;let n={type:"generic",handled:!0},i=r.mechanism;if(r.mechanism=w(w(w({},n),i),t),t&&"data"in t){let s=w(w({},i&&i.data),t.data);r.mechanism.data=s}}function Ss(e){if(e&&e.__sentry_captured__)return!0;try{wt(e,"__sentry_captured__",!0)}catch{}return!1}function ws(e){return Array.isArray(e)?e:[e]}function ir(e,t=100,r=1/0){try{return Tl("",e,t,r)}catch(n){return{ERROR:`**non-serializable** (${n})`}}}function bs(e,t=3,r=100*1024){let n=ir(e,t);return ly(n)>r?bs(e,t-1,r):n}function Tl(e,t,r=1/0,n=1/0,i=$f()){let[s,o]=i;if(t==null||["number","boolean","string"].includes(typeof t)&&!Number.isNaN(t))return t;let c=sy(e,t);if(!c.startsWith("[object "))return c;if(t.__sentry_skip_normalization__)return t;let u=typeof t.__sentry_override_normalization_depth__=="number"?t.__sentry_override_normalization_depth__:r;if(u===0)return c.replace("object ","");if(s(t))return"[Circular ~]";let p=t;if(p&&typeof p.toJSON=="function")try{let E=p.toJSON();return Tl("",E,u-1,n,i)}catch{}let m=Array.isArray(t)?[]:{},h=0,y=hs(t);for(let E in y){if(!Object.prototype.hasOwnProperty.call(y,E))continue;if(h>=n){m[E]="[MaxProperties ~]";break}let v=y[E];m[E]=Tl(E,v,u-1,n,i),h++}return o(t),m}function sy(e,t){try{if(e==="domain"&&t&&typeof t=="object"&&t._events)return"[Domain]";if(e==="domainEmitter")return"[DomainEmitter]";if(typeof global<"u"&&t===global)return"[Global]";if(typeof window<"u"&&t===window)return"[Window]";if(typeof document<"u"&&t===document)return"[Document]";if(to(t))return"[VueViewModel]";if(sl(t))return"[SyntheticEvent]";if(typeof t=="number"&&t!==t)return"[NaN]";if(typeof t=="function")return`[Function: ${Gt(t)}]`;if(typeof t=="symbol")return`[${String(t)}]`;if(typeof t=="bigint")return`[BigInt: ${String(t)}]`;let r=ay(t);return/^HTML(\w*)Element$/.test(r)?`[HTMLElement: ${r}]`:`[object ${r}]`}catch(r){return`**non-serializable** (${r})`}}function ay(e){let t=Object.getPrototypeOf(e);return t?t.constructor.name:"null prototype"}function cy(e){return~-encodeURI(e).split(/%..|./).length}function ly(e){return cy(JSON.stringify(e))}var Or;(function(e){e[e.PENDING=0]="PENDING";let t=1;e[e.RESOLVED=t]="RESOLVED";let r=2;e[e.REJECTED=r]="REJECTED"})(Or||(Or={}));function Vt(e){return new or(t=>{t(e)})}function zr(e){return new or((t,r)=>{r(e)})}var or=class Wn{constructor(t){Wn.prototype.__init.call(this),Wn.prototype.__init2.call(this),Wn.prototype.__init3.call(this),Wn.prototype.__init4.call(this),this._state=Or.PENDING,this._handlers=[];try{t(this._resolve,this._reject)}catch(r){this._reject(r)}}then(t,r){return new Wn((n,i)=>{this._handlers.push([!1,s=>{if(!t)n(s);else try{n(t(s))}catch(o){i(o)}},s=>{if(!r)i(s);else try{n(r(s))}catch(o){i(o)}}]),this._executeHandlers()})}catch(t){return this.then(r=>r,t)}finally(t){return new Wn((r,n)=>{let i,s;return this.then(o=>{s=!1,i=o,t&&t()},o=>{s=!0,i=o,t&&t()}).then(()=>{if(s){n(i);return}r(i)})})}__init(){this._resolve=t=>{this._setResult(Or.RESOLVED,t)}}__init2(){this._reject=t=>{this._setResult(Or.REJECTED,t)}}__init3(){this._setResult=(t,r)=>{if(this._state===Or.PENDING){if(Ar(r)){r.then(this._resolve,this._reject);return}this._state=t,this._value=r,this._executeHandlers()}}}__init4(){this._executeHandlers=()=>{if(this._state===Or.PENDING)return;let t=this._handlers.slice();this._handlers=[],t.forEach(r=>{r[0]||(this._state===Or.RESOLVED&&r[1](this._value),this._state===Or.REJECTED&&r[2](this._value),r[0]=!0)})}}};function Cl(e){let t=[];function r(){return e===void 0||t.length<e}function n(o){return t.splice(t.indexOf(o),1)[0]||Promise.resolve(void 0)}function i(o){if(!r())return zr(new ft("Not adding Promise because buffer limit was reached."));let c=o();return t.indexOf(c)===-1&&t.push(c),c.then(()=>n(c)).then(null,()=>n(c).then(null,()=>{})),c}function s(o){return new or((c,u)=>{let p=t.length;if(!p)return c(!0);let m=setTimeout(()=>{o&&o>0&&c(!1)},o);t.forEach(h=>{Vt(h).then(()=>{--p||(clearTimeout(m),c(!0))},u)})})}return{$:t,add:i,drain:s}}function so(e){if(!e)return{};let t=e.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!t)return{};let r=t[6]||"",n=t[8]||"";return{host:t[4],path:t[5],protocol:t[2],search:r,hash:n,relative:t[5]+r+n}}var Wf=["fatal","error","warning","log","info","debug"];function xl(e){return e==="warn"?"warning":Wf.includes(e)?e:"log"}var Vf="sentry-",Yf=/^sentry-/;function Dl(e){let t=zf(e);if(!t)return;let r=Object.entries(t).reduce((n,[i,s])=>{if(i.match(Yf)){let o=i.slice(Vf.length);n[o]=s}return n},{});if(Object.keys(r).length>0)return r}function zf(e){if(!(!e||!St(e)&&!Array.isArray(e)))return Array.isArray(e)?e.reduce((t,r)=>{let n=Gf(r);return Object.entries(n).forEach(([i,s])=>{t[i]=s}),t},{}):Gf(e)}function Gf(e){return e.split(",").map(t=>t.split("=").map(r=>decodeURIComponent(r.trim()))).reduce((t,[r,n])=>(r&&n&&(t[r]=n),t),{})}function _r(e,t=[]){return[e,t]}function Al(e,t){let[r,n]=e;return[r,[...n,t]]}function Is(e,t){let r=e[1];for(let n of r){let i=n[0].type;if(t(n,i))return!0}return!1}function Rl(e){return te.__SENTRY__&&te.__SENTRY__.encodePolyfill?te.__SENTRY__.encodePolyfill(e):new TextEncoder().encode(e)}function Nl(e){let[t,r]=e,n=JSON.stringify(t);function i(s){typeof n=="string"?n=typeof s=="string"?n+s:[Rl(n),s]:n.push(typeof s=="string"?Rl(s):s)}for(let s of r){let[o,c]=s;if(i(`
|
|
24
24
|
${JSON.stringify(o)}
|
|
25
|
-
`),typeof c=="string"||c instanceof Uint8Array)i(c);else{let u;try{u=JSON.stringify(c)}catch{u=JSON.stringify(nr(c))}i(u)}}return typeof n=="string"?n:pg(n)}function pg(t){let e=t.reduce((i,s)=>i+s.length,0),r=new Uint8Array(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return r}function Cl(t){let e=typeof t.data=="string"?Il(t.data):t.data;return[Xe({type:"attachment",length:e.length,filename:t.filename,content_type:t.contentType,attachment_type:t.attachmentType}),e]}var fg={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 Ss(t){return fg[t]}function ws(t){if(!t||!t.sdk)return;let{name:e,version:r}=t.sdk;return{name:e,version:r}}function Dl(t,e,r,n){let i=t.sdkProcessingMetadata&&t.sdkProcessingMetadata.dynamicSamplingContext;return w(w(w({event_id:t.event_id,sent_at:new Date().toISOString()},e&&{sdk:e}),!!r&&n&&{dsn:yr(n)}),i&&{trace:Xe(w({},i))})}function Rl(t,e,r){let n=[{type:"client_report"},{timestamp:r||_r(),discarded_events:t}];return Er(e?{dsn:e}:{},[n])}function uf(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 pf(t,e){return t[e]||t.all||0}function Al(t,e,r=Date.now()){return pf(t,e)>r}function Nl(t,{statusCode:e,headers:r},n=Date.now()){let i=w({},t),s=r&&r["x-sentry-rate-limits"],o=r&&r["retry-after"];if(s)for(let c of s.trim().split(",")){let[u,d,,,m]=c.split(":",5),h=parseInt(u,10),v=(isNaN(h)?60:h)*1e3;if(!d)i.all=n+v;else for(let _ of d.split(";"))_==="metric_bucket"?(!m||m.split(";").includes("custom"))&&(i[_]=n+v):i[_]=n+v}else o?i.all=n+uf(o,n):e===429&&(i.all=n+60*1e3);return i}function bs(){return{traceId:tt(),spanId:tt().substring(16)}}var Is=ee;function Ol(){let t=Is.chrome,e=t&&t.app&&t.app.runtime,r="history"in Is&&!!Is.history.pushState&&!!Is.history.replaceState;return!e&&r}var Ce=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function cn(){return co(ee),ee}function co(t){let e=t.__SENTRY__=t.__SENTRY__||{};return e.version=e.version||$t,e[$t]=e[$t]||{}}function lo(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||Ot(),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:tt()),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 Pl="_sentrySpan";function Ll(t,e){e?Et(t,Pl,e):delete t[Pl]}function Bl(t){return t[Pl]}var hg=100,Ul=class Fp{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext=bs()}clone(){let e=new Fp;return e._breadcrumbs=[...this._breadcrumbs],e._tags=w({},this._tags),e._extra=w({},this._extra),e._contexts=w({},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=w({},this._sdkProcessingMetadata),e._propagationContext=w({},this._propagationContext),e._client=this._client,e._lastEventId=this._lastEventId,Ll(e,Bl(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&&lo(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=w(w({},this._tags),e),this._notifyScopeListeners(),this}setTag(e,r){return this._tags=Z(w({},this._tags),{[e]:r}),this._notifyScopeListeners(),this}setExtras(e){return this._extra=w(w({},this._extra),e),this._notifyScopeListeners(),this}setExtra(e,r){return this._extra=Z(w({},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 pt?[r.getScopeData(),r.getRequestSession()]:tr(r)?[e,e.requestSession]:[],{tags:s,extra:o,user:c,contexts:u,level:d,fingerprint:m=[],propagationContext:h}=n||{};return this._tags=w(w({},this._tags),s),this._extra=w(w({},this._extra),o),this._contexts=w(w({},this._contexts),u),c&&Object.keys(c).length&&(this._user=c),d&&(this._level=d),m.length&&(this._fingerprint=m),h&&(this._propagationContext=h),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,Ll(this,void 0),this._attachments=[],this._propagationContext=bs(),this._notifyScopeListeners(),this}addBreadcrumb(e,r){let n=typeof r=="number"?r:hg;if(n<=0)return this;let i=w({timestamp:_r()},e),s=this._breadcrumbs;return s.push(i),this._breadcrumbs=s.length>n?s.slice(-n):s,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:Bl(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=w(w({},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:tt();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(w({originalException:e,syntheticException:i},r),{event_id:n}),this),n}captureMessage(e,r,n){let i=n&&n.event_id?n.event_id:tt();if(!this._client)return q.warn("No client configured on scope - will not capture message!"),i;let s=new Error(e);return this._client.captureMessage(e,r,Z(w({originalException:e,syntheticException:s},n),{event_id:i}),this),i}captureEvent(e,r){let n=r&&r.event_id?r.event_id:tt();return this._client?(this._client.captureEvent(e,Z(w({},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)}},pt=Ul;function ff(){return ei("defaultCurrentScope",()=>new pt)}function mf(){return ei("defaultIsolationScope",()=>new pt)}var kl=class{constructor(t,e){let r;t?r=t:r=new pt;let n;e?n=e:n=new pt,this._stack=[{scope:r}],this._isolationScope=n}withScope(t){let e=this._pushScope(),r;try{r=t(e)}catch(n){throw this._popScope(),n}return Nr(r)?r.then(n=>(this._popScope(),n),n=>{throw this._popScope(),n}):(this._popScope(),r)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){let t=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:t}),t}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}};function ii(){let t=cn(),e=co(t);return e.stack=e.stack||new kl(ff(),mf())}function gg(t){return ii().withScope(t)}function yg(t,e){let r=ii();return r.withScope(()=>(r.getStackTop().scope=t,e(t)))}function df(t){return ii().withScope(()=>t(ii().getIsolationScope()))}function hf(){return{withIsolationScope:df,withScope:gg,withSetScope:yg,withSetIsolationScope:(t,e)=>df(e),getCurrentScope:()=>ii().getScope(),getIsolationScope:()=>ii().getIsolationScope()}}function Ts(t){let e=co(t);return e.acs?e.acs:hf()}function ln(){let t=cn();return Ts(t).getCurrentScope()}function un(){let t=cn();return Ts(t).getIsolationScope()}function xs(){return ei("globalScope",()=>new pt)}function Cs(...t){let e=cn(),r=Ts(e);if(t.length===2){let[n,i]=t;return n?r.withSetScope(n,i):r.withScope(i)}return r.withScope(t[0])}function ke(){return ln().getClient()}var vg="_sentryMetrics";function gf(t){let e=t[vg];if(!e)return;let r={};for(let[,[n,i]]of e)(r[n]||(r[n]=[])).push(Xe(i));return r}var Ml="sentry.source",Fl="sentry.sample_rate",Hl="sentry.op",$l="sentry.origin",_g=1;function _f(t){let{spanId:e,traceId:r}=t.spanContext(),{parent_span_id:n}=pn(t);return Xe({parent_span_id:n,span_id:e,trace_id:r})}function yf(t){return typeof t=="number"?vf(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?vf(t.getTime()):Ot()}function vf(t){return t>9999999999?t/1e3:t}function pn(t){if(Sg(t))return t.getSpanJSON();try{let{spanId:e,traceId:r}=t.spanContext();if(Eg(t)){let{attributes:n,startTime:i,name:s,endTime:o,parentSpanId:c,status:u}=t;return Xe({span_id:e,trace_id:r,data:n,description:s,parent_span_id:c,start_timestamp:yf(i),timestamp:yf(o)||void 0,status:wg(u),op:n[Hl],origin:n[$l],_metrics_summary:gf(t)})}return{span_id:e,trace_id:r}}catch{return{}}}function Eg(t){let e=t;return!!e.attributes&&!!e.startTime&&!!e.name&&!!e.endTime&&!!e.status}function Sg(t){return typeof t.getSpanJSON=="function"}function Ef(t){let{traceFlags:e}=t.spanContext();return e===_g}function wg(t){if(!(!t||t.code===0))return t.code===1?"ok":t.message||"unknown_error"}var bg="_sentryRootSpan";function uo(t){return t[bg]||t}var Ds="production",Ig="_frozenDsc";function jl(t,e){let r=e.getOptions(),{publicKey:n}=e.getDsn()||{},i=Xe({environment:r.environment||Ds,release:r.release,public_key:n,trace_id:t});return e.emit("createDsc",i),i}function Sf(t){let e=ke();if(!e)return{};let r=jl(pn(t).trace_id||"",e),n=uo(t),i=n[Ig];if(i)return i;let s=n.spanContext().traceState,o=s&&s.get("sentry.dsc"),c=o&&bl(o);if(c)return c;let u=pn(n),d=u.data||{},m=d[Fl];m!=null&&(r.sample_rate=`${m}`);let h=d[Ml],v=u.description;return h!=="url"&&v&&(r.transaction=v),r.sampled=String(Ef(n)),e.emit("createDsc",r,n),r}function wf(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){Ce&&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 Tg(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 bf(t,e,r,n){let i=ws(r),s=w(w({sent_at:new Date().toISOString()},i&&{sdk:i}),!!n&&e&&{dsn:yr(e)}),o="aggregates"in t?[{type:"sessions"},t]:[{type:"session"},t.toJSON()];return Er(s,[o])}function If(t,e,r,n){let i=ws(r),s=t.type&&t.type!=="replay_event"?t.type:"event";Tg(t,r&&r.sdk);let o=Dl(t,i,n,e);return delete t.sdkProcessingMetadata,Er(o,[[{type:s},t]])}function Rs(t,e,r,n=0){return new ir((i,s)=>{let o=t[n];if(e===null||typeof o!="function")i(e);else{let c=o(w({},e),r);Ce&&o.id&&c===null&&q.log(`Event processor "${o.id}" dropped event`),Nr(c)?c.then(u=>Rs(t,u,r,n+1).then(i)).then(null,s):Rs(t,c,r,n+1).then(i).then(null,s)}})}function Tf(t,e){let{fingerprint:r,span:n,breadcrumbs:i,sdkProcessingMetadata:s}=e;xg(t,e),n&&Rg(t,n),Ag(t,r),Cg(t,i),Dg(t,s)}function Wl(t,e){let{extra:r,tags:n,user:i,contexts:s,level:o,sdkProcessingMetadata:c,breadcrumbs:u,fingerprint:d,eventProcessors:m,attachments:h,propagationContext:v,transactionName:_,span:g}=e;po(t,"extra",r),po(t,"tags",n),po(t,"user",i),po(t,"contexts",s),po(t,"sdkProcessingMetadata",c),o&&(t.level=o),_&&(t.transactionName=_),g&&(t.span=g),u.length&&(t.breadcrumbs=[...t.breadcrumbs,...u]),d.length&&(t.fingerprint=[...t.fingerprint,...d]),m.length&&(t.eventProcessors=[...t.eventProcessors,...m]),h.length&&(t.attachments=[...t.attachments,...h]),t.propagationContext=w(w({},t.propagationContext),v)}function po(t,e,r){if(r&&Object.keys(r).length){t[e]=w({},t[e]);for(let n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[e][n]=r[n])}}function xg(t,e){let{extra:r,tags:n,user:i,contexts:s,level:o,transactionName:c}=e,u=Xe(r);u&&Object.keys(u).length&&(t.extra=w(w({},u),t.extra));let d=Xe(n);d&&Object.keys(d).length&&(t.tags=w(w({},d),t.tags));let m=Xe(i);m&&Object.keys(m).length&&(t.user=w(w({},m),t.user));let h=Xe(s);h&&Object.keys(h).length&&(t.contexts=w(w({},h),t.contexts)),o&&(t.level=o),c&&t.type!=="transaction"&&(t.transaction=c)}function Cg(t,e){let r=[...t.breadcrumbs||[],...e];t.breadcrumbs=r.length?r:void 0}function Dg(t,e){t.sdkProcessingMetadata=w(w({},t.sdkProcessingMetadata),e)}function Rg(t,e){t.contexts=w({trace:_f(e)},t.contexts),t.sdkProcessingMetadata=w({dynamicSamplingContext:Sf(e)},t.sdkProcessingMetadata);let r=uo(e),n=pn(r).description;n&&!t.transaction&&t.type==="transaction"&&(t.transaction=n)}function Ag(t,e){t.fingerprint=t.fingerprint?vs(t.fingerprint):[],e&&(t.fingerprint=t.fingerprint.concat(e)),t.fingerprint&&!t.fingerprint.length&&delete t.fingerprint}function Cf(t,e,r,n,i,s){let{normalizeDepth:o=3,normalizeMaxBreadth:c=1e3}=t,u=Z(w({},e),{event_id:e.event_id||r.event_id||tt(),timestamp:e.timestamp||_r()}),d=r.integrations||t.integrations.map(y=>y.name);Ng(u,t),Lg(u,d),i&&i.emit("applyFrameMetadata",e),e.type===void 0&&Og(u,t.stackParser);let m=Ug(n,r.captureContext);r.mechanism&&Or(u,r.mechanism);let h=i?i.getEventProcessors():[],v=xs().getScopeData();if(s){let y=s.getScopeData();Wl(v,y)}if(m){let y=m.getScopeData();Wl(v,y)}let _=[...r.attachments||[],...v.attachments];_.length&&(r.attachments=_),Tf(u,v);let g=[...h,...v.eventProcessors];return Rs(g,u,r).then(y=>(y&&Pg(y),typeof o=="number"&&o>0?Bg(y,o,c):y))}function Ng(t,e){let{environment:r,release:n,dist:i,maxValueLength:s=250}=e;"environment"in t||(t.environment="environment"in e?r:Ds),t.release===void 0&&n!==void 0&&(t.release=n),t.dist===void 0&&i!==void 0&&(t.dist=i),t.message&&(t.message=hr(t.message,s));let o=t.exception&&t.exception.values&&t.exception.values[0];o&&o.value&&(o.value=hr(o.value,s));let c=t.request;c&&c.url&&(c.url=hr(c.url,s))}var xf=new WeakMap;function Og(t,e){let r=ee._sentryDebugIds;if(!r)return;let n,i=xf.get(e);i?n=i:(n=new Map,xf.set(e,n));let s=Object.entries(r).reduce((o,[c,u])=>{let d,m=n.get(c);m?d=m:(d=e(c),n.set(c,d));for(let h=d.length-1;h>=0;h--){let v=d[h];if(v.filename){o[v.filename]=u;break}}return o},{});try{t.exception.values.forEach(o=>{o.stacktrace.frames.forEach(c=>{c.filename&&(c.debug_id=s[c.filename])})})}catch{}}function Pg(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 Lg(t,e){e.length>0&&(t.sdk=t.sdk||{},t.sdk.integrations=[...t.sdk.integrations||[],...e])}function Bg(t,e,r){if(!t)return null;let n=w(w(w(w(w({},t),t.breadcrumbs&&{breadcrumbs:t.breadcrumbs.map(i=>w(w({},i),i.data&&{data:nr(i.data,e,r)}))}),t.user&&{user:nr(t.user,e,r)}),t.contexts&&{contexts:nr(t.contexts,e,r)}),t.extra&&{extra:nr(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=nr(t.contexts.trace.data,e,r))),t.spans&&(n.spans=t.spans.map(i=>w(w({},i),i.data&&{data:nr(i.data,e,r)}))),n}function Ug(t,e){if(!e)return t;let r=t?t.clone():new pt;return r.update(e),r}function Df(t){if(t)return kg(t)?{captureContext:t}:Fg(t)?{captureContext:t}:t}function kg(t){return t instanceof pt||typeof t=="function"}var Mg=["user","level","extra","contexts","tags","fingerprint","requestSession","propagationContext"];function Fg(t){return Object.keys(t).some(e=>Mg.includes(e))}function As(t,e){return ln().captureException(t,Df(e))}function fo(t,e){return ln().captureEvent(t,e)}var Hg="7";function $g(t){let e=t.protocol?`${t.protocol}:`:"",r=t.port?`:${t.port}`:"";return`${e}//${t.host}${r}${t.path?`/${t.path}`:""}/api/`}function jg(t){return`${$g(t)}${t.projectId}/envelope/`}function Wg(t,e){return cl(w({sentry_key:t.publicKey,sentry_version:Hg},e&&{sentry_client:`${e.name}/${e.version}`}))}function Af(t,e,r){return e||`${jg(t)}?${Wg(t,r)}`}var Nf=[];function Of(t,e){let r={};return e.forEach(n=>{n&&Vl(t,n,r)}),r}function Gl(t,e){for(let r of e)r&&r.afterAllSetup&&r.afterAllSetup(t)}function Vl(t,e,r){if(r[e.name]){Ce&&q.log(`Integration skipped because it was already installed: ${e.name}`);return}if(r[e.name]=e,Nf.indexOf(e.name)===-1&&typeof e.setupOnce=="function"&&(e.setupOnce(),Nf.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,s)=>n(i,s,t))}if(typeof e.processEvent=="function"){let n=e.processEvent.bind(e),i=Object.assign((s,o)=>n(s,o,t),{id:e.name});t.addEventProcessor(i)}Ce&&q.log(`Integration installed: ${e.name}`)}var Pf="Not capturing exception because it's already been captured.",mo=class{constructor(t){if(this._options=t,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],t.dsn?this._dsn=ls(t.dsn):Ce&&q.warn("No DSN provided, client will not send events."),this._dsn){let e=Af(this._dsn,t.tunnel,t._metadata?t._metadata.sdk:void 0);this._transport=t.transport(Z(w({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this)},t.transportOptions),{url:e}))}}captureException(t,e,r){let n=tt();if(ys(t))return Ce&&q.log(Pf),n;let i=w({event_id:n},e);return this._process(this.eventFromException(t,i).then(s=>this._captureEvent(s,i,r))),i.event_id}captureMessage(t,e,r,n){let i=w({event_id:tt()},r),s=Qn(t)?t:String(t),o=on(t)?this.eventFromMessage(s,e,i):this.eventFromException(t,i);return this._process(o.then(c=>this._captureEvent(c,i,n))),i.event_id}captureEvent(t,e,r){let n=tt();if(e&&e.originalException&&ys(e.originalException))return Ce&&q.log(Pf),n;let i=w({event_id:n},e),s=(t.sdkProcessingMetadata||{}).capturedSpanScope;return this._process(this._captureEvent(t,i,s||r)),i.event_id}captureSession(t){typeof t.release!="string"?Ce&&q.warn("Discarded session because of missing or non-string release"):(this.sendSession(t),lo(t,{init:!1}))}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}flush(t){let e=this._transport;return e?(this.emit("flush"),this._isClientDoneProcessing(t).then(r=>e.flush(t).then(n=>r&&n))):Wt(!0)}close(t){return this.flush(t).then(e=>(this.getOptions().enabled=!1,this.emit("close"),e))}getEventProcessors(){return this._eventProcessors}addEventProcessor(t){this._eventProcessors.push(t)}init(){this._isEnabled()&&this._setupIntegrations()}getIntegrationByName(t){return this._integrations[t]}addIntegration(t){let e=this._integrations[t.name];Vl(this,t,this._integrations),e||Gl(this,[t])}sendEvent(t,e={}){this.emit("beforeSendEvent",t,e);let r=If(t,this._dsn,this._options._metadata,this._options.tunnel);for(let i of e.attachments||[])r=Tl(r,Cl(i));let n=this.sendEnvelope(r);n&&n.then(i=>this.emit("afterSendEvent",t,i),null)}sendSession(t){let e=bf(t,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(e)}recordDroppedEvent(t,e,r){if(this._options.sendClientReports){let n=`${t}:${e}`;Ce&&q.log(`Adding outcome: "${n}"`),this._outcomes[n]=(this._outcomes[n]||0)+1}}on(t,e){let r=this._hooks[t]=this._hooks[t]||[];return r.push(e),()=>{let n=r.indexOf(e);n>-1&&r.splice(n,1)}}emit(t,...e){let r=this._hooks[t];r&&r.forEach(n=>n(...e))}sendEnvelope(t){return this.emit("beforeEnvelope",t),this._isEnabled()&&this._transport?this._transport.send(t).then(null,e=>(Ce&&q.error("Error while sending event:",e),e)):(Ce&&q.error("Transport disabled"),Wt({}))}_setupIntegrations(){let{integrations:t}=this._options;this._integrations=Of(this,t),Gl(this,t)}_updateSessionFromEvent(t,e){let r=!1,n=!1,i=e.exception&&e.exception.values;if(i){n=!0;for(let o of i){let c=o.mechanism;if(c&&c.handled===!1){r=!0;break}}}let s=t.status==="ok";(s&&t.errors===0||s&&r)&&(lo(t,Z(w({},r&&{status:"crashed"}),{errors:t.errors||Number(n||r)})),this.captureSession(t))}_isClientDoneProcessing(t){return new ir(e=>{let r=0,n=1,i=setInterval(()=>{this._numProcessing==0?(clearInterval(i),e(!0)):(r+=n,t&&r>=t&&(clearInterval(i),e(!1)))},n)})}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(t,e,r,n=un()){let i=this.getOptions(),s=Object.keys(this._integrations);return!e.integrations&&s.length>0&&(e.integrations=s),this.emit("preprocessEvent",t,e),t.type||n.setLastEventId(t.event_id||e.event_id),Cf(i,t,e,r,this,n).then(o=>{if(o===null)return o;let c=w(w({},n.getPropagationContext()),r?r.getPropagationContext():void 0);if(!(o.contexts&&o.contexts.trace)&&c){let{traceId:u,spanId:d,parentSpanId:m,dsc:h}=c;o.contexts=w({trace:Xe({trace_id:u,span_id:d,parent_span_id:m})},o.contexts);let v=h||jl(u,this);o.sdkProcessingMetadata=w({dynamicSamplingContext:v},o.sdkProcessingMetadata)}return o})}_captureEvent(t,e={},r){return this._processEvent(t,e,r).then(n=>n.event_id,n=>{if(Ce){let i=n;i.logLevel==="log"?q.log(i.message):q.warn(i)}})}_processEvent(t,e,r){let n=this.getOptions(),{sampleRate:i}=n,s=zl(t),o=Lf(t),c=t.type||"error",u=`before send for type \`${c}\``,d=typeof i>"u"?void 0:wf(i);if(o&&typeof d=="number"&&Math.random()>d)return this.recordDroppedEvent("sample_rate","error",t),zr(new ut(`Discarding event because it's not included in the random sample (sampling rate = ${i})`,"log"));let m=c==="replay_event"?"replay":c,h=(t.sdkProcessingMetadata||{}).capturedSpanIsolationScope;return this._prepareEvent(t,e,r,h).then(v=>{if(v===null)throw this.recordDroppedEvent("event_processor",m,t),new ut("An event processor returned `null`, will not send event.","log");if(e.data&&e.data.__sentry__===!0)return v;let _=Vg(this,n,v,e);return Gg(_,u)}).then(v=>{if(v===null){if(this.recordDroppedEvent("before_send",m,t),zl(t)){let y=1+(t.spans||[]).length;this._outcomes.span=(this._outcomes.span||0)+y}throw new ut(`${u} returned \`null\`, will not send event.`,"log")}let _=r&&r.getSession();!s&&_&&this._updateSessionFromEvent(_,v);let g=v.transaction_info;if(s&&g&&v.transaction!==t.transaction){let y="custom";v.transaction_info=Z(w({},g),{source:y})}return this.sendEvent(v,e),v}).then(null,v=>{throw v instanceof ut?v:(this.captureException(v,{data:{__sentry__:!0},originalException:v}),new ut(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
|
|
26
|
-
Reason: ${
|
|
27
|
-
Event: ${
|
|
28
|
-
Event: ${
|
|
29
|
-
Event: ${
|
|
30
|
-
Event: ${
|
|
31
|
-
Event: ${
|
|
32
|
-
Url: ${
|
|
33
|
-
Event: ${
|
|
34
|
-
Url: ${Ps(t)}`),!0)}function ty(t,e){return t.type||!e||!e.length?!1:oy(t).some(r=>Zn(r,e))}function ry(t,e){if(t.type!=="transaction"||!e||!e.length)return!1;let r=t.transaction;return r?Zn(r,e):!1}function ny(t,e){if(!e||!e.length)return!1;let r=Ps(t);return r?Zn(r,e):!1}function iy(t,e){if(!e||!e.length)return!0;let r=Ps(t);return r?Zn(r,e):!0}function oy(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 sy(t){try{return t.exception.values[0].type==="SentryError"}catch{}return!1}function ay(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 Ps(t){try{let e;try{e=t.exception.values[0].stacktrace.frames}catch{}return e?ay(e):null}catch{return Ce&&q.error(`Cannot extract url for event ${rr(t)}`),null}}function cy(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 ly="Dedupe",uy=()=>{let t;return{name:ly,processEvent(e){if(e.type)return e;try{if(py(e,t))return Ce&&q.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return t=e}}},Bs=uy;function py(t,e){return e?!!(fy(t,e)||my(t,e)):!1}function fy(t,e){let r=t.message,n=e.message;return!(!r&&!n||r&&!n||!r&&n||r!==n||!Hf(t,e)||!Ff(t,e))}function my(t,e){let r=Mf(e),n=Mf(t);return!(!r||!n||r.type!==n.type||r.value!==n.value||!Hf(t,e)||!Ff(t,e))}function Ff(t,e){let r=ms(t),n=ms(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 s=n[i],o=r[i];if(s.filename!==o.filename||s.lineno!==o.lineno||s.colno!==o.colno||s.function!==o.function)return!1}return!0}function Hf(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 Mf(t){return t.exception&&t.exception.values&&t.exception.values[0]}var Ge=ee,ql=0;function Kl(){return ql>0}function xy(){ql++,setTimeout(()=>{ql--})}function fn(t,e={},r){if(typeof t!="function")return t;try{let i=t.__sentry_wrapped__;if(i)return i;if(an(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 s=i.map(o=>fn(o,e));return t.apply(this,s)}catch(s){throw xy(),Cs(o=>{o.addEventProcessor(c=>(e.mechanism&&(ni(c,void 0,void 0),Or(c,e.mechanism)),c.extra=Z(w({},c.extra),{arguments:i}),c)),As(s)}),s}};try{for(let i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i])}catch{}us(n,t),Et(t,"__sentry_wrapped__",n);try{Object.getOwnPropertyDescriptor(n,"name").configurable&&Object.defineProperty(n,"name",{get(){return t.name}})}catch{}return n}var Lr=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function Us(t,e){let r=Ql(t,e),n={type:e&&e.name,value:Ny(e)};return r.length&&(n.stacktrace={frames:r}),n.type===void 0&&n.value===""&&(n.value="Unrecoverable error caught"),n}function Cy(t,e,r,n){let i=ke(),s=i&&i.getOptions().normalizeDepth,o=Ly(e),c={__serialized__:_s(e,s)};if(o)return{exception:{values:[Us(t,o)]},extra:c};let u={exception:{values:[{type:sn(e)?e.constructor.name:n?"UnhandledRejection":"Error",value:Oy(e,{isUnhandledRejection:n})}]},extra:c};if(r){let d=Ql(t,r);d.length&&(u.exception.values[0].stacktrace={frames:d})}return u}function Jl(t,e){return{exception:{values:[Us(t,e)]}}}function Ql(t,e){let r=e.stacktrace||e.stack||"",n=Ry(e),i=Ay(e);try{return t(r,n,i)}catch{}return[]}var Dy=/Minified React error #\d+;/i;function Ry(t){return t&&Dy.test(t.message)?1:0}function Ay(t){return typeof t.framesToPop=="number"?t.framesToPop:0}function Ny(t){let e=t&&t.message;return e?e.error&&typeof e.error.message=="string"?e.error.message:e:"No error message"}function Gf(t,e,r,n){let i=r&&r.syntheticException||void 0,s=ks(t,e,i,n);return Or(s),s.level="error",r&&r.event_id&&(s.event_id=r.event_id),Wt(s)}function Vf(t,e,r="info",n,i){let s=n&&n.syntheticException||void 0,o=Xl(t,e,s,i);return o.level=r,n&&n.event_id&&(o.event_id=n.event_id),Wt(o)}function ks(t,e,r,n,i){let s;if(ss(e)&&e.error)return Jl(t,e.error);if(as(e)||Qc(e)){let o=e;if("stack"in e)s=Jl(t,e);else{let c=o.name||(as(o)?"DOMError":"DOMException"),u=o.message?`${c}: ${o.message}`:c;s=Xl(t,u,r,n),ni(s,u)}return"code"in o&&(s.tags=Z(w({},s.tags),{"DOMException.code":`${o.code}`})),s}return nn(e)?Jl(t,e):tr(e)||sn(e)?(s=Cy(t,e,r,i),Or(s,{synthetic:!0}),s):(s=Xl(t,e,r,n),ni(s,`${e}`,void 0),Or(s,{synthetic:!0}),s)}function Xl(t,e,r,n){let i={};if(n&&r){let s=Ql(t,r);s.length&&(i.exception={values:[{value:e,stacktrace:{frames:s}}]})}if(Qn(e)){let{__sentry_template_string__:s,__sentry_template_values__:o}=e;return i.logentry={message:s,params:o},i}return i.message=e,i}function Oy(t,{isUnhandledRejection:e}){let r=ll(t),n=e?"promise rejection":"exception";return ss(t)?`Event \`ErrorEvent\` captured as ${n} with message \`${t.message}\``:sn(t)?`Event \`${Py(t)}\` (type=${t.type}) captured as ${n}`:`Object captured as ${n} with keys: ${r}`}function Py(t){try{let e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch{}}function Ly(t){for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)){let r=t[e];if(r instanceof Error)return r}}function zf(t,{metadata:e,tunnel:r,dsn:n}){let i=w(w({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:yr(n)}),s=By(t);return Er(i,[s])}function By(t){return[{type:"user_report"},t]}var ho=class extends mo{constructor(t){let e=w({parentSpanIsAlwaysRootSpan:!0},t),r=Ge.SENTRY_SDK_SOURCE||_l();Yl(e,"browser",["browser"],r),super(e),e.sendClientReports&&Ge.document&&Ge.document.addEventListener("visibilitychange",()=>{Ge.document.visibilityState==="hidden"&&this._flushOutcomes()})}eventFromException(t,e){return Gf(this._options.stackParser,t,e,this._options.attachStacktrace)}eventFromMessage(t,e="info",r){return Vf(this._options.stackParser,t,e,r,this._options.attachStacktrace)}captureUserFeedback(t){if(!this._isEnabled()){Lr&&q.warn("SDK not enabled, will not capture user feedback.");return}let e=zf(t,{metadata:this.getSdkMetadata(),dsn:this.getDsn(),tunnel:this.getOptions().tunnel});this.sendEnvelope(e)}_prepareEvent(t,e,r){return t.platform=t.platform||"javascript",super._prepareEvent(t,e,r)}_flushOutcomes(){let t=this._clearOutcomes();if(t.length===0){Lr&&q.log("No outcomes to send");return}if(!this._dsn){Lr&&q.log("No dsn provided, will not send outcomes");return}Lr&&q.log("Sending outcomes:",t);let e=Rl(t,this._options.tunnel&&yr(this._dsn));this.sendEnvelope(e)}},Yf=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,Ye=ee,Uy=1e3,qf,Zl,eu;function tu(t){let e="dom";St(e,t),wt(e,ky)}function ky(){if(!Ye.document)return;let t=Qe.bind(null,"dom"),e=Kf(t,!0);Ye.document.addEventListener("click",e,!1),Ye.document.addEventListener("keypress",e,!1),["EventTarget","Node"].forEach(r=>{let n=Ye[r]&&Ye[r].prototype;!n||!n.hasOwnProperty||!n.hasOwnProperty("addEventListener")||(Le(n,"addEventListener",function(i){return function(s,o,c){if(s==="click"||s=="keypress")try{let u=this,d=u.__sentry_instrumentation_handlers__=u.__sentry_instrumentation_handlers__||{},m=d[s]=d[s]||{refCount:0};if(!m.handler){let h=Kf(t);m.handler=h,i.call(this,s,h,c)}m.refCount++}catch{}return i.call(this,s,o,c)}}),Le(n,"removeEventListener",function(i){return function(s,o,c){if(s==="click"||s=="keypress")try{let u=this,d=u.__sentry_instrumentation_handlers__||{},m=d[s];m&&(m.refCount--,m.refCount<=0&&(i.call(this,s,m.handler,c),m.handler=void 0,delete d[s]),Object.keys(d).length===0&&delete u.__sentry_instrumentation_handlers__)}catch{}return i.call(this,s,o,c)}}))})}function My(t){if(t.type!==Zl)return!1;try{if(!t.target||t.target._sentryId!==eu)return!1}catch{}return!0}function Fy(t,e){return t!=="keypress"?!1:!e||!e.tagName?!0:!(e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable)}function Kf(t,e=!1){return r=>{if(!r||r._sentryCaptured)return;let n=Hy(r);if(Fy(r.type,n))return;Et(r,"_sentryCaptured",!0),n&&!n._sentryId&&Et(n,"_sentryId",tt());let i=r.type==="keypress"?"input":r.type;My(r)||(t({event:r,name:i,global:e}),Zl=r.type,eu=n?n._sentryId:void 0),clearTimeout(qf),qf=Ye.setTimeout(()=>{eu=void 0,Zl=void 0},Uy)}}function Hy(t){try{return t.target}catch{return null}}var Ms;function ru(t){let e="history";St(e,t),wt(e,$y)}function $y(){if(!Ol())return;let t=Ye.onpopstate;Ye.onpopstate=function(...r){let n=Ye.location.href,i=Ms;if(Ms=n,Qe("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 s=Ms,o=String(i);Ms=o,Qe("history",{from:s,to:o})}return r.apply(this,n)}}Le(Ye.history,"pushState",e),Le(Ye.history,"replaceState",e)}var Fs={};function nu(t){let e=Fs[t];if(e)return e;let r=Ye[t];if(oo(r))return Fs[t]=r.bind(Ye);let n=Ye.document;if(n&&typeof n.createElement=="function")try{let i=n.createElement("iframe");i.hidden=!0,n.head.appendChild(i);let s=i.contentWindow;s&&s[t]&&(r=s[t]),n.head.removeChild(i)}catch(i){Yf&&q.warn(`Could not create sandbox iframe for ${t} check, bailing to window.${t}: `,i)}return r&&(Fs[t]=r.bind(Ye))}function Hs(t){Fs[t]=void 0}var mn="__sentry_xhr_v3__";function iu(t){let e="xhr";St(e,t),wt(e,jy)}function jy(){if(!Ye.XMLHttpRequest)return;let t=XMLHttpRequest.prototype;Le(t,"open",function(e){return function(...r){let n=Ot()*1e3,i=_t(r[0])?r[0].toUpperCase():void 0,s=Wy(r[1]);if(!i||!s)return e.apply(this,r);this[mn]={method:i,url:s,request_headers:{}},i==="POST"&&s.match(/sentry_key/)&&(this.__sentry_own_request__=!0);let o=()=>{let c=this[mn];if(c&&this.readyState===4){try{c.status_code=this.status}catch{}let u={endTimestamp:Ot()*1e3,startTimestamp:n,xhr:this};Qe("xhr",u)}};return"onreadystatechange"in this&&typeof this.onreadystatechange=="function"?Le(this,"onreadystatechange",function(c){return function(...u){return o(),c.apply(this,u)}}):this.addEventListener("readystatechange",o),Le(this,"setRequestHeader",function(c){return function(...u){let[d,m]=u,h=this[mn];return h&&_t(d)&&_t(m)&&(h.request_headers[d.toLowerCase()]=m),c.apply(this,u)}}),e.apply(this,r)}}),Le(t,"send",function(e){return function(...r){let n=this[mn];if(!n)return e.apply(this,r);r[0]!==void 0&&(n.body=r[0]);let i={startTimestamp:Ot()*1e3,xhr:this};return Qe("xhr",i),e.apply(this,r)}})}function Wy(t){if(_t(t))return t;try{return t.toString()}catch{}}function ou(t,e=nu("fetch")){let r=0,n=0;function i(s){let o=s.body.length;r+=o,n++;let c=w({body:s.body,method:"POST",referrerPolicy:"origin",headers:t.headers,keepalive:r<=6e4&&n<15},t.fetchOptions);if(!e)return Hs("fetch"),zr("No fetch implementation available");try{return e(t.url,c).then(u=>(r-=o,n--,{statusCode:u.status,headers:{"x-sentry-rate-limits":u.headers.get("X-Sentry-Rate-Limits"),"retry-after":u.headers.get("Retry-After")}}))}catch(u){return Hs("fetch"),r-=o,n--,zr(u)}}return Ns(t,i)}var Gy=30,Vy=50;function su(t,e,r,n){let i={filename:t,function:e==="<anonymous>"?vr:e,in_app:!0};return r!==void 0&&(i.lineno=r),n!==void 0&&(i.colno=n),i}var zy=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Yy=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,qy=/\((\S*)(?::(\d+))(?::(\d+))\)/,Ky=t=>{let e=zy.exec(t);if(e){let[,n,i,s]=e;return su(n,vr,+i,+s)}let r=Yy.exec(t);if(r){if(r[2]&&r[2].indexOf("eval")===0){let s=qy.exec(r[2]);s&&(r[2]=s[1],r[3]=s[2],r[4]=s[3])}let[n,i]=Zf(r[1]||vr,r[2]);return su(i,n,r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},Jf=[Gy,Ky],Jy=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Xy=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Qy=t=>{let e=Jy.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){let i=Xy.exec(e[3]);i&&(e[1]=e[1]||"eval",e[3]=i[1],e[4]=i[2],e[5]="")}let r=e[3],n=e[1]||vr;return[n,r]=Zf(n,r),su(r,n,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},Xf=[Vy,Qy],Qf=[Jf,Xf],au=pl(...Qf),Zf=(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]:vr,r?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]},$s=1024,ev="Breadcrumbs",tv=(t={})=>{let e=w({console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0},t);return{name:ev,setup(r){e.console&&fl(iv(r)),e.dom&&tu(nv(r,e.dom)),e.xhr&&iu(ov(r)),e.fetch&&gl(sv(r)),e.history&&ru(av(r)),e.sentry&&r.on("beforeSendEvent",rv(r))}}},em=tv;function rv(t){return function(e){ke()===t&&Sr({category:`sentry.${e.type==="transaction"?"transaction":"event"}`,event_id:e.event_id,level:e.level,message:rr(e)},{event:e})}}function nv(t,e){return function(r){if(ke()!==t)return;let n,i,s=typeof e=="object"?e.serializeAttribute:void 0,o=typeof e=="object"&&typeof e.maxStringLength=="number"?e.maxStringLength:void 0;o&&o>$s&&(Lr&&q.warn(`\`dom.maxStringLength\` cannot exceed ${$s}, but a value of ${o} was configured. Sentry will use ${$s} instead.`),o=$s),typeof s=="string"&&(s=[s]);try{let u=r.event,d=cv(u)?u.target:u;n=no(d,{keyAttrs:s,maxStringLength:o}),i=sl(d)}catch{n="<unknown>"}if(n.length===0)return;let c={category:`ui.${r.name}`,message:n};i&&(c.data={"ui.component_name":i}),Sr(c,{event:r.event,name:r.name,global:r.global})}}function iv(t){return function(e){if(ke()!==t)return;let r={category:"console",data:{arguments:e.args,logger:"console"},level:wl(e.level),message:cs(e.args," ")};if(e.level==="assert")if(e.args[0]===!1)r.message=`Assertion failed: ${cs(e.args.slice(1)," ")||"console.assert"}`,r.data.arguments=e.args.slice(1);else return;Sr(r,{input:e.args,level:e.level})}}function ov(t){return function(e){if(ke()!==t)return;let{startTimestamp:r,endTimestamp:n}=e,i=e.xhr[mn];if(!r||!n||!i)return;let{method:s,url:o,status_code:c,body:u}=i,d={method:s,url:o,status_code:c},m={xhr:e.xhr,input:u,startTimestamp:r,endTimestamp:n};Sr({category:"xhr",data:d,type:"http"},m)}}function sv(t){return function(e){if(ke()!==t)return;let{startTimestamp:r,endTimestamp:n}=e;if(n&&!(e.fetchData.url.match(/sentry_key/)&&e.fetchData.method==="POST"))if(e.error){let i=e.fetchData,s={data:e.error,input:e.args,startTimestamp:r,endTimestamp:n};Sr({category:"fetch",data:i,level:"error",type:"http"},s)}else{let i=e.response,s=Z(w({},e.fetchData),{status_code:i&&i.status}),o={input:e.args,response:i,startTimestamp:r,endTimestamp:n};Sr({category:"fetch",data:s,type:"http"},o)}}}function av(t){return function(e){if(ke()!==t)return;let r=e.from,n=e.to,i=ao(Ge.location.href),s=r?ao(r):void 0,o=ao(n);(!s||!s.path)&&(s=i),i.protocol===o.protocol&&i.host===o.host&&(n=o.relative),i.protocol===s.protocol&&i.host===s.host&&(r=s.relative),Sr({category:"navigation",data:{from:r,to:n}})}}function cv(t){return!!t&&!!t.target}var lv=["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"],uv="BrowserApiErrors",pv=(t={})=>{let e=w({XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0},t);return{name:uv,setupOnce(){e.setTimeout&&Le(Ge,"setTimeout",tm),e.setInterval&&Le(Ge,"setInterval",tm),e.requestAnimationFrame&&Le(Ge,"requestAnimationFrame",fv),e.XMLHttpRequest&&"XMLHttpRequest"in Ge&&Le(XMLHttpRequest.prototype,"send",mv);let r=e.eventTarget;r&&(Array.isArray(r)?r:lv).forEach(dv)}}},rm=pv;function tm(t){return function(...e){let r=e[0];return e[0]=fn(r,{mechanism:{data:{function:jt(t)},handled:!1,type:"instrument"}}),t.apply(this,e)}}function fv(t){return function(e){return t.apply(this,[fn(e,{mechanism:{data:{function:"requestAnimationFrame",handler:jt(t)},handled:!1,type:"instrument"}})])}}function mv(t){return function(...e){let r=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(n=>{n in r&&typeof r[n]=="function"&&Le(r,n,function(i){let s={mechanism:{data:{function:n,handler:jt(i)},handled:!1,type:"instrument"}},o=an(i);return o&&(s.mechanism.data.handler=jt(o)),fn(i,s)})}),t.apply(this,e)}}function dv(t){let e=Ge,r=e[t]&&e[t].prototype;!r||!r.hasOwnProperty||!r.hasOwnProperty("addEventListener")||(Le(r,"addEventListener",function(n){return function(i,s,o){try{typeof s.handleEvent=="function"&&(s.handleEvent=fn(s.handleEvent,{mechanism:{data:{function:"handleEvent",handler:jt(s),target:t},handled:!1,type:"instrument"}}))}catch{}return n.apply(this,[i,fn(s,{mechanism:{data:{function:"addEventListener",handler:jt(s),target:t},handled:!1,type:"instrument"}}),o])}}),Le(r,"removeEventListener",function(n){return function(i,s,o){let c=s;try{let u=c&&c.__sentry_wrapped__;u&&n.call(this,i,u,o)}catch{}return n.call(this,i,c,o)}}))}var hv="GlobalHandlers",gv=(t={})=>{let e=w({onerror:!0,onunhandledrejection:!0},t);return{name:hv,setupOnce(){Error.stackTraceLimit=50},setup(r){e.onerror&&(yv(r),nm("onerror")),e.onunhandledrejection&&(vv(r),nm("onunhandledrejection"))}}},im=gv;function yv(t){yl(e=>{let{stackParser:r,attachStacktrace:n}=om();if(ke()!==t||Kl())return;let{msg:i,url:s,line:o,column:c,error:u}=e,d=Sv(ks(r,u||i,void 0,n,!1),s,o,c);d.level="error",fo(d,{originalException:u,mechanism:{handled:!1,type:"onerror"}})})}function vv(t){vl(e=>{let{stackParser:r,attachStacktrace:n}=om();if(ke()!==t||Kl())return;let i=_v(e),s=on(i)?Ev(i):ks(r,i,void 0,n,!0);s.level="error",fo(s,{originalException:i,mechanism:{handled:!1,type:"onunhandledrejection"}})})}function _v(t){if(on(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 Ev(t){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(t)}`}]}}}function Sv(t,e,r,n){let i=t.exception=t.exception||{},s=i.values=i.values||[],o=s[0]=s[0]||{},c=o.stacktrace=o.stacktrace||{},u=c.frames=c.frames||[],d=isNaN(parseInt(n,10))?void 0:n,m=isNaN(parseInt(r,10))?void 0:r,h=_t(e)&&e.length>0?e:ol();return u.length===0&&u.push({colno:d,filename:h,function:vr,in_app:!0,lineno:m}),t}function nm(t){Lr&&q.log(`Global Handler attached: ${t}`)}function om(){let t=ke();return t&&t.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}var sm=()=>({name:"HttpContext",preprocessEvent(t){if(!Ge.navigator&&!Ge.location&&!Ge.document)return;let e=t.request&&t.request.url||Ge.location&&Ge.location.href,{referrer:r}=Ge.document||{},{userAgent:n}=Ge.navigator||{},i=w(w(w({},t.request&&t.request.headers),r&&{Referer:r}),n&&{"User-Agent":n}),s=Z(w(w({},t.request),e&&{url:e}),{headers:i});t.request=s}}),wv="cause",bv=5,Iv="LinkedErrors",Tv=(t={})=>{let e=t.limit||bv,r=t.key||wv;return{name:Iv,preprocessEvent(n,i,s){let o=s.getOptions();nl(Us,o.stackParser,o.maxValueLength,r,e,n,i)}}},am=Tv;function cu(t){return[Ls(),Os(),rm(),em(),im(),am(),Bs(),sm()]}var lu=class extends Error{cause;constructor(t,e){super(t),this.cause=e}},Pe=class bd{static INSTANCE;contexts={};tags;client;user;constructor(){this.init()}static getInstance(){return this.INSTANCE||(this.INSTANCE=new bd),this.INSTANCE}captureException(e,r,n){b.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){b.error(e,r);let s=this.getNewScope(n,i),o=new lu(e,r);s.captureException(o)}setGlobalContext(e,r){this.contexts[e]=w({context:r},this.contexts[e])}setUser(e){this.user=e}setTags(e){this.tags=e}getNewScope(e,r){let n=new pt;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",ne.getTimezone()),n}init(){let e=cu({}).filter(r=>!["BrowserApiErrors","Breadcrumbs","GlobalHandlers"].includes(r.name));this.client=new ho({dsn:"https://1bc3dda4c861f60cd6be1b67584f4bc6@o559187.ingest.us.sentry.io/4507626484203520",transport:ou,stackParser:au,integrations:e,environment:er.mode,release:`web-sdk@${N.SDK_VERSION}`,debug:er.debug}),this.client.init()}},ne=class{static tz;static isValidURL(t){try{return new URL(t)}catch{return}}static isNull(t){return!t||t==="null"||t==="undefined"}static removeFromArray(t,e){let r=t.indexOf(e);return r===-1?!1:(t.splice(r,1),!0)}static formatCurrency(t,e){if(t==0&&e)return"Free";let r=le.get(),n=Oe.get(),i=r.shopCurrencyCode||n.currency,s=r.currencyCode;s||b.warn("Currency code is not set in RuntimeData");let o=n.money?.format??r.moneyFormat,c;if(o&&i===s)c=os.format(t*100,o);else{let u;try{u=new Intl.NumberFormat(this.getLang(),{style:"currency",currency:s||i,minimumFractionDigits:0,maximumFractionDigits:2})}catch(d){return Pe.getInstance().captureException(d,{currentCurrency:s,shopCurrency:i}),""}c=u.format(t),c=c.replace("\u20B9","Rs. "),n.money?.showCurrency&&s!=="INR"&&(c=c.concat(` ${s}`))}return c}static formatNumber(t){return new Intl.NumberFormat(this.getLang(),{notation:"compact"}).format(t)}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(t){document.readyState!=="loading"?t():document.addEventListener("DOMContentLoaded",t)}static onDocumentLoaded(t){document.readyState==="complete"?t():document.addEventListener("readystatechange",()=>{document.readyState==="complete"&&t()})}static showSnackbar(t){let e=document.createElement("span");e.id="snackbar",e.innerText=t,document.body.appendChild(e),e.className="show",setTimeout(()=>{e.classList.remove("show"),document.body.removeChild(e)},3e3)}static async retrySelectorForElements(t,e=10,r=document){let n=0,i=document.querySelectorAll("nonexistent-tag");for(;n<e;){let s=Math.min(100*2**n,5e3);if(await Ht.sleep(s),i=r.querySelectorAll(t),i.length)return b.debug(`Attempt ${n+1}: ${i.length} elements found with ${t}`),i;b.debug(`Attempt ${n+1}: Elements not found with ${t}. Retrying after ${s}ms.`),n++}return b.warn(`Max attempts reached. Element not found with ${t}.`),i}static async retrySelector(t,e=10,r=document){return(await this.retrySelectorForElements(t,e,r)).item(0)}static async getCartAttributes(){let t=await Ae.get(ie.DEVICE_ID),e=await et.get(ie.ID,"");return[{key:"letscooee_did",value:t},{key:"letscooee_sid",value:e},{key:"__letscooee_time",value:new Date().toLocaleString()},{key:"__letscooee_via",value:"Buy Now"}]}};function oi(t,e,r){Object.defineProperty(t,e,{enumerable:!1,configurable:!1,writable:!1,value:r})}var js=class{url;alt;constructor(t){t.alt&&(this.alt=t.alt),this.url=t.url}},Ws=class{d;cmp;effective;constructor(t={}){this.d=t.d,this.cmp=t.cmp,this.effective=this.d}},uu=class{id;mID;name;groupID;groupName;isSelected;constructor(t){t??={},this.id=t.id,this.mID=t.mID,this.name=t.name,this.groupID=t.groupID,this.groupName=t.groupName,this.isSelected=t.isSelected??!1}},wr=class{mID;name;imgs;link;price;sku;isAvailable;quantity;sellingPlans;selectedSellingPlan;effectivePrice;constructor(t){t=t??{},this.mID=t.mID,this.name=t.name,this.imgs=t.imgs?.map(e=>new js(e))??[],this.link=t.link,this.price=new Ws(t.price),this.sku=t.sku,this.isAvailable=t.isAvailable,this.quantity=t.quantity,this.effectivePrice=Mt(this.price.effective),t.sellingPlans?.length&&(this.selectedSellingPlan=Mt(void 0)),this.sellingPlans=t.sellingPlans?.map(e=>{let r=new uu(e);return r.isSelected&&(this.selectedSellingPlan.value=r),r})}getOneImage(){return this.imgs[0]?.url}changeSellingPlan(t){this.selectedSellingPlan.value=t}},xt=class{id;mID;name;status;ctg;imgs;videos;portraitVideos;vars;desc;sDesc;link;slug;quantity;category;meta;reviews;selectedOrFirstVariant;selected=Mt(!0);constructor(t){this.update(t),this.selectedOrFirstVariant=Mt(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(t=>t.isAvailable)??this.vars[0]}set variants(t){this.vars=t,this.selectedOrFirstVariant.value=this.selectedVariant}update(t){return this.id=t.id,this.mID=t.mID,this.name=t.name,this.status=t.status,this.ctg=t.ctg,this.imgs=t.imgs,this.desc=t.desc,this.sDesc=t.sDesc,this.link=t.link,this.slug=t.slug,this.quantity=t.quantity,this.meta=t.meta,this.category=t.category,this.videos=t.videos,this.reviews=t.reviews,this.portraitVideos=t.videos?.filter(e=>e.orientation==="PORTRAIT"),t.vars&&(this.vars=t.vars.map(e=>new wr(e))),this}toEmbed(t){return t=t??this.selectedOrFirstVariant.value,new lt({id:this.id,mID:this.mID,vID:t.mID,vName:t.name,name:this.name,link:this.link,slug:this.slug,price:t.price.d,imageURL:t.getOneImage()??this.imgs?.[0].url})}},Gs=class{id;mID;handle;title;imageURL;constructor(t){t??={},this.id=t.id,this.mID=t.mID,this.handle=t.handle,this.title=t.title,this.imageURL=t.imageURL}},pu=class{enabled;constructor(t){this.enabled=t.enabled}},fu=class extends pu{max;min;constructor(t){t??={},super(t),this.min=t.min,this.max=t.max}},Vs=class{productQuantity;constructor(t){t??={},this.productQuantity=new fu(t.productQuantity)}},dn=class{s;g;i;constructor(t){t.s&&(this.s=new Me(t.s)),t.g&&(this.g=new go(t.g)),this.i=t.i}get solid(){return this.s}get glossy(){return this.g}get img(){return this.i}},yo="a-f\\d",xv=`#?[${yo}]{3}[${yo}]?`,Cv=`#?[${yo}]{6}([${yo}]{2})?`,Dv=new RegExp(`[^#${yo}]`,"gi"),Rv=new RegExp(`^${xv}$|^${Cv}$`,"i");function mu(t,e={}){if(typeof t!="string"||Dv.test(t)||!Rv.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,s=n>>8&255,o=n&255,c=typeof e.alpha=="number"?e.alpha:r;if(e.format==="array")return[i,s,o,c];if(e.format==="css"){let u=c===1?"":` / ${Number((c*100).toFixed(2))}%`;return`rgb(${i} ${s} ${o}${u})`}return{red:i,green:s,blue:o,alpha:c}}var Me=class{h;a=100;g;constructor(t){t??={},this.h=t.h,this.a=t.a,this.g=t.g}get hex(){return this.h}get grad(){return this.g}get rgba(){if(!this.hex)return"";try{return mu(this.hex,{format:"css",alpha:this.getAlpha()})}catch(t){return console.error("Invalid hex",t),"#000000"}}getAlpha(){return(this.a??100)/100}},hn=class{s;r;w;c;constructor(t){this.s=t.s,this.r=t.r,this.w=t.w,t.c&&(this.c=new Me(t.c))}get radius(){return this.r}get width(){return this.w}get color(){return this.c}get style(){return cm[this.s??1]}},cm=(t=>(t[t.SOLID=1]="SOLID",t[t.DASHED=2]="DASHED",t))(cm||{}),go=class wd{static DEFAULT_FALLBACK=new Me({h:"#000000",a:50});r;c;fb;constructor(e){this.r=e.r,e.c&&(this.c=new Me(e.c)),e.fb&&(this.fb=new Me(e.fb))}get radius(){return this.r}get color(){return this.c}get fallback(){return this.fb??wd.DEFAULT_FALLBACK}},vo=class{blur;spr;clr;x;y;constructor(t){t=t??{},this.blur=t.blur??0,this.spr=t.spr??0,this.x=t.x??0,this.y=t.y??0,this.clr=new Me(t.clr)}getStyle(t){return`${this.x*t}px ${this.y*t}px ${this.blur*t}px ${this.spr*t}px ${this.clr.rgba}`}},Br=class{pl;pr;pt;pb;ml;mr;mt;mb;cent;constructor(t){t=t??{},this.pl=t.pl??0,this.pr=t.pr??0,this.pt=t.pt??0,this.pb=t.pb??0,this.ml=t.ml??0,this.mr=t.mr??0,this.mt=t.mt??0,this.mb=t.mb??0,this.cent=t.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`}},gn=class{rot;constructor(t){t?.rot&&(this.rot=t.rot)}get rotate(){return this.rot}},Pt=class{t;bg;br;clc;shd;spc;trf;a;w;h;x;y;constructor(t){this.t=t.t,t.bg&&(this.bg=new dn(t.bg)),t.br&&(this.br=new hn(t.br)),t.shd&&(this.shd=new vo(t.shd)),t.spc&&(this.spc=new Br(t.spc)),this.trf=new gn(t.trf),this.clc=t.clc,this.w=t.w,this.h=t.h,this.x=t.x,this.y=t.y,this.a=t.a}get alpha(){return this.a??100}get type(){return this.t}get typeAsString(){return Be[this.t]}get click(){return this.clc}},Be=(t=>(t[t.IMAGE=1]="IMAGE",t[t.TEXT=2]="TEXT",t[t.BUTTON=3]="BUTTON",t[t.FLEXBOX=4]="FLEXBOX",t[t.MULTI_COLUMN=5]="MULTI_COLUMN",t[t.CHECKBOX=6]="CHECKBOX",t[t.PRODUCTS=11]="PRODUCTS",t[t.PRODUCT=12]="PRODUCT",t[t.PRODUCT_IMAGE=13]="PRODUCT_IMAGE",t[t.PRODUCT_TITLE=14]="PRODUCT_TITLE",t[t.PRODUCT_VARIATIONS=15]="PRODUCT_VARIATIONS",t[t.PRODUCT_VARIATIONS_SELLING_PLANS=16]="PRODUCT_VARIATIONS_SELLING_PLANS",t[t.PRODUCT_BUTTON=18]="PRODUCT_BUTTON",t[t.PRODUCT_RATING=19]="PRODUCT_RATING",t[t.EMAIL_INPUT=51]="EMAIL_INPUT",t[t.PHONE_INPUT=52]="PHONE_INPUT",t[t.COUNTDOWN_TIMER=61]="COUNTDOWN_TIMER",t[t.CAROUSEL=62]="CAROUSEL",t[t.SHAPE=100]="SHAPE",t))(Be||{}),yn=class extends Pt{constructor(t){super(t)}},Ur=class extends Pt{src;constructor(t){super(t),this.src=t.src}},si=(t=>(t[t.START=0]="START",t[t.CENTER=1]="CENTER",t[t.END=2]="END",t[t.JUSTIFY=3]="JUSTIFY",t))(si||{}),zs=class{name;fonts;constructor(t){t=t??{},t.name&&(t.name=t.name!=="Arial"?t.name:""),this.name=t.name,this.fonts=t.fonts?.map(e=>new du(e))}},du=class{style;url;constructor(t){t=t??{},this.style=t.style,this.url=t.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')`}},st=class{fw;fs;fam;fmly;lh=1.2;ls;s;tc;ta;td;tdc;constructor(t){this.update(t)}get alignment(){return si[this.ta]}get letterSpacing(){return this.ls?this.ls+"px":"normal"}update(t){t=t??{},t.lh&&(this.lh=t.lh),t.tdc&&(this.tdc=new Me(t.tdc)),this.td=t.td,this.fs=t.s??t.fs??60,this.tc=new Me(t.tc),this.ta=t.ta??1,this.fw=t.fw??400,this.ls=t.ls??0,this.tc.h??="#000000",this.fam=new zs(t.fam??t.fmly)}resize(t){this.s*=t,this.ls*=t}},br=class extends Pt{typo;constructor(t){super(t);let e=w(w({},t.f),t.typo);t.alg&&(e.ta=t.alg),t.c&&(e.tc=t.c),this.typo=new st(e)}get color(){return this.typography.tc}get typography(){return this.typo}},Yr=class extends br{prs;constructor(t){super(t),this.prs=t.prs}get parts(){return this.prs}},Ys=class extends Pt{o;constructor(t){super(t),this.o=t.o??5,this.w=this.w??1080,this.h=this.h??1920}getOrigin(){return this.o}},ai=class{dd;hh;mm;ss;date;constructor(t){t??={},this.dd=t.dd??0,this.hh=t.hh??0,this.mm=t.mm??0,this.ss=t.ss??0,this.date=t.date?new Date(t.date):void 0}start(t,e){let r=new Date;t===2?(r.setSeconds(r.getSeconds()+this.ss),r.setMinutes(r.getMinutes()+this.mm),r.setHours(r.getHours()+this.hh),r.setDate(r.getDate()+this.dd)):r=this.date??new Date;let n=window.setInterval(()=>{let i=new Date().getTime(),s=r.getTime()-i;if(s<1){clearInterval(n);return}let o=Math.floor(s/(1e3*60*60*24)),c=Math.floor(s%(1e3*60*60*24)/(1e3*60*60)),u=Math.floor(s%(1e3*60*60)/(1e3*60)),d=Math.floor(s%(1e3*60)/1e3);e({days:o,hours:c,minutes:u,seconds:d})},1e3);return n}},ci=class extends br{gap;timer;timerType;horizontal;lblPos;show;constructor(t){t??={},super(t),this.gap=t.gap,this.timerType=t.type,this.timer=new ai(t.timer),this.show=t.show??{day:!0,hour:!0,minute:!0,second:!0},this.horizontal=t.horizontal,this.lblPos=t.lblPos}},qs=class{txt;c;constructor(t){t??={},this.txt=t.txt,this.c=new Me(t.c??{})}get text(){return this.txt}get color(){return this.c}},qr=class extends br{ph;constructor(t){super(t),this.ph=new qs(t.ph)}get placeholderText(){return this.ph.text}get placeholderColor(){return this.ph.color.rgba}},li=class extends qr{constructor(t){t??={},super(t)}},ui=class extends qr{},pi=class extends qr{},fi=class extends Ur{},vn=(t=>(t[t.LOW=1]="LOW",t[t.MEDIUM=2]="MEDIUM",t[t.HIGH=3]="HIGH",t))(vn||{}),Ks=class{en;ex;constructor(t){t=t??{},this.en=t.en,this.ex=t.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[]}}},_o=class extends Pt{gvt;max;cover;anim;embedded;position;constructor(t){t=t??{},super(t),this.gvt=t.gvt??5,this.max=t.max,this.cover=t.cover??!0,this.anim=new Ks(t.anim),this.embedded=t.embedded,this.position=t.position??1,this.spc||(this.spc=new Br({pl:N.IN_APP_DEFAULT_PADDING,pr:N.IN_APP_DEFAULT_PADDING,pt:N.IN_APP_DEFAULT_PADDING,pb:N.IN_APP_DEFAULT_PADDING}))}isEmbedded(){return this.position===2&&!!this.embedded}getEmbeddedSelector(){return`.letscooee-engagement.container-${this.embedded}`}},Js=class extends _o{cont;elems=[];mob;constructor(t){t=t??{},super(t),this.cont=new Ys(t.cont),this.mob=new _o(t.mob),this.bg||(this.bg=this.cont.bg,delete this.cont.bg),t.elems.forEach(e=>{e.t===1?this.elems.push(new Ur(e)):e.t===2?this.elems.push(new Yr(e)):e.t===3?this.elems.push(new Yr(e)):e.t===100?this.elems.push(new yn(e)):e.t===51?this.elems.push(new ui(e)):e.t===52?this.elems.push(new pi(e)):e.t===61?this.elems.push(new ci(e)):e.t===15||e.t===16?this.elems.push(new li(e)):e.t===13&&this.elems.push(new fi(e))})}getStylesForWrapper(){if(this.cover)return{};let t;return this.gvt===1?t={top:0,left:0}:this.gvt===2?t={top:0,left:"50%",transform:"translateX(-50%)"}:this.gvt===3?t={top:0,right:0}:this.gvt===6?t={top:"50%",right:0,transform:"translateY(-50%)"}:this.gvt===9?t={bottom:0,right:0}:this.gvt===8?t={bottom:0,left:"50%",transform:"translateX(-50%)"}:this.gvt===7?t={bottom:0,left:0}:this.gvt===4?t={top:"50%",left:0,transform:"translateY(-50%)"}:t={top:"50%",left:"50%",transform:"translateX(-50%) translateY(-50%)"},t.overflow="visible",t}getFlexStylesForContainer(){let t={display:"flex",flexDirection:"row"},e,r;return this.gvt===1?(e="flex-start",r="flex-start"):this.gvt===2?(e="center",r="flex-start"):this.gvt===3?(e="flex-end",r="flex-start"):this.gvt===4?(e="flex-start",r="center"):this.gvt===6?(e="flex-end",r="center"):this.gvt===7?(e="flex-start",r="flex-end"):this.gvt===8?(e="center",r="flex-end"):this.gvt===9?(e="flex-end",r="flex-end"):(e="center",r="center"),t.alignItems=r,t.justifyContent=e,t.overflow="visible",t}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}},mi=class{gap;dir;wrap;jc;ai;scroll;constructor(t){t??={},this.gap=t.gap??0,this.dir=t.dir??"row",this.wrap=t.wrap??"nowrap",this.jc=t.jc??"flex-start",this.ai=t.ai??"flex-start",this.scroll=t.scroll}},Xs=class{of;disp;pos;top;bottom;left;right;zIndex;constructor(t){t??={},this.of=t.of,this.disp=t.disp,this.pos=t.pos,this.top=t.top,this.bottom=t.bottom,this.left=t.left,this.right=t.right,this.zIndex=t.zIndex}},Qs=class{w;h;maxW;maxH;minW;minH;constructor(t){t??={},this.w=t.w??"100%",this.h=t.h??"auto",this.maxW=t.maxW,this.maxH=t.maxH,this.minW=t.minW,this.minH=t.minH}},Zs=class{size;bg;br;spc;typo;lout;flex;constructor(t){t??={},this.spc=new Br(t.spc),t.size&&(this.size=new Qs(t.size)),t.bg&&(this.bg=new dn(t.bg)),t.br&&(this.br=new hn(t.br)),t.typo&&(this.typo=new st(t.typo)),t.lout&&(this.lout=new Xs(t.lout)),t.flex&&(this.flex=new mi(t.flex))}},di=class{sm;lg;constructor(t){t??={},this.sm=new Zs(t.sm),this.lg=new Zs(t.lg)}},rt=class{t;style;hide;when;clc;constructor(t,e){e??={},this.t=t,this.style=new di(e.style),this.hide=e.hide,e.when?.op&&(this.when=e.when),e.clc&&(this.clc=e.clc)}get stringType(){return Be[this.t]}},qe=class extends rt{text;constructor(t,e){t?.style?.lg?.typo?.s&&delete t.style.lg.typo.s,t?.style?.sm?.typo?.s&&delete t.style.sm.typo.s,super(e??2,t),t??={},this.text=t.text}},_n=class extends qe{constructor(t,e){super(t,e??3)}},hi=class extends rt{value;constructor(t){super(6,t),t??={},this.value=t.value}},gi=class extends qe{constructor(t=15,e){super(e,t)}},ea=class extends rt{c;iconSize;showSingleStar;fullStar;halfStart;constructor(t){super(19,t),t??={},this.c=new Me(t.c),this.iconSize=t.iconSize??24,this.showSingleStar=t.showSingleStar??!1,this.fullStar=t.fullStar,this.halfStart=t.halfStart}},lm=Zt(tn()),hu=class{enabled;type;color;constructor(t){t??={},this.enabled=t.enabled,this.type=t.type,this.color=new Me(t.color)}},gu=class{size;enabled;color;constructor(t){t??={},this.enabled=t.enabled,this.size=t.size,this.color=new Me(t.color)}},Eo=class{navigation;pagination;autoplay;maxInRow;gap;slidesPerView;constructor(t){t??={},this.navigation=new gu(t.navigation),this.pagination=new hu(t.pagination),this.autoplay=t.autoplay,this.slidesPerView=t.slidesPerView??1,this.maxInRow=t.maxInRow??t.slidesPerView??4,this.gap=t.gap??0}},ta=class extends rt{conf;slide;formData;values;allowedTypes;constructor(t){super(62,t),t&&this.update(t)}update(t){t??={},this.slide=Lt.getParsedElement(t.slide),this.formData=t.formData,this.values=t.values,this.conf=new Eo(t.conf),this.allowedTypes=t.allowedTypes}},ra=class extends qe{gap;timer;timerType;horizontal;lblPos;show;constructor(t){t??={},super(t,61),this.gap=t.gap,this.timerType=t.type,this.timer=new ai(t.timer),this.show=t.show??{days:!0,hours:!0,minutes:!0,seconds:!0},this.horizontal=t.horizontal,this.lblPos=t.lblPos}},Kr=class extends rt{elems;constructor(t){super(4,t),this.update(t)}update(t){t??={},this.elems??=[],t.elems?.forEach(e=>{let r=Lt.getParsedElement(e);r&&this.elems.push(r)})}},En=class extends rt{src;sm;lg;constructor(t,e){super(e??1,t),t&&this.update(t)}update(t){this.src=t.src,this.sm=t.sm,this.lg=t.lg}},Lt=class Id{static getParsedElements(e){let r=[];return e?.forEach(n=>{let i=Id.getParsedElement(n);i&&r.push(i)}),r}static getParsedElement(e){switch(e.t){case 2:return new qe(e);case 3:return new _n(e);case 6:return new hi(e);case 11:return new na(e);case 12:return new Ir(e);case 61:return new ra(e);case 4:return new Kr(e);case 1:return new En(e);case 13:return new En(e,13);case 14:return new qe(e,14);case 15:case 16:return new gi(e.t,e);case 18:return new _n(e,18);case 62:return new ta(e);case 19:return new ea(e);default:lm.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"}}},Ir=class extends rt{img;title;desc;price;compareAt;btn;variantDD;show;symbol;cBox;elems;noLinks;constructor(t){if(t??={},super(12,t),this.show=t.show,this.elems=Lt.getParsedElements(t.elems),this.noLinks=t.noLinks,!this.elems.length){t.cBox&&this.elems.push(new hi(t.cBox)),this.elems.push(new En(t.img,13));let e=new qe(t.title,14);e.hide=!t.show?.title,e.text="{{ product.name }}",this.elems.push(e);let r=new qe(t.price);r.text="{{ product.price }}",r.hide=!t.show?.price;let n=new qe(t.compareAt);n.text="{{ product.compare_price }}",n.hide=!t.show?.price,t.compareAt||(n.style=new di(r.style),n.style.lg.typo=new st(Z(w({},n.style.lg.typo),{td:"line-through"})),n.style.sm.typo=new st(Z(w({},n.style.sm.typo),{td:"line-through"})));let i=new Kr({style:{lg:{spc:{mb:10},flex:{dir:"row",gap:10,ai:"center",jc:Lt.parseAlignmentToJustifyContent(r.style.lg.typo?.ta)}}}});i.elems.push(n),i.elems.push(r),this.elems.push(i);let s=new gi(15,t.variantDD);if(s.hide=!t.show?.variantDD,this.elems.push(s),t.btn){let o=new _n(t.btn,18);o.hide=!t.show?.btn,this.elems.push(o)}}t.symbol&&(this.symbol=new qe(t.symbol))}},na=class extends rt{conf;prod;constructor(t){super(11,t),t??={},this.conf=new yu(t.conf),this.prod=new Ir(t.prod)}},ia=class extends Eo{disp;maxItems;constructor(t){t??={},super(t),this.disp=t.disp,this.maxItems=t.maxItems}},yu=class{lg;sm;constructor(t){t??={},this.lg=new ia(t.lg),this.sm=new ia(t.sm)}},oa=class extends Kr{constructor(t){super(t)}},yi=class{cont;elems=[];constructor(t){t=t??{},this.cont=new oa(t.cont),t.elems?.forEach(e=>{this.addRawElement(e)})}addRawElement(t){let e=Lt.getParsedElement(t);return e&&this.elems.push(e),e}},vu=class{minValue;rewardType;label;reachingText;reachedText;discount;items;calculatedAlignment;constructor(t){this.minValue=t.minValue,this.rewardType=t.rewardType,this.label=t.label,this.reachingText=t.reachingText,this.reachedText=t.reachedText,this.discount=t.discount,this.items=t.items?.map(e=>new lt(e))}},sa=class{layout;milestones;constructor(t){this.layout=t.layout??Cc.ICONS,this.milestones=t.milestones?.map(e=>new vu(e))??[]}},aa=class{applyDiscountOnMinimum;constructor(t){this.applyDiscountOnMinimum=t.applyDiscountOnMinimum}},_u=class{engagementID;shortID;contentType;delay;onsiteDeliveryType;objective;redirectBehaviour;constructor(t){this.shortID=t.shortID,this.contentType=t.contentType,this.engagementID=t.engagementID,this.delay=t.delay??0,this.redirectBehaviour=t.redirectBehaviour,this.onsiteDeliveryType=t.onsiteDeliveryType,this.objective=t.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}},Bt=class Td extends _u{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=Mt({});constructor(e){super(e),this.id=e.id,this.nudgeID=e.nudgeID,this.currency=le.get().currencyCode??"USD",this.contentID=e.contentID,this.variation=e.variation,e.widget&&(this.widget=new yi(e.widget)),this.previewType=e.previewType,this.occurred=e.occurred??new Date,this.props=e.props,this.embeddedItems=e.embeddedItems?.map(r=>new lt(r)),this.items=e.items?.map(r=>new xt(r))??[],this.nonMutableItems=e.items?.map(r=>new xt(r))??[],this.collections=e.collections?.map(r=>new Gs(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 Vs(e.manipulation),this.contentSource=e.contentSource,this.klaviyoFormID=e.klaviyoFormID,this.hasMultiplePlacement=e.hasMultiplePlacement,this.skipSubscribedItems=e.skipSubscribedItems,e.progressBarConfig&&(this.progressBarConfig=new sa(e.progressBarConfig)),e.bundleConfig&&(this.bundleConfig=new aa(e.bundleConfig)),e.bundleFrom&&(this.bundleFrom=new xt(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===ur.BUNDLE_AND_UPSELL}isCartEmbed(){return this.onsiteDeliveryType===Yi.CART_EMBED}isPageEmbed(){return this.onsiteDeliveryType===Yi.PAGE_EMBED}isProgressBar(){return this.objective===ur.PROGRESS_BAR}isSubscriptionUpsell(){return this.objective===ur.SUBSCRIPTION_UPSELL}isCartRecovery(){return this.objective===ur.CART_RECOVERY}isProductPromotion(){return this.objective===ur.PRODUCT_PROMOTION}isProductPromoted(){return this.isProductPromotion()||this.isBundle()||this.isCartRecovery()}isBYOB(){return this.objective===ur.BYOB}isShoppableVideo(){return this.objective===ur.SHOPPABLE_VIDEO}processPopup(e){let r=JSON.stringify(e),n=this.items[0],i={},s={};if(n){let u=n.selectedOrFirstVariant.value;i={name:n.name,id:n.mID,link:n.link,vID:u.mID,image:n.variantImage,price:ne.formatCurrency(u.price.d),comparePrice:ne.formatCurrency(u.price.cmp),quantity:n.quantity},s={quantity:u.quantity}}let o={productCount:me.getCurrent().item_count},c=vt.render(r,{product:i,variant:s,cart:o,discount:this.discount,customer:this.customerData});return n&&(c=c.replace(new RegExp(N.PLACEHOLDER_IMAGE,"gi"),n.variantImage??n.imageURL)),new Js(JSON.parse(c))}calculateDiscountData(e,r){let n=jn.sum(e,s=>s.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([pr.UNIQUE_FLAT_ITEMS,pr.STATIC].includes(this.discount.type)&&this.discount.values?.length)i.discountPercentage=this.discount.values[0],i.discountAmount=i.actualPrice*i.discountPercentage/100,this.updateEffectivePrice(e,i.discountPercentage);else if(this.discount.type===pr.UNIQUE_FIXED_ITEMS&&this.discount.values?.length)i.discountAmount=i.actualPrice-this.discount.values[0],i.discountPercentage=i.discountAmount/i.actualPrice*100,this.updateEffectivePrice(e,i.discountPercentage);else if(this.discount.type===pr.UNIQUE_CHEAPEST_ITEM_FREE){e.sort((o,c)=>c.selectedOrFirstVariant.value.price.d-o.selectedOrFirstVariant.value.price.d);let s=e[e.length-1];s.selectedOrFirstVariant.value.price.effective=0,i.discountAmount=s.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 Oe.get().skipItemAttribute?{}:{[N.VIA]:"Cooee",[N.CAMPAIGN_ATTRIBUTE]:this.shortID,[N.CONTENT_ATTRIBUTE]:this.contentID}}getKVFormatPrivateAttributesForLineItem(){return Oe.get().skipItemAttribute?[]:[{key:N.VIA,value:"Cooee"},{key:N.CAMPAIGN_ATTRIBUTE,value:this.shortID},{key:N.CONTENT_ATTRIBUTE,value:this.contentID}]}isBundleDiscount(){return[pr.UNIQUE_FIXED_ITEMS,pr.UNIQUE_FLAT_ITEMS].includes(this.discount.type)}isBundleOnCartDrawer(){return this.onsiteDeliveryType===Yi.CART_EMBED&&this.objective===ur.BUNDLE_AND_UPSELL}hasSwiperElement(){let e=this.widget?.elems.find(n=>Td.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})`}updateEffectivePrice(e,r){e.forEach(n=>{let i=n.selectedOrFirstVariant.value,s=i.price;i.effectivePrice.value=s.d*r/100})}formatCurrencyAndNumber(e){if(!e)return{};let r={discountPercentage:ne.formatNumber(e.discountPercentage??0),discountCode:this.discount?.code};return["actualPrice","discountAmount","discountedPrice"].map(n=>{r[n]=ne.formatCurrency(e[n])}),r}};function Nv(t,e){return e={exports:{}},t(e,e.exports),e.exports}var Ov=Uv,Pv=Mv,Lv=$v,xr=[],Vt=[],Bv=typeof Uint8Array<"u"?Uint8Array:Array,Eu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Sn=0,um=Eu.length;Sn<um;++Sn)xr[Sn]=Eu[Sn],Vt[Eu.charCodeAt(Sn)]=Sn;var Sn,um;Vt[45]=62;Vt[95]=63;function xm(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 Uv(t){var e=xm(t),r=e[0],n=e[1];return(r+n)*3/4-n}function kv(t,e,r){return(e+r)*3/4-r}function Mv(t){var e,r=xm(t),n=r[0],i=r[1],s=new Bv(kv(t,n,i)),o=0,c=i>0?n-4:n,u;for(u=0;u<c;u+=4)e=Vt[t.charCodeAt(u)]<<18|Vt[t.charCodeAt(u+1)]<<12|Vt[t.charCodeAt(u+2)]<<6|Vt[t.charCodeAt(u+3)],s[o++]=e>>16&255,s[o++]=e>>8&255,s[o++]=e&255;return i===2&&(e=Vt[t.charCodeAt(u)]<<2|Vt[t.charCodeAt(u+1)]>>4,s[o++]=e&255),i===1&&(e=Vt[t.charCodeAt(u)]<<10|Vt[t.charCodeAt(u+1)]<<4|Vt[t.charCodeAt(u+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function Fv(t){return xr[t>>18&63]+xr[t>>12&63]+xr[t>>6&63]+xr[t&63]}function Hv(t,e,r){for(var n,i=[],s=e;s<r;s+=3)n=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(t[s+2]&255),i.push(Fv(n));return i.join("")}function $v(t){for(var e,r=t.length,n=r%3,i=[],s=16383,o=0,c=r-n;o<c;o+=s)i.push(Hv(t,o,o+s>c?c:o+s));return n===1?(e=t[r-1],i.push(xr[e>>2]+xr[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(xr[e>>10]+xr[e>>4&63]+xr[e<<2&63]+"=")),i.join("")}var Su={byteLength:Ov,toByteArray:Pv,fromByteArray:Lv},jv=function(t,e,r,n,i){var s,o,c=i*8-n-1,u=(1<<c)-1,d=u>>1,m=-7,h=r?i-1:0,v=r?-1:1,_=t[e+h];for(h+=v,s=_&(1<<-m)-1,_>>=-m,m+=c;m>0;s=s*256+t[e+h],h+=v,m-=8);for(o=s&(1<<-m)-1,s>>=-m,m+=n;m>0;o=o*256+t[e+h],h+=v,m-=8);if(s===0)s=1-d;else{if(s===u)return o?NaN:(_?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-d}return(_?-1:1)*o*Math.pow(2,s-n)},Wv=function(t,e,r,n,i,s){var o,c,u,d=s*8-i-1,m=(1<<d)-1,h=m>>1,v=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,_=n?0:s-1,g=n?1:-1,y=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(c=isNaN(e)?1:0,o=m):(o=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-o))<1&&(o--,u*=2),o+h>=1?e+=v/u:e+=v*Math.pow(2,1-h),e*u>=2&&(o++,u/=2),o+h>=m?(c=0,o=m):o+h>=1?(c=(e*u-1)*Math.pow(2,i),o=o+h):(c=e*Math.pow(2,h-1)*Math.pow(2,i),o=0));i>=8;t[r+_]=c&255,_+=g,c/=256,i-=8);for(o=o<<i|c,d+=i;d>0;t[r+_]=o&255,_+=g,o/=256,d-=8);t[r+_-g]|=y*128},vi={read:jv,write:Wv},ua=Nv(function(t,e){var r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=o,e.SlowBuffer=O,e.INSPECT_MAX_BYTES=50;var n=2147483647;e.kMaxLength=n,o.TYPED_ARRAY_SUPPORT=i(),!o.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 a=new Uint8Array(1),l={foo:function(){return 42}};return Object.setPrototypeOf(l,Uint8Array.prototype),Object.setPrototypeOf(a,l),a.foo()===42}catch{return!1}}Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}});function s(a){if(a>n)throw new RangeError('The value "'+a+'" is invalid for option "size"');var l=new Uint8Array(a);return Object.setPrototypeOf(l,o.prototype),l}function o(a,l,p){if(typeof a=="number"){if(typeof l=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return m(a)}return c(a,l,p)}o.poolSize=8192;function c(a,l,p){if(typeof a=="string")return h(a,l);if(ArrayBuffer.isView(a))return _(a);if(a==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(a));if(je(a,ArrayBuffer)||a&&je(a.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(je(a,SharedArrayBuffer)||a&&je(a.buffer,SharedArrayBuffer)))return g(a,l,p);if(typeof a=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var I=a.valueOf&&a.valueOf();if(I!=null&&I!==a)return o.from(I,l,p);var A=y(a);if(A)return A;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof a[Symbol.toPrimitive]=="function")return o.from(a[Symbol.toPrimitive]("string"),l,p);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(a))}o.from=function(a,l,p){return c(a,l,p)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array);function u(a){if(typeof a!="number")throw new TypeError('"size" argument must be of type number');if(a<0)throw new RangeError('The value "'+a+'" is invalid for option "size"')}function d(a,l,p){return u(a),a<=0?s(a):l!==void 0?typeof p=="string"?s(a).fill(l,p):s(a).fill(l):s(a)}o.alloc=function(a,l,p){return d(a,l,p)};function m(a){return u(a),s(a<0?0:C(a)|0)}o.allocUnsafe=function(a){return m(a)},o.allocUnsafeSlow=function(a){return m(a)};function h(a,l){if((typeof l!="string"||l==="")&&(l="utf8"),!o.isEncoding(l))throw new TypeError("Unknown encoding: "+l);var p=H(a,l)|0,I=s(p),A=I.write(a,l);return A!==p&&(I=I.slice(0,A)),I}function v(a){for(var l=a.length<0?0:C(a.length)|0,p=s(l),I=0;I<l;I+=1)p[I]=a[I]&255;return p}function _(a){if(je(a,Uint8Array)){var l=new Uint8Array(a);return g(l.buffer,l.byteOffset,l.byteLength)}return v(a)}function g(a,l,p){if(l<0||a.byteLength<l)throw new RangeError('"offset" is outside of buffer bounds');if(a.byteLength<l+(p||0))throw new RangeError('"length" is outside of buffer bounds');var I;return l===void 0&&p===void 0?I=new Uint8Array(a):p===void 0?I=new Uint8Array(a,l):I=new Uint8Array(a,l,p),Object.setPrototypeOf(I,o.prototype),I}function y(a){if(o.isBuffer(a)){var l=C(a.length)|0,p=s(l);return p.length===0||a.copy(p,0,0,l),p}if(a.length!==void 0)return typeof a.length!="number"||$r(a.length)?s(0):v(a);if(a.type==="Buffer"&&Array.isArray(a.data))return v(a.data)}function C(a){if(a>=n)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n.toString(16)+" bytes");return a|0}function O(a){return+a!=a&&(a=0),o.alloc(+a)}o.isBuffer=function(a){return a!=null&&a._isBuffer===!0&&a!==o.prototype},o.compare=function(a,l){if(je(a,Uint8Array)&&(a=o.from(a,a.offset,a.byteLength)),je(l,Uint8Array)&&(l=o.from(l,l.offset,l.byteLength)),!o.isBuffer(a)||!o.isBuffer(l))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(a===l)return 0;for(var p=a.length,I=l.length,A=0,M=Math.min(p,I);A<M;++A)if(a[A]!==l[A]){p=a[A],I=l[A];break}return p<I?-1:I<p?1:0},o.isEncoding=function(a){switch(String(a).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}},o.concat=function(a,l){if(!Array.isArray(a))throw new TypeError('"list" argument must be an Array of Buffers');if(a.length===0)return o.alloc(0);var p;if(l===void 0)for(l=0,p=0;p<a.length;++p)l+=a[p].length;var I=o.allocUnsafe(l),A=0;for(p=0;p<a.length;++p){var M=a[p];if(je(M,Uint8Array))A+M.length>I.length?o.from(M).copy(I,A):Uint8Array.prototype.set.call(I,M,A);else if(o.isBuffer(M))M.copy(I,A);else throw new TypeError('"list" argument must be an Array of Buffers');A+=M.length}return I};function H(a,l){if(o.isBuffer(a))return a.length;if(ArrayBuffer.isView(a)||je(a,ArrayBuffer))return a.byteLength;if(typeof a!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+babelHelpers.typeof(a));var p=a.length,I=arguments.length>2&&arguments[2]===!0;if(!I&&p===0)return 0;for(var A=!1;;)switch(l){case"ascii":case"latin1":case"binary":return p;case"utf8":case"utf-8":return kn(a).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return p*2;case"hex":return p>>>1;case"base64":return ji(a).length;default:if(A)return I?-1:kn(a).length;l=(""+l).toLowerCase(),A=!0}}o.byteLength=H;function L(a,l,p){var I=!1;if((l===void 0||l<0)&&(l=0),l>this.length||((p===void 0||p>this.length)&&(p=this.length),p<=0)||(p>>>=0,l>>>=0,p<=l))return"";for(a||(a="utf8");;)switch(a){case"hex":return De(this,l,p);case"utf8":case"utf-8":return ge(this,l,p);case"ascii":return be(this,l,p);case"latin1":case"binary":return Ut(this,l,p);case"base64":return Qt(this,l,p);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ht(this,l,p);default:if(I)throw new TypeError("Unknown encoding: "+a);a=(a+"").toLowerCase(),I=!0}}o.prototype._isBuffer=!0;function P(a,l,p){var I=a[l];a[l]=a[p],a[p]=I}o.prototype.swap16=function(){var a=this.length;if(a%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var l=0;l<a;l+=2)P(this,l,l+1);return this},o.prototype.swap32=function(){var a=this.length;if(a%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var l=0;l<a;l+=4)P(this,l,l+3),P(this,l+1,l+2);return this},o.prototype.swap64=function(){var a=this.length;if(a%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var l=0;l<a;l+=8)P(this,l,l+7),P(this,l+1,l+6),P(this,l+2,l+5),P(this,l+3,l+4);return this},o.prototype.toString=function(){var a=this.length;return a===0?"":arguments.length===0?ge(this,0,a):L.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(a){if(!o.isBuffer(a))throw new TypeError("Argument must be a Buffer");return this===a?!0:o.compare(this,a)===0},o.prototype.inspect=function(){var a="",l=e.INSPECT_MAX_BYTES;return a=this.toString("hex",0,l).replace(/(.{2})/g,"$1 ").trim(),this.length>l&&(a+=" ... "),"<Buffer "+a+">"},r&&(o.prototype[r]=o.prototype.inspect),o.prototype.compare=function(a,l,p,I,A){if(je(a,Uint8Array)&&(a=o.from(a,a.offset,a.byteLength)),!o.isBuffer(a))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+babelHelpers.typeof(a));if(l===void 0&&(l=0),p===void 0&&(p=a?a.length:0),I===void 0&&(I=0),A===void 0&&(A=this.length),l<0||p>a.length||I<0||A>this.length)throw new RangeError("out of range index");if(I>=A&&l>=p)return 0;if(I>=A)return-1;if(l>=p)return 1;if(l>>>=0,p>>>=0,I>>>=0,A>>>=0,this===a)return 0;for(var M=A-I,W=p-l,te=Math.min(M,W),Tt=this.slice(I,A),Dt=a.slice(l,p),ce=0;ce<te;++ce)if(Tt[ce]!==Dt[ce]){M=Tt[ce],W=Dt[ce];break}return M<W?-1:W<M?1:0};function V(a,l,p,I,A){if(a.length===0)return-1;if(typeof p=="string"?(I=p,p=0):p>2147483647?p=2147483647:p<-2147483648&&(p=-2147483648),p=+p,$r(p)&&(p=A?0:a.length-1),p<0&&(p=a.length+p),p>=a.length){if(A)return-1;p=a.length-1}else if(p<0)if(A)p=0;else return-1;if(typeof l=="string"&&(l=o.from(l,I)),o.isBuffer(l))return l.length===0?-1:kt(a,l,p,I,A);if(typeof l=="number")return l=l&255,typeof Uint8Array.prototype.indexOf=="function"?A?Uint8Array.prototype.indexOf.call(a,l,p):Uint8Array.prototype.lastIndexOf.call(a,l,p):kt(a,[l],p,I,A);throw new TypeError("val must be string, number or Buffer")}function kt(a,l,p,I,A){var M=1,W=a.length,te=l.length;if(I!==void 0&&(I=String(I).toLowerCase(),I==="ucs2"||I==="ucs-2"||I==="utf16le"||I==="utf-16le")){if(a.length<2||l.length<2)return-1;M=2,W/=2,te/=2,p/=2}function Tt(J,se){return M===1?J[se]:J.readUInt16BE(se*M)}var Dt;if(A){var ce=-1;for(Dt=p;Dt<W;Dt++)if(Tt(a,Dt)===Tt(l,ce===-1?0:Dt-ce)){if(ce===-1&&(ce=Dt),Dt-ce+1===te)return ce*M}else ce!==-1&&(Dt-=Dt-ce),ce=-1}else for(p+te>W&&(p=W-te),Dt=p;Dt>=0;Dt--){for(var G=!0,dt=0;dt<te;dt++)if(Tt(a,Dt+dt)!==Tt(l,dt)){G=!1;break}if(G)return Dt}return-1}o.prototype.includes=function(a,l,p){return this.indexOf(a,l,p)!==-1},o.prototype.indexOf=function(a,l,p){return V(this,a,l,p,!0)},o.prototype.lastIndexOf=function(a,l,p){return V(this,a,l,p,!1)};function fe(a,l,p,I){p=Number(p)||0;var A=a.length-p;I?(I=Number(I),I>A&&(I=A)):I=A;var M=l.length;I>M/2&&(I=M/2);for(var W=0;W<I;++W){var te=parseInt(l.substr(W*2,2),16);if($r(te))return W;a[p+W]=te}return W}function j(a,l,p,I){return Mn(kn(l,a.length-p),a,p,I)}function ct(a,l,p,I){return Mn(Hi(l),a,p,I)}function Y(a,l,p,I){return Mn(ji(l),a,p,I)}function at(a,l,p,I){return Mn(Wi(l,a.length-p),a,p,I)}o.prototype.write=function(a,l,p,I){if(l===void 0)I="utf8",p=this.length,l=0;else if(p===void 0&&typeof l=="string")I=l,p=this.length,l=0;else if(isFinite(l))l=l>>>0,isFinite(p)?(p=p>>>0,I===void 0&&(I="utf8")):(I=p,p=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var A=this.length-l;if((p===void 0||p>A)&&(p=A),a.length>0&&(p<0||l<0)||l>this.length)throw new RangeError("Attempt to write outside buffer bounds");I||(I="utf8");for(var M=!1;;)switch(I){case"hex":return fe(this,a,l,p);case"utf8":case"utf-8":return j(this,a,l,p);case"ascii":case"latin1":case"binary":return ct(this,a,l,p);case"base64":return Y(this,a,l,p);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return at(this,a,l,p);default:if(M)throw new TypeError("Unknown encoding: "+I);I=(""+I).toLowerCase(),M=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Qt(a,l,p){return l===0&&p===a.length?Su.fromByteArray(a):Su.fromByteArray(a.slice(l,p))}function ge(a,l,p){p=Math.min(a.length,p);for(var I=[],A=l;A<p;){var M=a[A],W=null,te=M>239?4:M>223?3:M>191?2:1;if(A+te<=p){var Tt,Dt,ce,G;switch(te){case 1:M<128&&(W=M);break;case 2:Tt=a[A+1],(Tt&192)===128&&(G=(M&31)<<6|Tt&63,G>127&&(W=G));break;case 3:Tt=a[A+1],Dt=a[A+2],(Tt&192)===128&&(Dt&192)===128&&(G=(M&15)<<12|(Tt&63)<<6|Dt&63,G>2047&&(G<55296||G>57343)&&(W=G));break;case 4:Tt=a[A+1],Dt=a[A+2],ce=a[A+3],(Tt&192)===128&&(Dt&192)===128&&(ce&192)===128&&(G=(M&15)<<18|(Tt&63)<<12|(Dt&63)<<6|ce&63,G>65535&&G<1114112&&(W=G))}}W===null?(W=65533,te=1):W>65535&&(W-=65536,I.push(W>>>10&1023|55296),W=56320|W&1023),I.push(W),A+=te}return xe(I)}var de=4096;function xe(a){var l=a.length;if(l<=de)return String.fromCharCode.apply(String,a);for(var p="",I=0;I<l;)p+=String.fromCharCode.apply(String,a.slice(I,I+=de));return p}function be(a,l,p){var I="";p=Math.min(a.length,p);for(var A=l;A<p;++A)I+=String.fromCharCode(a[A]&127);return I}function Ut(a,l,p){var I="";p=Math.min(a.length,p);for(var A=l;A<p;++A)I+=String.fromCharCode(a[A]);return I}function De(a,l,p){var I=a.length;(!l||l<0)&&(l=0),(!p||p<0||p>I)&&(p=I);for(var A="",M=l;M<p;++M)A+=is[a[M]];return A}function ht(a,l,p){for(var I=a.slice(l,p),A="",M=0;M<I.length-1;M+=2)A+=String.fromCharCode(I[M]+I[M+1]*256);return A}o.prototype.slice=function(a,l){var p=this.length;a=~~a,l=l===void 0?p:~~l,a<0?(a+=p,a<0&&(a=0)):a>p&&(a=p),l<0?(l+=p,l<0&&(l=0)):l>p&&(l=p),l<a&&(l=a);var I=this.subarray(a,l);return Object.setPrototypeOf(I,o.prototype),I};function Q(a,l,p){if(a%1!==0||a<0)throw new RangeError("offset is not uint");if(a+l>p)throw new RangeError("Trying to access beyond buffer length")}o.prototype.readUintLE=o.prototype.readUIntLE=function(a,l,p){a=a>>>0,l=l>>>0,p||Q(a,l,this.length);for(var I=this[a],A=1,M=0;++M<l&&(A*=256);)I+=this[a+M]*A;return I},o.prototype.readUintBE=o.prototype.readUIntBE=function(a,l,p){a=a>>>0,l=l>>>0,p||Q(a,l,this.length);for(var I=this[a+--l],A=1;l>0&&(A*=256);)I+=this[a+--l]*A;return I},o.prototype.readUint8=o.prototype.readUInt8=function(a,l){return a=a>>>0,l||Q(a,1,this.length),this[a]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(a,l){return a=a>>>0,l||Q(a,2,this.length),this[a]|this[a+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(a,l){return a=a>>>0,l||Q(a,2,this.length),this[a]<<8|this[a+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(a,l){return a=a>>>0,l||Q(a,4,this.length),(this[a]|this[a+1]<<8|this[a+2]<<16)+this[a+3]*16777216},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(a,l){return a=a>>>0,l||Q(a,4,this.length),this[a]*16777216+(this[a+1]<<16|this[a+2]<<8|this[a+3])},o.prototype.readIntLE=function(a,l,p){a=a>>>0,l=l>>>0,p||Q(a,l,this.length);for(var I=this[a],A=1,M=0;++M<l&&(A*=256);)I+=this[a+M]*A;return A*=128,I>=A&&(I-=Math.pow(2,8*l)),I},o.prototype.readIntBE=function(a,l,p){a=a>>>0,l=l>>>0,p||Q(a,l,this.length);for(var I=l,A=1,M=this[a+--I];I>0&&(A*=256);)M+=this[a+--I]*A;return A*=128,M>=A&&(M-=Math.pow(2,8*l)),M},o.prototype.readInt8=function(a,l){return a=a>>>0,l||Q(a,1,this.length),this[a]&128?(255-this[a]+1)*-1:this[a]},o.prototype.readInt16LE=function(a,l){a=a>>>0,l||Q(a,2,this.length);var p=this[a]|this[a+1]<<8;return p&32768?p|4294901760:p},o.prototype.readInt16BE=function(a,l){a=a>>>0,l||Q(a,2,this.length);var p=this[a+1]|this[a]<<8;return p&32768?p|4294901760:p},o.prototype.readInt32LE=function(a,l){return a=a>>>0,l||Q(a,4,this.length),this[a]|this[a+1]<<8|this[a+2]<<16|this[a+3]<<24},o.prototype.readInt32BE=function(a,l){return a=a>>>0,l||Q(a,4,this.length),this[a]<<24|this[a+1]<<16|this[a+2]<<8|this[a+3]},o.prototype.readFloatLE=function(a,l){return a=a>>>0,l||Q(a,4,this.length),vi.read(this,a,!0,23,4)},o.prototype.readFloatBE=function(a,l){return a=a>>>0,l||Q(a,4,this.length),vi.read(this,a,!1,23,4)},o.prototype.readDoubleLE=function(a,l){return a=a>>>0,l||Q(a,8,this.length),vi.read(this,a,!0,52,8)},o.prototype.readDoubleBE=function(a,l){return a=a>>>0,l||Q(a,8,this.length),vi.read(this,a,!1,52,8)};function we(a,l,p,I,A,M){if(!o.isBuffer(a))throw new TypeError('"buffer" argument must be a Buffer instance');if(l>A||l<M)throw new RangeError('"value" argument is out of bounds');if(p+I>a.length)throw new RangeError("Index out of range")}o.prototype.writeUintLE=o.prototype.writeUIntLE=function(a,l,p,I){if(a=+a,l=l>>>0,p=p>>>0,!I){var A=Math.pow(2,8*p)-1;we(this,a,l,p,A,0)}var M=1,W=0;for(this[l]=a&255;++W<p&&(M*=256);)this[l+W]=a/M&255;return l+p},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(a,l,p,I){if(a=+a,l=l>>>0,p=p>>>0,!I){var A=Math.pow(2,8*p)-1;we(this,a,l,p,A,0)}var M=p-1,W=1;for(this[l+M]=a&255;--M>=0&&(W*=256);)this[l+M]=a/W&255;return l+p},o.prototype.writeUint8=o.prototype.writeUInt8=function(a,l,p){return a=+a,l=l>>>0,p||we(this,a,l,1,255,0),this[l]=a&255,l+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(a,l,p){return a=+a,l=l>>>0,p||we(this,a,l,2,65535,0),this[l]=a&255,this[l+1]=a>>>8,l+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(a,l,p){return a=+a,l=l>>>0,p||we(this,a,l,2,65535,0),this[l]=a>>>8,this[l+1]=a&255,l+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(a,l,p){return a=+a,l=l>>>0,p||we(this,a,l,4,4294967295,0),this[l+3]=a>>>24,this[l+2]=a>>>16,this[l+1]=a>>>8,this[l]=a&255,l+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(a,l,p){return a=+a,l=l>>>0,p||we(this,a,l,4,4294967295,0),this[l]=a>>>24,this[l+1]=a>>>16,this[l+2]=a>>>8,this[l+3]=a&255,l+4},o.prototype.writeIntLE=function(a,l,p,I){if(a=+a,l=l>>>0,!I){var A=Math.pow(2,8*p-1);we(this,a,l,p,A-1,-A)}var M=0,W=1,te=0;for(this[l]=a&255;++M<p&&(W*=256);)a<0&&te===0&&this[l+M-1]!==0&&(te=1),this[l+M]=(a/W>>0)-te&255;return l+p},o.prototype.writeIntBE=function(a,l,p,I){if(a=+a,l=l>>>0,!I){var A=Math.pow(2,8*p-1);we(this,a,l,p,A-1,-A)}var M=p-1,W=1,te=0;for(this[l+M]=a&255;--M>=0&&(W*=256);)a<0&&te===0&&this[l+M+1]!==0&&(te=1),this[l+M]=(a/W>>0)-te&255;return l+p},o.prototype.writeInt8=function(a,l,p){return a=+a,l=l>>>0,p||we(this,a,l,1,127,-128),a<0&&(a=255+a+1),this[l]=a&255,l+1},o.prototype.writeInt16LE=function(a,l,p){return a=+a,l=l>>>0,p||we(this,a,l,2,32767,-32768),this[l]=a&255,this[l+1]=a>>>8,l+2},o.prototype.writeInt16BE=function(a,l,p){return a=+a,l=l>>>0,p||we(this,a,l,2,32767,-32768),this[l]=a>>>8,this[l+1]=a&255,l+2},o.prototype.writeInt32LE=function(a,l,p){return a=+a,l=l>>>0,p||we(this,a,l,4,2147483647,-2147483648),this[l]=a&255,this[l+1]=a>>>8,this[l+2]=a>>>16,this[l+3]=a>>>24,l+4},o.prototype.writeInt32BE=function(a,l,p){return a=+a,l=l>>>0,p||we(this,a,l,4,2147483647,-2147483648),a<0&&(a=4294967295+a+1),this[l]=a>>>24,this[l+1]=a>>>16,this[l+2]=a>>>8,this[l+3]=a&255,l+4};function cr(a,l,p,I,A,M){if(p+I>a.length)throw new RangeError("Index out of range");if(p<0)throw new RangeError("Index out of range")}function jr(a,l,p,I,A){return l=+l,p=p>>>0,A||cr(a,l,p,4),vi.write(a,l,p,I,23,4),p+4}o.prototype.writeFloatLE=function(a,l,p){return jr(this,a,l,!0,p)},o.prototype.writeFloatBE=function(a,l,p){return jr(this,a,l,!1,p)};function Ue(a,l,p,I,A){return l=+l,p=p>>>0,A||cr(a,l,p,8),vi.write(a,l,p,I,52,8),p+8}o.prototype.writeDoubleLE=function(a,l,p){return Ue(this,a,l,!0,p)},o.prototype.writeDoubleBE=function(a,l,p){return Ue(this,a,l,!1,p)},o.prototype.copy=function(a,l,p,I){if(!o.isBuffer(a))throw new TypeError("argument should be a Buffer");if(p||(p=0),!I&&I!==0&&(I=this.length),l>=a.length&&(l=a.length),l||(l=0),I>0&&I<p&&(I=p),I===p||a.length===0||this.length===0)return 0;if(l<0)throw new RangeError("targetStart out of bounds");if(p<0||p>=this.length)throw new RangeError("Index out of range");if(I<0)throw new RangeError("sourceEnd out of bounds");I>this.length&&(I=this.length),a.length-l<I-p&&(I=a.length-l+p);var A=I-p;return this===a&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(l,p,I):Uint8Array.prototype.set.call(a,this.subarray(p,I),l),A},o.prototype.fill=function(a,l,p,I){if(typeof a=="string"){if(typeof l=="string"?(I=l,l=0,p=this.length):typeof p=="string"&&(I=p,p=this.length),I!==void 0&&typeof I!="string")throw new TypeError("encoding must be a string");if(typeof I=="string"&&!o.isEncoding(I))throw new TypeError("Unknown encoding: "+I);if(a.length===1){var A=a.charCodeAt(0);(I==="utf8"&&A<128||I==="latin1")&&(a=A)}}else typeof a=="number"?a=a&255:typeof a=="boolean"&&(a=Number(a));if(l<0||this.length<l||this.length<p)throw new RangeError("Out of range index");if(p<=l)return this;l=l>>>0,p=p===void 0?this.length:p>>>0,a||(a=0);var M;if(typeof a=="number")for(M=l;M<p;++M)this[M]=a;else{var W=o.isBuffer(a)?a:o.from(a,I),te=W.length;if(te===0)throw new TypeError('The value "'+a+'" is invalid for argument "value"');for(M=0;M<p-l;++M)this[M+l]=W[M%te]}return this};var en=/[^+/0-9A-Za-z-_]/g;function Hn(a){if(a=a.split("=")[0],a=a.trim().replace(en,""),a.length<2)return"";for(;a.length%4!==0;)a=a+"=";return a}function kn(a,l){l=l||1/0;for(var p,I=a.length,A=null,M=[],W=0;W<I;++W){if(p=a.charCodeAt(W),p>55295&&p<57344){if(!A){if(p>56319){(l-=3)>-1&&M.push(239,191,189);continue}else if(W+1===I){(l-=3)>-1&&M.push(239,191,189);continue}A=p;continue}if(p<56320){(l-=3)>-1&&M.push(239,191,189),A=p;continue}p=(A-55296<<10|p-56320)+65536}else A&&(l-=3)>-1&&M.push(239,191,189);if(A=null,p<128){if((l-=1)<0)break;M.push(p)}else if(p<2048){if((l-=2)<0)break;M.push(p>>6|192,p&63|128)}else if(p<65536){if((l-=3)<0)break;M.push(p>>12|224,p>>6&63|128,p&63|128)}else if(p<1114112){if((l-=4)<0)break;M.push(p>>18|240,p>>12&63|128,p>>6&63|128,p&63|128)}else throw new Error("Invalid code point")}return M}function Hi(a){for(var l=[],p=0;p<a.length;++p)l.push(a.charCodeAt(p)&255);return l}function Wi(a,l){for(var p,I,A,M=[],W=0;W<a.length&&!((l-=2)<0);++W)p=a.charCodeAt(W),I=p>>8,A=p%256,M.push(A),M.push(I);return M}function ji(a){return Su.toByteArray(Hn(a))}function Mn(a,l,p,I){for(var A=0;A<I&&!(A+p>=l.length||A>=a.length);++A)l[A+p]=a[A];return A}function je(a,l){return a instanceof l||a!=null&&a.constructor!=null&&a.constructor.name!=null&&a.constructor.name===l.name}function $r(a){return a!==a}var is=function(){for(var a="0123456789abcdef",l=new Array(256),p=0;p<16;++p)for(var I=p*16,A=0;A<16;++A)l[I+A]=a[p]+a[A];return l}()}),Ee=ua.Buffer;ua.SlowBuffer;ua.INSPECT_MAX_BYTES;ua.kMaxLength;var xu=function(t,e){return xu=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},xu(t,e)};function pa(t,e){xu(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var bn=function(t){pa(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),$e=function(t){pa(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 ca(t){return t&&t.Math==Math&&t}function Cm(){return ca(typeof globalThis=="object"&&globalThis)||ca(typeof window=="object"&&window)||ca(typeof self=="object"&&self)||ca(typeof global=="object"&&global)||Function("return this")()}function Gv(){var t=Cm();return typeof t.navigator=="object"&&t.navigator.product==="ReactNative"}var Vv=function(t){var e=Gv()?"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(e);for(var r=Ee.alloc(t),n=0;n<t;++n)r[n]=Math.floor(Math.random()*256);return r},zv=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))}:Vv}},Dm=zv();function Yv(t){return["[object ArrayBuffer]","[object SharedArrayBuffer]"].includes(Object.prototype.toString.call(t))}function Du(t){return Object.prototype.toString.call(t)==="[object Uint8Array]"}function qv(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Kv(t){return Io(t)&&Object.prototype.toString.call(t)==="[object Date]"}function Io(t){return typeof t=="object"&&t!==null}function fa(t,e){var r=!1;function n(){for(var i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];return r||(console.warn(e),r=!0),t.apply(this,i)}return n}function la(t){if(ArrayBuffer.isView(t))return Ee.from(t.buffer,t.byteOffset,t.byteLength);if(Yv(t))return Ee.from(t);throw new $e("Must use either Buffer or TypedArray")}var Jv=/^(?:[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,Rm=function(t){return typeof t=="string"&&Jv.test(t)},Cu=function(t){if(!Rm(t))throw new $e('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")},pm=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")},WN=Math.pow(2,63)-1,GN=-Math.pow(2,63),Xv=Math.pow(2,53),Qv=-Math.pow(2,53),Am=4,In=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 $e("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=la(e),this.position=this.buffer.byteLength)}return t.prototype.put=function(e){if(typeof e=="string"&&e.length!==1)throw new $e("only accepts single character String");if(typeof e!="number"&&e.length!==1)throw new $e("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 $e("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(la(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 fm(this.buffer.slice(0,this.position));throw new bn('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=Cu(e.$uuid)),!n)throw new $e("Unexpected Binary Extended JSON format ".concat(JSON.stringify(e)));return i===Am?new fm(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(In.prototype,"_bsontype",{value:"Binary"});var wu=16,fm=function(t){pa(e,t);function e(r){var n=this,i,s;if(r==null)i=e.generate();else if(r instanceof e)i=Ee.from(r.buffer),s=r.__id;else if(ArrayBuffer.isView(r)&&r.byteLength===wu)i=la(r);else if(typeof r=="string")i=Cu(r);else throw new $e("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,Am)||this,n.__id=s,n}return Object.defineProperty(e.prototype,"id",{get:function(){return this.buffer},set:function(r){this.buffer=r,e.cacheHexString&&(this.__id=pm(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=pm(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 In(this.id,In.SUBTYPE_UUID)},e.generate=function(){var r=Dm(wu);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"?Rm(r):Du(r)?r.length!==wu?!1:(r[6]&240)===64&&(r[8]&128)===128:!1:!1},e.createFromHexString=function(r){var n=Cu(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}(In),ma=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(ma.prototype,"_bsontype",{value:"Code"});function Zv(t){return Io(t)&&t.$id!=null&&typeof t.$ref=="string"&&(t.$db==null||typeof t.$db=="string")}var wo=function(){function t(e,r,n,i){if(!(this instanceof t))return new t(e,r,n,i);var s=e.split(".");s.length===2&&(n=s.shift(),e=s.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(wo.prototype,"_bsontype",{value:"DBRef"});var Gt=void 0;try{Gt=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 mm=65536,e_=1<<24,Ei=mm*mm,Nm=Ei*Ei,dm=Nm/2,hm={},gm={},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,s;return r?(e>>>=0,(s=0<=e&&e<256)&&(i=gm[e],i)?i:(n=t.fromBits(e,(e|0)<0?-1:0,!0),s&&(gm[e]=n),n)):(e|=0,(s=-128<=e&&e<128)&&(i=hm[e],i)?i:(n=t.fromBits(e,e<0?-1:0,!1),s&&(hm[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>=Nm)return t.MAX_UNSIGNED_VALUE}else{if(e<=-dm)return t.MIN_VALUE;if(e+1>=dm)return t.MAX_VALUE}return e<0?t.fromNumber(-e,r).neg():t.fromBits(e%Ei|0,e/Ei|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 s=t.fromNumber(Math.pow(n,8)),o=t.ZERO,c=0;c<e.length;c+=8){var u=Math.min(8,e.length-c),d=parseInt(e.substring(c,c+u),n);if(u<8){var m=t.fromNumber(Math.pow(n,u));o=o.mul(m).add(t.fromNumber(d))}else o=o.mul(s),o=o.add(t.fromNumber(d))}return o.unsigned=r,o},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 Io(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,s=this.low&65535,o=e.high>>>16,c=e.high&65535,u=e.low>>>16,d=e.low&65535,m=0,h=0,v=0,_=0;return _+=s+d,v+=_>>>16,_&=65535,v+=i+u,h+=v>>>16,v&=65535,h+=n+c,m+=h>>>16,h&=65535,m+=r+o,m&=65535,t.fromBits(v<<16|_,m<<16|h,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(Gt){if(!this.unsigned&&this.high===-2147483648&&e.low===-1&&e.high===-1)return this;var r=(this.unsigned?Gt.div_u:Gt.div_s)(this.low,this.high,e.low,e.high);return t.fromBits(r,Gt.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?t.UZERO:t.ZERO;var n,i,s;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return t.UZERO;if(e.gt(this.shru(1)))return t.UONE;s=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 o=this.shr(1);return n=o.div(e).shl(1),n.eq(t.ZERO)?e.isNegative()?t.ONE:t.NEG_ONE:(i=this.sub(e.mul(n)),s=n.add(i.div(e)),s)}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();s=t.ZERO}for(i=this;i.gte(e);){n=Math.max(1,Math.floor(i.toNumber()/e.toNumber()));for(var c=Math.ceil(Math.log(n)/Math.LN2),u=c<=48?1:Math.pow(2,c-48),d=t.fromNumber(n),m=d.mul(e);m.isNegative()||m.gt(i);)n-=u,d=t.fromNumber(n,this.unsigned),m=d.mul(e);d.isZero()&&(d=t.ONE),s=s.add(d),i=i.sub(m)}return s},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)),Gt){var r=(this.unsigned?Gt.rem_u:Gt.rem_s)(this.low,this.high,e.low,e.high);return t.fromBits(r,Gt.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)),Gt){var r=Gt.mul(this.low,this.high,e.low,e.high);return t.fromBits(r,Gt.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,s=this.low>>>16,o=this.low&65535,c=e.high>>>16,u=e.high&65535,d=e.low>>>16,m=e.low&65535,h=0,v=0,_=0,g=0;return g+=o*m,_+=g>>>16,g&=65535,_+=s*m,v+=_>>>16,_&=65535,_+=o*d,v+=_>>>16,_&=65535,v+=i*m,h+=v>>>16,v&=65535,v+=s*d,h+=v>>>16,v&=65535,v+=o*u,h+=v>>>16,v&=65535,h+=n*m+i*d+s*u+o*c,h&=65535,t.fromBits(_<<16|g,h<<16|v,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)*Ei+(this.low>>>0):this.high*Ei+(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 s=t.fromNumber(Math.pow(e,6),this.unsigned),o=this,c="";;){var u=o.div(s),d=o.sub(u.mul(s)).toInt()>>>0,m=d.toString(e);if(o=u,o.isZero())return m+c;for(;m.length<6;)m="0"+m;c=""+m+c}},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(e_),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 t_=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,r_=/^(\+|-)?(Infinity|inf)$/i,n_=/^(\+|-)?NaN$/i,So=6111,bu=-6176,ym=6176,i_=34,Iu=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),vm=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),_m=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),o_=/^([-+])?(\d+)?$/,s_=31,Em=16383,a_=30,c_=31;function Sm(t){return!isNaN(parseInt(t,10))}function l_(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 u_(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),s=new K(e.getLowBits(),0),o=r.multiply(i),c=r.multiply(s),u=n.multiply(i),d=n.multiply(s);return o=o.add(c.shiftRightUnsigned(32)),c=new K(c.getLowBits(),0).add(u).add(d.shiftRightUnsigned(32)),o=o.add(c.shiftRightUnsigned(32)),d=c.shiftLeft(32).add(new K(d.getLowBits(),0)),{high:o,low:d}}function p_(t,e){var r=t.high>>>0,n=e.high>>>0;if(r<n)return!0;if(r===n){var i=t.low>>>0,s=e.low>>>0;if(i<s)return!0}return!1}function _i(t,e){throw new $e('"'.concat(t,'" is not a valid Decimal128 string - ').concat(e))}var Ru=function(){function t(e){if(!(this instanceof t))return new t(e);if(typeof e=="string")this.bytes=t.fromString(e).bytes;else if(Du(e)){if(e.byteLength!==16)throw new $e("Decimal128 must take a Buffer of 16 bytes");this.bytes=e}else throw new $e("Decimal128 must take a Buffer or string")}return t.fromString=function(e){var r=!1,n=!1,i=!1,s=0,o=0,c=0,u=0,d=0,m=[0],h=0,v=0,_=0,g=0,y=0,C=0,O=new K(0,0),H=new K(0,0),L=0,P=0;if(e.length>=7e3)throw new $e(""+e+" not a valid Decimal128 string");var V=e.match(t_),kt=e.match(r_),fe=e.match(n_);if(!V&&!kt&&!fe||e.length===0)throw new $e(""+e+" not a valid Decimal128 string");if(V){var j=V[2],ct=V[4],Y=V[5],at=V[6];ct&&at===void 0&&_i(e,"missing exponent power"),ct&&j===void 0&&_i(e,"missing exponent base"),ct===void 0&&(Y||at)&&_i(e,"missing e before exponent")}if((e[P]==="+"||e[P]==="-")&&(r=e[P++]==="-"),!Sm(e[P])&&e[P]!=="."){if(e[P]==="i"||e[P]==="I")return new t(Ee.from(r?vm:_m));if(e[P]==="N")return new t(Ee.from(Iu))}for(;Sm(e[P])||e[P]===".";){if(e[P]==="."){n&&_i(e,"contains multiple periods"),n=!0,P=P+1;continue}h<34&&(e[P]!=="0"||i)&&(i||(d=o),i=!0,m[v++]=parseInt(e[P],10),h=h+1),i&&(c=c+1),n&&(u=u+1),o=o+1,P=P+1}if(n&&!o)throw new $e(""+e+" not a valid Decimal128 string");if(e[P]==="e"||e[P]==="E"){var Qt=e.substr(++P).match(o_);if(!Qt||!Qt[2])return new t(Ee.from(Iu));y=parseInt(Qt[0],10),P=P+Qt[0].length}if(e[P])return new t(Ee.from(Iu));if(_=0,!h)_=0,g=0,m[0]=0,c=1,h=1,s=0;else if(g=h-1,s=c,s!==1)for(;m[d+s-1]===0;)s=s-1;for(y<=u&&u-y>16384?y=bu:y=y-u;y>So;){if(g=g+1,g-_>i_){var ge=m.join("");if(ge.match(/^0+$/)){y=So;break}_i(e,"overflow")}y=y-1}for(;y<bu||h<c;){if(g===0&&s<h){y=bu,s=0;break}if(h<c?c=c-1:g=g-1,y<So)y=y+1;else{var ge=m.join("");if(ge.match(/^0+$/)){y=So;break}_i(e,"overflow")}}if(g-_+1<s){var de=o;n&&(d=d+1,de=de+1),r&&(d=d+1,de=de+1);var xe=parseInt(e[d+g+1],10),be=0;if(xe>=5&&(be=1,xe===5)){for(be=m[g]%2===1?1:0,C=d+g+2;C<de;C++)if(parseInt(e[C],10)){be=1;break}}if(be){for(var Ut=g;Ut>=0;Ut--)if(++m[Ut]>9&&(m[Ut]=0,Ut===0))if(y<So)y=y+1,m[Ut]=1;else return new t(Ee.from(r?vm:_m))}}if(O=K.fromNumber(0),H=K.fromNumber(0),s===0)O=K.fromNumber(0),H=K.fromNumber(0);else if(g-_<17){var Ut=_;for(H=K.fromNumber(m[Ut++]),O=new K(0,0);Ut<=g;Ut++)H=H.multiply(K.fromNumber(10)),H=H.add(K.fromNumber(m[Ut]))}else{var Ut=_;for(O=K.fromNumber(m[Ut++]);Ut<=g-17;Ut++)O=O.multiply(K.fromNumber(10)),O=O.add(K.fromNumber(m[Ut]));for(H=K.fromNumber(m[Ut++]);Ut<=g;Ut++)H=H.multiply(K.fromNumber(10)),H=H.add(K.fromNumber(m[Ut]))}var De=u_(O,K.fromString("100000000000000000"));De.low=De.low.add(H),p_(De.low,H)&&(De.high=De.high.add(K.fromNumber(1))),L=y+ym;var ht={low:K.fromNumber(0),high:K.fromNumber(0)};De.high.shiftRightUnsigned(49).and(K.fromNumber(1)).equals(K.fromNumber(1))?(ht.high=ht.high.or(K.fromNumber(3).shiftLeft(61)),ht.high=ht.high.or(K.fromNumber(L).and(K.fromNumber(16383).shiftLeft(47))),ht.high=ht.high.or(De.high.and(K.fromNumber(0x7fffffffffff)))):(ht.high=ht.high.or(K.fromNumber(L&16383).shiftLeft(49)),ht.high=ht.high.or(De.high.and(K.fromNumber(562949953421311)))),ht.low=De.low,r&&(ht.high=ht.high.or(K.fromString("9223372036854775808")));var Q=Ee.alloc(16);return P=0,Q[P++]=ht.low.low&255,Q[P++]=ht.low.low>>8&255,Q[P++]=ht.low.low>>16&255,Q[P++]=ht.low.low>>24&255,Q[P++]=ht.low.high&255,Q[P++]=ht.low.high>>8&255,Q[P++]=ht.low.high>>16&255,Q[P++]=ht.low.high>>24&255,Q[P++]=ht.high.low&255,Q[P++]=ht.high.low>>8&255,Q[P++]=ht.high.low>>16&255,Q[P++]=ht.high.low>>24&255,Q[P++]=ht.high.high&255,Q[P++]=ht.high.high>>8&255,Q[P++]=ht.high.high>>16&255,Q[P++]=ht.high.high>>24&255,new t(Q)},t.prototype.toString=function(){for(var e,r=0,n=new Array(36),i=0;i<n.length;i++)n[i]=0;var s=0,o=!1,c,u={parts:[0,0,0,0]},d,m,h=[];s=0;var v=this.bytes,_=v[s++]|v[s++]<<8|v[s++]<<16|v[s++]<<24,g=v[s++]|v[s++]<<8|v[s++]<<16|v[s++]<<24,y=v[s++]|v[s++]<<8|v[s++]<<16|v[s++]<<24,C=v[s++]|v[s++]<<8|v[s++]<<16|v[s++]<<24;s=0;var O={low:new K(_,g),high:new K(y,C)};O.high.lessThan(K.ZERO)&&h.push("-");var H=C>>26&s_;if(H>>3===3){if(H===a_)return h.join("")+"Infinity";if(H===c_)return"NaN";e=C>>15&Em,c=8+(C>>14&1)}else c=C>>14&7,e=C>>17&Em;var L=e-ym;if(u.parts[0]=(C&16383)+((c&15)<<14),u.parts[1]=y,u.parts[2]=g,u.parts[3]=_,u.parts[0]===0&&u.parts[1]===0&&u.parts[2]===0&&u.parts[3]===0)o=!0;else for(m=3;m>=0;m--){var P=0,V=l_(u);if(u=V.quotient,P=V.rem.low,!!P)for(d=8;d>=0;d--)n[m*9+d]=P%10,P=Math.floor(P/10)}if(o)r=1,n[s]=0;else for(r=36;!n[s];)r=r-1,s=s+1;var kt=r-1+L;if(kt>=34||kt<=-7||L>0){if(r>34)return h.push("".concat(0)),L>0?h.push("E+".concat(L)):L<0&&h.push("E".concat(L)),h.join("");h.push("".concat(n[s++])),r=r-1,r&&h.push(".");for(var i=0;i<r;i++)h.push("".concat(n[s++]));h.push("E"),kt>0?h.push("+".concat(kt)):h.push("".concat(kt))}else if(L>=0)for(var i=0;i<r;i++)h.push("".concat(n[s++]));else{var fe=r+L;if(fe>0)for(var i=0;i<fe;i++)h.push("".concat(n[s++]));else h.push("0");for(h.push(".");fe++<0;)h.push("0");for(var i=0;i<r-Math.max(fe-1,0);i++)h.push("".concat(n[s++]))}return h.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(Ru.prototype,"_bsontype",{value:"Decimal128"});var da=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(da.prototype,"_bsontype",{value:"Double"});var ha=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(ha.prototype,"_bsontype",{value:"Int32"});var Au=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(Au.prototype,"_bsontype",{value:"MaxKey"});var Nu=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(Nu.prototype,"_bsontype",{value:"MinKey"});var f_=new RegExp("^[0-9a-fA-F]{24}$"),wn=null,Tr=Symbol("id"),Ze=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 $e("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[Tr]=t.generate(typeof r=="number"?r:void 0);else if(ArrayBuffer.isView(r)&&r.byteLength===12)this[Tr]=r instanceof Ee?r:la(r);else if(typeof r=="string")if(r.length===12){var n=Ee.from(r);if(n.byteLength===12)this[Tr]=n;else throw new $e("Argument passed in must be a string of 12 bytes")}else if(r.length===24&&f_.test(r))this[Tr]=Ee.from(r,"hex");else throw new $e("Argument passed in must be a string of 12 bytes or a string of 24 hex characters or an integer");else throw new $e("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[Tr]},set:function(e){this[Tr]=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),wn===null&&(wn=Dm(5)),n[4]=wn[0],n[5]=wn[1],n[6]=wn[2],n[7]=wn[3],n[8]=wn[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[Tr][11]===e[Tr][11]&&this[Tr].equals(e[Tr]);if(typeof e=="string"&&t.isValid(e)&&e.length===12&&Du(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 $e("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(Ze.prototype,"generate",{value:fa(function(t){return Ze.generate(t)},"Please use the static `ObjectId.generate(time)` instead")});Object.defineProperty(Ze.prototype,"getInc",{value:fa(function(){return Ze.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(Ze.prototype,"get_inc",{value:fa(function(){return Ze.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(Ze,"get_inc",{value:fa(function(){return Ze.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(Ze.prototype,"_bsontype",{value:"ObjectID"});function m_(t){return t.split("").sort().join("")}var bo=function(){function t(e,r){if(!(this instanceof t))return new t(e,r);if(this.pattern=e,this.options=m_(r??""),this.pattern.indexOf("\0")!==-1)throw new bn("BSON Regex patterns cannot contain null bytes, found: ".concat(JSON.stringify(this.pattern)));if(this.options.indexOf("\0")!==-1)throw new bn("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 bn("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 $e("Unexpected BSONRegExp EJSON object form: ".concat(JSON.stringify(e)))},t}();Object.defineProperty(bo.prototype,"_bsontype",{value:"BSONRegExp"});var Ou=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(Ou.prototype,"_bsontype",{value:"Symbol"});var d_=K,Om=function(t){pa(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:Io(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}(d_);function h_(t){return Io(t)&&Reflect.has(t,"_bsontype")&&typeof t._bsontype=="string"}var Pm=2147483647,Lm=-2147483648,Bm=9223372036854776e3,Um=-9223372036854776e3,g_={$oid:Ze,$binary:In,$uuid:In,$symbol:Ou,$numberInt:ha,$numberDecimal:Ru,$numberDouble:da,$numberLong:K,$minKey:Nu,$maxKey:Au,$regex:bo,$regularExpression:bo,$timestamp:Om};function km(t,e){if(e===void 0&&(e={}),typeof t=="number"){if(e.relaxed||e.legacy)return t;if(Math.floor(t)===t){if(t>=Lm&&t<=Pm)return new ha(t);if(t>=Um&&t<=Bm)return K.fromNumber(t)}return new da(t)}if(t==null||typeof t!="object")return t;if(t.$undefined)return null;for(var r=Object.keys(t).filter(function(h){return h.startsWith("$")&&t[h]!=null}),n=0;n<r.length;n++){var i=g_[r[n]];if(i)return i.fromExtendedJSON(t,e)}if(t.$date!=null){var s=t.$date,o=new Date;return e.legacy?typeof s=="number"?o.setTime(s):typeof s=="string"&&o.setTime(Date.parse(s)):typeof s=="string"?o.setTime(Date.parse(s)):K.isLong(s)?o.setTime(s.toNumber()):typeof s=="number"&&e.relaxed&&o.setTime(s),o}if(t.$code!=null){var c=Object.assign({},t);return t.$scope&&(c.$scope=km(t.$scope)),ma.fromExtendedJSON(t)}if(Zv(t)||t.$dbPointer){var u=t.$ref?t:t.$dbPointer;if(u instanceof wo)return u;var d=Object.keys(u).filter(function(h){return h.startsWith("$")}),m=!0;if(d.forEach(function(h){["$ref","$id","$db"].indexOf(h)===-1&&(m=!1)}),m)return wo.fromExtendedJSON(u)}return t}function y_(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 wm(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(O){return O.obj===t});if(r!==-1){var n=e.seenObjects.map(function(O){return O.propertyName}),i=n.slice(0,r).map(function(O){return"".concat(O," -> ")}).join(""),s=n[r],o=" -> "+n.slice(r+1,n.length-1).map(function(O){return"".concat(O," -> ")}).join(""),c=n[n.length-1],u=" ".repeat(i.length+s.length/2),d="-".repeat(o.length+(s.length+c.length)/2-1);throw new $e(`Converting circular structure to EJSON:
|
|
25
|
+
`),typeof c=="string"||c instanceof Uint8Array)i(c);else{let u;try{u=JSON.stringify(c)}catch{u=JSON.stringify(ir(c))}i(u)}}return typeof n=="string"?n:uy(n)}function uy(e){let t=e.reduce((i,s)=>i+s.length,0),r=new Uint8Array(t),n=0;for(let i of e)r.set(i,n),n+=i.length;return r}function Ol(e){let t=typeof e.data=="string"?Rl(e.data):e.data;return[Ze({type:"attachment",length:t.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType}),t]}var py={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 Ts(e){return py[e]}function Cs(e){if(!e||!e.sdk)return;let{name:t,version:r}=e.sdk;return{name:t,version:r}}function Pl(e,t,r,n){let i=e.sdkProcessingMetadata&&e.sdkProcessingMetadata.dynamicSamplingContext;return w(w(w({event_id:e.event_id,sent_at:new Date().toISOString()},t&&{sdk:t}),!!r&&n&&{dsn:gr(n)}),i&&{trace:Ze(w({},i))})}function Ll(e,t,r){let n=[{type:"client_report"},{timestamp:r||vr(),discarded_events:e}];return _r(t?{dsn:t}:{},[n])}function qf(e,t=Date.now()){let r=parseInt(`${e}`,10);if(!isNaN(r))return r*1e3;let n=Date.parse(`${e}`);return isNaN(n)?6e4:n-t}function Kf(e,t){return e[t]||e.all||0}function Bl(e,t,r=Date.now()){return Kf(e,t)>r}function Ul(e,{statusCode:t,headers:r},n=Date.now()){let i=w({},e),s=r&&r["x-sentry-rate-limits"],o=r&&r["retry-after"];if(s)for(let c of s.trim().split(",")){let[u,p,,,m]=c.split(":",5),h=parseInt(u,10),y=(isNaN(h)?60:h)*1e3;if(!p)i.all=n+y;else for(let E of p.split(";"))E==="metric_bucket"?(!m||m.split(";").includes("custom"))&&(i[E]=n+y):i[E]=n+y}else o?i.all=n+qf(o,n):t===429&&(i.all=n+60*1e3);return i}function xs(){return{traceId:nt(),spanId:nt().substring(16)}}var Ds=te;function kl(){let e=Ds.chrome,t=e&&e.app&&e.app.runtime,r="history"in Ds&&!!Ds.history.pushState&&!!Ds.history.replaceState;return!t&&r}var Re=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function un(){return ao(te),te}function ao(e){let t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||Wt,t[Wt]=t[Wt]||{}}function co(e,t={}){if(t.user&&(!e.ipAddress&&t.user.ip_address&&(e.ipAddress=t.user.ip_address),!e.did&&!t.did&&(e.did=t.user.id||t.user.email||t.user.username)),e.timestamp=t.timestamp||Bt(),t.abnormal_mechanism&&(e.abnormal_mechanism=t.abnormal_mechanism),t.ignoreDuration&&(e.ignoreDuration=t.ignoreDuration),t.sid&&(e.sid=t.sid.length===32?t.sid:nt()),t.init!==void 0&&(e.init=t.init),!e.did&&t.did&&(e.did=`${t.did}`),typeof t.started=="number"&&(e.started=t.started),e.ignoreDuration)e.duration=void 0;else if(typeof t.duration=="number")e.duration=t.duration;else{let r=e.timestamp-e.started;e.duration=r>=0?r:0}t.release&&(e.release=t.release),t.environment&&(e.environment=t.environment),!e.ipAddress&&t.ipAddress&&(e.ipAddress=t.ipAddress),!e.userAgent&&t.userAgent&&(e.userAgent=t.userAgent),typeof t.errors=="number"&&(e.errors=t.errors),t.status&&(e.status=t.status)}var Ml="_sentrySpan";function Fl(e,t){t?wt(e,Ml,t):delete e[Ml]}function Hl(e){return e[Ml]}var dy=100,$l=class Nh{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext=xs()}clone(){let t=new Nh;return t._breadcrumbs=[...this._breadcrumbs],t._tags=w({},this._tags),t._extra=w({},this._extra),t._contexts=w({},this._contexts),t._user=this._user,t._level=this._level,t._session=this._session,t._transactionName=this._transactionName,t._fingerprint=this._fingerprint,t._eventProcessors=[...this._eventProcessors],t._requestSession=this._requestSession,t._attachments=[...this._attachments],t._sdkProcessingMetadata=w({},this._sdkProcessingMetadata),t._propagationContext=w({},this._propagationContext),t._client=this._client,t._lastEventId=this._lastEventId,Fl(t,Hl(this)),t}setClient(t){this._client=t}setLastEventId(t){this._lastEventId=t}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(t){this._scopeListeners.push(t)}addEventProcessor(t){return this._eventProcessors.push(t),this}setUser(t){return this._user=t||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&co(this._session,{user:t}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){return this._requestSession}setRequestSession(t){return this._requestSession=t,this}setTags(t){return this._tags=w(w({},this._tags),t),this._notifyScopeListeners(),this}setTag(t,r){return this._tags=ee(w({},this._tags),{[t]:r}),this._notifyScopeListeners(),this}setExtras(t){return this._extra=w(w({},this._extra),t),this._notifyScopeListeners(),this}setExtra(t,r){return this._extra=ee(w({},this._extra),{[t]:r}),this._notifyScopeListeners(),this}setFingerprint(t){return this._fingerprint=t,this._notifyScopeListeners(),this}setLevel(t){return this._level=t,this._notifyScopeListeners(),this}setTransactionName(t){return this._transactionName=t,this._notifyScopeListeners(),this}setContext(t,r){return r===null?delete this._contexts[t]:this._contexts[t]=r,this._notifyScopeListeners(),this}setSession(t){return t?this._session=t:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(t){if(!t)return this;let r=typeof t=="function"?t(this):t,[n,i]=r instanceof mt?[r.getScopeData(),r.getRequestSession()]:rr(r)?[t,t.requestSession]:[],{tags:s,extra:o,user:c,contexts:u,level:p,fingerprint:m=[],propagationContext:h}=n||{};return this._tags=w(w({},this._tags),s),this._extra=w(w({},this._extra),o),this._contexts=w(w({},this._contexts),u),c&&Object.keys(c).length&&(this._user=c),p&&(this._level=p),m.length&&(this._fingerprint=m),h&&(this._propagationContext=h),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,Fl(this,void 0),this._attachments=[],this._propagationContext=xs(),this._notifyScopeListeners(),this}addBreadcrumb(t,r){let n=typeof r=="number"?r:dy;if(n<=0)return this;let i=w({timestamp:vr()},t),s=this._breadcrumbs;return s.push(i),this._breadcrumbs=s.length>n?s.slice(-n):s,this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(t){return this._attachments.push(t),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:Hl(this)}}setSDKProcessingMetadata(t){return this._sdkProcessingMetadata=w(w({},this._sdkProcessingMetadata),t),this}setPropagationContext(t){return this._propagationContext=t,this}getPropagationContext(){return this._propagationContext}captureException(t,r){let n=r&&r.event_id?r.event_id:nt();if(!this._client)return K.warn("No client configured on scope - will not capture exception!"),n;let i=new Error("Sentry syntheticException");return this._client.captureException(t,ee(w({originalException:t,syntheticException:i},r),{event_id:n}),this),n}captureMessage(t,r,n){let i=n&&n.event_id?n.event_id:nt();if(!this._client)return K.warn("No client configured on scope - will not capture message!"),i;let s=new Error(t);return this._client.captureMessage(t,r,ee(w({originalException:t,syntheticException:s},n),{event_id:i}),this),i}captureEvent(t,r){let n=r&&r.event_id?r.event_id:nt();return this._client?(this._client.captureEvent(t,ee(w({},r),{event_id:n}),this),n):(K.warn("No client configured on scope - will not capture event!"),n)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(t=>{t(this)}),this._notifyingListeners=!1)}},mt=$l;function Xf(){return ni("defaultCurrentScope",()=>new mt)}function Jf(){return ni("defaultIsolationScope",()=>new mt)}var jl=class{constructor(e,t){let r;e?r=e:r=new mt;let n;t?n=t:n=new mt,this._stack=[{scope:r}],this._isolationScope=n}withScope(e){let t=this._pushScope(),r;try{r=e(t)}catch(n){throw this._popScope(),n}return Ar(r)?r.then(n=>(this._popScope(),n),n=>{throw this._popScope(),n}):(this._popScope(),r)}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 ai(){let e=un(),t=ao(e);return t.stack=t.stack||new jl(Xf(),Jf())}function hy(e){return ai().withScope(e)}function gy(e,t){let r=ai();return r.withScope(()=>(r.getStackTop().scope=e,t(e)))}function Qf(e){return ai().withScope(()=>e(ai().getIsolationScope()))}function Zf(){return{withIsolationScope:Qf,withScope:hy,withSetScope:gy,withSetIsolationScope:(e,t)=>Qf(t),getCurrentScope:()=>ai().getScope(),getIsolationScope:()=>ai().getIsolationScope()}}function Rs(e){let t=ao(e);return t.acs?t.acs:Zf()}function pn(){let e=un();return Rs(e).getCurrentScope()}function fn(){let e=un();return Rs(e).getIsolationScope()}function As(){return ni("globalScope",()=>new mt)}function Ns(...e){let t=un(),r=Rs(t);if(e.length===2){let[n,i]=e;return n?r.withSetScope(n,i):r.withScope(i)}return r.withScope(e[0])}function Fe(){return pn().getClient()}var yy="_sentryMetrics";function em(e){let t=e[yy];if(!t)return;let r={};for(let[,[n,i]]of t)(r[n]||(r[n]=[])).push(Ze(i));return r}var Wl="sentry.source",Gl="sentry.sample_rate",Vl="sentry.op",Yl="sentry.origin",vy=1;function nm(e){let{spanId:t,traceId:r}=e.spanContext(),{parent_span_id:n}=mn(e);return Ze({parent_span_id:n,span_id:t,trace_id:r})}function tm(e){return typeof e=="number"?rm(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?rm(e.getTime()):Bt()}function rm(e){return e>9999999999?e/1e3:e}function mn(e){if(Ey(e))return e.getSpanJSON();try{let{spanId:t,traceId:r}=e.spanContext();if(_y(e)){let{attributes:n,startTime:i,name:s,endTime:o,parentSpanId:c,status:u}=e;return Ze({span_id:t,trace_id:r,data:n,description:s,parent_span_id:c,start_timestamp:tm(i),timestamp:tm(o)||void 0,status:Sy(u),op:n[Vl],origin:n[Yl],_metrics_summary:em(e)})}return{span_id:t,trace_id:r}}catch{return{}}}function _y(e){let t=e;return!!t.attributes&&!!t.startTime&&!!t.name&&!!t.endTime&&!!t.status}function Ey(e){return typeof e.getSpanJSON=="function"}function im(e){let{traceFlags:t}=e.spanContext();return t===vy}function Sy(e){if(!(!e||e.code===0))return e.code===1?"ok":e.message||"unknown_error"}var wy="_sentryRootSpan";function lo(e){return e[wy]||e}var Os="production",by="_frozenDsc";function zl(e,t){let r=t.getOptions(),{publicKey:n}=t.getDsn()||{},i=Ze({environment:r.environment||Os,release:r.release,public_key:n,trace_id:e});return t.emit("createDsc",i),i}function om(e){let t=Fe();if(!t)return{};let r=zl(mn(e).trace_id||"",t),n=lo(e),i=n[by];if(i)return i;let s=n.spanContext().traceState,o=s&&s.get("sentry.dsc"),c=o&&Dl(o);if(c)return c;let u=mn(n),p=u.data||{},m=p[Gl];m!=null&&(r.sample_rate=`${m}`);let h=p[Wl],y=u.description;return h!=="url"&&y&&(r.transaction=y),r.sampled=String(im(n)),t.emit("createDsc",r,n),r}function sm(e){if(typeof e=="boolean")return Number(e);let t=typeof e=="string"?parseFloat(e):e;if(typeof t!="number"||isNaN(t)||t<0||t>1){Re&&K.warn(`[Tracing] Given sample rate is invalid. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(e)} of type ${JSON.stringify(typeof e)}.`);return}return t}function Iy(e,t){return t&&(e.sdk=e.sdk||{},e.sdk.name=e.sdk.name||t.name,e.sdk.version=e.sdk.version||t.version,e.sdk.integrations=[...e.sdk.integrations||[],...t.integrations||[]],e.sdk.packages=[...e.sdk.packages||[],...t.packages||[]]),e}function am(e,t,r,n){let i=Cs(r),s=w(w({sent_at:new Date().toISOString()},i&&{sdk:i}),!!n&&t&&{dsn:gr(t)}),o="aggregates"in e?[{type:"sessions"},e]:[{type:"session"},e.toJSON()];return _r(s,[o])}function cm(e,t,r,n){let i=Cs(r),s=e.type&&e.type!=="replay_event"?e.type:"event";Iy(e,r&&r.sdk);let o=Pl(e,i,n,t);return delete e.sdkProcessingMetadata,_r(o,[[{type:s},e]])}function Ps(e,t,r,n=0){return new or((i,s)=>{let o=e[n];if(t===null||typeof o!="function")i(t);else{let c=o(w({},t),r);Re&&o.id&&c===null&&K.log(`Event processor "${o.id}" dropped event`),Ar(c)?c.then(u=>Ps(e,u,r,n+1).then(i)).then(null,s):Ps(e,c,r,n+1).then(i).then(null,s)}})}function lm(e,t){let{fingerprint:r,span:n,breadcrumbs:i,sdkProcessingMetadata:s}=t;Ty(e,t),n&&Dy(e,n),Ry(e,r),Cy(e,i),xy(e,s)}function ql(e,t){let{extra:r,tags:n,user:i,contexts:s,level:o,sdkProcessingMetadata:c,breadcrumbs:u,fingerprint:p,eventProcessors:m,attachments:h,propagationContext:y,transactionName:E,span:v}=t;uo(e,"extra",r),uo(e,"tags",n),uo(e,"user",i),uo(e,"contexts",s),uo(e,"sdkProcessingMetadata",c),o&&(e.level=o),E&&(e.transactionName=E),v&&(e.span=v),u.length&&(e.breadcrumbs=[...e.breadcrumbs,...u]),p.length&&(e.fingerprint=[...e.fingerprint,...p]),m.length&&(e.eventProcessors=[...e.eventProcessors,...m]),h.length&&(e.attachments=[...e.attachments,...h]),e.propagationContext=w(w({},e.propagationContext),y)}function uo(e,t,r){if(r&&Object.keys(r).length){e[t]=w({},e[t]);for(let n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[t][n]=r[n])}}function Ty(e,t){let{extra:r,tags:n,user:i,contexts:s,level:o,transactionName:c}=t,u=Ze(r);u&&Object.keys(u).length&&(e.extra=w(w({},u),e.extra));let p=Ze(n);p&&Object.keys(p).length&&(e.tags=w(w({},p),e.tags));let m=Ze(i);m&&Object.keys(m).length&&(e.user=w(w({},m),e.user));let h=Ze(s);h&&Object.keys(h).length&&(e.contexts=w(w({},h),e.contexts)),o&&(e.level=o),c&&e.type!=="transaction"&&(e.transaction=c)}function Cy(e,t){let r=[...e.breadcrumbs||[],...t];e.breadcrumbs=r.length?r:void 0}function xy(e,t){e.sdkProcessingMetadata=w(w({},e.sdkProcessingMetadata),t)}function Dy(e,t){e.contexts=w({trace:nm(t)},e.contexts),e.sdkProcessingMetadata=w({dynamicSamplingContext:om(t)},e.sdkProcessingMetadata);let r=lo(t),n=mn(r).description;n&&!e.transaction&&e.type==="transaction"&&(e.transaction=n)}function Ry(e,t){e.fingerprint=e.fingerprint?ws(e.fingerprint):[],t&&(e.fingerprint=e.fingerprint.concat(t)),e.fingerprint&&!e.fingerprint.length&&delete e.fingerprint}function pm(e,t,r,n,i,s){let{normalizeDepth:o=3,normalizeMaxBreadth:c=1e3}=e,u=ee(w({},t),{event_id:t.event_id||r.event_id||nt(),timestamp:t.timestamp||vr()}),p=r.integrations||e.integrations.map(_=>_.name);Ay(u,e),Py(u,p),i&&i.emit("applyFrameMetadata",t),t.type===void 0&&Ny(u,e.stackParser);let m=By(n,r.captureContext);r.mechanism&&Nr(u,r.mechanism);let h=i?i.getEventProcessors():[],y=As().getScopeData();if(s){let _=s.getScopeData();ql(y,_)}if(m){let _=m.getScopeData();ql(y,_)}let E=[...r.attachments||[],...y.attachments];E.length&&(r.attachments=E),lm(u,y);let v=[...h,...y.eventProcessors];return Ps(v,u,r).then(_=>(_&&Oy(_),typeof o=="number"&&o>0?Ly(_,o,c):_))}function Ay(e,t){let{environment:r,release:n,dist:i,maxValueLength:s=250}=t;"environment"in e||(e.environment="environment"in t?r:Os),e.release===void 0&&n!==void 0&&(e.release=n),e.dist===void 0&&i!==void 0&&(e.dist=i),e.message&&(e.message=dr(e.message,s));let o=e.exception&&e.exception.values&&e.exception.values[0];o&&o.value&&(o.value=dr(o.value,s));let c=e.request;c&&c.url&&(c.url=dr(c.url,s))}var um=new WeakMap;function Ny(e,t){let r=te._sentryDebugIds;if(!r)return;let n,i=um.get(t);i?n=i:(n=new Map,um.set(t,n));let s=Object.entries(r).reduce((o,[c,u])=>{let p,m=n.get(c);m?p=m:(p=t(c),n.set(c,p));for(let h=p.length-1;h>=0;h--){let y=p[h];if(y.filename){o[y.filename]=u;break}}return o},{});try{e.exception.values.forEach(o=>{o.stacktrace.frames.forEach(c=>{c.filename&&(c.debug_id=s[c.filename])})})}catch{}}function Oy(e){let t={};try{e.exception.values.forEach(n=>{n.stacktrace.frames.forEach(i=>{i.debug_id&&(i.abs_path?t[i.abs_path]=i.debug_id:i.filename&&(t[i.filename]=i.debug_id),delete i.debug_id)})})}catch{}if(Object.keys(t).length===0)return;e.debug_meta=e.debug_meta||{},e.debug_meta.images=e.debug_meta.images||[];let r=e.debug_meta.images;Object.entries(t).forEach(([n,i])=>{r.push({type:"sourcemap",code_file:n,debug_id:i})})}function Py(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}function Ly(e,t,r){if(!e)return null;let n=w(w(w(w(w({},e),e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map(i=>w(w({},i),i.data&&{data:ir(i.data,t,r)}))}),e.user&&{user:ir(e.user,t,r)}),e.contexts&&{contexts:ir(e.contexts,t,r)}),e.extra&&{extra:ir(e.extra,t,r)});return e.contexts&&e.contexts.trace&&n.contexts&&(n.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(n.contexts.trace.data=ir(e.contexts.trace.data,t,r))),e.spans&&(n.spans=e.spans.map(i=>w(w({},i),i.data&&{data:ir(i.data,t,r)}))),n}function By(e,t){if(!t)return e;let r=e?e.clone():new mt;return r.update(t),r}function fm(e){if(e)return Uy(e)?{captureContext:e}:My(e)?{captureContext:e}:e}function Uy(e){return e instanceof mt||typeof e=="function"}var ky=["user","level","extra","contexts","tags","fingerprint","requestSession","propagationContext"];function My(e){return Object.keys(e).some(t=>ky.includes(t))}function Ls(e,t){return pn().captureException(e,fm(t))}function po(e,t){return pn().captureEvent(e,t)}var Fy="7";function Hy(e){let t=e.protocol?`${e.protocol}:`:"",r=e.port?`:${e.port}`:"";return`${t}//${e.host}${r}${e.path?`/${e.path}`:""}/api/`}function $y(e){return`${Hy(e)}${e.projectId}/envelope/`}function jy(e,t){return ml(w({sentry_key:e.publicKey,sentry_version:Fy},t&&{sentry_client:`${t.name}/${t.version}`}))}function dm(e,t,r){return t||`${$y(e)}?${jy(e,r)}`}var hm=[];function gm(e,t){let r={};return t.forEach(n=>{n&&Xl(e,n,r)}),r}function Kl(e,t){for(let r of t)r&&r.afterAllSetup&&r.afterAllSetup(e)}function Xl(e,t,r){if(r[t.name]){Re&&K.log(`Integration skipped because it was already installed: ${t.name}`);return}if(r[t.name]=t,hm.indexOf(t.name)===-1&&typeof t.setupOnce=="function"&&(t.setupOnce(),hm.push(t.name)),t.setup&&typeof t.setup=="function"&&t.setup(e),typeof t.preprocessEvent=="function"){let n=t.preprocessEvent.bind(t);e.on("preprocessEvent",(i,s)=>n(i,s,e))}if(typeof t.processEvent=="function"){let n=t.processEvent.bind(t),i=Object.assign((s,o)=>n(s,o,e),{id:t.name});e.addEventProcessor(i)}Re&&K.log(`Integration installed: ${t.name}`)}var ym="Not capturing exception because it's already been captured.",fo=class{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],e.dsn?this._dsn=ms(e.dsn):Re&&K.warn("No DSN provided, client will not send events."),this._dsn){let t=dm(this._dsn,e.tunnel,e._metadata?e._metadata.sdk:void 0);this._transport=e.transport(ee(w({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this)},e.transportOptions),{url:t}))}}captureException(e,t,r){let n=nt();if(Ss(e))return Re&&K.log(ym),n;let i=w({event_id:n},t);return this._process(this.eventFromException(e,i).then(s=>this._captureEvent(s,i,r))),i.event_id}captureMessage(e,t,r,n){let i=w({event_id:nt()},r),s=ti(e)?e:String(e),o=an(e)?this.eventFromMessage(s,t,i):this.eventFromException(e,i);return this._process(o.then(c=>this._captureEvent(c,i,n))),i.event_id}captureEvent(e,t,r){let n=nt();if(t&&t.originalException&&Ss(t.originalException))return Re&&K.log(ym),n;let i=w({event_id:n},t),s=(e.sdkProcessingMetadata||{}).capturedSpanScope;return this._process(this._captureEvent(e,i,s||r)),i.event_id}captureSession(e){typeof e.release!="string"?Re&&K.warn("Discarded session because of missing or non-string release"):(this.sendSession(e),co(e,{init:!1}))}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}flush(e){let t=this._transport;return t?(this.emit("flush"),this._isClientDoneProcessing(e).then(r=>t.flush(e).then(n=>r&&n))):Vt(!0)}close(e){return this.flush(e).then(t=>(this.getOptions().enabled=!1,this.emit("close"),t))}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}init(){this._isEnabled()&&this._setupIntegrations()}getIntegrationByName(e){return this._integrations[e]}addIntegration(e){let t=this._integrations[e.name];Xl(this,e,this._integrations),t||Kl(this,[e])}sendEvent(e,t={}){this.emit("beforeSendEvent",e,t);let r=cm(e,this._dsn,this._options._metadata,this._options.tunnel);for(let i of t.attachments||[])r=Al(r,Ol(i));let n=this.sendEnvelope(r);n&&n.then(i=>this.emit("afterSendEvent",e,i),null)}sendSession(e){let t=am(e,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(t)}recordDroppedEvent(e,t,r){if(this._options.sendClientReports){let n=`${e}:${t}`;Re&&K.log(`Adding outcome: "${n}"`),this._outcomes[n]=(this._outcomes[n]||0)+1}}on(e,t){let r=this._hooks[e]=this._hooks[e]||[];return r.push(t),()=>{let n=r.indexOf(t);n>-1&&r.splice(n,1)}}emit(e,...t){let r=this._hooks[e];r&&r.forEach(n=>n(...t))}sendEnvelope(e){return this.emit("beforeEnvelope",e),this._isEnabled()&&this._transport?this._transport.send(e).then(null,t=>(Re&&K.error("Error while sending event:",t),t)):(Re&&K.error("Transport disabled"),Vt({}))}_setupIntegrations(){let{integrations:e}=this._options;this._integrations=gm(this,e),Kl(this,e)}_updateSessionFromEvent(e,t){let r=!1,n=!1,i=t.exception&&t.exception.values;if(i){n=!0;for(let o of i){let c=o.mechanism;if(c&&c.handled===!1){r=!0;break}}}let s=e.status==="ok";(s&&e.errors===0||s&&r)&&(co(e,ee(w({},r&&{status:"crashed"}),{errors:e.errors||Number(n||r)})),this.captureSession(e))}_isClientDoneProcessing(e){return new or(t=>{let r=0,n=1,i=setInterval(()=>{this._numProcessing==0?(clearInterval(i),t(!0)):(r+=n,e&&r>=e&&(clearInterval(i),t(!1)))},n)})}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(e,t,r,n=fn()){let i=this.getOptions(),s=Object.keys(this._integrations);return!t.integrations&&s.length>0&&(t.integrations=s),this.emit("preprocessEvent",e,t),e.type||n.setLastEventId(e.event_id||t.event_id),pm(i,e,t,r,this,n).then(o=>{if(o===null)return o;let c=w(w({},n.getPropagationContext()),r?r.getPropagationContext():void 0);if(!(o.contexts&&o.contexts.trace)&&c){let{traceId:u,spanId:p,parentSpanId:m,dsc:h}=c;o.contexts=w({trace:Ze({trace_id:u,span_id:p,parent_span_id:m})},o.contexts);let y=h||zl(u,this);o.sdkProcessingMetadata=w({dynamicSamplingContext:y},o.sdkProcessingMetadata)}return o})}_captureEvent(e,t={},r){return this._processEvent(e,t,r).then(n=>n.event_id,n=>{if(Re){let i=n;i.logLevel==="log"?K.log(i.message):K.warn(i)}})}_processEvent(e,t,r){let n=this.getOptions(),{sampleRate:i}=n,s=Jl(e),o=vm(e),c=e.type||"error",u=`before send for type \`${c}\``,p=typeof i>"u"?void 0:sm(i);if(o&&typeof p=="number"&&Math.random()>p)return this.recordDroppedEvent("sample_rate","error",e),zr(new ft(`Discarding event because it's not included in the random sample (sampling rate = ${i})`,"log"));let m=c==="replay_event"?"replay":c,h=(e.sdkProcessingMetadata||{}).capturedSpanIsolationScope;return this._prepareEvent(e,t,r,h).then(y=>{if(y===null)throw this.recordDroppedEvent("event_processor",m,e),new ft("An event processor returned `null`, will not send event.","log");if(t.data&&t.data.__sentry__===!0)return y;let E=Gy(this,n,y,t);return Wy(E,u)}).then(y=>{if(y===null){if(this.recordDroppedEvent("before_send",m,e),Jl(e)){let _=1+(e.spans||[]).length;this._outcomes.span=(this._outcomes.span||0)+_}throw new ft(`${u} returned \`null\`, will not send event.`,"log")}let E=r&&r.getSession();!s&&E&&this._updateSessionFromEvent(E,y);let v=y.transaction_info;if(s&&v&&y.transaction!==e.transaction){let _="custom";y.transaction_info=ee(w({},v),{source:_})}return this.sendEvent(y,t),y}).then(null,y=>{throw y instanceof ft?y:(this.captureException(y,{data:{__sentry__:!0},originalException:y}),new ft(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
|
|
26
|
+
Reason: ${y}`))})}_process(e){this._numProcessing++,e.then(t=>(this._numProcessing--,t),t=>(this._numProcessing--,t))}_clearOutcomes(){let e=this._outcomes;return this._outcomes={},Object.entries(e).map(([t,r])=>{let[n,i]=t.split(":");return{reason:n,category:i,quantity:r}})}};function Wy(e,t){let r=`${t} must return \`null\` or a valid event.`;if(Ar(e))return e.then(n=>{if(!rr(n)&&n!==null)throw new ft(r);return n},n=>{throw new ft(`${t} rejected with ${n}`)});if(!rr(e)&&e!==null)throw new ft(r);return e}function Gy(e,t,r,n){let{beforeSend:i,beforeSendTransaction:s,beforeSendSpan:o}=t;if(vm(r)&&i)return i(r,n);if(Jl(r)){if(r.spans&&o){let c=[];for(let u of r.spans){let p=o(u);p?c.push(p):e.recordDroppedEvent("before_send","span")}r.spans=c}if(s)return s(r,n)}return r}function vm(e){return e.type===void 0}function Jl(e){return e.type==="transaction"}var Vy=64;function Bs(e,t,r=Cl(e.bufferSize||Vy)){let n={},i=o=>r.drain(o);function s(o){let c=[];if(Is(o,(h,y)=>{let E=Ts(y);if(Bl(n,E)){let v=_m(h,y);e.recordDroppedEvent("ratelimit_backoff",E,v)}else c.push(h)}),c.length===0)return Vt({});let u=_r(o[0],c),p=h=>{Is(u,(y,E)=>{let v=_m(y,E);e.recordDroppedEvent(h,Ts(E),v)})},m=()=>t({body:Nl(u)}).then(h=>(h.statusCode!==void 0&&(h.statusCode<200||h.statusCode>=300)&&Re&&K.warn(`Sentry responded with status code ${h.statusCode} to sent event.`),n=Ul(n,h),h),h=>{throw p("network_error"),h});return r.add(m).then(h=>h,h=>{if(h instanceof ft)return Re&&K.error("Skipped sending event because buffer is full."),p("queue_overflow"),Vt({});throw h})}return{send:s,flush:i}}function _m(e,t){if(!(t!=="event"&&t!=="transaction"))return Array.isArray(e)?e[1]:void 0}function Ql(e,t,r=[t],n="npm"){let i=e._metadata||{};i.sdk||(i.sdk={name:`sentry.javascript.${t}`,packages:r.map(s=>({name:`${n}:@sentry/${s}`,version:Wt})),version:Wt}),e._metadata=i}var Yy=100;function Er(e,t){let r=Fe(),n=fn();if(!r)return;let{beforeBreadcrumb:i=null,maxBreadcrumbs:s=Yy}=r.getOptions();if(s<=0)return;let o=vr(),c=w({timestamp:o},e),u=i?oi(()=>i(c,t)):c;u!==null&&(r.emit&&r.emit("beforeAddBreadcrumb",u,t),n.addBreadcrumb(u,s))}var Em,zy="FunctionToString",Sm=new WeakMap,qy=()=>({name:zy,setupOnce(){Em=Function.prototype.toString;try{Function.prototype.toString=function(...e){let t=ln(this),r=Sm.has(Fe())&&t!==void 0?t:this;return Em.apply(r,e)}}catch{}},setup(e){Sm.set(e,!0)}}),Us=qy,Ky=[/^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"],Xy="InboundFilters",Jy=(e={})=>({name:Xy,processEvent(t,r,n){let i=n.getOptions(),s=Qy(e,i);return Zy(t,s)?null:t}}),Ms=Jy;function Qy(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:Ky],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[]],ignoreInternal:e.ignoreInternal!==void 0?e.ignoreInternal:!0}}function Zy(e,t){return t.ignoreInternal&&ov(e)?(Re&&K.warn(`Event dropped due to being internal Sentry Error.
|
|
27
|
+
Event: ${nr(e)}`),!0):ev(e,t.ignoreErrors)?(Re&&K.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
|
|
28
|
+
Event: ${nr(e)}`),!0):av(e)?(Re&&K.warn(`Event dropped due to not having an error message, error type or stacktrace.
|
|
29
|
+
Event: ${nr(e)}`),!0):tv(e,t.ignoreTransactions)?(Re&&K.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
|
|
30
|
+
Event: ${nr(e)}`),!0):rv(e,t.denyUrls)?(Re&&K.warn(`Event dropped due to being matched by \`denyUrls\` option.
|
|
31
|
+
Event: ${nr(e)}.
|
|
32
|
+
Url: ${ks(e)}`),!0):nv(e,t.allowUrls)?!1:(Re&&K.warn(`Event dropped due to not being matched by \`allowUrls\` option.
|
|
33
|
+
Event: ${nr(e)}.
|
|
34
|
+
Url: ${ks(e)}`),!0)}function ev(e,t){return e.type||!t||!t.length?!1:iv(e).some(r=>ri(r,t))}function tv(e,t){if(e.type!=="transaction"||!t||!t.length)return!1;let r=e.transaction;return r?ri(r,t):!1}function rv(e,t){if(!t||!t.length)return!1;let r=ks(e);return r?ri(r,t):!1}function nv(e,t){if(!t||!t.length)return!0;let r=ks(e);return r?ri(r,t):!0}function iv(e){let t=[];e.message&&t.push(e.message);let r;try{r=e.exception.values[e.exception.values.length-1]}catch{}return r&&r.value&&(t.push(r.value),r.type&&t.push(`${r.type}: ${r.value}`)),t}function ov(e){try{return e.exception.values[0].type==="SentryError"}catch{}return!1}function sv(e=[]){for(let t=e.length-1;t>=0;t--){let r=e[t];if(r&&r.filename!=="<anonymous>"&&r.filename!=="[native code]")return r.filename||null}return null}function ks(e){try{let t;try{t=e.exception.values[0].stacktrace.frames}catch{}return t?sv(t):null}catch{return Re&&K.error(`Cannot extract url for event ${nr(e)}`),null}}function av(e){return e.type||!e.exception||!e.exception.values||e.exception.values.length===0?!1:!e.message&&!e.exception.values.some(t=>t.stacktrace||t.type&&t.type!=="Error"||t.value)}var cv="Dedupe",lv=()=>{let e;return{name:cv,processEvent(t){if(t.type)return t;try{if(uv(t,e))return Re&&K.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return e=t}}},Fs=lv;function uv(e,t){return t?!!(pv(e,t)||fv(e,t)):!1}function pv(e,t){let r=e.message,n=t.message;return!(!r&&!n||r&&!n||!r&&n||r!==n||!Im(e,t)||!bm(e,t))}function fv(e,t){let r=wm(t),n=wm(e);return!(!r||!n||r.type!==n.type||r.value!==n.value||!Im(e,t)||!bm(e,t))}function bm(e,t){let r=ys(e),n=ys(t);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 s=n[i],o=r[i];if(s.filename!==o.filename||s.lineno!==o.lineno||s.colno!==o.colno||s.function!==o.function)return!1}return!0}function Im(e,t){let r=e.fingerprint,n=t.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 wm(e){return e.exception&&e.exception.values&&e.exception.values[0]}var Ye=te,Zl=0;function eu(){return Zl>0}function Tv(){Zl++,setTimeout(()=>{Zl--})}function dn(e,t={},r){if(typeof e!="function")return e;try{let i=e.__sentry_wrapped__;if(i)return i;if(ln(e))return e}catch{return e}let n=function(){let i=Array.prototype.slice.call(arguments);try{r&&typeof r=="function"&&r.apply(this,arguments);let s=i.map(o=>dn(o,t));return e.apply(this,s)}catch(s){throw Tv(),Ns(o=>{o.addEventProcessor(c=>(t.mechanism&&(si(c,void 0,void 0),Nr(c,t.mechanism)),c.extra=ee(w({},c.extra),{arguments:i}),c)),Ls(s)}),s}};try{for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i])}catch{}ds(n,e),wt(e,"__sentry_wrapped__",n);try{Object.getOwnPropertyDescriptor(n,"name").configurable&&Object.defineProperty(n,"name",{get(){return e.name}})}catch{}return n}var Pr=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function Hs(e,t){let r=nu(e,t),n={type:t&&t.name,value:Av(t)};return r.length&&(n.stacktrace={frames:r}),n.type===void 0&&n.value===""&&(n.value="Unrecoverable error caught"),n}function Cv(e,t,r,n){let i=Fe(),s=i&&i.getOptions().normalizeDepth,o=Pv(t),c={__serialized__:bs(t,s)};if(o)return{exception:{values:[Hs(e,o)]},extra:c};let u={exception:{values:[{type:cn(t)?t.constructor.name:n?"UnhandledRejection":"Error",value:Nv(t,{isUnhandledRejection:n})}]},extra:c};if(r){let p=nu(e,r);p.length&&(u.exception.values[0].stacktrace={frames:p})}return u}function tu(e,t){return{exception:{values:[Hs(e,t)]}}}function nu(e,t){let r=t.stacktrace||t.stack||"",n=Dv(t),i=Rv(t);try{return e(r,n,i)}catch{}return[]}var xv=/Minified React error #\d+;/i;function Dv(e){return e&&xv.test(e.message)?1:0}function Rv(e){return typeof e.framesToPop=="number"?e.framesToPop:0}function Av(e){let t=e&&e.message;return t?t.error&&typeof t.error.message=="string"?t.error.message:t:"No error message"}function Dm(e,t,r,n){let i=r&&r.syntheticException||void 0,s=$s(e,t,i,n);return Nr(s),s.level="error",r&&r.event_id&&(s.event_id=r.event_id),Vt(s)}function Rm(e,t,r="info",n,i){let s=n&&n.syntheticException||void 0,o=ru(e,t,s,i);return o.level=r,n&&n.event_id&&(o.event_id=n.event_id),Vt(o)}function $s(e,t,r,n,i){let s;if(us(t)&&t.error)return tu(e,t.error);if(ps(t)||nl(t)){let o=t;if("stack"in t)s=tu(e,t);else{let c=o.name||(ps(o)?"DOMError":"DOMException"),u=o.message?`${c}: ${o.message}`:c;s=ru(e,u,r,n),si(s,u)}return"code"in o&&(s.tags=ee(w({},s.tags),{"DOMException.code":`${o.code}`})),s}return sn(t)?tu(e,t):rr(t)||cn(t)?(s=Cv(e,t,r,i),Nr(s,{synthetic:!0}),s):(s=ru(e,t,r,n),si(s,`${t}`,void 0),Nr(s,{synthetic:!0}),s)}function ru(e,t,r,n){let i={};if(n&&r){let s=nu(e,r);s.length&&(i.exception={values:[{value:t,stacktrace:{frames:s}}]})}if(ti(t)){let{__sentry_template_string__:s,__sentry_template_values__:o}=t;return i.logentry={message:s,params:o},i}return i.message=t,i}function Nv(e,{isUnhandledRejection:t}){let r=dl(e),n=t?"promise rejection":"exception";return us(e)?`Event \`ErrorEvent\` captured as ${n} with message \`${e.message}\``:cn(e)?`Event \`${Ov(e)}\` (type=${e.type}) captured as ${n}`:`Object captured as ${n} with keys: ${r}`}function Ov(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function Pv(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let r=e[t];if(r instanceof Error)return r}}function Am(e,{metadata:t,tunnel:r,dsn:n}){let i=w(w({event_id:e.event_id,sent_at:new Date().toISOString()},t&&t.sdk&&{sdk:{name:t.sdk.name,version:t.sdk.version}}),!!r&&!!n&&{dsn:gr(n)}),s=Lv(e);return _r(i,[s])}function Lv(e){return[{type:"user_report"},e]}var mo=class extends fo{constructor(e){let t=w({parentSpanIsAlwaysRootSpan:!0},e),r=Ye.SENTRY_SDK_SOURCE||Il();Ql(t,"browser",["browser"],r),super(t),t.sendClientReports&&Ye.document&&Ye.document.addEventListener("visibilitychange",()=>{Ye.document.visibilityState==="hidden"&&this._flushOutcomes()})}eventFromException(e,t){return Dm(this._options.stackParser,e,t,this._options.attachStacktrace)}eventFromMessage(e,t="info",r){return Rm(this._options.stackParser,e,t,r,this._options.attachStacktrace)}captureUserFeedback(e){if(!this._isEnabled()){Pr&&K.warn("SDK not enabled, will not capture user feedback.");return}let t=Am(e,{metadata:this.getSdkMetadata(),dsn:this.getDsn(),tunnel:this.getOptions().tunnel});this.sendEnvelope(t)}_prepareEvent(e,t,r){return e.platform=e.platform||"javascript",super._prepareEvent(e,t,r)}_flushOutcomes(){let e=this._clearOutcomes();if(e.length===0){Pr&&K.log("No outcomes to send");return}if(!this._dsn){Pr&&K.log("No dsn provided, will not send outcomes");return}Pr&&K.log("Sending outcomes:",e);let t=Ll(e,this._options.tunnel&&gr(this._dsn));this.sendEnvelope(t)}},Nm=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,Ke=te,Bv=1e3,Om,iu,ou;function su(e){let t="dom";bt(t,e),It(t,Uv)}function Uv(){if(!Ke.document)return;let e=et.bind(null,"dom"),t=Pm(e,!0);Ke.document.addEventListener("click",t,!1),Ke.document.addEventListener("keypress",t,!1),["EventTarget","Node"].forEach(r=>{let n=Ke[r]&&Ke[r].prototype;!n||!n.hasOwnProperty||!n.hasOwnProperty("addEventListener")||(Ue(n,"addEventListener",function(i){return function(s,o,c){if(s==="click"||s=="keypress")try{let u=this,p=u.__sentry_instrumentation_handlers__=u.__sentry_instrumentation_handlers__||{},m=p[s]=p[s]||{refCount:0};if(!m.handler){let h=Pm(e);m.handler=h,i.call(this,s,h,c)}m.refCount++}catch{}return i.call(this,s,o,c)}}),Ue(n,"removeEventListener",function(i){return function(s,o,c){if(s==="click"||s=="keypress")try{let u=this,p=u.__sentry_instrumentation_handlers__||{},m=p[s];m&&(m.refCount--,m.refCount<=0&&(i.call(this,s,m.handler,c),m.handler=void 0,delete p[s]),Object.keys(p).length===0&&delete u.__sentry_instrumentation_handlers__)}catch{}return i.call(this,s,o,c)}}))})}function kv(e){if(e.type!==iu)return!1;try{if(!e.target||e.target._sentryId!==ou)return!1}catch{}return!0}function Mv(e,t){return e!=="keypress"?!1:!t||!t.tagName?!0:!(t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.isContentEditable)}function Pm(e,t=!1){return r=>{if(!r||r._sentryCaptured)return;let n=Fv(r);if(Mv(r.type,n))return;wt(r,"_sentryCaptured",!0),n&&!n._sentryId&&wt(n,"_sentryId",nt());let i=r.type==="keypress"?"input":r.type;kv(r)||(e({event:r,name:i,global:t}),iu=r.type,ou=n?n._sentryId:void 0),clearTimeout(Om),Om=Ke.setTimeout(()=>{ou=void 0,iu=void 0},Bv)}}function Fv(e){try{return e.target}catch{return null}}var js;function au(e){let t="history";bt(t,e),It(t,Hv)}function Hv(){if(!kl())return;let e=Ke.onpopstate;Ke.onpopstate=function(...r){let n=Ke.location.href,i=js;if(js=n,et("history",{from:i,to:n}),e)try{return e.apply(this,r)}catch{}};function t(r){return function(...n){let i=n.length>2?n[2]:void 0;if(i){let s=js,o=String(i);js=o,et("history",{from:s,to:o})}return r.apply(this,n)}}Ue(Ke.history,"pushState",t),Ue(Ke.history,"replaceState",t)}var Ws={};function cu(e){let t=Ws[e];if(t)return t;let r=Ke[e];if(io(r))return Ws[e]=r.bind(Ke);let n=Ke.document;if(n&&typeof n.createElement=="function")try{let i=n.createElement("iframe");i.hidden=!0,n.head.appendChild(i);let s=i.contentWindow;s&&s[e]&&(r=s[e]),n.head.removeChild(i)}catch(i){Nm&&K.warn(`Could not create sandbox iframe for ${e} check, bailing to window.${e}: `,i)}return r&&(Ws[e]=r.bind(Ke))}function Gs(e){Ws[e]=void 0}var hn="__sentry_xhr_v3__";function lu(e){let t="xhr";bt(t,e),It(t,$v)}function $v(){if(!Ke.XMLHttpRequest)return;let e=XMLHttpRequest.prototype;Ue(e,"open",function(t){return function(...r){let n=Bt()*1e3,i=St(r[0])?r[0].toUpperCase():void 0,s=jv(r[1]);if(!i||!s)return t.apply(this,r);this[hn]={method:i,url:s,request_headers:{}},i==="POST"&&s.match(/sentry_key/)&&(this.__sentry_own_request__=!0);let o=()=>{let c=this[hn];if(c&&this.readyState===4){try{c.status_code=this.status}catch{}let u={endTimestamp:Bt()*1e3,startTimestamp:n,xhr:this};et("xhr",u)}};return"onreadystatechange"in this&&typeof this.onreadystatechange=="function"?Ue(this,"onreadystatechange",function(c){return function(...u){return o(),c.apply(this,u)}}):this.addEventListener("readystatechange",o),Ue(this,"setRequestHeader",function(c){return function(...u){let[p,m]=u,h=this[hn];return h&&St(p)&&St(m)&&(h.request_headers[p.toLowerCase()]=m),c.apply(this,u)}}),t.apply(this,r)}}),Ue(e,"send",function(t){return function(...r){let n=this[hn];if(!n)return t.apply(this,r);r[0]!==void 0&&(n.body=r[0]);let i={startTimestamp:Bt()*1e3,xhr:this};return et("xhr",i),t.apply(this,r)}})}function jv(e){if(St(e))return e;try{return e.toString()}catch{}}function uu(e,t=cu("fetch")){let r=0,n=0;function i(s){let o=s.body.length;r+=o,n++;let c=w({body:s.body,method:"POST",referrerPolicy:"origin",headers:e.headers,keepalive:r<=6e4&&n<15},e.fetchOptions);if(!t)return Gs("fetch"),zr("No fetch implementation available");try{return t(e.url,c).then(u=>(r-=o,n--,{statusCode:u.status,headers:{"x-sentry-rate-limits":u.headers.get("X-Sentry-Rate-Limits"),"retry-after":u.headers.get("Retry-After")}}))}catch(u){return Gs("fetch"),r-=o,n--,zr(u)}}return Bs(e,i)}var Wv=30,Gv=50;function pu(e,t,r,n){let i={filename:e,function:t==="<anonymous>"?yr:t,in_app:!0};return r!==void 0&&(i.lineno=r),n!==void 0&&(i.colno=n),i}var Vv=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Yv=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,zv=/\((\S*)(?::(\d+))(?::(\d+))\)/,qv=e=>{let t=Vv.exec(e);if(t){let[,n,i,s]=t;return pu(n,yr,+i,+s)}let r=Yv.exec(e);if(r){if(r[2]&&r[2].indexOf("eval")===0){let s=zv.exec(r[2]);s&&(r[2]=s[1],r[3]=s[2],r[4]=s[3])}let[n,i]=km(r[1]||yr,r[2]);return pu(i,n,r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},Lm=[Wv,qv],Kv=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Xv=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Jv=e=>{let t=Kv.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){let i=Xv.exec(t[3]);i&&(t[1]=t[1]||"eval",t[3]=i[1],t[4]=i[2],t[5]="")}let r=t[3],n=t[1]||yr;return[n,r]=km(n,r),pu(r,n,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}},Bm=[Gv,Jv],Um=[Lm,Bm],fu=gl(...Um),km=(e,t)=>{let r=e.indexOf("safari-extension")!==-1,n=e.indexOf("safari-web-extension")!==-1;return r||n?[e.indexOf("@")!==-1?e.split("@")[0]:yr,r?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},Vs=1024,Zv="Breadcrumbs",e_=(e={})=>{let t=w({console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0},e);return{name:Zv,setup(r){t.console&&yl(n_(r)),t.dom&&su(r_(r,t.dom)),t.xhr&&lu(i_(r)),t.fetch&&Sl(o_(r)),t.history&&au(s_(r)),t.sentry&&r.on("beforeSendEvent",t_(r))}}},Mm=e_;function t_(e){return function(t){Fe()===e&&Er({category:`sentry.${t.type==="transaction"?"transaction":"event"}`,event_id:t.event_id,level:t.level,message:nr(t)},{event:t})}}function r_(e,t){return function(r){if(Fe()!==e)return;let n,i,s=typeof t=="object"?t.serializeAttribute:void 0,o=typeof t=="object"&&typeof t.maxStringLength=="number"?t.maxStringLength:void 0;o&&o>Vs&&(Pr&&K.warn(`\`dom.maxStringLength\` cannot exceed ${Vs}, but a value of ${o} was configured. Sentry will use ${Vs} instead.`),o=Vs),typeof s=="string"&&(s=[s]);try{let u=r.event,p=a_(u)?u.target:u;n=ro(p,{keyAttrs:s,maxStringLength:o}),i=pl(p)}catch{n="<unknown>"}if(n.length===0)return;let c={category:`ui.${r.name}`,message:n};i&&(c.data={"ui.component_name":i}),Er(c,{event:r.event,name:r.name,global:r.global})}}function n_(e){return function(t){if(Fe()!==e)return;let r={category:"console",data:{arguments:t.args,logger:"console"},level:xl(t.level),message:fs(t.args," ")};if(t.level==="assert")if(t.args[0]===!1)r.message=`Assertion failed: ${fs(t.args.slice(1)," ")||"console.assert"}`,r.data.arguments=t.args.slice(1);else return;Er(r,{input:t.args,level:t.level})}}function i_(e){return function(t){if(Fe()!==e)return;let{startTimestamp:r,endTimestamp:n}=t,i=t.xhr[hn];if(!r||!n||!i)return;let{method:s,url:o,status_code:c,body:u}=i,p={method:s,url:o,status_code:c},m={xhr:t.xhr,input:u,startTimestamp:r,endTimestamp:n};Er({category:"xhr",data:p,type:"http"},m)}}function o_(e){return function(t){if(Fe()!==e)return;let{startTimestamp:r,endTimestamp:n}=t;if(n&&!(t.fetchData.url.match(/sentry_key/)&&t.fetchData.method==="POST"))if(t.error){let i=t.fetchData,s={data:t.error,input:t.args,startTimestamp:r,endTimestamp:n};Er({category:"fetch",data:i,level:"error",type:"http"},s)}else{let i=t.response,s=ee(w({},t.fetchData),{status_code:i&&i.status}),o={input:t.args,response:i,startTimestamp:r,endTimestamp:n};Er({category:"fetch",data:s,type:"http"},o)}}}function s_(e){return function(t){if(Fe()!==e)return;let r=t.from,n=t.to,i=so(Ye.location.href),s=r?so(r):void 0,o=so(n);(!s||!s.path)&&(s=i),i.protocol===o.protocol&&i.host===o.host&&(n=o.relative),i.protocol===s.protocol&&i.host===s.host&&(r=s.relative),Er({category:"navigation",data:{from:r,to:n}})}}function a_(e){return!!e&&!!e.target}var c_=["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"],l_="BrowserApiErrors",u_=(e={})=>{let t=w({XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0},e);return{name:l_,setupOnce(){t.setTimeout&&Ue(Ye,"setTimeout",Fm),t.setInterval&&Ue(Ye,"setInterval",Fm),t.requestAnimationFrame&&Ue(Ye,"requestAnimationFrame",p_),t.XMLHttpRequest&&"XMLHttpRequest"in Ye&&Ue(XMLHttpRequest.prototype,"send",f_);let r=t.eventTarget;r&&(Array.isArray(r)?r:c_).forEach(m_)}}},Hm=u_;function Fm(e){return function(...t){let r=t[0];return t[0]=dn(r,{mechanism:{data:{function:Gt(e)},handled:!1,type:"instrument"}}),e.apply(this,t)}}function p_(e){return function(t){return e.apply(this,[dn(t,{mechanism:{data:{function:"requestAnimationFrame",handler:Gt(e)},handled:!1,type:"instrument"}})])}}function f_(e){return function(...t){let r=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(n=>{n in r&&typeof r[n]=="function"&&Ue(r,n,function(i){let s={mechanism:{data:{function:n,handler:Gt(i)},handled:!1,type:"instrument"}},o=ln(i);return o&&(s.mechanism.data.handler=Gt(o)),dn(i,s)})}),e.apply(this,t)}}function m_(e){let t=Ye,r=t[e]&&t[e].prototype;!r||!r.hasOwnProperty||!r.hasOwnProperty("addEventListener")||(Ue(r,"addEventListener",function(n){return function(i,s,o){try{typeof s.handleEvent=="function"&&(s.handleEvent=dn(s.handleEvent,{mechanism:{data:{function:"handleEvent",handler:Gt(s),target:e},handled:!1,type:"instrument"}}))}catch{}return n.apply(this,[i,dn(s,{mechanism:{data:{function:"addEventListener",handler:Gt(s),target:e},handled:!1,type:"instrument"}}),o])}}),Ue(r,"removeEventListener",function(n){return function(i,s,o){let c=s;try{let u=c&&c.__sentry_wrapped__;u&&n.call(this,i,u,o)}catch{}return n.call(this,i,c,o)}}))}var d_="GlobalHandlers",h_=(e={})=>{let t=w({onerror:!0,onunhandledrejection:!0},e);return{name:d_,setupOnce(){Error.stackTraceLimit=50},setup(r){t.onerror&&(g_(r),$m("onerror")),t.onunhandledrejection&&(y_(r),$m("onunhandledrejection"))}}},jm=h_;function g_(e){wl(t=>{let{stackParser:r,attachStacktrace:n}=Wm();if(Fe()!==e||eu())return;let{msg:i,url:s,line:o,column:c,error:u}=t,p=E_($s(r,u||i,void 0,n,!1),s,o,c);p.level="error",po(p,{originalException:u,mechanism:{handled:!1,type:"onerror"}})})}function y_(e){bl(t=>{let{stackParser:r,attachStacktrace:n}=Wm();if(Fe()!==e||eu())return;let i=v_(t),s=an(i)?__(i):$s(r,i,void 0,n,!0);s.level="error",po(s,{originalException:i,mechanism:{handled:!1,type:"onunhandledrejection"}})})}function v_(e){if(an(e))return e;try{if("reason"in e)return e.reason;if("detail"in e&&"reason"in e.detail)return e.detail.reason}catch{}return e}function __(e){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(e)}`}]}}}function E_(e,t,r,n){let i=e.exception=e.exception||{},s=i.values=i.values||[],o=s[0]=s[0]||{},c=o.stacktrace=o.stacktrace||{},u=c.frames=c.frames||[],p=isNaN(parseInt(n,10))?void 0:n,m=isNaN(parseInt(r,10))?void 0:r,h=St(t)&&t.length>0?t:ul();return u.length===0&&u.push({colno:p,filename:h,function:yr,in_app:!0,lineno:m}),e}function $m(e){Pr&&K.log(`Global Handler attached: ${e}`)}function Wm(){let e=Fe();return e&&e.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}var Gm=()=>({name:"HttpContext",preprocessEvent(e){if(!Ye.navigator&&!Ye.location&&!Ye.document)return;let t=e.request&&e.request.url||Ye.location&&Ye.location.href,{referrer:r}=Ye.document||{},{userAgent:n}=Ye.navigator||{},i=w(w(w({},e.request&&e.request.headers),r&&{Referer:r}),n&&{"User-Agent":n}),s=ee(w(w({},e.request),t&&{url:t}),{headers:i});e.request=s}}),S_="cause",w_=5,b_="LinkedErrors",I_=(e={})=>{let t=e.limit||w_,r=e.key||S_;return{name:b_,preprocessEvent(n,i,s){let o=s.getOptions();cl(Hs,o.stackParser,o.maxValueLength,r,t,n,i)}}},Vm=I_;function mu(e){return[Ms(),Us(),Hm(),Mm(),jm(),Vm(),Fs(),Gm()]}var du=class extends Error{cause;constructor(e,t){super(e),this.cause=t}},Be=class xh{static INSTANCE;contexts={};tags;client;user;constructor(){this.init()}static getInstance(){return this.INSTANCE||(this.INSTANCE=new xh),this.INSTANCE}captureException(t,r,n){b.error(t),this.getNewScope(r,n).captureException(t)}captureMessage(t,r,n,i){this.getNewScope(n,i).captureMessage(t,r??"error")}captureError(t,r,n,i){b.error(t,r);let s=this.getNewScope(n,i),o=new du(t,r);s.captureException(o)}setGlobalContext(t,r){this.contexts[t]=w({context:r},this.contexts[t])}setUser(t){this.user=t}setTags(t){this.tags=t}getNewScope(t,r){let n=new mt;if(n.setClient(this.client),n.setUser(this.user),t?.triggerContext){let i=t.triggerContext;n.setExtras(i.triggerData.sentryContext()),delete t.triggerContext}return t&&n.setExtras(t),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",re.getTimezone()),n}init(){let t=mu({}).filter(r=>!["BrowserApiErrors","Breadcrumbs","GlobalHandlers"].includes(r.name));this.client=new mo({dsn:"https://1bc3dda4c861f60cd6be1b67584f4bc6@o559187.ingest.us.sentry.io/4507626484203520",transport:uu,stackParser:fu,integrations:t,environment:tr.mode,release:`web-sdk@${N.SDK_VERSION}`,debug:tr.debug}),this.client.init()}},re=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,t){let r=e.indexOf(t);return r===-1?!1:(e.splice(r,1),!0)}static formatCurrency(e,t){if(e==0&&t)return"Free";let r=le.get(),n=Le.get(),i=r.shopCurrencyCode||n.currency,s=r.currencyCode;s||b.warn("Currency code is not set in RuntimeData");let o=n.money?.format??r.moneyFormat,c;if(o&&i===s)c=cs.format(e*100,o);else{let u;try{u=new Intl.NumberFormat(this.getLang(),{style:"currency",currency:s||i,minimumFractionDigits:0,maximumFractionDigits:2})}catch(p){return Be.getInstance().captureException(p,{currentCurrency:s,shopCurrency:i}),""}c=u.format(e),c=c.replace("\u20B9","Rs. "),n.money?.showCurrency&&s!=="INR"&&(c=c.concat(` ${s}`))}return c}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 t=document.createElement("span");t.id="snackbar",t.innerText=e,document.body.appendChild(t),t.className="show",setTimeout(()=>{t.classList.remove("show"),document.body.removeChild(t)},3e3)}static async retrySelectorForElements(e,t=10,r=document){let n=0,i=document.querySelectorAll("nonexistent-tag");for(;n<t;){let s=Math.min(100*2**n,5e3);if(await Ym.JSUtils.sleep(s),i=r.querySelectorAll(e),i.length)return b.debug(`Attempt ${n+1}: ${i.length} elements found with ${e}`),i;b.debug(`Attempt ${n+1}: Elements not found with ${e}. Retrying after ${s}ms.`),n++}return b.warn(`Max attempts reached. Element not found with ${e}.`),i}static async retrySelector(e,t=10,r=document){return(await this.retrySelectorForElements(e,t,r)).item(0)}static async getCartAttributes(){let e=await Oe.get(oe.DEVICE_ID),t=await rt.get(oe.ID,"");return[{key:"letscooee_did",value:e},{key:"letscooee_sid",value:t},{key:"__letscooee_time",value:new Date().toLocaleString()},{key:"__letscooee_via",value:"Buy Now"}]}};function ci(e,t,r){Object.defineProperty(e,t,{enumerable:!1,configurable:!1,writable:!1,value:r})}var Ys=class{url;alt;constructor(e){e.alt&&(this.alt=e.alt),this.url=e.url}},zs=class{d;cmp;effective;constructor(e={}){this.d=e.d,this.cmp=e.cmp,this.effective=this.d}},hu=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}},Sr=class{mID;name;imgs;link;price;sku;isAvailable;quantity;sellingPlans;selectedSellingPlan;effectivePrice;constructor(e){e=e??{},this.mID=e.mID,this.name=e.name,this.imgs=e.imgs?.map(t=>new Ys(t))??[],this.link=e.link,this.price=new zs(e.price),this.sku=e.sku,this.isAvailable=e.isAvailable,this.quantity=e.quantity,this.effectivePrice=$t(this.price.effective),e.sellingPlans?.length&&(this.selectedSellingPlan=$t(void 0)),this.sellingPlans=e.sellingPlans?.map(t=>{let r=new hu(t);return r.isSelected&&(this.selectedSellingPlan.value=r),r})}getOneImage(){return this.imgs[0]?.url}changeSellingPlan(e){this.selectedSellingPlan.value=e}},Rt=class{id;mID;name;status;ctg;imgs;videos;portraitVideos;vars;desc;sDesc;link;slug;quantity;category;meta;reviews;selectedOrFirstVariant;selected=$t(!0);constructor(e){this.update(e),this.selectedOrFirstVariant=$t(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.reviews=e.reviews,this.portraitVideos=e.videos?.filter(t=>t.orientation==="PORTRAIT"),e.vars&&(this.vars=e.vars.map(t=>new Sr(t))),this}toEmbed(e){return e=e??this.selectedOrFirstVariant.value,new pt({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})}},qs=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}},gu=class{enabled;constructor(e){this.enabled=e.enabled}},yu=class extends gu{max;min;constructor(e){e??={},super(e),this.min=e.min,this.max=e.max}},Ks=class{productQuantity;constructor(e){e??={},this.productQuantity=new yu(e.productQuantity)}},gn=class{s;g;i;constructor(e){e.s&&(this.s=new He(e.s)),e.g&&(this.g=new ho(e.g)),this.i=e.i}get solid(){return this.s}get glossy(){return this.g}get img(){return this.i}},go="a-f\\d",T_=`#?[${go}]{3}[${go}]?`,C_=`#?[${go}]{6}([${go}]{2})?`,x_=new RegExp(`[^#${go}]`,"gi"),D_=new RegExp(`^${T_}$|^${C_}$`,"i");function vu(e,t={}){if(typeof e!="string"||x_.test(e)||!D_.test(e))throw new TypeError("Expected a valid hex string");e=e.replace(/^#/,"");let r=1;e.length===8&&(r=Number.parseInt(e.slice(6,8),16)/255,e=e.slice(0,6)),e.length===4&&(r=Number.parseInt(e.slice(3,4).repeat(2),16)/255,e=e.slice(0,3)),e.length===3&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]);let n=Number.parseInt(e,16),i=n>>16,s=n>>8&255,o=n&255,c=typeof t.alpha=="number"?t.alpha:r;if(t.format==="array")return[i,s,o,c];if(t.format==="css"){let u=c===1?"":` / ${Number((c*100).toFixed(2))}%`;return`rgb(${i} ${s} ${o}${u})`}return{red:i,green:s,blue:o,alpha:c}}var He=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 vu(this.hex,{format:"css",alpha:this.getAlpha()})}catch(e){return console.error("Invalid hex",e),"#000000"}}getAlpha(){return(this.a??100)/100}},yn=class{s;r;w;c;constructor(e){this.s=e.s,this.r=e.r,this.w=e.w,e.c&&(this.c=new He(e.c))}get radius(){return this.r}get width(){return this.w}get color(){return this.c}get style(){return zm[this.s??1]}},zm=(e=>(e[e.SOLID=1]="SOLID",e[e.DASHED=2]="DASHED",e))(zm||{}),ho=class Dh{static DEFAULT_FALLBACK=new He({h:"#000000",a:50});r;c;fb;constructor(t){this.r=t.r,t.c&&(this.c=new He(t.c)),t.fb&&(this.fb=new He(t.fb))}get radius(){return this.r}get color(){return this.c}get fallback(){return this.fb??Dh.DEFAULT_FALLBACK}},yo=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 He(e.clr)}getStyle(e){return`${this.x*e}px ${this.y*e}px ${this.blur*e}px ${this.spr*e}px ${this.clr.rgba}`}},Lr=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`}},vn=class{rot;constructor(e){e?.rot&&(this.rot=e.rot)}get rotate(){return this.rot}},Ut=class{t;bg;br;clc;shd;spc;trf;a;w;h;x;y;constructor(e){this.t=e.t,e.bg&&(this.bg=new gn(e.bg)),e.br&&(this.br=new yn(e.br)),e.shd&&(this.shd=new yo(e.shd)),e.spc&&(this.spc=new Lr(e.spc)),this.trf=new vn(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 ke[this.t]}get click(){return this.clc}},ke=(e=>(e[e.IMAGE=1]="IMAGE",e[e.TEXT=2]="TEXT",e[e.BUTTON=3]="BUTTON",e[e.FLEXBOX=4]="FLEXBOX",e[e.MULTI_COLUMN=5]="MULTI_COLUMN",e[e.CHECKBOX=6]="CHECKBOX",e[e.PRODUCTS=11]="PRODUCTS",e[e.PRODUCT=12]="PRODUCT",e[e.PRODUCT_IMAGE=13]="PRODUCT_IMAGE",e[e.PRODUCT_TITLE=14]="PRODUCT_TITLE",e[e.PRODUCT_VARIATIONS=15]="PRODUCT_VARIATIONS",e[e.PRODUCT_VARIATIONS_SELLING_PLANS=16]="PRODUCT_VARIATIONS_SELLING_PLANS",e[e.PRODUCT_BUTTON=18]="PRODUCT_BUTTON",e[e.PRODUCT_RATING=19]="PRODUCT_RATING",e[e.EMAIL_INPUT=51]="EMAIL_INPUT",e[e.PHONE_INPUT=52]="PHONE_INPUT",e[e.COUNTDOWN_TIMER=61]="COUNTDOWN_TIMER",e[e.CAROUSEL=62]="CAROUSEL",e[e.SHAPE=100]="SHAPE",e))(ke||{}),_n=class extends Ut{constructor(e){super(e)}},Br=class extends Ut{src;constructor(e){super(e),this.src=e.src}},li=(e=>(e[e.START=0]="START",e[e.CENTER=1]="CENTER",e[e.END=2]="END",e[e.JUSTIFY=3]="JUSTIFY",e))(li||{}),Xs=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(t=>new _u(t))}},_u=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')`}},ct=class{fw;fs;fam;fmly;lh=1.2;ls;s;tc;ta;td;tdc;constructor(e){this.update(e)}get alignment(){return li[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 He(e.tdc)),this.td=e.td,this.fs=e.s??e.fs??60,this.tc=new He(e.tc),this.ta=e.ta??1,this.fw=e.fw??400,this.ls=e.ls??0,this.tc.h??="#000000",this.fam=new Xs(e.fam??e.fmly)}resize(e){this.s*=e,this.ls*=e}},wr=class extends Ut{typo;constructor(e){super(e);let t=w(w({},e.f),e.typo);e.alg&&(t.ta=e.alg),e.c&&(t.tc=e.c),this.typo=new ct(t)}get color(){return this.typography.tc}get typography(){return this.typo}},qr=class extends wr{prs;constructor(e){super(e),this.prs=e.prs}get parts(){return this.prs}},Js=class extends Ut{o;constructor(e){super(e),this.o=e.o??5,this.w=this.w??1080,this.h=this.h??1920}getOrigin(){return this.o}},ui=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,t){let r=new Date;e===2?(r.setSeconds(r.getSeconds()+this.ss),r.setMinutes(r.getMinutes()+this.mm),r.setHours(r.getHours()+this.hh),r.setDate(r.getDate()+this.dd)):r=this.date??new Date;let n=window.setInterval(()=>{let i=new Date().getTime(),s=r.getTime()-i;if(s<1){clearInterval(n);return}let o=Math.floor(s/(1e3*60*60*24)),c=Math.floor(s%(1e3*60*60*24)/(1e3*60*60)),u=Math.floor(s%(1e3*60*60)/(1e3*60)),p=Math.floor(s%(1e3*60)/1e3);t({days:o,hours:c,minutes:u,seconds:p})},1e3);return n}},pi=class extends wr{gap;timer;timerType;horizontal;lblPos;show;constructor(e){e??={},super(e),this.gap=e.gap,this.timerType=e.type,this.timer=new ui(e.timer),this.show=e.show??{day:!0,hour:!0,minute:!0,second:!0},this.horizontal=e.horizontal,this.lblPos=e.lblPos}},Qs=class{txt;c;constructor(e){e??={},this.txt=e.txt,this.c=new He(e.c??{})}get text(){return this.txt}get color(){return this.c}},Kr=class extends wr{ph;constructor(e){super(e),this.ph=new Qs(e.ph)}get placeholderText(){return this.ph.text}get placeholderColor(){return this.ph.color.rgba}},fi=class extends Kr{constructor(e){e??={},super(e)}},mi=class extends Kr{},di=class extends Kr{},hi=class extends Br{},En=(e=>(e[e.LOW=1]="LOW",e[e.MEDIUM=2]="MEDIUM",e[e.HIGH=3]="HIGH",e))(En||{}),Zs=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[]}}},vo=class extends Ut{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 Zs(e.anim),this.embedded=e.embedded,this.position=e.position??1,this.spc||(this.spc=new Lr({pl:N.IN_APP_DEFAULT_PADDING,pr:N.IN_APP_DEFAULT_PADDING,pt:N.IN_APP_DEFAULT_PADDING,pb:N.IN_APP_DEFAULT_PADDING}))}isEmbedded(){return this.position===2&&!!this.embedded}getEmbeddedSelector(){return`.letscooee-engagement.container-${this.embedded}`}},ea=class extends vo{cont;elems=[];mob;constructor(e){e=e??{},super(e),this.cont=new Js(e.cont),this.mob=new vo(e.mob),this.bg||(this.bg=this.cont.bg,delete this.cont.bg),e.elems.forEach(t=>{t.t===1?this.elems.push(new Br(t)):t.t===2?this.elems.push(new qr(t)):t.t===3?this.elems.push(new qr(t)):t.t===100?this.elems.push(new _n(t)):t.t===51?this.elems.push(new mi(t)):t.t===52?this.elems.push(new di(t)):t.t===61?this.elems.push(new pi(t)):t.t===15||t.t===16?this.elems.push(new fi(t)):t.t===13&&this.elems.push(new hi(t))})}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"},t,r;return this.gvt===1?(t="flex-start",r="flex-start"):this.gvt===2?(t="center",r="flex-start"):this.gvt===3?(t="flex-end",r="flex-start"):this.gvt===4?(t="flex-start",r="center"):this.gvt===6?(t="flex-end",r="center"):this.gvt===7?(t="flex-start",r="flex-end"):this.gvt===8?(t="center",r="flex-end"):this.gvt===9?(t="flex-end",r="flex-end"):(t="center",r="center"),e.alignItems=r,e.justifyContent=t,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}},gi=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}},ta=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}},ra=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}},na=class{size;bg;br;spc;typo;lout;flex;constructor(e){e??={},this.spc=new Lr(e.spc),e.size&&(this.size=new ra(e.size)),e.bg&&(this.bg=new gn(e.bg)),e.br&&(this.br=new yn(e.br)),e.typo&&(this.typo=new ct(e.typo)),e.lout&&(this.lout=new ta(e.lout)),e.flex&&(this.flex=new gi(e.flex))}},yi=class{sm;lg;constructor(e){e??={},this.sm=new na(e.sm),this.lg=new na(e.lg)}},it=class{t;style;hide;when;clc;constructor(e,t){t??={},this.t=e,this.style=new yi(t.style),this.hide=t.hide,t.when?.op&&(this.when=t.when),t.clc&&(this.clc=t.clc)}get stringType(){return ke[this.t]}},Xe=class extends it{text;constructor(e,t){e?.style?.lg?.typo?.s&&delete e.style.lg.typo.s,e?.style?.sm?.typo?.s&&delete e.style.sm.typo.s,super(t??2,e),e??={},this.text=e.text}},Sn=class extends Xe{constructor(e,t){super(e,t??3)}},vi=class extends it{value;constructor(e){super(6,e),e??={},this.value=e.value}},_i=class extends Xe{constructor(e=15,t){super(t,e)}},ia=class extends it{c;iconSize;showSingleStar;fullStar;halfStart;constructor(e){super(19,e),e??={},this.c=new He(e.c),this.iconSize=e.iconSize??24,this.showSingleStar=e.showSingleStar??!1,this.fullStar=e.fullStar,this.halfStart=e.halfStart}},qm=Ce(nn()),Eu=class{enabled;type;color;constructor(e){e??={},this.enabled=e.enabled,this.type=e.type,this.color=new He(e.color)}},Su=class{size;enabled;color;constructor(e){e??={},this.enabled=e.enabled,this.size=e.size,this.color=new He(e.color)}},_o=class{navigation;pagination;autoplay;maxInRow;gap;slidesPerView;constructor(e){e??={},this.navigation=new Su(e.navigation),this.pagination=new Eu(e.pagination),this.autoplay=e.autoplay,this.slidesPerView=e.slidesPerView??1,this.maxInRow=e.maxInRow??e.slidesPerView??4,this.gap=e.gap??0}},oa=class extends it{conf;slide;formData;values;allowedTypes;constructor(e){super(62,e),e&&this.update(e)}update(e){e??={},this.slide=kt.getParsedElement(e.slide),this.formData=e.formData,this.values=e.values,this.conf=new _o(e.conf),this.allowedTypes=e.allowedTypes}},sa=class extends Xe{gap;timer;timerType;horizontal;lblPos;show;constructor(e){e??={},super(e,61),this.gap=e.gap,this.timerType=e.type,this.timer=new ui(e.timer),this.show=e.show??{days:!0,hours:!0,minutes:!0,seconds:!0},this.horizontal=e.horizontal,this.lblPos=e.lblPos}},Xr=class extends it{elems;constructor(e){super(4,e),this.update(e)}update(e){e??={},this.elems??=[],e.elems?.forEach(t=>{let r=kt.getParsedElement(t);r&&this.elems.push(r)})}},wn=class extends it{src;sm;lg;constructor(e,t){super(t??1,e),e&&this.update(e)}update(e){this.src=e.src,this.sm=e.sm,this.lg=e.lg}},kt=class Oh{static getParsedElements(t){let r=[];return t?.forEach(n=>{let i=Oh.getParsedElement(n);i&&r.push(i)}),r}static getParsedElement(t){switch(t.t){case 2:return new Xe(t);case 3:return new Sn(t);case 6:return new vi(t);case 11:return new aa(t);case 12:return new br(t);case 61:return new sa(t);case 4:return new Xr(t);case 1:return new wn(t);case 13:return new wn(t,13);case 14:return new Xe(t,14);case 15:case 16:return new _i(t.t,t);case 18:return new Sn(t,18);case 62:return new oa(t);case 19:return new ia(t);default:qm.default.error("Unknown element type",t.t);return}}static parseAlignmentToJustifyContent(t){switch(t){case 1:return"center";case 2:return"flex-end";case 0:return"flex-start";default:return"flex-start"}}},br=class extends it{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=kt.getParsedElements(e.elems),this.noLinks=e.noLinks,!this.elems.length){e.cBox&&this.elems.push(new vi(e.cBox)),this.elems.push(new wn(e.img,13));let t=new Xe(e.title,14);t.hide=!e.show?.title,t.text="{{ product.name }}",this.elems.push(t);let r=new Xe(e.price);r.text="{{ product.price }}",r.hide=!e.show?.price;let n=new Xe(e.compareAt);n.text="{{ product.compare_price }}",n.hide=!e.show?.price,e.compareAt||(n.style=new yi(r.style),n.style.lg.typo=new ct(ee(w({},n.style.lg.typo),{td:"line-through"})),n.style.sm.typo=new ct(ee(w({},n.style.sm.typo),{td:"line-through"})));let i=new Xr({style:{lg:{spc:{mb:10},flex:{dir:"row",gap:10,ai:"center",jc:kt.parseAlignmentToJustifyContent(r.style.lg.typo?.ta)}}}});i.elems.push(n),i.elems.push(r),this.elems.push(i);let s=new _i(15,e.variantDD);if(s.hide=!e.show?.variantDD,this.elems.push(s),e.btn){let o=new Sn(e.btn,18);o.hide=!e.show?.btn,this.elems.push(o)}}e.symbol&&(this.symbol=new Xe(e.symbol))}},aa=class extends it{conf;prod;constructor(e){super(11,e),e??={},this.conf=new wu(e.conf),this.prod=new br(e.prod)}},ca=class extends _o{disp;maxItems;constructor(e){e??={},super(e),this.disp=e.disp,this.maxItems=e.maxItems}},wu=class{lg;sm;constructor(e){e??={},this.lg=new ca(e.lg),this.sm=new ca(e.sm)}},la=class extends Xr{constructor(e){super(e)}},Ei=class{cont;elems=[];constructor(e){e=e??{},this.cont=new la(e.cont),e.elems?.forEach(t=>{this.addRawElement(t)})}addRawElement(e){let t=kt.getParsedElement(e);return t&&this.elems.push(t),t}},Km=Ce(Gr()),bu=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(t=>new pt(t))}},ua=class{layout;milestones;constructor(e){this.layout=e.layout??Km.ProgressBarLayout.ICONS,this.milestones=e.milestones?.map(t=>new bu(t))??[]}},pa=class{applyDiscountOnMinimum;constructor(e){this.applyDiscountOnMinimum=e.applyDiscountOnMinimum}},Tu=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===Tt.EngagementContentType.EXCLUSION}isABTesting(){return this.contentType===Tt.EngagementContentType.ABTESTING}isSingleContent(){return this.contentType===Tt.EngagementContentType.SINGLE}},Mt=class Ah extends Tu{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=$t({});constructor(t){super(t),this.id=t.id,this.nudgeID=t.nudgeID,this.currency=le.get().currencyCode??"USD",this.contentID=t.contentID,this.variation=t.variation,t.widget&&(this.widget=new Ei(t.widget)),this.previewType=t.previewType,this.occurred=t.occurred??new Date,this.props=t.props,this.embeddedItems=t.embeddedItems?.map(r=>new pt(r)),this.items=t.items?.map(r=>new Rt(r))??[],this.nonMutableItems=t.items?.map(r=>new Rt(r))??[],this.collections=t.collections?.map(r=>new qs(r))??[],this.discount=t.discount,this.placement=t.placement,this.customerData=t.customerData,this.ian=t.ian?this.processPopup(t.ian):void 0,this.promotionType=t.promotionType,this.manipulation=new Ks(t.manipulation),this.contentSource=t.contentSource,this.klaviyoFormID=t.klaviyoFormID,this.hasMultiplePlacement=t.hasMultiplePlacement,this.skipSubscribedItems=t.skipSubscribedItems,t.progressBarConfig&&(this.progressBarConfig=new ua(t.progressBarConfig)),t.bundleConfig&&(this.bundleConfig=new pa(t.bundleConfig)),t.bundleFrom&&(this.bundleFrom=new Rt(t.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 t=new Date().getTime()-this.occurred.getTime();return this.delay*1e3-t}isBundle(){return this.objective===Tt.EngagementObjective.BUNDLE_AND_UPSELL}isCartEmbed(){return this.onsiteDeliveryType===Tt.OnsiteDeliveryType.CART_EMBED}isPageEmbed(){return this.onsiteDeliveryType===Tt.OnsiteDeliveryType.PAGE_EMBED}isProgressBar(){return this.objective===Tt.EngagementObjective.PROGRESS_BAR}isSubscriptionUpsell(){return this.objective===Tt.EngagementObjective.SUBSCRIPTION_UPSELL}isCartRecovery(){return this.objective===Tt.EngagementObjective.CART_RECOVERY}isProductPromotion(){return this.objective===Tt.EngagementObjective.PRODUCT_PROMOTION}isProductPromoted(){return this.isProductPromotion()||this.isBundle()||this.isCartRecovery()}isBYOB(){return this.objective===Tt.EngagementObjective.BYOB}isShoppableVideo(){return this.objective===Tt.EngagementObjective.SHOPPABLE_VIDEO}processPopup(t){let r=JSON.stringify(t),n=this.items[0],i={},s={};if(n){let u=n.selectedOrFirstVariant.value;i={name:n.name,id:n.mID,link:n.link,vID:u.mID,image:n.variantImage,price:re.formatCurrency(u.price.d),comparePrice:re.formatCurrency(u.price.cmp),quantity:n.quantity},s={quantity:u.quantity}}let o={productCount:de.getCurrent().item_count},c=Et.render(r,{product:i,variant:s,cart:o,discount:this.discount,customer:this.customerData});return n&&(c=c.replace(new RegExp(N.PLACEHOLDER_IMAGE,"gi"),n.variantImage??n.imageURL)),new ea(JSON.parse(c))}calculateDiscountData(t,r){let n=Iu.ArrayUtils.sum(t,s=>s.selectedOrFirstVariant.value.price.d),i={actualPrice:n,discountAmount:0,discountPercentage:0,discountedPrice:n};if(!t?.length||!r||!this.discount?.type){this.discountData.value=this.formatCurrencyAndNumber(i);return}if(Jr.DiscountType.BXGY===this.discount.type&&this.discount.values?.length)i.discountPercentage=this.discount.values[0],this.updateEffectivePrice(t,i.discountPercentage,!0),i.discountAmount=i.actualPrice-Iu.ArrayUtils.sum(t,s=>s.selectedOrFirstVariant.value.effectivePrice.value);else if([Jr.DiscountType.UNIQUE_FLAT_ITEMS,Jr.DiscountType.STATIC].includes(this.discount.type)&&this.discount.values?.length)i.discountPercentage=this.discount.values[0],i.discountAmount=i.actualPrice*i.discountPercentage/100,this.updateEffectivePrice(t,i.discountPercentage);else if(this.discount.type===Jr.DiscountType.UNIQUE_FIXED_ITEMS&&this.discount.values?.length)i.discountAmount=i.actualPrice-this.discount.values[0],i.discountPercentage=i.discountAmount/i.actualPrice*100,this.updateEffectivePrice(t,i.discountPercentage);else if(this.discount.type===Jr.DiscountType.UNIQUE_CHEAPEST_ITEM_FREE){t.sort((o,c)=>c.selectedOrFirstVariant.value.price.d-o.selectedOrFirstVariant.value.price.d);let s=t[t.length-1];s.selectedOrFirstVariant.value.effectivePrice.value=0,i.discountAmount=s.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 Le.get().skipItemAttribute?{}:{[N.VIA]:"Cooee",[N.CAMPAIGN_ATTRIBUTE]:this.shortID,[N.CONTENT_ATTRIBUTE]:this.contentID}}getKVFormatPrivateAttributesForLineItem(){return Le.get().skipItemAttribute?[]:[{key:N.VIA,value:"Cooee"},{key:N.CAMPAIGN_ATTRIBUTE,value:this.shortID},{key:N.CONTENT_ATTRIBUTE,value:this.contentID}]}isBundleDiscount(){return[Jr.DiscountType.UNIQUE_FIXED_ITEMS,Jr.DiscountType.UNIQUE_FLAT_ITEMS].includes(this.discount.type)}isBundleOnCartDrawer(){return this.isBundle()&&this.isCartEmbed()}isBundleOnPDP(){return this.isPageEmbed()&&this.isBundle()}hasSwiperElement(){let t=this.widget?.elems.find(n=>Ah.SWIPER_ELEMENTS.has(n.t));if(!t)return!1;if(t.t===62)return!0;let r=Lt.get().isMobile()?"sm":"lg";return t.conf[r].disp===2}toString(){return`Engagement(id=${this.shortID})`}updateEffectivePrice(t,r,n=!1){let i=le.get().getCurrentItem();t.forEach(s=>{let o=s.selectedOrFirstVariant.value,c=o.price;n&&s.mID===i.mID?o.effectivePrice.value=c.d:o.effectivePrice.value=c.d*r/100})}formatCurrencyAndNumber(t){if(!t)return{};let r={discountPercentage:re.formatNumber(t.discountPercentage??0),discountCode:this.discount?.code};return["actualPrice","discountAmount","discountedPrice"].map(n=>{r[n]=re.formatCurrency(t[n])}),r}};function A_(e,t){return t={exports:{}},e(t,t.exports),t.exports}var N_=B_,O_=k_,P_=H_,Tr=[],zt=[],L_=typeof Uint8Array<"u"?Uint8Array:Array,Cu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(bn=0,Xm=Cu.length;bn<Xm;++bn)Tr[bn]=Cu[bn],zt[Cu.charCodeAt(bn)]=bn;var bn,Xm;zt[45]=62;zt[95]=63;function fd(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");r===-1&&(r=t);var n=r===t?0:4-r%4;return[r,n]}function B_(e){var t=fd(e),r=t[0],n=t[1];return(r+n)*3/4-n}function U_(e,t,r){return(t+r)*3/4-r}function k_(e){var t,r=fd(e),n=r[0],i=r[1],s=new L_(U_(e,n,i)),o=0,c=i>0?n-4:n,u;for(u=0;u<c;u+=4)t=zt[e.charCodeAt(u)]<<18|zt[e.charCodeAt(u+1)]<<12|zt[e.charCodeAt(u+2)]<<6|zt[e.charCodeAt(u+3)],s[o++]=t>>16&255,s[o++]=t>>8&255,s[o++]=t&255;return i===2&&(t=zt[e.charCodeAt(u)]<<2|zt[e.charCodeAt(u+1)]>>4,s[o++]=t&255),i===1&&(t=zt[e.charCodeAt(u)]<<10|zt[e.charCodeAt(u+1)]<<4|zt[e.charCodeAt(u+2)]>>2,s[o++]=t>>8&255,s[o++]=t&255),s}function M_(e){return Tr[e>>18&63]+Tr[e>>12&63]+Tr[e>>6&63]+Tr[e&63]}function F_(e,t,r){for(var n,i=[],s=t;s<r;s+=3)n=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(e[s+2]&255),i.push(M_(n));return i.join("")}function H_(e){for(var t,r=e.length,n=r%3,i=[],s=16383,o=0,c=r-n;o<c;o+=s)i.push(F_(e,o,o+s>c?c:o+s));return n===1?(t=e[r-1],i.push(Tr[t>>2]+Tr[t<<4&63]+"==")):n===2&&(t=(e[r-2]<<8)+e[r-1],i.push(Tr[t>>10]+Tr[t>>4&63]+Tr[t<<2&63]+"=")),i.join("")}var xu={byteLength:N_,toByteArray:O_,fromByteArray:P_},$_=function(e,t,r,n,i){var s,o,c=i*8-n-1,u=(1<<c)-1,p=u>>1,m=-7,h=r?i-1:0,y=r?-1:1,E=e[t+h];for(h+=y,s=E&(1<<-m)-1,E>>=-m,m+=c;m>0;s=s*256+e[t+h],h+=y,m-=8);for(o=s&(1<<-m)-1,s>>=-m,m+=n;m>0;o=o*256+e[t+h],h+=y,m-=8);if(s===0)s=1-p;else{if(s===u)return o?NaN:(E?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-p}return(E?-1:1)*o*Math.pow(2,s-n)},j_=function(e,t,r,n,i,s){var o,c,u,p=s*8-i-1,m=(1<<p)-1,h=m>>1,y=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,E=n?0:s-1,v=n?1:-1,_=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(c=isNaN(t)?1:0,o=m):(o=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-o))<1&&(o--,u*=2),o+h>=1?t+=y/u:t+=y*Math.pow(2,1-h),t*u>=2&&(o++,u/=2),o+h>=m?(c=0,o=m):o+h>=1?(c=(t*u-1)*Math.pow(2,i),o=o+h):(c=t*Math.pow(2,h-1)*Math.pow(2,i),o=0));i>=8;e[r+E]=c&255,E+=v,c/=256,i-=8);for(o=o<<i|c,p+=i;p>0;e[r+E]=o&255,E+=v,o/=256,p-=8);e[r+E-v]|=_*128},Si={read:$_,write:j_},da=A_(function(e,t){var r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=o,t.SlowBuffer=P,t.INSPECT_MAX_BYTES=50;var n=2147483647;t.kMaxLength=n,o.TYPED_ARRAY_SUPPORT=i(),!o.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 a=new Uint8Array(1),l={foo:function(){return 42}};return Object.setPrototypeOf(l,Uint8Array.prototype),Object.setPrototypeOf(a,l),a.foo()===42}catch{return!1}}Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}});function s(a){if(a>n)throw new RangeError('The value "'+a+'" is invalid for option "size"');var l=new Uint8Array(a);return Object.setPrototypeOf(l,o.prototype),l}function o(a,l,f){if(typeof a=="number"){if(typeof l=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return m(a)}return c(a,l,f)}o.poolSize=8192;function c(a,l,f){if(typeof a=="string")return h(a,l);if(ArrayBuffer.isView(a))return E(a);if(a==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(a));if(vt(a,ArrayBuffer)||a&&vt(a.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(vt(a,SharedArrayBuffer)||a&&vt(a.buffer,SharedArrayBuffer)))return v(a,l,f);if(typeof a=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var T=a.valueOf&&a.valueOf();if(T!=null&&T!==a)return o.from(T,l,f);var A=_(a);if(A)return A;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof a[Symbol.toPrimitive]=="function")return o.from(a[Symbol.toPrimitive]("string"),l,f);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(a))}o.from=function(a,l,f){return c(a,l,f)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array);function u(a){if(typeof a!="number")throw new TypeError('"size" argument must be of type number');if(a<0)throw new RangeError('The value "'+a+'" is invalid for option "size"')}function p(a,l,f){return u(a),a<=0?s(a):l!==void 0?typeof f=="string"?s(a).fill(l,f):s(a).fill(l):s(a)}o.alloc=function(a,l,f){return p(a,l,f)};function m(a){return u(a),s(a<0?0:x(a)|0)}o.allocUnsafe=function(a){return m(a)},o.allocUnsafeSlow=function(a){return m(a)};function h(a,l){if((typeof l!="string"||l==="")&&(l="utf8"),!o.isEncoding(l))throw new TypeError("Unknown encoding: "+l);var f=B(a,l)|0,T=s(f),A=T.write(a,l);return A!==f&&(T=T.slice(0,A)),T}function y(a){for(var l=a.length<0?0:x(a.length)|0,f=s(l),T=0;T<l;T+=1)f[T]=a[T]&255;return f}function E(a){if(vt(a,Uint8Array)){var l=new Uint8Array(a);return v(l.buffer,l.byteOffset,l.byteLength)}return y(a)}function v(a,l,f){if(l<0||a.byteLength<l)throw new RangeError('"offset" is outside of buffer bounds');if(a.byteLength<l+(f||0))throw new RangeError('"length" is outside of buffer bounds');var T;return l===void 0&&f===void 0?T=new Uint8Array(a):f===void 0?T=new Uint8Array(a,l):T=new Uint8Array(a,l,f),Object.setPrototypeOf(T,o.prototype),T}function _(a){if(o.isBuffer(a)){var l=x(a.length)|0,f=s(l);return f.length===0||a.copy(f,0,0,l),f}if(a.length!==void 0)return typeof a.length!="number"||jr(a.length)?s(0):y(a);if(a.type==="Buffer"&&Array.isArray(a.data))return y(a.data)}function x(a){if(a>=n)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n.toString(16)+" bytes");return a|0}function P(a){return+a!=a&&(a=0),o.alloc(+a)}o.isBuffer=function(a){return a!=null&&a._isBuffer===!0&&a!==o.prototype},o.compare=function(a,l){if(vt(a,Uint8Array)&&(a=o.from(a,a.offset,a.byteLength)),vt(l,Uint8Array)&&(l=o.from(l,l.offset,l.byteLength)),!o.isBuffer(a)||!o.isBuffer(l))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(a===l)return 0;for(var f=a.length,T=l.length,A=0,M=Math.min(f,T);A<M;++A)if(a[A]!==l[A]){f=a[A],T=l[A];break}return f<T?-1:T<f?1:0},o.isEncoding=function(a){switch(String(a).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}},o.concat=function(a,l){if(!Array.isArray(a))throw new TypeError('"list" argument must be an Array of Buffers');if(a.length===0)return o.alloc(0);var f;if(l===void 0)for(l=0,f=0;f<a.length;++f)l+=a[f].length;var T=o.allocUnsafe(l),A=0;for(f=0;f<a.length;++f){var M=a[f];if(vt(M,Uint8Array))A+M.length>T.length?o.from(M).copy(T,A):Uint8Array.prototype.set.call(T,M,A);else if(o.isBuffer(M))M.copy(T,A);else throw new TypeError('"list" argument must be an Array of Buffers');A+=M.length}return T};function B(a,l){if(o.isBuffer(a))return a.length;if(ArrayBuffer.isView(a)||vt(a,ArrayBuffer))return a.byteLength;if(typeof a!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+babelHelpers.typeof(a));var f=a.length,T=arguments.length>2&&arguments[2]===!0;if(!T&&f===0)return 0;for(var A=!1;;)switch(l){case"ascii":case"latin1":case"binary":return f;case"utf8":case"utf-8":return rn(a).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return f*2;case"hex":return f>>>1;case"base64":return Hn(a).length;default:if(A)return T?-1:rn(a).length;l=(""+l).toLowerCase(),A=!0}}o.byteLength=B;function U(a,l,f){var T=!1;if((l===void 0||l<0)&&(l=0),l>this.length||((f===void 0||f>this.length)&&(f=this.length),f<=0)||(f>>>=0,l>>>=0,f<=l))return"";for(a||(a="utf8");;)switch(a){case"hex":return gt(this,l,f);case"utf8":case"utf-8":return je(this,l,f);case"ascii":return qe(this,l,f);case"latin1":case"binary":return ve(this,l,f);case"base64":return ge(this,l,f);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return se(this,l,f);default:if(T)throw new TypeError("Unknown encoding: "+a);a=(a+"").toLowerCase(),T=!0}}o.prototype._isBuffer=!0;function R(a,l,f){var T=a[l];a[l]=a[f],a[f]=T}o.prototype.swap16=function(){var a=this.length;if(a%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var l=0;l<a;l+=2)R(this,l,l+1);return this},o.prototype.swap32=function(){var a=this.length;if(a%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var l=0;l<a;l+=4)R(this,l,l+3),R(this,l+1,l+2);return this},o.prototype.swap64=function(){var a=this.length;if(a%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var l=0;l<a;l+=8)R(this,l,l+7),R(this,l+1,l+6),R(this,l+2,l+5),R(this,l+3,l+4);return this},o.prototype.toString=function(){var a=this.length;return a===0?"":arguments.length===0?je(this,0,a):U.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(a){if(!o.isBuffer(a))throw new TypeError("Argument must be a Buffer");return this===a?!0:o.compare(this,a)===0},o.prototype.inspect=function(){var a="",l=t.INSPECT_MAX_BYTES;return a=this.toString("hex",0,l).replace(/(.{2})/g,"$1 ").trim(),this.length>l&&(a+=" ... "),"<Buffer "+a+">"},r&&(o.prototype[r]=o.prototype.inspect),o.prototype.compare=function(a,l,f,T,A){if(vt(a,Uint8Array)&&(a=o.from(a,a.offset,a.byteLength)),!o.isBuffer(a))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+babelHelpers.typeof(a));if(l===void 0&&(l=0),f===void 0&&(f=a?a.length:0),T===void 0&&(T=0),A===void 0&&(A=this.length),l<0||f>a.length||T<0||A>this.length)throw new RangeError("out of range index");if(T>=A&&l>=f)return 0;if(T>=A)return-1;if(l>=f)return 1;if(l>>>=0,f>>>=0,T>>>=0,A>>>=0,this===a)return 0;for(var M=A-T,W=f-l,be=Math.min(M,W),me=this.slice(T,A),ye=a.slice(l,f),$e=0;$e<be;++$e)if(me[$e]!==ye[$e]){M=me[$e],W=ye[$e];break}return M<W?-1:W<M?1:0};function G(a,l,f,T,A){if(a.length===0)return-1;if(typeof f=="string"?(T=f,f=0):f>2147483647?f=2147483647:f<-2147483648&&(f=-2147483648),f=+f,jr(f)&&(f=A?0:a.length-1),f<0&&(f=a.length+f),f>=a.length){if(A)return-1;f=a.length-1}else if(f<0)if(A)f=0;else return-1;if(typeof l=="string"&&(l=o.from(l,T)),o.isBuffer(l))return l.length===0?-1:ue(a,l,f,T,A);if(typeof l=="number")return l=l&255,typeof Uint8Array.prototype.indexOf=="function"?A?Uint8Array.prototype.indexOf.call(a,l,f):Uint8Array.prototype.lastIndexOf.call(a,l,f):ue(a,[l],f,T,A);throw new TypeError("val must be string, number or Buffer")}function ue(a,l,f,T,A){var M=1,W=a.length,be=l.length;if(T!==void 0&&(T=String(T).toLowerCase(),T==="ucs2"||T==="ucs-2"||T==="utf16le"||T==="utf-16le")){if(a.length<2||l.length<2)return-1;M=2,W/=2,be/=2,f/=2}function me(Z,Te){return M===1?Z[Te]:Z.readUInt16BE(Te*M)}var ye;if(A){var $e=-1;for(ye=f;ye<W;ye++)if(me(a,ye)===me(l,$e===-1?0:ye-$e)){if($e===-1&&($e=ye),ye-$e+1===be)return $e*M}else $e!==-1&&(ye-=ye-$e),$e=-1}else for(f+be>W&&(f=W-be),ye=f;ye>=0;ye--){for(var q=!0,ae=0;ae<be;ae++)if(me(a,ye+ae)!==me(l,ae)){q=!1;break}if(q)return ye}return-1}o.prototype.includes=function(a,l,f){return this.indexOf(a,l,f)!==-1},o.prototype.indexOf=function(a,l,f){return G(this,a,l,f,!0)},o.prototype.lastIndexOf=function(a,l,f){return G(this,a,l,f,!1)};function Me(a,l,f,T){f=Number(f)||0;var A=a.length-f;T?(T=Number(T),T>A&&(T=A)):T=A;var M=l.length;T>M/2&&(T=M/2);for(var W=0;W<T;++W){var be=parseInt(l.substr(W*2,2),16);if(jr(be))return W;a[f+W]=be}return W}function j(a,l,f,T){return kn(rn(l,a.length-f),a,f,T)}function Q(a,l,f,T){return kn(Qn(l),a,f,T)}function z(a,l,f,T){return kn(Hn(l),a,f,T)}function J(a,l,f,T){return kn(Vi(l,a.length-f),a,f,T)}o.prototype.write=function(a,l,f,T){if(l===void 0)T="utf8",f=this.length,l=0;else if(f===void 0&&typeof l=="string")T=l,f=this.length,l=0;else if(isFinite(l))l=l>>>0,isFinite(f)?(f=f>>>0,T===void 0&&(T="utf8")):(T=f,f=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var A=this.length-l;if((f===void 0||f>A)&&(f=A),a.length>0&&(f<0||l<0)||l>this.length)throw new RangeError("Attempt to write outside buffer bounds");T||(T="utf8");for(var M=!1;;)switch(T){case"hex":return Me(this,a,l,f);case"utf8":case"utf-8":return j(this,a,l,f);case"ascii":case"latin1":case"binary":return Q(this,a,l,f);case"base64":return z(this,a,l,f);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return J(this,a,l,f);default:if(M)throw new TypeError("Unknown encoding: "+T);T=(""+T).toLowerCase(),M=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ge(a,l,f){return l===0&&f===a.length?xu.fromByteArray(a):xu.fromByteArray(a.slice(l,f))}function je(a,l,f){f=Math.min(a.length,f);for(var T=[],A=l;A<f;){var M=a[A],W=null,be=M>239?4:M>223?3:M>191?2:1;if(A+be<=f){var me,ye,$e,q;switch(be){case 1:M<128&&(W=M);break;case 2:me=a[A+1],(me&192)===128&&(q=(M&31)<<6|me&63,q>127&&(W=q));break;case 3:me=a[A+1],ye=a[A+2],(me&192)===128&&(ye&192)===128&&(q=(M&15)<<12|(me&63)<<6|ye&63,q>2047&&(q<55296||q>57343)&&(W=q));break;case 4:me=a[A+1],ye=a[A+2],$e=a[A+3],(me&192)===128&&(ye&192)===128&&($e&192)===128&&(q=(M&15)<<18|(me&63)<<12|(ye&63)<<6|$e&63,q>65535&&q<1114112&&(W=q))}}W===null?(W=65533,be=1):W>65535&&(W-=65536,T.push(W>>>10&1023|55296),W=56320|W&1023),T.push(W),A+=be}return d(T)}var De=4096;function d(a){var l=a.length;if(l<=De)return String.fromCharCode.apply(String,a);for(var f="",T=0;T<l;)f+=String.fromCharCode.apply(String,a.slice(T,T+=De));return f}function qe(a,l,f){var T="";f=Math.min(a.length,f);for(var A=l;A<f;++A)T+=String.fromCharCode(a[A]&127);return T}function ve(a,l,f){var T="";f=Math.min(a.length,f);for(var A=l;A<f;++A)T+=String.fromCharCode(a[A]);return T}function gt(a,l,f){var T=a.length;(!l||l<0)&&(l=0),(!f||f<0||f>T)&&(f=T);for(var A="",M=l;M<f;++M)A+=Gi[a[M]];return A}function se(a,l,f){for(var T=a.slice(l,f),A="",M=0;M<T.length-1;M+=2)A+=String.fromCharCode(T[M]+T[M+1]*256);return A}o.prototype.slice=function(a,l){var f=this.length;a=~~a,l=l===void 0?f:~~l,a<0?(a+=f,a<0&&(a=0)):a>f&&(a=f),l<0?(l+=f,l<0&&(l=0)):l>f&&(l=f),l<a&&(l=a);var T=this.subarray(a,l);return Object.setPrototypeOf(T,o.prototype),T};function ie(a,l,f){if(a%1!==0||a<0)throw new RangeError("offset is not uint");if(a+l>f)throw new RangeError("Trying to access beyond buffer length")}o.prototype.readUintLE=o.prototype.readUIntLE=function(a,l,f){a=a>>>0,l=l>>>0,f||ie(a,l,this.length);for(var T=this[a],A=1,M=0;++M<l&&(A*=256);)T+=this[a+M]*A;return T},o.prototype.readUintBE=o.prototype.readUIntBE=function(a,l,f){a=a>>>0,l=l>>>0,f||ie(a,l,this.length);for(var T=this[a+--l],A=1;l>0&&(A*=256);)T+=this[a+--l]*A;return T},o.prototype.readUint8=o.prototype.readUInt8=function(a,l){return a=a>>>0,l||ie(a,1,this.length),this[a]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(a,l){return a=a>>>0,l||ie(a,2,this.length),this[a]|this[a+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(a,l){return a=a>>>0,l||ie(a,2,this.length),this[a]<<8|this[a+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(a,l){return a=a>>>0,l||ie(a,4,this.length),(this[a]|this[a+1]<<8|this[a+2]<<16)+this[a+3]*16777216},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(a,l){return a=a>>>0,l||ie(a,4,this.length),this[a]*16777216+(this[a+1]<<16|this[a+2]<<8|this[a+3])},o.prototype.readIntLE=function(a,l,f){a=a>>>0,l=l>>>0,f||ie(a,l,this.length);for(var T=this[a],A=1,M=0;++M<l&&(A*=256);)T+=this[a+M]*A;return A*=128,T>=A&&(T-=Math.pow(2,8*l)),T},o.prototype.readIntBE=function(a,l,f){a=a>>>0,l=l>>>0,f||ie(a,l,this.length);for(var T=l,A=1,M=this[a+--T];T>0&&(A*=256);)M+=this[a+--T]*A;return A*=128,M>=A&&(M-=Math.pow(2,8*l)),M},o.prototype.readInt8=function(a,l){return a=a>>>0,l||ie(a,1,this.length),this[a]&128?(255-this[a]+1)*-1:this[a]},o.prototype.readInt16LE=function(a,l){a=a>>>0,l||ie(a,2,this.length);var f=this[a]|this[a+1]<<8;return f&32768?f|4294901760:f},o.prototype.readInt16BE=function(a,l){a=a>>>0,l||ie(a,2,this.length);var f=this[a+1]|this[a]<<8;return f&32768?f|4294901760:f},o.prototype.readInt32LE=function(a,l){return a=a>>>0,l||ie(a,4,this.length),this[a]|this[a+1]<<8|this[a+2]<<16|this[a+3]<<24},o.prototype.readInt32BE=function(a,l){return a=a>>>0,l||ie(a,4,this.length),this[a]<<24|this[a+1]<<16|this[a+2]<<8|this[a+3]},o.prototype.readFloatLE=function(a,l){return a=a>>>0,l||ie(a,4,this.length),Si.read(this,a,!0,23,4)},o.prototype.readFloatBE=function(a,l){return a=a>>>0,l||ie(a,4,this.length),Si.read(this,a,!1,23,4)},o.prototype.readDoubleLE=function(a,l){return a=a>>>0,l||ie(a,8,this.length),Si.read(this,a,!0,52,8)},o.prototype.readDoubleBE=function(a,l){return a=a>>>0,l||ie(a,8,this.length),Si.read(this,a,!1,52,8)};function lt(a,l,f,T,A,M){if(!o.isBuffer(a))throw new TypeError('"buffer" argument must be a Buffer instance');if(l>A||l<M)throw new RangeError('"value" argument is out of bounds');if(f+T>a.length)throw new RangeError("Index out of range")}o.prototype.writeUintLE=o.prototype.writeUIntLE=function(a,l,f,T){if(a=+a,l=l>>>0,f=f>>>0,!T){var A=Math.pow(2,8*f)-1;lt(this,a,l,f,A,0)}var M=1,W=0;for(this[l]=a&255;++W<f&&(M*=256);)this[l+W]=a/M&255;return l+f},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(a,l,f,T){if(a=+a,l=l>>>0,f=f>>>0,!T){var A=Math.pow(2,8*f)-1;lt(this,a,l,f,A,0)}var M=f-1,W=1;for(this[l+M]=a&255;--M>=0&&(W*=256);)this[l+M]=a/W&255;return l+f},o.prototype.writeUint8=o.prototype.writeUInt8=function(a,l,f){return a=+a,l=l>>>0,f||lt(this,a,l,1,255,0),this[l]=a&255,l+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(a,l,f){return a=+a,l=l>>>0,f||lt(this,a,l,2,65535,0),this[l]=a&255,this[l+1]=a>>>8,l+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(a,l,f){return a=+a,l=l>>>0,f||lt(this,a,l,2,65535,0),this[l]=a>>>8,this[l+1]=a&255,l+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(a,l,f){return a=+a,l=l>>>0,f||lt(this,a,l,4,4294967295,0),this[l+3]=a>>>24,this[l+2]=a>>>16,this[l+1]=a>>>8,this[l]=a&255,l+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(a,l,f){return a=+a,l=l>>>0,f||lt(this,a,l,4,4294967295,0),this[l]=a>>>24,this[l+1]=a>>>16,this[l+2]=a>>>8,this[l+3]=a&255,l+4},o.prototype.writeIntLE=function(a,l,f,T){if(a=+a,l=l>>>0,!T){var A=Math.pow(2,8*f-1);lt(this,a,l,f,A-1,-A)}var M=0,W=1,be=0;for(this[l]=a&255;++M<f&&(W*=256);)a<0&&be===0&&this[l+M-1]!==0&&(be=1),this[l+M]=(a/W>>0)-be&255;return l+f},o.prototype.writeIntBE=function(a,l,f,T){if(a=+a,l=l>>>0,!T){var A=Math.pow(2,8*f-1);lt(this,a,l,f,A-1,-A)}var M=f-1,W=1,be=0;for(this[l+M]=a&255;--M>=0&&(W*=256);)a<0&&be===0&&this[l+M+1]!==0&&(be=1),this[l+M]=(a/W>>0)-be&255;return l+f},o.prototype.writeInt8=function(a,l,f){return a=+a,l=l>>>0,f||lt(this,a,l,1,127,-128),a<0&&(a=255+a+1),this[l]=a&255,l+1},o.prototype.writeInt16LE=function(a,l,f){return a=+a,l=l>>>0,f||lt(this,a,l,2,32767,-32768),this[l]=a&255,this[l+1]=a>>>8,l+2},o.prototype.writeInt16BE=function(a,l,f){return a=+a,l=l>>>0,f||lt(this,a,l,2,32767,-32768),this[l]=a>>>8,this[l+1]=a&255,l+2},o.prototype.writeInt32LE=function(a,l,f){return a=+a,l=l>>>0,f||lt(this,a,l,4,2147483647,-2147483648),this[l]=a&255,this[l+1]=a>>>8,this[l+2]=a>>>16,this[l+3]=a>>>24,l+4},o.prototype.writeInt32BE=function(a,l,f){return a=+a,l=l>>>0,f||lt(this,a,l,4,2147483647,-2147483648),a<0&&(a=4294967295+a+1),this[l]=a>>>24,this[l+1]=a>>>16,this[l+2]=a>>>8,this[l+3]=a&255,l+4};function er(a,l,f,T,A,M){if(f+T>a.length)throw new RangeError("Index out of range");if(f<0)throw new RangeError("Index out of range")}function lr(a,l,f,T,A){return l=+l,f=f>>>0,A||er(a,l,f,4),Si.write(a,l,f,T,23,4),f+4}o.prototype.writeFloatLE=function(a,l,f){return lr(this,a,l,!0,f)},o.prototype.writeFloatBE=function(a,l,f){return lr(this,a,l,!1,f)};function yt(a,l,f,T,A){return l=+l,f=f>>>0,A||er(a,l,f,8),Si.write(a,l,f,T,52,8),f+8}o.prototype.writeDoubleLE=function(a,l,f){return yt(this,a,l,!0,f)},o.prototype.writeDoubleBE=function(a,l,f){return yt(this,a,l,!1,f)},o.prototype.copy=function(a,l,f,T){if(!o.isBuffer(a))throw new TypeError("argument should be a Buffer");if(f||(f=0),!T&&T!==0&&(T=this.length),l>=a.length&&(l=a.length),l||(l=0),T>0&&T<f&&(T=f),T===f||a.length===0||this.length===0)return 0;if(l<0)throw new RangeError("targetStart out of bounds");if(f<0||f>=this.length)throw new RangeError("Index out of range");if(T<0)throw new RangeError("sourceEnd out of bounds");T>this.length&&(T=this.length),a.length-l<T-f&&(T=a.length-l+f);var A=T-f;return this===a&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(l,f,T):Uint8Array.prototype.set.call(a,this.subarray(f,T),l),A},o.prototype.fill=function(a,l,f,T){if(typeof a=="string"){if(typeof l=="string"?(T=l,l=0,f=this.length):typeof f=="string"&&(T=f,f=this.length),T!==void 0&&typeof T!="string")throw new TypeError("encoding must be a string");if(typeof T=="string"&&!o.isEncoding(T))throw new TypeError("Unknown encoding: "+T);if(a.length===1){var A=a.charCodeAt(0);(T==="utf8"&&A<128||T==="latin1")&&(a=A)}}else typeof a=="number"?a=a&255:typeof a=="boolean"&&(a=Number(a));if(l<0||this.length<l||this.length<f)throw new RangeError("Out of range index");if(f<=l)return this;l=l>>>0,f=f===void 0?this.length:f>>>0,a||(a=0);var M;if(typeof a=="number")for(M=l;M<f;++M)this[M]=a;else{var W=o.isBuffer(a)?a:o.from(a,T),be=W.length;if(be===0)throw new TypeError('The value "'+a+'" is invalid for argument "value"');for(M=0;M<f-l;++M)this[M+l]=W[M%be]}return this};var Wr=/[^+/0-9A-Za-z-_]/g;function Fn(a){if(a=a.split("=")[0],a=a.trim().replace(Wr,""),a.length<2)return"";for(;a.length%4!==0;)a=a+"=";return a}function rn(a,l){l=l||1/0;for(var f,T=a.length,A=null,M=[],W=0;W<T;++W){if(f=a.charCodeAt(W),f>55295&&f<57344){if(!A){if(f>56319){(l-=3)>-1&&M.push(239,191,189);continue}else if(W+1===T){(l-=3)>-1&&M.push(239,191,189);continue}A=f;continue}if(f<56320){(l-=3)>-1&&M.push(239,191,189),A=f;continue}f=(A-55296<<10|f-56320)+65536}else A&&(l-=3)>-1&&M.push(239,191,189);if(A=null,f<128){if((l-=1)<0)break;M.push(f)}else if(f<2048){if((l-=2)<0)break;M.push(f>>6|192,f&63|128)}else if(f<65536){if((l-=3)<0)break;M.push(f>>12|224,f>>6&63|128,f&63|128)}else if(f<1114112){if((l-=4)<0)break;M.push(f>>18|240,f>>12&63|128,f>>6&63|128,f&63|128)}else throw new Error("Invalid code point")}return M}function Qn(a){for(var l=[],f=0;f<a.length;++f)l.push(a.charCodeAt(f)&255);return l}function Vi(a,l){for(var f,T,A,M=[],W=0;W<a.length&&!((l-=2)<0);++W)f=a.charCodeAt(W),T=f>>8,A=f%256,M.push(A),M.push(T);return M}function Hn(a){return xu.toByteArray(Fn(a))}function kn(a,l,f,T){for(var A=0;A<T&&!(A+f>=l.length||A>=a.length);++A)l[A+f]=a[A];return A}function vt(a,l){return a instanceof l||a!=null&&a.constructor!=null&&a.constructor.name!=null&&a.constructor.name===l.name}function jr(a){return a!==a}var Gi=function(){for(var a="0123456789abcdef",l=new Array(256),f=0;f<16;++f)for(var T=f*16,A=0;A<16;++A)l[T+A]=a[f]+a[A];return l}()}),Se=da.Buffer;da.SlowBuffer;da.INSPECT_MAX_BYTES;da.kMaxLength;var Ou=function(e,t){return Ou=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},Ou(e,t)};function ha(e,t){Ou(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}var Tn=function(e){ha(t,e);function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return Object.defineProperty(t.prototype,"name",{get:function(){return"BSONError"},enumerable:!1,configurable:!0}),t}(Error),We=function(e){ha(t,e);function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return Object.defineProperty(t.prototype,"name",{get:function(){return"BSONTypeError"},enumerable:!1,configurable:!0}),t}(TypeError);function fa(e){return e&&e.Math==Math&&e}function md(){return fa(typeof globalThis=="object"&&globalThis)||fa(typeof window=="object"&&window)||fa(typeof self=="object"&&self)||fa(typeof global=="object"&&global)||Function("return this")()}function W_(){var e=md();return typeof e.navigator=="object"&&e.navigator.product==="ReactNative"}var G_=function(e){var t=W_()?"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(t);for(var r=Se.alloc(e),n=0;n<e;++n)r[n]=Math.floor(Math.random()*256);return r},V_=function(){{if(typeof window<"u"){var e=window.crypto||window.msCrypto;if(e&&e.getRandomValues)return function(t){return e.getRandomValues(Se.alloc(t))}}return typeof global<"u"&&global.crypto&&global.crypto.getRandomValues?function(t){return global.crypto.getRandomValues(Se.alloc(t))}:G_}},dd=V_();function Y_(e){return["[object ArrayBuffer]","[object SharedArrayBuffer]"].includes(Object.prototype.toString.call(e))}function Lu(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}function z_(e){return Object.prototype.toString.call(e)==="[object RegExp]"}function q_(e){return bo(e)&&Object.prototype.toString.call(e)==="[object Date]"}function bo(e){return typeof e=="object"&&e!==null}function ga(e,t){var r=!1;function n(){for(var i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];return r||(console.warn(t),r=!0),e.apply(this,i)}return n}function ma(e){if(ArrayBuffer.isView(e))return Se.from(e.buffer,e.byteOffset,e.byteLength);if(Y_(e))return Se.from(e);throw new We("Must use either Buffer or TypedArray")}var K_=/^(?:[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,hd=function(e){return typeof e=="string"&&K_.test(e)},Pu=function(e){if(!hd(e))throw new We('UUID string representations must be a 32 or 36 character hex string (dashes excluded/included). Format: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" or "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".');var t=e.replace(/-/g,"");return Se.from(t,"hex")},Jm=function(e,t){return t===void 0&&(t=!0),t?e.toString("hex",0,4)+"-"+e.toString("hex",4,6)+"-"+e.toString("hex",6,8)+"-"+e.toString("hex",8,10)+"-"+e.toString("hex",10,16):e.toString("hex")},kO=Math.pow(2,63)-1,MO=-Math.pow(2,63),X_=Math.pow(2,53),J_=-Math.pow(2,53),gd=4,Cn=function(){function e(t,r){if(!(this instanceof e))return new e(t,r);if(t!=null&&typeof t!="string"&&!ArrayBuffer.isView(t)&&!(t instanceof ArrayBuffer)&&!Array.isArray(t))throw new We("Binary can only be constructed from string, Buffer, TypedArray, or Array<number>");this.sub_type=r??e.BSON_BINARY_SUBTYPE_DEFAULT,t==null?(this.buffer=Se.alloc(e.BUFFER_SIZE),this.position=0):(typeof t=="string"?this.buffer=Se.from(t,"binary"):Array.isArray(t)?this.buffer=Se.from(t):this.buffer=ma(t),this.position=this.buffer.byteLength)}return e.prototype.put=function(t){if(typeof t=="string"&&t.length!==1)throw new We("only accepts single character String");if(typeof t!="number"&&t.length!==1)throw new We("only accepts single character Uint8Array or Array");var r;if(typeof t=="string"?r=t.charCodeAt(0):typeof t=="number"?r=t:r=t[0],r<0||r>255)throw new We("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=Se.alloc(e.BUFFER_SIZE+this.buffer.length);this.buffer.copy(n,0,0,this.buffer.length),this.buffer=n,this.buffer[this.position++]=r}},e.prototype.write=function(t,r){if(r=typeof r=="number"?r:this.position,this.buffer.length<r+t.length){var n=Se.alloc(this.buffer.length+t.length);this.buffer.copy(n,0,0,this.buffer.length),this.buffer=n}ArrayBuffer.isView(t)?(this.buffer.set(ma(t),r),this.position=r+t.byteLength>this.position?r+t.length:this.position):typeof t=="string"&&(this.buffer.write(t,r,t.length,"binary"),this.position=r+t.length>this.position?r+t.length:this.position)},e.prototype.read=function(t,r){return r=r&&r>0?r:this.position,this.buffer.slice(t,t+r)},e.prototype.value=function(t){return t=!!t,t&&this.buffer.length===this.position?this.buffer:t?this.buffer.slice(0,this.position):this.buffer.toString("binary",0,this.position)},e.prototype.length=function(){return this.position},e.prototype.toJSON=function(){return this.buffer.toString("base64")},e.prototype.toString=function(t){return this.buffer.toString(t)},e.prototype.toExtendedJSON=function(t){t=t||{};var r=this.buffer.toString("base64"),n=Number(this.sub_type).toString(16);return t.legacy?{$binary:r,$type:n.length===1?"0"+n:n}:{$binary:{base64:r,subType:n.length===1?"0"+n:n}}},e.prototype.toUUID=function(){if(this.sub_type===e.SUBTYPE_UUID)return new Qm(this.buffer.slice(0,this.position));throw new Tn('Binary sub_type "'.concat(this.sub_type,'" is not supported for converting to UUID. Only "').concat(e.SUBTYPE_UUID,'" is currently supported.'))},e.fromExtendedJSON=function(t,r){r=r||{};var n,i;if("$binary"in t?r.legacy&&typeof t.$binary=="string"&&"$type"in t?(i=t.$type?parseInt(t.$type,16):0,n=Se.from(t.$binary,"base64")):typeof t.$binary!="string"&&(i=t.$binary.subType?parseInt(t.$binary.subType,16):0,n=Se.from(t.$binary.base64,"base64")):"$uuid"in t&&(i=4,n=Pu(t.$uuid)),!n)throw new We("Unexpected Binary Extended JSON format ".concat(JSON.stringify(t)));return i===gd?new Qm(n):new e(n,i)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){var t=this.value(!0);return'new Binary(Buffer.from("'.concat(t.toString("hex"),'", "hex"), ').concat(this.sub_type,")")},e.BSON_BINARY_SUBTYPE_DEFAULT=0,e.BUFFER_SIZE=256,e.SUBTYPE_DEFAULT=0,e.SUBTYPE_FUNCTION=1,e.SUBTYPE_BYTE_ARRAY=2,e.SUBTYPE_UUID_OLD=3,e.SUBTYPE_UUID=4,e.SUBTYPE_MD5=5,e.SUBTYPE_ENCRYPTED=6,e.SUBTYPE_COLUMN=7,e.SUBTYPE_USER_DEFINED=128,e}();Object.defineProperty(Cn.prototype,"_bsontype",{value:"Binary"});var Du=16,Qm=function(e){ha(t,e);function t(r){var n=this,i,s;if(r==null)i=t.generate();else if(r instanceof t)i=Se.from(r.buffer),s=r.__id;else if(ArrayBuffer.isView(r)&&r.byteLength===Du)i=ma(r);else if(typeof r=="string")i=Pu(r);else throw new We("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=e.call(this,i,gd)||this,n.__id=s,n}return Object.defineProperty(t.prototype,"id",{get:function(){return this.buffer},set:function(r){this.buffer=r,t.cacheHexString&&(this.__id=Jm(r))},enumerable:!1,configurable:!0}),t.prototype.toHexString=function(r){if(r===void 0&&(r=!0),t.cacheHexString&&this.__id)return this.__id;var n=Jm(this.id,r);return t.cacheHexString&&(this.__id=n),n},t.prototype.toString=function(r){return r?this.id.toString(r):this.toHexString()},t.prototype.toJSON=function(){return this.toHexString()},t.prototype.equals=function(r){if(!r)return!1;if(r instanceof t)return r.id.equals(this.id);try{return new t(r).id.equals(this.id)}catch{return!1}},t.prototype.toBinary=function(){return new Cn(this.id,Cn.SUBTYPE_UUID)},t.generate=function(){var r=dd(Du);return r[6]=r[6]&15|64,r[8]=r[8]&63|128,Se.from(r)},t.isValid=function(r){return r?r instanceof t?!0:typeof r=="string"?hd(r):Lu(r)?r.length!==Du?!1:(r[6]&240)===64&&(r[8]&128)===128:!1:!1},t.createFromHexString=function(r){var n=Pu(r);return new t(n)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new UUID("'.concat(this.toHexString(),'")')},t}(Cn),ya=function(){function e(t,r){if(!(this instanceof e))return new e(t,r);this.code=t,this.scope=r}return e.prototype.toJSON=function(){return{code:this.code,scope:this.scope}},e.prototype.toExtendedJSON=function(){return this.scope?{$code:this.code,$scope:this.scope}:{$code:this.code}},e.fromExtendedJSON=function(t){return new e(t.$code,t.$scope)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){var t=this.toJSON();return'new Code("'.concat(String(t.code),'"').concat(t.scope?", ".concat(JSON.stringify(t.scope)):"",")")},e}();Object.defineProperty(ya.prototype,"_bsontype",{value:"Code"});function Q_(e){return bo(e)&&e.$id!=null&&typeof e.$ref=="string"&&(e.$db==null||typeof e.$db=="string")}var So=function(){function e(t,r,n,i){if(!(this instanceof e))return new e(t,r,n,i);var s=t.split(".");s.length===2&&(n=s.shift(),t=s.shift()),this.collection=t,this.oid=r,this.db=n,this.fields=i||{}}return Object.defineProperty(e.prototype,"namespace",{get:function(){return this.collection},set:function(t){this.collection=t},enumerable:!1,configurable:!0}),e.prototype.toJSON=function(){var t=Object.assign({$ref:this.collection,$id:this.oid},this.fields);return this.db!=null&&(t.$db=this.db),t},e.prototype.toExtendedJSON=function(t){t=t||{};var r={$ref:this.collection,$id:this.oid};return t.legacy||(this.db&&(r.$db=this.db),r=Object.assign(r,this.fields)),r},e.fromExtendedJSON=function(t){var r=Object.assign({},t);return delete r.$ref,delete r.$id,delete r.$db,new e(t.$ref,t.$id,t.$db,r)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){var t=this.oid===void 0||this.oid.toString===void 0?this.oid:this.oid.toString();return'new DBRef("'.concat(this.namespace,'", new ObjectId("').concat(String(t),'")').concat(this.db?', "'.concat(this.db,'"'):"",")")},e}();Object.defineProperty(So.prototype,"_bsontype",{value:"DBRef"});var Yt=void 0;try{Yt=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 Zm=65536,Z_=1<<24,bi=Zm*Zm,yd=bi*bi,ed=yd/2,td={},rd={},X=function(){function e(t,r,n){if(t===void 0&&(t=0),!(this instanceof e))return new e(t,r,n);typeof t=="bigint"?Object.assign(this,e.fromBigInt(t,!!r)):typeof t=="string"?Object.assign(this,e.fromString(t,!!r)):(this.low=t|0,this.high=r|0,this.unsigned=!!n),Object.defineProperty(this,"__isLong__",{value:!0,configurable:!1,writable:!1,enumerable:!1})}return e.fromBits=function(t,r,n){return new e(t,r,n)},e.fromInt=function(t,r){var n,i,s;return r?(t>>>=0,(s=0<=t&&t<256)&&(i=rd[t],i)?i:(n=e.fromBits(t,(t|0)<0?-1:0,!0),s&&(rd[t]=n),n)):(t|=0,(s=-128<=t&&t<128)&&(i=td[t],i)?i:(n=e.fromBits(t,t<0?-1:0,!1),s&&(td[t]=n),n))},e.fromNumber=function(t,r){if(isNaN(t))return r?e.UZERO:e.ZERO;if(r){if(t<0)return e.UZERO;if(t>=yd)return e.MAX_UNSIGNED_VALUE}else{if(t<=-ed)return e.MIN_VALUE;if(t+1>=ed)return e.MAX_VALUE}return t<0?e.fromNumber(-t,r).neg():e.fromBits(t%bi|0,t/bi|0,r)},e.fromBigInt=function(t,r){return e.fromString(t.toString(),r)},e.fromString=function(t,r,n){if(t.length===0)throw Error("empty string");if(t==="NaN"||t==="Infinity"||t==="+Infinity"||t==="-Infinity")return e.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=t.indexOf("-"))>0)throw Error("interior hyphen");if(i===0)return e.fromString(t.substring(1),r,n).neg();for(var s=e.fromNumber(Math.pow(n,8)),o=e.ZERO,c=0;c<t.length;c+=8){var u=Math.min(8,t.length-c),p=parseInt(t.substring(c,c+u),n);if(u<8){var m=e.fromNumber(Math.pow(n,u));o=o.mul(m).add(e.fromNumber(p))}else o=o.mul(s),o=o.add(e.fromNumber(p))}return o.unsigned=r,o},e.fromBytes=function(t,r,n){return n?e.fromBytesLE(t,r):e.fromBytesBE(t,r)},e.fromBytesLE=function(t,r){return new e(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,r)},e.fromBytesBE=function(t,r){return new e(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],r)},e.isLong=function(t){return bo(t)&&t.__isLong__===!0},e.fromValue=function(t,r){return typeof t=="number"?e.fromNumber(t,r):typeof t=="string"?e.fromString(t,r):e.fromBits(t.low,t.high,typeof r=="boolean"?r:t.unsigned)},e.prototype.add=function(t){e.isLong(t)||(t=e.fromValue(t));var r=this.high>>>16,n=this.high&65535,i=this.low>>>16,s=this.low&65535,o=t.high>>>16,c=t.high&65535,u=t.low>>>16,p=t.low&65535,m=0,h=0,y=0,E=0;return E+=s+p,y+=E>>>16,E&=65535,y+=i+u,h+=y>>>16,y&=65535,h+=n+c,m+=h>>>16,h&=65535,m+=r+o,m&=65535,e.fromBits(y<<16|E,m<<16|h,this.unsigned)},e.prototype.and=function(t){return e.isLong(t)||(t=e.fromValue(t)),e.fromBits(this.low&t.low,this.high&t.high,this.unsigned)},e.prototype.compare=function(t){if(e.isLong(t)||(t=e.fromValue(t)),this.eq(t))return 0;var r=this.isNegative(),n=t.isNegative();return r&&!n?-1:!r&&n?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.sub(t).isNegative()?-1:1},e.prototype.comp=function(t){return this.compare(t)},e.prototype.divide=function(t){if(e.isLong(t)||(t=e.fromValue(t)),t.isZero())throw Error("division by zero");if(Yt){if(!this.unsigned&&this.high===-2147483648&&t.low===-1&&t.high===-1)return this;var r=(this.unsigned?Yt.div_u:Yt.div_s)(this.low,this.high,t.low,t.high);return e.fromBits(r,Yt.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?e.UZERO:e.ZERO;var n,i,s;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return e.UZERO;if(t.gt(this.shru(1)))return e.UONE;s=e.UZERO}else{if(this.eq(e.MIN_VALUE)){if(t.eq(e.ONE)||t.eq(e.NEG_ONE))return e.MIN_VALUE;if(t.eq(e.MIN_VALUE))return e.ONE;var o=this.shr(1);return n=o.div(t).shl(1),n.eq(e.ZERO)?t.isNegative()?e.ONE:e.NEG_ONE:(i=this.sub(t.mul(n)),s=n.add(i.div(t)),s)}else if(t.eq(e.MIN_VALUE))return this.unsigned?e.UZERO:e.ZERO;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();s=e.ZERO}for(i=this;i.gte(t);){n=Math.max(1,Math.floor(i.toNumber()/t.toNumber()));for(var c=Math.ceil(Math.log(n)/Math.LN2),u=c<=48?1:Math.pow(2,c-48),p=e.fromNumber(n),m=p.mul(t);m.isNegative()||m.gt(i);)n-=u,p=e.fromNumber(n,this.unsigned),m=p.mul(t);p.isZero()&&(p=e.ONE),s=s.add(p),i=i.sub(m)}return s},e.prototype.div=function(t){return this.divide(t)},e.prototype.equals=function(t){return e.isLong(t)||(t=e.fromValue(t)),this.unsigned!==t.unsigned&&this.high>>>31===1&&t.high>>>31===1?!1:this.high===t.high&&this.low===t.low},e.prototype.eq=function(t){return this.equals(t)},e.prototype.getHighBits=function(){return this.high},e.prototype.getHighBitsUnsigned=function(){return this.high>>>0},e.prototype.getLowBits=function(){return this.low},e.prototype.getLowBitsUnsigned=function(){return this.low>>>0},e.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.eq(e.MIN_VALUE)?64:this.neg().getNumBitsAbs();var t=this.high!==0?this.high:this.low,r;for(r=31;r>0&&(t&1<<r)===0;r--);return this.high!==0?r+33:r+1},e.prototype.greaterThan=function(t){return this.comp(t)>0},e.prototype.gt=function(t){return this.greaterThan(t)},e.prototype.greaterThanOrEqual=function(t){return this.comp(t)>=0},e.prototype.gte=function(t){return this.greaterThanOrEqual(t)},e.prototype.ge=function(t){return this.greaterThanOrEqual(t)},e.prototype.isEven=function(){return(this.low&1)===0},e.prototype.isNegative=function(){return!this.unsigned&&this.high<0},e.prototype.isOdd=function(){return(this.low&1)===1},e.prototype.isPositive=function(){return this.unsigned||this.high>=0},e.prototype.isZero=function(){return this.high===0&&this.low===0},e.prototype.lessThan=function(t){return this.comp(t)<0},e.prototype.lt=function(t){return this.lessThan(t)},e.prototype.lessThanOrEqual=function(t){return this.comp(t)<=0},e.prototype.lte=function(t){return this.lessThanOrEqual(t)},e.prototype.modulo=function(t){if(e.isLong(t)||(t=e.fromValue(t)),Yt){var r=(this.unsigned?Yt.rem_u:Yt.rem_s)(this.low,this.high,t.low,t.high);return e.fromBits(r,Yt.get_high(),this.unsigned)}return this.sub(this.div(t).mul(t))},e.prototype.mod=function(t){return this.modulo(t)},e.prototype.rem=function(t){return this.modulo(t)},e.prototype.multiply=function(t){if(this.isZero())return e.ZERO;if(e.isLong(t)||(t=e.fromValue(t)),Yt){var r=Yt.mul(this.low,this.high,t.low,t.high);return e.fromBits(r,Yt.get_high(),this.unsigned)}if(t.isZero())return e.ZERO;if(this.eq(e.MIN_VALUE))return t.isOdd()?e.MIN_VALUE:e.ZERO;if(t.eq(e.MIN_VALUE))return this.isOdd()?e.MIN_VALUE:e.ZERO;if(this.isNegative())return t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg();if(t.isNegative())return this.mul(t.neg()).neg();if(this.lt(e.TWO_PWR_24)&&t.lt(e.TWO_PWR_24))return e.fromNumber(this.toNumber()*t.toNumber(),this.unsigned);var n=this.high>>>16,i=this.high&65535,s=this.low>>>16,o=this.low&65535,c=t.high>>>16,u=t.high&65535,p=t.low>>>16,m=t.low&65535,h=0,y=0,E=0,v=0;return v+=o*m,E+=v>>>16,v&=65535,E+=s*m,y+=E>>>16,E&=65535,E+=o*p,y+=E>>>16,E&=65535,y+=i*m,h+=y>>>16,y&=65535,y+=s*p,h+=y>>>16,y&=65535,y+=o*u,h+=y>>>16,y&=65535,h+=n*m+i*p+s*u+o*c,h&=65535,e.fromBits(E<<16|v,h<<16|y,this.unsigned)},e.prototype.mul=function(t){return this.multiply(t)},e.prototype.negate=function(){return!this.unsigned&&this.eq(e.MIN_VALUE)?e.MIN_VALUE:this.not().add(e.ONE)},e.prototype.neg=function(){return this.negate()},e.prototype.not=function(){return e.fromBits(~this.low,~this.high,this.unsigned)},e.prototype.notEquals=function(t){return!this.equals(t)},e.prototype.neq=function(t){return this.notEquals(t)},e.prototype.ne=function(t){return this.notEquals(t)},e.prototype.or=function(t){return e.isLong(t)||(t=e.fromValue(t)),e.fromBits(this.low|t.low,this.high|t.high,this.unsigned)},e.prototype.shiftLeft=function(t){return e.isLong(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?e.fromBits(this.low<<t,this.high<<t|this.low>>>32-t,this.unsigned):e.fromBits(0,this.low<<t-32,this.unsigned)},e.prototype.shl=function(t){return this.shiftLeft(t)},e.prototype.shiftRight=function(t){return e.isLong(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?e.fromBits(this.low>>>t|this.high<<32-t,this.high>>t,this.unsigned):e.fromBits(this.high>>t-32,this.high>=0?0:-1,this.unsigned)},e.prototype.shr=function(t){return this.shiftRight(t)},e.prototype.shiftRightUnsigned=function(t){if(e.isLong(t)&&(t=t.toInt()),t&=63,t===0)return this;var r=this.high;if(t<32){var n=this.low;return e.fromBits(n>>>t|r<<32-t,r>>>t,this.unsigned)}else return t===32?e.fromBits(r,0,this.unsigned):e.fromBits(r>>>t-32,0,this.unsigned)},e.prototype.shr_u=function(t){return this.shiftRightUnsigned(t)},e.prototype.shru=function(t){return this.shiftRightUnsigned(t)},e.prototype.subtract=function(t){return e.isLong(t)||(t=e.fromValue(t)),this.add(t.neg())},e.prototype.sub=function(t){return this.subtract(t)},e.prototype.toInt=function(){return this.unsigned?this.low>>>0:this.low},e.prototype.toNumber=function(){return this.unsigned?(this.high>>>0)*bi+(this.low>>>0):this.high*bi+(this.low>>>0)},e.prototype.toBigInt=function(){return BigInt(this.toString())},e.prototype.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()},e.prototype.toBytesLE=function(){var t=this.high,r=this.low;return[r&255,r>>>8&255,r>>>16&255,r>>>24,t&255,t>>>8&255,t>>>16&255,t>>>24]},e.prototype.toBytesBE=function(){var t=this.high,r=this.low;return[t>>>24,t>>>16&255,t>>>8&255,t&255,r>>>24,r>>>16&255,r>>>8&255,r&255]},e.prototype.toSigned=function(){return this.unsigned?e.fromBits(this.low,this.high,!1):this},e.prototype.toString=function(t){if(t=t||10,t<2||36<t)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(e.MIN_VALUE)){var r=e.fromNumber(t),n=this.div(r),i=n.mul(r).sub(this);return n.toString(t)+i.toInt().toString(t)}else return"-"+this.neg().toString(t);for(var s=e.fromNumber(Math.pow(t,6),this.unsigned),o=this,c="";;){var u=o.div(s),p=o.sub(u.mul(s)).toInt()>>>0,m=p.toString(t);if(o=u,o.isZero())return m+c;for(;m.length<6;)m="0"+m;c=""+m+c}},e.prototype.toUnsigned=function(){return this.unsigned?this:e.fromBits(this.low,this.high,!0)},e.prototype.xor=function(t){return e.isLong(t)||(t=e.fromValue(t)),e.fromBits(this.low^t.low,this.high^t.high,this.unsigned)},e.prototype.eqz=function(){return this.isZero()},e.prototype.le=function(t){return this.lessThanOrEqual(t)},e.prototype.toExtendedJSON=function(t){return t&&t.relaxed?this.toNumber():{$numberLong:this.toString()}},e.fromExtendedJSON=function(t,r){var n=e.fromString(t.$numberLong);return r&&r.relaxed?n.toNumber():n},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return'new Long("'.concat(this.toString(),'"').concat(this.unsigned?", true":"",")")},e.TWO_PWR_24=e.fromInt(Z_),e.MAX_UNSIGNED_VALUE=e.fromBits(-1,-1,!0),e.ZERO=e.fromInt(0),e.UZERO=e.fromInt(0,!0),e.ONE=e.fromInt(1),e.UONE=e.fromInt(1,!0),e.NEG_ONE=e.fromInt(-1),e.MAX_VALUE=e.fromBits(-1,2147483647,!1),e.MIN_VALUE=e.fromBits(0,-2147483648,!1),e}();Object.defineProperty(X.prototype,"__isLong__",{value:!0});Object.defineProperty(X.prototype,"_bsontype",{value:"Long"});var eE=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,tE=/^(\+|-)?(Infinity|inf)$/i,rE=/^(\+|-)?NaN$/i,Eo=6111,Ru=-6176,nd=6176,nE=34,Au=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),id=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),od=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),iE=/^([-+])?(\d+)?$/,oE=31,sd=16383,sE=30,aE=31;function ad(e){return!isNaN(parseInt(e,10))}function cE(e){var t=X.fromNumber(1e9),r=X.fromNumber(0);if(!e.parts[0]&&!e.parts[1]&&!e.parts[2]&&!e.parts[3])return{quotient:e,rem:r};for(var n=0;n<=3;n++)r=r.shiftLeft(32),r=r.add(new X(e.parts[n],0)),e.parts[n]=r.div(t).low,r=r.modulo(t);return{quotient:e,rem:r}}function lE(e,t){if(!e&&!t)return{high:X.fromNumber(0),low:X.fromNumber(0)};var r=e.shiftRightUnsigned(32),n=new X(e.getLowBits(),0),i=t.shiftRightUnsigned(32),s=new X(t.getLowBits(),0),o=r.multiply(i),c=r.multiply(s),u=n.multiply(i),p=n.multiply(s);return o=o.add(c.shiftRightUnsigned(32)),c=new X(c.getLowBits(),0).add(u).add(p.shiftRightUnsigned(32)),o=o.add(c.shiftRightUnsigned(32)),p=c.shiftLeft(32).add(new X(p.getLowBits(),0)),{high:o,low:p}}function uE(e,t){var r=e.high>>>0,n=t.high>>>0;if(r<n)return!0;if(r===n){var i=e.low>>>0,s=t.low>>>0;if(i<s)return!0}return!1}function wi(e,t){throw new We('"'.concat(e,'" is not a valid Decimal128 string - ').concat(t))}var Bu=function(){function e(t){if(!(this instanceof e))return new e(t);if(typeof t=="string")this.bytes=e.fromString(t).bytes;else if(Lu(t)){if(t.byteLength!==16)throw new We("Decimal128 must take a Buffer of 16 bytes");this.bytes=t}else throw new We("Decimal128 must take a Buffer or string")}return e.fromString=function(t){var r=!1,n=!1,i=!1,s=0,o=0,c=0,u=0,p=0,m=[0],h=0,y=0,E=0,v=0,_=0,x=0,P=new X(0,0),B=new X(0,0),U=0,R=0;if(t.length>=7e3)throw new We(""+t+" not a valid Decimal128 string");var G=t.match(eE),ue=t.match(tE),Me=t.match(rE);if(!G&&!ue&&!Me||t.length===0)throw new We(""+t+" not a valid Decimal128 string");if(G){var j=G[2],Q=G[4],z=G[5],J=G[6];Q&&J===void 0&&wi(t,"missing exponent power"),Q&&j===void 0&&wi(t,"missing exponent base"),Q===void 0&&(z||J)&&wi(t,"missing e before exponent")}if((t[R]==="+"||t[R]==="-")&&(r=t[R++]==="-"),!ad(t[R])&&t[R]!=="."){if(t[R]==="i"||t[R]==="I")return new e(Se.from(r?id:od));if(t[R]==="N")return new e(Se.from(Au))}for(;ad(t[R])||t[R]===".";){if(t[R]==="."){n&&wi(t,"contains multiple periods"),n=!0,R=R+1;continue}h<34&&(t[R]!=="0"||i)&&(i||(p=o),i=!0,m[y++]=parseInt(t[R],10),h=h+1),i&&(c=c+1),n&&(u=u+1),o=o+1,R=R+1}if(n&&!o)throw new We(""+t+" not a valid Decimal128 string");if(t[R]==="e"||t[R]==="E"){var ge=t.substr(++R).match(iE);if(!ge||!ge[2])return new e(Se.from(Au));_=parseInt(ge[0],10),R=R+ge[0].length}if(t[R])return new e(Se.from(Au));if(E=0,!h)E=0,v=0,m[0]=0,c=1,h=1,s=0;else if(v=h-1,s=c,s!==1)for(;m[p+s-1]===0;)s=s-1;for(_<=u&&u-_>16384?_=Ru:_=_-u;_>Eo;){if(v=v+1,v-E>nE){var je=m.join("");if(je.match(/^0+$/)){_=Eo;break}wi(t,"overflow")}_=_-1}for(;_<Ru||h<c;){if(v===0&&s<h){_=Ru,s=0;break}if(h<c?c=c-1:v=v-1,_<Eo)_=_+1;else{var je=m.join("");if(je.match(/^0+$/)){_=Eo;break}wi(t,"overflow")}}if(v-E+1<s){var De=o;n&&(p=p+1,De=De+1),r&&(p=p+1,De=De+1);var d=parseInt(t[p+v+1],10),qe=0;if(d>=5&&(qe=1,d===5)){for(qe=m[v]%2===1?1:0,x=p+v+2;x<De;x++)if(parseInt(t[x],10)){qe=1;break}}if(qe){for(var ve=v;ve>=0;ve--)if(++m[ve]>9&&(m[ve]=0,ve===0))if(_<Eo)_=_+1,m[ve]=1;else return new e(Se.from(r?id:od))}}if(P=X.fromNumber(0),B=X.fromNumber(0),s===0)P=X.fromNumber(0),B=X.fromNumber(0);else if(v-E<17){var ve=E;for(B=X.fromNumber(m[ve++]),P=new X(0,0);ve<=v;ve++)B=B.multiply(X.fromNumber(10)),B=B.add(X.fromNumber(m[ve]))}else{var ve=E;for(P=X.fromNumber(m[ve++]);ve<=v-17;ve++)P=P.multiply(X.fromNumber(10)),P=P.add(X.fromNumber(m[ve]));for(B=X.fromNumber(m[ve++]);ve<=v;ve++)B=B.multiply(X.fromNumber(10)),B=B.add(X.fromNumber(m[ve]))}var gt=lE(P,X.fromString("100000000000000000"));gt.low=gt.low.add(B),uE(gt.low,B)&&(gt.high=gt.high.add(X.fromNumber(1))),U=_+nd;var se={low:X.fromNumber(0),high:X.fromNumber(0)};gt.high.shiftRightUnsigned(49).and(X.fromNumber(1)).equals(X.fromNumber(1))?(se.high=se.high.or(X.fromNumber(3).shiftLeft(61)),se.high=se.high.or(X.fromNumber(U).and(X.fromNumber(16383).shiftLeft(47))),se.high=se.high.or(gt.high.and(X.fromNumber(0x7fffffffffff)))):(se.high=se.high.or(X.fromNumber(U&16383).shiftLeft(49)),se.high=se.high.or(gt.high.and(X.fromNumber(562949953421311)))),se.low=gt.low,r&&(se.high=se.high.or(X.fromString("9223372036854775808")));var ie=Se.alloc(16);return R=0,ie[R++]=se.low.low&255,ie[R++]=se.low.low>>8&255,ie[R++]=se.low.low>>16&255,ie[R++]=se.low.low>>24&255,ie[R++]=se.low.high&255,ie[R++]=se.low.high>>8&255,ie[R++]=se.low.high>>16&255,ie[R++]=se.low.high>>24&255,ie[R++]=se.high.low&255,ie[R++]=se.high.low>>8&255,ie[R++]=se.high.low>>16&255,ie[R++]=se.high.low>>24&255,ie[R++]=se.high.high&255,ie[R++]=se.high.high>>8&255,ie[R++]=se.high.high>>16&255,ie[R++]=se.high.high>>24&255,new e(ie)},e.prototype.toString=function(){for(var t,r=0,n=new Array(36),i=0;i<n.length;i++)n[i]=0;var s=0,o=!1,c,u={parts:[0,0,0,0]},p,m,h=[];s=0;var y=this.bytes,E=y[s++]|y[s++]<<8|y[s++]<<16|y[s++]<<24,v=y[s++]|y[s++]<<8|y[s++]<<16|y[s++]<<24,_=y[s++]|y[s++]<<8|y[s++]<<16|y[s++]<<24,x=y[s++]|y[s++]<<8|y[s++]<<16|y[s++]<<24;s=0;var P={low:new X(E,v),high:new X(_,x)};P.high.lessThan(X.ZERO)&&h.push("-");var B=x>>26&oE;if(B>>3===3){if(B===sE)return h.join("")+"Infinity";if(B===aE)return"NaN";t=x>>15&sd,c=8+(x>>14&1)}else c=x>>14&7,t=x>>17&sd;var U=t-nd;if(u.parts[0]=(x&16383)+((c&15)<<14),u.parts[1]=_,u.parts[2]=v,u.parts[3]=E,u.parts[0]===0&&u.parts[1]===0&&u.parts[2]===0&&u.parts[3]===0)o=!0;else for(m=3;m>=0;m--){var R=0,G=cE(u);if(u=G.quotient,R=G.rem.low,!!R)for(p=8;p>=0;p--)n[m*9+p]=R%10,R=Math.floor(R/10)}if(o)r=1,n[s]=0;else for(r=36;!n[s];)r=r-1,s=s+1;var ue=r-1+U;if(ue>=34||ue<=-7||U>0){if(r>34)return h.push("".concat(0)),U>0?h.push("E+".concat(U)):U<0&&h.push("E".concat(U)),h.join("");h.push("".concat(n[s++])),r=r-1,r&&h.push(".");for(var i=0;i<r;i++)h.push("".concat(n[s++]));h.push("E"),ue>0?h.push("+".concat(ue)):h.push("".concat(ue))}else if(U>=0)for(var i=0;i<r;i++)h.push("".concat(n[s++]));else{var Me=r+U;if(Me>0)for(var i=0;i<Me;i++)h.push("".concat(n[s++]));else h.push("0");for(h.push(".");Me++<0;)h.push("0");for(var i=0;i<r-Math.max(Me-1,0);i++)h.push("".concat(n[s++]))}return h.join("")},e.prototype.toJSON=function(){return{$numberDecimal:this.toString()}},e.prototype.toExtendedJSON=function(){return{$numberDecimal:this.toString()}},e.fromExtendedJSON=function(t){return e.fromString(t.$numberDecimal)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return'new Decimal128("'.concat(this.toString(),'")')},e}();Object.defineProperty(Bu.prototype,"_bsontype",{value:"Decimal128"});var va=function(){function e(t){if(!(this instanceof e))return new e(t);t instanceof Number&&(t=t.valueOf()),this.value=+t}return e.prototype.valueOf=function(){return this.value},e.prototype.toJSON=function(){return this.value},e.prototype.toString=function(t){return this.value.toString(t)},e.prototype.toExtendedJSON=function(t){return t&&(t.legacy||t.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()}},e.fromExtendedJSON=function(t,r){var n=parseFloat(t.$numberDouble);return r&&r.relaxed?n:new e(n)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){var t=this.toExtendedJSON();return"new Double(".concat(t.$numberDouble,")")},e}();Object.defineProperty(va.prototype,"_bsontype",{value:"Double"});var Ea=function(){function e(t){if(!(this instanceof e))return new e(t);t instanceof Number&&(t=t.valueOf()),this.value=+t|0}return e.prototype.valueOf=function(){return this.value},e.prototype.toString=function(t){return this.value.toString(t)},e.prototype.toJSON=function(){return this.value},e.prototype.toExtendedJSON=function(t){return t&&(t.relaxed||t.legacy)?this.value:{$numberInt:this.value.toString()}},e.fromExtendedJSON=function(t,r){return r&&r.relaxed?parseInt(t.$numberInt,10):new e(t.$numberInt)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return"new Int32(".concat(this.valueOf(),")")},e}();Object.defineProperty(Ea.prototype,"_bsontype",{value:"Int32"});var Uu=function(){function e(){if(!(this instanceof e))return new e}return e.prototype.toExtendedJSON=function(){return{$maxKey:1}},e.fromExtendedJSON=function(){return new e},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return"new MaxKey()"},e}();Object.defineProperty(Uu.prototype,"_bsontype",{value:"MaxKey"});var ku=function(){function e(){if(!(this instanceof e))return new e}return e.prototype.toExtendedJSON=function(){return{$minKey:1}},e.fromExtendedJSON=function(){return new e},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return"new MinKey()"},e}();Object.defineProperty(ku.prototype,"_bsontype",{value:"MinKey"});var pE=new RegExp("^[0-9a-fA-F]{24}$"),In=null,Ir=Symbol("id"),tt=function(){function e(t){if(!(this instanceof e))return new e(t);var r;if(typeof t=="object"&&t&&"id"in t){if(typeof t.id!="string"&&!ArrayBuffer.isView(t.id))throw new We("Argument passed in must have an id that is of type string or Buffer");"toHexString"in t&&typeof t.toHexString=="function"?r=Se.from(t.toHexString(),"hex"):r=t.id}else r=t;if(r==null||typeof r=="number")this[Ir]=e.generate(typeof r=="number"?r:void 0);else if(ArrayBuffer.isView(r)&&r.byteLength===12)this[Ir]=r instanceof Se?r:ma(r);else if(typeof r=="string")if(r.length===12){var n=Se.from(r);if(n.byteLength===12)this[Ir]=n;else throw new We("Argument passed in must be a string of 12 bytes")}else if(r.length===24&&pE.test(r))this[Ir]=Se.from(r,"hex");else throw new We("Argument passed in must be a string of 12 bytes or a string of 24 hex characters or an integer");else throw new We("Argument passed in does not match the accepted types");e.cacheHexString&&(this.__id=this.id.toString("hex"))}return Object.defineProperty(e.prototype,"id",{get:function(){return this[Ir]},set:function(t){this[Ir]=t,e.cacheHexString&&(this.__id=t.toString("hex"))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"generationTime",{get:function(){return this.id.readInt32BE(0)},set:function(t){this.id.writeUInt32BE(t,0)},enumerable:!1,configurable:!0}),e.prototype.toHexString=function(){if(e.cacheHexString&&this.__id)return this.__id;var t=this.id.toString("hex");return e.cacheHexString&&!this.__id&&(this.__id=t),t},e.getInc=function(){return e.index=(e.index+1)%16777215},e.generate=function(t){typeof t!="number"&&(t=Math.floor(Date.now()/1e3));var r=e.getInc(),n=Se.alloc(12);return n.writeUInt32BE(t,0),In===null&&(In=dd(5)),n[4]=In[0],n[5]=In[1],n[6]=In[2],n[7]=In[3],n[8]=In[4],n[11]=r&255,n[10]=r>>8&255,n[9]=r>>16&255,n},e.prototype.toString=function(t){return t?this.id.toString(t):this.toHexString()},e.prototype.toJSON=function(){return this.toHexString()},e.prototype.equals=function(t){if(t==null)return!1;if(t instanceof e)return this[Ir][11]===t[Ir][11]&&this[Ir].equals(t[Ir]);if(typeof t=="string"&&e.isValid(t)&&t.length===12&&Lu(this.id))return t===Se.prototype.toString.call(this.id,"latin1");if(typeof t=="string"&&e.isValid(t)&&t.length===24)return t.toLowerCase()===this.toHexString();if(typeof t=="string"&&e.isValid(t)&&t.length===12)return Se.from(t).equals(this.id);if(typeof t=="object"&&"toHexString"in t&&typeof t.toHexString=="function"){var r=t.toHexString(),n=this.toHexString().toLowerCase();return typeof r=="string"&&r.toLowerCase()===n}return!1},e.prototype.getTimestamp=function(){var t=new Date,r=this.id.readUInt32BE(0);return t.setTime(Math.floor(r)*1e3),t},e.createPk=function(){return new e},e.createFromTime=function(t){var r=Se.from([0,0,0,0,0,0,0,0,0,0,0,0]);return r.writeUInt32BE(t,0),new e(r)},e.createFromHexString=function(t){if(typeof t>"u"||t!=null&&t.length!==24)throw new We("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");return new e(Se.from(t,"hex"))},e.isValid=function(t){if(t==null)return!1;try{return new e(t),!0}catch{return!1}},e.prototype.toExtendedJSON=function(){return this.toHexString?{$oid:this.toHexString()}:{$oid:this.toString("hex")}},e.fromExtendedJSON=function(t){return new e(t.$oid)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return'new ObjectId("'.concat(this.toHexString(),'")')},e.index=Math.floor(Math.random()*16777215),e}();Object.defineProperty(tt.prototype,"generate",{value:ga(function(e){return tt.generate(e)},"Please use the static `ObjectId.generate(time)` instead")});Object.defineProperty(tt.prototype,"getInc",{value:ga(function(){return tt.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(tt.prototype,"get_inc",{value:ga(function(){return tt.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(tt,"get_inc",{value:ga(function(){return tt.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(tt.prototype,"_bsontype",{value:"ObjectID"});function fE(e){return e.split("").sort().join("")}var wo=function(){function e(t,r){if(!(this instanceof e))return new e(t,r);if(this.pattern=t,this.options=fE(r??""),this.pattern.indexOf("\0")!==-1)throw new Tn("BSON Regex patterns cannot contain null bytes, found: ".concat(JSON.stringify(this.pattern)));if(this.options.indexOf("\0")!==-1)throw new Tn("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 Tn("The regular expression option [".concat(this.options[n],"] is not supported"))}return e.parseOptions=function(t){return t?t.split("").sort().join(""):""},e.prototype.toExtendedJSON=function(t){return t=t||{},t.legacy?{$regex:this.pattern,$options:this.options}:{$regularExpression:{pattern:this.pattern,options:this.options}}},e.fromExtendedJSON=function(t){if("$regex"in t)if(typeof t.$regex!="string"){if(t.$regex._bsontype==="BSONRegExp")return t}else return new e(t.$regex,e.parseOptions(t.$options));if("$regularExpression"in t)return new e(t.$regularExpression.pattern,e.parseOptions(t.$regularExpression.options));throw new We("Unexpected BSONRegExp EJSON object form: ".concat(JSON.stringify(t)))},e}();Object.defineProperty(wo.prototype,"_bsontype",{value:"BSONRegExp"});var Mu=function(){function e(t){if(!(this instanceof e))return new e(t);this.value=t}return e.prototype.valueOf=function(){return this.value},e.prototype.toString=function(){return this.value},e.prototype.inspect=function(){return'new BSONSymbol("'.concat(this.value,'")')},e.prototype.toJSON=function(){return this.value},e.prototype.toExtendedJSON=function(){return{$symbol:this.value}},e.fromExtendedJSON=function(t){return new e(t.$symbol)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e}();Object.defineProperty(Mu.prototype,"_bsontype",{value:"Symbol"});var mE=X,vd=function(e){ha(t,e);function t(r,n){var i=this;return i instanceof t?(X.isLong(r)?i=e.call(this,r.low,r.high,!0)||this:bo(r)&&typeof r.t<"u"&&typeof r.i<"u"?i=e.call(this,r.i,r.t,!0)||this:i=e.call(this,r,n,!0)||this,Object.defineProperty(i,"_bsontype",{value:"Timestamp",writable:!1,configurable:!1,enumerable:!1}),i):new t(r,n)}return t.prototype.toJSON=function(){return{$timestamp:this.toString()}},t.fromInt=function(r){return new t(X.fromInt(r,!0))},t.fromNumber=function(r){return new t(X.fromNumber(r,!0))},t.fromBits=function(r,n){return new t(r,n)},t.fromString=function(r,n){return new t(X.fromString(r,!0,n))},t.prototype.toExtendedJSON=function(){return{$timestamp:{t:this.high>>>0,i:this.low>>>0}}},t.fromExtendedJSON=function(r){return new t(r.$timestamp)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new Timestamp({ t: ".concat(this.getHighBits(),", i: ").concat(this.getLowBits()," })")},t.MAX_VALUE=X.MAX_UNSIGNED_VALUE,t}(mE);function dE(e){return bo(e)&&Reflect.has(e,"_bsontype")&&typeof e._bsontype=="string"}var _d=2147483647,Ed=-2147483648,Sd=9223372036854776e3,wd=-9223372036854776e3,hE={$oid:tt,$binary:Cn,$uuid:Cn,$symbol:Mu,$numberInt:Ea,$numberDecimal:Bu,$numberDouble:va,$numberLong:X,$minKey:ku,$maxKey:Uu,$regex:wo,$regularExpression:wo,$timestamp:vd};function bd(e,t){if(t===void 0&&(t={}),typeof e=="number"){if(t.relaxed||t.legacy)return e;if(Math.floor(e)===e){if(e>=Ed&&e<=_d)return new Ea(e);if(e>=wd&&e<=Sd)return X.fromNumber(e)}return new va(e)}if(e==null||typeof e!="object")return e;if(e.$undefined)return null;for(var r=Object.keys(e).filter(function(h){return h.startsWith("$")&&e[h]!=null}),n=0;n<r.length;n++){var i=hE[r[n]];if(i)return i.fromExtendedJSON(e,t)}if(e.$date!=null){var s=e.$date,o=new Date;return t.legacy?typeof s=="number"?o.setTime(s):typeof s=="string"&&o.setTime(Date.parse(s)):typeof s=="string"?o.setTime(Date.parse(s)):X.isLong(s)?o.setTime(s.toNumber()):typeof s=="number"&&t.relaxed&&o.setTime(s),o}if(e.$code!=null){var c=Object.assign({},e);return e.$scope&&(c.$scope=bd(e.$scope)),ya.fromExtendedJSON(e)}if(Q_(e)||e.$dbPointer){var u=e.$ref?e:e.$dbPointer;if(u instanceof So)return u;var p=Object.keys(u).filter(function(h){return h.startsWith("$")}),m=!0;if(p.forEach(function(h){["$ref","$id","$db"].indexOf(h)===-1&&(m=!1)}),m)return So.fromExtendedJSON(u)}return e}function gE(e,t){return e.map(function(r,n){t.seenObjects.push({propertyName:"index ".concat(n),obj:null});try{return Qr(r,t)}finally{t.seenObjects.pop()}})}function cd(e){var t=e.toISOString();return e.getUTCMilliseconds()!==0?t:t.slice(0,-5)+"Z"}function Qr(e,t){if((typeof e=="object"||typeof e=="function")&&e!==null){var r=t.seenObjects.findIndex(function(P){return P.obj===e});if(r!==-1){var n=t.seenObjects.map(function(P){return P.propertyName}),i=n.slice(0,r).map(function(P){return"".concat(P," -> ")}).join(""),s=n[r],o=" -> "+n.slice(r+1,n.length-1).map(function(P){return"".concat(P," -> ")}).join(""),c=n[n.length-1],u=" ".repeat(i.length+s.length/2),p="-".repeat(o.length+(s.length+c.length)/2-1);throw new We(`Converting circular structure to EJSON:
|
|
35
35
|
`+" ".concat(i).concat(s).concat(o).concat(c,`
|
|
36
|
-
`)+" ".concat(u,"\\").concat(
|
|
37
|
-
${
|
|
38
|
-
`)}`:"",this.name="UnsubscriptionError",this.errors=e});function Tn(t,e){if(t){let r=t.indexOf(e);0<=r&&t.splice(r,1)}}var zt=class Xu{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 s of r)s.remove(this);else r.remove(this);let{initialTeardown:n}=this;if(ae(n))try{n()}catch(s){e=s instanceof va?s.errors:[s]}let{_finalizers:i}=this;if(i){this._finalizers=null;for(let s of i)try{Fm(s)}catch(o){e=e??[],o instanceof va?e=[...e,...o.errors]:e.push(o)}}if(e)throw new va(e)}}add(e){var r;if(e&&e!==this)if(this.closed)Fm(e);else{if(e instanceof Xu){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)&&Tn(r,e)}remove(e){let{_finalizers:r}=this;r&&Tn(r,e),e instanceof Xu&&e._removeParent(this)}};zt.EMPTY=(()=>{let t=new zt;return t.closed=!0,t})();var Lu=zt.EMPTY;function Ea(t){return t instanceof zt||t&&"closed"in t&&ae(t.remove)&&ae(t.add)&&ae(t.unsubscribe)}function Fm(t){ae(t)?t():t.unsubscribe()}var or={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},wi={setTimeout(t,e,...r){let{delegate:n}=wi;return n?.setTimeout?n.setTimeout(t,e,...r):setTimeout(t,e,...r)},clearTimeout(t){let{delegate:e}=wi;return(e?.clearTimeout||clearTimeout)(t)},delegate:void 0};function Sa(t){wi.setTimeout(()=>{let{onUnhandledError:e}=or;if(e)e(t);else throw t})}function Bu(){}var Hm=Uu("C",void 0,void 0);function $m(t){return Uu("E",void 0,t)}function jm(t){return Uu("N",t,void 0)}function Uu(t,e,r){return{kind:t,value:e,error:r}}var xn=null;function bi(t){if(or.useDeprecatedSynchronousErrorHandling){let e=!xn;if(e&&(xn={errorThrown:!1,error:null}),t(),e){let{errorThrown:r,error:n}=xn;if(xn=null,r)throw n}}else t()}function Wm(t){or.useDeprecatedSynchronousErrorHandling&&xn&&(xn.errorThrown=!0,xn.error=t)}var Cn=class extends zt{constructor(t){super(),this.isStopped=!1,t?(this.destination=t,Ea(t)&&t.add(this)):this.destination=I_}static create(t,e,r){return new Ii(t,e,r)}next(t){this.isStopped?Mu(jm(t),this):this._next(t)}error(t){this.isStopped?Mu($m(t),this):(this.isStopped=!0,this._error(t))}complete(){this.isStopped?Mu(Hm,this):(this.isStopped=!0,this._complete())}unsubscribe(){this.closed||(this.isStopped=!0,super.unsubscribe(),this.destination=null)}_next(t){this.destination.next(t)}_error(t){try{this.destination.error(t)}finally{this.unsubscribe()}}_complete(){try{this.destination.complete()}finally{this.unsubscribe()}}},w_=Function.prototype.bind;function ku(t,e){return w_.call(t,e)}var Fu=class{constructor(t){this.partialObserver=t}next(t){let{partialObserver:e}=this;if(e.next)try{e.next(t)}catch(r){wa(r)}}error(t){let{partialObserver:e}=this;if(e.error)try{e.error(t)}catch(r){wa(r)}else wa(t)}complete(){let{partialObserver:t}=this;if(t.complete)try{t.complete()}catch(e){wa(e)}}},Ii=class extends Cn{constructor(t,e,r){super();let n;if(ae(t)||!t)n={next:t??void 0,error:e??void 0,complete:r??void 0};else{let i;this&&or.useDeprecatedNextContext?(i=Object.create(t),i.unsubscribe=()=>this.unsubscribe(),n={next:t.next&&ku(t.next,i),error:t.error&&ku(t.error,i),complete:t.complete&&ku(t.complete,i)}):n=t}this.destination=new Fu(n)}};function wa(t){or.useDeprecatedSynchronousErrorHandling?Wm(t):Sa(t)}function b_(t){throw t}function Mu(t,e){let{onStoppedNotification:r}=or;r&&wi.setTimeout(()=>r(t,e))}var I_={closed:!0,next:Bu,error:b_,complete:Bu},Ti=typeof Symbol=="function"&&Symbol.observable||"@@observable";function ba(t){return t}function Gm(t){return t.length===0?ba:t.length===1?t[0]:function(e){return t.reduce((r,n)=>n(r),e)}}var nt=(()=>{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 s=x_(r)?r:new Ii(r,n,i);return bi(()=>{let{operator:o,source:c}=this;s.add(o?o.call(s,c):c?this._subscribe(s):this._trySubscribe(s))}),s}_trySubscribe(r){try{return this._subscribe(r)}catch(n){r.error(n)}}forEach(r,n){return n=Vm(n),new n((i,s)=>{let o=new Ii({next:c=>{try{r(c)}catch(u){s(u),o.unsubscribe()}},error:s,complete:i});this.subscribe(o)})}_subscribe(r){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(r)}[Ti](){return this}pipe(...r){return Gm(r)(this)}toPromise(r){return r=Vm(r),new r((n,i)=>{let s;this.subscribe(o=>s=o,o=>i(o),()=>n(s))})}}return t.create=e=>new t(e),t})();function Vm(t){var e;return(e=t??or.Promise)!==null&&e!==void 0?e:Promise}function T_(t){return t&&ae(t.next)&&ae(t.error)&&ae(t.complete)}function x_(t){return t&&t instanceof Cn||T_(t)&&Ea(t)}function C_(t){return ae(t?.lift)}function Yt(t){return e=>{if(C_(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 kr(t,e,r,n,i){return new Hu(t,e,r,n,i)}var Hu=class extends Cn{constructor(t,e,r,n,i,s){super(t),this.onFinalize=i,this.shouldUnsubscribe=s,this._next=e?function(o){try{e(o)}catch(c){t.error(c)}}:super._next,this._error=n?function(o){try{n(o)}catch(c){t.error(c)}finally{this.unsubscribe()}}:super._error,this._complete=r?function(){try{r()}catch(o){t.error(o)}finally{this.unsubscribe()}}:super._complete}unsubscribe(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){let{closed:e}=this;super.unsubscribe(),!e&&((t=this.onFinalize)===null||t===void 0||t.call(this))}}},zm=ya(t=>function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}),bt=(()=>{class t extends nt{constructor(){super(),this.closed=!1,this.currentObservers=null,this.observers=[],this.isStopped=!1,this.hasError=!1,this.thrownError=null}lift(r){let n=new Ia(this,this);return n.operator=r,n}_throwIfClosed(){if(this.closed)throw new zm}next(r){bi(()=>{if(this._throwIfClosed(),!this.isStopped){this.currentObservers||(this.currentObservers=Array.from(this.observers));for(let n of this.currentObservers)n.next(r)}})}error(r){bi(()=>{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(){bi(()=>{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:s}=this;return n||i?Lu:(this.currentObservers=null,s.push(r),new zt(()=>{this.currentObservers=null,Tn(s,r)}))}_checkFinalizedStatuses(r){let{hasError:n,thrownError:i,isStopped:s}=this;n?r.error(i):s&&r.complete()}asObservable(){let r=new nt;return r.source=this,r}}return t.create=(e,r)=>new Ia(e,r),t})(),Ia=class extends bt{constructor(t,e){super(),this.destination=t,this.source=e}next(t){var e,r;(r=(e=this.destination)===null||e===void 0?void 0:e.next)===null||r===void 0||r.call(e,t)}error(t){var e,r;(r=(e=this.destination)===null||e===void 0?void 0:e.error)===null||r===void 0||r.call(e,t)}complete(){var t,e;(e=(t=this.destination)===null||t===void 0?void 0:t.complete)===null||e===void 0||e.call(t)}_subscribe(t){var e,r;return(r=(e=this.source)===null||e===void 0?void 0:e.subscribe(t))!==null&&r!==void 0?r:Lu}},xo=class extends bt{constructor(t){super(),this._value=t}get value(){return this.getValue()}_subscribe(t){let e=super._subscribe(t);return!e.closed&&t.next(this._value),e}getValue(){let{hasError:t,thrownError:e,_value:r}=this;if(t)throw e;return this._throwIfClosed(),r}next(t){super.next(this._value=t)}},Co={now(){return(Co.delegate||Date).now()},delegate:void 0},Do=class extends bt{constructor(t=1/0,e=1/0,r=Co){super(),this._bufferSize=t,this._windowTime=e,this._timestampProvider=r,this._buffer=[],this._infiniteTimeWindow=!0,this._infiniteTimeWindow=e===1/0,this._bufferSize=Math.max(1,t),this._windowTime=Math.max(1,e)}next(t){let{isStopped:e,_buffer:r,_infiniteTimeWindow:n,_timestampProvider:i,_windowTime:s}=this;e||(r.push(t),!n&&r.push(i.now()+s)),this._trimBuffer(),super.next(t)}_subscribe(t){this._throwIfClosed(),this._trimBuffer();let e=this._innerSubscribe(t),{_infiniteTimeWindow:r,_buffer:n}=this,i=n.slice();for(let s=0;s<i.length&&!t.closed;s+=r?1:2)t.next(i[s]);return this._checkFinalizedStatuses(t),e}_trimBuffer(){let{_bufferSize:t,_timestampProvider:e,_buffer:r,_infiniteTimeWindow:n}=this,i=(n?1:2)*t;if(t<1/0&&i<r.length&&r.splice(0,r.length-i),!n){let s=e.now(),o=0;for(let c=1;c<r.length&&r[c]<=s;c+=2)o=c;o&&r.splice(0,o+1)}}},Ta=class extends zt{constructor(t,e){super()}schedule(t,e=0){return this}},Ro={setInterval(t,e,...r){let{delegate:n}=Ro;return n?.setInterval?n.setInterval(t,e,...r):setInterval(t,e,...r)},clearInterval(t){let{delegate:e}=Ro;return(e?.clearInterval||clearInterval)(t)},delegate:void 0},xa=class extends Ta{constructor(t,e){super(t,e),this.scheduler=t,this.work=e,this.pending=!1}schedule(t,e=0){var r;if(this.closed)return this;this.state=t;let n=this.id,i=this.scheduler;return n!=null&&(this.id=this.recycleAsyncId(i,n,e)),this.pending=!0,this.delay=e,this.id=(r=this.id)!==null&&r!==void 0?r:this.requestAsyncId(i,this.id,e),this}requestAsyncId(t,e,r=0){return Ro.setInterval(t.flush.bind(t,this),r)}recycleAsyncId(t,e,r=0){if(r!=null&&this.delay===r&&this.pending===!1)return e;e!=null&&Ro.clearInterval(e)}execute(t,e){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;let r=this._execute(t,e);if(r)return r;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))}_execute(t,e){let r=!1,n;try{this.work(t)}catch(i){r=!0,n=i||new Error("Scheduled action threw falsy error")}if(r)return this.unsubscribe(),n}unsubscribe(){if(!this.closed){let{id:t,scheduler:e}=this,{actions:r}=e;this.work=this.state=this.scheduler=null,this.pending=!1,Tn(r,this),t!=null&&(this.id=this.recycleAsyncId(e,t,null)),this.delay=null,super.unsubscribe()}}},xi=class Cd{constructor(e,r=Cd.now){this.schedulerActionCtor=e,this.now=r}schedule(e,r=0,n){return new this.schedulerActionCtor(this,e).schedule(n,r)}};xi.now=Co.now;var Ca=class extends xi{constructor(t,e=xi.now){super(t,e),this.actions=[],this._active=!1}flush(t){let{actions:e}=this;if(this._active){e.push(t);return}let r;this._active=!0;do if(r=t.execute(t.state,t.delay))break;while(t=e.shift());if(this._active=!1,r){for(;t=e.shift();)t.unsubscribe();throw r}}},Ym=new Ca(xa);function qm(t){return t&&ae(t.schedule)}function D_(t){return t[t.length-1]}function Da(t){return qm(D_(t))?t.pop():void 0}function Jm(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function c(m){try{d(n.next(m))}catch(h){o(h)}}function u(m){try{d(n.throw(m))}catch(h){o(h)}}function d(m){m.done?s(m.value):i(m.value).then(c,u)}d((n=n.apply(t,e||[])).next())})}function Km(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 Dn(t){return this instanceof Dn?(this.v=t,this):new Dn(t)}function Xm(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,s=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),c("next"),c("throw"),c("return",o),i[Symbol.asyncIterator]=function(){return this},i;function o(_){return function(g){return Promise.resolve(g).then(_,h)}}function c(_,g){n[_]&&(i[_]=function(y){return new Promise(function(C,O){s.push([_,y,C,O])>1||u(_,y)})},g&&(i[_]=g(i[_])))}function u(_,g){try{d(n[_](g))}catch(y){v(s[0][3],y)}}function d(_){_.value instanceof Dn?Promise.resolve(_.value.v).then(m,h):v(s[0][2],_)}function m(_){u("next",_)}function h(_){u("throw",_)}function v(_,g){_(g),s.shift(),s.length&&u(s[0][0],s[0][1])}}function Qm(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 Km=="function"?Km(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(c,u){o=t[s](o),i(c,u,o.done,o.value)})}}function i(s,o,c,u){Promise.resolve(u).then(function(d){s({value:d,done:c})},o)}}var Ci=t=>t&&typeof t.length=="number"&&typeof t!="function";function Ra(t){return ae(t?.then)}function Aa(t){return ae(t[Ti])}function Na(t){return Symbol.asyncIterator&&ae(t?.[Symbol.asyncIterator])}function Oa(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 R_(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Pa=R_();function La(t){return ae(t?.[Pa])}function Ba(t){return Xm(this,arguments,function*(){let e=t.getReader();try{for(;;){let{value:r,done:n}=yield Dn(e.read());if(n)return yield Dn(void 0);yield yield Dn(r)}}finally{e.releaseLock()}})}function Ua(t){return ae(t?.getReader)}function qt(t){if(t instanceof nt)return t;if(t!=null){if(Aa(t))return A_(t);if(Ci(t))return N_(t);if(Ra(t))return O_(t);if(Na(t))return Zm(t);if(La(t))return P_(t);if(Ua(t))return L_(t)}throw Oa(t)}function A_(t){return new nt(e=>{let r=t[Ti]();if(ae(r.subscribe))return r.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function N_(t){return new nt(e=>{for(let r=0;r<t.length&&!e.closed;r++)e.next(t[r]);e.complete()})}function O_(t){return new nt(e=>{t.then(r=>{e.closed||(e.next(r),e.complete())},r=>e.error(r)).then(null,Sa)})}function P_(t){return new nt(e=>{for(let r of t)if(e.next(r),e.closed)return;e.complete()})}function Zm(t){return new nt(e=>{B_(t,e).catch(r=>e.error(r))})}function L_(t){return Zm(Ba(t))}function B_(t,e){var r,n,i,s;return Jm(this,void 0,void 0,function*(){try{for(r=Qm(t);n=yield r.next(),!n.done;){let o=n.value;if(e.next(o),e.closed)return}}catch(o){i={error:o}}finally{try{n&&!n.done&&(s=r.return)&&(yield s.call(r))}finally{if(i)throw i.error}}e.complete()})}function Kt(t,e,r,n=0,i=!1){let s=e.schedule(function(){r(),i?t.add(this.schedule(null,n)):this.unsubscribe()},n);if(t.add(s),!i)return s}function ka(t,e=0){return Yt((r,n)=>{r.subscribe(kr(n,i=>Kt(n,t,()=>n.next(i),e),()=>Kt(n,t,()=>n.complete(),e),i=>Kt(n,t,()=>n.error(i),e)))})}function Ma(t,e=0){return Yt((r,n)=>{n.add(t.schedule(()=>r.subscribe(n),e))})}function ed(t,e){return qt(t).pipe(Ma(e),ka(e))}function td(t,e){return qt(t).pipe(Ma(e),ka(e))}function rd(t,e){return new nt(r=>{let n=0;return e.schedule(function(){n===t.length?r.complete():(r.next(t[n++]),r.closed||this.schedule())})})}function nd(t,e){return new nt(r=>{let n;return Kt(r,e,()=>{n=t[Pa](),Kt(r,e,()=>{let i,s;try{({value:i,done:s}=n.next())}catch(o){r.error(o);return}s?r.complete():r.next(i)},0,!0)}),()=>ae(n?.return)&&n.return()})}function Fa(t,e){if(!t)throw new Error("Iterable cannot be null");return new nt(r=>{Kt(r,e,()=>{let n=t[Symbol.asyncIterator]();Kt(r,e,()=>{n.next().then(i=>{i.done?r.complete():r.next(i.value)})},0,!0)})})}function id(t,e){return Fa(Ba(t),e)}function od(t,e){if(t!=null){if(Aa(t))return ed(t,e);if(Ci(t))return rd(t,e);if(Ra(t))return td(t,e);if(Na(t))return Fa(t,e);if(La(t))return nd(t,e);if(Ua(t))return id(t,e)}throw Oa(t)}function sd(t,e){return e?od(t,e):qt(t)}function Rn(t,e){return Yt((r,n)=>{let i=0;r.subscribe(kr(n,s=>{n.next(t.call(e,s,i++))}))})}var{isArray:U_}=Array;function k_(t,e){return U_(e)?t(...e):t(e)}function ad(t){return Rn(e=>k_(t,e))}function cd(t,e,r,n,i,s,o,c){let u=[],d=0,m=0,h=!1,v=()=>{h&&!u.length&&!d&&e.complete()},_=y=>d<n?g(y):u.push(y),g=y=>{s&&e.next(y),d++;let C=!1;qt(r(y,m++)).subscribe(kr(e,O=>{i?.(O),s?_(O):e.next(O)},()=>{C=!0},void 0,()=>{if(C)try{for(d--;u.length&&d<n;){let O=u.shift();o?Kt(e,o,()=>g(O)):g(O)}v()}catch(O){e.error(O)}}))};return t.subscribe(kr(e,_,()=>{h=!0,v()})),()=>{c?.()}}function Ao(t,e,r=1/0){return ae(e)?Ao((n,i)=>Rn((s,o)=>e(n,s,i,o))(qt(t(n,i))),r):(typeof e=="number"&&(r=e),Yt((n,i)=>cd(n,i,t,r)))}function ld(t=1/0){return Ao(ba,t)}function ud(){return ld(1)}function $u(...t){return ud()(sd(t,Da(t)))}var M_=["addListener","removeListener"],F_=["addEventListener","removeEventListener"],H_=["on","off"];function An(t,e,r,n){if(ae(r)&&(n=r,r=void 0),n)return An(t,e,r).pipe(ad(n));let[i,s]=W_(t)?F_.map(o=>c=>t[o](e,c,r)):$_(t)?M_.map(pd(t,e)):j_(t)?H_.map(pd(t,e)):[];if(!i&&Ci(t))return Ao(o=>An(o,e,r))(qt(t));if(!i)throw new TypeError("Invalid event target");return new nt(o=>{let c=(...u)=>o.next(1<u.length?u:u[0]);return i(c),()=>s(c)})}function pd(t,e){return r=>n=>t[r](e,n)}function $_(t){return ae(t.addListener)&&ae(t.removeListener)}function j_(t){return ae(t.on)&&ae(t.off)}function W_(t){return ae(t.addEventListener)&&ae(t.removeEventListener)}function sr(t,e=Ym){return Yt((r,n)=>{let i=null,s=null,o=null,c=()=>{if(i){i.unsubscribe(),i=null;let d=s;s=null,n.next(d)}};function u(){let d=o+t,m=e.now();if(m<d){i=this.schedule(void 0,d-m),n.add(i);return}c()}r.subscribe(kr(n,d=>{s=d,o=e.now(),i||(i=e.schedule(u,t),n.add(i))},()=>{c(),n.complete()},void 0,()=>{s=i=null}))})}function ju(...t){let e=Da(t);return Yt((r,n)=>{(e?$u(t,r,e):$u(t,r)).subscribe(n)})}var G_=" 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/\\d\\.\\d\\s[\\w\\.-]+$|^mozilla/\\d\\.\\d\\s\\(compatible;?(?:\\s\\w+\\/\\d+\\.\\d+)?\\)$|^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|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|retriever|rexx;|rigor|rss\\b|scanner\\.|scrape|server|sogou|sparkler/|speedcurve|spider|splash|statuscake|supercleaner|synapse|synthetic|tools|torrent|transcoder|url|validator|virtuoso|wappalyzer|webglance|webkit2png|whatcms/|zgrab",V_=/bot|crawl|http|lighthouse|scan|search|spider/i,No;function z_(){if(No instanceof RegExp)return No;try{No=new RegExp(G_,"i")}catch{No=V_}return No}function fd(t){return!!t&&z_().test(t)}var Wu={d:(t,e)=>{for(var r in e)Wu.o(e,r)&&!Wu.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},Gu={};Wu.d(Gu,{A:()=>K_,k:()=>Vu});var Y_=function(t,e,r,n){return new(r||(r=Promise))(function(i,s){function o(d){try{u(n.next(d))}catch(m){s(m)}}function c(d){try{u(n.throw(d))}catch(m){s(m)}}function u(d){var m;d.done?i(d.value):(m=d.value,m instanceof r?m:new r(function(h){h(m)})).then(o,c)}u((n=n.apply(t,e||[])).next())})},q_=function(t,e){var r,n,i,s,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return s={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function c(u){return function(d){return function(m){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,m[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&m[0]?n.return:m[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,m[1])).done)return i;switch(n=0,i&&(m=[2&m[0],i.value]),m[0]){case 0:case 1:i=m;break;case 4:return o.label++,{value:m[1],done:!1};case 5:o.label++,n=m[1],m=[0];continue;case 7:m=o.ops.pop(),o.trys.pop();continue;default:if(i=o.trys,!((i=i.length>0&&i[i.length-1])||m[0]!==6&&m[0]!==2)){o=0;continue}if(m[0]===3&&(!i||m[1]>i[0]&&m[1]<i[3])){o.label=m[1];break}if(m[0]===6&&o.label<i[1]){o.label=i[1],i=m;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(m);break}i[2]&&o.ops.pop(),o.trys.pop();continue}m=e.call(t,o)}catch(h){m=[6,h],n=0}finally{r=i=0}if(5&m[0])throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}([u,d])}}};function Vu(){return Y_(this,void 0,Promise,function(){return q_(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(o){var s=o;return o instanceof Error&&(s=(n=o.message)!==null&&n!==void 0?n:o),typeof s!="string"?void __callback(!1):void __callback(s.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=Vu);var K_=Vu,md=Gu.A,zL=Gu.k,yd=Zt(tn()),Ha=class{parser;result={};constructor(){this.parser=Nt.get().getUAParser()}async get(){let t=this.result;return this.getDeviceMemory(),this.getNetworkType(),this.getOrientation(),await this.getBatteryInfo(),await this.getLocation(),t.locale=navigator.language,t.display={w:screen.width,h:screen.height,pd:screen.pixelDepth,dpi:this.getDPI()},t.win={ow:window.outerWidth,oh:window.outerHeight,iw:window.innerWidth,ih:window.innerHeight,dpr:window.devicePixelRatio},t.browser={name:this.parser.getBrowser().name,ver:this.parser.getBrowser().version},t.device={model:this.parser.getDevice().model,type:this.parser.getDevice().type,vendor:this.parser.getDevice().vendor},t.os={name:this.parser.getOS().name,ver:this.parser.getOS().version},t.navigatorUA=navigator.userAgent,t.isHeadless=navigator.webdriver,t}getDeviceMemory(){let t=navigator;if(!t.deviceMemory)return;let e=t.deviceMemory;this.result.mem={tot:e*1024}}getNetworkType(){let t=navigator,e=t.connection||t.mozConnection||t.webkitConnection;e?.effectiveType&&(this.result.net={type:e.effectiveType})}getOrientation(){let t=screen.orientation?.type;t&&(this.result.orientation=t)}getDPI(){let t=document.createElement("div");t.setAttribute("style","height: 1in; left: -100%; position: absolute; top: -100%; width: 1in;"),document.body.appendChild(t);let e=window.devicePixelRatio||1,r=t.offsetWidth*e;return document.body.removeChild(t),r}async getLocation(){if(!(!navigator.geolocation||!navigator.permissions||(await navigator.permissions.query({name:"geolocation"})).state!="granted"))return new Promise(t=>{navigator.geolocation.getCurrentPosition(e=>{this.result.coords=[e.coords.latitude,e.coords.longitude],t()},()=>t())})}async getBatteryInfo(){if("getBattery"in navigator)try{let t=await navigator.getBattery();this.result.bat={l:t.level*100,c:t.charging}}catch{}}},Di=class{static trackDeviceID(t){this.isInstalled()}static trackIntent(t){if(!this.isInstalled())return;let e=vn[t]?.toLowerCase();e&&(b.debug(`Sending ${e} intent to MS Clarity`),window.clarity("set","Cooee Intent",e))}static isInstalled(){return window.clarity&&typeof window.clarity=="function"}},Ri=class{constructor(t,e){this._startTime=t,this._triggerData=e}intervals=[];selectedEmbeddedItems;renderer;closeCallback;inputFields=[];get startTime(){return this._startTime}get triggerData(){return this._triggerData}get inputs(){return this.inputFields}get rootClassName(){let t=this.triggerData.shortID??this.triggerData.id.slice(-6);return t==="test"&&(t="test-"+this.startTime.getTime().toString()),N.IN_APP_WRAPPER_NAME+"-"+t}get selectedItems(){return this.triggerData.items.filter(t=>t.selected.value)}get shouldGiveFBTDiscount(){let t=this.selectedItems.length;return this.triggerData.bundleConfig?.applyDiscountOnMinimum?this.triggerData.bundleConfig.applyDiscountOnMinimum<=t:t===this.triggerData.items.length}onClose(t){this.closeCallback=t}closeInApp(t,e){e??={};let r=(new Date().getTime()-this.startTime.getTime())/1e3,n=w({eventName:t,duration:r},e);this.stopIntervals(),this.closeCallback&&this.closeCallback(n)}addInputField(t,e){this.inputFields.push({id:t,type:e,isValid:!1})}updateValidation(t,e){this.inputFields.forEach(r=>{if(r.id===t){r.isValid=e;return}})}hasManipulatedProductQuantity(){let t=this.triggerData.manipulation.productQuantity;return t.enabled&&t.min!=null&&t.max!=null}getManipulatedQuantity(t){let{min:e=1,max:r=100}=this.triggerData.manipulation.productQuantity;if(e>r)return b.error("Invalid range: min should be less than or equal to max."),t;if(t>=e&&t<=r)return t;let n=t%100;return n<e?e:n>r?r:n}stopIntervals(){this.intervals.forEach(t=>clearInterval(t))}},$a=class{loadedFonts=[];async loadAllFonts(t){t.elems?.forEach(e=>{e instanceof br&&this.loadFamily(e.typography?.fam)})}async loadFamily(t){if(!t?.fonts||this.loadedFonts.indexOf(t.name)>-1)return;let e=[];t.fonts.forEach(r=>{if(r.url){let n=new FontFace(N.COOEE+t.name,r.getURL(),r.getFontDescriptor());e.push(n.load())}}),this.loadedFonts.push(t.name),(await Promise.all(e)).forEach(r=>{document.fonts.add(r)})}},ja=class{static updateIdentity(t){if(!this.isInstalled())return;let e={};t.email&&(e.email=t.email),t.mobile&&(e.phone_number=t.mobile),b.debug("Sending email/mobile to Klaviyo"),window.klaviyo.push(["identify",e])}static isInstalled(){return window.klaviyo&&typeof window.klaviyo=="object"}},Wa=class{apiService;action;triggerContext;constructor(t,e){this.action=t,this.apiService=pe.getInstance(),this.triggerContext=e}async execute(){let t=this.containsCTA()?N.EVENT_TRIGGER_CLICKED:N.EVENT_TRIGGER_CLOSED;switch(this.action.at!==106&&this.closeTriggerAndSendEvent(t),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:b.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 t=this.action.gu.u;ne.isValidURL(t)||(t=`//${t}`),window.open(t,"_self")}}prompt(){let t=this.action.pmpt;t&&(t===2&&this.promptLocationPermission(),t===3&&this.promptPushNotificationPermission(),t===1&&this.promptCameraPermission())}closeTriggerAndSendEvent(t,e){this.triggerContext.closeInApp(t,e),this.dispatchEvent()}shareAction(){if(this.action.share){if(!navigator.share){b.warn("Navigator.share is not compatible with this browser");return}navigator.share({text:this.action.share.text,title:"Share"}).then(t=>console.log(t)).catch(t=>console.error(t))}}containsCTA(){return this.action.at&&this.action.at!==1?!0:!(this.isEmpty(this.action.custKV)&&this.isEmpty(this.action.up))}isEmpty(t){return t?Object.keys(t).length===0:!0}promptLocationPermission(){!navigator.geolocation||!navigator.permissions||navigator.geolocation.getCurrentPosition(t=>{this.apiService.updateDeviceProps({coords:[t.coords.latitude,t.coords.longitude]}),this.sendPermissionData()})}promptPushNotificationPermission(){if(!("Notification"in window)){b.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(t){return navigator.permissions.query({name:t}).then(e=>e.state.toString())}async checkAllPermission(){let t=await this.checkPermission("camera"),e=await this.checkPermission("geolocation"),r=Notification.permission;return{camera:t,location:e,notification:r}}sendPermissionData(){this.checkAllPermission().then(t=>{this.apiService.updateDeviceProps({perm:t})})}collectFormData(){let t={};for(let e of this.triggerContext.inputs){if(!e.isValid)return;let r=document.getElementById(e.id).value;e.type===51?t.email=r:e.type===52&&(t.mobile=r)}this.closeTriggerAndSendEvent(N.EVENT_FORM_SUBMITTED,{form:t}),ne.showSnackbar("Coupon applied on cart"),ja.updateIdentity(t)}dispatchEvent(){let t=this.triggerContext.triggerData,e={clickAction:this.action,items:this.triggerContext.selectedEmbeddedItems??t.embeddedItems??t.items,collections:t.collections,triggerData:t};document.dispatchEvent(new CustomEvent(N.CTA_EVENT,{detail:e}));let r={action:this.containsCTA()?N.CAMPAIGN_CLICKED_ACTIVITY:N.CAMPAIGN_CLOSED_ACTIVITY};document.dispatchEvent(new CustomEvent(N.POPUP_ACTIVITY_EVENT,{detail:r}))}},Ai=class{constructor(t){this.scalingFactor=t}getLayoutStyles(t){if(!t)return{display:"block"};let e={display:t.disp};return t.of&&(e.objectFit=t.of),t.pos==="absolute"&&(e.width="auto !important",e.position="absolute",e.right=t.right+"px",e.left=t.left+"px",e.top=t.top+"px",e.bottom=t.bottom+"px"),e}getSizeStyles(t){let e={};return t?.w&&(e.width=t.w),t?.h&&(e.height=t.h),t?.maxW&&(e.maxWidth=t.maxW),t?.maxH&&(e.maxHeight=t.maxH),t?.minW&&(e.minWidth=t.minW),t?.minH&&(e.minHeight=t.minH),e}getBorderStyles(t){if(!t)return{};let e={};return t.radius&&t.radius>0&&(e.borderRadius=this.getSizePx(t.radius)),t.width&&t.width>0&&(e.borderWidth=this.getSizePx(t.width),e.borderStyle=t.style?.toLowerCase(),t.color?this.getColourStyles(t.color,"border-color",e):e.borderColor="black"),e}getFlexStyles(t){return t?{gap:t.gap+"px",flexWrap:t.wrap,flexDirection:t.dir,justifyContent:t.jc,alignItems:t.ai,width:"100%"}:{}}getSpaceStyles(t){let e={};return t?(e.paddingTop=this.getSizePx(t.pt),e.paddingBottom=this.getSizePx(t.pb),e.paddingLeft=this.getSizePx(t.pl),e.paddingRight=this.getSizePx(t.pr),e.marginTop=this.getSizePx(t.mt),e.marginBottom=this.getSizePx(t.mb),e.marginLeft=t.cent?"auto":this.getSizePx(t.ml),e.marginRight=t.cent?"auto":this.getSizePx(t.mr),e):(e.margin="0 !important",e.padding="unset",e)}getBackgroundStyles(t){if(!t)return{};let e={};if(t.glossy){let r="backdrop-filter",n="-webkit-"+r,i=`blur(${t.glossy.radius}px)`;if(!CSS.supports(n,i)&&!CSS.supports(r,i))return{background:t.glossy.fallback.rgba};if(e[n]=i,e[r]=i,t.glossy.color)return this.getColourStyles(t.glossy.color,"background",e)}else if(t.solid){if(t.solid.grad)return this.getGradientStyles(t.solid.grad,"background",e);if(t.solid.hex)return{backgroundColor:t.solid.rgba}}else if(t.img){if(!t.img.src)return{};let r=(t.img.a??0)/100;e.background=`linear-gradient(rgba(0, 0, 0, ${r}), rgba(0, 0, 0, ${r})),url("${t.img.src}") no-repeat center`,e.backgroundSize="cover",t.img.a&&(e["-webkit-backdrop-filter"]=`opacity(${t.img.a})`,e.backdropFilter=`opacity(${t.img.a})`)}return e}getGradientStyles(t,e,r){if(r??={},t.type==="LINEAR"){let n=`linear-gradient(${t.ang}deg, ${t.c1}, ${t.c2}`;t.c3&&(n+=`, ${t.c3}`),n+=")",r[e]=n}return r}getColourStyles(t,e="color",r){return r??={},t?t.grad?this.getGradientStyles(t.grad,e,r):(t.hex&&(r[e]=t.rgba),r):r}getSizePx(t){return this.getScaledSize(t)+"px"}getScaledSize(t){return(t??0)*this.scalingFactor}},Jt=class{renderer=Nt.get();parentHTMLEl;inappElement;inappHTMLEl;triggerContext;stylesConverter;scalingFactor;constructor(t,e,r){this.parentHTMLEl=t,this.inappElement=e,this.triggerContext=r,this.stylesConverter=new Ai(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 t=Z(w(w(w(w({},this.getDisplayStyles()),this.getSpaceStyles()),this.getBorderStyles()),this.getBackgroundStyles()),{boxSizing:"border-box",outline:"none"});this.renderer.setStyles(this.inappHTMLEl,t)}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 t={position:"absolute",left:this.stylesConverter.getSizePx(this.inappElement.x),top:this.stylesConverter.getSizePx(this.inappElement.y)};this.renderer.setStyles(this.inappHTMLEl,t)}getBorderStyles(){return this.stylesConverter.getBorderStyles(this.inappElement.br)}getSpaceStyles(){return this.stylesConverter.getSpaceStyles(this.inappElement.spc)}processTransparency(){let t=this.inappElement.alpha;if(!isNaN(t)){let e=(t/100).toFixed(2);this.renderer.setStyle(this.inappHTMLEl,"opacity",e)}}processShadow(){let t=this.inappElement.shd;t?this.renderer.setStyle(this.inappHTMLEl,"box-shadow",t.getStyle(this.scalingFactor)):this.renderer.setStyle(this.inappHTMLEl,"box-shadow","unset")}processTransformBlock(){let t=new gn(this.inappElement.trf);t&&t.rotate&&this.renderer.setStyle(this.inappHTMLEl,"transform",`rotate(${t.rotate}deg)`)}registerAction(){let t=this.inappElement.clc;!t||Object.keys(t).length===0||(this.inappHTMLEl.addEventListener("click",e=>{e.stopPropagation(),new Wa(t,this.triggerContext).execute()}),this.renderer.setStyle(this.inappHTMLEl,"cursor","pointer"))}getBackgroundStyles(){return this.stylesConverter.getBackgroundStyles(this.inappElement.bg)}},Dr=class extends Jt{constructor(t,e,r){super(t,e,r)}processCommonBlocks(){super.processCommonBlocks(),this.processFontBlock(),this.processAlignment()}processFontBlock(){let t={},e=this.inappElement.typography;return e&&(t.fontSize=this.stylesConverter.getSizePx(e.fs),t.fontFamily=N.COOEE+e.fam?.name,t.lineHeight=`${e.lh}`,t.letterSpacing=e.letterSpacing),this.stylesConverter.getColourStyles(this.inappElement.color,"color",t),this.renderer.setStyles(this.inappHTMLEl,t),t}processPart(t,e){let r=[];e.u&&r.push("underline"),e.st&&r.push("line-through"),r.length||r.push("normal"),this.renderer.setStyle(t,"font-weight",e.b?"bold":"normal"),this.renderer.setStyle(t,"font-style",e.i?"italic":"normal"),this.renderer.setStyle(t,"text-decoration",r.join(" ")),this.renderer.setStyle(t,"color",e.c??"inherit"),this.renderer.setStyle(t,"font-family","inherit")}processAlignment(){let t=this.inappElement.typography.ta,e=t?si[t]?.toLowerCase():this.inappElement.typography.alignment;e||(e="start"),this.renderer.setStyle(this.inappHTMLEl,"text-align",e)}},Oo=class extends Dr{constructor(t,e,r){super(t,e,r),this.inappHTMLEl=this.renderer.createElement("div"),this.insertElement()}render(){this.inappElement.parts?.forEach(t=>{let e=this.renderer.createElement("span");e.innerHTML=t.txt?.toString()?.replace(/\n/g,"<br />"),this.processPart(e,t),this.renderer.appendChild(this.inappHTMLEl,e)}),this.processCommonBlocks()}},Po=class extends Jt{constructor(t,e,r){super(t,e,r),this.inappHTMLEl=this.renderer.createElement("div"),this.insertElement()}render(){this.processCommonBlocks()}},Nn=class extends Jt{constructor(t,e,r){super(t,e,r),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()}},Lo=class Dd extends Jt{constructor(e,r,n){super(e,r,n),this.parent=e,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(N.IN_APP_WRAPPER_NAME),this.inappHTMLEl.classList.add(this.triggerContext.rootClassName),this.renderer.setStyle(this.inappHTMLEl,"z-index",Dd.MAX_Z_INDEX),this.inappHTMLEl}getBackgroundStyles(){return this.inappElement.cover?super.getBackgroundStyles():{}}processWidthAndHeight(){let e=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 r=this.inappElement.spc,n=this.stylesConverter.getScaledSize(e.w)+r.getHorizontal(),i=this.stylesConverter.getScaledSize(e.h)+r.getVertical();this.renderer.setStyle(this.inappHTMLEl,"width",n+"px"),this.renderer.setStyle(this.inappHTMLEl,"height",i+"px")}}getSpaceStyles(){return{padding:this.inappElement.spc.getPaddingCSS()}}getDisplayStyles(){return w(w({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(){}},Va=class extends Jt{constructor(t,e,r){super(t,e,r),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(N.IN_APP_CONTAINER_NAME),this}},Ni=class extends Dr{borderColor="";constructor(t,e,r){super(t,e,r),this.inappHTMLEl=this.renderer.createElement("input"),this.insertElement()}render(){let t=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",e=>{e.stopPropagation()}),this.processCommonBlocks(),this.addListener(this.inappHTMLEl,t),this.triggerContext.addInputField(t,this.inappElement.t)}},za=class Nd extends Ni{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(Nd.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()})}},Ya=class Ad extends Ni{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(Ad.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()})}},qa=class Bn extends Dr{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(w(w(w({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(Bn.DAYS)),e.hour&&this.elements.push(this.getChild(Bn.HOURS)),e.minute&&this.elements.push(this.getChild(Bn.MINUTES)),e.second&&this.elements.push(this.getChild(Bn.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-${Bn.DAYS}`?n.innerText=String(r.days).padStart(2,"0"):n.id===`lc-${Bn.HOURS}`?n.innerText=String(r.hours).padStart(2,"0"):n.id===`lc-${Bn.MINUTES}`?n.innerText=String(r.minutes).padStart(2,"0"):n.id===`lc-${Bn.SECONDS}`&&(n.innerText=String(r.seconds).padStart(2,"0"))})});this.triggerContext.intervals.push(e)}},Ka=class extends Dr{constructor(t,e,r){super(t,e,r),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(t){this.triggerContext.selectedEmbeddedItems?.length||this.updateItems(this.triggerContext.triggerData.items[0].vars[0]),t.addEventListener("click",e=>{e.stopPropagation()}),t.addEventListener("change",()=>{let e=new wr(JSON.parse(t.value));this.updateItems(e)})}updateItems(t){let e=this.triggerContext.triggerData.items[0];this.triggerContext.selectedEmbeddedItems=[e.toEmbed(t)];let r=this.parentHTMLEl.querySelector("#coo-13");if(!r)return;let n=t.imgs[0]??e.imgs?.at(0);n?.url&&r.setAttribute("src",n.url)}addOptions(){let t=this.triggerContext.triggerData.items,e=this.inappHTMLEl;if(!t?.length){e.add(this.createOption(this.inappElement.placeholderText));return}let r=this.triggerContext.selectedEmbeddedItems?.at(0);t[0].vars.forEach(n=>{e.add(this.createOption(n.name??"Default",n,n.mID===r?.vID))})}createOption(t,e,r){let n=this.renderer.createElement("option");return n.text=t,n.value=JSON.stringify(e),r&&(n.selected=!0),e||(n.disabled=!0),n}},Ja=class extends Nn{constructor(t,e,r){super(t,e,r)}render(){super.render(),this.inappHTMLEl.setAttribute("id",`coo-${this.inappElement.type}`)}},Xa=Zt(tn()),Rr=class kd{static INSTANCE=new kd;topics={};constructor(){}static get(){return this.INSTANCE}broadcast(e,r){this.topics[e]||(this.topics[e]=new bt),this.topics[e].next(r)}subscriber(e){return this.topics[e]||(this.topics[e]=new bt),this.topics[e].asObservable()}},Ve=class Wr{static DEFAULT_SELECTOR="cart-drawer";static _instance;inShadow=!1;cartDrawerElement;cartDrawerShadowElement;configWebsite=Oe.get().website??{};currentState=!1;drawerSubject=new xo({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",'a[onclick*="handleFloCartBtn"]'].join(",");cartSelector=[Wr.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(),document.addEventListener(N.CTA_AFTER_REFRESH_UI,this.updateBubble.bind(this))}get element(){return this.cartDrawerElement}static get(){return Wr._instance||(Wr._instance=new Wr),Wr._instance}static forceUpdate(){Wr._instance=new Wr}isOpen(){let e=this.inShadow?this.isPresent():this.isVisible();return Xa.default.log(`Cart drawer is currently ${e?"open":"close"}`),e}open(){if(this.isOpen()){b.log("Drawer is already open");return}document.dispatchEvent(new CustomEvent(N.CTA_OPEN_CART_EVENT));let e=document.querySelector(this.iconSelector);if(!e){b.debug("No clickable cart icon found with selector",this.iconSelector);return}e.click()}onToggle(){return this.drawerSubject}isShopifyDefaultDrawer(){return this.element?.tagName.toLowerCase()===Wr.DEFAULT_SELECTOR}isMiniCart(){return this.isShopifyDefaultDrawer()&&this.element?.id==="mini-cart"}refreshUI(e,r=!0){if(this.isMiniCart()&&this.element?._rerenderCart)this.element._rerenderCart({detail:{cart:e}});else if(this.isShopifyDefaultDrawer())this.element?.renderContents&&e&&(this.element.classList.remove("is-empty"),this.element.renderContents?.(e));else if(this.element?.onCartDrawerUpdate)this.element.onCartDrawerUpdate();else if(window.cartGiftUpdate){if(!e?.items?.[0])return;let n=e.items[0].id,i=e.items[0].quantity,s=e.items[0].price;window.cartGiftUpdate(n,s,i,"","ADD_TO_CART")}else if(window.icartCartActivityEvent)window.icartCartActivityEvent();else if(window.theme?.CartDrawer)window.theme?.CartDrawer.init?new window.theme.CartDrawer().init():new window.theme.CartDrawer;else if(window.Hs_CartDrawer?.updateSlideCart)window.Hs_CartDrawer.updateSlideCart();else if(window.theme?.fetch_side_cart)window.theme.fetch_side_cart();else if(window.theme?.Cart?.updateCart)window.theme.Cart.updateCart();else if(window.cartUpdate)window.cartUpdate();else if(this.element?._onCartRefresh)this.element._onCartRefresh();else if(window.cart?.getCart)window.cart.getCart();else if(this.element?.tagName?.toLowerCase()==="cart-drawer-component")document.dispatchEvent(new CustomEvent("action:cart:updateCartandShowCart"));else if(this.element?.id==="sidebar-cart")document.body.dispatchEvent(new CustomEvent("cart:refresh",{bubbles:!0,detail:{}}));else if(this.element?.id==="quick-cart"){let n=document.querySelector('a[href="/cart"]');n&&n.click()}else b.info("No method found to update the cart without refreshing");document.dispatchEvent(new CustomEvent(N.CTA_AFTER_REFRESH_UI)),r&&Rr.get().broadcast(N.CART_UPDATE_BROADCAST)}async initialize(){let e=this.configWebsite.cartDrawerSelector;if(!e){await this.findCartDrawer();return}let r=e.split(N.SHADOW_SPLITTER);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(!Ne.isShopify())return;let e=this.selector||this.cartSelector;if(this.cartDrawerElement=await ne.retrySelector(e),!this.cartDrawerElement){Xa.default.warn("Max attempts exhausted to find cart drawer");return}Xa.default.log("Found",this.cartDrawerElement,`from selector: ${e}`),this.createMutationObserver()}async findCartDrawerWithShadow(){if(!Ne.isShopify()||!this.shadowParentElementSelector)return;let e=(await ne.retrySelector(this.shadowParentElementSelector))?.shadowRoot;e?.mode==="open"&&(this.cartDrawerShadowElement=e,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,s=e.left<=n&&e.right>=0,o=i&&s,c=this.cartDrawerElement.tagName.toLowerCase()===Wr.DEFAULT_SELECTOR&&this.cartDrawerElement.open,u=getComputedStyle(this.cartDrawerElement),d=u.display!=="none"&&u.visibility!=="hidden"&&parseFloat(u.opacity)>0,m=!this.cartDrawerElement.hidden,h=this.cartDrawerElement.offsetWidth>0||this.cartDrawerElement.offsetHeight>0||this.cartDrawerElement.getClientRects().length>0,v=u.transform.match(/matrix\(([^)]+)\)/),_=0,g=0;if(v){let V=v[1].split(", ").map(parseFloat);_=V[4],g=V[5]}let y=_+e.left>n||_+e.right<0||g+e.top>r||g+e.bottom<0,C=Math.max(0,Math.min(e.right,n)-Math.max(e.left,0)),O=Math.max(0,Math.min(e.bottom,r)-Math.max(e.top,0)),H=C*O,L=e.width*e.height,P=L>0&&H/L>=.1;return(o||c||!y)&&d&&m&&h&&P}createMutationObserver(){if(!this.cartDrawerElement&&!this.cartDrawerShadowElement)return;let e=this.cartDrawerElement||this.cartDrawerShadowElement,r=new bt;this.mutationObserver=new MutationObserver(()=>{r.next()}),this.mutationObserver.observe(e,{attributes:!0,subtree:!0,childList:this.inShadow}),r.pipe(sr(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)}async updateBubble(){let e=(await me.getCurrent().getNormalisedCart(!0)).itemCount,r=document.querySelector(".cart-link__bubble");r&&(r.innerText=e+"")}},Oi=class bc{static ACTIVE_TRIGGER_DATA;renderer=Nt.get();safeHTTP;parent;rootContainer;containerHTMLElement;ian;triggerContext;resizeListener;cartDrawerToggleSubscription;constructor(e){this.safeHTTP=pe.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 Bt(e))}async renderEngagement(e){if(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(!Ve.get().isOpen()||!this.renderer.isMobile()){this.startRenderingOnce();return}this.cartDrawerToggleSubscription=Ve.get().onToggle().subscribe(({open:e})=>{!e&&this.startRenderingOnce()})}startRenderingOnce(){if(!this.shouldSkipCampaign()){bc.ACTIVE_TRIGGER_DATA=this.triggerContext.triggerData;try{this.startRendering()}catch(e){Pe.getInstance().captureException(e,{triggerData:JSON.stringify(this.triggerContext.triggerData)});return}this.sendTriggerDisplayed(),this.renderer.isMobile()||window.addEventListener("resize",this.resizeListener),this.cartDrawerToggleSubscription?.unsubscribe()}}shouldSkipCampaign(){let e=this.triggerContext.triggerData;if(!e.previewType&&bc.ACTIVE_TRIGGER_DATA){let n={triggerShown:new Si(bc.ACTIVE_TRIGGER_DATA??{})};return this.skipTrigger(e,n),!0}if(le.get().isGoKwikPopupOpen)return this.skipTrigger(e,{reason:"GoKwik popup is open"}),!0;let r=N.PAYMENT_MODAL_DETAILS.find(n=>!!document.querySelector(n.identifier));return r?(this.skipTrigger(e,{reason:`${r.gateway} modal is open`}),!0):!1}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 b.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(N.EVENT_TRIGGER_DISPLAYED,e,this.triggerContext.triggerData);this.safeHTTP.sendEvent(r);let n={action:N.CAMPAIGN_DISPLAYED_ACTIVITY};document.dispatchEvent(new CustomEvent(N.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===N.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 ui?new za(e,r,n).render():r instanceof pi?new Ya(e,r,n).render():r instanceof Yr?new Oo(e,r,n).render():r instanceof fi?new Ja(e,r,n).render():r instanceof Ur?new Nn(e,r,n).render():r instanceof yn?new Po(e,r,n).render():r instanceof ci?new qa(e,r,n).render():r instanceof li?new Ka(e,r,n).render():b.error("Unsupported element type- "+r.type)}renderContainer(e){let r=this.ian?.cont;r&&(this.containerHTMLElement=new Va(this.rootContainer,r,e).render().getHTMLElement(),new $a().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),bc.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(N.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 s=i.bg?.img?.src;if(s&&n.push(this.getPromise(s)),i.t===1){let o=i.src;if(!o)return;n.push(this.getPromise(o))}}),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"})}},Qa=class{triggerData;safeHttpService=pe.getInstance();render(t){t.contentSource===qi.KLAVIYO&&(this.triggerData=t,window.addEventListener("klaviyoForms",this.handleKlaviyoEvents.bind(this)),window._klOnsite=window._klOnsite||[],window._klOnsite.push(["openForm",t.klaviyoFormID]))}handleKlaviyoEvents(t){if(t.type!=="klaviyoForms")return;let e=t.detail;if(e.formId!==this.triggerData.klaviyoFormID){b.warn("Received invalid trigger callback");return}switch(e.type){case"open":this.safeHttpService.sendEvent(new ve(N.EVENT_TRIGGER_DISPLAYED,{form:{id:e.formId}},this.triggerData));break;case"stepSubmit":{let r=this.getFormDetails(e);this.safeHttpService.sendEvent(new ve(N.EVENT_FORM_SUBMITTED,{form:r},this.triggerData)),this.safeHttpService.updateProfile(r);break}case"close":window.removeEventListener("klaviyoForms",this.handleKlaviyoEvents.bind(this)),this.safeHttpService.sendEvent(new ve(N.EVENT_TRIGGER_CLOSED,{form:{id:e.formId}},this.triggerData));break}}getFormDetails(t){let e={id:t.formId},r=t.metaData;if(Ht.hasKeys(r)){let n=["email","phone_number","first_name","last_name","$email","$phone_number","$first_name","$last_name"];Object.keys(r).forEach(o=>{n.includes(o)||(e[o]=r[o])}),e.email=r.$email??r.email,e.mobile=r.$phone_number??r.phone_number;let i=r.$first_name??r.first_name,s=r.$last_name??r.last_name;(i?.length||s?.length)&&(e.name=i+" "+s)}return e}},Za=class{static trackIntent(t){if(!this.isInstalled()){b.log("Facebook pixel not installed");return}if(!Oe.get().pixelPush){b.log("Facebook pixel push not enabled");return}let e=vn[t.intent]?.toLowerCase(),r=t.segmentName;!e&&!r||(b.debug(`Sending ${e} intent and ${r} segment to Facebook Pixel`),window.fbq("trackCustom","CooeeIntent",{intent_value:e,segment_value:t.segmentName}))}static isInstalled(){return window.fbq&&typeof window.fbq=="function"}},hd=Zt(dd()),On=class{static _flags={};static getFlags(){return this._flags}static setFlags(t){this._flags=t??{}}static isECommerceApp(){return Ne.isShopify()}},J_=(0,hd.default)(fetch),X_={retryDelay:N.API_CALL_RETRY_DELAY,retryOn:(t,e,r)=>t>=N.API_CALL_MAX_ATTEMPTS?!1:!!(e!==null||r?.status&&r?.status>=500)},mt=class Od{static INSTANCE;apiToken="";firstSeen="";constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Od),this.INSTANCE}async validateSession(e){return this.post("/v1/event/validate-session",e)}updateUserData(e){this.put("/v1/user/update",e).then(async r=>{b.log("Updated user profile"),await Pn.getInstance().storeAndPopulateAuthData(r)}).catch(r=>{b.error("Error saving user profile",r)})}trackOrder(e){this.post("/v1/event/track-order",e).then(()=>{b.log("Sent Order")}).catch(r=>{b.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(()=>{b.log("Updated device property")}).catch(async r=>{b.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(!On.isECommerceApp()&&!On.getFlags().allowEvents)return b.log(`Rejecting ${e} ${r} as this is not e-commerce app`),Promise.reject();r.startsWith("http")||(r=er.apiURL+r);let i=this.getDefaultHeaders(),s="keepalive"in new Request("");if(n&&!s&&JSON.stringify(n).includes("CE App Background"))try{return this.performXMLHttpRequest(r,i,n)}catch(c){return Pe.getInstance().captureException(c,{body:JSON.stringify(n)}),{}}let o={method:e,headers:i,keepalive:!0};return n&&(o.body=JSON.stringify(n)),this.request(r,o)}async request(e,r){let n=w(w({},X_),r),i=await J_(e,n);if(!i.ok)throw i;return i.json()}performXMLHttpRequest(e,r,n){return new Promise((i,s)=>{let o=new XMLHttpRequest;o.open("POST",e,!0),r.forEach((c,u)=>{o.setRequestHeader(u,c)}),o.onreadystatechange=()=>{if(o.readyState===XMLHttpRequest.DONE)if(o.status>=200&&o.status<300)try{o.getResponseHeader("Content-Type")?.includes("application/json")?i(JSON.parse(o.responseText)):s(new Error("Content-Type of response header is not json"))}catch(c){s(c)}else s(new Error(`Received status - ${o.status}(${o.statusText})`))},o.onerror=()=>{s(new Error("Network error occurred during the request."))},o.send(JSON.stringify(n))})}getDefaultHeaders(){let e=new Headers;return e.set("content-type","application/json"),e.set("cooee-sdk",N.SDK),e.set("cooee-sdk-code",N.SDK_VERSION_CODE.toString()),e.set("cooee-sdk-version",N.SDK_VERSION),e.set("cooee-first-seen",this.firstSeen),this.apiToken&&e.append("cooee-sdk-token",this.apiToken),er.debug&&e.set("cooee-sdk-debug",String(1)),e}},Pi=class{static sentryService=Pe.getInstance();static httpApiService=mt.getInstance();static async refreshItems(t){if(t.isCartEmbed()&&!t.isSubscriptionUpsell()){let i=(await me.getCurrent().getNormalisedCart()).items.map(s=>s.mID);t.items=t.items.filter(s=>!i.includes(s.mID))}if(Oe.get().currencyCount<=1)return t.items;let e=t.items.length,r=t.items.map(i=>this.updatedItem(i,t.engagementID)),n=(await Promise.all(r)).filter(i=>i!=null);if(e&&!n.length){let i="Failed to fetch any product from Ajax API",s=new ve(N.EVENT_CAMPAIGN_FAILED,{reason:i,currency:t.currency},t);throw pe.getInstance().sendEvent(s),new Error(i)}if(t.isCartRecovery()){let i=me.getCurrent().items,s=[];for(let o of n)for(let c of o.vars){if(!c.isAvailable)continue;let u=i.find(h=>h.variant_id.toString()===c.mID);if(!u)continue;let d=new xt(o);d.name=u.title;let m=new wr(c);m.name=u.variant_title,m.price.d=u.discounted_price/100,d.variants=[m],s.push(d)}return s}return n}static async updatedItem(t,e){let r=t,n,i=Ne.getRootPrefix()+`products/${r.slug}.js`;try{n=await this.httpApiService.request(i)}catch(o){return b.error(`Failed to fetch ${i}`,o),o instanceof Response?this.sentryService.captureMessage(`Shopify product fetch failed ${o.status}`,"error",{item:r,path:i},{"engagement.id":e}):this.sentryService.captureException(o,{item:r,path:i},{"engagement.id":e}),null}if(!n)return b.error("Item not found after AJAX call for:",r),null;r.name=n.title;let s=r.selectedOrFirstVariant.value;return r.vars.map(o=>{let c=n.variants.find(u=>u.id===+o.mID);o.name=c.title,o.isAvailable=c.available,o.price.d=c.price?c.price/100:c.price,o.price.effective=o.price.d,o.price.cmp=c.compare_at_price?c.compare_at_price/100:c.compare_at_price,+s.mID===c.id&&(s.effectivePrice.value=o.price.d)}),r}},ec=class Pd{static INSTANCE;httpService=ue.get(mt);sentryService=ue.get(Pe);sessionManager=ue.get(it);runtime=le.get();constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Pd),this.INSTANCE}sendSilently(e){this.send(e).catch(r=>b.error(`Failed to send ${e.name}`,r))}async send(e){if(b.debug(`Sending event ${e.name}`),Xt.prepend(`Sending event <strong>${e.name}</strong> with id ${e.id}`),this.shouldReject(e)){b.warn(`Rejecting event ${e.name}`);return}await Promise.all([this.addSessionContext(e),this.addShopifyContext(e)]),this.addShopifyAttributes(),e.name!==N.EVENT_APP_BACKGROUND&&this.runtime.setActive(),e.currentItem=this.runtime.getCurrentItem(),this.httpService.post("/v1/event/track",e).then(async r=>{b.log("\u2705 Event tracked:",e.name),Xt.prepend(`\u2705 Event <strong>${r.eventName}</strong> tracked`),this.processEventResponse(e,r)}).catch(r=>{b.error(`Error sending event ${e.name} to server`,r)})}shouldReject(e){return e.trigger?.triggerID==="test"||e.trigger?.triggerID==="preview"?(b.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=Cr.parseFromCurrent()}async addShopifyContext(e){if(Ne.isShopify())try{e.cart=await me.getCurrent().getNormalisedCart()}catch(r){b.error("Error fetching Shopify cart before sending the event",r)}}processEventResponse(e,r){this.renderWidgetIfAny(e,r).catch(n=>{b.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){b.log(`Nothing to engage after ${e.name}`);return}b.log(`\u{1F4E3} Engagement(id=${r.triggerData.shortID}) will be shown`,r.triggerData);let n=new Bt(r.triggerData);n.occurred=e.occurred;let i;try{i=await Pi.refreshItems(n)}catch(s){b.error("Failed to refresh the products",s);return}if(n.items=i,n.contentSource===qi.KLAVIYO){new Qa().render(n);return}new Oi().renderEngagement(n).catch(s=>{b.error("Failed to render popup",s),this.sentryService.captureException(s,{event:e,triggerData:n})})}utiliseIntentIfCalculated(e){e.intent&&(Di.trackIntent(e.intent),Za.trackIntent(e),Xt.prepend(`Intent is <strong>${vn[e.intent]}</strong>`))}addShopifyAttributes(){Ne.isShopify()&&me.getCurrent().addCooeeAttributes().catch(e=>{b.error("Fail to add attributes in cart",e)})}},pe=class Rd{static INSTANCE;httpApiService=mt.getInstance();eventAPIService=ec.getInstance();constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Rd),this.INSTANCE}sendEvent(e){b.debug(`Waiting for auth to send event ${e.name}`),it.replaySubject.subscribe(async()=>{this.eventAPIService.sendSilently(e)})}updateProfile(e){it.replaySubject.subscribe(()=>{this.httpApiService.updateUserData(e??{})})}trackOrder(e){it.replaySubject.subscribe(()=>{this.httpApiService.trackOrder(e)})}updateDeviceProps(e){it.replaySubject.subscribe(()=>{this.httpApiService.updateDeviceProps({props:e})})}generateDiscount(e){return this.httpApiService.generateDiscount(e)}},Xt=class{static isOn=!1;static element;static watch(){let t=b.getDebugParam();(t==="1"||t==="on")&&pe.getInstance().updateDeviceProps({debugTill:this.getDebugMillis()}),t==="on"?sessionStorage.cooeeDebug="1":t==="off"&&sessionStorage.removeItem("cooeeDebug"),sessionStorage.cooeeDebug&&(this.isOn=!0,this.renderDebugBar())}static prepend(t){if(!this.isOn)return;let e=document.createElement("div");e.innerHTML="• "+new Date().toLocaleString()+" - "+t,this.element.prepend(e)}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 t=0,e=0,r=0,n=0,i=c=>{c=c||window.event,c.preventDefault(),r=c.clientX,n=c.clientY,document.onmouseup=o,document.onmousemove=s},s=c=>{c=c||window.event,c.preventDefault(),t=r-c.clientX,e=n-c.clientY,r=c.clientX,n=c.clientY,this.element.style.top=this.element.offsetTop-e+"px",this.element.style.left=this.element.offsetLeft-t+"px"},o=()=>{document.onmouseup=null,document.onmousemove=null};this.element.onmousedown=i}static getDebugMillis(){return new Date().getTime()+6*60*60*1e3}},Bo=class extends Vr{static storeName="app";static{this.storage=Kn(this.storeName)}},tc=class{static processConfiguration(){let t=Oe.get();!t.gaMeasurementID||!t.gaEnabled||this.sendClientID()}static async sendClientID(){let t=await this.getClientID();t&&pe.getInstance().updateDeviceProps({gaClientID:t})}static async getClientID(){let t=await Ae.get(ie.GA_CLIENT_ID),e=await this.getClientIDViaGTag();if(t!==e)return await Ae.set(ie.GA_CLIENT_ID,e),e}static async getClientIDViaGTag(){let t=Oe.get().gaMeasurementID;if(!(!t||!window.gtag))return new Promise(e=>{window.gtag("get",t,"client_id",r=>{e(r)})})}},rc=class Ld{static INSTANCE;constructor(){this.init()}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Ld),this.INSTANCE}init(){Bo.get(ie.APP_CONFIG,{}).then(e=>this.updateGlobalConfig(e))}async processAppConfigurations(e){b.log("Received app configuration",e),e.currencyCount=e.currencies?.length;let r=this.updateGlobalConfig(e);Bo.set(ie.APP_CONFIG,r).catch(n=>b.error(n)),tc.processConfiguration(),r.website&&(ft.injectRawScript(r.website.commonJS),ft.injectRawCSS(r.website.commonCSS)),Ve.get().onToggle().subscribe(async({open:n})=>{b.info("Cart drawer is now",n?"open":"closed"),n&&(ue.get(ar).loadOrRenderWidgetsAfterCartChange(),await this.trackViewCartEvent())})}updateGlobalConfig(e){let r=Se.globalRef.config.update(e);return Ve.forceUpdate(),b.debug("App configurations",r),r}async trackViewCartEvent(){let e=await me.getCurrent().getNormalisedCart(),r={value:e.amount,currency:e.currency},n={items:e.items,amount:r,drawer:!0};pe.getInstance().sendEvent(new ve(N.EVENT_VIEW_CART,n))}},gd=Zt(Pu()),nc=class Zu{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 gd.URLBuilder(location.href)}catch{return{}}let r={};if(this.META_REQUIRED_FIELDS.every(n=>Array.from(e.getParams().keys()).includes(n)))return r={source:"META",adID:e.getQueryParam("ad_id")?.trim(),campaignID:e.getQueryParam("campaign_id")?.trim()},new Zu(r);if(this.GOOGLE_REQUIRED_FIELDS.every(n=>Array.from(e.getParams().keys()).includes(n)))return r={source:"GOOGLE"},new Zu(r)}},Pn=class Md{static INSTANCE=new Md;httpAPIService=mt.getInstance();coreService=rc.getInstance();sentryService=Pe.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 Ae.set(ie.ID,e.userID)),e.deviceID&&(this.deviceID=e.deviceID,await Ae.set(ie.DEVICE_ID,e.deviceID)),e.sdkToken&&(this.sdkToken=e.sdkToken,await Ae.set(ie.SDK_TOKEN,e.sdkToken)),this.updateAPIClient())}async validateSession(e){await this.populateFirstSeen(),await this.populateUserDataFromStorage(),b.log("Validating session with server");let r=await this.getSessionValidateData(e);try{let n=await this.httpAPIService.validateSession(r);b.log("Validating session Response",n),await this.coreService.processAppConfigurations(n.appSettings),await this.storeAndPopulateAuthData(n)}catch(n){throw b.error(n),n}}async populateUserDataFromStorage(){if(this.sdkToken=await Ae.get(ie.SDK_TOKEN),!this.sdkToken){b.warn("No SDK token found in local storage");return}this.userID=await Ae.get(ie.ID),this.deviceID=await Ae.get(ie.DEVICE_ID),this.updateAPIClient()}updateAPIClient(){b.debug("SDK Token:",this.sdkToken),b.log("Device ID:",this.deviceID),b.log("User ID:",this.userID),Di.trackDeviceID(this.deviceID),Xt.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 Ha().get();r.host=location.origin;try{(await md())?.isPrivate&&(r.private=!0)}catch(i){yd.default.error("Unable to detect private/incognito window",i)}let n=await Ae.get(ie.DEVICE_ID);return n||(n=new Ze().toHexString(),await Ae.set(ie.DEVICE_ID,n)),Z(w({deviceID:n,deviceProps:r,appID:this.appID,shopifyShop:this.shopifyShop},e),{sdk:N.SDK,page:Cr.parseFromCurrent(),ad:nc.getAdParams(),occurred:this.getSessionStartTime(le.get().jsLoadTime),currentItem:le.get().getCurrentItem(),cart:await me.getCurrent().getNormalisedCart(),properties:{}})}async populateFirstSeen(){let e=await Ae.get(ie.FIRST_SEEN),r=e?new Date(e):new Date;e||await Ae.set(ie.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>N.IDLE_TIME_IN_SECONDS?new Date:e}},it=class wc{static replaySubject=new Do(1);static INSTANCE;sentryService=ue.get(Pe);lock=new Jn;constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new wc),this.INSTANCE}init(e){if(b.debug("Initialising SDK",e),fd(navigator.userAgent)){b.info("This seems to be a bot. Disabling SDK");return}Pn.getInstance().init(e),wc.INSTANCE.checkForNewSession(!0).then(async()=>{wc.replaySubject.next(!0),wc.replaySubject.complete()}).catch(r=>b.error("Unable to perform device init",r))}getCurrentSessionID(){return et.set(ie.SESSION_LAST_USED_TIME,new Date().getTime()),et.get(ie.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 et.set(ie.SESSION_SYNCED,!0)}this.lock.release()}async startNewSession(){b.debug("Starting new session"),await et.clear(),b.debug("Cleared SessionStorage before starting new session");let e=new Date,r=new Ze().toHexString();b.debug("New session ID to be used",r);let n=await Ae.get(ie.SESSION_NUMBER,0)+1;Xt.prepend(`New Session ID: <strong>${r}</strong> & number: ${n}`),await Promise.all([Ae.set(ie.SESSION_NUMBER,n),et.set(ie.ID,r),et.set(ie.SESSION_LAST_USED_TIME,e.getTime()),et.set(ie.SESSION_LANDING_PAGE,Cr.parseFromCurrent())])}getLandingPage(){return et.get(ie.SESSION_LANDING_PAGE,{})}getCurrentSessionNumber(){return Ae.get(ie.SESSION_NUMBER,1)}async isNewSessionRequired(){if(!await et.get(ie.ID))return!0;let e=await et.get(ie.SESSION_LAST_USED_TIME,0);return e?(new Date().getTime()-e)/1e3>N.IDLE_TIME_IN_SECONDS:!0}async notSynced(){return!await et.get(ie.SESSION_SYNCED,!1)}},_d=Zt(tn()),vd=Zt(tn()),Q_=`
|
|
36
|
+
`)+" ".concat(u,"\\").concat(p,"/"))}t.seenObjects[t.seenObjects.length-1].obj=e}if(Array.isArray(e))return gE(e,t);if(e===void 0)return null;if(e instanceof Date||q_(e)){var m=e.getTime(),h=m>-1&&m<2534023188e5;return t.legacy?t.relaxed&&h?{$date:e.getTime()}:{$date:cd(e)}:t.relaxed&&h?{$date:cd(e)}:{$date:{$numberLong:e.getTime().toString()}}}if(typeof e=="number"&&(!t.relaxed||!isFinite(e))){if(Math.floor(e)===e){var y=e>=Ed&&e<=_d,E=e>=wd&&e<=Sd;if(y)return{$numberInt:e.toString()};if(E)return{$numberLong:e.toString()}}return{$numberDouble:e.toString()}}if(e instanceof RegExp||z_(e)){var v=e.flags;if(v===void 0){var _=e.toString().match(/[gimuy]*$/);_&&(v=_[0])}var x=new wo(e.source,v);return x.toExtendedJSON(t)}return e!=null&&typeof e=="object"?vE(e,t):e}var yE={Binary:function(e){return new Cn(e.value(),e.sub_type)},Code:function(e){return new ya(e.code,e.scope)},DBRef:function(e){return new So(e.collection||e.namespace,e.oid,e.db,e.fields)},Decimal128:function(e){return new Bu(e.bytes)},Double:function(e){return new va(e.value)},Int32:function(e){return new Ea(e.value)},Long:function(e){return X.fromBits(e.low!=null?e.low:e.low_,e.low!=null?e.high:e.high_,e.low!=null?e.unsigned:e.unsigned_)},MaxKey:function(){return new Uu},MinKey:function(){return new ku},ObjectID:function(e){return new tt(e)},ObjectId:function(e){return new tt(e)},BSONRegExp:function(e){return new wo(e.pattern,e.options)},Symbol:function(e){return new Mu(e.value)},Timestamp:function(e){return vd.fromBits(e.low,e.high)}};function vE(e,t){if(e==null||typeof e!="object")throw new Tn("not an object instance");var r=e._bsontype;if(typeof r>"u"){var n={};for(var i in e){t.seenObjects.push({propertyName:i,obj:null});try{var s=Qr(e[i],t);i==="__proto__"?Object.defineProperty(n,i,{value:s,writable:!0,enumerable:!0,configurable:!0}):n[i]=s}finally{t.seenObjects.pop()}}return n}else if(dE(e)){var o=e;if(typeof o.toExtendedJSON!="function"){var c=yE[e._bsontype];if(!c)throw new We("Unrecognized or invalid _bsontype: "+e._bsontype);o=c(o)}return r==="Code"&&o.scope?o=new ya(o.code,Qr(o.scope,t)):r==="DBRef"&&o.oid&&(o=new So(Qr(o.collection,t),Qr(o.oid,t),Qr(o.db,t),Qr(o.fields,t))),o.toExtendedJSON(t)}else throw new Tn("_bsontype must be a string, but was: "+typeof r)}var ld;(function(e){function t(s,o){var c=Object.assign({},{relaxed:!0,legacy:!1},o);return typeof c.relaxed=="boolean"&&(c.strict=!c.relaxed),typeof c.strict=="boolean"&&(c.relaxed=!c.strict),JSON.parse(s,function(u,p){if(u.indexOf("\0")!==-1)throw new Tn("BSON Document field names cannot contain null bytes, found: ".concat(JSON.stringify(u)));return bd(p,c)})}e.parse=t;function r(s,o,c,u){c!=null&&typeof c=="object"&&(u=c,c=0),o!=null&&typeof o=="object"&&!Array.isArray(o)&&(u=o,o=void 0,c=0);var p=Object.assign({relaxed:!0,legacy:!1},u,{seenObjects:[{propertyName:"(root)",obj:null}]}),m=Qr(s,p);return JSON.stringify(m,o,c)}e.stringify=r;function n(s,o){return o=o||{},JSON.parse(r(s,o))}e.serialize=n;function i(s,o){return o=o||{},t(JSON.stringify(s),o)}e.deserialize=i})(ld||(ld={}));var ud,pd=md();pd.Map?ud=pd.Map:ud=function(){function e(t){t===void 0&&(t=[]),this._keys=[],this._values={};for(var r=0;r<t.length;r++)if(t[r]!=null){var n=t[r],i=n[0],s=n[1];this._keys.push(i),this._values[i]={v:s,i:this._keys.length-1}}}return e.prototype.clear=function(){this._keys=[],this._values={}},e.prototype.delete=function(t){var r=this._values[t];return r==null?!1:(delete this._values[t],this._keys.splice(r.i,1),!0)},e.prototype.entries=function(){var t=this,r=0;return{next:function(){var n=t._keys[r++];return{value:n!==void 0?[n,t._values[n].v]:void 0,done:n===void 0}}}},e.prototype.forEach=function(t,r){r=r||this;for(var n=0;n<this._keys.length;n++){var i=this._keys[n];t.call(r,this._values[i].v,i,r)}},e.prototype.get=function(t){return this._values[t]?this._values[t].v:void 0},e.prototype.has=function(t){return this._values[t]!=null},e.prototype.keys=function(){var t=this,r=0;return{next:function(){var n=t._keys[r++];return{value:n!==void 0?n:void 0,done:n===void 0}}}},e.prototype.set=function(t,r){return this._values[t]?(this._values[t].v=r,this):(this._keys.push(t),this._values[t]={v:r,i:this._keys.length-1},this)},e.prototype.values=function(){var t=this,r=0;return{next:function(){var n=t._keys[r++];return{value:n!==void 0?t._values[n].v:void 0,done:n===void 0}}}},Object.defineProperty(e.prototype,"size",{get:function(){return this._keys.length},enumerable:!1,configurable:!0}),e}();var FO=X.fromNumber(X_),HO=X.fromNumber(J_),Nu=new Uint8Array(8),$O=new DataView(Nu.buffer,Nu.byteOffset,Nu.byteLength),_E=1024*1024*17,jO=Se.alloc(_E),Ii=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}},_e=class{constructor(e,t={},r,n){this.name=e,this.properties=t,this.id=n?new tt(n):new tt,this.occurred=new Date,r&&(this.trigger=new Ii(r)),this.newEvent=!n}trigger;items;id;newEvent;cart;currentItem;deviceProps;landingPage;occurred;page;sessionID;sessionNumber},dt=class{static injectScriptURL(e,t){if(!e)return;let r=document.createElement("script");r.id=t??"",r.src=e,r.defer=!0,e.includes("localhost")&&(r.type="module"),document.head.appendChild(r)}static injectRawScript(e){if(!e)return;let t=document.createElement("script");t.id="cooee-app-script",t.innerHTML=e,document.head.appendChild(t)}static injectRawCSS(e,t=document.head){if(!e)return;let r=document.createElement("style");r.textContent=e,t.appendChild(r)}static injectStylesheet(e,t=document.head){if(!e)return;let r=document.createElement("link");r.rel="stylesheet",r.href=e,e==="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css"&&(r.crossOrigin="anonymous",r.onload=n=>{let i=n.currentTarget?.sheet?.cssRules;if(i){for(let s of i)if(s.type==CSSRule.FONT_FACE_RULE){let o=e.split("/"),c=o.slice(0,o.length-1).join("/"),u=s.cssText;u=u.replace(/url\s*\(\s*['"]?(?!((\/)|((?:https?:)?\/\/)|(?:data:?:)))([^'")]+)['"]?\s*\)/g,`url("${c}/$4")`);let p=document.createElement("style");p.appendChild(document.createTextNode(u)),document.head.appendChild(p)}}}),t.appendChild(r)}},pe=class{static storage=new Map;static get(e){return this.storage.has(e)||this.storage.set(e,e.getInstance()),this.storage.get(e)}},Id=Ce(Fu()),Io=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 Id.URLBuilder(location.href)}catch{return{}}let t={};this.UTM_PARAMS.forEach(n=>{let i=e.getQueryParam(n);i&&(t[n]=i)});let r={};return Object.keys(this.TW_PARAMS).forEach(n=>{let i=e.getQueryParam(this.TW_PARAMS[n]);i&&(r[n]=i)}),w(w({},r),t)}},Cr=class kh{origin;path;qs;name;referrer;utmSource;utmMedium;utmCampaign;utmId;utmTerm;utmContent;constructor(t){this.name=t.name,this.path=t.path,this.qs=t.qs,this.referrer=t.referrer,this.utmSource=t.utmSource||t.utm_source,this.utmMedium=t.utmMedium||t.utm_medium,this.utmCampaign=t.utmCampaign||t.utm_campaign,this.utmId=t.utmId||t.utm_id,this.utmTerm=t.utmTerm||t.utm_term,this.utmContent=t.utmContent||t.utm_content}static parseFromCurrent(){let t=location.pathname==="/"?location.pathname:location.pathname.replace(/\/+$/,"");return new kh(w({origin:location.origin,path:t,qs:location.search,referrer:Io.getReferrer(),name:le.get().pageName},Io.getUTMParams()))}};function ce(e){return typeof e=="function"}function wa(e){let t=e(r=>{Error.call(r),r.stack=new Error().stack});return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var ba=wa(e=>function(t){e(this),this.message=t?`${t.length} errors occurred during unsubscription:
|
|
37
|
+
${t.map((r,n)=>`${n+1}) ${r.toString()}`).join(`
|
|
38
|
+
`)}`:"",this.name="UnsubscriptionError",this.errors=t});function xn(e,t){if(e){let r=e.indexOf(t);0<=r&&e.splice(r,1)}}var qt=class Dc{constructor(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}unsubscribe(){let t;if(!this.closed){this.closed=!0;let{_parentage:r}=this;if(r)if(this._parentage=null,Array.isArray(r))for(let s of r)s.remove(this);else r.remove(this);let{initialTeardown:n}=this;if(ce(n))try{n()}catch(s){t=s instanceof ba?s.errors:[s]}let{_finalizers:i}=this;if(i){this._finalizers=null;for(let s of i)try{Td(s)}catch(o){t=t??[],o instanceof ba?t=[...t,...o.errors]:t.push(o)}}if(t)throw new ba(t)}}add(t){var r;if(t&&t!==this)if(this.closed)Td(t);else{if(t instanceof Dc){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(t)}}_hasParent(t){let{_parentage:r}=this;return r===t||Array.isArray(r)&&r.includes(t)}_addParent(t){let{_parentage:r}=this;this._parentage=Array.isArray(r)?(r.push(t),r):r?[r,t]:t}_removeParent(t){let{_parentage:r}=this;r===t?this._parentage=null:Array.isArray(r)&&xn(r,t)}remove(t){let{_finalizers:r}=this;r&&xn(r,t),t instanceof Dc&&t._removeParent(this)}};qt.EMPTY=(()=>{let e=new qt;return e.closed=!0,e})();var Hu=qt.EMPTY;function Ia(e){return e instanceof qt||e&&"closed"in e&&ce(e.remove)&&ce(e.add)&&ce(e.unsubscribe)}function Td(e){ce(e)?e():e.unsubscribe()}var sr={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},Ti={setTimeout(e,t,...r){let{delegate:n}=Ti;return n?.setTimeout?n.setTimeout(e,t,...r):setTimeout(e,t,...r)},clearTimeout(e){let{delegate:t}=Ti;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function Ta(e){Ti.setTimeout(()=>{let{onUnhandledError:t}=sr;if(t)t(e);else throw e})}function $u(){}var Cd=ju("C",void 0,void 0);function xd(e){return ju("E",void 0,e)}function Dd(e){return ju("N",e,void 0)}function ju(e,t,r){return{kind:e,value:t,error:r}}var Dn=null;function Ci(e){if(sr.useDeprecatedSynchronousErrorHandling){let t=!Dn;if(t&&(Dn={errorThrown:!1,error:null}),e(),t){let{errorThrown:r,error:n}=Dn;if(Dn=null,r)throw n}}else e()}function Rd(e){sr.useDeprecatedSynchronousErrorHandling&&Dn&&(Dn.errorThrown=!0,Dn.error=e)}var Rn=class extends qt{constructor(e){super(),this.isStopped=!1,e?(this.destination=e,Ia(e)&&e.add(this)):this.destination=bE}static create(e,t,r){return new xi(e,t,r)}next(e){this.isStopped?Gu(Dd(e),this):this._next(e)}error(e){this.isStopped?Gu(xd(e),this):(this.isStopped=!0,this._error(e))}complete(){this.isStopped?Gu(Cd,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()}}},SE=Function.prototype.bind;function Wu(e,t){return SE.call(e,t)}var Vu=class{constructor(e){this.partialObserver=e}next(e){let{partialObserver:t}=this;if(t.next)try{t.next(e)}catch(r){Ca(r)}}error(e){let{partialObserver:t}=this;if(t.error)try{t.error(e)}catch(r){Ca(r)}else Ca(e)}complete(){let{partialObserver:e}=this;if(e.complete)try{e.complete()}catch(t){Ca(t)}}},xi=class extends Rn{constructor(e,t,r){super();let n;if(ce(e)||!e)n={next:e??void 0,error:t??void 0,complete:r??void 0};else{let i;this&&sr.useDeprecatedNextContext?(i=Object.create(e),i.unsubscribe=()=>this.unsubscribe(),n={next:e.next&&Wu(e.next,i),error:e.error&&Wu(e.error,i),complete:e.complete&&Wu(e.complete,i)}):n=e}this.destination=new Vu(n)}};function Ca(e){sr.useDeprecatedSynchronousErrorHandling?Rd(e):Ta(e)}function wE(e){throw e}function Gu(e,t){let{onStoppedNotification:r}=sr;r&&Ti.setTimeout(()=>r(e,t))}var bE={closed:!0,next:$u,error:wE,complete:$u},Di=typeof Symbol=="function"&&Symbol.observable||"@@observable";function xa(e){return e}function Ad(e){return e.length===0?xa:e.length===1?e[0]:function(t){return e.reduce((r,n)=>n(r),t)}}var ot=(()=>{class e{constructor(r){r&&(this._subscribe=r)}lift(r){let n=new e;return n.source=this,n.operator=r,n}subscribe(r,n,i){let s=TE(r)?r:new xi(r,n,i);return Ci(()=>{let{operator:o,source:c}=this;s.add(o?o.call(s,c):c?this._subscribe(s):this._trySubscribe(s))}),s}_trySubscribe(r){try{return this._subscribe(r)}catch(n){r.error(n)}}forEach(r,n){return n=Nd(n),new n((i,s)=>{let o=new xi({next:c=>{try{r(c)}catch(u){s(u),o.unsubscribe()}},error:s,complete:i});this.subscribe(o)})}_subscribe(r){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(r)}[Di](){return this}pipe(...r){return Ad(r)(this)}toPromise(r){return r=Nd(r),new r((n,i)=>{let s;this.subscribe(o=>s=o,o=>i(o),()=>n(s))})}}return e.create=t=>new e(t),e})();function Nd(e){var t;return(t=e??sr.Promise)!==null&&t!==void 0?t:Promise}function IE(e){return e&&ce(e.next)&&ce(e.error)&&ce(e.complete)}function TE(e){return e&&e instanceof Rn||IE(e)&&Ia(e)}function CE(e){return ce(e?.lift)}function Kt(e){return t=>{if(CE(t))return t.lift(function(r){try{return e(r,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}function Ur(e,t,r,n,i){return new Yu(e,t,r,n,i)}var Yu=class extends Rn{constructor(e,t,r,n,i,s){super(e),this.onFinalize=i,this.shouldUnsubscribe=s,this._next=t?function(o){try{t(o)}catch(c){e.error(c)}}:super._next,this._error=n?function(o){try{n(o)}catch(c){e.error(c)}finally{this.unsubscribe()}}:super._error,this._complete=r?function(){try{r()}catch(o){e.error(o)}finally{this.unsubscribe()}}:super._complete}unsubscribe(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){let{closed:t}=this;super.unsubscribe(),!t&&((e=this.onFinalize)===null||e===void 0||e.call(this))}}},Od=wa(e=>function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}),Ct=(()=>{class e extends ot{constructor(){super(),this.closed=!1,this.currentObservers=null,this.observers=[],this.isStopped=!1,this.hasError=!1,this.thrownError=null}lift(r){let n=new Da(this,this);return n.operator=r,n}_throwIfClosed(){if(this.closed)throw new Od}next(r){Ci(()=>{if(this._throwIfClosed(),!this.isStopped){this.currentObservers||(this.currentObservers=Array.from(this.observers));for(let n of this.currentObservers)n.next(r)}})}error(r){Ci(()=>{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(){Ci(()=>{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:s}=this;return n||i?Hu:(this.currentObservers=null,s.push(r),new qt(()=>{this.currentObservers=null,xn(s,r)}))}_checkFinalizedStatuses(r){let{hasError:n,thrownError:i,isStopped:s}=this;n?r.error(i):s&&r.complete()}asObservable(){let r=new ot;return r.source=this,r}}return e.create=(t,r)=>new Da(t,r),e})(),Da=class extends Ct{constructor(e,t){super(),this.destination=e,this.source=t}next(e){var t,r;(r=(t=this.destination)===null||t===void 0?void 0:t.next)===null||r===void 0||r.call(t,e)}error(e){var t,r;(r=(t=this.destination)===null||t===void 0?void 0:t.error)===null||r===void 0||r.call(t,e)}complete(){var e,t;(t=(e=this.destination)===null||e===void 0?void 0:e.complete)===null||t===void 0||t.call(e)}_subscribe(e){var t,r;return(r=(t=this.source)===null||t===void 0?void 0:t.subscribe(e))!==null&&r!==void 0?r:Hu}},To=class extends Ct{constructor(e){super(),this._value=e}get value(){return this.getValue()}_subscribe(e){let t=super._subscribe(e);return!t.closed&&e.next(this._value),t}getValue(){let{hasError:e,thrownError:t,_value:r}=this;if(e)throw t;return this._throwIfClosed(),r}next(e){super.next(this._value=e)}},Co={now(){return(Co.delegate||Date).now()},delegate:void 0},xo=class extends Ct{constructor(e=1/0,t=1/0,r=Co){super(),this._bufferSize=e,this._windowTime=t,this._timestampProvider=r,this._buffer=[],this._infiniteTimeWindow=!0,this._infiniteTimeWindow=t===1/0,this._bufferSize=Math.max(1,e),this._windowTime=Math.max(1,t)}next(e){let{isStopped:t,_buffer:r,_infiniteTimeWindow:n,_timestampProvider:i,_windowTime:s}=this;t||(r.push(e),!n&&r.push(i.now()+s)),this._trimBuffer(),super.next(e)}_subscribe(e){this._throwIfClosed(),this._trimBuffer();let t=this._innerSubscribe(e),{_infiniteTimeWindow:r,_buffer:n}=this,i=n.slice();for(let s=0;s<i.length&&!e.closed;s+=r?1:2)e.next(i[s]);return this._checkFinalizedStatuses(e),t}_trimBuffer(){let{_bufferSize:e,_timestampProvider:t,_buffer:r,_infiniteTimeWindow:n}=this,i=(n?1:2)*e;if(e<1/0&&i<r.length&&r.splice(0,r.length-i),!n){let s=t.now(),o=0;for(let c=1;c<r.length&&r[c]<=s;c+=2)o=c;o&&r.splice(0,o+1)}}},Ra=class extends qt{constructor(e,t){super()}schedule(e,t=0){return this}},Do={setInterval(e,t,...r){let{delegate:n}=Do;return n?.setInterval?n.setInterval(e,t,...r):setInterval(e,t,...r)},clearInterval(e){let{delegate:t}=Do;return(t?.clearInterval||clearInterval)(e)},delegate:void 0},Aa=class extends Ra{constructor(e,t){super(e,t),this.scheduler=e,this.work=t,this.pending=!1}schedule(e,t=0){var r;if(this.closed)return this;this.state=e;let n=this.id,i=this.scheduler;return n!=null&&(this.id=this.recycleAsyncId(i,n,t)),this.pending=!0,this.delay=t,this.id=(r=this.id)!==null&&r!==void 0?r:this.requestAsyncId(i,this.id,t),this}requestAsyncId(e,t,r=0){return Do.setInterval(e.flush.bind(e,this),r)}recycleAsyncId(e,t,r=0){if(r!=null&&this.delay===r&&this.pending===!1)return t;t!=null&&Do.clearInterval(t)}execute(e,t){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;let r=this._execute(e,t);if(r)return r;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))}_execute(e,t){let r=!1,n;try{this.work(e)}catch(i){r=!0,n=i||new Error("Scheduled action threw falsy error")}if(r)return this.unsubscribe(),n}unsubscribe(){if(!this.closed){let{id:e,scheduler:t}=this,{actions:r}=t;this.work=this.state=this.scheduler=null,this.pending=!1,xn(r,this),e!=null&&(this.id=this.recycleAsyncId(t,e,null)),this.delay=null,super.unsubscribe()}}},Ri=class Ph{constructor(t,r=Ph.now){this.schedulerActionCtor=t,this.now=r}schedule(t,r=0,n){return new this.schedulerActionCtor(this,t).schedule(n,r)}};Ri.now=Co.now;var Na=class extends Ri{constructor(e,t=Ri.now){super(e,t),this.actions=[],this._active=!1}flush(e){let{actions:t}=this;if(this._active){t.push(e);return}let r;this._active=!0;do if(r=e.execute(e.state,e.delay))break;while(e=t.shift());if(this._active=!1,r){for(;e=t.shift();)e.unsubscribe();throw r}}},Pd=new Na(Aa);function Ld(e){return e&&ce(e.schedule)}function xE(e){return e[e.length-1]}function Oa(e){return Ld(xE(e))?e.pop():void 0}function Ud(e,t,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function c(m){try{p(n.next(m))}catch(h){o(h)}}function u(m){try{p(n.throw(m))}catch(h){o(h)}}function p(m){m.done?s(m.value):i(m.value).then(c,u)}p((n=n.apply(e,t||[])).next())})}function Bd(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function An(e){return this instanceof An?(this.v=e,this):new An(e)}function kd(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),i,s=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),c("next"),c("throw"),c("return",o),i[Symbol.asyncIterator]=function(){return this},i;function o(E){return function(v){return Promise.resolve(v).then(E,h)}}function c(E,v){n[E]&&(i[E]=function(_){return new Promise(function(x,P){s.push([E,_,x,P])>1||u(E,_)})},v&&(i[E]=v(i[E])))}function u(E,v){try{p(n[E](v))}catch(_){y(s[0][3],_)}}function p(E){E.value instanceof An?Promise.resolve(E.value.v).then(m,h):y(s[0][2],E)}function m(E){u("next",E)}function h(E){u("throw",E)}function y(E,v){E(v),s.shift(),s.length&&u(s[0][0],s[0][1])}}function Md(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof Bd=="function"?Bd(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=e[s]&&function(o){return new Promise(function(c,u){o=e[s](o),i(c,u,o.done,o.value)})}}function i(s,o,c,u){Promise.resolve(u).then(function(p){s({value:p,done:c})},o)}}var Ai=e=>e&&typeof e.length=="number"&&typeof e!="function";function Pa(e){return ce(e?.then)}function La(e){return ce(e[Di])}function Ba(e){return Symbol.asyncIterator&&ce(e?.[Symbol.asyncIterator])}function Ua(e){return new TypeError(`You provided ${e!==null&&typeof e=="object"?"an invalid object":`'${e}'`} where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.`)}function DE(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var ka=DE();function Ma(e){return ce(e?.[ka])}function Fa(e){return kd(this,arguments,function*(){let t=e.getReader();try{for(;;){let{value:r,done:n}=yield An(t.read());if(n)return yield An(void 0);yield yield An(r)}}finally{t.releaseLock()}})}function Ha(e){return ce(e?.getReader)}function Xt(e){if(e instanceof ot)return e;if(e!=null){if(La(e))return RE(e);if(Ai(e))return AE(e);if(Pa(e))return NE(e);if(Ba(e))return Fd(e);if(Ma(e))return OE(e);if(Ha(e))return PE(e)}throw Ua(e)}function RE(e){return new ot(t=>{let r=e[Di]();if(ce(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function AE(e){return new ot(t=>{for(let r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}function NE(e){return new ot(t=>{e.then(r=>{t.closed||(t.next(r),t.complete())},r=>t.error(r)).then(null,Ta)})}function OE(e){return new ot(t=>{for(let r of e)if(t.next(r),t.closed)return;t.complete()})}function Fd(e){return new ot(t=>{LE(e,t).catch(r=>t.error(r))})}function PE(e){return Fd(Fa(e))}function LE(e,t){var r,n,i,s;return Ud(this,void 0,void 0,function*(){try{for(r=Md(e);n=yield r.next(),!n.done;){let o=n.value;if(t.next(o),t.closed)return}}catch(o){i={error:o}}finally{try{n&&!n.done&&(s=r.return)&&(yield s.call(r))}finally{if(i)throw i.error}}t.complete()})}function Jt(e,t,r,n=0,i=!1){let s=t.schedule(function(){r(),i?e.add(this.schedule(null,n)):this.unsubscribe()},n);if(e.add(s),!i)return s}function $a(e,t=0){return Kt((r,n)=>{r.subscribe(Ur(n,i=>Jt(n,e,()=>n.next(i),t),()=>Jt(n,e,()=>n.complete(),t),i=>Jt(n,e,()=>n.error(i),t)))})}function ja(e,t=0){return Kt((r,n)=>{n.add(e.schedule(()=>r.subscribe(n),t))})}function Hd(e,t){return Xt(e).pipe(ja(t),$a(t))}function $d(e,t){return Xt(e).pipe(ja(t),$a(t))}function jd(e,t){return new ot(r=>{let n=0;return t.schedule(function(){n===e.length?r.complete():(r.next(e[n++]),r.closed||this.schedule())})})}function Wd(e,t){return new ot(r=>{let n;return Jt(r,t,()=>{n=e[ka](),Jt(r,t,()=>{let i,s;try{({value:i,done:s}=n.next())}catch(o){r.error(o);return}s?r.complete():r.next(i)},0,!0)}),()=>ce(n?.return)&&n.return()})}function Wa(e,t){if(!e)throw new Error("Iterable cannot be null");return new ot(r=>{Jt(r,t,()=>{let n=e[Symbol.asyncIterator]();Jt(r,t,()=>{n.next().then(i=>{i.done?r.complete():r.next(i.value)})},0,!0)})})}function Gd(e,t){return Wa(Fa(e),t)}function Vd(e,t){if(e!=null){if(La(e))return Hd(e,t);if(Ai(e))return jd(e,t);if(Pa(e))return $d(e,t);if(Ba(e))return Wa(e,t);if(Ma(e))return Wd(e,t);if(Ha(e))return Gd(e,t)}throw Ua(e)}function Yd(e,t){return t?Vd(e,t):Xt(e)}function Nn(e,t){return Kt((r,n)=>{let i=0;r.subscribe(Ur(n,s=>{n.next(e.call(t,s,i++))}))})}var{isArray:BE}=Array;function UE(e,t){return BE(t)?e(...t):e(t)}function zd(e){return Nn(t=>UE(e,t))}function qd(e,t,r,n,i,s,o,c){let u=[],p=0,m=0,h=!1,y=()=>{h&&!u.length&&!p&&t.complete()},E=_=>p<n?v(_):u.push(_),v=_=>{s&&t.next(_),p++;let x=!1;Xt(r(_,m++)).subscribe(Ur(t,P=>{i?.(P),s?E(P):t.next(P)},()=>{x=!0},void 0,()=>{if(x)try{for(p--;u.length&&p<n;){let P=u.shift();o?Jt(t,o,()=>v(P)):v(P)}y()}catch(P){t.error(P)}}))};return e.subscribe(Ur(t,E,()=>{h=!0,y()})),()=>{c?.()}}function Ro(e,t,r=1/0){return ce(t)?Ro((n,i)=>Nn((s,o)=>t(n,s,i,o))(Xt(e(n,i))),r):(typeof t=="number"&&(r=t),Kt((n,i)=>qd(n,i,e,r)))}function Kd(e=1/0){return Ro(xa,e)}function Xd(){return Kd(1)}function zu(...e){return Xd()(Yd(e,Oa(e)))}var kE=["addListener","removeListener"],ME=["addEventListener","removeEventListener"],FE=["on","off"];function On(e,t,r,n){if(ce(r)&&(n=r,r=void 0),n)return On(e,t,r).pipe(zd(n));let[i,s]=jE(e)?ME.map(o=>c=>e[o](t,c,r)):HE(e)?kE.map(Jd(e,t)):$E(e)?FE.map(Jd(e,t)):[];if(!i&&Ai(e))return Ro(o=>On(o,t,r))(Xt(e));if(!i)throw new TypeError("Invalid event target");return new ot(o=>{let c=(...u)=>o.next(1<u.length?u:u[0]);return i(c),()=>s(c)})}function Jd(e,t){return r=>n=>e[r](t,n)}function HE(e){return ce(e.addListener)&&ce(e.removeListener)}function $E(e){return ce(e.on)&&ce(e.off)}function jE(e){return ce(e.addEventListener)&&ce(e.removeEventListener)}function ar(e,t=Pd){return Kt((r,n)=>{let i=null,s=null,o=null,c=()=>{if(i){i.unsubscribe(),i=null;let p=s;s=null,n.next(p)}};function u(){let p=o+e,m=t.now();if(m<p){i=this.schedule(void 0,p-m),n.add(i);return}c()}r.subscribe(Ur(n,p=>{s=p,o=t.now(),i||(i=t.schedule(u,e),n.add(i))},()=>{c(),n.complete()},void 0,()=>{s=i=null}))})}function qu(...e){let t=Oa(e);return Kt((r,n)=>{(t?zu(e,r,t):zu(e,r)).subscribe(n)})}var WE=" 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/\\d\\.\\d\\s[\\w\\.-]+$|^mozilla/\\d\\.\\d\\s\\(compatible;?(?:\\s\\w+\\/\\d+\\.\\d+)?\\)$|^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|infrawatch|insight|inspect|iplabel|ips-agent|java(?!;)|jsjcw_scanner|library|linkcheck|mail\\.ru/|manager|measure|neustar wpm|node|nutch|offbyone|onetrust|optimize|pageburst|pagespeed|parser|perl|phantomjs|pingdom|powermarks|preview|proxy|ptst[ /]\\d|retriever|rexx;|rigor|rss\\b|scanner\\.|scrape|server|sogou|sparkler/|speedcurve|spider|splash|statuscake|supercleaner|synapse|synthetic|tools|torrent|transcoder|url|validator|virtuoso|wappalyzer|webglance|webkit2png|whatcms/|zgrab",GE=/bot|crawl|http|lighthouse|scan|search|spider/i,Ao;function VE(){if(Ao instanceof RegExp)return Ao;try{Ao=new RegExp(WE,"i")}catch{Ao=GE}return Ao}function Qd(e){return!!e&&VE().test(e)}var Ku={d:(e,t)=>{for(var r in t)Ku.o(t,r)&&!Ku.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},Xu={};Ku.d(Xu,{A:()=>qE,k:()=>Ju});var YE=function(e,t,r,n){return new(r||(r=Promise))(function(i,s){function o(p){try{u(n.next(p))}catch(m){s(m)}}function c(p){try{u(n.throw(p))}catch(m){s(m)}}function u(p){var m;p.done?i(p.value):(m=p.value,m instanceof r?m:new r(function(h){h(m)})).then(o,c)}u((n=n.apply(e,t||[])).next())})},zE=function(e,t){var r,n,i,s,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return s={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function c(u){return function(p){return function(m){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,m[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&m[0]?n.return:m[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,m[1])).done)return i;switch(n=0,i&&(m=[2&m[0],i.value]),m[0]){case 0:case 1:i=m;break;case 4:return o.label++,{value:m[1],done:!1};case 5:o.label++,n=m[1],m=[0];continue;case 7:m=o.ops.pop(),o.trys.pop();continue;default:if(i=o.trys,!((i=i.length>0&&i[i.length-1])||m[0]!==6&&m[0]!==2)){o=0;continue}if(m[0]===3&&(!i||m[1]>i[0]&&m[1]<i[3])){o.label=m[1];break}if(m[0]===6&&o.label<i[1]){o.label=i[1],i=m;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(m);break}i[2]&&o.ops.pop(),o.trys.pop();continue}m=t.call(e,o)}catch(h){m=[6,h],n=0}finally{r=i=0}if(5&m[0])throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}([u,p])}}};function Ju(){return YE(this,void 0,Promise,function(){return zE(this,function(_a){switch(_a.label){case 0:return[4,new Promise(function(resolve,reject){var browserName="Unknown";function __callback(e){resolve({isPrivate:e,browserName})}function identifyChromium(){var e=navigator.userAgent;return e.match(/Chrome/)?navigator.brave!==void 0?"Brave":e.match(/Edg/)?"Edge":e.match(/OPR/)?"Opera":"Chrome":"Chromium"}function assertEvalToString(e){return e===eval.toString().length}function feid(){var toFixedEngineID=0;try{eval("(-1).toFixed(-1);")}catch(e){toFixedEngineID=e.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 e=String(Math.random());try{window.indexedDB.open(e,1).onupgradeneeded=function(t){var r,n,i=(r=t.target)===null||r===void 0?void 0:r.result;try{i.createObjectStore("test",{autoIncrement:!0}).put(new Blob),__callback(!1)}catch(o){var s=o;return o instanceof Error&&(s=(n=o.message)!==null&&n!==void 0?n:o),typeof s!="string"?void __callback(!1):void __callback(s.includes("BlobURLs are not yet supported"))}finally{i.close(),window.indexedDB.deleteDatabase(e)}}}catch{__callback(!1)}}function oldSafariTest(){var e=window.openDatabase,t=window.localStorage;try{e(null,null,null,null)}catch{return void __callback(!0)}try{t.setItem("test","1"),t.removeItem("test")}catch{return void __callback(!0)}__callback(!1)}function safariPrivateTest(){navigator.maxTouchPoints!==void 0?newSafariTest():oldSafariTest()}function getQuotaLimit(){var e=window;return e.performance!==void 0&&e.performance.memory!==void 0&&e.performance.memory.jsHeapSizeLimit!==void 0?performance.memory.jsHeapSizeLimit:1073741824}function storageQuotaChromePrivateTest(){navigator.webkitTemporaryStorage.queryUsageAndQuota(function(e,t){__callback(Math.round(t/1048576)<2*Math.round(getQuotaLimit()/1048576))},function(e){reject(new Error("detectIncognito somehow failed to query storage quota: "+e.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 qE=Ju,Zd=Xu.A,HB=Xu.k,sh=Ce(nn()),Ga=class{parser;result={};constructor(){this.parser=Lt.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 t=e.deviceMemory;this.result.mem={tot:t*1024}}getNetworkType(){let e=navigator,t=e.connection||e.mozConnection||e.webkitConnection;t?.effectiveType&&(this.result.net={type:t.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 t=window.devicePixelRatio||1,r=e.offsetWidth*t;return document.body.removeChild(e),r}async getLocation(){if(!(!navigator.geolocation||!navigator.permissions||(await navigator.permissions.query({name:"geolocation"})).state!="granted"))return new Promise(e=>{navigator.geolocation.getCurrentPosition(t=>{this.result.coords=[t.coords.latitude,t.coords.longitude],e()},()=>e())})}async getBatteryInfo(){if("getBattery"in navigator)try{let e=await navigator.getBattery();this.result.bat={l:e.level*100,c:e.charging}}catch{}}},Ni=class{static trackDeviceID(e){this.isInstalled()}static trackIntent(e){if(!this.isInstalled())return;let t=En[e]?.toLowerCase();t&&(b.debug(`Sending ${t} intent to MS Clarity`),window.clarity("set","Cooee Intent",t))}static isInstalled(){return window.clarity&&typeof window.clarity=="function"}},ih=Ce(Gr()),Oi=class{constructor(e,t){this._startTime=e,this._triggerData=t}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()),N.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,t){t??={};let r=(new Date().getTime()-this.startTime.getTime())/1e3,n=w({eventName:e,duration:r},t);this.stopIntervals(),this.closeCallback&&this.closeCallback(n)}addInputField(e,t){this.inputFields.push({id:e,type:t,isValid:!1})}updateValidation(e,t){this.inputFields.forEach(r=>{if(r.id===e){r.isValid=t;return}})}hasManipulatedProductQuantity(){let e=this.triggerData.manipulation.productQuantity;return e.enabled&&e.min!=null&&e.max!=null}getManipulatedQuantity(e){let{min:t=1,max:r=100}=this.triggerData.manipulation.productQuantity;if(t>r)return b.error("Invalid range: min should be less than or equal to max."),e;if(e>=t&&e<=r)return e;let n=e%100;return n<t?t:n>r?r:n}stopIntervals(){this.intervals.forEach(e=>clearInterval(e))}},Va=class{loadedFonts=[];async loadAllFonts(e){e.elems?.forEach(t=>{t instanceof wr&&this.loadFamily(t.typography?.fam)})}async loadFamily(e){if(!e?.fonts||this.loadedFonts.indexOf(e.name)>-1)return;let t=[];e.fonts.forEach(r=>{if(r.url){let n=new FontFace(N.COOEE+e.name,r.getURL(),r.getFontDescriptor());t.push(n.load())}}),this.loadedFonts.push(e.name),(await Promise.all(t)).forEach(r=>{document.fonts.add(r)})}},Ya=class{static updateIdentity(e){if(!this.isInstalled())return;let t={};e.email&&(t.email=e.email),e.mobile&&(t.phone_number=e.mobile),b.debug("Sending email/mobile to Klaviyo"),window.klaviyo.push(["identify",t])}static isInstalled(){return window.klaviyo&&typeof window.klaviyo=="object"}},za=class{apiService;action;triggerContext;constructor(e,t){this.action=e,this.apiService=fe.getInstance(),this.triggerContext=t}async execute(){let e=this.containsCTA()?N.EVENT_TRIGGER_CLICKED:N.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:b.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;re.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,t){this.triggerContext.closeInApp(e,t),this.dispatchEvent()}shareAction(){if(this.action.share){if(!navigator.share){b.warn("Navigator.share is not compatible with this browser");return}navigator.share({text:this.action.share.text,title:"Share"}).then(e=>console.log(e)).catch(e=>console.error(e))}}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)){b.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(t=>t.state.toString())}async checkAllPermission(){let e=await this.checkPermission("camera"),t=await this.checkPermission("geolocation"),r=Notification.permission;return{camera:e,location:t,notification:r}}sendPermissionData(){this.checkAllPermission().then(e=>{this.apiService.updateDeviceProps({perm:e})})}collectFormData(){let e={};for(let t of this.triggerContext.inputs){if(!t.isValid)return;let r=document.getElementById(t.id).value;t.type===51?e.email=r:t.type===52&&(e.mobile=r)}this.closeTriggerAndSendEvent(N.EVENT_FORM_SUBMITTED,{form:e}),re.showSnackbar("Coupon applied on cart"),Ya.updateIdentity(e)}dispatchEvent(){let e=this.triggerContext.triggerData,t={clickAction:this.action,items:this.triggerContext.selectedEmbeddedItems??e.embeddedItems??e.items,collections:e.collections,triggerData:e};document.dispatchEvent(new CustomEvent(N.CTA_EVENT,{detail:t}));let r={action:this.containsCTA()?N.CAMPAIGN_CLICKED_ACTIVITY:N.CAMPAIGN_CLOSED_ACTIVITY};document.dispatchEvent(new CustomEvent(N.POPUP_ACTIVITY_EVENT,{detail:r}))}},Pi=class{constructor(e){this.scalingFactor=e}getLayoutStyles(e){if(!e)return{display:"block"};let t={display:e.disp};return e.of&&(t.objectFit=e.of),e.pos==="absolute"&&(t.width="auto !important",t.position="absolute",t.right=e.right+"px",t.left=e.left+"px",t.top=e.top+"px",t.bottom=e.bottom+"px"),t}getSizeStyles(e){let t={};return e?.w&&(t.width=e.w),e?.h&&(t.height=e.h),e?.maxW&&(t.maxWidth=e.maxW),e?.maxH&&(t.maxHeight=e.maxH),e?.minW&&(t.minWidth=e.minW),e?.minH&&(t.minHeight=e.minH),t}getBorderStyles(e){if(!e)return{};let t={};return e.radius&&e.radius>0&&(t.borderRadius=this.getSizePx(e.radius)),e.width&&e.width>0&&(t.borderWidth=this.getSizePx(e.width),t.borderStyle=e.style?.toLowerCase(),e.color?this.getColourStyles(e.color,"border-color",t):t.borderColor="black"),t}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 t={};return e?(t.paddingTop=this.getSizePx(e.pt),t.paddingBottom=this.getSizePx(e.pb),t.paddingLeft=this.getSizePx(e.pl),t.paddingRight=this.getSizePx(e.pr),t.marginTop=this.getSizePx(e.mt),t.marginBottom=this.getSizePx(e.mb),t.marginLeft=e.cent?"auto":this.getSizePx(e.ml),t.marginRight=e.cent?"auto":this.getSizePx(e.mr),t):(t.margin="0 !important",t.padding="unset",t)}getBackgroundStyles(e){if(!e)return{};let t={};if(e.glossy){let r="backdrop-filter",n="-webkit-"+r,i=`blur(${e.glossy.radius}px)`;if(!CSS.supports(n,i)&&!CSS.supports(r,i))return{background:e.glossy.fallback.rgba};if(t[n]=i,t[r]=i,e.glossy.color)return this.getColourStyles(e.glossy.color,"background",t)}else if(e.solid){if(e.solid.grad)return this.getGradientStyles(e.solid.grad,"background",t);if(e.solid.hex)return{backgroundColor:e.solid.rgba}}else if(e.img){if(!e.img.src)return{};let r=(e.img.a??0)/100;t.background=`linear-gradient(rgba(0, 0, 0, ${r}), rgba(0, 0, 0, ${r})),url("${e.img.src}") no-repeat center`,t.backgroundSize="cover",e.img.a&&(t["-webkit-backdrop-filter"]=`opacity(${e.img.a})`,t.backdropFilter=`opacity(${e.img.a})`)}return t}getGradientStyles(e,t,r){if(r??={},e.type==="LINEAR"){let n=`linear-gradient(${e.ang}deg, ${e.c1}, ${e.c2}`;e.c3&&(n+=`, ${e.c3}`),n+=")",r[t]=n}return r}getColourStyles(e,t="color",r){return r??={},e?e.grad?this.getGradientStyles(e.grad,t,r):(e.hex&&(r[t]=e.rgba),r):r}getSizePx(e){return this.getScaledSize(e)+"px"}getScaledSize(e){return(e??0)*this.scalingFactor}},Qt=class{renderer=Lt.get();parentHTMLEl;inappElement;inappHTMLEl;triggerContext;stylesConverter;scalingFactor;constructor(e,t,r){this.parentHTMLEl=e,this.inappElement=t,this.triggerContext=r,this.stylesConverter=new Pi(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=ee(w(w(w(w({},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 t=(e/100).toFixed(2);this.renderer.setStyle(this.inappHTMLEl,"opacity",t)}}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 vn(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",t=>{t.stopPropagation(),new za(e,this.triggerContext).execute()}),this.renderer.setStyle(this.inappHTMLEl,"cursor","pointer"))}getBackgroundStyles(){return this.stylesConverter.getBackgroundStyles(this.inappElement.bg)}},xr=class extends Qt{constructor(e,t,r){super(e,t,r)}processCommonBlocks(){super.processCommonBlocks(),this.processFontBlock(),this.processAlignment()}processFontBlock(){let e={},t=this.inappElement.typography;return t&&(e.fontSize=this.stylesConverter.getSizePx(t.fs),e.fontFamily=N.COOEE+t.fam?.name,e.lineHeight=`${t.lh}`,e.letterSpacing=t.letterSpacing),this.stylesConverter.getColourStyles(this.inappElement.color,"color",e),this.renderer.setStyles(this.inappHTMLEl,e),e}processPart(e,t){let r=[];t.u&&r.push("underline"),t.st&&r.push("line-through"),r.length||r.push("normal"),this.renderer.setStyle(e,"font-weight",t.b?"bold":"normal"),this.renderer.setStyle(e,"font-style",t.i?"italic":"normal"),this.renderer.setStyle(e,"text-decoration",r.join(" ")),this.renderer.setStyle(e,"color",t.c??"inherit"),this.renderer.setStyle(e,"font-family","inherit")}processAlignment(){let e=this.inappElement.typography.ta,t=e?li[e]?.toLowerCase():this.inappElement.typography.alignment;t||(t="start"),this.renderer.setStyle(this.inappHTMLEl,"text-align",t)}},No=class extends xr{constructor(e,t,r){super(e,t,r),this.inappHTMLEl=this.renderer.createElement("div"),this.insertElement()}render(){this.inappElement.parts?.forEach(e=>{let t=this.renderer.createElement("span");t.innerHTML=e.txt?.toString()?.replace(/\n/g,"<br />"),this.processPart(t,e),this.renderer.appendChild(this.inappHTMLEl,t)}),this.processCommonBlocks()}},Oo=class extends Qt{constructor(e,t,r){super(e,t,r),this.inappHTMLEl=this.renderer.createElement("div"),this.insertElement()}render(){this.processCommonBlocks()}},Pn=class extends Qt{constructor(e,t,r){super(e,t,r),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()}},Po=class Rh extends Qt{constructor(t,r,n){super(t,r,n),this.parent=t,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(N.IN_APP_WRAPPER_NAME),this.inappHTMLEl.classList.add(this.triggerContext.rootClassName),this.renderer.setStyle(this.inappHTMLEl,"z-index",Rh.MAX_Z_INDEX),this.inappHTMLEl}getBackgroundStyles(){return this.inappElement.cover?super.getBackgroundStyles():{}}processWidthAndHeight(){let t=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 r=this.inappElement.spc,n=this.stylesConverter.getScaledSize(t.w)+r.getHorizontal(),i=this.stylesConverter.getScaledSize(t.h)+r.getVertical();this.renderer.setStyle(this.inappHTMLEl,"width",n+"px"),this.renderer.setStyle(this.inappHTMLEl,"height",i+"px")}}getSpaceStyles(){return{padding:this.inappElement.spc.getPaddingCSS()}}getDisplayStyles(){return w(w({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(){}},Ka=class extends Qt{constructor(e,t,r){super(e,t,r),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(N.IN_APP_CONTAINER_NAME),this}},Li=class extends xr{borderColor="";constructor(e,t,r){super(e,t,r),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",t=>{t.stopPropagation()}),this.processCommonBlocks(),this.addListener(this.inappHTMLEl,e),this.triggerContext.addInputField(e,this.inappElement.t)}},Xa=class Lh extends Li{static EMAIL_REGEX=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;constructor(t,r,n){super(t,r,n)}setInputType(){let t=`coo-${this.inappElement.t}`;return this.renderer.setAttribute(this.inappHTMLEl,"type","email"),this.renderer.setAttribute(this.inappHTMLEl,"id",t),t}addListener(t,r){t.addEventListener("keydown",n=>{this.borderColor||(this.borderColor=this.inappHTMLEl.style.borderColor),t.value.match(Lh.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()})}},Ja=class Uh extends Li{static MOBILE_REGEX=/^\d+$/;constructor(t,r,n){super(t,r,n)}setInputType(){let t=`coo-${this.inappElement.t}`;return this.renderer.setAttribute(this.inappHTMLEl,"type","tel"),this.renderer.setAttribute(this.inappHTMLEl,"id",t),t}addListener(t,r){t.addEventListener("keydown",n=>{this.borderColor||(this.borderColor=this.inappHTMLEl.style.borderColor),t.value.match(Uh.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()})}},Qa=class jn extends xr{static DAYS="Days";static HOURS="Hours";static MINUTES="Minutes";static SECONDS="Seconds";elements;spans=[];constructor(t,r,n){super(t,r,n),this.inappHTMLEl=this.renderer.createElement("div"),this.insertElement()}render(){this.addTimerChildren(),this.processAndStartTimer(),this.processCommonBlocks();let t=ee(w(w(w({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(t)}getBackgroundStyles(){return{}}processFontBlock(){let t=super.processFontBlock();return this.stylesConverter.getColourStyles(this.inappElement.color,"color",t),this.addStylesToTimer(t),t}getSpaceStyles(){return{}}getBorderStyles(){return{}}getDisplayStyles(){return{display:"flex",flexWrap:"nowrap",justifyContent:"center"}}addStylesToTimer(t){this.elements.forEach(r=>this.renderer.setStyles(r,t))}addTimerChildren(){let t=this.inappElement.show;this.elements=[],t.day&&this.elements.push(this.getChild(jn.DAYS)),t.hour&&this.elements.push(this.getChild(jn.HOURS)),t.minute&&this.elements.push(this.getChild(jn.MINUTES)),t.second&&this.elements.push(this.getChild(jn.SECONDS)),this.elements.forEach(r=>this.inappHTMLEl.appendChild(r))}getChild(t){let r=this.renderer.createElement("div"),n=this.renderer.createElement("span"),i=this.renderer.createElement("span");return i.innerText=t,n.innerText="00",n.id=`lc-${t}`,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 t=this.inappElement.timer.start(this.inappElement.timerType,r=>{this.spans.forEach(n=>{n.id===`lc-${jn.DAYS}`?n.innerText=String(r.days).padStart(2,"0"):n.id===`lc-${jn.HOURS}`?n.innerText=String(r.hours).padStart(2,"0"):n.id===`lc-${jn.MINUTES}`?n.innerText=String(r.minutes).padStart(2,"0"):n.id===`lc-${jn.SECONDS}`&&(n.innerText=String(r.seconds).padStart(2,"0"))})});this.triggerContext.intervals.push(t)}},Za=class extends xr{constructor(e,t,r){super(e,t,r),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",t=>{t.stopPropagation()}),e.addEventListener("change",()=>{let t=new Sr(JSON.parse(e.value));this.updateItems(t)})}updateItems(e){let t=this.triggerContext.triggerData.items[0];this.triggerContext.selectedEmbeddedItems=[t.toEmbed(e)];let r=this.parentHTMLEl.querySelector("#coo-13");if(!r)return;let n=e.imgs[0]??t.imgs?.at(0);n?.url&&r.setAttribute("src",n.url)}addOptions(){let e=this.triggerContext.triggerData.items,t=this.inappHTMLEl;if(!e?.length){t.add(this.createOption(this.inappElement.placeholderText));return}let r=this.triggerContext.selectedEmbeddedItems?.at(0);e[0].vars.forEach(n=>{t.add(this.createOption(n.name??"Default",n,n.mID===r?.vID))})}createOption(e,t,r){let n=this.renderer.createElement("option");return n.text=e,n.value=JSON.stringify(t),r&&(n.selected=!0),t||(n.disabled=!0),n}},ec=class extends Pn{constructor(e,t,r){super(e,t,r)}render(){super.render(),this.inappHTMLEl.setAttribute("id",`coo-${this.inappElement.type}`)}},tc=Ce(nn()),Dr=class Mh{static INSTANCE=new Mh;topics={};constructor(){}static get(){return this.INSTANCE}broadcast(t,r){this.topics[t]||(this.topics[t]=new Ct),this.topics[t].next(r)}subscriber(t){return this.topics[t]||(this.topics[t]=new Ct),this.topics[t].asObservable()}},ze=class $r{static DEFAULT_SELECTOR="cart-drawer";static _instance;inShadow=!1;cartDrawerElement;cartDrawerShadowElement;configWebsite=Le.get().website??{};currentState=!1;drawerSubject=new To({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",'a[onclick*="handleFloCartBtn"]'].join(",");cartSelector=[$r.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(),document.addEventListener(N.CTA_AFTER_REFRESH_UI,this.updateBubble.bind(this))}get element(){return this.cartDrawerElement}static get(){return $r._instance||($r._instance=new $r),$r._instance}static forceUpdate(){$r._instance=new $r}isOpen(){let t=this.inShadow?this.isPresent():this.isVisible();return tc.default.log(`Cart drawer is currently ${t?"open":"close"}`),t}open(){if(this.isOpen()){b.log("Drawer is already open");return}document.dispatchEvent(new CustomEvent(N.CTA_OPEN_CART_EVENT));let t=document.querySelector(this.iconSelector);if(!t){b.debug("No clickable cart icon found with selector",this.iconSelector);return}t.click()}onToggle(){return this.drawerSubject}isShopifyDefaultDrawer(){return this.element?.tagName.toLowerCase()===$r.DEFAULT_SELECTOR}isMiniCart(){return this.isShopifyDefaultDrawer()&&this.element?.id==="mini-cart"}refreshUI(t,r=!0){if(this.isMiniCart()&&this.element?._rerenderCart)this.element._rerenderCart({detail:{cart:t}});else if(this.isShopifyDefaultDrawer())this.element?.renderContents&&t&&(this.element.classList.remove("is-empty"),this.element.renderContents?.(t));else if(this.element?.onCartDrawerUpdate)this.element.onCartDrawerUpdate();else if(window.cartGiftUpdate){if(!t?.items?.[0])return;let n=t.items[0].id,i=t.items[0].quantity,s=t.items[0].price;window.cartGiftUpdate(n,s,i,"","ADD_TO_CART")}else if(window.icartCartActivityEvent)window.icartCartActivityEvent();else if(window.theme?.CartDrawer)window.theme?.CartDrawer.init?new window.theme.CartDrawer().init():new window.theme.CartDrawer;else if(window.Hs_CartDrawer?.updateSlideCart)window.Hs_CartDrawer.updateSlideCart();else if(window.theme?.fetch_side_cart)window.theme.fetch_side_cart();else if(window.theme?.Cart?.updateCart)window.theme.Cart.updateCart();else if(window.cartUpdate)window.cartUpdate();else if(this.element?._onCartRefresh)this.element._onCartRefresh();else if(window.cart?.getCart)window.cart.getCart();else if(this.element?.tagName?.toLowerCase()==="cart-drawer-component")document.dispatchEvent(new CustomEvent("action:cart:updateCartandShowCart"));else if(this.element?.id==="sidebar-cart")document.body.dispatchEvent(new CustomEvent("cart:refresh",{bubbles:!0,detail:{}}));else if(this.element?.id==="quick-cart"){let n=document.querySelector('a[href="/cart"]');n&&n.click()}else b.info("No method found to update the cart without refreshing");document.dispatchEvent(new CustomEvent(N.CTA_AFTER_REFRESH_UI)),r&&Dr.get().broadcast(N.CART_UPDATE_BROADCAST)}async initialize(){let t=this.configWebsite.cartDrawerSelector;if(!t){await this.findCartDrawer();return}let r=t.split(N.SHADOW_SPLITTER);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(!Pe.isShopify())return;let t=this.selector||this.cartSelector;if(this.cartDrawerElement=await re.retrySelector(t),!this.cartDrawerElement){tc.default.warn("Max attempts exhausted to find cart drawer");return}tc.default.log("Found",this.cartDrawerElement,`from selector: ${t}`),this.createMutationObserver()}async findCartDrawerWithShadow(){if(!Pe.isShopify()||!this.shadowParentElementSelector)return;let t=(await re.retrySelector(this.shadowParentElementSelector))?.shadowRoot;t?.mode==="open"&&(this.cartDrawerShadowElement=t,this.createMutationObserver())}isVisible(){if(!this.cartDrawerElement)return!1;let t=this.cartDrawerElement.getBoundingClientRect(),r=(window.innerHeight||document.documentElement.clientHeight)+.5,n=(window.innerWidth||document.documentElement.clientWidth)+.5,i=t.top<=r&&t.bottom>=0,s=t.left<=n&&t.right>=0,o=i&&s,c=this.cartDrawerElement.tagName.toLowerCase()===$r.DEFAULT_SELECTOR&&this.cartDrawerElement.open,u=getComputedStyle(this.cartDrawerElement),p=u.display!=="none"&&u.visibility!=="hidden"&&parseFloat(u.opacity)>0,m=!this.cartDrawerElement.hidden,h=this.cartDrawerElement.offsetWidth>0||this.cartDrawerElement.offsetHeight>0||this.cartDrawerElement.getClientRects().length>0,y=u.transform.match(/matrix\(([^)]+)\)/),E=0,v=0;if(y){let G=y[1].split(", ").map(parseFloat);E=G[4],v=G[5]}let _=E+t.left>n||E+t.right<0||v+t.top>r||v+t.bottom<0,x=Math.max(0,Math.min(t.right,n)-Math.max(t.left,0)),P=Math.max(0,Math.min(t.bottom,r)-Math.max(t.top,0)),B=x*P,U=t.width*t.height,R=U>0&&B/U>=.1;return(o||c||!_)&&p&&m&&h&&R}createMutationObserver(){if(!this.cartDrawerElement&&!this.cartDrawerShadowElement)return;let t=this.cartDrawerElement||this.cartDrawerShadowElement,r=new Ct;this.mutationObserver=new MutationObserver(()=>{r.next()}),this.mutationObserver.observe(t,{attributes:!0,subtree:!0,childList:this.inShadow}),r.pipe(ar(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)}async updateBubble(){let t=(await de.getCurrent().getNormalisedCart(!0)).itemCount,r=document.querySelector(".cart-link__bubble");r&&(r.innerText=t+"")}},Bi=class qo{static ACTIVE_TRIGGER_DATA;renderer=Lt.get();safeHTTP;parent;rootContainer;containerHTMLElement;ian;triggerContext;resizeListener;cartDrawerToggleSubscription;constructor(t){this.safeHTTP=fe.getInstance(),this.resizeListener=()=>this.screenResized(),this.setParentContainer(t)}setParentContainer(t){this.parent=t??document.body,this.renderer.setParentContainer(this.parent)}render(t){this.renderEngagement(new Mt(t))}async renderEngagement(t){if(this.triggerContext=new Oi(new Date,t),this.triggerContext.onClose(r=>{this.closeInApp(r)}),this.ian=t.ian,(this.renderer.isMobile()||t.previewType==="mobile")&&this.ian.overrideForMobileView(),this.ian.isEmbedded()){let r=document.querySelector(this.ian.getEmbeddedSelector());this.setParentContainer(r)}await this.preloadImages(t),t.shouldDelay()?window.setTimeout(()=>{this.withCartDrawerClosed()},t.getDelaySeconds()):this.withCartDrawerClosed()}withCartDrawerClosed(){if(!ze.get().isOpen()||!this.renderer.isMobile()){this.startRenderingOnce();return}this.cartDrawerToggleSubscription=ze.get().onToggle().subscribe(({open:t})=>{!t&&this.startRenderingOnce()})}startRenderingOnce(){if(!this.shouldSkipCampaign()){qo.ACTIVE_TRIGGER_DATA=this.triggerContext.triggerData;try{this.startRendering()}catch(t){Be.getInstance().captureException(t,{triggerData:JSON.stringify(this.triggerContext.triggerData)});return}this.sendTriggerDisplayed(),this.renderer.isMobile()||window.addEventListener("resize",this.resizeListener),this.cartDrawerToggleSubscription?.unsubscribe()}}shouldSkipCampaign(){let t=this.triggerContext.triggerData;if(!t.previewType&&qo.ACTIVE_TRIGGER_DATA){let n={triggerShown:new Ii(qo.ACTIVE_TRIGGER_DATA??{})};return this.skipTrigger(t,n),!0}if(le.get().isGoKwikPopupOpen)return this.skipTrigger(t,{reason:"GoKwik popup is open"}),!0;let r=N.PAYMENT_MODAL_DETAILS.find(n=>!!document.querySelector(n.identifier));return r?(this.skipTrigger(t,{reason:`${r.gateway} modal is open`}),!0):!1}startRendering(){this.renderer.calculateScalingFactor(this.ian),this.rootContainer=new Po(this.parent,this.ian,this.triggerContext).render();try{this.renderContainer(this.triggerContext)}catch(t){throw b.error(t),t}}sendTriggerDisplayed(){let t={};this.triggerContext.triggerData.items?.length&&(t.promotedMIDs=this.triggerContext.triggerData.items?.map(i=>i.mID));let r=new _e(N.EVENT_TRIGGER_DISPLAYED,t,this.triggerContext.triggerData);this.safeHTTP.sendEvent(r);let n={action:N.CAMPAIGN_DISPLAYED_ACTIVITY};document.dispatchEvent(new CustomEvent(N.POPUP_ACTIVITY_EVENT,{detail:n}))}sendTriggerClosed(t){let r=t.eventName;delete t.eventName;let n=new _e(r,t,this.triggerContext.triggerData);n.name===N.EVENT_TRIGGER_CLICKED&&(n.items=this.triggerContext.selectedEmbeddedItems??this.triggerContext.triggerData.items?.map(i=>i.toEmbed())),this.safeHTTP.sendEvent(n)}addEnterAnimation(t){this.containerHTMLElement.animate(t.getEnterAnimation(),{duration:500})}renderElement(t,r,n){r instanceof mi?new Xa(t,r,n).render():r instanceof di?new Ja(t,r,n).render():r instanceof qr?new No(t,r,n).render():r instanceof hi?new ec(t,r,n).render():r instanceof Br?new Pn(t,r,n).render():r instanceof _n?new Oo(t,r,n).render():r instanceof pi?new Qa(t,r,n).render():r instanceof fi?new Za(t,r,n).render():b.error("Unsupported element type- "+r.type)}renderContainer(t){let r=this.ian?.cont;r&&(this.containerHTMLElement=new Ka(this.rootContainer,r,t).render().getHTMLElement(),new Va().loadAllFonts(this.ian),this.ian.elems?.forEach(async n=>{await this.renderElement(this.containerHTMLElement,n,t)}),this.addEnterAnimation(this.ian.anim))}closeInApp(t){let r=this.ian.anim.getExitAnimation();this.sendTriggerClosed(t),qo.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(){Lt.get().removeInApp(this.triggerContext)}skipTrigger(t,r){let n=new _e(N.EVENT_CAMPAIGN_REJECTED,r,t);this.safeHTTP.sendEvent(n)}async preloadImages(t){let r=t.ian;if(!r)return;let n=[];r.elems.forEach(i=>{let s=i.bg?.img?.src;if(s&&n.push(this.getPromise(s)),i.t===1){let o=i.src;if(!o)return;n.push(this.getPromise(o))}}),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(t){return new Promise(r=>{let n=new Image;n.onload=r,n.src=t,n.style.display="none"})}},eh=Ce(Gr()),th=Ce(Zn()),rc=class{triggerData;safeHttpService=fe.getInstance();render(e){e.contentSource===eh.EngagementContentSource.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 t=e.detail;if(t.formId!==this.triggerData.klaviyoFormID){b.warn("Received invalid trigger callback");return}switch(t.type){case"open":this.safeHttpService.sendEvent(new _e(N.EVENT_TRIGGER_DISPLAYED,{form:{id:t.formId}},this.triggerData));break;case"stepSubmit":{let r=this.getFormDetails(t);this.safeHttpService.sendEvent(new _e(N.EVENT_FORM_SUBMITTED,{form:r},this.triggerData)),this.safeHttpService.updateProfile(r);break}case"close":window.removeEventListener("klaviyoForms",this.handleKlaviyoEvents.bind(this)),this.safeHttpService.sendEvent(new _e(N.EVENT_TRIGGER_CLOSED,{form:{id:t.formId}},this.triggerData));break}}getFormDetails(e){let t={id:e.formId},r=e.metaData;if(th.JSUtils.hasKeys(r)){let n=["email","phone_number","first_name","last_name","$email","$phone_number","$first_name","$last_name"];Object.keys(r).forEach(o=>{n.includes(o)||(t[o]=r[o])}),t.email=r.$email??r.email,t.mobile=r.$phone_number??r.phone_number;let i=r.$first_name??r.first_name,s=r.$last_name??r.last_name;(i?.length||s?.length)&&(t.name=i+" "+s)}return t}},nc=class{static trackIntent(e){if(!this.isInstalled()){b.log("Facebook pixel not installed");return}if(!Le.get().pixelPush){b.log("Facebook pixel push not enabled");return}let t=En[e.intent]?.toLowerCase(),r=e.segmentName;!t&&!r||(b.debug(`Sending ${t} intent and ${r} segment to Facebook Pixel`),window.fbq("trackCustom","CooeeIntent",{intent_value:t,segment_value:e.segmentName}))}static isInstalled(){return window.fbq&&typeof window.fbq=="function"}},nh=Ce(rh()),Ln=class{static _flags={};static getFlags(){return this._flags}static setFlags(e){this._flags=e??{}}static isECommerceApp(){return Pe.isShopify()}},KE=(0,nh.default)(fetch),XE={retryDelay:N.API_CALL_RETRY_DELAY,retryOn:(e,t,r)=>e>=N.API_CALL_MAX_ATTEMPTS?!1:!!(t!==null||r?.status&&r?.status>=500)},ht=class Bh{static INSTANCE;apiToken="";firstSeen="";constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Bh),this.INSTANCE}async validateSession(t){return this.post("/v1/event/validate-session",t)}updateUserData(t){this.put("/v1/user/update",t).then(async r=>{b.log("Updated user profile"),await Bn.getInstance().storeAndPopulateAuthData(r)}).catch(r=>{b.error("Error saving user profile",r)})}trackOrder(t){this.post("/v1/event/track-order",t).then(()=>{b.log("Sent Order")}).catch(r=>{b.error("Error sending track order",r)})}generateDiscount(t){return this.post("/v1/event/generate-discount",t)}updateDeviceProps(t){this.put("/v1/device/update",t).then(()=>{b.log("Updated device property")}).catch(async r=>{b.error("Error saving device property",r)})}setAPIToken(t){this.apiToken=t??""}setFirstSeen(t){this.firstSeen=t?.toUTCString()??""}get(t){return this.requestBackend("GET",t)}post(t,r){return this.requestBackend("POST",t,r)}put(t,r){return this.requestBackend("PUT",t,r)}async requestBackend(t,r,n){if(!Ln.isECommerceApp()&&!Ln.getFlags().allowEvents)return b.log(`Rejecting ${t} ${r} as this is not e-commerce app`),Promise.reject();r.startsWith("http")||(r=tr.apiURL+r);let i=this.getDefaultHeaders(),s="keepalive"in new Request("");if(n&&!s&&JSON.stringify(n).includes("CE App Background"))try{return this.performXMLHttpRequest(r,i,n)}catch(c){return Be.getInstance().captureException(c,{body:JSON.stringify(n)}),{}}let o={method:t,headers:i,keepalive:!0};return n&&(o.body=JSON.stringify(n)),this.request(r,o)}async request(t,r){let n=w(w({},XE),r),i=await KE(t,n);if(!i.ok)throw i;return i.json()}performXMLHttpRequest(t,r,n){return new Promise((i,s)=>{let o=new XMLHttpRequest;o.open("POST",t,!0),r.forEach((c,u)=>{o.setRequestHeader(u,c)}),o.onreadystatechange=()=>{if(o.readyState===XMLHttpRequest.DONE)if(o.status>=200&&o.status<300)try{o.getResponseHeader("Content-Type")?.includes("application/json")?i(JSON.parse(o.responseText)):s(new Error("Content-Type of response header is not json"))}catch(c){s(c)}else s(new Error(`Received status - ${o.status}(${o.statusText})`))},o.onerror=()=>{s(new Error("Network error occurred during the request."))},o.send(JSON.stringify(n))})}getDefaultHeaders(){let t=new Headers;return t.set("content-type","application/json"),t.set("cooee-sdk",N.SDK),t.set("cooee-sdk-code",N.SDK_VERSION_CODE.toString()),t.set("cooee-sdk-version",N.SDK_VERSION),t.set("cooee-first-seen",this.firstSeen),this.apiToken&&t.append("cooee-sdk-token",this.apiToken),tr.debug&&t.set("cooee-sdk-debug",String(1)),t}},Ui=class{static sentryService=Be.getInstance();static httpApiService=ht.getInstance();static async refreshItems(e){if(e.isCartEmbed()&&!e.isSubscriptionUpsell()){let i=(await de.getCurrent().getNormalisedCart()).items.map(s=>s.mID);e.items=e.items.filter(s=>!i.includes(s.mID))}if(Le.get().currencyCount<=1)return e.items;let t=e.items.length,r=e.items.map(i=>this.updatedItem(i,e.engagementID)),n=(await Promise.all(r)).filter(i=>i!=null);if(t&&!n.length){let i="Failed to fetch any product from Ajax API",s=new _e(N.EVENT_CAMPAIGN_FAILED,{reason:i,currency:e.currency},e);throw fe.getInstance().sendEvent(s),new Error(i)}if(e.isCartRecovery()){let i=de.getCurrent().items,s=[];for(let o of n)for(let c of o.vars){if(!c.isAvailable)continue;let u=i.find(h=>h.variant_id.toString()===c.mID);if(!u)continue;let p=new Rt(o);p.name=u.title;let m=new Sr(c);m.name=u.variant_title,m.price.d=u.discounted_price/100,p.variants=[m],s.push(p)}return s}return n}static async updatedItem(e,t){let r=e,n,i=Pe.getRootPrefix()+`products/${r.slug}.js`;try{n=await this.httpApiService.request(i)}catch(o){return b.error(`Failed to fetch ${i}`,o),o instanceof Response?this.sentryService.captureMessage(`Shopify product fetch failed ${o.status}`,"error",{item:r,path:i},{"engagement.id":t}):this.sentryService.captureException(o,{item:r,path:i},{"engagement.id":t}),null}if(!n)return b.error("Item not found after AJAX call for:",r),null;r.name=n.title;let s=r.selectedOrFirstVariant.value;return r.vars.map(o=>{let c=n.variants.find(u=>u.id===+o.mID);o.name=c.title,o.isAvailable=c.available,o.price.d=c.price?c.price/100:c.price,o.price.effective=o.price.d,o.price.cmp=c.compare_at_price?c.compare_at_price/100:c.compare_at_price,+s.mID===c.id&&(s.effectivePrice.value=o.price.d)}),r}},ic=class jh{static INSTANCE;httpService=pe.get(ht);sentryService=pe.get(Be);sessionManager=pe.get(st);runtime=le.get();constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new jh),this.INSTANCE}sendSilently(t){this.send(t).catch(r=>b.error(`Failed to send ${t.name}`,r))}async send(t){if(b.debug(`Sending event ${t.name}`),Zt.prepend(`Sending event <strong>${t.name}</strong> with id ${t.id}`),this.shouldReject(t)){b.warn(`Rejecting event ${t.name}`);return}await Promise.all([this.addSessionContext(t),this.addShopifyContext(t)]),this.addShopifyAttributes(),t.name!==N.EVENT_APP_BACKGROUND&&this.runtime.setActive(),t.currentItem=this.runtime.getCurrentItem(),this.httpService.post("/v1/event/track",t).then(async r=>{b.log("\u2705 Event tracked:",t.name),Zt.prepend(`\u2705 Event <strong>${r.eventName}</strong> tracked`),this.processEventResponse(t,r)}).catch(r=>{b.error(`Error sending event ${t.name} to server`,r)})}shouldReject(t){return t.trigger?.triggerID==="test"||t.trigger?.triggerID==="preview"?(b.warn("Not sending event as this is a test trigger"),!0):!1}async addSessionContext(t){let r=await this.sessionManager.checkSessionAndGetContext();t.sessionID=r[0],t.sessionNumber=r[1],t.landingPage=r[2],t.page=Cr.parseFromCurrent()}async addShopifyContext(t){if(Pe.isShopify())try{t.cart=await de.getCurrent().getNormalisedCart()}catch(r){b.error("Error fetching Shopify cart before sending the event",r)}}processEventResponse(t,r){this.renderWidgetIfAny(t,r).catch(n=>{b.error("Failed to display a campaign",n,t,r),this.sentryService.captureException(n,{event:t,response:r})}),this.utiliseIntentIfCalculated(r)}async renderWidgetIfAny(t,r){if(!r.triggerData){b.log(`Nothing to engage after ${t.name}`);return}b.log(`\u{1F4E3} Engagement(id=${r.triggerData.shortID}) will be shown`,r.triggerData);let n=new Mt(r.triggerData);n.occurred=t.occurred;let i;try{i=await Ui.refreshItems(n)}catch(s){b.error("Failed to refresh the products",s);return}if(n.items=i,n.contentSource===ih.EngagementContentSource.KLAVIYO){new rc().render(n);return}new Bi().renderEngagement(n).catch(s=>{b.error("Failed to render popup",s),this.sentryService.captureException(s,{event:t,triggerData:n})})}utiliseIntentIfCalculated(t){t.intent&&(Ni.trackIntent(t.intent),nc.trackIntent(t),Zt.prepend(`Intent is <strong>${En[t.intent]}</strong>`))}addShopifyAttributes(){Pe.isShopify()&&de.getCurrent().addCooeeAttributes().catch(t=>{b.error("Fail to add attributes in cart",t)})}},fe=class $h{static INSTANCE;httpApiService=ht.getInstance();eventAPIService=ic.getInstance();constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new $h),this.INSTANCE}sendEvent(t){b.debug(`Waiting for auth to send event ${t.name}`),st.replaySubject.subscribe(async()=>{this.eventAPIService.sendSilently(t)})}updateProfile(t){st.replaySubject.subscribe(()=>{this.httpApiService.updateUserData(t??{})})}trackOrder(t){st.replaySubject.subscribe(()=>{this.httpApiService.trackOrder(t)})}updateDeviceProps(t){st.replaySubject.subscribe(()=>{this.httpApiService.updateDeviceProps({props:t})})}generateDiscount(t){return this.httpApiService.generateDiscount(t)}},Zt=class{static isOn=!1;static element;static watch(){let e=b.getDebugParam();(e==="1"||e==="on")&&fe.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 t=document.createElement("div");t.innerHTML="• "+new Date().toLocaleString()+" - "+e,this.element.prepend(t)}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,t=0,r=0,n=0,i=c=>{c=c||window.event,c.preventDefault(),r=c.clientX,n=c.clientY,document.onmouseup=o,document.onmousemove=s},s=c=>{c=c||window.event,c.preventDefault(),e=r-c.clientX,t=n-c.clientY,r=c.clientX,n=c.clientY,this.element.style.top=this.element.offsetTop-t+"px",this.element.style.left=this.element.offsetLeft-e+"px"},o=()=>{document.onmouseup=null,document.onmousemove=null};this.element.onmousedown=i}static getDebugMillis(){return new Date().getTime()+6*60*60*1e3}},Lo=class extends Yr{static storeName="app";static{this.storage=Xn(this.storeName)}},oc=class{static processConfiguration(){let e=Le.get();!e.gaMeasurementID||!e.gaEnabled||this.sendClientID()}static async sendClientID(){let e=await this.getClientID();e&&fe.getInstance().updateDeviceProps({gaClientID:e})}static async getClientID(){let e=await Oe.get(oe.GA_CLIENT_ID),t=await this.getClientIDViaGTag();if(e!==t)return await Oe.set(oe.GA_CLIENT_ID,t),t}static async getClientIDViaGTag(){let e=Le.get().gaMeasurementID;if(!(!e||!window.gtag))return new Promise(t=>{window.gtag("get",e,"client_id",r=>{t(r)})})}},sc=class Fh{static INSTANCE;constructor(){this.init()}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Fh),this.INSTANCE}init(){Lo.get(oe.APP_CONFIG,{}).then(t=>this.updateGlobalConfig(t))}async processAppConfigurations(t){b.log("Received app configuration",t),t.currencyCount=t.currencies?.length;let r=this.updateGlobalConfig(t);Lo.set(oe.APP_CONFIG,r).catch(n=>b.error(n)),oc.processConfiguration(),r.website&&(dt.injectRawScript(r.website.commonJS),dt.injectRawCSS(r.website.commonCSS)),ze.get().onToggle().subscribe(async({open:n})=>{b.info("Cart drawer is now",n?"open":"closed"),n&&(pe.get(cr).loadOrRenderWidgetsAfterCartChange(),await this.trackViewCartEvent())})}updateGlobalConfig(t){let r=we.globalRef.config.update(t);return ze.forceUpdate(),b.debug("App configurations",r),r}async trackViewCartEvent(){let t=await de.getCurrent().getNormalisedCart(),r={value:t.amount,currency:t.currency},n={items:t.items,amount:r,drawer:!0};fe.getInstance().sendEvent(new _e(N.EVENT_VIEW_CART,n))}},oh=Ce(Fu()),ac=class Oc{static META_REQUIRED_FIELDS=["ad_id","campaign_id","fbclid"];static GOOGLE_REQUIRED_FIELDS=["gad_source","gclid"];source;adID;campaignID;adName;campaignName;constructor(t){this.adID=t.adID,this.campaignID=t.campaignID,this.source=t.source}static getAdParams(){let t;try{t=new oh.URLBuilder(location.href)}catch{return{}}let r={};if(this.META_REQUIRED_FIELDS.every(n=>Array.from(t.getParams().keys()).includes(n)))return r={source:"META",adID:t.getQueryParam("ad_id")?.trim(),campaignID:t.getQueryParam("campaign_id")?.trim()},new Oc(r);if(this.GOOGLE_REQUIRED_FIELDS.every(n=>Array.from(t.getParams().keys()).includes(n)))return r={source:"GOOGLE"},new Oc(r)}},Bn=class Hh{static INSTANCE=new Hh;httpAPIService=ht.getInstance();coreService=sc.getInstance();sentryService=Be.getInstance();sdkToken="";userID="";deviceID="";appID="";shopifyShop="";constructor(){}static getInstance(){return this.INSTANCE}init(t){this.appID=t.appID,this.shopifyShop=t.shopifyShop}async storeAndPopulateAuthData(t){t&&(t.userID&&(this.userID=t.userID,await Oe.set(oe.ID,t.userID)),t.deviceID&&(this.deviceID=t.deviceID,await Oe.set(oe.DEVICE_ID,t.deviceID)),t.sdkToken&&(this.sdkToken=t.sdkToken,await Oe.set(oe.SDK_TOKEN,t.sdkToken)),this.updateAPIClient())}async validateSession(t){await this.populateFirstSeen(),await this.populateUserDataFromStorage(),b.log("Validating session with server");let r=await this.getSessionValidateData(t);try{let n=await this.httpAPIService.validateSession(r);b.log("Validating session Response",n),await this.coreService.processAppConfigurations(n.appSettings),await this.storeAndPopulateAuthData(n)}catch(n){throw b.error(n),n}}async populateUserDataFromStorage(){if(this.sdkToken=await Oe.get(oe.SDK_TOKEN),!this.sdkToken){b.warn("No SDK token found in local storage");return}this.userID=await Oe.get(oe.ID),this.deviceID=await Oe.get(oe.DEVICE_ID),this.updateAPIClient()}updateAPIClient(){b.debug("SDK Token:",this.sdkToken),b.log("Device ID:",this.deviceID),b.log("User ID:",this.userID),Ni.trackDeviceID(this.deviceID),Zt.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(t){let r=await new Ga().get();r.host=location.origin;try{(await Zd())?.isPrivate&&(r.private=!0)}catch(i){sh.default.error("Unable to detect private/incognito window",i)}let n=await Oe.get(oe.DEVICE_ID);return n||(n=new tt().toHexString(),await Oe.set(oe.DEVICE_ID,n)),ee(w({deviceID:n,deviceProps:r,appID:this.appID,shopifyShop:this.shopifyShop},t),{sdk:N.SDK,page:Cr.parseFromCurrent(),ad:ac.getAdParams(),occurred:this.getSessionStartTime(le.get().jsLoadTime),currentItem:le.get().getCurrentItem(),cart:await de.getCurrent().getNormalisedCart(),properties:{}})}async populateFirstSeen(){let t=await Oe.get(oe.FIRST_SEEN),r=t?new Date(t):new Date;t||await Oe.set(oe.FIRST_SEEN,r.toISOString()),this.httpAPIService.setFirstSeen(r),this.sentryService.setGlobalContext("Visitor Info",{first_seen:r.toISOString()})}getSessionStartTime(t){return(new Date().getTime()-t.getTime())/1e3>N.IDLE_TIME_IN_SECONDS?new Date:t}},st=class Ko{static replaySubject=new xo(1);static INSTANCE;sentryService=pe.get(Be);lock=new Jn;constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Ko),this.INSTANCE}init(t){if(b.debug("Initialising SDK",t),Qd(navigator.userAgent)){b.info("This seems to be a bot. Disabling SDK");return}Bn.getInstance().init(t),Ko.INSTANCE.checkForNewSession(!0).then(async()=>{Ko.replaySubject.next(!0),Ko.replaySubject.complete()}).catch(r=>b.error("Unable to perform device init",r))}getCurrentSessionID(){return rt.set(oe.SESSION_LAST_USED_TIME,new Date().getTime()),rt.get(oe.ID,"")}async checkSessionAndGetContext(){return await this.checkForNewSession(),this.getContext()}async getContext(){let t=await Promise.all([this.getCurrentSessionID(),this.getCurrentSessionNumber(),this.getLandingPage()]);return this.sentryService.setGlobalContext("Visitor Session",{id:t[0],number:t[1],landing_page:t[2]}),t}async checkForNewSession(t){await this.lock.acquire();let r=!1;if(await this.isNewSessionRequired()?(await this.startNewSession(),t=!0,r=!0):await this.notSynced()&&(r=!0),t){let n=await this.getContext();await Bn.getInstance().validateSession({sessionID:n[0],sessionNumber:n[1],landingPage:n[2],newSession:r}),await rt.set(oe.SESSION_SYNCED,!0)}this.lock.release()}async startNewSession(){b.debug("Starting new session"),await rt.clear(),b.debug("Cleared SessionStorage before starting new session");let t=new Date,r=new tt().toHexString();b.debug("New session ID to be used",r);let n=await Oe.get(oe.SESSION_NUMBER,0)+1;Zt.prepend(`New Session ID: <strong>${r}</strong> & number: ${n}`),await Promise.all([Oe.set(oe.SESSION_NUMBER,n),rt.set(oe.ID,r),rt.set(oe.SESSION_LAST_USED_TIME,t.getTime()),rt.set(oe.SESSION_LANDING_PAGE,Cr.parseFromCurrent())])}getLandingPage(){return rt.get(oe.SESSION_LANDING_PAGE,{})}getCurrentSessionNumber(){return Oe.get(oe.SESSION_NUMBER,1)}async isNewSessionRequired(){if(!await rt.get(oe.ID))return!0;let t=await rt.get(oe.SESSION_LAST_USED_TIME,0);return t?(new Date().getTime()-t)/1e3>N.IDLE_TIME_IN_SECONDS:!0}async notSynced(){return!await rt.get(oe.SESSION_SYNCED,!1)}},Go=Ce(Gr()),fh=Ce(Pc()),mh=Ce(Zn()),dh=Ce(nn()),ch=Ce(Jo()),lh=Ce(nn()),kr=Ce(Gr()),JE=`
|
|
39
39
|
mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]) {
|
|
40
40
|
cartDiscountCodesUpdate(cartId: $cartId, discountCodes: $discountCodes) {
|
|
41
41
|
cart {
|
|
@@ -47,7 +47,7 @@ mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]) {
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
-
`,
|
|
50
|
+
`,Zr=class{static navigate(e,t,r){let n=`${location.origin}/discount/${e}`;switch(b.log(`Applying discount code ${e}`,t,r),t){case kr.RedirectBehaviour.CART_PAGE:location.href=`${n}?redirect=/cart`;break;case kr.RedirectBehaviour.CART_DRAWER:location.href=`${n}?redirect=${location.pathname}#${N.HASH_OPEN_CART_DRAWER}=1`;break;case kr.RedirectBehaviour.SHOPIFY_CHECKOUT:location.href=`${n}?redirect=/checkout`;break;case kr.RedirectBehaviour.THIRD_PARTY_CHECKOUT:this.checkThirdPartyMethods(`${n}?redirect=/cart#${N.HASH_INITIATE_CHECKOUT}=1`);break;default:location.href=`${n}?redirect=${r||location.pathname}`}}static navigateWithoutDiscount(e,t){let r=ze.get();switch(e){case kr.RedirectBehaviour.CART_PAGE:location.href="/cart";break;case kr.RedirectBehaviour.SHOPIFY_CHECKOUT:location.href="/checkout";break;case kr.RedirectBehaviour.THIRD_PARTY_CHECKOUT:this.checkThirdPartyMethods(`/cart#${N.HASH_INITIATE_CHECKOUT}=1`);break;case kr.RedirectBehaviour.CART_DRAWER:{r.open();break}}t&&r.refreshUI(t)}static async applyWithStorefront(e){let t=Le.get().storefrontToken;if(!t)throw new Error("Storefront token not set for the store");let r=new Headers;r.append("Content-Type","application/json"),r.append("X-Shopify-Storefront-Access-Token",t);let n=JSON.stringify({query:JE,variables:{cartId:`gid://shopify/Cart/${de.getCurrent().token}`,discountCodes:[e]}}),i={method:"POST",headers:r,body:n};await ht.getInstance().request(N.GRAPHQL_API_PATH,i)}static checkThirdPartyMethods(e){window.triggerGokwikCustomCheckout?window.triggerGokwikCustomCheckout():window.shiprocketCheckoutEvents?.buyCart?window.shiprocketCheckoutEvents.buyCart():window.openCheckout?window.openCheckout():window.openRzpCheckout?window.openRzpCheckout():location.href=e}},ah=Ce(Zn()),QE=`
|
|
51
51
|
mutation cartCreate($input: CartInput) {
|
|
52
52
|
cartCreate(input: $input) {
|
|
53
53
|
cart {
|
|
@@ -60,11 +60,11 @@ mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]) {
|
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
-
`,Qr=class{listen(){document.addEventListener(N.CTA_EVENT,async t=>{await this.processEvent(t)},!1)}async performAddToCart(t,e){if(!t.length)return;let r=t.map(c=>{let{vID:u,quantity:d}=this.getVIDAndQuantity(c);return{id:u?+u:+c.mID,quantity:d,properties:e.getPrivateAttributesForLineItem()}}),n=Ne.getCartURL("cart/add.js"),i={items:r},s=Ve.get();s.isMiniCart()?i.sections=["mini-cart"]:s.isShopifyDefaultDrawer()&&(i.sections=s.element.getSectionsToRender?.().map(c=>c.section??c.id));let o=JSON.stringify(i);try{let c=await fetch(n,{body:o,method:"post",headers:{"Content-Type":"application/json"}});if(c.status===200||c.status===302)return b.log(`Added ${t.length} items to Cart`),ne.showSnackbar("Product added to your cart"),c.json()}catch(c){b.error("Failed to add product in cart",c)}}async performUpdate(t,e){if(!Ht.hasKeys(e)){b.warn("No update fields provided");return}let r=Ne.getCartURL("cart/change.js"),n=w({id:+t.vID},e),i=JSON.stringify(n);try{let s=await fetch(r,{body:i,method:"post",headers:{"Content-Type":"application/json"}});(s.status===200||s.status===302)&&(b.log(`Updated ${t}`),me.getCurrent().update(s.json()))}catch(s){b.error("Failed to update item in cart",s,t)}}async performCopyCoupon(t){if(t)try{await navigator.clipboard.writeText(t),b.log(`Code-${t} copied`),ne.showSnackbar("Discount code copied")}catch(e){b.error("Failed to copy code",e)}}performGoToItem(t){if(!t?.link)return;let e=Ne.getProductSlug(t.link);e&&(location.pathname=Ne.getRootPrefix()+"products/"+e)}async upgradeToSubscription(t,e){if(!t){b.warn("Trying to upgrade to subscription with no item");return}let r=await me.getCurrent().getNormalisedCart(),n=t.selectedOrFirstVariant.value,i=r.items.findIndex(d=>d.vID===n.mID),s=n.selectedSellingPlan.value,o=Ne.getCartURL("cart/change.js"),c={line:i+1,selling_plan:s?.mID||null,properties:e.getPrivateAttributesForLineItem()},u=JSON.stringify(c);try{let d=await fetch(o,{body:u,method:"post",headers:{"Content-Type":"application/json"}});if(d.status===200||d.status===302){b.log(`Upgraded ${t} selling plan`),ne.showSnackbar("Line item updated");let m=await d.json();return me.getCurrent().update(m),m}}catch(d){b.error("Failed to update subscription for item in cart",d)}}async performCartCreate(t,e,r){let n=Oe.get().storefrontToken;if(!n)throw new Error("Storefront token not set for the store");if(!t?.vID){b.error("No variant ID found to perform Buy now",t);return}let i=e?[e]:[],s=[{merchandiseId:`gid://shopify/ProductVariant/${t.vID}`,quantity:1,attributes:r.getKVFormatPrivateAttributesForLineItem()}],o=await ne.getCartAttributes(),c=new Headers;c.append("Content-Type","application/json"),c.append("X-Shopify-Storefront-Access-Token",n);let u=JSON.stringify({query:Z_,variables:{input:{lines:s,discountCodes:i,attributes:o}}});return(await mt.getInstance().request(N.GRAPHQL_API_PATH,{method:"POST",headers:c,body:u})).data?.cartCreate?.cart?.checkoutUrl}async processEvent(t){let e=t?.detail;if(!e)return;let r=e.clickAction,n=e.items,i=e.triggerData;if(r.at){let s=r;if(b.log(`Performing ${JSON.stringify(s)} action`),s.at===101)n?.length&&this.performGoToItem(n[0]);else if(s.at===102)n?.length&&await this.performAddToCart(n,i);else if(s.at===103)await this.performCopyCoupon(i.discount.code);else if(s.at===105)Ve.get().open();else if(s.at===104){let o=e.collections;if(!o?.length)return;location.pathname=Ne.getRootPrefix()+"collections/"+o[0].handle}}r.applyDiscount&&i.discount?.code&&Xr.navigate(i.discount.code,i.redirectBehaviour)}getVIDAndQuantity(t){let e,r;if(t instanceof lt)e=t.vID,r=t.quantity??1;else{if(!t.vars?.length)return{};e=t.selectedOrFirstVariant.value.mID,r=1}return{vID:e,quantity:r}}},Li=class{constructor(t,e){this.triggerContext=t,this.element=e}safeHTTP=pe.getInstance();async execute(t){let e=t.clickAction||this.element?.clc;if(!e)return;let r=t.item,n=this.triggerContext,i=new Qr,s=n.triggerData.redirectBehaviour,o=!!n.triggerData.discount.type&&!!e?.applyDiscount,c={selectedVariants:n.triggerData.nonMutableItems.map(g=>({itemMID:g.mID,mID:g.selectedOrFirstVariant.value.mID})),eID:n.triggerData.engagementID,cID:n.triggerData.contentID},u="",d=[],m=r?[r.toEmbed()]:[];if(e.at===108){let g=n.selectedItems;if(m=t.embeddedItems??g.map(y=>y.toEmbed()),n.shouldGiveFBTDiscount||t.embeddedItems?.length){let y;t.embeddedItems?y=t.embeddedItems.map(O=>({itemMID:O.mID,mID:O.vID,quantity:O.quantity})):y=g.map(O=>({itemMID:O.mID,mID:O.selectedOrFirstVariant.value.mID}));let C=n.triggerData.bundleFrom;n.triggerData.isBundleOnCartDrawer()&&C&&y.push({itemMID:C.mID,mID:C.selectedOrFirstVariant.value.mID}),c.selectedVariants=y}else c=void 0;d=t.embeddedItems??g}else if(e.at===107){let g=await me.getCurrent().getNormalisedCart();m=g.items,c.selectedVariants=g.items.map(y=>({itemMID:y.mID,mID:y.vID}))}else if(e.at===102)d=[r];else if(e.at===101)u=Ne.getRootPrefix()+"products/"+r.slug;else if(e.at===4){let g=ne.isValidURL(e.gu?.u);g&&(u=g.pathname+g.search+g.hash)}else if(e.at===109){let g=await i.upgradeToSubscription(r,n.triggerData);this.triggerContext.triggerData.skipSubscribedItems&&this.triggerContext.renderer.destroy(),Ve.get().refreshUI(g)}if(this.sendTriggerClicked(m,{from:"button"}),b.debug({redirectPath:u,redirectBehaviour:s,hasDiscount:o}),!o&&u){location.href=u;return}let h,v=!1;try{h=await this.getOrGenerateDiscountCode(c),b.debug("Discount code (if any) to apply",h)}catch(g){if(!this.triggerContext.triggerData.isBYOB()){vd.default.error("Unable to get a discount code",g);return}}if(h&&e.at===103)await i.performCopyCoupon(h);else if(e.at===110){let g=le.get().getCurrentItem(),y=await i.performCartCreate(g,h,n.triggerData);y&&(location.href=y);return}try{h&&await Xr.applyWithStorefront(h)}catch(g){b.error(g),v=!0}let _;if(d?.length&&(_=await i.performAddToCart(d,n.triggerData)),v&&h){Xr.navigate(h,s,u);return}if(u){location.href=u;return}Xr.navigateWithoutDiscount(s,_)}sendTriggerClicked(t,e){let r=N.EVENT_TRIGGER_CLICKED,n=new ve(r,e,this.triggerContext.triggerData);n.items=t,this.safeHTTP.sendEvent(n)}async getOrGenerateDiscountCode(t){let e=this.triggerContext.triggerData.discount;if(!e?.type)return;let r="";if(e.type===pr.STATIC){if(!e.code)throw Pe.getInstance().captureMessage("No discount code found","warning",{triggerContext:this.triggerContext}),new Error("No discount code found");return e.code}if(t){if(r=await this.generateDiscount(t),!r)throw b.error("No discount code found",t),new Error("Discount code not found or generated");return r}}async generateDiscount(t){try{return(await this.safeHTTP.generateDiscount(t))?.code}catch(e){throw ne.showSnackbar("Failed to generate a discount code"),b.error("Error generating discount code",e,t),Pe.getInstance().captureMessage("Failed to generate discount code","error",{discountData:JSON.stringify(t),triggerContext:this.triggerContext,error:e}),e}}},Te=class extends fr{stylesConverter=new Ai(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(),w(w(Z(w(w(w(w(w(w({},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(t){if(!t?.op)return!0;let{lhs:e,rhs:r}=t;switch(t.op){case"eq":return e===r;case"gt":return+e>+r;case"gte":return+e>=+r;case"lt":return+e<+r;case"lte":return+e<=+r;case"ne":return e!==r;case"null":return e==null;case"empty":return e.trim()==="";default:return b.error(`Invalid operator found for when condition - ${t.op}`),!1}}putStyleAccordingToDevice(){let t=this.props.element;this.mediaStyle=t.style.lg,this.renderer.isMobile()&&t.style.sm&&Object.keys(t.style.sm).length&&(this.mediaStyle=w(w({},this.mediaStyle),t.style.sm))}sendTriggerClicked(t,e){this.clickExecutor.sendTriggerClicked(t,e)}async onClick(t){await this.clickExecutor.execute(t)}},eE=0,JF=Array.isArray;function k(t,e,r,n,i,s){e||(e={});var o,c,u=e;if("ref"in u)for(c in u={},e)c=="ref"?o=e[c]:u[c]=e[c];var d={type:t,props:u,key:r,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--eE,__i:-1,__u:0,__source:i,__self:s};if(typeof t=="function"&&(o=t.defaultProps))for(c in o)u[c]===void 0&&(u[c]=o[c]);return _e.vnode&&_e.vnode(d),d}var It=class extends Te{componentDidMount(){this.setState(()=>({text:this.props.element.text})),ot(this.onChange.bind(this))}componentWillReceiveProps(t){this.props.element=t.element,this.onChange()}render(){let t=this.getCompiledStyles(),e=this.state.text;return e||(t.display="none",e=""),k("div",{style:t,onClick:this.customOnClick.bind(this),className:"lc-text",children:k("span",{style:this.getSpanStyle(),dangerouslySetInnerHTML:{__html:e}})})}customOnClick(){this.props.onClick&&this.props.onClick("title")}onChange(){if(this.props.element.text==null)return;let t=this.props.triggerContext.triggerData,e={bundle:t.discountData.value,customer:t.customerData},r=vt.render(JSON.stringify(this.props.element),e),n=new qe(JSON.parse(r));if(!this.matchWhenCondition(n.when)){this.setState(()=>({text:""}));return}this.setState(()=>({text:n.text}))}getTypoStyles(){let t={},e=this.mediaStyle.typo??new st;return t.letterSpacing=e.letterSpacing,t.fontSize=e.fs+"px",t.lineHeight=e.lh,t.fontFamily=e.fam.name||"inherit",t.textAlign=e.alignment,t.fontWeight=e.fw,t.textDecoration=e.td??"none",this.stylesConverter.getColourStyles(e.tc,"color",t),t}getComponentStyles(){return w({},this.getTypoStyles())}getSpanStyle(){return{overflow:"hidden",display:"-webkit-box",webkitBoxOrient:"vertical",webkitLineClamp:2,color:"inherit",fontSize:"inherit",fontWeight:"inherit",fontFamily:"inherit"}}},Ln=class extends It{render(){return k("div",{style:this.getCompiledStyles(),className:"lc-button",onClick:()=>this.onClick({item:this.props.item}),children:k("span",{style:this.getSpanStyle(),dangerouslySetInnerHTML:{__html:this.state.text}})})}getComponentStyles(){return Z(w({},super.getComponentStyles()),{cursor:"pointer"})}},qu=class extends fr{render(){if(this.props.element.show[this.props.label.toLowerCase()])return this.props.element.lblPos==="end"?k("div",{style:w(w({},this.getElementStyle()),this.props.styles),children:[k("span",{children:this.props.time}),k("span",{style:this.getTimeLabelStyle(),children:this.props.label})]}):k("div",{style:w(w({},this.getElementStyle()),this.props.styles),children:[k("span",{style:this.getTimeLabelStyle(),children:this.props.label}),k("span",{children:this.props.time})]})}getDesign(){}getTimeLabelStyle(){return{fontSize:"0.5em",alignContent:"center"}}getElementStyle(){let t={display:"flex",flexDirection:"column",placeContent:"center center",textAlign:"center"};return this.props.element.horizontal&&(t.gridTemplateColumns="repeat(2, minmax(0, 1fr))"),t}},Uo=class extends It{labels={Days:"00",Hours:"00",Minutes:"00",Seconds:"00"};componentWillMount(){super.componentWillMount(),this.setState(()=>w({},this.labels)),this.processAndStartTimer()}render(){return k("div",{style:this.getLabelsParentStyle(),children:Object.keys(this.labels).map(t=>k(qu,{styles:this.getCompiledStyles(),label:t,time:this.state[t],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 w(w({},super.getComponentStyles()),this.getDisplayStyles())}processAndStartTimer(){this.props.element.timer.start(this.props.element.timerType,t=>{this.labels.Days=String(t.days).padStart(2,"0"),this.labels.Hours=String(t.hours).padStart(2,"0"),this.labels.Minutes=String(t.minutes).padStart(2,"0"),this.labels.Seconds=String(t.seconds).padStart(2,"0"),this.setState(()=>w({},this.labels))})}},ko=class extends Te{componentDidMount(){ot(()=>{this.setState(()=>({checked:this.props.item.selected.value}))})}render(){return k("div",{style:this.getCompiledStyles(),className:"lc-checkbox",children:k("input",{type:"checkbox",checked:this.state.checked,onChange:this.onChange.bind(this),style:{appearance:"auto"}})})}onChange(t){let{checked:e}=t.target;this.props.item.selected.value=e}getTypoStyles(){let t={},e=this.mediaStyle.typo??new st;return t.textAlign=e.alignment,t.justifyContent=e.alignment,t}getComponentStyles(){return Z(w({},this.getTypoStyles()),{display:"flex"})}},Mr=class extends Te{constructor(t,e){super(t,e)}render(){let t=this.props.element[this.deviceTypeKey],e=t?.src||this.props.element.src||this.props.element.lg?.src;return k("img",{onClick:this.customOnClick.bind(this),className:"lc-image",alt:t?.name||"Image",onMouseEnter:this.handleMouseEnter.bind(this),onMouseLeave:this.handleMouseLeave.bind(this),src:e,style:this.getCompiledStyles()})}customOnClick(){this.props.onClick&&this.props.onClick("image")}getComponentStyles(){let t=this.mediaStyle.lout;if(!t||t.pos!=="absolute")return{};let e={zIndex:t.zIndex};return this.mediaStyle.size?.w&&(e.width=this.mediaStyle.size.w),this.mediaStyle.size?.h&&(e.height=this.mediaStyle.size.h),e}handleMouseEnter(t){let e=this.props.element[this.deviceTypeKey]?.secondarySrc;e&&(t.currentTarget.src=e)}handleMouseLeave(t){t.currentTarget.src=this.props.element[this.deviceTypeKey]?.src}},Fr=class extends Te{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return k("div",{style:this.getCompiledStyles(),class:"lc-flexbox",children:k(Zr,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})})}getComponentStyles(){let t=this.mediaStyle.flex??new mi,e={display:"flex",gap:t.gap+"px",flexWrap:t.wrap,flexDirection:t.dir,justifyContent:t.jc,alignItems:t.ai};return t.wrap==="nowrap"&&t.scroll&&(t.dir==="column"?e["overflow-y"]="auto":e["overflow-x"]="auto"),e}},Mo=class extends Fr{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return k("div",{style:this.getCompiledStyles(),class:"lc-flexbox",children:k(Bi,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext,item:this.props.item,noLinks:this.props.noLinks})})}},Fo=class extends Te{render(){return k("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(){ot(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:!1}))})}getTypoStyles(){let t={},e=this.mediaStyle.typo??new st;return t.letterSpacing=e.letterSpacing,t.fontSize=e.fs+"px",t.lineHeight=e.lh,t.fontFamily="inherit",t.textAlign=e.alignment,t.fontWeight=e.fw,this.stylesConverter.getColourStyles(e.tc,"color",t),t.boxShadow="none",t}getComponentStyles(){let t={};return this.props.selectedVariant.sellingPlans?.length||(t.visibility="hidden"),w(w({},t),this.getTypoStyles())}createSelectItems(){let t=[],e=this.props.selectedVariant;if(!e.sellingPlans?.length)return[];this.props.triggerContext.triggerData.skipSubscribedItems?e.selectedSellingPlan.value||(e.sellingPlans[0].isSelected=!0,e.changeSellingPlan(e.sellingPlans[0])):t.push(k("option",{value:"",selected:!e.selectedSellingPlan,children:"One time purchase"}));for(let r of e.sellingPlans??[])t.push(k("option",{value:r.mID,selected:r.isSelected,children:r.name}));return t}onChange(t){let e=t.target.value;e?this.props.selectedVariant.selectedSellingPlan.value=this.props.selectedVariant.sellingPlans.find(r=>r.mID===e):this.props.selectedVariant.selectedSellingPlan.value=void 0}},Ho=class extends Te{colorRegex=new RegExp('fill="#[a-zA-Z0-9]+"');constructor(){super(),vt.escape=Ko.escapeHtml}render(){let t=this.getCompiledStyles(),e=this.getRating();return e||(t.display="none",e=""),k("div",{style:t,className:"lc-star-rating",dangerouslySetInnerHTML:{__html:e}})}getRating(){let t=this.props.element.fullStar,e=this.props.element.halfStart,r={size:this.props.element.iconSize,color:this.props.element.c.hex};t=vt.render(t,{svg:r}),e=vt.render(e,{svg:r});let n=this.props.review;if(!n?.rating)return"";let i="";if(this.props.element.showSingleStar)i=t;else{let s=5,o=`${n.rating}`.split(".");for(let c=0;c<+o[0];c++)i+=t,s--;o[1]&&(i+=e,s--);for(let c=0;c<s;c++)i+=t.replace(this.colorRegex,'fill="#f1f1f1')}return i}getComponentStyles(){return{display:"flex",alignItems:"center"}}},$o=class extends Te{render(){return k("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(){ot(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:!1}))})}getTypoStyles(){let t={},e=this.mediaStyle.typo??new st;return t.letterSpacing=e.letterSpacing,t.fontSize=e.fs+"px",t.lineHeight=e.lh,t.fontFamily="inherit",t.textAlign=e.alignment,t.fontWeight=e.fw,this.stylesConverter.getColourStyles(e.tc,"color",t),t.boxShadow="none",t}getComponentStyles(){let t={};return this.props.item.vars?.length===1&&this.props.item.vars[0].name==="Default Title"&&(t.visibility="hidden"),w(w({},t),this.getTypoStyles())}createSelectItems(){let t=[];for(let e of this.props.item.vars)t.push(k("option",{value:e.mID,disabled:!e.isAvailable,children:e.name}));return t}onChange(t){let e=t.target.value;this.props.item.selectedOrFirstVariant.value=this.props.item.vars.find(r=>r.mID===e)}},Bi=class extends Te{constructor(t,e){super(t,e),this.setState(()=>({decoration:"unset"}))}renderElement(t){if(!(t.hide||!this.matchWhenCondition(t.when))){if(t.t===4){let e=t;return k(Mo,{element:e,triggerContext:this.props.triggerContext,elements:e.elems,item:this.props.item,noLinks:this.props.noLinks})}if(t.t===6)return this.props.triggerContext.triggerData.isBundle()?k(ko,{element:t,item:this.props.item,triggerContext:this.props.triggerContext}):void 0;if(t.t===13){let e=t,r=this.props.item,n=r.variantImage??r.imageURL,i=r.variantSecondaryImage??r.secondaryImageURL;e.lg=e.sm={src:n,name:r.name,secondarySrc:i};let s=k(Mr,{element:e,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?s:k("a",{href:this.props.item.selectedOrFirstVariant.value.link,style:{display:"block"},children:s})}if(t.t===14)return this.renderProductTitle(t);if(t.t===15){let e=t;return this.props.triggerContext.triggerData.isCartEmbed()&&this.props.item.vars?.length===1&&this.props.item.vars[0].name==="Default Title"?void 0:k($o,{element:e,item:this.props.item,triggerContext:this.props.triggerContext})}return t.t===16?k(Fo,{element:t,selectedVariant:this.props.item.selectedOrFirstVariant.value,item:this.props.item,triggerContext:this.props.triggerContext}):t.t===19?k(Ho,{element:t,triggerContext:this.props.triggerContext,review:this.props.item.reviews}):t.t===18||t.t===3?k(Ln,{element:t,item:this.props.item,triggerContext:this.props.triggerContext}):k(Zr,{elements:[t],element:this.props.element,triggerContext:this.props.triggerContext})}}render(){return this.props.elements.map(t=>this.renderElement(t))}getComponentStyles(){return{}}renderProductTitle(t){let e=k(It,{element:t,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?e:k("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:e})}customOnClick(t){this.sendTriggerClicked([this.props.item.toEmbed()],{from:t})}onMouseEnter(){this.setState(()=>({decoration:"underline"}))}onMouseLeave(){this.setState(()=>({decoration:"unset"}))}},Hr=class extends Te{productElement;constructor(t,e){super(t,e),this.setState(()=>({decoration:"unset"}))}render(){let t=JSON.stringify(this.props.element),e=vt.render(t,this.getProductData());if(this.productElement=new Ir(JSON.parse(e)),!(this.productElement.hide||!this.matchWhenCondition(this.productElement.when)))return k("div",{style:w({},this.getCompiledStyles()),class:"lc-single-product",children:k(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 t=this.props.item.selectedOrFirstVariant.value,e=t.price,r=this.props.item.name,n=this.props.item.category,i=ne.formatCurrency(e.d,!0),s=this.props.item.variantImage??this.props.item.imageURL,o=this.props.item.meta,c=this.props.item.reviews?.rating,u=this.props.item.reviews?.totalReviews,d=e.cmp&&e.cmp>e.d,m=this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(this.props.item.quantity):this.props.item.quantity,h=ne.formatCurrency(t.effectivePrice.value),v={name:r,price:i,quantity:m,image_url:s,meta:o,effective_price:h,category:n,rating:c,reviews:u};if(d){v.compare_price=ne.formatCurrency(e.cmp);let g=e.cmp-e.d;v.discount_percent=(g/e.cmp*100).toFixed(0),v.discount_price=ne.formatCurrency(g)}let _={name:t.name,quantity:this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(t.quantity):t.quantity};return{product:v,variant:_,svg:{color:()=>"{{svg.color}}",size:()=>"{{svg.size}}"}}}};function ic(){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 oc(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)=>`
|
|
63
|
+
`,en=class{listen(){document.addEventListener(N.CTA_EVENT,async e=>{await this.processEvent(e)},!1)}async performAddToCart(e,t){if(!e.length)return;let r=e.map(c=>{let{vID:u,quantity:p}=this.getVIDAndQuantity(c);return{id:u?+u:+c.mID,quantity:p,properties:t.getPrivateAttributesForLineItem()}}),n=Pe.getCartURL("cart/add.js"),i={items:r},s=ze.get();s.isMiniCart()?i.sections=["mini-cart"]:s.isShopifyDefaultDrawer()&&(i.sections=s.element.getSectionsToRender?.().map(c=>c.section??c.id));let o=JSON.stringify(i);try{let c=await fetch(n,{body:o,method:"post",headers:{"Content-Type":"application/json"}});if(c.status===200||c.status===302)return b.log(`Added ${e.length} items to Cart`),re.showSnackbar("Product added to your cart"),c.json()}catch(c){b.error("Failed to add product in cart",c)}}async performUpdate(e,t){if(!ah.JSUtils.hasKeys(t)){b.warn("No update fields provided");return}let r=Pe.getCartURL("cart/change.js"),n=w({id:+e.vID},t),i=JSON.stringify(n);try{let s=await fetch(r,{body:i,method:"post",headers:{"Content-Type":"application/json"}});(s.status===200||s.status===302)&&(b.log(`Updated ${e}`),de.getCurrent().update(s.json()))}catch(s){b.error("Failed to update item in cart",s,e)}}async performCopyCoupon(e){if(e)try{await navigator.clipboard.writeText(e),b.log(`Code-${e} copied`),re.showSnackbar("Discount code copied")}catch(t){b.error("Failed to copy code",t)}}performGoToItem(e){if(!e?.link)return;let t=Pe.getProductSlug(e.link);t&&(location.pathname=Pe.getRootPrefix()+"products/"+t)}async upgradeToSubscription(e,t){if(!e){b.warn("Trying to upgrade to subscription with no item");return}let r=await de.getCurrent().getNormalisedCart(),n=e.selectedOrFirstVariant.value,i=r.items.findIndex(p=>p.vID===n.mID),s=n.selectedSellingPlan.value,o=Pe.getCartURL("cart/change.js"),c={line:i+1,selling_plan:s?.mID||null,properties:t.getPrivateAttributesForLineItem()},u=JSON.stringify(c);try{let p=await fetch(o,{body:u,method:"post",headers:{"Content-Type":"application/json"}});if(p.status===200||p.status===302){b.log(`Upgraded ${e} selling plan`),re.showSnackbar("Line item updated");let m=await p.json();return de.getCurrent().update(m),m}}catch(p){b.error("Failed to update subscription for item in cart",p)}}async performCartCreate(e,t,r){let n=Le.get().storefrontToken;if(!n)throw new Error("Storefront token not set for the store");if(!e?.vID){b.error("No variant ID found to perform Buy now",e);return}let i=t?[t]:[],s=[{merchandiseId:`gid://shopify/ProductVariant/${e.vID}`,quantity:1,attributes:r.getKVFormatPrivateAttributesForLineItem()}],o=await re.getCartAttributes(),c=new Headers;c.append("Content-Type","application/json"),c.append("X-Shopify-Storefront-Access-Token",n);let u=JSON.stringify({query:QE,variables:{input:{lines:s,discountCodes:i,attributes:o}}});return(await ht.getInstance().request(N.GRAPHQL_API_PATH,{method:"POST",headers:c,body:u})).data?.cartCreate?.cart?.checkoutUrl}async processEvent(e){let t=e?.detail;if(!t)return;let r=t.clickAction,n=t.items,i=t.triggerData;if(r.at){let s=r;if(b.log(`Performing ${JSON.stringify(s)} action`),s.at===101)n?.length&&this.performGoToItem(n[0]);else if(s.at===102)n?.length&&await this.performAddToCart(n,i);else if(s.at===103)await this.performCopyCoupon(i.discount.code);else if(s.at===105)ze.get().open();else if(s.at===104){let o=t.collections;if(!o?.length)return;location.pathname=Pe.getRootPrefix()+"collections/"+o[0].handle}}r.applyDiscount&&i.discount?.code&&Zr.navigate(i.discount.code,i.redirectBehaviour)}getVIDAndQuantity(e){let t,r;if(e instanceof pt)t=e.vID,r=e.quantity??1;else{if(!e.vars?.length)return{};t=e.selectedOrFirstVariant.value.mID,r=1}return{vID:t,quantity:r}}},ki=class{constructor(e,t){this.triggerContext=e,this.element=t}safeHTTP=fe.getInstance();async execute(e){let t=le.get().getCurrentItem(),r=e.clickAction||this.element?.clc;if(!r)return;let n=e.item,i=this.triggerContext,s=new en,o=i.triggerData.redirectBehaviour,c=!!i.triggerData.discount.type&&!!r?.applyDiscount,u={selectedVariants:i.triggerData.nonMutableItems.map(_=>({itemMID:_.mID,mID:_.selectedOrFirstVariant.value.mID})),eID:i.triggerData.engagementID,cID:i.triggerData.contentID},p="",m=[],h=n?[n.toEmbed()]:[];if(r.at===108){let _=i.selectedItems;if(h=e.embeddedItems??_.map(x=>x.toEmbed()),i.shouldGiveFBTDiscount||e.embeddedItems?.length){let x;e.embeddedItems?x=e.embeddedItems.map(B=>({itemMID:B.mID,mID:B.vID,quantity:B.quantity})):x=_.map(B=>({itemMID:B.mID,mID:B.selectedOrFirstVariant.value.mID}));let P=i.triggerData.bundleFrom;i.triggerData.isBundleOnCartDrawer()&&P&&x.push({itemMID:P.mID,mID:P.selectedOrFirstVariant.value.mID,isPrimary:!0}),u.selectedVariants=x,i.triggerData.isBundleOnPDP()&&u.selectedVariants.forEach(B=>{B.mID===t.vID&&(B.isPrimary=!0)})}else u=void 0;m=e.embeddedItems??_}else if(r.at===107){let _=await de.getCurrent().getNormalisedCart();h=_.items,u.selectedVariants=_.items.map(x=>({itemMID:x.mID,mID:x.vID}))}else if(r.at===102)m=[n];else if(r.at===101)p=Pe.getRootPrefix()+"products/"+n.slug;else if(r.at===4){let _=re.isValidURL(r.gu?.u);_&&(p=_.pathname+_.search+_.hash)}else if(r.at===109){let _=await s.upgradeToSubscription(n,i.triggerData);this.triggerContext.triggerData.skipSubscribedItems&&this.triggerContext.renderer.destroy(),ze.get().refreshUI(_)}if(this.sendTriggerClicked(h,{from:"button"}),b.debug({redirectPath:p,redirectBehaviour:o,hasDiscount:c}),!c&&p){location.href=p;return}let y,E=!1;try{y=await this.getOrGenerateDiscountCode(u),b.debug("Discount code (if any) to apply",y)}catch(_){if(!this.triggerContext.triggerData.isBYOB()){lh.default.error("Unable to get a discount code",_);return}}if(y&&r.at===103)await s.performCopyCoupon(y);else if(r.at===110){let _=await s.performCartCreate(t,y,i.triggerData);_&&(location.href=_);return}try{y&&await Zr.applyWithStorefront(y)}catch(_){b.error(_),E=!0}let v;if(m?.length&&(v=await s.performAddToCart(m,i.triggerData)),E&&y){Zr.navigate(y,o,p);return}if(p){location.href=p;return}Zr.navigateWithoutDiscount(o,v)}sendTriggerClicked(e,t){let r=N.EVENT_TRIGGER_CLICKED,n=new _e(r,t,this.triggerContext.triggerData);n.items=e,this.safeHTTP.sendEvent(n)}async getOrGenerateDiscountCode(e){let t=this.triggerContext.triggerData.discount;if(!t?.type)return;let r="";if(t.type===ch.DiscountType.STATIC){if(!t.code)throw Be.getInstance().captureMessage("No discount code found","warning",{triggerContext:this.triggerContext}),new Error("No discount code found");return t.code}if(e){if(r=await this.generateDiscount(e),!r)throw b.error("No discount code found",e),new Error("Discount code not found or generated");return r}}async generateDiscount(e){try{return(await this.safeHTTP.generateDiscount(e))?.code}catch(t){throw re.showSnackbar("Failed to generate a discount code"),b.error("Error generating discount code",t,e),Be.getInstance().captureMessage("Failed to generate discount code","error",{discountData:JSON.stringify(e),triggerContext:this.triggerContext,error:t}),t}}},xe=class extends pr{stylesConverter=new Pi(1);renderer=Lt.get();mediaStyle={};deviceTypeKey;clickExecutor;componentWillMount(){this.deviceTypeKey=this.renderer.isMobile()?"sm":"lg",this.clickExecutor=new ki(this.props.triggerContext,this.props.element)}getCompiledStyles(){return this.putStyleAccordingToDevice(),w(w(ee(w(w(w(w(w(w({},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:t,rhs:r}=e;switch(e.op){case"eq":return t===r;case"gt":return+t>+r;case"gte":return+t>=+r;case"lt":return+t<+r;case"lte":return+t<=+r;case"ne":return t!==r;case"null":return t==null;case"empty":return t.trim()==="";default:return b.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=w(w({},this.mediaStyle),e.style.sm))}sendTriggerClicked(e,t){this.clickExecutor.sendTriggerClicked(e,t)}async onClick(e){await this.clickExecutor.execute(e)}},ZE=0,M2=Array.isArray;function k(e,t,r,n,i,s){t||(t={});var o,c,u=t;if("ref"in u)for(c in u={},t)c=="ref"?o=t[c]:u[c]=t[c];var p={type:e,props:u,key:r,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--ZE,__i:-1,__u:0,__source:i,__self:s};if(typeof e=="function"&&(o=e.defaultProps))for(c in o)u[c]===void 0&&(u[c]=o[c]);return Ee.vnode&&Ee.vnode(p),p}var xt=class extends xe{componentDidMount(){this.setState(()=>({text:this.props.element.text})),at(this.onChange.bind(this))}componentWillReceiveProps(e){this.props.element=e.element,this.onChange()}render(){let e=this.getCompiledStyles(),t=this.state.text;return t||(e.display="none",t=""),k("div",{style:e,onClick:this.customOnClick.bind(this),className:"lc-text",children:k("span",{style:this.getSpanStyle(),dangerouslySetInnerHTML:{__html:t}})})}customOnClick(){this.props.onClick&&this.props.onClick("title")}onChange(){if(this.props.element.text==null)return;let e=this.props.triggerContext.triggerData,t={bundle:e.discountData.value,customer:e.customerData},r=Et.render(JSON.stringify(this.props.element),t),n=new Xe(JSON.parse(r));if(!this.matchWhenCondition(n.when)){this.setState(()=>({text:""}));return}this.setState(()=>({text:n.text}))}getTypoStyles(){let e={},t=this.mediaStyle.typo??new ct;return e.letterSpacing=t.letterSpacing,e.fontSize=t.fs+"px",e.lineHeight=t.lh,e.fontFamily=t.fam.name||"inherit",e.textAlign=t.alignment,e.fontWeight=t.fw,e.textDecoration=t.td??"none",this.stylesConverter.getColourStyles(t.tc,"color",e),e}getComponentStyles(){return w({},this.getTypoStyles())}getSpanStyle(){return{overflow:"hidden",display:"-webkit-box",webkitBoxOrient:"vertical",webkitLineClamp:2,color:"inherit",fontSize:"inherit",fontWeight:"inherit",fontFamily:"inherit"}}},Un=class extends xt{render(){return k("div",{style:this.getCompiledStyles(),className:"lc-button",onClick:()=>this.onClick({item:this.props.item}),children:k("span",{style:this.getSpanStyle(),dangerouslySetInnerHTML:{__html:this.state.text}})})}getComponentStyles(){return ee(w({},super.getComponentStyles()),{cursor:"pointer"})}},ep=class extends pr{render(){if(this.props.element.show[this.props.label.toLowerCase()])return this.props.element.lblPos==="end"?k("div",{style:w(w({},this.getElementStyle()),this.props.styles),children:[k("span",{children:this.props.time}),k("span",{style:this.getTimeLabelStyle(),children:this.props.label})]}):k("div",{style:w(w({},this.getElementStyle()),this.props.styles),children:[k("span",{style:this.getTimeLabelStyle(),children:this.props.label}),k("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}},Bo=class extends xt{labels={Days:"00",Hours:"00",Minutes:"00",Seconds:"00"};componentWillMount(){super.componentWillMount(),this.setState(()=>w({},this.labels)),this.processAndStartTimer()}render(){return k("div",{style:this.getLabelsParentStyle(),children:Object.keys(this.labels).map(e=>k(ep,{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 w(w({},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(()=>w({},this.labels))})}},Uo=class extends xe{componentDidMount(){at(()=>{this.setState(()=>({checked:this.props.item.selected.value}))})}render(){return k("div",{style:this.getCompiledStyles(),className:"lc-checkbox",children:k("input",{type:"checkbox",checked:this.state.checked,onChange:this.onChange.bind(this),style:{appearance:"auto"}})})}onChange(e){let{checked:t}=e.target;this.props.item.selected.value=t}getTypoStyles(){let e={},t=this.mediaStyle.typo??new ct;return e.textAlign=t.alignment,e.justifyContent=t.alignment,e}getComponentStyles(){return ee(w({},this.getTypoStyles()),{display:"flex"})}},Mr=class extends xe{constructor(e,t){super(e,t)}render(){let e=this.props.element[this.deviceTypeKey],t=e?.src||this.props.element.src||this.props.element.lg?.src;return k("img",{onClick:this.customOnClick.bind(this),className:"lc-image",alt:e?.name||"Image",onMouseEnter:this.handleMouseEnter.bind(this),onMouseLeave:this.handleMouseLeave.bind(this),src:t,style:this.getCompiledStyles()})}customOnClick(){this.props.onClick&&this.props.onClick("image")}getComponentStyles(){let e=this.mediaStyle.lout;if(!e||e.pos!=="absolute")return{};let t={zIndex:e.zIndex};return this.mediaStyle.size?.w&&(t.width=this.mediaStyle.size.w),this.mediaStyle.size?.h&&(t.height=this.mediaStyle.size.h),t}handleMouseEnter(e){let t=this.props.element[this.deviceTypeKey]?.secondarySrc;t&&(e.currentTarget.src=t)}handleMouseLeave(e){e.currentTarget.src=this.props.element[this.deviceTypeKey]?.src}},Fr=class extends xe{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return k("div",{style:this.getCompiledStyles(),class:"lc-flexbox",children:k(tn,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})})}getComponentStyles(){let e=this.mediaStyle.flex??new gi,t={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"?t["overflow-y"]="auto":t["overflow-x"]="auto"),t}},ko=class extends Fr{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return k("div",{style:this.getCompiledStyles(),class:"lc-flexbox",children:k(Mi,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext,item:this.props.item,noLinks:this.props.noLinks})})}},Mo=class extends xe{render(){return k("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(){at(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:!1}))})}getTypoStyles(){let e={},t=this.mediaStyle.typo??new ct;return e.letterSpacing=t.letterSpacing,e.fontSize=t.fs+"px",e.lineHeight=t.lh,e.fontFamily="inherit",e.textAlign=t.alignment,e.fontWeight=t.fw,this.stylesConverter.getColourStyles(t.tc,"color",e),e.boxShadow="none",e}getComponentStyles(){let e={};return this.props.selectedVariant.sellingPlans?.length||(e.visibility="hidden"),w(w({},e),this.getTypoStyles())}createSelectItems(){let e=[],t=this.props.selectedVariant;if(!t.sellingPlans?.length)return[];this.props.triggerContext.triggerData.skipSubscribedItems?t.selectedSellingPlan.value||(t.sellingPlans[0].isSelected=!0,t.changeSellingPlan(t.sellingPlans[0])):e.push(k("option",{value:"",selected:!t.selectedSellingPlan,children:"One time purchase"}));for(let r of t.sellingPlans??[])e.push(k("option",{value:r.mID,selected:r.isSelected,children:r.name}));return e}onChange(e){let t=e.target.value;t?this.props.selectedVariant.selectedSellingPlan.value=this.props.selectedVariant.sellingPlans.find(r=>r.mID===t):this.props.selectedVariant.selectedSellingPlan.value=void 0}},uh=Ce(Nc()),Fo=class extends xe{colorRegex=new RegExp('fill="#[a-zA-Z0-9]+"');constructor(){super(),Et.escape=uh.MustacheUtils.escapeHtml}render(){let e=this.getCompiledStyles(),t=this.getRating();return t||(e.display="none",t=""),k("div",{style:e,className:"lc-star-rating",dangerouslySetInnerHTML:{__html:t}})}getRating(){let e=this.props.element.fullStar,t=this.props.element.halfStart,r={size:this.props.element.iconSize,color:this.props.element.c.hex};e=Et.render(e,{svg:r}),t=Et.render(t,{svg:r});let n=this.props.review;if(!n?.rating)return"";let i="";if(this.props.element.showSingleStar)i=e;else{let s=5,o=`${n.rating}`.split(".");for(let c=0;c<+o[0];c++)i+=e,s--;o[1]&&(i+=t,s--);for(let c=0;c<s;c++)i+=e.replace(this.colorRegex,'fill="#f1f1f1')}return i}getComponentStyles(){return{display:"flex",alignItems:"center"}}},Ho=class extends xe{render(){return k("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(){at(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:!1}))})}getTypoStyles(){let e={},t=this.mediaStyle.typo??new ct;return e.letterSpacing=t.letterSpacing,e.fontSize=t.fs+"px",e.lineHeight=t.lh,e.fontFamily="inherit",e.textAlign=t.alignment,e.fontWeight=t.fw,this.stylesConverter.getColourStyles(t.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"),w(w({},e),this.getTypoStyles())}createSelectItems(){let e=[];for(let t of this.props.item.vars)e.push(k("option",{value:t.mID,disabled:!t.isAvailable,children:t.name}));return e}onChange(e){let t=e.target.value;this.props.item.selectedOrFirstVariant.value=this.props.item.vars.find(r=>r.mID===t)}},Mi=class extends xe{constructor(e,t){super(e,t),this.setState(()=>({decoration:"unset"}))}renderElement(e){if(!(e.hide||!this.matchWhenCondition(e.when))){if(e.t===4){let t=e;return k(ko,{element:t,triggerContext:this.props.triggerContext,elements:t.elems,item:this.props.item,noLinks:this.props.noLinks})}if(e.t===6)return this.props.triggerContext.triggerData.isBundle()?k(Uo,{element:e,item:this.props.item,triggerContext:this.props.triggerContext}):void 0;if(e.t===13){let t=e,r=this.props.item,n=r.variantImage??r.imageURL,i=r.variantSecondaryImage??r.secondaryImageURL;t.lg=t.sm={src:n,name:r.name,secondarySrc:i};let s=k(Mr,{element:t,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?s:k("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 t=e;return this.props.triggerContext.triggerData.isCartEmbed()&&this.props.item.vars?.length===1&&this.props.item.vars[0].name==="Default Title"?void 0:k(Ho,{element:t,item:this.props.item,triggerContext:this.props.triggerContext})}return e.t===16?k(Mo,{element:e,selectedVariant:this.props.item.selectedOrFirstVariant.value,item:this.props.item,triggerContext:this.props.triggerContext}):e.t===19?k(Fo,{element:e,triggerContext:this.props.triggerContext,review:this.props.item.reviews}):e.t===18||e.t===3?k(Un,{element:e,item:this.props.item,triggerContext:this.props.triggerContext}):k(tn,{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 t=k(xt,{element:e,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?t:k("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:t})}customOnClick(e){this.sendTriggerClicked([this.props.item.toEmbed()],{from:e})}onMouseEnter(){this.setState(()=>({decoration:"underline"}))}onMouseLeave(){this.setState(()=>({decoration:"unset"}))}},ph=Ce(Jo()),Hr=class extends xe{productElement;constructor(e,t){super(e,t),this.setState(()=>({decoration:"unset"}))}render(){let e=JSON.stringify(this.props.element),t=Et.render(e,this.getProductData());if(this.productElement=new br(JSON.parse(t)),!(this.productElement.hide||!this.matchWhenCondition(this.productElement.when)))return k("div",{style:w({},this.getCompiledStyles()),class:"lc-single-product",children:k(Mi,{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,t=e.price,r=this.props.item.name,n=this.props.item.category,i=re.formatCurrency(t.d,!0),s=this.props.item.variantImage??this.props.item.imageURL,o=this.props.item.meta,c=this.props.item.reviews?.rating,u=this.props.item.reviews?.totalReviews,p=t.cmp&&t.cmp>t.d,m=this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(this.props.item.quantity):this.props.item.quantity,h={name:r,price:i,quantity:m,image_url:s,meta:o,category:n,rating:c,reviews:u},y=e.effectivePrice.value!==t.d;y&&(h.effective_price=re.formatCurrency(e.effectivePrice.value));let E=this.props.triggerContext.triggerData.discount.type===ph.DiscountType.BXGY;if(!y&&E&&(h.effective_price=re.formatCurrency(e.effectivePrice.value),h.price=""),p){h.compare_price=re.formatCurrency(t.cmp);let _=t.cmp-t.d;h.discount_percent=(_/t.cmp*100).toFixed(0),h.discount_price=re.formatCurrency(_)}let v={name:e.name,quantity:this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(e.quantity):e.quantity};return{product:h,variant:v,svg:{color:()=>"{{svg.color}}",size:()=>"{{svg.size}}"}}}};function cc(){return new Promise(e=>{let t="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.js";if(Array.from(document.scripts).some(n=>n.src.includes(t))){e();return}let r=document.createElement("script");r.src=t,r.onload=()=>{e()},document.body.appendChild(r)})}function lc(e,t){if(!e||!window.Swiper)return;let r=new window.Swiper(e,{loop:!0,slidesPerView:t.maxInRow,spaceBetween:t.gap+"px",pagination:{type:t.pagination.type,el:e.querySelector(".swiper-pagination"),clickable:!0,renderBullet:(n,i)=>`
|
|
64
64
|
<span class="${i}"
|
|
65
|
-
style="background-color: ${
|
|
65
|
+
style="background-color: ${t.pagination.color?.rgba};"></span>
|
|
66
66
|
`,renderProgressbar:n=>`
|
|
67
67
|
<span class="${n}"
|
|
68
|
-
style="background-color: ${
|
|
68
|
+
style="background-color: ${t.pagination.color?.rgba};">
|
|
69
69
|
</span>
|
|
70
|
-
`},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 sc(t,e,r){let n={color:t.navigation.color?.rgba};return t.pagination.enabled&&(n.transform="translateY(-25%)"),k("div",{class:"swiper-container",ref:e,children:[k("div",{class:"swiper-wrapper",children:r()}),t.navigation.enabled&&k("div",{class:"swiper-button-next",style:n,children:k("span",{})}),t.navigation.enabled&&k("div",{class:"swiper-button-prev",style:n,children:k("span",{})}),t.pagination.enabled&&k("div",{className:"swiper-pagination",style:{bottom:0,top:"unset",position:"relative",color:t.pagination.color?.rgba}})]})}var jo=class extends Te{swiperRef=null;swiperInstance=null;configuration;gap;constructor(t,e){super(t,e),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&&ic().then(()=>{this.swiperInstance=oc(this.swiperRef,this.props.element.conf[this.deviceTypeKey])})}componentWillUnmount(){this.swiperInstance&&this.swiperInstance.destroy()}render(){let t=this.props.triggerContext.triggerData.items;t.splice(this.configuration.maxItems??10);let e;if(this.configuration.disp===2){let r=i=>{this.swiperRef=i},n=()=>t?.map(i=>k("div",{class:"swiper-slide",children:this.getProductFragment(i)}));e=k("div",{style:Z(w({},this.getCompiledStyles()),{display:"block"}),class:"lc-product-swiper-list",children:sc(this.configuration,r,n)})}else e=k("div",{style:this.getCompiledStyles(),class:"lc-product-list",children:t?.map((r,n)=>this.getProductFragment(r,n!==t.length-1))});return e}getComponentStyles(){let t=[0,2].includes(this.configuration.disp),e={display:t?"flex":"grid",justifyContent:"safe "+(this.mediaStyle.flex?.jc??"center"),gap:this.gap,flexDirection:this.mediaStyle.flex?.dir??"row"};if(e.flexDirection==="row"){if(t)e.maxWidth="100%",e.overflowY="auto";else if(this.configuration.disp===1){let r=this.props.triggerContext.triggerData,n=r.items.length,i;r.isBundle()?i=this.props.element.prod.symbol?.hide!==!0?n*2-1:n:i=this.props.element.conf[this.deviceTypeKey].maxInRow,e.gridTemplateColumns=`repeat(${i}, auto)`}}return e}getProductFragment(t,e=!1){return k(mr,{children:[k(Hr,{element:this.props.element.prod,item:t,triggerContext:this.props.triggerContext}),this.props.triggerContext.triggerData.isBundle()&&e&&this.props.element.prod.symbol&&!this.props.element.prod.symbol.hide&&k("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:k(It,{element:this.props.element.prod.symbol,triggerContext:this.props.triggerContext})})]},t.mID)}},Wo=class extends Te{swiperRef=null;swiperInstance=null;constructor(t,e){super(t,e)}componentDidMount(){ic().then(()=>{this.swiperInstance=oc(this.swiperRef,this.props.element.conf)})}componentWillUnmount(){this.swiperInstance&&this.swiperInstance.destroy()}render(){let t=this.props.element,e=n=>{this.swiperRef=n},r=()=>t.values?.map(n=>k("div",{class:"swiper-slide",onClick:()=>this.onClick({clickAction:this.getClickAction(n)}),children:this.renderElement(n)}));return sc(t.conf,e,r)}getComponentStyles(){return{}}renderElement(t){let e=this.valueAddedSlide(this.props.element.slide,t);switch(e?.t){case 1:return k(Mr,{element:e,triggerContext:this.props.triggerContext});case 4:return k(Fr,{elements:e.elems,element:e,triggerContext:this.props.triggerContext});default:b.warn("Unknown slide type for carousal")}}valueAddedSlide(t,e){let r=JSON.stringify(t),n=vt.render(r,{form:e});return Lt.getParsedElement(JSON.parse(n))}getClickAction(t){let e=w({},this.props.element.clc),r=JSON.stringify(e),n=vt.render(r,{form:t});return JSON.parse(n)}},Zr=class extends Te{constructor(t,e){super(t,e),this.setState(()=>({decoration:"unset"})),ot(()=>{this.setState(()=>({showButton:!this.props.triggerContext.triggerData.isBundle()||!!this.props.triggerContext.selectedItems.length}))})}renderElement(t){if(!t.hide){if(t.t===4){let e=t;return k(Fr,{element:e,triggerContext:this.props.triggerContext,elements:e.elems})}if(t.t===61)return k(Uo,{element:t,triggerContext:this.props.triggerContext});if(t.t===3)return this.state.showButton?k(Ln,{element:t,triggerContext:this.props.triggerContext}):void 0;if(t.t===2)return k(It,{element:t,triggerContext:this.props.triggerContext});if(t.t===1)return k(Mr,{element:t,triggerContext:this.props.triggerContext});if(t.t===11)return k(jo,{element:t,triggerContext:this.props.triggerContext});if(t.t===12)return k(Hr,{element:t,item:this.props.triggerContext.triggerData.items[0],triggerContext:this.props.triggerContext});if(t.t===62)return k(Wo,{element:t,triggerContext:this.props.triggerContext})}}render(){return this.props.elements.map(t=>this.renderElement(t))}getComponentStyles(){return{}}},Go=class extends Te{clickAction;isClickable;constructor(t,e){super(t,e),this.clickAction=this.props.element.clc,this.isClickable=this.clickAction?.at===4&&this.clickAction.gu?.u}componentDidMount(){ot(()=>{let t=this.props.triggerContext.triggerData,e=this.props.triggerContext.selectedItems;t.calculateDiscountData(e,this.props.triggerContext.shouldGiveFBTDiscount)})}render(){return k(mr,{children:[k("div",{style:this.getCompiledStyles(),class:"lc-container",onClick:()=>{this.onClick({clickAction:this.clickAction})},children:k(Zr,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})}),this.props.triggerContext.triggerData.id==="preview"&&k("div",{class:"letscooee-preview-badge",children:["#",this.props.triggerContext.triggerData.shortID," preview"]})]})}getComponentStyles(){let t={position:"relative",overflow:"hidden",display:"block"};return this.isClickable&&(t.cursor="pointer"),t}async onClick(t){if(this.isClickable)return super.onClick(t)}},Ct=class Yo{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=le.get();widgetAPIService=ue.get(ar);safeHTTPService=ue.get(pe);scrollSubscription;variation;isExclusionWithBVariation;renderSilently(){this.render().catch(e=>Pe.getInstance().captureException(e,w({},this.engagementTrigger.sentryContext())))}destroy(){b.log(`${this.engagementTrigger} will be destroyed`),this.scrollSubscription?.unsubscribe(),this.observers.forEach(e=>{e?.disconnect&&e.disconnect()}),this.rootContainer?.remove(),Yo.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){b.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){_d.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){b.log(`${this.engagementTrigger} already has required data to render widget`);return}let e=await this.observeWidgetContainerInViewport();this.handleVariationResponse(e)}handleVariationResponse(e){e&&(b.log(`${this.engagementTrigger} visitor has been assigned to variation ${e.variation}`),e.items?.length&&(this.engagementTrigger.items=e.items.map(r=>new xt(r)),this.engagementTrigger.nonMutableItems=e.items.map(r=>new xt(r))),e.bundleFrom&&(this.engagementTrigger.bundleFrom=new xt(e.bundleFrom)),e.discount&&(this.engagementTrigger.discount=e.discount),e.placement&&(this.triggerContext.triggerData.placement=e.placement),e.props&&Ht.hasKeys(e.props)&&(this.engagementTrigger.props=w(w({},this.engagementTrigger.props),e.props)),this.triggerContext.triggerData.widget=this.widget=new yi(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(){Yo.renderedEngagements.push(this)}async getVariation(){b.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){b.error(`${this.engagementTrigger} unable to get the variation`,r);return}}async observeWidgetContainerInViewport(){if(!this.rootContainer){b.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((s,o)=>{s.forEach(async c=>{if(c.isIntersecting){b.log(`${this.engagementTrigger} root container is near the viewport. Fetching variation`);let u=await this.getVariation();n(u),o.unobserve(this.rootContainer)}})},r);i.observe(this.rootContainer),this.observers.push(i)})}attachScroll(){this.scrollSubscription=An(window,"scroll").pipe(sr(Yo.DEBOUNCE_TIME)).subscribe(()=>{this.checkAndSendEvent()})}async checkAndSendEvent(){let e=this.engagementTrigger.shortID;if(Yo.engagementIDsWithTrackedDisplay.has(e)||!await this.isInViewport())return;let r={};this.triggerContext.triggerData.items?.length&&(r.promotedMIDs=this.engagementTrigger.items?.map(s=>s.mID));let n=this.isExclusionWithBVariation?N.EVENT_CAMPAIGN_HOLDOUT:N.EVENT_TRIGGER_DISPLAYED,i=new ve(n,r,this.engagementTrigger);i.name===N.EVENT_CAMPAIGN_HOLDOUT&&(i.trigger.holdout=!0),this.safeHTTPService.sendEvent(i),Yo.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,n=(Math.min(e.bottom,r)-Math.max(e.top,0))*e.width,i=e.width*e.height,s=n/i*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 b.warn(`${this.engagementTrigger} does not have a selector`),null;let n=r.selector,i;if(n.includes(N.SHADOW_SPLITTER)){let u=n.split(N.SHADOW_SPLITTER);i=(await ne.retrySelector(u[0].trim()))?.shadowRoot,n=u[1].trim(),i&&ft.injectStylesheet(er.styleURL,i);let d=Oe.get().website.commonCSS;i&&d&&ft.injectRawCSS(d,i)}b.debug(`${this.engagementTrigger} attempt to render ${r.position}-${n}`);let s=await ne.retrySelector(n,10,i??document);if(!s)return b.warn(`${this.engagementTrigger} no placement found with ${n}`),null;let o=this.generateParentElementID(),c=this.getParentElement(o);if(!e)return c;switch(r.position){case $n.BEFORE:{s.parentElement?.insertBefore(c,s);break}case $n.INSIDE_FIRST:{s.insertBefore(c,s.firstChild);break}case $n.INSIDE_LAST:{s.appendChild(c);break}case $n.AFTER:default:s.parentElement?.insertBefore(c,s.nextSibling)}return c}async startRendering(){let e;try{e=await Pi.refreshItems(this.engagementTrigger)}catch(r){b.error(`${this.engagementTrigger} error refreshing the items`,r);return}if(!e?.length&&this.engagementTrigger.isProductPromoted()){b.warn(`${this.engagementTrigger} is of ${this.engagementTrigger.objective} but no product found`);return}this.engagementTrigger.items=e,this.renderContainer()}getParentElement(e,r=document){let n=r.getElementById(e);if(n)return n;let i=this.engagementTrigger.shortID;return n=document.createElement("div"),n.id=e,n.className=`letscooee letscooee-engagement engagement-${i}`,n.dataset.engagementId=i,this.engagementTrigger.id==="preview"&&(n.className+=" letscooee-preview"),n.style.display="block",n.style.minHeight="0.5px",n.style.minWidth="0.5px",n}renderContainer(){if(!this.widget)return;let e=this.rootContainer;if(this.triggerContext.triggerData.hasSwiperElement()){let r=this.rootContainer?.shadowRoot||this.rootContainer?.attachShadow({mode:"open"}),n=Oe.get().website.commonCSS;n&&ft.injectRawCSS(n,r),ft.injectStylesheet(er.styleURL,r),ft.injectStylesheet("https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css",r),e=r}es(Ji(Go,{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 s of i)jn.remove(r,s)}getItemDiff(e,r){return e.filter(n=>!r.some(i=>i.selectedOrFirstVariant.value.mID===n.selectedOrFirstVariant.value.mID))}},Ar=class Ud extends Ct{static renderedEngagements=[];constructor(e){super(e)}addToRendered(){Ud.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(!Ve.get().isOpen()&&this.runtimeData.pageName!=="cart"){b.log("Do not send display event as neither the cart drawer nor the cart page is open.");return}return super.checkAndSendEvent()}},ac=class jd{constructor(e,r){this.engagementTrigger=e,this.element=r,this.cartItems=me.getCurrent().items}cartItems;static renderCartUpsell(e){let r=e.placement;if(!r?.selector){b.warn(`No placement available for ${e.objective}`,e.shortID);return}let n=Array.from(document.querySelectorAll(r.selector));if(!n?.length){b.warn(`No placement found for ${e.objective}`,e.shortID);return}for(let i of n)new jd(e,i).render()}render(){let e=this.findCartItemFromHTMLElement();if(!e||this.engagementTrigger.skipSubscribedItems&&e.selling_plan_allocation)return;let r=this.engagementTrigger.items.find(m=>m.mID===e.product_id.toString());if(!r)return;let n=r.vars.find(m=>m.mID===e.id.toString());if(!n)return;let i=new wr(n),s=e.selling_plan_allocation?.selling_plan;if(s)for(let m of i.sellingPlans??[])m.mID===s.id.toString()&&(m.isSelected=!0,i.changeSellingPlan(m));let o=new xt(r);o.vars=[i],o.selectedOrFirstVariant.value=i;let c=`lc-cart-item-${this.engagementTrigger.shortID}-${r.mID}`;this.element.classList.add(c);let u=new Bt(this.engagementTrigger);u.placement.selector=`.${c}`,u.items=[o];let d=new Ar(u);d.renderSilently(),this.watchForCartItemDeletion(d,c)}watchForCartItemDeletion(e,r){let n=new MutationObserver(i=>{i.forEach(s=>{s.removedNodes.forEach(o=>{o===this.element&&(b.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))})}},cc=class extends Ar{ctaListener=new Qr;constructor(t){super(t),Rr.get().subscriber(N.CART_UPDATE_BROADCAST).pipe(ju(null)).subscribe(this.checkMilestone.bind(this))}update(t){super.update(t),this.widgetElement.update()}shouldStopRendering(){return!1}renderContainer(){if(this.widgetElement?.isConnected){this.addToRendered();return}let t=this.widgetElement=document.createElement("cooee-progressbar");t.className="cooee-root",t.cart=me.getCurrent(),t.engagementTrigger=this.engagementTrigger,t.setAttribute("engagement",this.engagementTrigger.shortID),this.rootContainer.appendChild(t),this.addToRendered()}async checkMilestone(){let t=await me.getCurrent().getNormalisedCart(),e=[...this.engagementTrigger.progressBarConfig.milestones].reverse().find(r=>r.minValue<t.amount);if(!e){b.log("No milestone achieved yet");return}if(b.log("Current milestone",e),e.rewardType===Dc.FREE_AUTO_GIFT){let r=e.items[0];if(t.items.find(n=>n.vID===r.vID||n.mID===r.mID)){b.log(`Item(vID:${r.vID}) already present in the cart. Updating item's properties`),await this.ctaListener.performUpdate(r,{properties:this.engagementTrigger.getPrivateAttributesForLineItem()});return}else{let n=await this.ctaListener.performAddToCart([r],this.engagementTrigger);Ve.get().refreshUI(n,!1),await this.removeOtherFreeGifts(r)}}}async removeOtherFreeGifts(t){let e=(await me.getCurrent().getNormalisedCart()).items.filter(r=>r.vID!==t?.vID&&r.properties[N.CAMPAIGN_ATTRIBUTE]===this.engagementTrigger.shortID);if(e.length)for(let r of e)await this.ctaListener.performUpdate(r,{quantity:0})}},Ed=new Ir({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]}]}]}]}]}),Sd=new qe({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"}),Vo=class extends Te{render(){return k("div",{style:{marginTop:30},class:"lc-container",children:[k(It,{element:Sd,triggerContext:this.props.triggerContext}),k("div",{style:this.getComponentStyles(),children:this.props.triggerContext.triggerData.items.map(t=>{if(t.portraitVideos?.length)return k("div",{class:"lc-shoppable-video",style:{flex:"1 1 0",width:"260px"},children:[k("a",{href:t.link,onClick:()=>{this.sendTriggerClicked([new lt(t)],{from:"video"})},children:k("video",{width:"100%",autoplay:!0,muted:!0,loop:!0,children:this.getSources(t.portraitVideos[0].sources)})}),k(Hr,{element:Ed,item:t,triggerContext:this.props.triggerContext})]})})})]})}getSources(t){let e=t.map(i=>k("source",{src:i.url,type:i.mimeType,media:`(max-width:${i.width}px)`})),r=t.filter(i=>i.format==="mp4").sort((i,s)=>s.width-i.width)[0];r&&e.push(k("source",{src:r.url,type:r.mimeType}));let n=t.filter(i=>i.format==="m3u8").sort((i,s)=>s.width-i.width)[0];return n&&e.push(k("source",{src:n.url,type:n.mimeType})),e}getComponentStyles(){return{display:"flex",gap:10,overflowX:"auto",margin:10}}},lc=class extends Ct{constructor(t){super(t)}shouldStopRendering(){return!1}renderContainer(){es(Ji(Vo,{element:this.widget?.cont,triggerContext:this.triggerContext}),this.rootContainer)}},uc=class extends Ct{constructor(t){super(t)}shouldStopRendering(){return!1}renderContainer(){let t=this.getParentElement(`inner-letscooee-${this.engagementTrigger.shortID}`);this.rootContainer.appendChild(t),document.addEventListener(N.ADD_BUNDLE_CTA_INBOUND_EVENT,this.inboundCTAListener.bind(this),!1)}async inboundCTAListener(t){let e=this.engagementTrigger,r=`Engagement(id: ${e.engagementID}, shortID: ${e.shortID})`,n=t.detail;if(!Ht.hasKeys(n)){b.error(`No detail received for ${r}`);return}b.log("Detail received for BYOB",n);let i=n.campaignID??n.campaignId??n.campaign_id;if(i!==e.shortID&&i!==e.engagementID){b.warn(`Current ${r} is not BYOB. Received: ${i}`);return}let s=n.items;if(!s?.length)return;let o=s.map(c=>new lt({mID:c.product_id,vID:c.variant_id,quantity:c.quantity||1}));await new Li(this.triggerContext).execute({embeddedItems:o,clickAction:{at:108,applyDiscount:!0}})}},Ui=class{runtimeData=le.get();processCartWidgetResponse(t){this.runtimeData.isCartDirty=!1,this.runtimeData.cartEngagements=t;let e=[...Ar.renderedEngagements];Ar.renderedEngagements.length=0;for(let r of t)b.log(`\u{1F4E3} ${r} received as cart embed`),!this.findAndUpdateCurrent(r,e)&&(b.log(`${r} is new`),r.isProgressBar()?new cc(r).renderSilently():r.isSubscriptionUpsell()?ac.renderCartUpsell(r):new Ar(r).renderSilently());this.removeOldWidgets(e)}processPageWidgetResponse(t){let e=[...Ct.renderedEngagements];Ct.renderedEngagements.length=0;for(let r of t)b.log(`\u{1F4E3} ${r} received as page embed`),!this.findAndUpdateCurrent(r,e)&&(b.log(`${r} is new`),r.isShoppableVideo()?new lc(r).renderSilently():r.isBYOB()?new uc(r).renderSilently():new Ct(r).renderSilently());this.removeOldWidgets(e)}findAndUpdateCurrent(t,e){let r=e.findIndex(n=>n.isSameTrigger(t));return r<0||t.isSubscriptionUpsell()?!1:(e[r].update(t),e[r].renderSilently(),e.splice(r,1),!0)}removeOldWidgets(t){for(let e of t)e.destroy()}},ar=class Bd{static INSTANCE;httpService=ue.get(mt);sessionManager=ue.get(it);runtimeData=le.get();loadWidgetsSubject=new bt;constructor(){this.loadWidgetsSubject.pipe(sr(300)).subscribe(()=>{this.loadCartWidgets().catch(e=>b.error("Unable to initiate cart widgets",e)),this.loadPageWidgets().catch(e=>b.error("Unable to initiate page widgets",e))}),Rr.get().subscriber(N.CART_UPDATE_BROADCAST).subscribe(()=>this.loadWidgetsSubject.next())}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Bd),this.INSTANCE}loadOrRenderWidgetsAfterCartChange(){this.runtimeData.isCartDirty?this.loadWidgetsSilently():this.renderCachedCartWidgets()}loadPageWidgetsSilently(){it.replaySubject.subscribe(async()=>{this.loadPageWidgets().catch(e=>b.error("Unable to initiate load page widgets",e))})}loadCartWidgetsSilently(){it.replaySubject.subscribe(async()=>{this.loadCartWidgets().catch(e=>b.error("Unable to initiate cart widgets",e))})}loadWidgetsSilently(){it.replaySubject.subscribe(async()=>{this.loadWidgetsSubject.next()})}async loadPageWidgets(){let e=await this.getWidgetProps();b.log("Load widgets",e),this.httpService.post("/v1/engagement/page-widgets",e).then(async r=>{let n=r.widgets.map(i=>new Bt(i));new Ui().processPageWidgetResponse(n)}).catch(r=>{b.error("Error sending widget getter",r)})}async loadCartWidgets(){let e=await this.getWidgetProps();b.log("Load cart widgets",e),this.httpService.post("/v1/engagement/cart-widgets",e).then(async r=>{let n=r.widgets.map(i=>new Bt(i));new Ui().processCartWidgetResponse(n)}).catch(r=>{b.error("Error sending widget getter",r)})}async getVariation(e){let r=await this.getWidgetProps();return this.httpService.post("/v1/engagement/get-variant",w(w({},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=Cr.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 me.getCurrent().getNormalisedCart()}catch(s){b.error("Error fetching Shopify cart before sending widget call",s)}let r=new URLSearchParams(location.search),n=r.get("cooee-preview");n?e.previewIDs=n.trim().split(",").filter(s=>Number.isInteger(+s)):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}},pc=class{runtimeData=le.get();widgetAPIService=ue.get(ar);meddle(){let t=Se.globalRef;t.account=t.account??[],t.profile=t.profile??[],t.events=t.events??[],t.screen=t.screen??[],t.page=t.page??[],this.meddlePage(),this.meddleAccount(),this.meddleEvents(),this.meddleProfile(),this.meddleScreen(),this.exposeMethods()}exposeMethods(){let t=Se.globalRef;t.loadPageWidgets=()=>{this.widgetAPIService.loadPageWidgetsSilently()},t.loadCartWidgets=()=>{this.widgetAPIService.loadCartWidgetsSilently()},t.previewWidget=Se.previewWidget.bind(Se),t.previewPopup=Se.previewPopup.bind(Se)}overwritePush(t,e){oi(t,"push",e)}meddleAccount(){this.overwritePush(Se.globalRef.account,(...t)=>{this.processAccount(t[0])}),Se.globalRef.account.forEach(this.processAccount.bind(this))}meddleEvents(){this.overwritePush(Se.globalRef.events,(...t)=>{this.processEvent(t[0])}),Se.globalRef.events.forEach(this.processEvent.bind(this))}meddleProfile(){this.overwritePush(Se.globalRef.profile,(...t)=>{this.processProfile(t[0])}),Se.globalRef.profile.forEach(this.processProfile.bind(this))}meddleScreen(){this.overwritePush(Se.globalRef.screen,(...t)=>{this.processPageName(t[0])}),Se.globalRef.screen.forEach(this.processPageName.bind(this))}processAccount(t){t&&(t.appID&&Se.authenticate(t),t.flags&&On.setFlags(t.flags))}processEvent(t){t&&(N.JS_LOAD_WHITELIST_EVENTS.includes(t[0])?Se.sendEvent(t[0],t[1],this.runtimeData.jsLoadTime):Se.sendEvent(t[0],t[1]))}processProfile(t){t&&Se.updateProfile(t)}processPageName(t){t&&Se.setPageName(t)}meddlePage(){this.overwritePush(Se.globalRef.page,(...t)=>{this.processPage(t[0])}),Se.globalRef.page.forEach(this.processPage.bind(this))}processPage(t){t.currentItem&&this.runtimeData.setCurrentItem(t.currentItem),t.currency&&(this.runtimeData.currencyCode=t.currency),t.shopCurrency&&(this.runtimeData.shopCurrencyCode=t.shopCurrency),t.moneyFormat&&(this.runtimeData.moneyFormat=t.moneyFormat),t.jsLoad&&(this.runtimeData.jsLoadTime=t.jsLoad),t.pageName&&Se.setPageName(t.pageName)}},ki=class{static SESSION_STORAGE=window.sessionStorage;static SESSION_STORAGE_KEY_PREFIX=N.COOEE.concat("-");static getString(t,e){return this.getItem(t)||e}static setString(t,e){this.setItem(t,e)}static remove(t){this.removeItem(t)}static getItem(t){return this.SESSION_STORAGE.getItem(this.SESSION_STORAGE_KEY_PREFIX.concat(t))}static setItem(t,e){this.SESSION_STORAGE.setItem(this.SESSION_STORAGE_KEY_PREFIX.concat(t),e)}static removeItem(t){this.SESSION_STORAGE.removeItem(this.SESSION_STORAGE_KEY_PREFIX.concat(t))}},Mi=class Sc{static INSTANCE;static DEBOUNCE_TIME=1e3;static THRESHOLD=10;safeHttpService=ue.get(pe);_lastScreenOrScroll=new Date;lastPercent=0;constructor(){}set lastScreenOrScroll(e){this._lastScreenOrScroll=e}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Sc),this.INSTANCE}resetScrollID(e){ki.remove(N.SESSION_STORAGE_SCROLL_ID),this.lastScreenOrScroll=e??new Date}listen(){if(window.scrollY){let e=this.getPercentScrolledY();this.shouldSendScroll(e)&&this.sendScroll(e)}ne.onDocumentLoaded(()=>{this.observeWindowScroll()})}observeWindowScroll(){An(window,"scroll").pipe(sr(Sc.DEBOUNCE_TIME),Rn(()=>{let e=this.getPercentScrolledY();if(e>100){b.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)>=Sc.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=ki.getString(N.SESSION_STORAGE_SCROLL_ID,""),i=new ve(N.EVENT_SCROLL,r,null,n);this.safeHttpService.sendEvent(i),ki.setString(N.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)}},fc=class $d{static ACTIVE_DURATION="aDur";static INACTIVE_DURATION="iaDur";apiService=ue.get(pe);runtimeData=le.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){b.info("Not sending background event as user was inactive on website");return}b.info(`Sending background event with ${e} seconds`);let r={};r[$d.ACTIVE_DURATION]=e,this.apiService.sendEvent(new ve(N.EVENT_APP_BACKGROUND,r))}},mc=class{compareCartItemSubject=new bt;constructor(){this.compareCartItemSubject.pipe(sr(100)).subscribe(this.compareCartItems.bind(this))}listen(){this.compareCartItemSubject.next(),this.overwriteXMLHttpRequest(),this.overwriteFetchMethod()}overwriteXMLHttpRequest(){let t=this,e=window.XMLHttpRequest.prototype.send;window.XMLHttpRequest.prototype.send=function(){return this.addEventListener("load",function(){t.performEvent(this._url).catch(r=>b.error("Unable to process cart change in XMLHttpRequest",r))}),e.apply(this,arguments)},b.debug("Securely overwritten window.XMLHttpRequest.send method")}overwriteFetchMethod(){let t=this,e=window.fetch;window.fetch=function(r){return e.apply(window,arguments).then(n=>(t.performEvent(r.toString()).catch(i=>b.error("Unable to process cart change in fetch",i)),n))},b.debug("Securely overwritten window.fetch method")}async performEvent(t){this.isCartManipulationURL(t)&&(le.get().isCartDirty=!0,this.compareCartItemSubject.next())}isCartManipulationURL(t){return/\/cart\/(add|change|update|clear)/.test(t)}sendChangesAsEvents(t,e){let r=t?.items,n=e.items,i=[],s=[];if(b.debug(`Comparing cart change with old count ${r?.length} to new count ${n.length}`),n?.forEach(o=>{let c=r?.find(u=>u.vID===o.vID);if(c){if(c.quantity!==o.quantity){let u=c.quantity<o.quantity,d=Math.abs(c.quantity-o.quantity),m=Z(w({},o),{quantity:d});u?i.push(m):s.push(m)}r&&ne.removeFromArray(r,c)}else i.push(o)}),r)for(let o of r)s.push(o);b.debug(`Cart delta: added: ${i.length}, removed: ${s.length}`),i.length&&this.sendEvent(N.EVENT_ADD_TO_CART,{items:i}),s.length&&t.token===e.token&&this.sendEvent(N.EVENT_REMOVE_FROM_CART,{items:s}),(s.length||i.length)&&Rr.get().broadcast(N.CART_UPDATE_BROADCAST,{itemsAdded:i,itemsRemoved:s})}sendEvent(t,e){let r=new ve(t,e);ue.get(pe).sendEvent(r)}async compareCartItems(){let t=await Ae.get(ie.CURRENT_CART,{}),e=await me.getCurrent().getNormalisedCart(!0);this.sendChangesAsEvents(t,e)}},dc=class{listen(){return this.overwriteFetchMethod(),this}overwriteFetchMethod(){let t=this,e=window.fetch;window.fetch=async function(r,n){try{await t.modifyRequest(r,n)}catch(i){Pe.getInstance().captureError("Failed to modify graphql request",i,{body:JSON.stringify(n?.body)})}return e(r,n)},b.debug("Securely overwritten window.fetch method for graphql query")}async modifyRequest(t,e){let r=typeof t=="string"?t:t instanceof Request?t.url:"";if(!(r.includes("graphql.json")&&e?.method==="POST")||!e.body)return;let n;if(typeof e.body=="string")try{n=JSON.parse(e.body)}catch{return}else n=e.body;b.debug("Intercepted fetch request of:",r),n?.query.includes("cartCreate")&&(e.body=await this.updatedBody(n),this.sendBuyNowEvent())}async updatedBody(t){let e=t.variables.input.attributes??[],r=await ne.getCartAttributes();return t.variables.input.attributes=[...e,...r],JSON.stringify(t)}sendBuyNowEvent(){let t=le.get().getCurrentItem();if(!t)return;let e=new ve(N.EVENT_BUY_NOW_CLICKED,{items:[t]});pe.getInstance().sendEvent(e)}},Fi=class{constructor(t,e){this.selectors=t,this.eventName=e,this.selectorString=t.join(",")}static INSTANCE;elements;selectorString;clickListenerCallback=t=>{let e=t.currentTarget,r=new ve(this.eventName,{class:e.className||void 0,tagName:e.tagName||void 0,id:e.id||void 0});pe.getInstance().sendEvent(r),this.removeClickListener(this.clickListenerCallback)};listenSilently(){this.listen().catch(t=>b.error(t))}async listen(){this.elements=await ne.retrySelectorForElements(this.selectorString),this.elements.forEach(t=>{t.addEventListener("click",this.clickListenerCallback)})}removeClickListener(t){this.elements?.forEach(e=>{e.removeEventListener("click",t)})}},hc=class Qu 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(Qu.selectors,N.EVENT_ITEM_THUMBNAIL_CLICKED)}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Qu),this.INSTANCE}},gc=class th 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(th.selectors,N.EVENT_REVIEW_CLICKED)}static getInstance(){return this.INSTANCE||(this.INSTANCE=new th),this.INSTANCE}},yc=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(){ne.onDocumentLoaded(()=>{b.debug("Execution order:","document ready"),this.useLocationHash()})}useLocationHash(){let t=window.location.hash?.substring(1);if(t)if(t.includes(N.HASH_INITIATE_CHECKOUT)){document.dispatchEvent(new Event(N.THIRD_PARTY_CHECKOUT_EVENT));let e=document.querySelector(this.selector);if(!e){b.debug("No clickable cart checkout button found");return}b.debug("Clickable cart checkout button found",e),e.click()}else t.includes(N.HASH_OPEN_CART_DRAWER)&&Ve.get().open()}},vc=class{trackSilently(){this.track().catch(t=>Pe.getInstance().captureException(t))}async track(){let t=window.Shopify?.checkout,e=window.Shopify?.Checkout;if(!t&&!e)return;let r={};this.processSmallCheckout(t,r),this.processBigCheckout(e,r);let n=this.getTokenFromCurrentURLPath();if(n&&(r.urlToken=n),!Object.keys(r).length){b.warn("No processable data found in",t,e);return}r.referrer=document.referrer,r.url=location.href;let i=await ue.get(it).checkSessionAndGetContext();r.sessionID=i[0],this.trackOrder(r)}processSmallCheckout(t,e){t&&(t.order_id&&(e.orderID=t.order_id.toString()),t.token&&(e.checkoutToken=t.token.toString()),t.customer_id&&(e.customerID=t.customer_id.toString()))}processBigCheckout(t,e){t&&(t.token&&!e.checkoutToken&&(e.checkoutToken=t.token.toString()),t.cartToken&&(e.cartToken=t.cartToken.toString()))}trackOrder(t){b.info("Found order to be send",t),pe.getInstance().trackOrder(t)}getTokenFromCurrentURLPath(){let t=new RegExp("[A-Fa-f0-9]{28,32}");return location.pathname?.split("/").find(e=>e.length&&t.test(e))}},zo=class{static attachCheckoutListener(){window.gokwikSdk&&window.gokwikSdk.on("checkout_initiated",async()=>{let t=await me.getCurrent().getNormalisedCart(),e={via:"GoKwik",items:t.items,cartToken:t.token,amount:{value:t.amount,currency:t.currency}},r=new ve(N.EVENT_CHECKOUT_STARTED,e);pe.getInstance().sendEvent(r)})}},_c=class{async migrate(){}};vt.escape=Ko.escapeHtml;var Se=class{static globalRef;static authenticated;static async initForMerchantWebsiteOnly(){window.cooeeSDKPreview||(this.initGlobalReference(),await new _c().migrate(),this.autoAuthenticate(),new pc().meddle(),new fc().listen(),new vc().trackSilently(),new Qr().listen(),new mc().listen(),new dc().listen(),new yc().listen(),ue.get(Mi).listen(),ue.get(gc).listenSilently(),ue.get(hc).listenSilently(),ue.get(ar).loadPageWidgetsSilently(),this.attachGoKwikListeners(),this.storePreviewParams(),this.setupPreviewListeners(),Xt.watch())}static async initForAll(){this.injectWidgetAssets()}static initGlobalReference(){window.CooeeSDK||oi(window,"CooeeSDK",{}),this.globalRef=window.CooeeSDK,oi(this.globalRef,"config",new Oe),oi(this.globalRef,"runtimeData",new le),b.debug("Global reference initialised")}static injectWidgetAssets(){if(document.currentScript.src.includes("localhost")){let t="http://localhost:8002";ft.injectScriptURL(`${t}/main.js`),ft.injectStylesheet(`${t}/styles.css`)}else{let t=`https://cdn.jsdelivr.net/npm/@letscooee/web-sdk@${N.SDK_VERSION}`;ft.injectScriptURL(`${t}/dist/widget-sdk.min.js`,"cooee-widget-sdk"),ft.injectStylesheet(`${t}/dist/widget-sdk.min.css`)}}static autoAuthenticate(){let t=Ne.getShopName();t&&this.authenticate({shopifyShop:t})}static authenticate(t){if(this.authenticated)return;let e=t.appID?.trim(),r=t.shopifyShop;if((ne.isNull(e)||e.length!==24)&&ne.isNull(r)){b.warn("Cooee App ID or Shop name is not configured");return}this.authenticated=!0,ue.get(it).init(t)}static sendEvent(t,e,r){for(let i in e)if(i.length>3&&i.toLowerCase().startsWith("ce "))throw new Error("Event property name cannot start with 'CE '");let n=new ve(t,e);n.occurred=r??new Date,ue.get(pe).sendEvent(n)}static updateProfile(t){for(let e in t)if(e.toLowerCase().startsWith("ce "))throw new Error("User property name cannot start with 'CE '");ue.get(pe).updateProfile(t)}static setPageName(t){if(!t)return;let e=le.get(),r=e.pageName;if(t===r)return;if(e.pageName=t,t==="cart"&&ue.get(ar).loadOrRenderWidgetsAfterCartChange(),N.BLACKLISTED_PAGE_NAMES.some(s=>t.includes(s))){ue.get(Mi).resetScrollID();return}let n={};r&&(n.ps=r);let i=new ve(N.EVENT_SCREEN_VIEW,n);i.occurred=e.jsLoadTime,ue.get(pe).sendEvent(i),ue.get(Mi).resetScrollID(i.occurred)}static previewPopup(t,e){new Oi(e).render(t)}static previewWidget(t){new Ct(new Bt(t)).render()}static setupPreviewListeners(){if(window.opener){try{window.opener.postMessage({action:"COOEE_READY_FOR_PREVIEW"},"*")}catch(t){b.error(t)}window.addEventListener("message",t=>{if(b.debug("Received event",t),!t.origin.includes("letscooee.com")&&!t.origin.includes("localhost"))return;let e=t.data;typeof e=="object"&&(e.action==="POPUP_PREVIEW"?(this.previewPopup(e.engagementTrigger),t.source?.postMessage({action:"PREVIEW_SUCCESSFUL"},t.origin)):e.action==="WIDGET_PREVIEW"&&(this.previewWidget(e.engagementTrigger),t.source?.postMessage({action:"PREVIEW_SUCCESSFUL"},t.origin)))})}}static attachGoKwikListeners(){let t=le.get();window.addEventListener("kp-modal:opened",()=>{t.isGoKwikPopupOpen=!0}),window.addEventListener("user-loggedin",e=>{let{token:r}=e.detail;r&&this.updateProfile({goKwikToken:r})}),window.gokwikSdk?zo.attachCheckoutListener():window.addEventListener("gokwikLoaded",zo.attachCheckoutListener)}static storePreviewParams(){let t=le.get(),e=new URLSearchParams(location.search),r=e.get("cooee-preview");r&&(t.previewIDs=r.trim().split(",").filter(i=>Number.isInteger(+i)));let n=e.get("cooee-variant");n&&(t.previewVariant=n)}};b.configure();b.logBrand();b.debug("Execution order:","top");window.cooeeShopifyScriptLoaded||(window.cooeeShopifyScriptLoaded=!0,(async()=>(b.debug("Execution order:","IIFE start"),await Se.initForMerchantWebsiteOnly(),await Se.initForAll(),b.debug("Execution order:","IIFE end")))());b.debug("Execution order:","bottom");})();
|
|
70
|
+
`},navigation:{nextEl:e.querySelector(".swiper-button-next"),prevEl:e.querySelector(".swiper-button-prev")},autoplay:t.autoplay?.enabled?{delay:t.autoplay?.delay,disableOnInteraction:!1}:!1,autoHeight:!0});return e.style.setProperty("--swiper-navigation-size",`${t.navigation.size}px`),r}function uc(e,t,r){let n={color:e.navigation.color?.rgba};return e.pagination.enabled&&(n.transform="translateY(-25%)"),k("div",{class:"swiper-container",ref:t,children:[k("div",{class:"swiper-wrapper",children:r()}),e.navigation.enabled&&k("div",{class:"swiper-button-next",style:n,children:k("span",{})}),e.navigation.enabled&&k("div",{class:"swiper-button-prev",style:n,children:k("span",{})}),e.pagination.enabled&&k("div",{className:"swiper-pagination",style:{bottom:0,top:"unset",position:"relative",color:e.pagination.color?.rgba}})]})}var $o=class extends xe{swiperRef=null;swiperInstance=null;configuration;gap;constructor(e,t){super(e,t),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&&cc().then(()=>{this.swiperInstance=lc(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 t;if(this.configuration.disp===2){let r=i=>{this.swiperRef=i},n=()=>e?.map(i=>k("div",{class:"swiper-slide",children:this.getProductFragment(i)}));t=k("div",{style:ee(w({},this.getCompiledStyles()),{display:"block"}),class:"lc-product-swiper-list",children:uc(this.configuration,r,n)})}else t=k("div",{style:this.getCompiledStyles(),class:"lc-product-list",children:e?.map((r,n)=>this.getProductFragment(r,n!==e.length-1))});return t}getComponentStyles(){let e=[0,2].includes(this.configuration.disp),t={display:e?"flex":"grid",justifyContent:"safe "+(this.mediaStyle.flex?.jc??"center"),gap:this.gap,flexDirection:this.mediaStyle.flex?.dir??"row"};if(t.flexDirection==="row"){if(e)t.maxWidth="100%",t.overflowY="auto";else if(this.configuration.disp===1){let r=this.props.triggerContext.triggerData,n=r.items.length,i;r.isBundle()?i=this.props.element.prod.symbol?.hide!==!0?n*2-1:n:i=this.props.element.conf[this.deviceTypeKey].maxInRow,t.gridTemplateColumns=`repeat(${i}, auto)`}}return t}getProductFragment(e,t=!1){return k(fr,{children:[k(Hr,{element:this.props.element.prod,item:e,triggerContext:this.props.triggerContext}),this.props.triggerContext.triggerData.isBundle()&&t&&this.props.element.prod.symbol&&!this.props.element.prod.symbol.hide&&k("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:k(xt,{element:this.props.element.prod.symbol,triggerContext:this.props.triggerContext})})]},e.mID)}},jo=class extends xe{swiperRef=null;swiperInstance=null;constructor(e,t){super(e,t)}componentDidMount(){cc().then(()=>{this.swiperInstance=lc(this.swiperRef,this.props.element.conf)})}componentWillUnmount(){this.swiperInstance&&this.swiperInstance.destroy()}render(){let e=this.props.element,t=n=>{this.swiperRef=n},r=()=>e.values?.map(n=>k("div",{class:"swiper-slide",onClick:()=>this.onClick({clickAction:this.getClickAction(n)}),children:this.renderElement(n)}));return uc(e.conf,t,r)}getComponentStyles(){return{}}renderElement(e){let t=this.valueAddedSlide(this.props.element.slide,e);switch(t?.t){case 1:return k(Mr,{element:t,triggerContext:this.props.triggerContext});case 4:return k(Fr,{elements:t.elems,element:t,triggerContext:this.props.triggerContext});default:b.warn("Unknown slide type for carousal")}}valueAddedSlide(e,t){let r=JSON.stringify(e),n=Et.render(r,{form:t});return kt.getParsedElement(JSON.parse(n))}getClickAction(e){let t=w({},this.props.element.clc),r=JSON.stringify(t),n=Et.render(r,{form:e});return JSON.parse(n)}},tn=class extends xe{constructor(e,t){super(e,t),this.setState(()=>({decoration:"unset"})),at(()=>{this.setState(()=>({showButton:!this.props.triggerContext.triggerData.isBundle()||!!this.props.triggerContext.selectedItems.length}))})}renderElement(e){if(!e.hide){if(e.t===4){let t=e;return k(Fr,{element:t,triggerContext:this.props.triggerContext,elements:t.elems})}if(e.t===61)return k(Bo,{element:e,triggerContext:this.props.triggerContext});if(e.t===3)return this.state.showButton?k(Un,{element:e,triggerContext:this.props.triggerContext}):void 0;if(e.t===2)return k(xt,{element:e,triggerContext:this.props.triggerContext});if(e.t===1)return k(Mr,{element:e,triggerContext:this.props.triggerContext});if(e.t===11)return k($o,{element:e,triggerContext:this.props.triggerContext});if(e.t===12)return k(Hr,{element:e,item:this.props.triggerContext.triggerData.items[0],triggerContext:this.props.triggerContext});if(e.t===62)return k(jo,{element:e,triggerContext:this.props.triggerContext})}}render(){return this.props.elements.map(e=>this.renderElement(e))}getComponentStyles(){return{}}},Wo=class extends xe{clickAction;isClickable;constructor(e,t){super(e,t),this.clickAction=this.props.element.clc,this.isClickable=this.clickAction?.at===4&&this.clickAction.gu?.u}componentDidMount(){at(()=>{let e=this.props.triggerContext.triggerData,t=this.props.triggerContext.selectedItems;e.calculateDiscountData(t,this.props.triggerContext.shouldGiveFBTDiscount)})}render(){return k(fr,{children:[k("div",{style:this.getCompiledStyles(),class:"lc-container",onClick:()=>{this.onClick({clickAction:this.clickAction})},children:k(tn,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})}),this.props.triggerContext.triggerData.id==="preview"&&k("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)}},At=class as{constructor(t){this.engagementTrigger=t,this.triggerContext=new Oi(new Date,this.engagementTrigger)}static renderedEngagements=[];static engagementIDsWithTrackedDisplay=new Set;static DEBOUNCE_TIME=1e3;rootContainer;widgetElement;widget;triggerContext;observers=[];runtimeData=le.get();widgetAPIService=pe.get(cr);safeHTTPService=pe.get(fe);scrollSubscription;variation;isExclusionWithBVariation;renderSilently(){this.render().catch(t=>Be.getInstance().captureException(t,w({},this.engagementTrigger.sentryContext())))}destroy(){b.log(`${this.engagementTrigger} will be destroyed`),this.scrollSubscription?.unsubscribe(),this.observers.forEach(t=>{t?.disconnect&&t.disconnect()}),this.rootContainer?.remove(),as.engagementIDsWithTrackedDisplay.delete(this.engagementTrigger.shortID)}async render(){if(this.engagementTrigger.hasMultiplePlacement){let t=await this.getVariation();this.handleVariationResponse(t)}if(this.rootContainer=await this.getWidgetContainer(!0),!this.rootContainer){b.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(t){return this.engagementTrigger.shortID===t.shortID}update(t){dh.default.log(`${this.engagementTrigger} will be updated`),this.updateItems(t.items,this.engagementTrigger.items)}shouldStopRendering(){return!this.widget&&!this.isExclusionWithBVariation}async getVariationIfRequired(){if(this.engagementTrigger.isSingleContent()||this.engagementTrigger.widget){b.log(`${this.engagementTrigger} already has required data to render widget`);return}let t=await this.observeWidgetContainerInViewport();this.handleVariationResponse(t)}handleVariationResponse(t){t&&(b.log(`${this.engagementTrigger} visitor has been assigned to variation ${t.variation}`),t.items?.length&&(this.engagementTrigger.items=t.items.map(r=>new Rt(r)),this.engagementTrigger.nonMutableItems=t.items.map(r=>new Rt(r))),t.bundleFrom&&(this.engagementTrigger.bundleFrom=new Rt(t.bundleFrom)),t.discount&&(this.engagementTrigger.discount=t.discount),t.placement&&(this.triggerContext.triggerData.placement=t.placement),t.props&&mh.JSUtils.hasKeys(t.props)&&(this.engagementTrigger.props=w(w({},this.engagementTrigger.props),t.props)),this.triggerContext.triggerData.widget=this.widget=new Ei(t.widget),this.triggerContext.triggerData.contentID=t.contentID,this.triggerContext.triggerData.variation=this.variation=t.variation,this.triggerContext.triggerData.placement=t.placement,this.isExclusionWithBVariation=this.engagementTrigger.isExclusionTesting()&&this.variation==="b",this.isExclusionWithBVariation&&(this.rootContainer.style.height="0.5px"))}addToRendered(){as.renderedEngagements.push(this)}async getVariation(){b.log(`${this.engagementTrigger} get variation`);let t={engagementID:this.engagementTrigger.engagementID,isPreview:this.engagementTrigger.id==="preview"};try{return await this.widgetAPIService.getVariation(t)}catch(r){b.error(`${this.engagementTrigger} unable to get the variation`,r);return}}async observeWidgetContainerInViewport(){if(!this.rootContainer){b.warn(`${this.engagementTrigger} No root container found to watch for viewport`);return}let t=window.innerHeight*.3,r={root:null,rootMargin:`-${t}px 0px ${t}px 0px`,threshold:0};return await this.isInViewport()?this.getVariation():new Promise(n=>{let i=new IntersectionObserver((s,o)=>{s.forEach(async c=>{if(c.isIntersecting){b.log(`${this.engagementTrigger} root container is near the viewport. Fetching variation`);let u=await this.getVariation();n(u),o.unobserve(this.rootContainer)}})},r);i.observe(this.rootContainer),this.observers.push(i)})}attachScroll(){this.scrollSubscription=On(window,"scroll").pipe(ar(as.DEBOUNCE_TIME)).subscribe(()=>{this.checkAndSendEvent()})}async checkAndSendEvent(){let t=this.engagementTrigger.shortID;if(as.engagementIDsWithTrackedDisplay.has(t)||!await this.isInViewport())return;let r={};this.triggerContext.triggerData.items?.length&&(r.promotedMIDs=this.engagementTrigger.items?.map(s=>s.mID));let n=this.isExclusionWithBVariation?N.EVENT_CAMPAIGN_HOLDOUT:N.EVENT_TRIGGER_DISPLAYED,i=new _e(n,r,this.engagementTrigger);i.name===N.EVENT_CAMPAIGN_HOLDOUT&&(i.trigger.holdout=!0),this.safeHTTPService.sendEvent(i),as.engagementIDsWithTrackedDisplay.add(t),this.scrollSubscription.unsubscribe()}generateParentElementID(){return`letscooee-${this.engagementTrigger.shortID}`}async isInViewport(){let t=(await this.getWidgetContainer())?.getBoundingClientRect();if(!t)return!1;let r=window.innerHeight||document.documentElement.clientHeight,n=(Math.min(t.bottom,r)-Math.max(t.top,0))*t.width,i=t.width*t.height,s=n/i*100;return this.engagementTrigger.isAnySplit()?s>0:s>=30}async getWidgetContainer(t){if(this.rootContainer?.isConnected)return this.rootContainer;let r=await this.createParentElementWithPlacement(t);if(r)return r;let n=`.letscooee[data-engagement-id="${this.triggerContext.triggerData.shortID}"]`;return document.querySelector(n)}async createParentElementWithPlacement(t){let r=this.engagementTrigger.placement;if(!r?.selector)return b.warn(`${this.engagementTrigger} does not have a selector`),null;let n=r.selector,i;if(n.includes(N.SHADOW_SPLITTER)){let u=n.split(N.SHADOW_SPLITTER);i=(await re.retrySelector(u[0].trim()))?.shadowRoot,n=u[1].trim(),i&&dt.injectStylesheet(tr.styleURL,i);let p=Le.get().website.commonCSS;i&&p&&dt.injectRawCSS(p,i)}b.debug(`${this.engagementTrigger} attempt to render ${r.position}-${n}`);let s=await re.retrySelector(n,10,i??document);if(!s)return b.warn(`${this.engagementTrigger} no placement found with ${n}`),null;let o=this.generateParentElementID(),c=this.getParentElement(o);if(!t)return c;switch(r.position){case Go.EngagementPlacementPosition.BEFORE:{s.parentElement?.insertBefore(c,s);break}case Go.EngagementPlacementPosition.INSIDE_FIRST:{s.insertBefore(c,s.firstChild);break}case Go.EngagementPlacementPosition.INSIDE_LAST:{s.appendChild(c);break}case Go.EngagementPlacementPosition.AFTER:default:s.parentElement?.insertBefore(c,s.nextSibling)}return c}async startRendering(){let t;try{t=await Ui.refreshItems(this.engagementTrigger)}catch(r){b.error(`${this.engagementTrigger} error refreshing the items`,r);return}if(!t?.length&&this.engagementTrigger.isProductPromoted()){b.warn(`${this.engagementTrigger} is of ${this.engagementTrigger.objective} but no product found`);return}this.engagementTrigger.items=t,this.renderContainer()}getParentElement(t,r=document){let n=r.getElementById(t);if(n)return n;let i=this.engagementTrigger.shortID;return n=document.createElement("div"),n.id=t,n.className=`letscooee letscooee-engagement engagement-${i}`,n.dataset.engagementId=i,this.engagementTrigger.id==="preview"&&(n.className+=" letscooee-preview"),n.style.display="block",n.style.minHeight="0.5px",n.style.minWidth="0.5px",n}renderContainer(){if(!this.widget)return;let t=this.rootContainer;if(this.triggerContext.triggerData.hasSwiperElement()){let r=this.rootContainer?.shadowRoot||this.rootContainer?.attachShadow({mode:"open"}),n=Le.get().website.commonCSS;n&&dt.injectRawCSS(n,r),dt.injectStylesheet(tr.styleURL,r),dt.injectStylesheet("https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css",r),t=r}ns(Ki(Wo,{element:this.widget.cont,triggerContext:this.triggerContext,elements:this.widget.elems}),t),this.addToRendered()}updateItems(t,r){let n=this.getItemDiff(t,r),i=this.getItemDiff(r,t);r.push(...n);for(let s of i)fh.ArrayUtils.remove(r,s)}getItemDiff(t,r){return t.filter(n=>!r.some(i=>i.selectedOrFirstVariant.value.mID===n.selectedOrFirstVariant.value.mID))}},Rr=class Vh extends At{static renderedEngagements=[];constructor(t){super(t)}addToRendered(){Vh.renderedEngagements.push(this)}observeWidgetContainerInViewport(){return this.getVariation()}generateParentElementID(){let t=super.generateParentElementID();return this.engagementTrigger.isSubscriptionUpsell()&&(t+=`-${this.engagementTrigger.items[0].selectedOrFirstVariant.value.mID}`),t}async checkAndSendEvent(){if(!ze.get().isOpen()&&this.runtimeData.pageName!=="cart"){b.log("Do not send display event as neither the cart drawer nor the cart page is open.");return}return super.checkAndSendEvent()}},pc=class Gh{constructor(t,r){this.engagementTrigger=t,this.element=r,this.cartItems=de.getCurrent().items}cartItems;static renderCartUpsell(t){let r=t.placement;if(!r?.selector){b.warn(`No placement available for ${t.objective}`,t.shortID);return}let n=Array.from(document.querySelectorAll(r.selector));if(!n?.length){b.warn(`No placement found for ${t.objective}`,t.shortID);return}for(let i of n)new Gh(t,i).render()}render(){let t=this.findCartItemFromHTMLElement();if(!t||this.engagementTrigger.skipSubscribedItems&&t.selling_plan_allocation)return;let r=this.engagementTrigger.items.find(m=>m.mID===t.product_id.toString());if(!r)return;let n=r.vars.find(m=>m.mID===t.id.toString());if(!n)return;let i=new Sr(n),s=t.selling_plan_allocation?.selling_plan;if(s)for(let m of i.sellingPlans??[])m.mID===s.id.toString()&&(m.isSelected=!0,i.changeSellingPlan(m));let o=new Rt(r);o.vars=[i],o.selectedOrFirstVariant.value=i;let c=`lc-cart-item-${this.engagementTrigger.shortID}-${r.mID}`;this.element.classList.add(c);let u=new Mt(this.engagementTrigger);u.placement.selector=`.${c}`,u.items=[o];let p=new Rr(u);p.renderSilently(),this.watchForCartItemDeletion(p,c)}watchForCartItemDeletion(t,r){let n=new MutationObserver(i=>{i.forEach(s=>{s.removedNodes.forEach(o=>{o===this.element&&(b.debug(`${r} has been removed`),t.destroy(),n.disconnect())})})});n.observe(this.element.parentElement,{childList:!0,subtree:!0})}findCartItemFromHTMLElement(){let t=this.element.innerHTML;return this.cartItems.find(r=>{if(!(t.includes(r.url)||t.includes(r.variant_id))&&(!t.includes(r.product_title)||r.variant_title&&!t.includes(r.variant_title)))return!1;let n=r.selling_plan_allocation?.selling_plan?.name;return!(n&&!t.includes(n))})}},hh=Ce(Gr()),fc=class extends Rr{ctaListener=new en;constructor(e){super(e),Dr.get().subscriber(N.CART_UPDATE_BROADCAST).pipe(qu(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=de.getCurrent(),e.engagementTrigger=this.engagementTrigger,e.setAttribute("engagement",this.engagementTrigger.shortID),this.rootContainer.appendChild(e),this.addToRendered()}async checkMilestone(){let e=await de.getCurrent().getNormalisedCart(),t=[...this.engagementTrigger.progressBarConfig.milestones].reverse().find(r=>r.minValue<e.amount);if(!t){b.log("No milestone achieved yet");return}if(b.log("Current milestone",t),t.rewardType===hh.MilestoneRewardType.FREE_AUTO_GIFT){let r=t.items[0];if(e.items.find(n=>n.vID===r.vID||n.mID===r.mID)){b.log(`Item(vID:${r.vID}) already present in the cart. Updating item's properties`),await this.ctaListener.performUpdate(r,{properties:this.engagementTrigger.getPrivateAttributesForLineItem()});return}else{let n=await this.ctaListener.performAddToCart([r],this.engagementTrigger);ze.get().refreshUI(n,!1),await this.removeOtherFreeGifts(r)}}}async removeOtherFreeGifts(e){let t=(await de.getCurrent().getNormalisedCart()).items.filter(r=>r.vID!==e?.vID&&r.properties[N.CAMPAIGN_ATTRIBUTE]===this.engagementTrigger.shortID);if(t.length)for(let r of t)await this.ctaListener.performUpdate(r,{quantity:0})}},gh=new br({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]}]}]}]}]}),yh=new Xe({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"}),Vo=class extends xe{render(){return k("div",{style:{marginTop:30},class:"lc-container",children:[k(xt,{element:yh,triggerContext:this.props.triggerContext}),k("div",{style:this.getComponentStyles(),children:this.props.triggerContext.triggerData.items.map(e=>{if(e.portraitVideos?.length)return e.portraitVideos.map(t=>k("div",{className:"lc-shoppable-video",style:{flex:"1 1 0",width:"260px"},children:[k("a",{href:e.link,onClick:()=>{this.sendTriggerClicked([new pt(e)],{from:"video"})},children:k("video",{width:"100%",autoplay:!0,muted:!0,loop:!0,children:this.getSources(t.sources)})}),k(Hr,{element:gh,item:e,triggerContext:this.props.triggerContext})]}))})})]})}getSources(e){let t=e.map(i=>k("source",{src:i.url,type:i.mimeType,media:`(max-width:${i.width}px)`})),r=e.filter(i=>i.format==="mp4").sort((i,s)=>s.width-i.width)[0];r&&t.push(k("source",{src:r.url,type:r.mimeType}));let n=e.filter(i=>i.format==="m3u8").sort((i,s)=>s.width-i.width)[0];return n&&t.push(k("source",{src:n.url,type:n.mimeType})),t}getComponentStyles(){return{display:"flex",gap:10,overflowX:"auto",margin:10}}},mc=class extends At{constructor(e){super(e)}shouldStopRendering(){return!1}renderContainer(){ns(Ki(Vo,{element:this.widget?.cont,triggerContext:this.triggerContext}),this.rootContainer)}},vh=Ce(Zn()),dc=class extends At{constructor(e){super(e)}shouldStopRendering(){return!1}renderContainer(){let e=this.getParentElement(`inner-letscooee-${this.engagementTrigger.shortID}`);this.rootContainer.appendChild(e),document.addEventListener(N.ADD_BUNDLE_CTA_INBOUND_EVENT,this.inboundCTAListener.bind(this),!1)}async inboundCTAListener(e){let t=this.engagementTrigger,r=`Engagement(id: ${t.engagementID}, shortID: ${t.shortID})`,n=e.detail;if(!vh.JSUtils.hasKeys(n)){b.error(`No detail received for ${r}`);return}b.log("Detail received for BYOB",n);let i=n.campaignID??n.campaignId??n.campaign_id;if(i!==t.shortID&&i!==t.engagementID){b.warn(`Current ${r} is not BYOB. Received: ${i}`);return}let s=n.items;if(!s?.length)return;let o=s.map(c=>new pt({mID:c.product_id,vID:c.variant_id,quantity:c.quantity||1}));await new ki(this.triggerContext).execute({embeddedItems:o,clickAction:{at:108,applyDiscount:!0}})}},Fi=class{runtimeData=le.get();processCartWidgetResponse(e){this.runtimeData.isCartDirty=!1,this.runtimeData.cartEngagements=e;let t=[...Rr.renderedEngagements];Rr.renderedEngagements.length=0;for(let r of e)b.log(`\u{1F4E3} ${r} received as cart embed`),!this.findAndUpdateCurrent(r,t)&&(b.log(`${r} is new`),r.isProgressBar()?new fc(r).renderSilently():r.isSubscriptionUpsell()?pc.renderCartUpsell(r):new Rr(r).renderSilently());this.removeOldWidgets(t)}processPageWidgetResponse(e){let t=[...At.renderedEngagements];At.renderedEngagements.length=0;for(let r of e)b.log(`\u{1F4E3} ${r} received as page embed`),!this.findAndUpdateCurrent(r,t)&&(b.log(`${r} is new`),r.isShoppableVideo()?new mc(r).renderSilently():r.isBYOB()?new dc(r).renderSilently():new At(r).renderSilently());this.removeOldWidgets(t)}findAndUpdateCurrent(e,t){let r=t.findIndex(n=>n.isSameTrigger(e));return r<0||e.isSubscriptionUpsell()?!1:(t[r].update(e),t[r].renderSilently(),t.splice(r,1),!0)}removeOldWidgets(e){for(let t of e)t.destroy()}},cr=class Wh{static INSTANCE;httpService=pe.get(ht);sessionManager=pe.get(st);runtimeData=le.get();loadWidgetsSubject=new Ct;constructor(){this.loadWidgetsSubject.pipe(ar(300)).subscribe(()=>{this.loadCartWidgets().catch(t=>b.error("Unable to initiate cart widgets",t)),this.loadPageWidgets().catch(t=>b.error("Unable to initiate page widgets",t))}),Dr.get().subscriber(N.CART_UPDATE_BROADCAST).subscribe(()=>this.loadWidgetsSubject.next())}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Wh),this.INSTANCE}loadOrRenderWidgetsAfterCartChange(){this.runtimeData.isCartDirty?this.loadWidgetsSilently():this.renderCachedCartWidgets()}loadPageWidgetsSilently(){st.replaySubject.subscribe(async()=>{this.loadPageWidgets().catch(t=>b.error("Unable to initiate load page widgets",t))})}loadCartWidgetsSilently(){st.replaySubject.subscribe(async()=>{this.loadCartWidgets().catch(t=>b.error("Unable to initiate cart widgets",t))})}loadWidgetsSilently(){st.replaySubject.subscribe(async()=>{this.loadWidgetsSubject.next()})}async loadPageWidgets(){let t=await this.getWidgetProps();b.log("Load widgets",t),this.httpService.post("/v1/engagement/page-widgets",t).then(async r=>{let n=r.widgets.map(i=>new Mt(i));new Fi().processPageWidgetResponse(n)}).catch(r=>{b.error("Error sending widget getter",r)})}async loadCartWidgets(){let t=await this.getWidgetProps();b.log("Load cart widgets",t),this.httpService.post("/v1/engagement/cart-widgets",t).then(async r=>{let n=r.widgets.map(i=>new Mt(i));new Fi().processCartWidgetResponse(n)}).catch(r=>{b.error("Error sending widget getter",r)})}async getVariation(t){let r=await this.getWidgetProps();return this.httpService.post("/v1/engagement/get-variant",w(w({},t),r))}renderCachedCartWidgets(){new Fi().processCartWidgetResponse(this.runtimeData.cartEngagements)}async addSessionContext(t){let r=await this.sessionManager.checkSessionAndGetContext();t.sessionID=r[0],t.sessionNumber=r[1],t.landingPage=r[2],t.page=Cr.parseFromCurrent()}addAvailableEngagementShortIDs(){let t=document.querySelectorAll(".letscooee-engagement"),r=[];return t.forEach(n=>{let i=n.dataset.engagementId;i&&+i&&r.push(i)}),r}async getWidgetProps(){let t={};t.engagementIDs=this.addAvailableEngagementShortIDs(),await this.addSessionContext(t),t.currentItem=this.runtimeData.getCurrentItem();try{t.cart=await de.getCurrent().getNormalisedCart()}catch(s){b.error("Error fetching Shopify cart before sending widget call",s)}let r=new URLSearchParams(location.search),n=r.get("cooee-preview");n?t.previewIDs=n.trim().split(",").filter(s=>Number.isInteger(+s)):this.runtimeData.previewIDs?.length&&(t.previewIDs=this.runtimeData.previewIDs);let i=r.get("cooee-variant");return i?t.previewVariant=i:this.runtimeData.previewVariant&&(t.previewVariant=this.runtimeData.previewVariant),t}},hc=class{runtimeData=le.get();widgetAPIService=pe.get(cr);meddle(){let e=we.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=we.globalRef;e.loadPageWidgets=()=>{this.widgetAPIService.loadPageWidgetsSilently()},e.loadCartWidgets=()=>{this.widgetAPIService.loadCartWidgetsSilently()},e.previewWidget=we.previewWidget.bind(we),e.previewPopup=we.previewPopup.bind(we)}overwritePush(e,t){ci(e,"push",t)}meddleAccount(){this.overwritePush(we.globalRef.account,(...e)=>{this.processAccount(e[0])}),we.globalRef.account.forEach(this.processAccount.bind(this))}meddleEvents(){this.overwritePush(we.globalRef.events,(...e)=>{this.processEvent(e[0])}),we.globalRef.events.forEach(this.processEvent.bind(this))}meddleProfile(){this.overwritePush(we.globalRef.profile,(...e)=>{this.processProfile(e[0])}),we.globalRef.profile.forEach(this.processProfile.bind(this))}meddleScreen(){this.overwritePush(we.globalRef.screen,(...e)=>{this.processPageName(e[0])}),we.globalRef.screen.forEach(this.processPageName.bind(this))}processAccount(e){e&&(e.appID&&we.authenticate(e),e.flags&&Ln.setFlags(e.flags))}processEvent(e){e&&(N.JS_LOAD_WHITELIST_EVENTS.includes(e[0])?we.sendEvent(e[0],e[1],this.runtimeData.jsLoadTime):we.sendEvent(e[0],e[1]))}processProfile(e){e&&we.updateProfile(e)}processPageName(e){e&&we.setPageName(e)}meddlePage(){this.overwritePush(we.globalRef.page,(...e)=>{this.processPage(e[0])}),we.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&&we.setPageName(e.pageName)}},Hi=class{static SESSION_STORAGE=window.sessionStorage;static SESSION_STORAGE_KEY_PREFIX=N.COOEE.concat("-");static getString(e,t){return this.getItem(e)||t}static setString(e,t){this.setItem(e,t)}static remove(e){this.removeItem(e)}static getItem(e){return this.SESSION_STORAGE.getItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e))}static setItem(e,t){this.SESSION_STORAGE.setItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e),t)}static removeItem(e){this.SESSION_STORAGE.removeItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e))}},$i=class Xo{static INSTANCE;static DEBOUNCE_TIME=1e3;static THRESHOLD=10;safeHttpService=pe.get(fe);_lastScreenOrScroll=new Date;lastPercent=0;constructor(){}set lastScreenOrScroll(t){this._lastScreenOrScroll=t}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Xo),this.INSTANCE}resetScrollID(t){Hi.remove(N.SESSION_STORAGE_SCROLL_ID),this.lastScreenOrScroll=t??new Date}listen(){if(window.scrollY){let t=this.getPercentScrolledY();this.shouldSendScroll(t)&&this.sendScroll(t)}re.onDocumentLoaded(()=>{this.observeWindowScroll()})}observeWindowScroll(){On(window,"scroll").pipe(ar(Xo.DEBOUNCE_TIME),Nn(()=>{let t=this.getPercentScrolledY();if(t>100){b.warn("Received scroll percent is more than 100",t);return}if(this.shouldSendScroll(t))return t})).subscribe(t=>{this.sendScroll(t)})}shouldSendScroll(t){return Math.abs(this.lastPercent-t)>=Xo.THRESHOLD||this.lastPercent!==t&&t===100}sendScroll(t){if(t==null)return;let r={percent:t,timeMS:new Date().getTime()-this._lastScreenOrScroll.getTime()};this.lastPercent=t;let n=Hi.getString(N.SESSION_STORAGE_SCROLL_ID,""),i=new _e(N.EVENT_SCROLL,r,null,n);this.safeHttpService.sendEvent(i),Hi.setString(N.SESSION_STORAGE_SCROLL_ID,i.id.toHexString()),this._lastScreenOrScroll=new Date(i.occurred)}getPercentScrolledY(){let t=window.document.body.scrollHeight,r=window.innerHeight;return Math.ceil((window.scrollY+r)/t*100)}},gc=class qh{static ACTIVE_DURATION="aDur";static INACTIVE_DURATION="iaDur";apiService=pe.get(fe);runtimeData=le.get();listen(){document.onvisibilitychange=()=>{document.visibilityState==="visible"?this.onVisible():document.visibilityState==="hidden"&&this.onHidden()}}async onVisible(){}async onHidden(){let t=await this.runtimeData.setInactive();if(t===0){b.info("Not sending background event as user was inactive on website");return}b.info(`Sending background event with ${t} seconds`);let r={};r[qh.ACTIVE_DURATION]=t,this.apiService.sendEvent(new _e(N.EVENT_APP_BACKGROUND,r))}},yc=class{compareCartItemSubject=new Ct;constructor(){this.compareCartItemSubject.pipe(ar(100)).subscribe(this.compareCartItems.bind(this))}listen(){this.compareCartItemSubject.next(),this.overwriteXMLHttpRequest(),this.overwriteFetchMethod()}overwriteXMLHttpRequest(){let e=this,t=window.XMLHttpRequest.prototype.send;window.XMLHttpRequest.prototype.send=function(){return this.addEventListener("load",function(){e.performEvent(this._url).catch(r=>b.error("Unable to process cart change in XMLHttpRequest",r))}),t.apply(this,arguments)},b.debug("Securely overwritten window.XMLHttpRequest.send method")}overwriteFetchMethod(){let e=this,t=window.fetch;window.fetch=function(r){return t.apply(window,arguments).then(n=>(e.performEvent(r.toString()).catch(i=>b.error("Unable to process cart change in fetch",i)),n))},b.debug("Securely overwritten window.fetch method")}async performEvent(e){this.isCartManipulationURL(e)&&(le.get().isCartDirty=!0,this.compareCartItemSubject.next())}isCartManipulationURL(e){return/\/cart\/(add|change|update|clear)/.test(e)}sendChangesAsEvents(e,t){let r=e?.items,n=t.items,i=[],s=[];if(b.debug(`Comparing cart change with old count ${r?.length} to new count ${n.length}`),n?.forEach(o=>{let c=r?.find(u=>u.vID===o.vID);if(c){if(c.quantity!==o.quantity){let u=c.quantity<o.quantity,p=Math.abs(c.quantity-o.quantity),m=ee(w({},o),{quantity:p});u?i.push(m):s.push(m)}r&&re.removeFromArray(r,c)}else i.push(o)}),r)for(let o of r)s.push(o);b.debug(`Cart delta: added: ${i.length}, removed: ${s.length}`),i.length&&this.sendEvent(N.EVENT_ADD_TO_CART,{items:i}),s.length&&e.token===t.token&&this.sendEvent(N.EVENT_REMOVE_FROM_CART,{items:s}),(s.length||i.length)&&Dr.get().broadcast(N.CART_UPDATE_BROADCAST,{itemsAdded:i,itemsRemoved:s})}sendEvent(e,t){let r=new _e(e,t);pe.get(fe).sendEvent(r)}async compareCartItems(){let e=await Oe.get(oe.CURRENT_CART,{}),t=await de.getCurrent().getNormalisedCart(!0);this.sendChangesAsEvents(e,t)}},vc=class{listen(){return this.overwriteFetchMethod(),this}overwriteFetchMethod(){let e=this,t=window.fetch;window.fetch=async function(r,n){try{await e.modifyRequest(r,n)}catch(i){Be.getInstance().captureError("Failed to modify graphql request",i,{body:JSON.stringify(n?.body)})}return t(r,n)},b.debug("Securely overwritten window.fetch method for graphql query")}async modifyRequest(e,t){let r=typeof e=="string"?e:e instanceof Request?e.url:"";if(!(r.includes("graphql.json")&&t?.method==="POST")||!t.body)return;let n;if(typeof t.body=="string")try{n=JSON.parse(t.body)}catch{return}else n=t.body;b.debug("Intercepted fetch request of:",r),n?.query.includes("cartCreate")&&(t.body=await this.updatedBody(n),this.sendBuyNowEvent())}async updatedBody(e){let t=e.variables.input.attributes??[],r=await re.getCartAttributes();return e.variables.input.attributes=[...t,...r],JSON.stringify(e)}sendBuyNowEvent(){let e=le.get().getCurrentItem();if(!e)return;let t=new _e(N.EVENT_BUY_NOW_CLICKED,{items:[e]});fe.getInstance().sendEvent(t)}},ji=class{constructor(e,t){this.selectors=e,this.eventName=t,this.selectorString=e.join(",")}static INSTANCE;elements;selectorString;clickListenerCallback=e=>{let t=e.currentTarget,r=new _e(this.eventName,{class:t.className||void 0,tagName:t.tagName||void 0,id:t.id||void 0});fe.getInstance().sendEvent(r),this.removeClickListener(this.clickListenerCallback)};listenSilently(){this.listen().catch(e=>b.error(e))}async listen(){this.elements=await re.retrySelectorForElements(this.selectorString),this.elements.forEach(e=>{e.addEventListener("click",this.clickListenerCallback)})}removeClickListener(e){this.elements?.forEach(t=>{t.removeEventListener("click",e)})}},_c=class Rc extends ji{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(Rc.selectors,N.EVENT_ITEM_THUMBNAIL_CLICKED)}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Rc),this.INSTANCE}},Ec=class tl extends ji{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(tl.selectors,N.EVENT_REVIEW_CLICKED)}static getInstance(){return this.INSTANCE||(this.INSTANCE=new tl),this.INSTANCE}},Sc=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(){re.onDocumentLoaded(()=>{b.debug("Execution order:","document ready"),this.useLocationHash()})}useLocationHash(){let e=window.location.hash?.substring(1);if(e)if(e.includes(N.HASH_INITIATE_CHECKOUT)){document.dispatchEvent(new Event(N.THIRD_PARTY_CHECKOUT_EVENT));let t=document.querySelector(this.selector);if(!t){b.debug("No clickable cart checkout button found");return}b.debug("Clickable cart checkout button found",t),t.click()}else e.includes(N.HASH_OPEN_CART_DRAWER)&&ze.get().open()}},wc=class{trackSilently(){this.track().catch(e=>Be.getInstance().captureException(e))}async track(){let e=window.Shopify?.checkout,t=window.Shopify?.Checkout;if(!e&&!t)return;let r={};this.processSmallCheckout(e,r),this.processBigCheckout(t,r);let n=this.getTokenFromCurrentURLPath();if(n&&(r.urlToken=n),!Object.keys(r).length){b.warn("No processable data found in",e,t);return}r.referrer=document.referrer,r.url=location.href;let i=await pe.get(st).checkSessionAndGetContext();r.sessionID=i[0],this.trackOrder(r)}processSmallCheckout(e,t){e&&(e.order_id&&(t.orderID=e.order_id.toString()),e.token&&(t.checkoutToken=e.token.toString()),e.customer_id&&(t.customerID=e.customer_id.toString()))}processBigCheckout(e,t){e&&(e.token&&!t.checkoutToken&&(t.checkoutToken=e.token.toString()),e.cartToken&&(t.cartToken=e.cartToken.toString()))}trackOrder(e){b.info("Found order to be send",e),fe.getInstance().trackOrder(e)}getTokenFromCurrentURLPath(){let e=new RegExp("[A-Fa-f0-9]{28,32}");return location.pathname?.split("/").find(t=>t.length&&e.test(t))}},Yo=class{static attachCheckoutListener(){window.gokwikSdk&&window.gokwikSdk.on("checkout_initiated",async()=>{let e=await de.getCurrent().getNormalisedCart(),t={via:"GoKwik",items:e.items,cartToken:e.token,amount:{value:e.amount,currency:e.currency}},r=new _e(N.EVENT_CHECKOUT_STARTED,t);fe.getInstance().sendEvent(r)})}},bc=class{async migrate(){}};Et.escape=_h.MustacheUtils.escapeHtml;var we=class{static globalRef;static authenticated;static async initForMerchantWebsiteOnly(){window.cooeeSDKPreview||(this.initGlobalReference(),await new bc().migrate(),this.autoAuthenticate(),new hc().meddle(),new gc().listen(),new wc().trackSilently(),new en().listen(),new yc().listen(),new vc().listen(),new Sc().listen(),pe.get($i).listen(),pe.get(Ec).listenSilently(),pe.get(_c).listenSilently(),pe.get(cr).loadPageWidgetsSilently(),this.attachGoKwikListeners(),this.storePreviewParams(),this.setupPreviewListeners(),Zt.watch())}static async initForAll(){this.injectWidgetAssets()}static initGlobalReference(){window.CooeeSDK||ci(window,"CooeeSDK",{}),this.globalRef=window.CooeeSDK,ci(this.globalRef,"config",new Le),ci(this.globalRef,"runtimeData",new le),b.debug("Global reference initialised")}static injectWidgetAssets(){if(document.currentScript.src.includes("localhost")){let e="http://localhost:8002";dt.injectScriptURL(`${e}/main.js`),dt.injectStylesheet(`${e}/styles.css`)}else{let e=`https://cdn.jsdelivr.net/npm/@letscooee/web-sdk@${N.SDK_VERSION}`;dt.injectScriptURL(`${e}/dist/widget-sdk.min.js`,"cooee-widget-sdk"),dt.injectStylesheet(`${e}/dist/widget-sdk.min.css`)}}static autoAuthenticate(){let e=Pe.getShopName();e&&this.authenticate({shopifyShop:e})}static authenticate(e){if(this.authenticated)return;let t=e.appID?.trim(),r=e.shopifyShop;if((re.isNull(t)||t.length!==24)&&re.isNull(r)){b.warn("Cooee App ID or Shop name is not configured");return}this.authenticated=!0,pe.get(st).init(e)}static sendEvent(e,t,r){for(let i in t)if(i.length>3&&i.toLowerCase().startsWith("ce "))throw new Error("Event property name cannot start with 'CE '");let n=new _e(e,t);n.occurred=r??new Date,pe.get(fe).sendEvent(n)}static updateProfile(e){for(let t in e)if(t.toLowerCase().startsWith("ce "))throw new Error("User property name cannot start with 'CE '");pe.get(fe).updateProfile(e)}static setPageName(e){if(!e)return;let t=le.get(),r=t.pageName;if(e===r)return;if(t.pageName=e,e==="cart"&&pe.get(cr).loadOrRenderWidgetsAfterCartChange(),N.BLACKLISTED_PAGE_NAMES.some(s=>e.includes(s))){pe.get($i).resetScrollID();return}let n={};r&&(n.ps=r);let i=new _e(N.EVENT_SCREEN_VIEW,n);i.occurred=t.jsLoadTime,pe.get(fe).sendEvent(i),pe.get($i).resetScrollID(i.occurred)}static previewPopup(e,t){new Bi(t).render(e)}static previewWidget(e){new At(new Mt(e)).render()}static setupPreviewListeners(){if(window.opener){try{window.opener.postMessage({action:"COOEE_READY_FOR_PREVIEW"},"*")}catch(e){b.error(e)}window.addEventListener("message",e=>{if(b.debug("Received event",e),!e.origin.includes("letscooee.com")&&!e.origin.includes("localhost"))return;let t=e.data;typeof t=="object"&&(t.action==="POPUP_PREVIEW"?(this.previewPopup(t.engagementTrigger),e.source?.postMessage({action:"PREVIEW_SUCCESSFUL"},e.origin)):t.action==="WIDGET_PREVIEW"&&(this.previewWidget(t.engagementTrigger),e.source?.postMessage({action:"PREVIEW_SUCCESSFUL"},e.origin)))})}}static attachGoKwikListeners(){let e=le.get();window.addEventListener("kp-modal:opened",()=>{e.isGoKwikPopupOpen=!0}),window.addEventListener("user-loggedin",t=>{let{token:r}=t.detail;r&&this.updateProfile({goKwikToken:r})}),window.gokwikSdk?Yo.attachCheckoutListener():window.addEventListener("gokwikLoaded",Yo.attachCheckoutListener)}static storePreviewParams(){let e=le.get(),t=new URLSearchParams(location.search),r=t.get("cooee-preview");r&&(e.previewIDs=r.trim().split(",").filter(i=>Number.isInteger(+i)));let n=t.get("cooee-variant");n&&(e.previewVariant=n)}};b.configure();b.logBrand();b.debug("Execution order:","top");window.cooeeShopifyScriptLoaded||(window.cooeeShopifyScriptLoaded=!0,(async()=>(b.debug("Execution order:","IIFE start"),await we.initForMerchantWebsiteOnly(),await we.initForAll(),b.debug("Execution order:","IIFE end")))());b.debug("Execution order:","bottom");})();
|