@letscooee/web-sdk 9.6.7 → 9.6.9
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/main.min.js +3 -3
- package/dist/widget.min.css +1 -1
- package/dist/widget.min.js +32 -32
- package/package.json +2 -2
package/dist/main.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";(()=>{var ag=Object.create,Oc=Object.defineProperty,cg=Object.defineProperties,lg=Object.getOwnPropertyDescriptor,ug=Object.getOwnPropertyDescriptors,pg=Object.getOwnPropertyNames,up=Object.getOwnPropertySymbols,fg=Object.getPrototypeOf,fp=Object.prototype.hasOwnProperty,mg=Object.prototype.propertyIsEnumerable,pp=(e,t,r)=>t in e?Oc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,w=(e,t)=>{for(var r in t||={})fp.call(t,r)&&pp(e,r,t[r]);if(up)for(var r of up(t))mg.call(t,r)&&pp(e,r,t[r]);return e},te=(e,t)=>cg(e,ug(t)),Ki=(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),dg=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of pg(t))!fp.call(e,i)&&i!==r&&Oc(e,i,{get:()=>t[i],enumerable:!(n=lg(t,i))||n.enumerable});return e},Se=(e,t,r)=>(r=e!=null?ag(fg(e)):{},dg(t||!e||!e.__esModule?Oc(r,"default",{value:e,enumerable:!0}):r,e)),on=ur((e,t)=>{"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],E,y;for(y=1;y<h.length;y++)for(E in h[y])!(E in v)&&h[y].hasOwnProperty(E)&&(v[E]=h[y][E]);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(y,_){_.name&&y.unshift("["+_.name+"]")};var v={},E=function(y,_){Function.prototype.apply.call(y,console,_)};return typeof console>"u"?function(){}:function(y,_){y=Array.prototype.slice.call(y);var D=console.log,P;_.level===n.TIME?(P=(_.name?"["+_.name+"] ":"")+y[0],y[1]==="start"?console.time?console.time(P):v[P]=new Date().getTime():console.timeEnd?console.timeEnd(P):E(D,[P+": "+(new Date().getTime()-v[P])+"ms"])):(_.level===n.WARN&&console.warn?D=console.warn:_.level===n.ERROR&&console.error?D=console.error:_.level===n.INFO&&console.info?D=console.info:_.level===n.DEBUG&&console.debug?D=console.debug:_.level===n.TRACE&&console.trace&&(D=console.trace),h.formatter(y,_),E(D,y))}},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)}),Pc=ur(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MustacheUtils=void 0;var t=class xh{static escapeHtml(n){return String(n).replace(/"/g,i=>xh.entityMap[i])}};e.MustacheUtils=t,t.entityMap={'"':"""}}),Rr=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(g){return g[g.ONCE_PER_USER=1]="ONCE_PER_USER",g[g.ONCE_PER_SESSION=2]="ONCE_PER_SESSION",g[g.EVERY_TIME=3]="EVERY_TIME",g}(t||(e.CriteriaFrequency=t={})),r=function(g){return g[g.ONE_TIME=1]="ONE_TIME",g[g.MULTIPLE=2]="MULTIPLE",g[g.RECURRING=3]="RECURRING",g}(r||(e.ScheduleFrequency=r={})),n=function(g){return g[g.NOW=1]="NOW",g[g.LATER=2]="LATER",g[g.NEVER=3]="NEVER",g}(n||(e.TimePreference=n={})),i=function(g){return g[g.PUBLISHED=1]="PUBLISHED",g[g.DRAFT=2]="DRAFT",g[g.PAUSED=3]="PAUSED",g[g.FAILED=4]="FAILED",g[g.STOPPED=5]="STOPPED",g[g.COMPLETED=6]="COMPLETED",g[g.ARCHIVED=7]="ARCHIVED",g[g.UNINSTALLED=8]="UNINSTALLED",g}(i||(e.EngagementStatus=i={})),s=function(g){return g.CAMPAIGN="CAMPAIGN",g.NATIVE_AB="NATIVE_AB",g.CRO_COPILOT="CRO_COPILOT",g}(s||(e.EngagementType=s={})),o=function(g){return g[g.NONE=0]="NONE",g[g.RULE_BASED=1]="RULE_BASED",g[g.INTENT_BASED=2]="INTENT_BASED",g}(o||(e.TriggerType=o={})),c=function(g){return g[g.SINGLE=1]="SINGLE",g[g.EXCLUSION=2]="EXCLUSION",g[g.ABTESTING=3]="ABTESTING",g}(c||(e.EngagementContentType=c={})),u=function(g){return g[g.ALL=0]="ALL",g[g.NEW_ONLY=1]="NEW_ONLY",g[g.RETURNING_ONLY=2]="RETURNING_ONLY",g}(u||(e.SessionType=u={})),d=function(g){return g[g.ALL=0]="ALL",g[g.LOGGED_IN_ONLY=3]="LOGGED_IN_ONLY",g[g.NON_LOGGED_IN_ONLY=4]="NON_LOGGED_IN_ONLY",g[g.PURCHASED=5]="PURCHASED",g[g.NON_PURCHASED=6]="NON_PURCHASED",g[g.ABANDON_CART=7]="ABANDON_CART",g[g.RETURNING_AND_NON_PURCHASED=8]="RETURNING_AND_NON_PURCHASED",g}(d||(e.VisitorType=d={})),m=function(g){return g.ALL="ALL",g.LOGGED_IN="LOGGED_IN",g.NON_LOGGED_IN="NON_LOGGED_IN",g}(m||(e.LoggedInVisitor=m={})),h=function(g){return g.ALL="ALL",g.PURCHASED="PURCHASED",g.NON_PURCHASED="NON_PURCHASED",g}(h||(e.PurchasedVisitor=h={})),v=function(g){return g[g.NONE=0]="NONE",g[g.ITEM_RECOMMENDATION=1]="ITEM_RECOMMENDATION",g[g.MULTIPLE_ITEMS=2]="MULTIPLE_ITEMS",g[g.SINGLE_ITEM=3]="SINGLE_ITEM",g[g.TOP_SELLING=4]="TOP_SELLING",g[g.STOCK_CLEARANCE=5]="STOCK_CLEARANCE",g[g.NEW_ARRIVALS=6]="NEW_ARRIVALS",g[g.RECENTLY_VIEWED=7]="RECENTLY_VIEWED",g[g.EVENT_ITEM=8]="EVENT_ITEM",g[g.CART_ITEM=9]="CART_ITEM",g[g.BUNDLE=10]="BUNDLE",g[g.CURRENT_ITEM=11]="CURRENT_ITEM",g[g.PURCHASED_PREVIOUSLY=12]="PURCHASED_PREVIOUSLY",g[g.COLLECTION_ITEMS=13]="COLLECTION_ITEMS",g[g.TRENDING_ITEMS=14]="TRENDING_ITEMS",g}(v||(e.EngagementItemSource=v={})),E=function(g){return g[g.LAST_ADDED=1]="LAST_ADDED",g[g.FIRST_ADDED=2]="FIRST_ADDED",g[g.HIGHEST_PRICE=3]="HIGHEST_PRICE",g[g.LOWEST_PRICE=4]="LOWEST_PRICE",g[g.FIRST_MATCHING_TAG=5]="FIRST_MATCHING_TAG",g[g.ALL=6]="ALL",g}(E||(e.CartItemSource=E={})),y=function(g){return g[g.ALL=0]="ALL",g[g.ONLY_ORGANIC=1]="ONLY_ORGANIC",g[g.ONLY_NON_ORGANIC=2]="ONLY_NON_ORGANIC",g[g.INCLUDES=3]="INCLUDES",g[g.EXCLUDES=4]="EXCLUDES",g}(y||(e.UTMCriteria=y={})),_=function(g){return g[g.NONE=0]="NONE",g[g.LIKE=1]="LIKE",g[g.NOT_LIKE=2]="NOT_LIKE",g[g.EQUALS=3]="EQUALS",g[g.NOT_EQUALS=4]="NOT_EQUALS",g}(_||(e.URLCriteria=_={})),D=function(g){return g[g.NONE=0]="NONE",g[g.LESS_THAN=1]="LESS_THAN",g[g.GREATER_THAN=2]="GREATER_THAN",g[g.BETWEEN=3]="BETWEEN",g[g.EQUALS=4]="EQUALS",g}(D||(e.CartCriteria=D={})),P=function(g){return g[g.ALL=0]="ALL",g[g.INCLUDES=1]="INCLUDES",g[g.EXCLUDES=2]="EXCLUDES",g}(P||(e.CartCurrencyOperator=P={})),M=function(g){return g[g.NONE=0]="NONE",g[g.AMOUNT=1]="AMOUNT",g[g.TOTAL_PRODUCT=2]="TOTAL_PRODUCT",g[g.UNIQUE_PRODUCT=3]="UNIQUE_PRODUCT",g}(M||(e.CartFilterEnum=M={})),L=function(g){return g[g.NONE=0]="NONE",g[g.ITEM=1]="ITEM",g[g.COLLECTION=2]="COLLECTION",g}(L||(e.PromotionType=L={})),R=function(g){return g[g.NONE=0]="NONE",g[g.SINGLE=1]="SINGLE",g[g.MULTIPLE=2]="MULTIPLE",g}(R||(e.EngagementCollectionSource=R={})),q=function(g){return g.BEFORE="before",g.AFTER="after",g.INSIDE_FIRST="insideFirst",g.INSIDE_LAST="insideLast",g}(q||(e.EngagementPlacementPosition=q={})),he=function(g){return g.SHOPIFY_CHECKOUT="shopify_checkout",g.THIRD_PARTY_CHECKOUT="third_party_checkout",g.CART_PAGE="cart_page",g.CART_DRAWER="cart_drawer",g}(he||(e.RedirectBehaviour=he={})),ke=function(g){return g.ONCE_IN_SESSION="ONCE_IN_SESSION",g.ACROSS_SESSIONS="ACROSS_SESSIONS",g}(ke||(e.FrequencyType=ke={})),B=function(g){return g.DAYS="DAYS",g.HOURS="HOURS",g.MINUTES="MINUTES",g.SECONDS="SECONDS",g}(B||(e.FrequencyGapUnit=B={})),Z=function(g){return g[g.NONE=0]="NONE",g[g.REJECT_POPUP=1]="REJECT_POPUP",g[g.ACCEPT_POPUP=2]="ACCEPT_POPUP",g[g.GO_TO_URL=4]="GO_TO_URL",g[g.SHARE=5]="SHARE",g[g.KEY_VALUE=100]="KEY_VALUE",g[g.GO_TO_PRODUCT=101]="GO_TO_PRODUCT",g[g.ADD_TO_CART=102]="ADD_TO_CART",g[g.COPY_COUPON_CODE=103]="COPY_COUPON_CODE",g[g.GO_TO_COLLECTION=104]="GO_TO_COLLECTION",g[g.OPEN_CART=105]="OPEN_CART",g[g.SUBMIT_FORM=106]="SUBMIT_FORM",g[g.INITIATE_CHECKOUT=107]="INITIATE_CHECKOUT",g[g.ADD_BUNDLE=108]="ADD_BUNDLE",g[g.UPGRADE_TO_SUBSCRIPTION=109]="UPGRADE_TO_SUBSCRIPTION",g}(Z||(e.ClickActionType=Z={})),z=function(g){return g.POPUP="POPUP",g.PAGE_EMBED="PAGE_EMBED",g.CART_EMBED="CART_EMBED",g.ANNOUNCEMENT_BAR="ANNOUNCEMENT_BAR",g}(z||(e.OnsiteDeliveryType=z={})),J=function(g){return g.PRODUCT_PROMOTION="PRODUCT_PROMOTION",g.BUNDLE_AND_UPSELL="BUNDLE_AND_UPSELL",g.CART_RECOVERY="CART_RECOVERY",g.ANNOUNCEMENT="ANNOUNCEMENT",g.LEAD_GENERATION="LEAD_GENERATION",g.DATA_COLLECTION="DATA_COLLECTION",g.SALE_PROMOTION="SALE_PROMOTION",g.SUBSCRIPTION_UPSELL="SUBSCRIPTION_UPSELL",g.SHOPPABLE_VIDEO="SHOPPABLE_VIDEO",g.BYOB="BYOB",g.PROGRESS_BAR="PROGRESS_BAR",g.BUY_NOW="BUY_NOW",g.EXPERIMENT="EXPERIMENT",g}(J||(e.EngagementObjective=J={})),ge=function(g){return g.COOEE="COOEE",g.KLAVIYO="KLAVIYO",g}(ge||(e.EngagementContentSource=ge={})),$e=function(g){return g.ICONS="ICONS",g.TILES="TILES",g}($e||(e.ProgressBarLayout=$e={})),xe=function(g){return g.FREE_SHIPPING="FREE_SHIPPING",g.DISCOUNT="DISCOUNT",g.FREE_AUTO_GIFT="FREE_AUTO_GIFT",g.FREE_GIFT_SELECT="FREE_GIFT_SELECT",g}(xe||(e.MilestoneRewardType=xe={}))}),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={}))}),Bc=ur(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ArrayUtils=void 0;var t=class Oh{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--,Oh.swap(n,i,s)}}};e.ArrayUtils=t}),Cf=ur((e,t)=>{"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",E="name",y="type",_="vendor",D="version",P="architecture",M="console",L="mobile",R="tablet",q="smarttv",he="wearable",ke="embedded",B=500,Z="Amazon",z="Apple",J="ASUS",ge="BlackBerry",$e="Browser",xe="Chrome",g="Edge",Ke="Firefox",ye="Google",ht="Huawei",ae="LG",ie="Microsoft",lt="Motorola",tr="Opera",lr="Samsung",gt="Sharp",Hr="Sony",Hn="Xiaomi",nn="Zebra",ei="Facebook",qi="Chromium OS",Gn="Mac OS",$n=" Browser",yt=function(W,ce){var ee={};for(var Ce in W)ce[Ce]&&ce[Ce].length%2===0?ee[Ce]=ce[Ce].concat(W[Ce]):ee[Ce]=W[Ce];return ee},$r=function(W){for(var ce={},ee=0;ee<W.length;ee++)ce[W[ee].toUpperCase()]=W[ee];return ce},Gi=function(W,ce){return typeof W===m?a(ce).indexOf(a(W))!==-1:!1},a=function(W){return W.toLowerCase()},l=function(W){return typeof W===m?W.replace(/[^\d\.]/g,s).split(".")[0]:n},p=function(W,ce){if(typeof W===m)return W=W.replace(/^\s\s*/,s),typeof ce===u?W:W.substring(0,B)},T=function(W,ce){for(var ee=0,Ce,Ot,xt,Te,ne,$t;ee<ce.length&&!ne;){var Yi=ce[ee],cs=ce[ee+1];for(Ce=Ot=0;Ce<Yi.length&&!ne&&Yi[Ce];)if(ne=Yi[Ce++].exec(W),ne)for(xt=0;xt<cs.length;xt++)$t=ne[++Ot],Te=cs[xt],typeof Te===d&&Te.length>0?Te.length===2?typeof Te[1]==c?this[Te[0]]=Te[1].call(this,$t):this[Te[0]]=Te[1]:Te.length===3?typeof Te[1]===c&&!(Te[1].exec&&Te[1].test)?this[Te[0]]=$t?Te[1].call(this,$t,Te[2]):n:this[Te[0]]=$t?$t.replace(Te[1],Te[2]):n:Te.length===4&&(this[Te[0]]=$t?Te[3].call(this,$t.replace(Te[1],Te[2])):n):this[Te]=$t||n;ee+=2}},A=function(W,ce){for(var ee in ce)if(typeof ce[ee]===d&&ce[ee].length>0){for(var Ce=0;Ce<ce[ee].length;Ce++)if(Gi(ce[ee][Ce],W))return ee===o?n:ee}else if(Gi(ce[ee],W))return ee===o?n:ee;return ce.hasOwnProperty("*")?ce["*"]:W},U={"1.0":"/8","1.2":"/1","1.3":"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"},G={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"},Ie={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[D,[E,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[D,[E,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[E,D],[/opios[\/ ]+([\w\.]+)/i],[D,[E,tr+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[D,[E,tr+" GX"]],[/\bopr\/([\w\.]+)/i],[D,[E,tr]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[D,[E,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[D,[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,D],[/quark(?:pc)?\/([-\w\.]+)/i],[D,[E,"Quark"]],[/\bddg\/([\w\.]+)/i],[D,[E,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[D,[E,"UC"+$e]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[D,[E,"WeChat"]],[/konqueror\/([\w\.]+)/i],[D,[E,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[D,[E,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[D,[E,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[D,[E,"Smart Lenovo "+$e]],[/(avast|avg)\/([\w\.]+)/i],[[E,/(.+)/,"$1 Secure "+$e],D],[/\bfocus\/([\w\.]+)/i],[D,[E,Ke+" Focus"]],[/\bopt\/([\w\.]+)/i],[D,[E,tr+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[D,[E,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[D,[E,"Dolphin"]],[/coast\/([\w\.]+)/i],[D,[E,tr+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[D,[E,"MIUI"+$n]],[/fxios\/([\w\.-]+)/i],[D,[E,Ke]],[/\bqihoobrowser\/?([\w\.]*)/i],[D,[E,"360"]],[/\b(qq)\/([\w\.]+)/i],[[E,/(.+)/,"$1Browser"],D],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[E,/(.+)/,"$1"+$n],D],[/samsungbrowser\/([\w\.]+)/i],[D,[E,lr+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[D,[E,"Sogou Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[E,"Sogou Mobile"],D],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[E,D],[/(lbbrowser|rekonq)/i,/\[(linkedin)app\]/i],[E],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[D,E],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[E,ei],D],[/(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,D],[/\bgsa\/([\w\.]+) .*safari\//i],[D,[E,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[D,[E,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[D,[E,xe+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[E,xe+" WebView"],D],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[D,[E,"Android "+$e]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[E,D],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[D,[E,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[D,E],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[E,[D,A,U]],[/(webkit|khtml)\/([\w\.]+)/i],[E,D],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[E,"Netscape"],D],[/(wolvic|librewolf)\/([\w\.]+)/i],[E,D],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[D,[E,Ke+" 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,[D,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[E,[D,/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],[v,[_,lr],[y,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],[v,[_,lr],[y,L]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[v,[_,z],[y,L]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[v,[_,z],[y,R]],[/(macintosh);/i],[v,[_,z]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[v,[_,gt],[y,L]],[/(?:honor)([-\w ]+)[;\)]/i],[v,[_,"Honor"],[y,L]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[v,[_,ht],[y,R]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[v,[_,ht],[y,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," "],[_,Hn],[y,L]],[/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[v,/_/g," "],[_,Hn],[y,R]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[v,[_,"OPPO"],[y,L]],[/\b(opd2\d{3}a?) bui/i],[v,[_,"OPPO"],[y,R]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[v,[_,"Vivo"],[y,L]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[v,[_,"Realme"],[y,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,[_,lt],[y,L]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[v,[_,lt],[y,R]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[v,[_,ae],[y,R]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[v,[_,ae],[y,L]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[v,[_,"Lenovo"],[y,R]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[v,/_/g," "],[_,"Nokia"],[y,L]],[/(pixel c)\b/i],[v,[_,ye],[y,R]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[v,[_,ye],[y,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,[_,Hr],[y,L]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[v,"Xperia Tablet"],[_,Hr],[y,R]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[v,[_,"OnePlus"],[y,L]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[v,[_,Z],[y,R]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[v,/(.+)/g,"Fire Phone $1"],[_,Z],[y,L]],[/(playbook);[-\w\),; ]+(rim)/i],[v,_,[y,R]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[v,[_,ge],[y,L]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[v,[_,J],[y,R]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[v,[_,J],[y,L]],[/(nexus 9)/i],[v,[_,"HTC"],[y,R]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[_,[v,/_/g," "],[y,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,[_,"TCL"],[y,R]],[/(itel) ((\w+))/i],[[_,a],v,[y,A,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[v,[_,"Acer"],[y,R]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[v,[_,"Meizu"],[y,L]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[v,[_,"Ulefone"],[y,L]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[v,[_,"Energizer"],[y,L]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[v,[_,"Cat"],[y,L]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[v,[_,"Smartfren"],[y,L]],[/droid.+; (a(?:015|06[35]|142p?))/i],[v,[_,"Nothing"],[y,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],[_,v,[y,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],[_,v,[y,R]],[/(surface duo)/i],[v,[_,ie],[y,R]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[v,[_,"Fairphone"],[y,L]],[/(u304aa)/i],[v,[_,"AT&T"],[y,L]],[/\bsie-(\w*)/i],[v,[_,"Siemens"],[y,L]],[/\b(rct\w+) b/i],[v,[_,"RCA"],[y,R]],[/\b(venue[\d ]{2,7}) b/i],[v,[_,"Dell"],[y,R]],[/\b(q(?:mv|ta)\w+) b/i],[v,[_,"Verizon"],[y,R]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[v,[_,"Barnes & Noble"],[y,R]],[/\b(tm\d{3}\w+) b/i],[v,[_,"NuVision"],[y,R]],[/\b(k88) b/i],[v,[_,"ZTE"],[y,R]],[/\b(nx\d{3}j) b/i],[v,[_,"ZTE"],[y,L]],[/\b(gen\d{3}) b.+49h/i],[v,[_,"Swiss"],[y,L]],[/\b(zur\d{3}) b/i],[v,[_,"Swiss"],[y,R]],[/\b((zeki)?tb.*\b) b/i],[v,[_,"Zeki"],[y,R]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[_,"Dragon Touch"],v,[y,R]],[/\b(ns-?\w{0,9}) b/i],[v,[_,"Insignia"],[y,R]],[/\b((nxa|next)-?\w{0,9}) b/i],[v,[_,"NextBook"],[y,R]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[_,"Voice"],v,[y,L]],[/\b(lvtel\-)?(v1[12]) b/i],[[_,"LvTel"],v,[y,L]],[/\b(ph-1) /i],[v,[_,"Essential"],[y,L]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[v,[_,"Envizen"],[y,R]],[/\b(trio[-\w\. ]+) b/i],[v,[_,"MachSpeed"],[y,R]],[/\btu_(1491) b/i],[v,[_,"Rotor"],[y,R]],[/(shield[\w ]+) b/i],[v,[_,"Nvidia"],[y,R]],[/(sprint) (\w+)/i],[_,v,[y,L]],[/(kin\.[onetw]{3})/i],[[v,/\./g," "],[_,ie],[y,L]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[v,[_,nn],[y,R]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[v,[_,nn],[y,L]],[/smart-tv.+(samsung)/i],[_,[y,q]],[/hbbtv.+maple;(\d+)/i],[[v,/^/,"SmartTV"],[_,lr],[y,q]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[_,ae],[y,q]],[/(apple) ?tv/i],[_,[v,z+" TV"],[y,q]],[/crkey/i],[[v,xe+"cast"],[_,ye],[y,q]],[/droid.+aft(\w+)( bui|\))/i],[v,[_,Z],[y,q]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[v,[_,gt],[y,q]],[/(bravia[\w ]+)( bui|\))/i],[v,[_,Hr],[y,q]],[/(mitv-\w{5}) bui/i],[v,[_,Hn],[y,q]],[/Hbbtv.*(technisat) (.*);/i],[_,v,[y,q]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[_,p],[v,p],[y,q]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[y,q]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[_,v,[y,M]],[/droid.+; (shield) bui/i],[v,[_,"Nvidia"],[y,M]],[/(playstation [345portablevi]+)/i],[v,[_,Hr],[y,M]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[v,[_,ie],[y,M]],[/\b(sm-[lr]\d\d[05][fnuw]?s?)\b/i],[v,[_,lr],[y,he]],[/((pebble))app/i],[_,v,[y,he]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[v,[_,z],[y,he]],[/droid.+; (glass) \d/i],[v,[_,ye],[y,he]],[/droid.+; (wt63?0{2,3})\)/i],[v,[_,nn],[y,he]],[/droid.+; (glass) \d/i],[v,[_,ye],[y,he]],[/(pico) (4|neo3(?: link|pro)?)/i],[_,v,[y,he]],[/; (quest( \d| pro)?)/i],[v,[_,ei],[y,he]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[_,[y,ke]],[/(aeobc)\b/i],[v,[_,Z],[y,ke]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[v,[y,L]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[v,[y,R]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[y,R]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[y,L]],[/(android[-\w\. ]{0,9});.+buil/i],[v,[_,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[D,[E,g+"HTML"]],[/(arkweb)\/([\w\.]+)/i],[E,D],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[D,[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,D],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[D,E]],os:[[/microsoft (windows) (vista|xp)/i],[E,D],[/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i],[E,[D,A,G]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[D,A,G],[E,"Windows"]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[D,/_/g,"."],[E,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[E,Gn],[D,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[D,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,D],[/\(bb(10);/i],[D,[E,ge]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[D,[E,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[D,[E,Ke+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[D,[E,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[D,[E,"watchOS"]],[/crkey\/([\d\.]+)/i],[D,[E,xe+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[E,qi],D],[/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,D],[/(sunos) ?([\w\.\d]*)/i],[[E,"Solaris"],D],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[E,D]]},me=function(W,ce){if(typeof W===d&&(ce=W,W=n),!(this instanceof me))return new me(W,ce).getResult();var ee=typeof r!==u&&r.navigator?r.navigator:n,Ce=W||(ee&&ee.userAgent?ee.userAgent:s),Ot=ee&&ee.userAgentData?ee.userAgentData:n,xt=ce?yt(Ie,ce):Ie,Te=ee&&ee.userAgent==Ce;return this.getBrowser=function(){var ne={};return ne[E]=n,ne[D]=n,T.call(ne,Ce,xt.browser),ne[h]=l(ne[D]),Te&&ee&&ee.brave&&typeof ee.brave.isBrave==c&&(ne[E]="Brave"),ne},this.getCPU=function(){var ne={};return ne[P]=n,T.call(ne,Ce,xt.cpu),ne},this.getDevice=function(){var ne={};return ne[_]=n,ne[v]=n,ne[y]=n,T.call(ne,Ce,xt.device),Te&&!ne[y]&&Ot&&Ot.mobile&&(ne[y]=L),Te&&ne[v]=="Macintosh"&&ee&&typeof ee.standalone!==u&&ee.maxTouchPoints&&ee.maxTouchPoints>2&&(ne[v]="iPad",ne[y]=R),ne},this.getEngine=function(){var ne={};return ne[E]=n,ne[D]=n,T.call(ne,Ce,xt.engine),ne},this.getOS=function(){var ne={};return ne[E]=n,ne[D]=n,T.call(ne,Ce,xt.os),Te&&!ne[E]&&Ot&&Ot.platform&&Ot.platform!="Unknown"&&(ne[E]=Ot.platform.replace(/chrome os/i,qi).replace(/macos/i,Gn)),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 Ce},this.setUA=function(ne){return Ce=typeof ne===m&&ne.length>B?p(ne,B):ne,this},this.setUA(Ce),this};me.VERSION=i,me.BROWSER=$r([E,D,h]),me.CPU=$r([P]),me.DEVICE=$r([v,_,y,M,L,q,R,he,ke]),me.ENGINE=me.OS=$r([E,D]),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 ve=typeof r!==u&&(r.jQuery||r.Zepto);if(ve&&!ve.ua){var je=new me;ve.ua=je.getResult(),ve.ua.get=function(){return je.getUA()},ve.ua.set=function(W){je.setUA(W);var ce=je.getResult();for(var ee in ce)ve.ua[ee]=ce[ee]}}})(typeof window=="object"?window:e)}),Rf=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 d(v,E){if(!c[v]){if(!o[v]){var y=typeof Ki=="function"&&Ki;if(!E&&y)return y(v,!0);if(m)return m(v,!0);var _=new Error("Cannot find module '"+v+"'");throw _.code="MODULE_NOT_FOUND",_}var D=c[v]={exports:{}};o[v][0].call(D.exports,function(P){var M=o[v][1][P];return d(M||P)},D,D.exports,s,o,c,u)}return c[v].exports}for(var m=typeof Ki=="function"&&Ki,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(P),E=u.document.createTextNode("");v.observe(E,{characterData:!0}),m=function(){E.data=h=++h%2}}else if(!u.setImmediate&&typeof u.MessageChannel<"u"){var y=new u.MessageChannel;y.port1.onmessage=P,m=function(){y.port2.postMessage(0)}}else"document"in u&&"onreadystatechange"in u.document.createElement("script")?m=function(){var L=u.document.createElement("script");L.onreadystatechange=function(){P(),L.onreadystatechange=null,L.parentNode.removeChild(L),L=null},u.document.documentElement.appendChild(L)}:m=function(){setTimeout(P,0)};var _,D=[];function P(){_=!0;for(var L,R,q=D.length;q;){for(R=D,D=[],L=-1;++L<q;)R[L]();q=D.length}_=!1}o.exports=M;function M(L){D.push(L)===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 d(){}var m={},h=["REJECTED"],v=["FULFILLED"],E=["PENDING"];o.exports=y;function y(B){if(typeof B!="function")throw new TypeError("resolver must be a function");this.state=E,this.queue=[],this.outcome=void 0,B!==d&&M(this,B)}y.prototype.catch=function(B){return this.then(null,B)},y.prototype.then=function(B,Z){if(typeof B!="function"&&this.state===v||typeof Z!="function"&&this.state===h)return this;var z=new this.constructor(d);if(this.state!==E){var J=this.state===v?B:Z;D(z,J,this.outcome)}else this.queue.push(new _(z,B,Z));return z};function _(B,Z,z){this.promise=B,typeof Z=="function"&&(this.onFulfilled=Z,this.callFulfilled=this.otherCallFulfilled),typeof z=="function"&&(this.onRejected=z,this.callRejected=this.otherCallRejected)}_.prototype.callFulfilled=function(B){m.resolve(this.promise,B)},_.prototype.otherCallFulfilled=function(B){D(this.promise,this.onFulfilled,B)},_.prototype.callRejected=function(B){m.reject(this.promise,B)},_.prototype.otherCallRejected=function(B){D(this.promise,this.onRejected,B)};function D(B,Z,z){u(function(){var J;try{J=Z(z)}catch(ge){return m.reject(B,ge)}J===B?m.reject(B,new TypeError("Cannot resolve promise with itself")):m.resolve(B,J)})}m.resolve=function(B,Z){var z=L(P,Z);if(z.status==="error")return m.reject(B,z.value);var J=z.value;if(J)M(B,J);else{B.state=v,B.outcome=Z;for(var ge=-1,$e=B.queue.length;++ge<$e;)B.queue[ge].callFulfilled(Z)}return B},m.reject=function(B,Z){B.state=h,B.outcome=Z;for(var z=-1,J=B.queue.length;++z<J;)B.queue[z].callRejected(Z);return B};function P(B){var Z=B&&B.then;if(B&&(typeof B=="object"||typeof B=="function")&&typeof Z=="function")return function(){Z.apply(B,arguments)}}function M(B,Z){var z=!1;function J(g){z||(z=!0,m.reject(B,g))}function ge(g){z||(z=!0,m.resolve(B,g))}function $e(){Z(ge,J)}var xe=L($e);xe.status==="error"&&J(xe.value)}function L(B,Z){var z={};try{z.value=B(Z),z.status="success"}catch(J){z.status="error",z.value=J}return z}y.resolve=R;function R(B){return B instanceof this?B:m.resolve(new this(d),B)}y.reject=q;function q(B){var Z=new this(d);return m.reject(Z,B)}y.all=he;function he(B){var Z=this;if(Object.prototype.toString.call(B)!=="[object Array]")return this.reject(new TypeError("must be an array"));var z=B.length,J=!1;if(!z)return this.resolve([]);for(var ge=new Array(z),$e=0,xe=-1,g=new this(d);++xe<z;)Ke(B[xe],xe);return g;function Ke(ye,ht){Z.resolve(ye).then(ae,function(ie){J||(J=!0,m.reject(g,ie))});function ae(ie){ge[ht]=ie,++$e===z&&!J&&(J=!0,m.resolve(g,ge))}}}y.race=ke;function ke(B){var Z=this;if(Object.prototype.toString.call(B)!=="[object Array]")return this.reject(new TypeError("must be an array"));var z=B.length,J=!1;if(!z)return this.resolve([]);for(var ge=-1,$e=new this(d);++ge<z;)xe(B[ge]);return $e;function xe(g){Z.resolve(g).then(function(Ke){J||(J=!0,m.resolve($e,Ke))},function(Ke){J||(J=!0,m.reject($e,Ke))})}}},{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,S){if(!(f 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 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),S=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!f||S)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function E(f,S){f=f||[],S=S||{};try{return new Blob(f,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,x=new I,C=0;C<f.length;C+=1)x.append(f[C]);return x.getBlob(S.type)}}typeof Promise>"u"&&s(3);var y=Promise;function _(f,S){S&&f.then(function(I){S(null,I)},function(I){S(I)})}function D(f,S,I){typeof S=="function"&&f.then(S),typeof I=="function"&&f.catch(I)}function P(f){return typeof f!="string"&&(console.warn(f+" used as a key, but it is not a string."),f=String(f)),f}function M(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var L="local-forage-detect-blob-support",R=void 0,q={},he=Object.prototype.toString,ke="readonly",B="readwrite";function Z(f){for(var S=f.length,I=new ArrayBuffer(S),x=new Uint8Array(I),C=0;C<S;C++)x[C]=f.charCodeAt(C);return I}function z(f){return new y(function(S){var I=f.transaction(L,B),x=E([""]);I.objectStore(L).put(x,"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(f){return typeof R=="boolean"?y.resolve(R):z(f).then(function(S){return R=S,R})}function ge(f){var S=q[f.name],I={};I.promise=new y(function(x,C){I.resolve=x,I.reject=C}),S.deferredOperations.push(I),S.dbReady?S.dbReady=S.dbReady.then(function(){return I.promise}):S.dbReady=I.promise}function $e(f){var S=q[f.name],I=S.deferredOperations.pop();if(I)return I.resolve(),I.promise}function xe(f,S){var I=q[f.name],x=I.deferredOperations.pop();if(x)return x.reject(S),x.promise}function g(f,S){return new y(function(I,x){if(q[f.name]=q[f.name]||Hr(),f.db)if(S)ge(f),f.db.close();else return I(f.db);var C=[f.name];S&&C.push(f.version);var O=h.open.apply(h,C);S&&(O.onupgradeneeded=function(k){var j=O.result;try{j.createObjectStore(f.storeName),k.oldVersion<=1&&j.createObjectStore(L)}catch(H){if(H.name==="ConstraintError")console.warn('The database "'+f.name+'" has been upgraded from version '+k.oldVersion+" to version "+k.newVersion+', but the storage "'+f.storeName+'" already exists.');else throw H}}),O.onerror=function(k){k.preventDefault(),x(O.error)},O.onsuccess=function(){var k=O.result;k.onversionchange=function(j){j.target.close()},I(k),$e(f)}})}function Ke(f){return g(f,!1)}function ye(f){return g(f,!0)}function ht(f,S){if(!f.db)return!0;var I=!f.db.objectStoreNames.contains(f.storeName),x=f.version<f.db.version,C=f.version>f.db.version;if(x&&(f.version!==S&&console.warn('The database "'+f.name+`" can't be downgraded from version `+f.db.version+" to version "+f.version+"."),f.version=f.db.version),C||I){if(I){var O=f.db.version+1;O>f.version&&(f.version=O)}return!0}return!1}function ae(f){return new y(function(S,I){var x=new FileReader;x.onerror=I,x.onloadend=function(C){var O=btoa(C.target.result||"");S({__local_forage_encoded_blob:!0,data:O,type:f.type})},x.readAsBinaryString(f)})}function ie(f){var S=Z(atob(f.data));return E([S],{type:f.type})}function lt(f){return f&&f.__local_forage_encoded_blob}function tr(f){var S=this,I=S._initReady().then(function(){var x=q[S._dbInfo.name];if(x&&x.dbReady)return x.dbReady});return D(I,f,f),I}function lr(f){ge(f);for(var S=q[f.name],I=S.forages,x=0;x<I.length;x++){var C=I[x];C._dbInfo.db&&(C._dbInfo.db.close(),C._dbInfo.db=null)}return f.db=null,Ke(f).then(function(O){return f.db=O,ht(f)?ye(f):O}).then(function(O){f.db=S.db=O;for(var k=0;k<I.length;k++)I[k]._dbInfo.db=O}).catch(function(O){throw xe(f,O),O})}function gt(f,S,I,x){x===void 0&&(x=1);try{var C=f.db.transaction(f.storeName,S);I(null,C)}catch(O){if(x>0&&(!f.db||O.name==="InvalidStateError"||O.name==="NotFoundError"))return y.resolve().then(function(){if(!f.db||O.name==="NotFoundError"&&!f.db.objectStoreNames.contains(f.storeName)&&f.version<=f.db.version)return f.db&&(f.version=f.db.version+1),ye(f)}).then(function(){return lr(f).then(function(){gt(f,S,I,x-1)})}).catch(I);I(O)}}function Hr(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function Hn(f){var S=this,I={db:null};if(f)for(var x in f)I[x]=f[x];var C=q[I.name];C||(C=Hr(),q[I.name]=C),C.forages.push(S),S._initReady||(S._initReady=S.ready,S.ready=tr);var O=[];function k(){return y.resolve()}for(var j=0;j<C.forages.length;j++){var H=C.forages[j];H!==S&&O.push(H._initReady().catch(k))}var V=C.forages.slice(0);return y.all(O).then(function(){return I.db=C.db,Ke(I)}).then(function(F){return I.db=F,ht(I,S._defaultConfig.version)?ye(I):F}).then(function(F){I.db=C.db=F,S._dbInfo=I;for(var Y=0;Y<V.length;Y++){var pe=V[Y];pe!==S&&(pe._dbInfo.db=I.db,pe._dbInfo.version=I.version)}})}function nn(f,S){var I=this;f=P(f);var x=new y(function(C,O){I.ready().then(function(){gt(I._dbInfo,ke,function(k,j){if(k)return O(k);try{var H=j.objectStore(I._dbInfo.storeName),V=H.get(f);V.onsuccess=function(){var F=V.result;F===void 0&&(F=null),lt(F)&&(F=ie(F)),C(F)},V.onerror=function(){O(V.error)}}catch(F){O(F)}})}).catch(O)});return _(x,S),x}function ei(f,S){var I=this,x=new y(function(C,O){I.ready().then(function(){gt(I._dbInfo,ke,function(k,j){if(k)return O(k);try{var H=j.objectStore(I._dbInfo.storeName),V=H.openCursor(),F=1;V.onsuccess=function(){var Y=V.result;if(Y){var pe=Y.value;lt(pe)&&(pe=ie(pe));var Ge=f(pe,Y.key,F++);Ge!==void 0?C(Ge):Y.continue()}else C()},V.onerror=function(){O(V.error)}}catch(Y){O(Y)}})}).catch(O)});return _(x,S),x}function qi(f,S,I){var x=this;f=P(f);var C=new y(function(O,k){var j;x.ready().then(function(){return j=x._dbInfo,he.call(S)==="[object Blob]"?J(j.db).then(function(H){return H?S:ae(S)}):S}).then(function(H){gt(x._dbInfo,B,function(V,F){if(V)return k(V);try{var Y=F.objectStore(x._dbInfo.storeName);H===null&&(H=void 0);var pe=Y.put(H,f);F.oncomplete=function(){H===void 0&&(H=null),O(H)},F.onabort=F.onerror=function(){var Ge=pe.error?pe.error:pe.transaction.error;k(Ge)}}catch(Ge){k(Ge)}})}).catch(k)});return _(C,I),C}function Gn(f,S){var I=this;f=P(f);var x=new y(function(C,O){I.ready().then(function(){gt(I._dbInfo,B,function(k,j){if(k)return O(k);try{var H=j.objectStore(I._dbInfo.storeName),V=H.delete(f);j.oncomplete=function(){C()},j.onerror=function(){O(V.error)},j.onabort=function(){var F=V.error?V.error:V.transaction.error;O(F)}}catch(F){O(F)}})}).catch(O)});return _(x,S),x}function $n(f){var S=this,I=new y(function(x,C){S.ready().then(function(){gt(S._dbInfo,B,function(O,k){if(O)return C(O);try{var j=k.objectStore(S._dbInfo.storeName),H=j.clear();k.oncomplete=function(){x()},k.onabort=k.onerror=function(){var V=H.error?H.error:H.transaction.error;C(V)}}catch(V){C(V)}})}).catch(C)});return _(I,f),I}function yt(f){var S=this,I=new y(function(x,C){S.ready().then(function(){gt(S._dbInfo,ke,function(O,k){if(O)return C(O);try{var j=k.objectStore(S._dbInfo.storeName),H=j.count();H.onsuccess=function(){x(H.result)},H.onerror=function(){C(H.error)}}catch(V){C(V)}})}).catch(C)});return _(I,f),I}function $r(f,S){var I=this,x=new y(function(C,O){if(f<0){C(null);return}I.ready().then(function(){gt(I._dbInfo,ke,function(k,j){if(k)return O(k);try{var H=j.objectStore(I._dbInfo.storeName),V=!1,F=H.openKeyCursor();F.onsuccess=function(){var Y=F.result;if(!Y){C(null);return}f===0||V?C(Y.key):(V=!0,Y.advance(f))},F.onerror=function(){O(F.error)}}catch(Y){O(Y)}})}).catch(O)});return _(x,S),x}function Gi(f){var S=this,I=new y(function(x,C){S.ready().then(function(){gt(S._dbInfo,ke,function(O,k){if(O)return C(O);try{var j=k.objectStore(S._dbInfo.storeName),H=j.openKeyCursor(),V=[];H.onsuccess=function(){var F=H.result;if(!F){x(V);return}V.push(F.key),F.continue()},H.onerror=function(){C(H.error)}}catch(F){C(F)}})}).catch(C)});return _(I,f),I}function a(f,S){S=M.apply(this,arguments);var I=this.config();f=typeof f!="function"&&f||{},f.name||(f.name=f.name||I.name,f.storeName=f.storeName||I.storeName);var x=this,C;if(!f.name)C=y.reject("Invalid arguments");else{var O=f.name===I.name&&x._dbInfo.db,k=O?y.resolve(x._dbInfo.db):Ke(f).then(function(j){var H=q[f.name],V=H.forages;H.db=j;for(var F=0;F<V.length;F++)V[F]._dbInfo.db=j;return j});f.storeName?C=k.then(function(j){if(j.objectStoreNames.contains(f.storeName)){var H=j.version+1;ge(f);var V=q[f.name],F=V.forages;j.close();for(var Y=0;Y<F.length;Y++){var pe=F[Y];pe._dbInfo.db=null,pe._dbInfo.version=H}var Ge=new y(function(Ae,ut){var We=h.open(f.name,H);We.onerror=function(Ht){var Dc=We.result;Dc.close(),ut(Ht)},We.onupgradeneeded=function(){var Ht=We.result;Ht.deleteObjectStore(f.storeName)},We.onsuccess=function(){var Ht=We.result;Ht.close(),Ae(Ht)}});return Ge.then(function(Ae){V.db=Ae;for(var ut=0;ut<F.length;ut++){var We=F[ut];We._dbInfo.db=Ae,$e(We._dbInfo)}}).catch(function(Ae){throw(xe(f,Ae)||y.resolve()).catch(function(){}),Ae})}}):C=k.then(function(j){ge(f);var H=q[f.name],V=H.forages;j.close();for(var F=0;F<V.length;F++){var Y=V[F];Y._dbInfo.db=null}var pe=new y(function(Ge,Ae){var ut=h.deleteDatabase(f.name);ut.onerror=function(){var We=ut.result;We&&We.close(),Ae(ut.error)},ut.onblocked=function(){console.warn('dropInstance blocked for database "'+f.name+'" until all open connections are closed')},ut.onsuccess=function(){var We=ut.result;We&&We.close(),Ge(We)}});return pe.then(function(Ge){H.db=Ge;for(var Ae=0;Ae<V.length;Ae++){var ut=V[Ae];$e(ut._dbInfo)}}).catch(function(Ge){throw(xe(f,Ge)||y.resolve()).catch(function(){}),Ge})})}return _(C,S),C}var l={_driver:"asyncStorage",_initStorage:Hn,_support:v(),iterate:ei,getItem:nn,setItem:qi,removeItem:Gn,clear:$n,length:yt,key:$r,keys:Gi,dropInstance:a};function p(){return typeof openDatabase=="function"}var T="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",A="~~local_forage_type~",U=/^~~local_forage_type~([^~]+)~/,G="__lfsc__:",Ie=G.length,me="arbf",ve="blob",je="si08",W="ui08",ce="uic8",ee="si16",Ce="si32",Ot="ur16",xt="ui32",Te="fl32",ne="fl64",$t=Ie+me.length,Yi=Object.prototype.toString;function cs(f){var S=f.length*.75,I=f.length,x,C=0,O,k,j,H;f[f.length-1]==="="&&(S--,f[f.length-2]==="="&&S--);var V=new ArrayBuffer(S),F=new Uint8Array(V);for(x=0;x<I;x+=4)O=T.indexOf(f[x]),k=T.indexOf(f[x+1]),j=T.indexOf(f[x+2]),H=T.indexOf(f[x+3]),F[C++]=O<<2|k>>4,F[C++]=(k&15)<<4|j>>2,F[C++]=(j&3)<<6|H&63;return V}function Qo(f){var S=new Uint8Array(f),I="",x;for(x=0;x<S.length;x+=3)I+=T[S[x]>>2],I+=T[(S[x]&3)<<4|S[x+1]>>4],I+=T[(S[x+1]&15)<<2|S[x+2]>>6],I+=T[S[x+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 Zh(f,S){var I="";if(f&&(I=Yi.call(f)),f&&(I==="[object ArrayBuffer]"||f.buffer&&Yi.call(f.buffer)==="[object ArrayBuffer]")){var x,C=G;f instanceof ArrayBuffer?(x=f,C+=me):(x=f.buffer,I==="[object Int8Array]"?C+=je:I==="[object Uint8Array]"?C+=W:I==="[object Uint8ClampedArray]"?C+=ce:I==="[object Int16Array]"?C+=ee:I==="[object Uint16Array]"?C+=Ot:I==="[object Int32Array]"?C+=Ce:I==="[object Uint32Array]"?C+=xt:I==="[object Float32Array]"?C+=Te:I==="[object Float64Array]"?C+=ne:S(new Error("Failed to get type for BinaryArray"))),S(C+Qo(x))}else if(I==="[object Blob]"){var O=new FileReader;O.onload=function(){var k=A+f.type+"~"+Qo(this.result);S(G+ve+k)},O.readAsArrayBuffer(f)}else try{S(JSON.stringify(f))}catch(k){console.error("Couldn't convert value into a JSON string: ",f),S(null,k)}}function tp(f){if(f.substring(0,Ie)!==G)return JSON.parse(f);var S=f.substring($t),I=f.substring(Ie,$t),x;if(I===ve&&U.test(S)){var C=S.match(U);x=C[1],S=S.substring(C[0].length)}var O=cs(S);switch(I){case me:return O;case ve:return E([O],{type:x});case je:return new Int8Array(O);case W:return new Uint8Array(O);case ce:return new Uint8ClampedArray(O);case ee:return new Int16Array(O);case Ot:return new Uint16Array(O);case Ce:return new Int32Array(O);case xt:return new Uint32Array(O);case Te:return new Float32Array(O);case ne:return new Float64Array(O);default:throw new Error("Unkown type: "+I)}}var Wa={serialize:Zh,deserialize:tp,stringToBuffer:cs,bufferToString:Qo};function bh(f,S,I,x){f.executeSql("CREATE TABLE IF NOT EXISTS "+S.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],I,x)}function rp(f){var S=this,I={db:null};if(f)for(var x in f)I[x]=typeof f[x]!="string"?f[x].toString():f[x];var C=new y(function(O,k){try{I.db=openDatabase(I.name,String(I.version),I.description,I.size)}catch(j){return k(j)}I.db.transaction(function(j){bh(j,I,function(){S._dbInfo=I,O()},function(H,V){k(V)})},k)});return I.serializer=Wa,C}function Vn(f,S,I,x,C,O){f.executeSql(I,x,C,function(k,j){j.code===j.SYNTAX_ERR?k.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[S.storeName],function(H,V){V.rows.length?O(H,j):bh(H,S,function(){H.executeSql(I,x,C,O)},O)},O):O(k,j)},O)}function ip(f,S){var I=this;f=P(f);var x=new y(function(C,O){I.ready().then(function(){var k=I._dbInfo;k.db.transaction(function(j){Vn(j,k,"SELECT * FROM "+k.storeName+" WHERE key = ? LIMIT 1",[f],function(H,V){var F=V.rows.length?V.rows.item(0).value:null;F&&(F=k.serializer.deserialize(F)),C(F)},function(H,V){O(V)})})}).catch(O)});return _(x,S),x}function sp(f,S){var I=this,x=new y(function(C,O){I.ready().then(function(){var k=I._dbInfo;k.db.transaction(function(j){Vn(j,k,"SELECT * FROM "+k.storeName,[],function(H,V){for(var F=V.rows,Y=F.length,pe=0;pe<Y;pe++){var Ge=F.item(pe),Ae=Ge.value;if(Ae&&(Ae=k.serializer.deserialize(Ae)),Ae=f(Ae,Ge.key,pe+1),Ae!==void 0){C(Ae);return}}C()},function(H,V){O(V)})})}).catch(O)});return _(x,S),x}function Ih(f,S,I,x){var C=this;f=P(f);var O=new y(function(k,j){C.ready().then(function(){S===void 0&&(S=null);var H=S,V=C._dbInfo;V.serializer.serialize(S,function(F,Y){Y?j(Y):V.db.transaction(function(pe){Vn(pe,V,"INSERT OR REPLACE INTO "+V.storeName+" (key, value) VALUES (?, ?)",[f,F],function(){k(H)},function(Ge,Ae){j(Ae)})},function(pe){if(pe.code===pe.QUOTA_ERR){if(x>0){k(Ih.apply(C,[f,H,I,x-1]));return}j(pe)}})})}).catch(j)});return _(O,I),O}function op(f,S,I){return Ih.apply(this,[f,S,I,1])}function ap(f,S){var I=this;f=P(f);var x=new y(function(C,O){I.ready().then(function(){var k=I._dbInfo;k.db.transaction(function(j){Vn(j,k,"DELETE FROM "+k.storeName+" WHERE key = ?",[f],function(){C()},function(H,V){O(V)})})}).catch(O)});return _(x,S),x}function cp(f){var S=this,I=new y(function(x,C){S.ready().then(function(){var O=S._dbInfo;O.db.transaction(function(k){Vn(k,O,"DELETE FROM "+O.storeName,[],function(){x()},function(j,H){C(H)})})}).catch(C)});return _(I,f),I}function lp(f){var S=this,I=new y(function(x,C){S.ready().then(function(){var O=S._dbInfo;O.db.transaction(function(k){Vn(k,O,"SELECT COUNT(key) as c FROM "+O.storeName,[],function(j,H){var V=H.rows.item(0).c;x(V)},function(j,H){C(H)})})}).catch(C)});return _(I,f),I}function hp(f,S){var I=this,x=new y(function(C,O){I.ready().then(function(){var k=I._dbInfo;k.db.transaction(function(j){Vn(j,k,"SELECT key FROM "+k.storeName+" WHERE id = ? LIMIT 1",[f+1],function(H,V){var F=V.rows.length?V.rows.item(0).key:null;C(F)},function(H,V){O(V)})})}).catch(O)});return _(x,S),x}function dp(f){var S=this,I=new y(function(x,C){S.ready().then(function(){var O=S._dbInfo;O.db.transaction(function(k){Vn(k,O,"SELECT key FROM "+O.storeName,[],function(j,H){for(var V=[],F=0;F<H.rows.length;F++)V.push(H.rows.item(F).key);x(V)},function(j,H){C(H)})})}).catch(C)});return _(I,f),I}function gp(f){return new y(function(S,I){f.transaction(function(x){x.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(C,O){for(var k=[],j=0;j<O.rows.length;j++)k.push(O.rows.item(j).name);S({db:f,storeNames:k})},function(C,O){I(O)})},function(x){I(x)})})}function vp(f,S){S=M.apply(this,arguments);var I=this.config();f=typeof f!="function"&&f||{},f.name||(f.name=f.name||I.name,f.storeName=f.storeName||I.storeName);var x=this,C;return f.name?C=new y(function(O){var k;f.name===I.name?k=x._dbInfo.db:k=openDatabase(f.name,"","",0),f.storeName?O({db:k,storeNames:[f.storeName]}):O(gp(k))}).then(function(O){return new y(function(k,j){O.db.transaction(function(H){function V(Ge){return new y(function(Ae,ut){H.executeSql("DROP TABLE IF EXISTS "+Ge,[],function(){Ae()},function(We,Ht){ut(Ht)})})}for(var F=[],Y=0,pe=O.storeNames.length;Y<pe;Y++)F.push(V(O.storeNames[Y]));y.all(F).then(function(){k()}).catch(function(Ge){j(Ge)})},function(H){j(H)})})}):C=y.reject("Invalid arguments"),_(C,S),C}var yp={_driver:"webSQLStorage",_initStorage:rp,_support:p(),iterate:sp,getItem:ip,setItem:op,removeItem:ap,clear:cp,length:lp,key:hp,keys:dp,dropInstance:vp};function bp(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function Th(f,S){var I=f.name+"/";return f.storeName!==S.storeName&&(I+=f.storeName+"/"),I}function wp(){var f="_localforage_support_test";try{return localStorage.setItem(f,!0),localStorage.removeItem(f),!1}catch{return!0}}function _p(){return!wp()||localStorage.length>0}function Ep(f){var S=this,I={};if(f)for(var x in f)I[x]=f[x];return I.keyPrefix=Th(f,S._defaultConfig),_p()?(S._dbInfo=I,I.serializer=Wa,y.resolve()):y.reject()}function Sp(f){var S=this,I=S.ready().then(function(){for(var x=S._dbInfo.keyPrefix,C=localStorage.length-1;C>=0;C--){var O=localStorage.key(C);O.indexOf(x)===0&&localStorage.removeItem(O)}});return _(I,f),I}function Ip(f,S){var I=this;f=P(f);var x=I.ready().then(function(){var C=I._dbInfo,O=localStorage.getItem(C.keyPrefix+f);return O&&(O=C.serializer.deserialize(O)),O});return _(x,S),x}function Tp(f,S){var I=this,x=I.ready().then(function(){for(var C=I._dbInfo,O=C.keyPrefix,k=O.length,j=localStorage.length,H=1,V=0;V<j;V++){var F=localStorage.key(V);if(F.indexOf(O)===0){var Y=localStorage.getItem(F);if(Y&&(Y=C.serializer.deserialize(Y)),Y=f(Y,F.substring(k),H++),Y!==void 0)return Y}}});return _(x,S),x}function Cp(f,S){var I=this,x=I.ready().then(function(){var C=I._dbInfo,O;try{O=localStorage.key(f)}catch{O=null}return O&&(O=O.substring(C.keyPrefix.length)),O});return _(x,S),x}function Dp(f){var S=this,I=S.ready().then(function(){for(var x=S._dbInfo,C=localStorage.length,O=[],k=0;k<C;k++){var j=localStorage.key(k);j.indexOf(x.keyPrefix)===0&&O.push(j.substring(x.keyPrefix.length))}return O});return _(I,f),I}function Np(f){var S=this,I=S.keys().then(function(x){return x.length});return _(I,f),I}function xp(f,S){var I=this;f=P(f);var x=I.ready().then(function(){var C=I._dbInfo;localStorage.removeItem(C.keyPrefix+f)});return _(x,S),x}function Op(f,S,I){var x=this;f=P(f);var C=x.ready().then(function(){S===void 0&&(S=null);var O=S;return new y(function(k,j){var H=x._dbInfo;H.serializer.serialize(S,function(V,F){if(F)j(F);else try{localStorage.setItem(H.keyPrefix+f,V),k(O)}catch(Y){(Y.name==="QuotaExceededError"||Y.name==="NS_ERROR_DOM_QUOTA_REACHED")&&j(Y),j(Y)}})})});return _(C,I),C}function Ap(f,S){if(S=M.apply(this,arguments),f=typeof f!="function"&&f||{},!f.name){var I=this.config();f.name=f.name||I.name,f.storeName=f.storeName||I.storeName}var x=this,C;return f.name?C=new y(function(O){f.storeName?O(Th(f,x._defaultConfig)):O(f.name+"/")}).then(function(O){for(var k=localStorage.length-1;k>=0;k--){var j=localStorage.key(k);j.indexOf(O)===0&&localStorage.removeItem(j)}}):C=y.reject("Invalid arguments"),_(C,S),C}var Pp={_driver:"localStorageWrapper",_initStorage:Ep,_support:bp(),iterate:Tp,getItem:Ip,setItem:Op,removeItem:xp,clear:Sp,length:Np,key:Cp,keys:Dp,dropInstance:Ap},Rp=function(f,S){return f===S||typeof f=="number"&&typeof S=="number"&&isNaN(f)&&isNaN(S)},kp=function(f,S){for(var I=f.length,x=0;x<I;){if(Rp(f[x],S))return!0;x++}return!1},Ch=Array.isArray||function(f){return Object.prototype.toString.call(f)==="[object Array]"},to={},Dh={},zi={INDEXEDDB:l,WEBSQL:yp,LOCALSTORAGE:Pp},Lp=[zi.INDEXEDDB._driver,zi.WEBSQL._driver,zi.LOCALSTORAGE._driver],Xo=["dropInstance"],Ka=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Xo),Up={description:"",driver:Lp.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function Mp(f,S){f[S]=function(){var I=arguments;return f.ready().then(function(){return f[S].apply(f,I)})}}function Cc(){for(var f=1;f<arguments.length;f++){var S=arguments[f];if(S)for(var I in S)S.hasOwnProperty(I)&&(Ch(S[I])?arguments[0][I]=S[I].slice():arguments[0][I]=S[I])}return arguments[0]}var Bp=function(){function f(S){d(this,f);for(var I in zi)if(zi.hasOwnProperty(I)){var x=zi[I],C=x._driver;this[I]=C,to[C]||this.defineDriver(x)}this._defaultConfig=Cc({},Up),this._config=Cc({},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 f.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},f.prototype.defineDriver=function(S,I,x){var C=new y(function(O,k){try{var j=S._driver,H=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!S._driver){k(H);return}for(var V=Ka.concat("_initStorage"),F=0,Y=V.length;F<Y;F++){var pe=V[F],Ge=!kp(Xo,pe);if((Ge||S[pe])&&typeof S[pe]!="function"){k(H);return}}var Ae=function(){for(var We=function(jp){return function(){var Fp=new Error("Method "+jp+" is not implemented by the current driver"),Nh=y.reject(Fp);return _(Nh,arguments[arguments.length-1]),Nh}},Ht=0,Dc=Xo.length;Ht<Dc;Ht++){var Nc=Xo[Ht];S[Nc]||(S[Nc]=We(Nc))}};Ae();var ut=function(We){to[j]&&console.info("Redefining LocalForage driver: "+j),to[j]=S,Dh[j]=We,O()};"_support"in S?S._support&&typeof S._support=="function"?S._support().then(ut,k):ut(!!S._support):ut(!0)}catch(We){k(We)}});return D(C,I,x),C},f.prototype.driver=function(){return this._driver||null},f.prototype.getDriver=function(S,I,x){var C=to[S]?y.resolve(to[S]):y.reject(new Error("Driver not found."));return D(C,I,x),C},f.prototype.getSerializer=function(S){var I=y.resolve(Wa);return D(I,S),I},f.prototype.ready=function(S){var I=this,x=I._driverSet.then(function(){return I._ready===null&&(I._ready=I._initDriver()),I._ready});return D(x,S,S),x},f.prototype.setDriver=function(S,I,x){var C=this;Ch(S)||(S=[S]);var O=this._getSupportedDrivers(S);function k(){C._config.driver=C.driver()}function j(F){return C._extend(F),k(),C._ready=C._initStorage(C._config),C._ready}function H(F){return function(){var Y=0;function pe(){for(;Y<F.length;){var Ge=F[Y];return Y++,C._dbInfo=null,C._ready=null,C.getDriver(Ge).then(j).catch(pe)}k();var Ae=new Error("No available storage method found.");return C._driverSet=y.reject(Ae),C._driverSet}return pe()}}var V=this._driverSet!==null?this._driverSet.catch(function(){return y.resolve()}):y.resolve();return this._driverSet=V.then(function(){var F=O[0];return C._dbInfo=null,C._ready=null,C.getDriver(F).then(function(Y){C._driver=Y._driver,k(),C._wrapLibraryMethodsWithReady(),C._initDriver=H(O)})}).catch(function(){k();var F=new Error("No available storage method found.");return C._driverSet=y.reject(F),C._driverSet}),D(this._driverSet,I,x),this._driverSet},f.prototype.supports=function(S){return!!Dh[S]},f.prototype._extend=function(S){Cc(this,S)},f.prototype._getSupportedDrivers=function(S){for(var I=[],x=0,C=S.length;x<C;x++){var O=S[x];this.supports(O)&&I.push(O)}return I},f.prototype._wrapLibraryMethodsWithReady=function(){for(var S=0,I=Ka.length;S<I;S++)Mp(this,Ka[S])},f.prototype.createInstance=function(S){return new f(S)},f}(),$p=new Bp;o.exports=$p},{3:3}]},{},[4])(4)})}),ti=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(d){d(u)})}return new(s||(s=Promise))(function(u,d){function m(E){try{v(o.next(E))}catch(y){d(y)}}function h(E){try{v(o.throw(E))}catch(y){d(y)}}function v(E){E.done?u(E.value):c(E.value).then(m,h)}v((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)/)}),Ju=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}),ih=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,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(E,y){var _=function(P){var M=typeof Request<"u"&&u instanceof Request?u.clone():u;s(M,d).then(function(L){if(Array.isArray(v)&&v.indexOf(L.status)===-1)E(L);else if(typeof v=="function")try{return Promise.resolve(v(P,null,L)).then(function(R){R?D(P,null,L):E(L)}).catch(y)}catch(R){y(R)}else P<m?D(P,null,L):E(L)}).catch(function(L){if(typeof v=="function")try{Promise.resolve(v(P,L,null)).then(function(R){R?D(P,L,null):y(L)}).catch(function(R){y(R)})}catch(R){y(R)}else P<m?D(P,L,null):y(L)})};function D(P,M,L){var R=typeof h=="function"?h(P,M,L):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})}),mp="9.6.7",N=class xc{static SDK_VERSION=mp;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_EXPERIMENT_START="CE Experiment Start";static EVENT_VIDEO_DIALOG_CLOSED="CE Video Dialog Closed";static EVENT_VIDEO_DIALOG_OPENED="CE Video Dialog Opened";static EVENT_VIDEO_CHANGE="CE Video Changed";static EVENT_LAST_VIDEO_ENDED="CE Last Video Ended";static EVENT_VIDEO_MUTED="CE Video Muted";static EVENT_VIDEO_UNMUTED="CE Video Unmuted";static EVENT_ADD_TO_CART_CLICKED="CE Add To Cart Clicked";static EVENT_VIEW_ITEM_CLICKED="CE View Item Clicked";static EVENT_MORE_ITEM_INFO_CLICKED="CE More Item Info Clicked";static EVENT_OPEN_CART_CLICKED="CE Open Cart Clicked";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 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)}},Dt={apiURL:"https://api.sdk.letscooee.com",debug:!1,mode:"production",styleURL:`https://cdn.jsdelivr.net/npm/@letscooee/web-sdk@${N.SDK_VERSION}/dist/widget.min.css`,widgetURL:`https://cdn.jsdelivr.net/npm/@letscooee/web-sdk@${N.SDK_VERSION}/dist/widget.min.js`},Pt=Se(on()),b=class{static log(...e){Pt.default.info(...e)}static debug(...e){Pt.default.debug(...e)}static error(...e){Pt.default.error(...e)}static warn(...e){Pt.default.warn(...e)}static info(...e){Pt.default.info(...e)}static trace(...e){Pt.default.trace(...e)}static configure(e=N.LOG_PREFIX){Pt.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?Pt.default.setLevel(Pt.default[localStorage.cooeeLogLevel]):Pt.default.setLevel(Dt.debug?Pt.default.TRACE:Pt.default.OFF)}static getDebugParam(){return new URL(location.href).searchParams?.get("cooee-debug")}static logBrand(){let e=`
|
|
1
|
+
"use strict";(()=>{var ag=Object.create,Oc=Object.defineProperty,cg=Object.defineProperties,lg=Object.getOwnPropertyDescriptor,ug=Object.getOwnPropertyDescriptors,pg=Object.getOwnPropertyNames,up=Object.getOwnPropertySymbols,fg=Object.getPrototypeOf,fp=Object.prototype.hasOwnProperty,mg=Object.prototype.propertyIsEnumerable,pp=(e,t,r)=>t in e?Oc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,w=(e,t)=>{for(var r in t||={})fp.call(t,r)&&pp(e,r,t[r]);if(up)for(var r of up(t))mg.call(t,r)&&pp(e,r,t[r]);return e},te=(e,t)=>cg(e,ug(t)),Ki=(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),dg=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of pg(t))!fp.call(e,i)&&i!==r&&Oc(e,i,{get:()=>t[i],enumerable:!(n=lg(t,i))||n.enumerable});return e},Se=(e,t,r)=>(r=e!=null?ag(fg(e)):{},dg(t||!e||!e.__esModule?Oc(r,"default",{value:e,enumerable:!0}):r,e)),on=ur((e,t)=>{"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],E,y;for(y=1;y<h.length;y++)for(E in h[y])!(E in v)&&h[y].hasOwnProperty(E)&&(v[E]=h[y][E]);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(y,_){_.name&&y.unshift("["+_.name+"]")};var v={},E=function(y,_){Function.prototype.apply.call(y,console,_)};return typeof console>"u"?function(){}:function(y,_){y=Array.prototype.slice.call(y);var D=console.log,P;_.level===n.TIME?(P=(_.name?"["+_.name+"] ":"")+y[0],y[1]==="start"?console.time?console.time(P):v[P]=new Date().getTime():console.timeEnd?console.timeEnd(P):E(D,[P+": "+(new Date().getTime()-v[P])+"ms"])):(_.level===n.WARN&&console.warn?D=console.warn:_.level===n.ERROR&&console.error?D=console.error:_.level===n.INFO&&console.info?D=console.info:_.level===n.DEBUG&&console.debug?D=console.debug:_.level===n.TRACE&&console.trace&&(D=console.trace),h.formatter(y,_),E(D,y))}},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)}),Pc=ur(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MustacheUtils=void 0;var t=class xh{static escapeHtml(n){return String(n).replace(/"/g,i=>xh.entityMap[i])}};e.MustacheUtils=t,t.entityMap={'"':"""}}),Rr=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(g){return g[g.ONCE_PER_USER=1]="ONCE_PER_USER",g[g.ONCE_PER_SESSION=2]="ONCE_PER_SESSION",g[g.EVERY_TIME=3]="EVERY_TIME",g}(t||(e.CriteriaFrequency=t={})),r=function(g){return g[g.ONE_TIME=1]="ONE_TIME",g[g.MULTIPLE=2]="MULTIPLE",g[g.RECURRING=3]="RECURRING",g}(r||(e.ScheduleFrequency=r={})),n=function(g){return g[g.NOW=1]="NOW",g[g.LATER=2]="LATER",g[g.NEVER=3]="NEVER",g}(n||(e.TimePreference=n={})),i=function(g){return g[g.PUBLISHED=1]="PUBLISHED",g[g.DRAFT=2]="DRAFT",g[g.PAUSED=3]="PAUSED",g[g.FAILED=4]="FAILED",g[g.STOPPED=5]="STOPPED",g[g.COMPLETED=6]="COMPLETED",g[g.ARCHIVED=7]="ARCHIVED",g[g.UNINSTALLED=8]="UNINSTALLED",g}(i||(e.EngagementStatus=i={})),s=function(g){return g.CAMPAIGN="CAMPAIGN",g.NATIVE_AB="NATIVE_AB",g.CRO_COPILOT="CRO_COPILOT",g}(s||(e.EngagementType=s={})),o=function(g){return g[g.NONE=0]="NONE",g[g.RULE_BASED=1]="RULE_BASED",g[g.INTENT_BASED=2]="INTENT_BASED",g}(o||(e.TriggerType=o={})),c=function(g){return g[g.SINGLE=1]="SINGLE",g[g.EXCLUSION=2]="EXCLUSION",g[g.ABTESTING=3]="ABTESTING",g}(c||(e.EngagementContentType=c={})),u=function(g){return g[g.ALL=0]="ALL",g[g.NEW_ONLY=1]="NEW_ONLY",g[g.RETURNING_ONLY=2]="RETURNING_ONLY",g}(u||(e.SessionType=u={})),d=function(g){return g[g.ALL=0]="ALL",g[g.LOGGED_IN_ONLY=3]="LOGGED_IN_ONLY",g[g.NON_LOGGED_IN_ONLY=4]="NON_LOGGED_IN_ONLY",g[g.PURCHASED=5]="PURCHASED",g[g.NON_PURCHASED=6]="NON_PURCHASED",g[g.ABANDON_CART=7]="ABANDON_CART",g[g.RETURNING_AND_NON_PURCHASED=8]="RETURNING_AND_NON_PURCHASED",g}(d||(e.VisitorType=d={})),m=function(g){return g.ALL="ALL",g.LOGGED_IN="LOGGED_IN",g.NON_LOGGED_IN="NON_LOGGED_IN",g}(m||(e.LoggedInVisitor=m={})),h=function(g){return g.ALL="ALL",g.PURCHASED="PURCHASED",g.NON_PURCHASED="NON_PURCHASED",g}(h||(e.PurchasedVisitor=h={})),v=function(g){return g[g.NONE=0]="NONE",g[g.ITEM_RECOMMENDATION=1]="ITEM_RECOMMENDATION",g[g.MULTIPLE_ITEMS=2]="MULTIPLE_ITEMS",g[g.SINGLE_ITEM=3]="SINGLE_ITEM",g[g.TOP_SELLING=4]="TOP_SELLING",g[g.STOCK_CLEARANCE=5]="STOCK_CLEARANCE",g[g.NEW_ARRIVALS=6]="NEW_ARRIVALS",g[g.RECENTLY_VIEWED=7]="RECENTLY_VIEWED",g[g.EVENT_ITEM=8]="EVENT_ITEM",g[g.CART_ITEM=9]="CART_ITEM",g[g.BUNDLE=10]="BUNDLE",g[g.CURRENT_ITEM=11]="CURRENT_ITEM",g[g.PURCHASED_PREVIOUSLY=12]="PURCHASED_PREVIOUSLY",g[g.COLLECTION_ITEMS=13]="COLLECTION_ITEMS",g[g.TRENDING_ITEMS=14]="TRENDING_ITEMS",g}(v||(e.EngagementItemSource=v={})),E=function(g){return g[g.LAST_ADDED=1]="LAST_ADDED",g[g.FIRST_ADDED=2]="FIRST_ADDED",g[g.HIGHEST_PRICE=3]="HIGHEST_PRICE",g[g.LOWEST_PRICE=4]="LOWEST_PRICE",g[g.FIRST_MATCHING_TAG=5]="FIRST_MATCHING_TAG",g[g.ALL=6]="ALL",g}(E||(e.CartItemSource=E={})),y=function(g){return g[g.ALL=0]="ALL",g[g.ONLY_ORGANIC=1]="ONLY_ORGANIC",g[g.ONLY_NON_ORGANIC=2]="ONLY_NON_ORGANIC",g[g.INCLUDES=3]="INCLUDES",g[g.EXCLUDES=4]="EXCLUDES",g}(y||(e.UTMCriteria=y={})),_=function(g){return g[g.NONE=0]="NONE",g[g.LIKE=1]="LIKE",g[g.NOT_LIKE=2]="NOT_LIKE",g[g.EQUALS=3]="EQUALS",g[g.NOT_EQUALS=4]="NOT_EQUALS",g}(_||(e.URLCriteria=_={})),D=function(g){return g[g.NONE=0]="NONE",g[g.LESS_THAN=1]="LESS_THAN",g[g.GREATER_THAN=2]="GREATER_THAN",g[g.BETWEEN=3]="BETWEEN",g[g.EQUALS=4]="EQUALS",g}(D||(e.CartCriteria=D={})),P=function(g){return g[g.ALL=0]="ALL",g[g.INCLUDES=1]="INCLUDES",g[g.EXCLUDES=2]="EXCLUDES",g}(P||(e.CartCurrencyOperator=P={})),M=function(g){return g[g.NONE=0]="NONE",g[g.AMOUNT=1]="AMOUNT",g[g.TOTAL_PRODUCT=2]="TOTAL_PRODUCT",g[g.UNIQUE_PRODUCT=3]="UNIQUE_PRODUCT",g}(M||(e.CartFilterEnum=M={})),L=function(g){return g[g.NONE=0]="NONE",g[g.ITEM=1]="ITEM",g[g.COLLECTION=2]="COLLECTION",g}(L||(e.PromotionType=L={})),R=function(g){return g[g.NONE=0]="NONE",g[g.SINGLE=1]="SINGLE",g[g.MULTIPLE=2]="MULTIPLE",g}(R||(e.EngagementCollectionSource=R={})),q=function(g){return g.BEFORE="before",g.AFTER="after",g.INSIDE_FIRST="insideFirst",g.INSIDE_LAST="insideLast",g}(q||(e.EngagementPlacementPosition=q={})),he=function(g){return g.SHOPIFY_CHECKOUT="shopify_checkout",g.THIRD_PARTY_CHECKOUT="third_party_checkout",g.CART_PAGE="cart_page",g.CART_DRAWER="cart_drawer",g}(he||(e.RedirectBehaviour=he={})),ke=function(g){return g.ONCE_IN_SESSION="ONCE_IN_SESSION",g.ACROSS_SESSIONS="ACROSS_SESSIONS",g}(ke||(e.FrequencyType=ke={})),B=function(g){return g.DAYS="DAYS",g.HOURS="HOURS",g.MINUTES="MINUTES",g.SECONDS="SECONDS",g}(B||(e.FrequencyGapUnit=B={})),Z=function(g){return g[g.NONE=0]="NONE",g[g.REJECT_POPUP=1]="REJECT_POPUP",g[g.ACCEPT_POPUP=2]="ACCEPT_POPUP",g[g.GO_TO_URL=4]="GO_TO_URL",g[g.SHARE=5]="SHARE",g[g.KEY_VALUE=100]="KEY_VALUE",g[g.GO_TO_PRODUCT=101]="GO_TO_PRODUCT",g[g.ADD_TO_CART=102]="ADD_TO_CART",g[g.COPY_COUPON_CODE=103]="COPY_COUPON_CODE",g[g.GO_TO_COLLECTION=104]="GO_TO_COLLECTION",g[g.OPEN_CART=105]="OPEN_CART",g[g.SUBMIT_FORM=106]="SUBMIT_FORM",g[g.INITIATE_CHECKOUT=107]="INITIATE_CHECKOUT",g[g.ADD_BUNDLE=108]="ADD_BUNDLE",g[g.UPGRADE_TO_SUBSCRIPTION=109]="UPGRADE_TO_SUBSCRIPTION",g}(Z||(e.ClickActionType=Z={})),z=function(g){return g.POPUP="POPUP",g.PAGE_EMBED="PAGE_EMBED",g.CART_EMBED="CART_EMBED",g.ANNOUNCEMENT_BAR="ANNOUNCEMENT_BAR",g}(z||(e.OnsiteDeliveryType=z={})),J=function(g){return g.PRODUCT_PROMOTION="PRODUCT_PROMOTION",g.BUNDLE_AND_UPSELL="BUNDLE_AND_UPSELL",g.CART_RECOVERY="CART_RECOVERY",g.ANNOUNCEMENT="ANNOUNCEMENT",g.LEAD_GENERATION="LEAD_GENERATION",g.DATA_COLLECTION="DATA_COLLECTION",g.SALE_PROMOTION="SALE_PROMOTION",g.SUBSCRIPTION_UPSELL="SUBSCRIPTION_UPSELL",g.SHOPPABLE_VIDEO="SHOPPABLE_VIDEO",g.BYOB="BYOB",g.PROGRESS_BAR="PROGRESS_BAR",g.BUY_NOW="BUY_NOW",g.EXPERIMENT="EXPERIMENT",g}(J||(e.EngagementObjective=J={})),ge=function(g){return g.COOEE="COOEE",g.KLAVIYO="KLAVIYO",g}(ge||(e.EngagementContentSource=ge={})),$e=function(g){return g.ICONS="ICONS",g.TILES="TILES",g}($e||(e.ProgressBarLayout=$e={})),xe=function(g){return g.FREE_SHIPPING="FREE_SHIPPING",g.DISCOUNT="DISCOUNT",g.FREE_AUTO_GIFT="FREE_AUTO_GIFT",g.FREE_GIFT_SELECT="FREE_GIFT_SELECT",g}(xe||(e.MilestoneRewardType=xe={}))}),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={}))}),Bc=ur(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ArrayUtils=void 0;var t=class Oh{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--,Oh.swap(n,i,s)}}};e.ArrayUtils=t}),Cf=ur((e,t)=>{"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",E="name",y="type",_="vendor",D="version",P="architecture",M="console",L="mobile",R="tablet",q="smarttv",he="wearable",ke="embedded",B=500,Z="Amazon",z="Apple",J="ASUS",ge="BlackBerry",$e="Browser",xe="Chrome",g="Edge",Ke="Firefox",ye="Google",ht="Huawei",ae="LG",ie="Microsoft",lt="Motorola",tr="Opera",lr="Samsung",gt="Sharp",Hr="Sony",Hn="Xiaomi",nn="Zebra",ei="Facebook",qi="Chromium OS",Gn="Mac OS",$n=" Browser",yt=function(W,ce){var ee={};for(var Ce in W)ce[Ce]&&ce[Ce].length%2===0?ee[Ce]=ce[Ce].concat(W[Ce]):ee[Ce]=W[Ce];return ee},$r=function(W){for(var ce={},ee=0;ee<W.length;ee++)ce[W[ee].toUpperCase()]=W[ee];return ce},Gi=function(W,ce){return typeof W===m?a(ce).indexOf(a(W))!==-1:!1},a=function(W){return W.toLowerCase()},l=function(W){return typeof W===m?W.replace(/[^\d\.]/g,s).split(".")[0]:n},p=function(W,ce){if(typeof W===m)return W=W.replace(/^\s\s*/,s),typeof ce===u?W:W.substring(0,B)},T=function(W,ce){for(var ee=0,Ce,Ot,xt,Te,ne,$t;ee<ce.length&&!ne;){var Yi=ce[ee],cs=ce[ee+1];for(Ce=Ot=0;Ce<Yi.length&&!ne&&Yi[Ce];)if(ne=Yi[Ce++].exec(W),ne)for(xt=0;xt<cs.length;xt++)$t=ne[++Ot],Te=cs[xt],typeof Te===d&&Te.length>0?Te.length===2?typeof Te[1]==c?this[Te[0]]=Te[1].call(this,$t):this[Te[0]]=Te[1]:Te.length===3?typeof Te[1]===c&&!(Te[1].exec&&Te[1].test)?this[Te[0]]=$t?Te[1].call(this,$t,Te[2]):n:this[Te[0]]=$t?$t.replace(Te[1],Te[2]):n:Te.length===4&&(this[Te[0]]=$t?Te[3].call(this,$t.replace(Te[1],Te[2])):n):this[Te]=$t||n;ee+=2}},A=function(W,ce){for(var ee in ce)if(typeof ce[ee]===d&&ce[ee].length>0){for(var Ce=0;Ce<ce[ee].length;Ce++)if(Gi(ce[ee][Ce],W))return ee===o?n:ee}else if(Gi(ce[ee],W))return ee===o?n:ee;return ce.hasOwnProperty("*")?ce["*"]:W},U={"1.0":"/8","1.2":"/1","1.3":"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"},G={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"},Ie={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[D,[E,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[D,[E,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[E,D],[/opios[\/ ]+([\w\.]+)/i],[D,[E,tr+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[D,[E,tr+" GX"]],[/\bopr\/([\w\.]+)/i],[D,[E,tr]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[D,[E,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[D,[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,D],[/quark(?:pc)?\/([-\w\.]+)/i],[D,[E,"Quark"]],[/\bddg\/([\w\.]+)/i],[D,[E,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[D,[E,"UC"+$e]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[D,[E,"WeChat"]],[/konqueror\/([\w\.]+)/i],[D,[E,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[D,[E,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[D,[E,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[D,[E,"Smart Lenovo "+$e]],[/(avast|avg)\/([\w\.]+)/i],[[E,/(.+)/,"$1 Secure "+$e],D],[/\bfocus\/([\w\.]+)/i],[D,[E,Ke+" Focus"]],[/\bopt\/([\w\.]+)/i],[D,[E,tr+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[D,[E,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[D,[E,"Dolphin"]],[/coast\/([\w\.]+)/i],[D,[E,tr+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[D,[E,"MIUI"+$n]],[/fxios\/([\w\.-]+)/i],[D,[E,Ke]],[/\bqihoobrowser\/?([\w\.]*)/i],[D,[E,"360"]],[/\b(qq)\/([\w\.]+)/i],[[E,/(.+)/,"$1Browser"],D],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[E,/(.+)/,"$1"+$n],D],[/samsungbrowser\/([\w\.]+)/i],[D,[E,lr+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[D,[E,"Sogou Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[E,"Sogou Mobile"],D],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[E,D],[/(lbbrowser|rekonq)/i,/\[(linkedin)app\]/i],[E],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[D,E],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[E,ei],D],[/(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,D],[/\bgsa\/([\w\.]+) .*safari\//i],[D,[E,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[D,[E,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[D,[E,xe+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[E,xe+" WebView"],D],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[D,[E,"Android "+$e]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[E,D],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[D,[E,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[D,E],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[E,[D,A,U]],[/(webkit|khtml)\/([\w\.]+)/i],[E,D],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[E,"Netscape"],D],[/(wolvic|librewolf)\/([\w\.]+)/i],[E,D],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[D,[E,Ke+" 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,[D,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[E,[D,/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],[v,[_,lr],[y,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],[v,[_,lr],[y,L]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[v,[_,z],[y,L]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[v,[_,z],[y,R]],[/(macintosh);/i],[v,[_,z]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[v,[_,gt],[y,L]],[/(?:honor)([-\w ]+)[;\)]/i],[v,[_,"Honor"],[y,L]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[v,[_,ht],[y,R]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[v,[_,ht],[y,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," "],[_,Hn],[y,L]],[/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[v,/_/g," "],[_,Hn],[y,R]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[v,[_,"OPPO"],[y,L]],[/\b(opd2\d{3}a?) bui/i],[v,[_,"OPPO"],[y,R]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[v,[_,"Vivo"],[y,L]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[v,[_,"Realme"],[y,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,[_,lt],[y,L]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[v,[_,lt],[y,R]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[v,[_,ae],[y,R]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[v,[_,ae],[y,L]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[v,[_,"Lenovo"],[y,R]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[v,/_/g," "],[_,"Nokia"],[y,L]],[/(pixel c)\b/i],[v,[_,ye],[y,R]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[v,[_,ye],[y,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,[_,Hr],[y,L]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[v,"Xperia Tablet"],[_,Hr],[y,R]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[v,[_,"OnePlus"],[y,L]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[v,[_,Z],[y,R]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[v,/(.+)/g,"Fire Phone $1"],[_,Z],[y,L]],[/(playbook);[-\w\),; ]+(rim)/i],[v,_,[y,R]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[v,[_,ge],[y,L]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[v,[_,J],[y,R]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[v,[_,J],[y,L]],[/(nexus 9)/i],[v,[_,"HTC"],[y,R]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[_,[v,/_/g," "],[y,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,[_,"TCL"],[y,R]],[/(itel) ((\w+))/i],[[_,a],v,[y,A,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[v,[_,"Acer"],[y,R]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[v,[_,"Meizu"],[y,L]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[v,[_,"Ulefone"],[y,L]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[v,[_,"Energizer"],[y,L]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[v,[_,"Cat"],[y,L]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[v,[_,"Smartfren"],[y,L]],[/droid.+; (a(?:015|06[35]|142p?))/i],[v,[_,"Nothing"],[y,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],[_,v,[y,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],[_,v,[y,R]],[/(surface duo)/i],[v,[_,ie],[y,R]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[v,[_,"Fairphone"],[y,L]],[/(u304aa)/i],[v,[_,"AT&T"],[y,L]],[/\bsie-(\w*)/i],[v,[_,"Siemens"],[y,L]],[/\b(rct\w+) b/i],[v,[_,"RCA"],[y,R]],[/\b(venue[\d ]{2,7}) b/i],[v,[_,"Dell"],[y,R]],[/\b(q(?:mv|ta)\w+) b/i],[v,[_,"Verizon"],[y,R]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[v,[_,"Barnes & Noble"],[y,R]],[/\b(tm\d{3}\w+) b/i],[v,[_,"NuVision"],[y,R]],[/\b(k88) b/i],[v,[_,"ZTE"],[y,R]],[/\b(nx\d{3}j) b/i],[v,[_,"ZTE"],[y,L]],[/\b(gen\d{3}) b.+49h/i],[v,[_,"Swiss"],[y,L]],[/\b(zur\d{3}) b/i],[v,[_,"Swiss"],[y,R]],[/\b((zeki)?tb.*\b) b/i],[v,[_,"Zeki"],[y,R]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[_,"Dragon Touch"],v,[y,R]],[/\b(ns-?\w{0,9}) b/i],[v,[_,"Insignia"],[y,R]],[/\b((nxa|next)-?\w{0,9}) b/i],[v,[_,"NextBook"],[y,R]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[_,"Voice"],v,[y,L]],[/\b(lvtel\-)?(v1[12]) b/i],[[_,"LvTel"],v,[y,L]],[/\b(ph-1) /i],[v,[_,"Essential"],[y,L]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[v,[_,"Envizen"],[y,R]],[/\b(trio[-\w\. ]+) b/i],[v,[_,"MachSpeed"],[y,R]],[/\btu_(1491) b/i],[v,[_,"Rotor"],[y,R]],[/(shield[\w ]+) b/i],[v,[_,"Nvidia"],[y,R]],[/(sprint) (\w+)/i],[_,v,[y,L]],[/(kin\.[onetw]{3})/i],[[v,/\./g," "],[_,ie],[y,L]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[v,[_,nn],[y,R]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[v,[_,nn],[y,L]],[/smart-tv.+(samsung)/i],[_,[y,q]],[/hbbtv.+maple;(\d+)/i],[[v,/^/,"SmartTV"],[_,lr],[y,q]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[_,ae],[y,q]],[/(apple) ?tv/i],[_,[v,z+" TV"],[y,q]],[/crkey/i],[[v,xe+"cast"],[_,ye],[y,q]],[/droid.+aft(\w+)( bui|\))/i],[v,[_,Z],[y,q]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[v,[_,gt],[y,q]],[/(bravia[\w ]+)( bui|\))/i],[v,[_,Hr],[y,q]],[/(mitv-\w{5}) bui/i],[v,[_,Hn],[y,q]],[/Hbbtv.*(technisat) (.*);/i],[_,v,[y,q]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[_,p],[v,p],[y,q]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[y,q]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[_,v,[y,M]],[/droid.+; (shield) bui/i],[v,[_,"Nvidia"],[y,M]],[/(playstation [345portablevi]+)/i],[v,[_,Hr],[y,M]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[v,[_,ie],[y,M]],[/\b(sm-[lr]\d\d[05][fnuw]?s?)\b/i],[v,[_,lr],[y,he]],[/((pebble))app/i],[_,v,[y,he]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[v,[_,z],[y,he]],[/droid.+; (glass) \d/i],[v,[_,ye],[y,he]],[/droid.+; (wt63?0{2,3})\)/i],[v,[_,nn],[y,he]],[/droid.+; (glass) \d/i],[v,[_,ye],[y,he]],[/(pico) (4|neo3(?: link|pro)?)/i],[_,v,[y,he]],[/; (quest( \d| pro)?)/i],[v,[_,ei],[y,he]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[_,[y,ke]],[/(aeobc)\b/i],[v,[_,Z],[y,ke]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[v,[y,L]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[v,[y,R]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[y,R]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[y,L]],[/(android[-\w\. ]{0,9});.+buil/i],[v,[_,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[D,[E,g+"HTML"]],[/(arkweb)\/([\w\.]+)/i],[E,D],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[D,[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,D],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[D,E]],os:[[/microsoft (windows) (vista|xp)/i],[E,D],[/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i],[E,[D,A,G]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[D,A,G],[E,"Windows"]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[D,/_/g,"."],[E,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[E,Gn],[D,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[D,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,D],[/\(bb(10);/i],[D,[E,ge]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[D,[E,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[D,[E,Ke+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[D,[E,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[D,[E,"watchOS"]],[/crkey\/([\d\.]+)/i],[D,[E,xe+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[E,qi],D],[/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,D],[/(sunos) ?([\w\.\d]*)/i],[[E,"Solaris"],D],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[E,D]]},me=function(W,ce){if(typeof W===d&&(ce=W,W=n),!(this instanceof me))return new me(W,ce).getResult();var ee=typeof r!==u&&r.navigator?r.navigator:n,Ce=W||(ee&&ee.userAgent?ee.userAgent:s),Ot=ee&&ee.userAgentData?ee.userAgentData:n,xt=ce?yt(Ie,ce):Ie,Te=ee&&ee.userAgent==Ce;return this.getBrowser=function(){var ne={};return ne[E]=n,ne[D]=n,T.call(ne,Ce,xt.browser),ne[h]=l(ne[D]),Te&&ee&&ee.brave&&typeof ee.brave.isBrave==c&&(ne[E]="Brave"),ne},this.getCPU=function(){var ne={};return ne[P]=n,T.call(ne,Ce,xt.cpu),ne},this.getDevice=function(){var ne={};return ne[_]=n,ne[v]=n,ne[y]=n,T.call(ne,Ce,xt.device),Te&&!ne[y]&&Ot&&Ot.mobile&&(ne[y]=L),Te&&ne[v]=="Macintosh"&&ee&&typeof ee.standalone!==u&&ee.maxTouchPoints&&ee.maxTouchPoints>2&&(ne[v]="iPad",ne[y]=R),ne},this.getEngine=function(){var ne={};return ne[E]=n,ne[D]=n,T.call(ne,Ce,xt.engine),ne},this.getOS=function(){var ne={};return ne[E]=n,ne[D]=n,T.call(ne,Ce,xt.os),Te&&!ne[E]&&Ot&&Ot.platform&&Ot.platform!="Unknown"&&(ne[E]=Ot.platform.replace(/chrome os/i,qi).replace(/macos/i,Gn)),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 Ce},this.setUA=function(ne){return Ce=typeof ne===m&&ne.length>B?p(ne,B):ne,this},this.setUA(Ce),this};me.VERSION=i,me.BROWSER=$r([E,D,h]),me.CPU=$r([P]),me.DEVICE=$r([v,_,y,M,L,q,R,he,ke]),me.ENGINE=me.OS=$r([E,D]),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 ve=typeof r!==u&&(r.jQuery||r.Zepto);if(ve&&!ve.ua){var je=new me;ve.ua=je.getResult(),ve.ua.get=function(){return je.getUA()},ve.ua.set=function(W){je.setUA(W);var ce=je.getResult();for(var ee in ce)ve.ua[ee]=ce[ee]}}})(typeof window=="object"?window:e)}),Rf=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 d(v,E){if(!c[v]){if(!o[v]){var y=typeof Ki=="function"&&Ki;if(!E&&y)return y(v,!0);if(m)return m(v,!0);var _=new Error("Cannot find module '"+v+"'");throw _.code="MODULE_NOT_FOUND",_}var D=c[v]={exports:{}};o[v][0].call(D.exports,function(P){var M=o[v][1][P];return d(M||P)},D,D.exports,s,o,c,u)}return c[v].exports}for(var m=typeof Ki=="function"&&Ki,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(P),E=u.document.createTextNode("");v.observe(E,{characterData:!0}),m=function(){E.data=h=++h%2}}else if(!u.setImmediate&&typeof u.MessageChannel<"u"){var y=new u.MessageChannel;y.port1.onmessage=P,m=function(){y.port2.postMessage(0)}}else"document"in u&&"onreadystatechange"in u.document.createElement("script")?m=function(){var L=u.document.createElement("script");L.onreadystatechange=function(){P(),L.onreadystatechange=null,L.parentNode.removeChild(L),L=null},u.document.documentElement.appendChild(L)}:m=function(){setTimeout(P,0)};var _,D=[];function P(){_=!0;for(var L,R,q=D.length;q;){for(R=D,D=[],L=-1;++L<q;)R[L]();q=D.length}_=!1}o.exports=M;function M(L){D.push(L)===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 d(){}var m={},h=["REJECTED"],v=["FULFILLED"],E=["PENDING"];o.exports=y;function y(B){if(typeof B!="function")throw new TypeError("resolver must be a function");this.state=E,this.queue=[],this.outcome=void 0,B!==d&&M(this,B)}y.prototype.catch=function(B){return this.then(null,B)},y.prototype.then=function(B,Z){if(typeof B!="function"&&this.state===v||typeof Z!="function"&&this.state===h)return this;var z=new this.constructor(d);if(this.state!==E){var J=this.state===v?B:Z;D(z,J,this.outcome)}else this.queue.push(new _(z,B,Z));return z};function _(B,Z,z){this.promise=B,typeof Z=="function"&&(this.onFulfilled=Z,this.callFulfilled=this.otherCallFulfilled),typeof z=="function"&&(this.onRejected=z,this.callRejected=this.otherCallRejected)}_.prototype.callFulfilled=function(B){m.resolve(this.promise,B)},_.prototype.otherCallFulfilled=function(B){D(this.promise,this.onFulfilled,B)},_.prototype.callRejected=function(B){m.reject(this.promise,B)},_.prototype.otherCallRejected=function(B){D(this.promise,this.onRejected,B)};function D(B,Z,z){u(function(){var J;try{J=Z(z)}catch(ge){return m.reject(B,ge)}J===B?m.reject(B,new TypeError("Cannot resolve promise with itself")):m.resolve(B,J)})}m.resolve=function(B,Z){var z=L(P,Z);if(z.status==="error")return m.reject(B,z.value);var J=z.value;if(J)M(B,J);else{B.state=v,B.outcome=Z;for(var ge=-1,$e=B.queue.length;++ge<$e;)B.queue[ge].callFulfilled(Z)}return B},m.reject=function(B,Z){B.state=h,B.outcome=Z;for(var z=-1,J=B.queue.length;++z<J;)B.queue[z].callRejected(Z);return B};function P(B){var Z=B&&B.then;if(B&&(typeof B=="object"||typeof B=="function")&&typeof Z=="function")return function(){Z.apply(B,arguments)}}function M(B,Z){var z=!1;function J(g){z||(z=!0,m.reject(B,g))}function ge(g){z||(z=!0,m.resolve(B,g))}function $e(){Z(ge,J)}var xe=L($e);xe.status==="error"&&J(xe.value)}function L(B,Z){var z={};try{z.value=B(Z),z.status="success"}catch(J){z.status="error",z.value=J}return z}y.resolve=R;function R(B){return B instanceof this?B:m.resolve(new this(d),B)}y.reject=q;function q(B){var Z=new this(d);return m.reject(Z,B)}y.all=he;function he(B){var Z=this;if(Object.prototype.toString.call(B)!=="[object Array]")return this.reject(new TypeError("must be an array"));var z=B.length,J=!1;if(!z)return this.resolve([]);for(var ge=new Array(z),$e=0,xe=-1,g=new this(d);++xe<z;)Ke(B[xe],xe);return g;function Ke(ye,ht){Z.resolve(ye).then(ae,function(ie){J||(J=!0,m.reject(g,ie))});function ae(ie){ge[ht]=ie,++$e===z&&!J&&(J=!0,m.resolve(g,ge))}}}y.race=ke;function ke(B){var Z=this;if(Object.prototype.toString.call(B)!=="[object Array]")return this.reject(new TypeError("must be an array"));var z=B.length,J=!1;if(!z)return this.resolve([]);for(var ge=-1,$e=new this(d);++ge<z;)xe(B[ge]);return $e;function xe(g){Z.resolve(g).then(function(Ke){J||(J=!0,m.resolve($e,Ke))},function(Ke){J||(J=!0,m.reject($e,Ke))})}}},{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,S){if(!(f 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 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),S=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!f||S)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function E(f,S){f=f||[],S=S||{};try{return new Blob(f,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,x=new I,C=0;C<f.length;C+=1)x.append(f[C]);return x.getBlob(S.type)}}typeof Promise>"u"&&s(3);var y=Promise;function _(f,S){S&&f.then(function(I){S(null,I)},function(I){S(I)})}function D(f,S,I){typeof S=="function"&&f.then(S),typeof I=="function"&&f.catch(I)}function P(f){return typeof f!="string"&&(console.warn(f+" used as a key, but it is not a string."),f=String(f)),f}function M(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var L="local-forage-detect-blob-support",R=void 0,q={},he=Object.prototype.toString,ke="readonly",B="readwrite";function Z(f){for(var S=f.length,I=new ArrayBuffer(S),x=new Uint8Array(I),C=0;C<S;C++)x[C]=f.charCodeAt(C);return I}function z(f){return new y(function(S){var I=f.transaction(L,B),x=E([""]);I.objectStore(L).put(x,"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(f){return typeof R=="boolean"?y.resolve(R):z(f).then(function(S){return R=S,R})}function ge(f){var S=q[f.name],I={};I.promise=new y(function(x,C){I.resolve=x,I.reject=C}),S.deferredOperations.push(I),S.dbReady?S.dbReady=S.dbReady.then(function(){return I.promise}):S.dbReady=I.promise}function $e(f){var S=q[f.name],I=S.deferredOperations.pop();if(I)return I.resolve(),I.promise}function xe(f,S){var I=q[f.name],x=I.deferredOperations.pop();if(x)return x.reject(S),x.promise}function g(f,S){return new y(function(I,x){if(q[f.name]=q[f.name]||Hr(),f.db)if(S)ge(f),f.db.close();else return I(f.db);var C=[f.name];S&&C.push(f.version);var O=h.open.apply(h,C);S&&(O.onupgradeneeded=function(k){var j=O.result;try{j.createObjectStore(f.storeName),k.oldVersion<=1&&j.createObjectStore(L)}catch(H){if(H.name==="ConstraintError")console.warn('The database "'+f.name+'" has been upgraded from version '+k.oldVersion+" to version "+k.newVersion+', but the storage "'+f.storeName+'" already exists.');else throw H}}),O.onerror=function(k){k.preventDefault(),x(O.error)},O.onsuccess=function(){var k=O.result;k.onversionchange=function(j){j.target.close()},I(k),$e(f)}})}function Ke(f){return g(f,!1)}function ye(f){return g(f,!0)}function ht(f,S){if(!f.db)return!0;var I=!f.db.objectStoreNames.contains(f.storeName),x=f.version<f.db.version,C=f.version>f.db.version;if(x&&(f.version!==S&&console.warn('The database "'+f.name+`" can't be downgraded from version `+f.db.version+" to version "+f.version+"."),f.version=f.db.version),C||I){if(I){var O=f.db.version+1;O>f.version&&(f.version=O)}return!0}return!1}function ae(f){return new y(function(S,I){var x=new FileReader;x.onerror=I,x.onloadend=function(C){var O=btoa(C.target.result||"");S({__local_forage_encoded_blob:!0,data:O,type:f.type})},x.readAsBinaryString(f)})}function ie(f){var S=Z(atob(f.data));return E([S],{type:f.type})}function lt(f){return f&&f.__local_forage_encoded_blob}function tr(f){var S=this,I=S._initReady().then(function(){var x=q[S._dbInfo.name];if(x&&x.dbReady)return x.dbReady});return D(I,f,f),I}function lr(f){ge(f);for(var S=q[f.name],I=S.forages,x=0;x<I.length;x++){var C=I[x];C._dbInfo.db&&(C._dbInfo.db.close(),C._dbInfo.db=null)}return f.db=null,Ke(f).then(function(O){return f.db=O,ht(f)?ye(f):O}).then(function(O){f.db=S.db=O;for(var k=0;k<I.length;k++)I[k]._dbInfo.db=O}).catch(function(O){throw xe(f,O),O})}function gt(f,S,I,x){x===void 0&&(x=1);try{var C=f.db.transaction(f.storeName,S);I(null,C)}catch(O){if(x>0&&(!f.db||O.name==="InvalidStateError"||O.name==="NotFoundError"))return y.resolve().then(function(){if(!f.db||O.name==="NotFoundError"&&!f.db.objectStoreNames.contains(f.storeName)&&f.version<=f.db.version)return f.db&&(f.version=f.db.version+1),ye(f)}).then(function(){return lr(f).then(function(){gt(f,S,I,x-1)})}).catch(I);I(O)}}function Hr(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function Hn(f){var S=this,I={db:null};if(f)for(var x in f)I[x]=f[x];var C=q[I.name];C||(C=Hr(),q[I.name]=C),C.forages.push(S),S._initReady||(S._initReady=S.ready,S.ready=tr);var O=[];function k(){return y.resolve()}for(var j=0;j<C.forages.length;j++){var H=C.forages[j];H!==S&&O.push(H._initReady().catch(k))}var V=C.forages.slice(0);return y.all(O).then(function(){return I.db=C.db,Ke(I)}).then(function(F){return I.db=F,ht(I,S._defaultConfig.version)?ye(I):F}).then(function(F){I.db=C.db=F,S._dbInfo=I;for(var Y=0;Y<V.length;Y++){var pe=V[Y];pe!==S&&(pe._dbInfo.db=I.db,pe._dbInfo.version=I.version)}})}function nn(f,S){var I=this;f=P(f);var x=new y(function(C,O){I.ready().then(function(){gt(I._dbInfo,ke,function(k,j){if(k)return O(k);try{var H=j.objectStore(I._dbInfo.storeName),V=H.get(f);V.onsuccess=function(){var F=V.result;F===void 0&&(F=null),lt(F)&&(F=ie(F)),C(F)},V.onerror=function(){O(V.error)}}catch(F){O(F)}})}).catch(O)});return _(x,S),x}function ei(f,S){var I=this,x=new y(function(C,O){I.ready().then(function(){gt(I._dbInfo,ke,function(k,j){if(k)return O(k);try{var H=j.objectStore(I._dbInfo.storeName),V=H.openCursor(),F=1;V.onsuccess=function(){var Y=V.result;if(Y){var pe=Y.value;lt(pe)&&(pe=ie(pe));var Ge=f(pe,Y.key,F++);Ge!==void 0?C(Ge):Y.continue()}else C()},V.onerror=function(){O(V.error)}}catch(Y){O(Y)}})}).catch(O)});return _(x,S),x}function qi(f,S,I){var x=this;f=P(f);var C=new y(function(O,k){var j;x.ready().then(function(){return j=x._dbInfo,he.call(S)==="[object Blob]"?J(j.db).then(function(H){return H?S:ae(S)}):S}).then(function(H){gt(x._dbInfo,B,function(V,F){if(V)return k(V);try{var Y=F.objectStore(x._dbInfo.storeName);H===null&&(H=void 0);var pe=Y.put(H,f);F.oncomplete=function(){H===void 0&&(H=null),O(H)},F.onabort=F.onerror=function(){var Ge=pe.error?pe.error:pe.transaction.error;k(Ge)}}catch(Ge){k(Ge)}})}).catch(k)});return _(C,I),C}function Gn(f,S){var I=this;f=P(f);var x=new y(function(C,O){I.ready().then(function(){gt(I._dbInfo,B,function(k,j){if(k)return O(k);try{var H=j.objectStore(I._dbInfo.storeName),V=H.delete(f);j.oncomplete=function(){C()},j.onerror=function(){O(V.error)},j.onabort=function(){var F=V.error?V.error:V.transaction.error;O(F)}}catch(F){O(F)}})}).catch(O)});return _(x,S),x}function $n(f){var S=this,I=new y(function(x,C){S.ready().then(function(){gt(S._dbInfo,B,function(O,k){if(O)return C(O);try{var j=k.objectStore(S._dbInfo.storeName),H=j.clear();k.oncomplete=function(){x()},k.onabort=k.onerror=function(){var V=H.error?H.error:H.transaction.error;C(V)}}catch(V){C(V)}})}).catch(C)});return _(I,f),I}function yt(f){var S=this,I=new y(function(x,C){S.ready().then(function(){gt(S._dbInfo,ke,function(O,k){if(O)return C(O);try{var j=k.objectStore(S._dbInfo.storeName),H=j.count();H.onsuccess=function(){x(H.result)},H.onerror=function(){C(H.error)}}catch(V){C(V)}})}).catch(C)});return _(I,f),I}function $r(f,S){var I=this,x=new y(function(C,O){if(f<0){C(null);return}I.ready().then(function(){gt(I._dbInfo,ke,function(k,j){if(k)return O(k);try{var H=j.objectStore(I._dbInfo.storeName),V=!1,F=H.openKeyCursor();F.onsuccess=function(){var Y=F.result;if(!Y){C(null);return}f===0||V?C(Y.key):(V=!0,Y.advance(f))},F.onerror=function(){O(F.error)}}catch(Y){O(Y)}})}).catch(O)});return _(x,S),x}function Gi(f){var S=this,I=new y(function(x,C){S.ready().then(function(){gt(S._dbInfo,ke,function(O,k){if(O)return C(O);try{var j=k.objectStore(S._dbInfo.storeName),H=j.openKeyCursor(),V=[];H.onsuccess=function(){var F=H.result;if(!F){x(V);return}V.push(F.key),F.continue()},H.onerror=function(){C(H.error)}}catch(F){C(F)}})}).catch(C)});return _(I,f),I}function a(f,S){S=M.apply(this,arguments);var I=this.config();f=typeof f!="function"&&f||{},f.name||(f.name=f.name||I.name,f.storeName=f.storeName||I.storeName);var x=this,C;if(!f.name)C=y.reject("Invalid arguments");else{var O=f.name===I.name&&x._dbInfo.db,k=O?y.resolve(x._dbInfo.db):Ke(f).then(function(j){var H=q[f.name],V=H.forages;H.db=j;for(var F=0;F<V.length;F++)V[F]._dbInfo.db=j;return j});f.storeName?C=k.then(function(j){if(j.objectStoreNames.contains(f.storeName)){var H=j.version+1;ge(f);var V=q[f.name],F=V.forages;j.close();for(var Y=0;Y<F.length;Y++){var pe=F[Y];pe._dbInfo.db=null,pe._dbInfo.version=H}var Ge=new y(function(Ae,ut){var We=h.open(f.name,H);We.onerror=function(Ht){var Dc=We.result;Dc.close(),ut(Ht)},We.onupgradeneeded=function(){var Ht=We.result;Ht.deleteObjectStore(f.storeName)},We.onsuccess=function(){var Ht=We.result;Ht.close(),Ae(Ht)}});return Ge.then(function(Ae){V.db=Ae;for(var ut=0;ut<F.length;ut++){var We=F[ut];We._dbInfo.db=Ae,$e(We._dbInfo)}}).catch(function(Ae){throw(xe(f,Ae)||y.resolve()).catch(function(){}),Ae})}}):C=k.then(function(j){ge(f);var H=q[f.name],V=H.forages;j.close();for(var F=0;F<V.length;F++){var Y=V[F];Y._dbInfo.db=null}var pe=new y(function(Ge,Ae){var ut=h.deleteDatabase(f.name);ut.onerror=function(){var We=ut.result;We&&We.close(),Ae(ut.error)},ut.onblocked=function(){console.warn('dropInstance blocked for database "'+f.name+'" until all open connections are closed')},ut.onsuccess=function(){var We=ut.result;We&&We.close(),Ge(We)}});return pe.then(function(Ge){H.db=Ge;for(var Ae=0;Ae<V.length;Ae++){var ut=V[Ae];$e(ut._dbInfo)}}).catch(function(Ge){throw(xe(f,Ge)||y.resolve()).catch(function(){}),Ge})})}return _(C,S),C}var l={_driver:"asyncStorage",_initStorage:Hn,_support:v(),iterate:ei,getItem:nn,setItem:qi,removeItem:Gn,clear:$n,length:yt,key:$r,keys:Gi,dropInstance:a};function p(){return typeof openDatabase=="function"}var T="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",A="~~local_forage_type~",U=/^~~local_forage_type~([^~]+)~/,G="__lfsc__:",Ie=G.length,me="arbf",ve="blob",je="si08",W="ui08",ce="uic8",ee="si16",Ce="si32",Ot="ur16",xt="ui32",Te="fl32",ne="fl64",$t=Ie+me.length,Yi=Object.prototype.toString;function cs(f){var S=f.length*.75,I=f.length,x,C=0,O,k,j,H;f[f.length-1]==="="&&(S--,f[f.length-2]==="="&&S--);var V=new ArrayBuffer(S),F=new Uint8Array(V);for(x=0;x<I;x+=4)O=T.indexOf(f[x]),k=T.indexOf(f[x+1]),j=T.indexOf(f[x+2]),H=T.indexOf(f[x+3]),F[C++]=O<<2|k>>4,F[C++]=(k&15)<<4|j>>2,F[C++]=(j&3)<<6|H&63;return V}function Qo(f){var S=new Uint8Array(f),I="",x;for(x=0;x<S.length;x+=3)I+=T[S[x]>>2],I+=T[(S[x]&3)<<4|S[x+1]>>4],I+=T[(S[x+1]&15)<<2|S[x+2]>>6],I+=T[S[x+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 Zh(f,S){var I="";if(f&&(I=Yi.call(f)),f&&(I==="[object ArrayBuffer]"||f.buffer&&Yi.call(f.buffer)==="[object ArrayBuffer]")){var x,C=G;f instanceof ArrayBuffer?(x=f,C+=me):(x=f.buffer,I==="[object Int8Array]"?C+=je:I==="[object Uint8Array]"?C+=W:I==="[object Uint8ClampedArray]"?C+=ce:I==="[object Int16Array]"?C+=ee:I==="[object Uint16Array]"?C+=Ot:I==="[object Int32Array]"?C+=Ce:I==="[object Uint32Array]"?C+=xt:I==="[object Float32Array]"?C+=Te:I==="[object Float64Array]"?C+=ne:S(new Error("Failed to get type for BinaryArray"))),S(C+Qo(x))}else if(I==="[object Blob]"){var O=new FileReader;O.onload=function(){var k=A+f.type+"~"+Qo(this.result);S(G+ve+k)},O.readAsArrayBuffer(f)}else try{S(JSON.stringify(f))}catch(k){console.error("Couldn't convert value into a JSON string: ",f),S(null,k)}}function tp(f){if(f.substring(0,Ie)!==G)return JSON.parse(f);var S=f.substring($t),I=f.substring(Ie,$t),x;if(I===ve&&U.test(S)){var C=S.match(U);x=C[1],S=S.substring(C[0].length)}var O=cs(S);switch(I){case me:return O;case ve:return E([O],{type:x});case je:return new Int8Array(O);case W:return new Uint8Array(O);case ce:return new Uint8ClampedArray(O);case ee:return new Int16Array(O);case Ot:return new Uint16Array(O);case Ce:return new Int32Array(O);case xt:return new Uint32Array(O);case Te:return new Float32Array(O);case ne:return new Float64Array(O);default:throw new Error("Unkown type: "+I)}}var Wa={serialize:Zh,deserialize:tp,stringToBuffer:cs,bufferToString:Qo};function bh(f,S,I,x){f.executeSql("CREATE TABLE IF NOT EXISTS "+S.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],I,x)}function rp(f){var S=this,I={db:null};if(f)for(var x in f)I[x]=typeof f[x]!="string"?f[x].toString():f[x];var C=new y(function(O,k){try{I.db=openDatabase(I.name,String(I.version),I.description,I.size)}catch(j){return k(j)}I.db.transaction(function(j){bh(j,I,function(){S._dbInfo=I,O()},function(H,V){k(V)})},k)});return I.serializer=Wa,C}function Vn(f,S,I,x,C,O){f.executeSql(I,x,C,function(k,j){j.code===j.SYNTAX_ERR?k.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[S.storeName],function(H,V){V.rows.length?O(H,j):bh(H,S,function(){H.executeSql(I,x,C,O)},O)},O):O(k,j)},O)}function ip(f,S){var I=this;f=P(f);var x=new y(function(C,O){I.ready().then(function(){var k=I._dbInfo;k.db.transaction(function(j){Vn(j,k,"SELECT * FROM "+k.storeName+" WHERE key = ? LIMIT 1",[f],function(H,V){var F=V.rows.length?V.rows.item(0).value:null;F&&(F=k.serializer.deserialize(F)),C(F)},function(H,V){O(V)})})}).catch(O)});return _(x,S),x}function sp(f,S){var I=this,x=new y(function(C,O){I.ready().then(function(){var k=I._dbInfo;k.db.transaction(function(j){Vn(j,k,"SELECT * FROM "+k.storeName,[],function(H,V){for(var F=V.rows,Y=F.length,pe=0;pe<Y;pe++){var Ge=F.item(pe),Ae=Ge.value;if(Ae&&(Ae=k.serializer.deserialize(Ae)),Ae=f(Ae,Ge.key,pe+1),Ae!==void 0){C(Ae);return}}C()},function(H,V){O(V)})})}).catch(O)});return _(x,S),x}function Ih(f,S,I,x){var C=this;f=P(f);var O=new y(function(k,j){C.ready().then(function(){S===void 0&&(S=null);var H=S,V=C._dbInfo;V.serializer.serialize(S,function(F,Y){Y?j(Y):V.db.transaction(function(pe){Vn(pe,V,"INSERT OR REPLACE INTO "+V.storeName+" (key, value) VALUES (?, ?)",[f,F],function(){k(H)},function(Ge,Ae){j(Ae)})},function(pe){if(pe.code===pe.QUOTA_ERR){if(x>0){k(Ih.apply(C,[f,H,I,x-1]));return}j(pe)}})})}).catch(j)});return _(O,I),O}function op(f,S,I){return Ih.apply(this,[f,S,I,1])}function ap(f,S){var I=this;f=P(f);var x=new y(function(C,O){I.ready().then(function(){var k=I._dbInfo;k.db.transaction(function(j){Vn(j,k,"DELETE FROM "+k.storeName+" WHERE key = ?",[f],function(){C()},function(H,V){O(V)})})}).catch(O)});return _(x,S),x}function cp(f){var S=this,I=new y(function(x,C){S.ready().then(function(){var O=S._dbInfo;O.db.transaction(function(k){Vn(k,O,"DELETE FROM "+O.storeName,[],function(){x()},function(j,H){C(H)})})}).catch(C)});return _(I,f),I}function lp(f){var S=this,I=new y(function(x,C){S.ready().then(function(){var O=S._dbInfo;O.db.transaction(function(k){Vn(k,O,"SELECT COUNT(key) as c FROM "+O.storeName,[],function(j,H){var V=H.rows.item(0).c;x(V)},function(j,H){C(H)})})}).catch(C)});return _(I,f),I}function hp(f,S){var I=this,x=new y(function(C,O){I.ready().then(function(){var k=I._dbInfo;k.db.transaction(function(j){Vn(j,k,"SELECT key FROM "+k.storeName+" WHERE id = ? LIMIT 1",[f+1],function(H,V){var F=V.rows.length?V.rows.item(0).key:null;C(F)},function(H,V){O(V)})})}).catch(O)});return _(x,S),x}function dp(f){var S=this,I=new y(function(x,C){S.ready().then(function(){var O=S._dbInfo;O.db.transaction(function(k){Vn(k,O,"SELECT key FROM "+O.storeName,[],function(j,H){for(var V=[],F=0;F<H.rows.length;F++)V.push(H.rows.item(F).key);x(V)},function(j,H){C(H)})})}).catch(C)});return _(I,f),I}function gp(f){return new y(function(S,I){f.transaction(function(x){x.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(C,O){for(var k=[],j=0;j<O.rows.length;j++)k.push(O.rows.item(j).name);S({db:f,storeNames:k})},function(C,O){I(O)})},function(x){I(x)})})}function vp(f,S){S=M.apply(this,arguments);var I=this.config();f=typeof f!="function"&&f||{},f.name||(f.name=f.name||I.name,f.storeName=f.storeName||I.storeName);var x=this,C;return f.name?C=new y(function(O){var k;f.name===I.name?k=x._dbInfo.db:k=openDatabase(f.name,"","",0),f.storeName?O({db:k,storeNames:[f.storeName]}):O(gp(k))}).then(function(O){return new y(function(k,j){O.db.transaction(function(H){function V(Ge){return new y(function(Ae,ut){H.executeSql("DROP TABLE IF EXISTS "+Ge,[],function(){Ae()},function(We,Ht){ut(Ht)})})}for(var F=[],Y=0,pe=O.storeNames.length;Y<pe;Y++)F.push(V(O.storeNames[Y]));y.all(F).then(function(){k()}).catch(function(Ge){j(Ge)})},function(H){j(H)})})}):C=y.reject("Invalid arguments"),_(C,S),C}var yp={_driver:"webSQLStorage",_initStorage:rp,_support:p(),iterate:sp,getItem:ip,setItem:op,removeItem:ap,clear:cp,length:lp,key:hp,keys:dp,dropInstance:vp};function bp(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function Th(f,S){var I=f.name+"/";return f.storeName!==S.storeName&&(I+=f.storeName+"/"),I}function wp(){var f="_localforage_support_test";try{return localStorage.setItem(f,!0),localStorage.removeItem(f),!1}catch{return!0}}function _p(){return!wp()||localStorage.length>0}function Ep(f){var S=this,I={};if(f)for(var x in f)I[x]=f[x];return I.keyPrefix=Th(f,S._defaultConfig),_p()?(S._dbInfo=I,I.serializer=Wa,y.resolve()):y.reject()}function Sp(f){var S=this,I=S.ready().then(function(){for(var x=S._dbInfo.keyPrefix,C=localStorage.length-1;C>=0;C--){var O=localStorage.key(C);O.indexOf(x)===0&&localStorage.removeItem(O)}});return _(I,f),I}function Ip(f,S){var I=this;f=P(f);var x=I.ready().then(function(){var C=I._dbInfo,O=localStorage.getItem(C.keyPrefix+f);return O&&(O=C.serializer.deserialize(O)),O});return _(x,S),x}function Tp(f,S){var I=this,x=I.ready().then(function(){for(var C=I._dbInfo,O=C.keyPrefix,k=O.length,j=localStorage.length,H=1,V=0;V<j;V++){var F=localStorage.key(V);if(F.indexOf(O)===0){var Y=localStorage.getItem(F);if(Y&&(Y=C.serializer.deserialize(Y)),Y=f(Y,F.substring(k),H++),Y!==void 0)return Y}}});return _(x,S),x}function Cp(f,S){var I=this,x=I.ready().then(function(){var C=I._dbInfo,O;try{O=localStorage.key(f)}catch{O=null}return O&&(O=O.substring(C.keyPrefix.length)),O});return _(x,S),x}function Dp(f){var S=this,I=S.ready().then(function(){for(var x=S._dbInfo,C=localStorage.length,O=[],k=0;k<C;k++){var j=localStorage.key(k);j.indexOf(x.keyPrefix)===0&&O.push(j.substring(x.keyPrefix.length))}return O});return _(I,f),I}function Np(f){var S=this,I=S.keys().then(function(x){return x.length});return _(I,f),I}function xp(f,S){var I=this;f=P(f);var x=I.ready().then(function(){var C=I._dbInfo;localStorage.removeItem(C.keyPrefix+f)});return _(x,S),x}function Op(f,S,I){var x=this;f=P(f);var C=x.ready().then(function(){S===void 0&&(S=null);var O=S;return new y(function(k,j){var H=x._dbInfo;H.serializer.serialize(S,function(V,F){if(F)j(F);else try{localStorage.setItem(H.keyPrefix+f,V),k(O)}catch(Y){(Y.name==="QuotaExceededError"||Y.name==="NS_ERROR_DOM_QUOTA_REACHED")&&j(Y),j(Y)}})})});return _(C,I),C}function Ap(f,S){if(S=M.apply(this,arguments),f=typeof f!="function"&&f||{},!f.name){var I=this.config();f.name=f.name||I.name,f.storeName=f.storeName||I.storeName}var x=this,C;return f.name?C=new y(function(O){f.storeName?O(Th(f,x._defaultConfig)):O(f.name+"/")}).then(function(O){for(var k=localStorage.length-1;k>=0;k--){var j=localStorage.key(k);j.indexOf(O)===0&&localStorage.removeItem(j)}}):C=y.reject("Invalid arguments"),_(C,S),C}var Pp={_driver:"localStorageWrapper",_initStorage:Ep,_support:bp(),iterate:Tp,getItem:Ip,setItem:Op,removeItem:xp,clear:Sp,length:Np,key:Cp,keys:Dp,dropInstance:Ap},Rp=function(f,S){return f===S||typeof f=="number"&&typeof S=="number"&&isNaN(f)&&isNaN(S)},kp=function(f,S){for(var I=f.length,x=0;x<I;){if(Rp(f[x],S))return!0;x++}return!1},Ch=Array.isArray||function(f){return Object.prototype.toString.call(f)==="[object Array]"},to={},Dh={},zi={INDEXEDDB:l,WEBSQL:yp,LOCALSTORAGE:Pp},Lp=[zi.INDEXEDDB._driver,zi.WEBSQL._driver,zi.LOCALSTORAGE._driver],Xo=["dropInstance"],Ka=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Xo),Up={description:"",driver:Lp.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function Mp(f,S){f[S]=function(){var I=arguments;return f.ready().then(function(){return f[S].apply(f,I)})}}function Cc(){for(var f=1;f<arguments.length;f++){var S=arguments[f];if(S)for(var I in S)S.hasOwnProperty(I)&&(Ch(S[I])?arguments[0][I]=S[I].slice():arguments[0][I]=S[I])}return arguments[0]}var Bp=function(){function f(S){d(this,f);for(var I in zi)if(zi.hasOwnProperty(I)){var x=zi[I],C=x._driver;this[I]=C,to[C]||this.defineDriver(x)}this._defaultConfig=Cc({},Up),this._config=Cc({},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 f.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},f.prototype.defineDriver=function(S,I,x){var C=new y(function(O,k){try{var j=S._driver,H=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!S._driver){k(H);return}for(var V=Ka.concat("_initStorage"),F=0,Y=V.length;F<Y;F++){var pe=V[F],Ge=!kp(Xo,pe);if((Ge||S[pe])&&typeof S[pe]!="function"){k(H);return}}var Ae=function(){for(var We=function(jp){return function(){var Fp=new Error("Method "+jp+" is not implemented by the current driver"),Nh=y.reject(Fp);return _(Nh,arguments[arguments.length-1]),Nh}},Ht=0,Dc=Xo.length;Ht<Dc;Ht++){var Nc=Xo[Ht];S[Nc]||(S[Nc]=We(Nc))}};Ae();var ut=function(We){to[j]&&console.info("Redefining LocalForage driver: "+j),to[j]=S,Dh[j]=We,O()};"_support"in S?S._support&&typeof S._support=="function"?S._support().then(ut,k):ut(!!S._support):ut(!0)}catch(We){k(We)}});return D(C,I,x),C},f.prototype.driver=function(){return this._driver||null},f.prototype.getDriver=function(S,I,x){var C=to[S]?y.resolve(to[S]):y.reject(new Error("Driver not found."));return D(C,I,x),C},f.prototype.getSerializer=function(S){var I=y.resolve(Wa);return D(I,S),I},f.prototype.ready=function(S){var I=this,x=I._driverSet.then(function(){return I._ready===null&&(I._ready=I._initDriver()),I._ready});return D(x,S,S),x},f.prototype.setDriver=function(S,I,x){var C=this;Ch(S)||(S=[S]);var O=this._getSupportedDrivers(S);function k(){C._config.driver=C.driver()}function j(F){return C._extend(F),k(),C._ready=C._initStorage(C._config),C._ready}function H(F){return function(){var Y=0;function pe(){for(;Y<F.length;){var Ge=F[Y];return Y++,C._dbInfo=null,C._ready=null,C.getDriver(Ge).then(j).catch(pe)}k();var Ae=new Error("No available storage method found.");return C._driverSet=y.reject(Ae),C._driverSet}return pe()}}var V=this._driverSet!==null?this._driverSet.catch(function(){return y.resolve()}):y.resolve();return this._driverSet=V.then(function(){var F=O[0];return C._dbInfo=null,C._ready=null,C.getDriver(F).then(function(Y){C._driver=Y._driver,k(),C._wrapLibraryMethodsWithReady(),C._initDriver=H(O)})}).catch(function(){k();var F=new Error("No available storage method found.");return C._driverSet=y.reject(F),C._driverSet}),D(this._driverSet,I,x),this._driverSet},f.prototype.supports=function(S){return!!Dh[S]},f.prototype._extend=function(S){Cc(this,S)},f.prototype._getSupportedDrivers=function(S){for(var I=[],x=0,C=S.length;x<C;x++){var O=S[x];this.supports(O)&&I.push(O)}return I},f.prototype._wrapLibraryMethodsWithReady=function(){for(var S=0,I=Ka.length;S<I;S++)Mp(this,Ka[S])},f.prototype.createInstance=function(S){return new f(S)},f}(),$p=new Bp;o.exports=$p},{3:3}]},{},[4])(4)})}),ti=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(d){d(u)})}return new(s||(s=Promise))(function(u,d){function m(E){try{v(o.next(E))}catch(y){d(y)}}function h(E){try{v(o.throw(E))}catch(y){d(y)}}function v(E){E.done?u(E.value):c(E.value).then(m,h)}v((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)/)}),Ju=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}),ih=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,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(E,y){var _=function(P){var M=typeof Request<"u"&&u instanceof Request?u.clone():u;s(M,d).then(function(L){if(Array.isArray(v)&&v.indexOf(L.status)===-1)E(L);else if(typeof v=="function")try{return Promise.resolve(v(P,null,L)).then(function(R){R?D(P,null,L):E(L)}).catch(y)}catch(R){y(R)}else P<m?D(P,null,L):E(L)}).catch(function(L){if(typeof v=="function")try{Promise.resolve(v(P,L,null)).then(function(R){R?D(P,L,null):y(L)}).catch(function(R){y(R)})}catch(R){y(R)}else P<m?D(P,L,null):y(L)})};function D(P,M,L){var R=typeof h=="function"?h(P,M,L):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})}),mp="9.6.9",N=class xc{static SDK_VERSION=mp;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_EXPERIMENT_START="CE Experiment Start";static EVENT_VIDEO_DIALOG_CLOSED="CE Video Dialog Closed";static EVENT_VIDEO_DIALOG_OPENED="CE Video Dialog Opened";static EVENT_VIDEO_CHANGE="CE Video Changed";static EVENT_LAST_VIDEO_ENDED="CE Last Video Ended";static EVENT_VIDEO_MUTED="CE Video Muted";static EVENT_VIDEO_UNMUTED="CE Video Unmuted";static EVENT_ADD_TO_CART_CLICKED="CE Add To Cart Clicked";static EVENT_VIEW_ITEM_CLICKED="CE View Item Clicked";static EVENT_MORE_ITEM_INFO_CLICKED="CE More Item Info Clicked";static EVENT_OPEN_CART_CLICKED="CE Open Cart Clicked";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 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)}},Dt={apiURL:"https://api.sdk.letscooee.com",debug:!1,mode:"production",styleURL:`https://cdn.jsdelivr.net/npm/@letscooee/web-sdk@${N.SDK_VERSION}/dist/widget.min.css`,widgetURL:`https://cdn.jsdelivr.net/npm/@letscooee/web-sdk@${N.SDK_VERSION}/dist/widget.min.js`},Pt=Se(on()),b=class{static log(...e){Pt.default.info(...e)}static debug(...e){Pt.default.debug(...e)}static error(...e){Pt.default.error(...e)}static warn(...e){Pt.default.warn(...e)}static info(...e){Pt.default.info(...e)}static trace(...e){Pt.default.trace(...e)}static configure(e=N.LOG_PREFIX){Pt.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?Pt.default.setLevel(Pt.default[localStorage.cooeeLogLevel]):Pt.default.setLevel(Dt.debug?Pt.default.TRACE:Pt.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%);
|
|
@@ -60,11 +60,11 @@ mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]) {
|
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
-
`,en=class{async performAddToCart(e,t){if(!e.length)return;let r=e.map(c=>{let{vID:u,quantity:d}=this.getVIDAndQuantity(c);return{id:u?+u:+c.mID,quantity:d,properties:t.getPrivateAttributesForLineItem()}}),n=Be.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`),Q.showSnackbar("Product added to your cart"),c.json()}catch(c){b.error("Failed to add product in cart",c)}}async performUpdate(e,t){if(!sh.JSUtils.hasKeys(t)){b.warn("No update fields provided");return}let r=Be.getCartURL("cart/change.js"),n=w({id:e.key},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`),Q.showSnackbar("Discount code copied")}catch(t){b.error("Failed to copy code",t)}}performGoToItem(e){if(!e?.link)return;let t=Be.getProductSlug(e.link);t&&(location.pathname=Be.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(d=>d.vID===n.mID),s=n.selectedSellingPlan.value,o=Be.getCartURL("cart/change.js"),c={line:i+1,selling_plan:s?.mID||null,properties:t.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 ${e} selling plan`),Q.showSnackbar("Line item updated");let m=await d.json();return de.getCurrent().update(m),m}}catch(d){b.error("Failed to update subscription for item in cart",d)}}async performCartCreate(e,t,r){let n=Pe.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 Q.getCartAttributes(),c=new Headers;c.append("Content-Type","application/json"),c.append("X-Shopify-Storefront-Access-Token",n);let u=JSON.stringify({query:tS,variables:{input:{lines:s,discountCodes:i,attributes:o}}});return(await dt.getInstance().request(N.GRAPHQL_API_PATH,{method:"POST",headers:c,body:u})).data?.cartCreate?.cart?.checkoutUrl}async processEvent(e){let t=e.clickAction,r=e.items,n=e.triggerData;if(t.at){let i=t;if(b.log(`Performing ${JSON.stringify(i)} action`),i.at===101)r?.length&&this.performGoToItem(r[0]);else if(i.at===102)r?.length&&await this.performAddToCart(r,n);else if(i.at===103)await this.performCopyCoupon(n.discount.code);else if(i.at===105)ze.get().open();else if(i.at===104){let s=e.collections;if(!s?.length)return;location.pathname=Be.getRootPrefix()+"collections/"+s[0].handle}}t.applyDiscount&&n.discount?.code&&Zr.navigate(n.discount.code,n.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}}},Xa=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&&await this.closeTriggerAndSendEvent(e),this.action.at){case 2:break;case 4:this.gotoURLAction();break;case 5:this.shareAction();break;case 106:await 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;Q.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())}async closeTriggerAndSendEvent(e,t){this.triggerContext.closeInApp(e,t),await 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})})}async 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)}await this.closeTriggerAndSendEvent(N.EVENT_FORM_SUBMITTED,{form:e}),Q.showSnackbar("Coupon applied on cart"),za.updateIdentity(e)}async dispatchEvent(){let e=this.triggerContext.triggerData,t={clickAction:this.action,items:this.triggerContext.selectedEmbeddedItems??e.embeddedItems??e.items,collections:e.collections,triggerData:e};await new en().processEvent(t);let r={action:this.containsCTA()?N.CAMPAIGN_CLICKED_ACTIVITY:N.CAMPAIGN_CLOSED_ACTIVITY};document.dispatchEvent(new CustomEvent(N.POPUP_ACTIVITY_EVENT,{detail:r}))}},Li=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}},Zt=class{renderer=Bt.get();parentHTMLEl;inappElement;inappHTMLEl;triggerContext;stylesConverter;scalingFactor;constructor(e,t,r){this.parentHTMLEl=e,this.inappElement=t,this.triggerContext=r,this.stylesConverter=new Li(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=te(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 En(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 Xa(e,this.triggerContext).execute()}),this.renderer.setStyle(this.inappHTMLEl,"cursor","pointer"))}getBackgroundStyles(){return this.stylesConverter.getBackgroundStyles(this.inappElement.bg)}},xr=class extends Zt{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?pi[e]?.toLowerCase():this.inappElement.typography.alignment;t||(t="start"),this.renderer.setStyle(this.inappHTMLEl,"text-align",t)}},Oo=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()}},Po=class extends Zt{constructor(e,t,r){super(e,t,r),this.inappHTMLEl=this.renderer.createElement("div"),this.insertElement()}render(){this.processCommonBlocks()}},Un=class extends Zt{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()}},Lo=class Fh extends Zt{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",Fh.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(){}},Ja=class extends Zt{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}},Bi=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)}},Qa=class Vh extends Bi{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(Vh.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()})}},Za=class Hh extends Bi{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(Hh.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()})}},ec=class Fn 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=te(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(Fn.DAYS)),t.hour&&this.elements.push(this.getChild(Fn.HOURS)),t.minute&&this.elements.push(this.getChild(Fn.MINUTES)),t.second&&this.elements.push(this.getChild(Fn.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-${Fn.DAYS}`?n.innerText=String(r.days).padStart(2,"0"):n.id===`lc-${Fn.HOURS}`?n.innerText=String(r.hours).padStart(2,"0"):n.id===`lc-${Fn.MINUTES}`?n.innerText=String(r.minutes).padStart(2,"0"):n.id===`lc-${Fn.SECONDS}`&&(n.innerText=String(r.seconds).padStart(2,"0"))})});this.triggerContext.intervals.push(t)}},tc=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}},rc=class extends Un{constructor(e,t,r){super(e,t,r)}render(){super.render(),this.inappHTMLEl.setAttribute("id",`coo-${this.inappElement.type}`)}},Ui=class qo{static ACTIVE_TRIGGER_DATA;renderer=Bt.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 Tt(t))}async renderEngagement(t){if(this.triggerContext=new Pi(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){Le.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 Qr(qo.ACTIVE_TRIGGER_DATA??{})};return this.skipTrigger(t,n),!0}if(ue.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 Lo(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 Ee(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 Ee(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 hi?new Qa(t,r,n).render():r instanceof gi?new Za(t,r,n).render():r instanceof Yr?new Oo(t,r,n).render():r instanceof yi?new rc(t,r,n).render():r instanceof Br?new Un(t,r,n).render():r instanceof _n?new Po(t,r,n).render():r instanceof mi?new ec(t,r,n).render():r instanceof di?new tc(t,r,n).render():b.error("Unsupported element type- "+r.type)}renderContainer(t){let r=this.ian?.cont;r&&(this.containerHTMLElement=new Ja(this.rootContainer,r,t).render().getHTMLElement(),new Ya().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(){Bt.get().removeInApp(this.triggerContext)}skipTrigger(t,r){let n=new Ee(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"})}},ah=Se(Rr()),ch=Se(ti()),nc=class{triggerData;safeHttpService=fe.getInstance();render(e){e.contentSource===ah.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 Ee(N.EVENT_TRIGGER_DISPLAYED,{form:{id:t.formId}},this.triggerData));break;case"stepSubmit":{let r=this.getFormDetails(t);this.safeHttpService.sendEvent(new Ee(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 Ee(N.EVENT_TRIGGER_CLOSED,{form:{id:t.formId}},this.triggerData));break}}getFormDetails(e){let t={id:e.formId},r=e.metaData;if(ch.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}},ic=class{static trackIntent(e){if(!this.isInstalled()){b.log("Facebook pixel not installed");return}if(!Pe.get().pixelPush){b.log("Facebook pixel push not enabled");return}let t=Sn[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"}},Mi=class{static sentryService=Le.getInstance();static httpApiService=dt.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(Pe.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 Ee(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 d=new Rt(o);d.name=u.title;let m=new Sr(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(e,t){let r=e,n,i=`/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,r.tags=n.tags;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}},oc=class qh{static INSTANCE;httpService=se.get(dt);sentryService=se.get(Le);sessionManager=se.get(qe);runtime=ue.get();constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new qh),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}`),er.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(),t.locale=this.runtime.locale,this.httpService.post("/v1/event/track",t).then(async r=>{b.log("\u2705 Event tracked:",t.name),er.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=Tr.parseFromCurrent()}async addShopifyContext(t){if(Be.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 Tt(r.triggerData);n.occurred=t.occurred;let i;try{i=await Mi.refreshItems(n)}catch(s){b.error("Failed to refresh the products",s);return}if(n.items=i,n.contentSource===lh.EngagementContentSource.KLAVIYO){new nc().render(n);return}new Ui().renderEngagement(n).catch(s=>{b.error("Failed to render popup",s),this.sentryService.captureException(s,{event:t,triggerData:n})})}utiliseIntentIfCalculated(t){t.intent&&(Oi.trackIntent(t.intent),ic.trackIntent(t),er.prepend(`Intent is <strong>${Sn[t.intent]}</strong>`))}addShopifyAttributes(){Be.isShopify()&&de.getCurrent().addCooeeAttributes().catch(t=>{b.error("Fail to add attributes in cart",t)})}},fe=class Gh{static INSTANCE;httpApiService=dt.getInstance();eventAPIService=oc.getInstance();constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Gh),this.INSTANCE}sendEvent(t){b.debug(`Waiting for auth to send event ${t.name}`),qe.replaySubject.subscribe(async()=>{this.eventAPIService.sendSilently(t)})}updateProfile(t){qe.replaySubject.subscribe(()=>{this.httpApiService.updateUserData(t??{})})}trackOrder(t){qe.replaySubject.subscribe(()=>{this.httpApiService.trackOrder(t)})}updateDeviceProps(t){qe.replaySubject.subscribe(()=>{this.httpApiService.updateDeviceProps({props:t})})}generateDiscount(t){return this.httpApiService.generateDiscount(t)}},er=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}},Bo=class extends Wr{static storeName="app";static{this.storage=Qn(this.storeName)}},sc=class{static processConfiguration(){let e=Pe.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 De.get(oe.GA_CLIENT_ID),t=await this.getClientIDViaGTag();if(e!==t)return await De.set(oe.GA_CLIENT_ID,t),t}static async getClientIDViaGTag(){let e=Pe.get().gaMeasurementID;if(!(!e||!window.gtag))return new Promise(t=>{window.gtag("get",e,"client_id",r=>{t(r)})})}},ac=class Wh{static INSTANCE;constructor(){this.init()}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Wh),this.INSTANCE}init(){Bo.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);Bo.set(oe.APP_CONFIG,r).catch(n=>b.error(n)),sc.processConfiguration(),r.website&&(At.injectRawScript(r.website.commonJS),At.injectRawCSS(r.website.commonCSS)),ze.get().onToggle().subscribe(async({open:n})=>{b.info("Cart drawer is now",n?"open":"closed"),n&&(se.get(cr).loadOrRenderWidgetsAfterCartChange(),await this.trackViewCartEvent())})}updateGlobalConfig(t){let r=be.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 Ee(N.EVENT_VIEW_CART,n))}},uh=Se(Ju()),cc=class Rc{static META_REQUIRED_FIELDS=["ad_id"];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 uh.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 Rc(r);if(this.GOOGLE_REQUIRED_FIELDS.every(n=>Array.from(t.getParams().keys()).includes(n)))return r={source:"GOOGLE"},new Rc(r)}},Bn=class Kh{static INSTANCE;httpAPIService=dt.getInstance();coreService=ac.getInstance();sentryService=Le.getInstance();sdkToken="";userID="";deviceID="";appID="";shopifyShop="";constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Kh),this.INSTANCE}init(t){this.appID=t.appID,this.shopifyShop=t.shopifyShop}async storeAndPopulateAuthData(t){t&&(t.userID&&(this.userID=t.userID,await De.set(oe.ID,t.userID)),t.deviceID&&(this.deviceID=t.deviceID,await De.set(oe.DEVICE_ID,t.deviceID)),t.sdkToken&&(this.sdkToken=t.sdkToken,await De.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 De.get(oe.SDK_TOKEN),!this.sdkToken){b.warn("No SDK token found in local storage");return}this.userID=await De.get(oe.ID),this.deviceID=await De.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),Oi.trackDeviceID(this.deviceID),er.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 nh())?.isPrivate&&(r.private=!0)}catch(i){ph.default.error("Unable to detect private/incognito window",i)}let n=await De.get(oe.DEVICE_ID);return n||(n=new tt().toHexString(),await De.set(oe.DEVICE_ID,n)),te(w({deviceID:n,deviceProps:r,appID:this.appID,shopifyShop:this.shopifyShop},t),{sdk:N.SDK,page:Tr.parseFromCurrent(),ad:cc.getAdParams(),occurred:this.getSessionStartTime(ue.get().jsLoadTime),currentItem:ue.get().getCurrentItem(),cart:await de.getCurrent().getNormalisedCart(),properties:{}})}async populateFirstSeen(){let t=await De.get(oe.FIRST_SEEN),r=t?new Date(t):new Date;t||await De.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}},qe=class Ko{static replaySubject=new xo(1);static INSTANCE;sentryService=se.get(Le);lock=new Zn;constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Ko),this.INSTANCE}init(t){if(b.debug("Initialising SDK",t),th(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 De.get(oe.SESSION_NUMBER,0)+1;er.prepend(`New Session ID: <strong>${r}</strong> & number: ${n}`),await Promise.all([De.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,Tr.parseFromCurrent())])}getLandingPage(){return rt.get(oe.SESSION_LANDING_PAGE,{})}getCurrentSessionNumber(){return De.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=Se(Rr()),yh=Se(Bc()),vh=Se(ti()),Eh=Se(on()),fh=Se(Jo()),mh=Se(on()),ki=class{constructor(e,t){this.triggerContext=e,this.element=t}safeHTTP=fe.getInstance();async execute(e){let t=ue.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},d="",m=[],h=[];if(n?h=[n.toEmbed()]:e.embeddedItem&&(h=[e.embeddedItem]),r.at===108){let _=i.selectedItems;if(h=e.embeddedItems??_.map(D=>D.toEmbed()),i.shouldGiveFBTDiscount||e.embeddedItems?.length){let D;e.embeddedItems?D=e.embeddedItems.map(M=>({itemMID:M.mID,mID:M.vID,quantity:M.quantity})):D=_.map(M=>({itemMID:M.mID,mID:M.selectedOrFirstVariant.value.mID}));let P=i.triggerData.bundleFrom;i.triggerData.isBundleOnCartDrawer()&&P&&(D.push({itemMID:P.mID,mID:P.selectedOrFirstVariant.value.mID,isPrimary:!0}),h.unshift(P.toEmbed())),u.selectedVariants=D,i.triggerData.isBundleOnPDP()&&u.selectedVariants.forEach(M=>{M.mID===t.vID&&(M.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(D=>({itemMID:D.mID,mID:D.vID}))}else if(r.at===102)m=n?[n]:[e.embeddedItem];else if(r.at===101)d=n?Be.getRootPrefix()+"products/"+n.slug:e.embeddedItem?.link;else if(r.at===4){let _=Q.isValidURL(r.gu?.u);_&&(d=_.href)}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"},e.video),b.debug({redirectPath:d,redirectBehaviour:o,hasDiscount:c}),!c&&d){location.href=d;return}let v,E=!1;try{v=await this.getOrGenerateDiscountCode(u),b.debug("Discount code (if any) to apply",v)}catch(_){if(!this.triggerContext.triggerData.isBYOB()){mh.default.error("Unable to get a discount code",_);return}}if(v&&r.at===103)await s.performCopyCoupon(v);else if(r.at===110){let _=await s.performCartCreate(t,v,i.triggerData);_&&(location.href=_);return}try{v&&await Zr.applyWithStorefront(v)}catch(_){b.error(_),E=!0}let y;if(m?.length&&(y=await s.performAddToCart(m,i.triggerData)),E&&v){Zr.navigate(v,o,d);return}if(d){location.href=d;return}Zr.navigateWithoutDiscount(o,y)}sendTriggerClicked(e,t,r){let n=N.EVENT_TRIGGER_CLICKED,i=new Ee(n,t,this.triggerContext.triggerData);i.items=e,r?.id&&(i.videos=[r.id]),this.safeHTTP.sendEvent(i)}async getOrGenerateDiscountCode(e){let t=this.triggerContext.triggerData.discount;if(!t?.type)return;let r="";if(t.type===fh.DiscountType.STATIC){if(!t.code)throw Le.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 Q.showSnackbar("Failed to generate a discount code"),b.error("Error generating discount code",t,e),Le.getInstance().captureMessage("Failed to generate discount code","error",{discountData:JSON.stringify(e),triggerContext:this.triggerContext,error:t}),t}}},Ne=class extends pr{stylesConverter=new Li(1);renderer=Bt.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(te(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()==="";case"in":return new RegExp(`\\b${r}\\b`).test(t);case"nin":return!new RegExp(`\\b${r}\\b`).test(t);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)}},rS=0,YH=Array.isArray;function $(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 d={type:e,props:u,key:r,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--rS,__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 _e.vnode&&_e.vnode(d),d}var Ft=class extends Ne{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=""),$("div",{style:e,onClick:this.customOnClick.bind(this),className:"lc-text",children:$("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,cart:e.getCartMagicVariables()},r=Et.render(JSON.stringify(this.props.element),t),n=new ot(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"}}},Mn=class extends Ft{render(){return $("div",{style:this.getCompiledStyles(),className:"lc-button",onClick:()=>this.onClick({item:this.props.item}),children:$("span",{style:this.getSpanStyle(),dangerouslySetInnerHTML:{__html:this.state.text}})})}getComponentStyles(){return te(w({},super.getComponentStyles()),{cursor:"pointer"})}},np=class extends pr{render(){if(this.props.element.show[this.props.label.toLowerCase()])return this.props.element.lblPos==="end"?$("div",{style:w(w({},this.getElementStyle()),this.props.styles),children:[$("span",{children:this.props.time}),$("span",{style:this.getTimeLabelStyle(),children:this.props.label})]}):$("div",{style:w(w({},this.getElementStyle()),this.props.styles),children:[$("span",{style:this.getTimeLabelStyle(),children:this.props.label}),$("span",{children:this.props.time})]})}getDesign(){}getTimeLabelStyle(){return{fontSize:"0.5em",alignContent:"center"}}getElementStyle(){let e={display:"flex",flexDirection:"column",placeContent:"center center",textAlign:"center"};return this.props.element.horizontal&&(e.gridTemplateColumns="repeat(2, minmax(0, 1fr))"),e}},Uo=class extends Ft{labels={Days:"00",Hours:"00",Minutes:"00",Seconds:"00"};componentWillMount(){super.componentWillMount(),this.setState(()=>w({},this.labels)),this.processAndStartTimer()}render(){return $("div",{style:this.getLabelsParentStyle(),children:Object.keys(this.labels).map(e=>$(np,{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))})}},Mo=class extends Ne{componentDidMount(){at(()=>{this.setState(()=>({checked:this.props.item.selected.value}))})}render(){return $("div",{style:this.getCompiledStyles(),className:"lc-checkbox",children:$("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 te(w({},this.getTypoStyles()),{display:"flex"})}},dh=Se(Rr()),kr=class extends Ne{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 $("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.element.clc?.at===dh.ClickActionType.ADD_TO_CART&&this.props.triggerContext.triggerData.items[0]&&this.onClick({item:this.props.triggerContext.triggerData.items[0]}),this.props.onClick&&this.props.onClick("image")}getComponentStyles(){let e=this.mediaStyle.lout;if(!e||e.pos!=="absolute")return{};let t={zIndex:e.zIndex,cursor:this.props.element.clc?.at?"pointer":"auto"};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 Ne{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return $("div",{style:this.getCompiledStyles(),class:"lc-flexbox",children:$(tn,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})})}getComponentStyles(){let e=this.mediaStyle.flex??new vi,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 $("div",{style:this.getCompiledStyles(),class:"lc-flexbox",children:$(Fi,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext,item:this.props.item,noLinks:this.props.noLinks})})}},Fo=class extends Ne{render(){return $("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($("option",{value:"",selected:!t.selectedSellingPlan,children:"One time purchase"}));for(let r of t.sellingPlans??[])e.push($("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}},hh=Se(Pc()),Ho=class extends Ne{colorRegex=new RegExp('fill="#[a-zA-Z0-9]+"');constructor(){super(),Et.escape=hh.MustacheUtils.escapeHtml}render(){let e=this.getCompiledStyles(),t=this.getRating();return t||(e.display="none",t=""),$("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"}}},$o=class extends Ne{render(){return $("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($("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)}},Fi=class extends Ne{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 $(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()?$(Mo,{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=$(kr,{element:t,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?s:$("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:$($o,{element:t,item:this.props.item,triggerContext:this.props.triggerContext})}return e.t===16?$(Fo,{element:e,selectedVariant:this.props.item.selectedOrFirstVariant.value,item:this.props.item,triggerContext:this.props.triggerContext}):e.t===19?$(Ho,{element:e,triggerContext:this.props.triggerContext,review:this.props.item.reviews}):e.t===18||e.t===3?$(Mn,{element:e,item:this.props.item,triggerContext:this.props.triggerContext}):$(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=$(Ft,{element:e,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?t:$("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"}))}},gh=Se(Jo()),kn=class extends Ne{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 Kr(JSON.parse(t)),!(this.productElement.hide||!this.matchWhenCondition(this.productElement.when)))return $("div",{style:w({},this.getCompiledStyles()),class:"lc-single-product",children:$(Fi,{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=Q.formatCurrency(t.d,!0),s=this.props.item.variantImage??this.props.item.imageURL,o=this.props.item.meta,c=this.props.item.tags?.join(",")??"",u=this.props.item.reviews?.rating,d=this.props.item.reviews?.totalReviews,m=t.cmp&&t.cmp>t.d,h=this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(this.props.item.quantity):this.props.item.quantity,v={name:r,price:i,quantity:h,image_url:s,meta:o,category:n,rating:u,reviews:d,tags:c},E=e.effectivePrice.value!==t.d;E&&(v.effective_price=Q.formatCurrency(e.effectivePrice.value));let y=this.props.triggerContext.triggerData.discount.type===gh.DiscountType.BXGY;if(!E&&y&&(v.effective_price=Q.formatCurrency(e.effectivePrice.value),v.price=""),m){v.compare_price=Q.formatCurrency(t.cmp);let D=t.cmp-t.d;v.discount_percent=(D/t.cmp*100).toFixed(0),v.discount_price=Q.formatCurrency(D)}let _={name:e.name,quantity:this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(e.quantity):e.quantity};return{product:v,variant:_,svg:{color:()=>"{{svg.color}}",size:()=>"{{svg.size}}"}}}};function lc(){let e="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.js";return new Promise(t=>{if(window.Swiper){t();return}if(Array.from(document.scripts).some(n=>n.src.includes(e))){let n=setInterval(()=>{window.Swiper&&(clearInterval(n),t())},50)}let r=document.createElement("script");r.src=e,r.onload=()=>{t()},r.onerror=()=>{r.remove()},document.body.appendChild(r)})}function uc(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)=>`
|
|
63
|
+
`,en=class{async performAddToCart(e,t){if(!e.length)return;let r=e.map(c=>{let{vID:u,quantity:d}=this.getVIDAndQuantity(c);return{id:u?+u:+c.mID,quantity:d,properties:t.getPrivateAttributesForLineItem()}}),n=Be.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`),Q.showSnackbar("Product added to your cart"),c.json()}catch(c){b.error("Failed to add product in cart",c)}}async performUpdate(e,t){if(!sh.JSUtils.hasKeys(t)){b.warn("No update fields provided");return}let r=Be.getCartURL("cart/change.js"),n=w({id:e.key},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`),Q.showSnackbar("Discount code copied")}catch(t){b.error("Failed to copy code",t)}}performGoToItem(e){if(!e?.link)return;let t=Be.getProductSlug(e.link);t&&(location.pathname=Be.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(d=>d.vID===n.mID),s=n.selectedSellingPlan.value,o=Be.getCartURL("cart/change.js"),c={line:i+1,selling_plan:s?.mID||null,properties:t.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 ${e} selling plan`),Q.showSnackbar("Line item updated");let m=await d.json();return de.getCurrent().update(m),m}}catch(d){b.error("Failed to update subscription for item in cart",d)}}async performCartCreate(e,t,r){let n=Pe.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 Q.getCartAttributes(),c=new Headers;c.append("Content-Type","application/json"),c.append("X-Shopify-Storefront-Access-Token",n);let u=JSON.stringify({query:tS,variables:{input:{lines:s,discountCodes:i,attributes:o}}});return(await dt.getInstance().request(N.GRAPHQL_API_PATH,{method:"POST",headers:c,body:u})).data?.cartCreate?.cart?.checkoutUrl}async processEvent(e){let t=e.clickAction,r=e.items,n=e.triggerData;if(t.at){let i=t;if(b.log(`Performing ${JSON.stringify(i)} action`),i.at===101)r?.length&&this.performGoToItem(r[0]);else if(i.at===102)r?.length&&await this.performAddToCart(r,n);else if(i.at===103)await this.performCopyCoupon(n.discount.code);else if(i.at===105)ze.get().open();else if(i.at===104){let s=e.collections;if(!s?.length)return;location.pathname=Be.getRootPrefix()+"collections/"+s[0].handle}}t.applyDiscount&&n.discount?.code&&Zr.navigate(n.discount.code,n.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}}},Xa=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&&await this.closeTriggerAndSendEvent(e),this.action.at){case 2:break;case 4:this.gotoURLAction();break;case 5:this.shareAction();break;case 106:await 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;Q.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())}async closeTriggerAndSendEvent(e,t){this.triggerContext.closeInApp(e,t),await 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})})}async 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)}await this.closeTriggerAndSendEvent(N.EVENT_FORM_SUBMITTED,{form:e}),Q.showSnackbar("Coupon applied on cart"),za.updateIdentity(e)}async dispatchEvent(){let e=this.triggerContext.triggerData,t={clickAction:this.action,items:this.triggerContext.selectedEmbeddedItems??e.embeddedItems??e.items,collections:e.collections,triggerData:e};await new en().processEvent(t);let r={action:this.containsCTA()?N.CAMPAIGN_CLICKED_ACTIVITY:N.CAMPAIGN_CLOSED_ACTIVITY};document.dispatchEvent(new CustomEvent(N.POPUP_ACTIVITY_EVENT,{detail:r}))}},Li=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}},Zt=class{renderer=Bt.get();parentHTMLEl;inappElement;inappHTMLEl;triggerContext;stylesConverter;scalingFactor;constructor(e,t,r){this.parentHTMLEl=e,this.inappElement=t,this.triggerContext=r,this.stylesConverter=new Li(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=te(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 En(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 Xa(e,this.triggerContext).execute()}),this.renderer.setStyle(this.inappHTMLEl,"cursor","pointer"))}getBackgroundStyles(){return this.stylesConverter.getBackgroundStyles(this.inappElement.bg)}},xr=class extends Zt{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?pi[e]?.toLowerCase():this.inappElement.typography.alignment;t||(t="start"),this.renderer.setStyle(this.inappHTMLEl,"text-align",t)}},Oo=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()}},Po=class extends Zt{constructor(e,t,r){super(e,t,r),this.inappHTMLEl=this.renderer.createElement("div"),this.insertElement()}render(){this.processCommonBlocks()}},Un=class extends Zt{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()}},Lo=class Fh extends Zt{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",Fh.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(){}},Ja=class extends Zt{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}},Bi=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)}},Qa=class Vh extends Bi{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(Vh.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()})}},Za=class Hh extends Bi{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(Hh.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()})}},ec=class Fn 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=te(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(Fn.DAYS)),t.hour&&this.elements.push(this.getChild(Fn.HOURS)),t.minute&&this.elements.push(this.getChild(Fn.MINUTES)),t.second&&this.elements.push(this.getChild(Fn.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-${Fn.DAYS}`?n.innerText=String(r.days).padStart(2,"0"):n.id===`lc-${Fn.HOURS}`?n.innerText=String(r.hours).padStart(2,"0"):n.id===`lc-${Fn.MINUTES}`?n.innerText=String(r.minutes).padStart(2,"0"):n.id===`lc-${Fn.SECONDS}`&&(n.innerText=String(r.seconds).padStart(2,"0"))})});this.triggerContext.intervals.push(t)}},tc=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}},rc=class extends Un{constructor(e,t,r){super(e,t,r)}render(){super.render(),this.inappHTMLEl.setAttribute("id",`coo-${this.inappElement.type}`)}},Ui=class qo{static ACTIVE_TRIGGER_DATA;renderer=Bt.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 Tt(t))}async renderEngagement(t){if(this.triggerContext=new Pi(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){Le.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 Qr(qo.ACTIVE_TRIGGER_DATA??{})};return this.skipTrigger(t,n),!0}if(ue.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 Lo(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 Ee(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 Ee(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 hi?new Qa(t,r,n).render():r instanceof gi?new Za(t,r,n).render():r instanceof Yr?new Oo(t,r,n).render():r instanceof yi?new rc(t,r,n).render():r instanceof Br?new Un(t,r,n).render():r instanceof _n?new Po(t,r,n).render():r instanceof mi?new ec(t,r,n).render():r instanceof di?new tc(t,r,n).render():b.error("Unsupported element type- "+r.type)}renderContainer(t){let r=this.ian?.cont;r&&(this.containerHTMLElement=new Ja(this.rootContainer,r,t).render().getHTMLElement(),new Ya().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(){Bt.get().removeInApp(this.triggerContext)}skipTrigger(t,r){let n=new Ee(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"})}},ah=Se(Rr()),ch=Se(ti()),nc=class{triggerData;safeHttpService=fe.getInstance();render(e){e.contentSource===ah.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 Ee(N.EVENT_TRIGGER_DISPLAYED,{form:{id:t.formId}},this.triggerData));break;case"stepSubmit":{let r=this.getFormDetails(t);this.safeHttpService.sendEvent(new Ee(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 Ee(N.EVENT_TRIGGER_CLOSED,{form:{id:t.formId}},this.triggerData));break}}getFormDetails(e){let t={id:e.formId},r=e.metaData;if(ch.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}},ic=class{static trackIntent(e){if(!this.isInstalled()){b.log("Facebook pixel not installed");return}if(!Pe.get().pixelPush){b.log("Facebook pixel push not enabled");return}let t=Sn[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"}},Mi=class{static sentryService=Le.getInstance();static httpApiService=dt.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(Pe.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 Ee(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 d=new Rt(o);d.name=u.title;let m=new Sr(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(e,t){let r=e,n,i=`/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,r.tags=n.tags;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}},oc=class qh{static INSTANCE;httpService=se.get(dt);sentryService=se.get(Le);sessionManager=se.get(qe);runtime=ue.get();constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new qh),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}`),er.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(),t.locale=this.runtime.locale,this.httpService.post("/v1/event/track",t).then(async r=>{b.log("\u2705 Event tracked:",t.name),er.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=Tr.parseFromCurrent()}async addShopifyContext(t){if(Be.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 Tt(r.triggerData);n.occurred=t.occurred;let i;try{i=await Mi.refreshItems(n)}catch(s){b.error("Failed to refresh the products",s);return}if(n.items=i,n.contentSource===lh.EngagementContentSource.KLAVIYO){new nc().render(n);return}new Ui().renderEngagement(n).catch(s=>{b.error("Failed to render popup",s),this.sentryService.captureException(s,{event:t,triggerData:n})})}utiliseIntentIfCalculated(t){t.intent&&(Oi.trackIntent(t.intent),ic.trackIntent(t),er.prepend(`Intent is <strong>${Sn[t.intent]}</strong>`))}addShopifyAttributes(){Be.isShopify()&&de.getCurrent().addCooeeAttributes().catch(t=>{b.error("Fail to add attributes in cart",t)})}},fe=class Gh{static INSTANCE;httpApiService=dt.getInstance();eventAPIService=oc.getInstance();constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Gh),this.INSTANCE}sendEvent(t){b.debug(`Waiting for auth to send event ${t.name}`),qe.replaySubject.subscribe(async()=>{this.eventAPIService.sendSilently(t)})}updateProfile(t){qe.replaySubject.subscribe(()=>{this.httpApiService.updateUserData(t??{})})}trackOrder(t){qe.replaySubject.subscribe(()=>{this.httpApiService.trackOrder(t)})}updateDeviceProps(t){qe.replaySubject.subscribe(()=>{this.httpApiService.updateDeviceProps({props:t})})}generateDiscount(t){return this.httpApiService.generateDiscount(t)}},er=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}},Bo=class extends Wr{static storeName="app";static{this.storage=Qn(this.storeName)}},sc=class{static processConfiguration(){let e=Pe.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 De.get(oe.GA_CLIENT_ID),t=await this.getClientIDViaGTag();if(e!==t)return await De.set(oe.GA_CLIENT_ID,t),t}static async getClientIDViaGTag(){let e=Pe.get().gaMeasurementID;if(!(!e||!window.gtag))return new Promise(t=>{window.gtag("get",e,"client_id",r=>{t(r)})})}},ac=class Wh{static INSTANCE;constructor(){this.init()}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Wh),this.INSTANCE}init(){Bo.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);Bo.set(oe.APP_CONFIG,r).catch(n=>b.error(n)),sc.processConfiguration(),r.website&&(At.injectRawScript(r.website.commonJS),At.injectRawCSS(r.website.commonCSS)),ze.get().onToggle().subscribe(async({open:n})=>{b.info("Cart drawer is now",n?"open":"closed"),n&&(se.get(cr).loadOrRenderWidgetsAfterCartChange(),await this.trackViewCartEvent())})}updateGlobalConfig(t){let r=be.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 Ee(N.EVENT_VIEW_CART,n))}},uh=Se(Ju()),cc=class Rc{static META_REQUIRED_FIELDS=["ad_id"];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 uh.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 Rc(r);if(this.GOOGLE_REQUIRED_FIELDS.every(n=>Array.from(t.getParams().keys()).includes(n)))return r={source:"GOOGLE"},new Rc(r)}},Bn=class Kh{static INSTANCE;httpAPIService=dt.getInstance();coreService=ac.getInstance();sentryService=Le.getInstance();sdkToken="";userID="";deviceID="";appID="";shopifyShop="";constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Kh),this.INSTANCE}init(t){this.appID=t.appID,this.shopifyShop=t.shopifyShop}async storeAndPopulateAuthData(t){t&&(t.userID&&(this.userID=t.userID,await De.set(oe.ID,t.userID)),t.deviceID&&(this.deviceID=t.deviceID,await De.set(oe.DEVICE_ID,t.deviceID)),t.sdkToken&&(this.sdkToken=t.sdkToken,await De.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 De.get(oe.SDK_TOKEN),!this.sdkToken){b.warn("No SDK token found in local storage");return}this.userID=await De.get(oe.ID),this.deviceID=await De.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),Oi.trackDeviceID(this.deviceID),er.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 nh())?.isPrivate&&(r.private=!0)}catch(i){ph.default.error("Unable to detect private/incognito window",i)}let n=await De.get(oe.DEVICE_ID);return n||(n=new tt().toHexString(),await De.set(oe.DEVICE_ID,n)),te(w({deviceID:n,deviceProps:r,appID:this.appID,shopifyShop:this.shopifyShop},t),{sdk:N.SDK,page:Tr.parseFromCurrent(),ad:cc.getAdParams(),occurred:this.getSessionStartTime(ue.get().jsLoadTime),currentItem:ue.get().getCurrentItem(),cart:await de.getCurrent().getNormalisedCart(),properties:{}})}async populateFirstSeen(){let t=await De.get(oe.FIRST_SEEN),r=t?new Date(t):new Date;t||await De.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}},qe=class Ko{static replaySubject=new xo(1);static INSTANCE;sentryService=se.get(Le);lock=new Zn;constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Ko),this.INSTANCE}init(t){if(b.debug("Initialising SDK",t),th(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 De.get(oe.SESSION_NUMBER,0)+1;er.prepend(`New Session ID: <strong>${r}</strong> & number: ${n}`),await Promise.all([De.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,Tr.parseFromCurrent())])}getLandingPage(){return rt.get(oe.SESSION_LANDING_PAGE,{})}getCurrentSessionNumber(){return De.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=Se(Rr()),yh=Se(Bc()),vh=Se(ti()),Eh=Se(on()),fh=Se(Jo()),mh=Se(on()),ki=class{constructor(e,t){this.triggerContext=e,this.element=t}safeHTTP=fe.getInstance();async execute(e){let t=ue.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},d="",m=[],h=[];if(n?h=[n.toEmbed()]:e.embeddedItem&&(h=[e.embeddedItem]),r.at===108){let _=i.selectedItems;if(h=e.embeddedItems??_.map(D=>D.toEmbed()),i.shouldGiveFBTDiscount||e.embeddedItems?.length){let D;e.embeddedItems?D=e.embeddedItems.map(M=>({itemMID:M.mID,mID:M.vID,quantity:M.quantity})):D=_.map(M=>({itemMID:M.mID,mID:M.selectedOrFirstVariant.value.mID}));let P=i.triggerData.bundleFrom;i.triggerData.isBundleOnCartDrawer()&&P&&(D.push({itemMID:P.mID,mID:P.selectedOrFirstVariant.value.mID,isPrimary:!0}),h.unshift(P.toEmbed())),u.selectedVariants=D,i.triggerData.isBundleOnPDP()&&u.selectedVariants.forEach(M=>{M.mID===t.vID&&(M.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(D=>({itemMID:D.mID,mID:D.vID}))}else if(r.at===102)m=n?[n]:[e.embeddedItem];else if(r.at===101)d=n?Be.getRootPrefix()+"products/"+n.slug:e.embeddedItem?.link;else if(r.at===4){let _=Q.isValidURL(r.gu?.u);_&&(d=_.href)}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"},e.video),b.debug({redirectPath:d,redirectBehaviour:o,hasDiscount:c}),!c&&d){location.href=d;return}let v,E=!1;try{v=await this.getOrGenerateDiscountCode(u),b.debug("Discount code (if any) to apply",v)}catch(_){if(!this.triggerContext.triggerData.isBYOB()){mh.default.error("Unable to get a discount code",_);return}}if(v&&r.at===103)await s.performCopyCoupon(v);else if(r.at===110){let _=await s.performCartCreate(t,v,i.triggerData);_&&(location.href=_);return}try{v&&await Zr.applyWithStorefront(v)}catch(_){b.error(_),E=!0}let y;if(m?.length&&(y=await s.performAddToCart(m,i.triggerData)),E&&v){Zr.navigate(v,o,d);return}if(d){location.href=d;return}Zr.navigateWithoutDiscount(o,y)}sendTriggerClicked(e,t,r){let n=N.EVENT_TRIGGER_CLICKED,i=new Ee(n,t,this.triggerContext.triggerData);i.items=e,r?.id&&(i.videos=[r.id]),this.safeHTTP.sendEvent(i)}async getOrGenerateDiscountCode(e){let t=this.triggerContext.triggerData.discount;if(!t?.type)return;let r="";if(t.type===fh.DiscountType.STATIC){if(!t.code)throw Le.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 Q.showSnackbar("Failed to generate a discount code"),b.error("Error generating discount code",t,e),Le.getInstance().captureMessage("Failed to generate discount code","error",{discountData:JSON.stringify(e),triggerContext:this.triggerContext,error:t}),t}}},Ne=class extends pr{stylesConverter=new Li(1);renderer=Bt.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(te(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()==="";case"in":return new RegExp(`\\b${r}\\b`).test(t);case"nin":return!new RegExp(`\\b${r}\\b`).test(t);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,t){e.stopPropagation(),await this.clickExecutor.execute(t)}},rS=0,YH=Array.isArray;function $(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 d={type:e,props:u,key:r,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--rS,__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 _e.vnode&&_e.vnode(d),d}var Ft=class extends Ne{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=""),$("div",{style:e,onClick:this.customOnClick.bind(this),className:"lc-text",children:$("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,cart:e.getCartMagicVariables()},r=Et.render(JSON.stringify(this.props.element),t),n=new ot(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"}}},Mn=class extends Ft{render(){return $("div",{style:this.getCompiledStyles(),className:"lc-button",onClick:e=>this.onClick(e,{item:this.props.item}),children:$("span",{style:this.getSpanStyle(),dangerouslySetInnerHTML:{__html:this.state.text}})})}getComponentStyles(){return te(w({},super.getComponentStyles()),{cursor:"pointer"})}},np=class extends pr{render(){if(this.props.element.show[this.props.label.toLowerCase()])return this.props.element.lblPos==="end"?$("div",{style:w(w({},this.getElementStyle()),this.props.styles),children:[$("span",{children:this.props.time}),$("span",{style:this.getTimeLabelStyle(),children:this.props.label})]}):$("div",{style:w(w({},this.getElementStyle()),this.props.styles),children:[$("span",{style:this.getTimeLabelStyle(),children:this.props.label}),$("span",{children:this.props.time})]})}getDesign(){}getTimeLabelStyle(){return{fontSize:"0.5em",alignContent:"center"}}getElementStyle(){let e={display:"flex",flexDirection:"column",placeContent:"center center",textAlign:"center"};return this.props.element.horizontal&&(e.gridTemplateColumns="repeat(2, minmax(0, 1fr))"),e}},Uo=class extends Ft{labels={Days:"00",Hours:"00",Minutes:"00",Seconds:"00"};componentWillMount(){super.componentWillMount(),this.setState(()=>w({},this.labels)),this.processAndStartTimer()}render(){return $("div",{style:this.getLabelsParentStyle(),children:Object.keys(this.labels).map(e=>$(np,{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))})}},Mo=class extends Ne{componentDidMount(){at(()=>{this.setState(()=>({checked:this.props.item.selected.value}))})}render(){return $("div",{style:this.getCompiledStyles(),className:"lc-checkbox",children:$("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 te(w({},this.getTypoStyles()),{display:"flex"})}},dh=Se(Rr()),kr=class extends Ne{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 $("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(e){this.props.element.clc?.at===dh.ClickActionType.ADD_TO_CART&&this.props.triggerContext.triggerData.items[0]&&this.onClick(e,{item:this.props.triggerContext.triggerData.items[0]}),this.props.onClick&&this.props.onClick("image")}getComponentStyles(){let e=this.mediaStyle.lout;if(!e||e.pos!=="absolute")return{};let t={zIndex:e.zIndex,cursor:this.props.element.clc?.at?"pointer":"auto"};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 Ne{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return $("div",{style:this.getCompiledStyles(),class:"lc-flexbox",children:$(tn,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})})}getComponentStyles(){let e=this.mediaStyle.flex??new vi,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 $("div",{style:this.getCompiledStyles(),class:"lc-flexbox",children:$(Fi,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext,item:this.props.item,noLinks:this.props.noLinks})})}},Fo=class extends Ne{render(){return $("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($("option",{value:"",selected:!t.selectedSellingPlan,children:"One time purchase"}));for(let r of t.sellingPlans??[])e.push($("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}},hh=Se(Pc()),Ho=class extends Ne{colorRegex=new RegExp('fill="#[a-zA-Z0-9]+"');constructor(){super(),Et.escape=hh.MustacheUtils.escapeHtml}render(){let e=this.getCompiledStyles(),t=this.getRating();return t||(e.display="none",t=""),$("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"}}},$o=class extends Ne{render(){return $("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($("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)}},Fi=class extends Ne{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 $(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()?$(Mo,{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=$(kr,{element:t,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?s:$("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:$($o,{element:t,item:this.props.item,triggerContext:this.props.triggerContext})}return e.t===16?$(Fo,{element:e,selectedVariant:this.props.item.selectedOrFirstVariant.value,item:this.props.item,triggerContext:this.props.triggerContext}):e.t===19?$(Ho,{element:e,triggerContext:this.props.triggerContext,review:this.props.item.reviews}):e.t===18||e.t===3?$(Mn,{element:e,item:this.props.item,triggerContext:this.props.triggerContext}):$(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=$(Ft,{element:e,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?t:$("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"}))}},gh=Se(Jo()),kn=class extends Ne{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 Kr(JSON.parse(t)),!(this.productElement.hide||!this.matchWhenCondition(this.productElement.when)))return $("div",{style:w({},this.getCompiledStyles()),class:"lc-single-product",children:$(Fi,{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=Q.formatCurrency(t.d,!0),s=this.props.item.variantImage??this.props.item.imageURL,o=this.props.item.meta,c=this.props.item.tags?.join(",")??"",u=this.props.item.reviews?.rating,d=this.props.item.reviews?.totalReviews,m=t.cmp&&t.cmp>t.d,h=this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(this.props.item.quantity):this.props.item.quantity,v={name:r,price:i,quantity:h,image_url:s,meta:o,category:n,rating:u,reviews:d,tags:c},E=e.effectivePrice.value!==t.d;E&&(v.effective_price=Q.formatCurrency(e.effectivePrice.value));let y=this.props.triggerContext.triggerData.discount.type===gh.DiscountType.BXGY;if(!E&&y&&(v.effective_price=Q.formatCurrency(e.effectivePrice.value),v.price=""),m){v.compare_price=Q.formatCurrency(t.cmp);let D=t.cmp-t.d;v.discount_percent=(D/t.cmp*100).toFixed(0),v.discount_price=Q.formatCurrency(D)}let _={name:e.name,quantity:this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(e.quantity):e.quantity};return{product:v,variant:_,svg:{color:()=>"{{svg.color}}",size:()=>"{{svg.size}}"}}}};function lc(){let e="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.js";return new Promise(t=>{if(window.Swiper){t();return}if(Array.from(document.scripts).some(n=>n.src.includes(e))){let n=setInterval(()=>{window.Swiper&&(clearInterval(n),t())},50)}let r=document.createElement("script");r.src=e,r.onload=()=>{t()},r.onerror=()=>{r.remove()},document.body.appendChild(r)})}function uc(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
65
|
style="background-color: ${t.pagination.color?.rgba};"></span>
|
|
66
66
|
`,renderProgressbar:n=>`
|
|
67
67
|
<span class="${n}"
|
|
68
68
|
style="background-color: ${t.pagination.color?.rgba};">
|
|
69
69
|
</span>
|
|
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 pc(e,t,r){let n={color:e.navigation.color?.rgba};return e.pagination.enabled&&(n.transform="translateY(-25%)"),$("div",{class:"swiper-container",ref:t,children:[$("div",{class:"swiper-wrapper",children:r()}),e.navigation.enabled&&$("div",{class:"swiper-button-next",style:n,children:$("span",{})}),e.navigation.enabled&&$("div",{class:"swiper-button-prev",style:n,children:$("span",{})}),e.pagination.enabled&&$("div",{className:"swiper-pagination",style:{bottom:0,top:"unset",position:"relative",color:e.pagination.color?.rgba}})]})}var jo=class extends Ne{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&&lc().then(()=>{this.swiperInstance=uc(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=>$("div",{class:"swiper-slide",children:this.getProductFragment(i)}));t=$("div",{style:te(w({},this.getCompiledStyles()),{display:"block"}),class:"lc-product-swiper-list",children:pc(this.configuration,r,n)})}else t=$("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 $(fr,{children:[$(kn,{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&&$("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:$(Ft,{element:this.props.element.prod.symbol,triggerContext:this.props.triggerContext})})]},e.mID)}},Vo=class extends Ne{swiperRef=null;swiperInstance=null;constructor(e,t){super(e,t)}componentDidMount(){lc().then(()=>{this.swiperInstance=uc(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=>$("div",{class:"swiper-slide",onClick:()=>this.onClick({clickAction:this.getClickAction(n)}),children:this.renderElement(n)}));return pc(e.conf,t,r)}getComponentStyles(){return{}}renderElement(e){let t=this.valueAddedSlide(this.props.element.slide,e);switch(t?.t){case 1:return $(kr,{element:t,triggerContext:this.props.triggerContext});case 4:return $(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 Ne{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 $(Fr,{element:t,triggerContext:this.props.triggerContext,elements:t.elems})}if(e.t===61)return $(Uo,{element:e,triggerContext:this.props.triggerContext});if(e.t===3)return this.state.showButton?$(Mn,{element:e,triggerContext:this.props.triggerContext}):void 0;if(e.t===2)return $(Ft,{element:e,triggerContext:this.props.triggerContext});if(e.t===1)return $(kr,{element:e,triggerContext:this.props.triggerContext});if(e.t===11)return $(jo,{element:e,triggerContext:this.props.triggerContext});if(e.t===12)return $(kn,{element:e,item:this.props.triggerContext.triggerData.items[0],triggerContext:this.props.triggerContext});if(e.t===62)return $(Vo,{element:e,triggerContext:this.props.triggerContext})}}render(){return this.props.elements.map(e=>this.renderElement(e))}getComponentStyles(){return{}}},Wo=class extends Ne{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 $(fr,{children:[$("div",{style:this.getCompiledStyles(),class:"lc-container",onClick:()=>{this.onClick({clickAction:this.clickAction})},children:$(tn,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})}),this.props.triggerContext.triggerData.id==="preview"&&$("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)}},Nt=class ss{constructor(t){this.engagementTrigger=t,this.triggerContext=new Pi(new Date,this.engagementTrigger)}static renderedEngagements=[];static engagementIDsWithTrackedDisplay=new Set;static DEBOUNCE_TIME=1e3;rootContainer;widgetElement;widget;triggerContext;observers=[];runtimeData=ue.get();widgetAPIService=se.get(cr);safeHTTPService=se.get(fe);scrollSubscription;variation;isExclusionWithBVariation;renderSilently(){this.render().catch(t=>Le.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(),ss.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){Eh.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&&vh.JSUtils.hasKeys(t.props)&&(this.engagementTrigger.props=w(w({},this.engagementTrigger.props),t.props)),this.triggerContext.triggerData.widget=this.widget=new wi(t.widget),this.triggerContext.triggerData.contentID=t.contentID,this.triggerContext.triggerData.variation=this.variation=t.variation,this.triggerContext.triggerData.placement=t.placement,this.triggerContext.triggerData.manipulation=t.manipulation,this.triggerContext.triggerData.content=t.content,this.isExclusionWithBVariation=this.engagementTrigger.isExclusionTesting()&&this.variation==="b",this.isExclusionWithBVariation&&(this.rootContainer.style.height="0.5px"))}addToRendered(){ss.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=Pn(window,"scroll").pipe(ar(ss.DEBOUNCE_TIME)).subscribe(()=>{this.checkAndSendEvent()})}async checkAndSendEvent(){let t=this.engagementTrigger.shortID;if(ss.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 Ee(n,r,this.engagementTrigger);i.name===N.EVENT_CAMPAIGN_HOLDOUT&&(i.trigger.holdout=!0),this.safeHTTPService.sendEvent(i),ss.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 Q.retrySelector(u[0].trim()))?.shadowRoot,n=u[1].trim(),i&&At.injectStylesheet(Dt.styleURL,i);let d=Pe.get().website.commonCSS;i&&d&&At.injectRawCSS(d,i)}b.debug(`${this.engagementTrigger} attempt to render ${r.position}-${n}`);let s=await Q.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 Mi.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=Pe.get().website.commonCSS;n&&At.injectRawCSS(n,r),At.injectStylesheet(Dt.styleURL,r),At.injectStylesheet("https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css",r),t=r}af(Vc(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)yh.ArrayUtils.remove(r,s)}getItemDiff(t,r){return t.filter(n=>!r.some(i=>i.selectedOrFirstVariant.value.mID===n.selectedOrFirstVariant.value.mID))}},Dr=class Yh extends Nt{static renderedEngagements=[];constructor(t){super(t)}addToRendered(){Yh.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()}},fc=class Xh{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 Xh(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 Tt(this.engagementTrigger);u.placement.selector=`.${c}`,u.items=[o];let d=new Dr(u);d.renderSilently(),this.watchForCartItemDeletion(d,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))})}},_h=Se(Rr()),mc=class extends Dr{ctaListener=new en;constructor(e){super(e),Cr.get().subscriber(N.CART_UPDATE_BROADCAST).pipe(Xu(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];for(let r of t){if(e.amount<r.minValue)break;if(b.log("Current milestone",r),r.rewardType===_h.MilestoneRewardType.FREE_AUTO_GIFT){let n=r.items[0],i=e.items.find(s=>s.vID===n.vID||s.mID===n.mID);if(i)b.log(`Item(vID:${n.vID}) already present in the cart. Updating item's properties`),await this.ctaListener.performUpdate(i,{properties:this.engagementTrigger.getPrivateAttributesForLineItem()});else{let s=await this.ctaListener.performAddToCart([n],this.engagementTrigger);ze.get().refreshUI(s,!1)}}}}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})}},dc=class extends Nt{constructor(e){super(e)}shouldStopRendering(){return!1}renderContainer(){if(this.widgetElement?.isConnected){this.addToRendered();return}let e=this.widgetElement=document.createElement("cooee-shoppable-videos");e.className="cooee-root",e.triggerContext=this.triggerContext,e.addEventListener("sendEvent",t=>{let r=t.detail;this.safeHTTPService.sendEvent(r)}),e.setAttribute("engagement",this.engagementTrigger.shortID),this.rootContainer.appendChild(e),this.addToRendered()}},Sh=Se(ti()),hc=class extends Nt{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(!Sh.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}})}},Hi=class{runtimeData=ue.get();processCartWidgetResponse(e){this.runtimeData.isCartDirty=!1,this.runtimeData.cartEngagements=e;let t=[...Dr.renderedEngagements];Dr.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 mc(r).renderSilently():r.isSubscriptionUpsell()?fc.renderCartUpsell(r):new Dr(r).renderSilently());this.removeOldWidgets(t)}processPageWidgetResponse(e){let t=[...Nt.renderedEngagements];Nt.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 dc(r).renderSilently():r.isBYOB()?new hc(r).renderSilently():new Nt(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()}},$i=class{runtimeData=ue.get();httpService=se.get(dt);sessionManager=se.get(qe);constructor(){}async getWidgetProps(){let e={};e.engagementIDs=this.addAvailableEngagementShortIDs(),e.locale=this.runtimeData.locale,await this.addSessionContext(e),e.currentItem=this.runtimeData.getCurrentItem();try{e.cart=await de.getCurrent().getNormalisedCart()}catch(i){b.error("Error fetching Shopify cart before sending widget call",i)}let t=new URLSearchParams(location.search),r=t.get("cooee-preview");r?e.previewIDs=r.trim().split(",").filter(i=>Number.isInteger(+i)):this.runtimeData.previewIDs?.length&&(e.previewIDs=this.runtimeData.previewIDs);let n=t.get("cooee-variant");return n?e.previewVariant=n:this.runtimeData.previewVariant&&(e.previewVariant=this.runtimeData.previewVariant),e}async addSessionContext(e){let t=await this.sessionManager.checkSessionAndGetContext();e.sessionID=t[0],e.sessionNumber=t[1],e.landingPage=t[2],e.page=Tr.parseFromCurrent()}addAvailableEngagementShortIDs(){let e=document.querySelectorAll(".letscooee-engagement"),t=[];return e.forEach(r=>{let n=r.dataset.engagementId;n&&+n&&t.push(n)}),t}},cr=class zh extends $i{static INSTANCE;loadWidgetsSubject=new Ct;constructor(){super(),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))}),Cr.get().subscriber(N.CART_UPDATE_BROADCAST).subscribe(()=>this.loadWidgetsSubject.next())}static getInstance(){return this.INSTANCE||(this.INSTANCE=new zh),this.INSTANCE}loadOrRenderWidgetsAfterCartChange(){this.runtimeData.isCartDirty?this.loadWidgetsSilently():this.renderCachedCartWidgets()}loadPageWidgetsSilently(){qe.replaySubject.subscribe(async()=>{this.loadPageWidgets().catch(t=>b.error("Unable to initiate load page widgets",t))})}loadCartWidgetsSilently(){qe.replaySubject.subscribe(async()=>{this.loadCartWidgets().catch(t=>b.error("Unable to initiate cart widgets",t))})}loadWidgetsSilently(){qe.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 Tt(i));new Hi().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 Tt(i));new Hi().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 Hi().processCartWidgetResponse(this.runtimeData.cartEngagements)}},gc=class{eventAPIService;constructor(){this.eventAPIService=se.get(rn)}processResponse(e){for(let t of e)t.experiment?.cssSelector&&this.runExperiment(t)}async runExperiment(e){if(!e.experiment?.cssSelector){b.error("No CSS selector present in experiment",e.toString);return}let t;try{t=await Q.retrySelectors(e.experiment.cssSelector)}catch{b.error("Fail to get CSS selector for experiment",e.toString());return}if(t?.length){for(let r of t)if(e.experiment.op==="SHOW")r.style.display="block";else if(e.experiment.op==="HIDE")r.style.display="none";else{b.error("Invalid experiment operation",e.toString);return}this.eventAPIService.trackExperiment({name:N.EVENT_EXPERIMENT_START,experiment:new Qr(e)}).catch(r=>{b.error("Fail to track experiment",r)})}}},rn=class Jh extends $i{static INSTANCE;constructor(){super()}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Jh),this.INSTANCE}loadExperimentSilently(){De.get(oe.SDK_TOKEN).then(t=>{t?this.loadExperiments().catch(r=>b.error("Unable to initiate experiment",r)):qe.replaySubject.subscribe(async()=>{this.loadExperiments().catch(r=>b.error("Unable to initiate experiment",r))})})}async loadExperiments(){if(!this.runtimeData.activeExperiment)return;let t=await this.getWidgetProps();b.log("Load experiments",t),this.httpService.post("/v1/engagement/experiments",t).then(async r=>{let n=r.experiments.map(i=>new Tt(i));new gc().processResponse(n)}).catch(r=>{b.error("Error sending experiment getter",r)})}async trackExperiment(t){await this.addSessionContext(t),await this.httpService.post("/v1/event/experiment",t)}},yc=class{runtimeData=ue.get();widgetAPIService=se.get(cr);experimentAPIService=se.get(rn);meddle(){let e=be.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=be.globalRef;e.loadPageWidgets=()=>{this.widgetAPIService.loadPageWidgetsSilently()},e.loadCartWidgets=()=>{this.widgetAPIService.loadCartWidgetsSilently()},e.loadExperiments=()=>{this.experimentAPIService.loadExperimentSilently()},e.previewWidget=be.previewWidget.bind(be),e.previewPopup=be.previewPopup.bind(be)}overwritePush(e,t){ui(e,"push",t)}meddleAccount(){this.overwritePush(be.globalRef.account,(...e)=>{this.processAccount(e[0])}),be.globalRef.account.forEach(this.processAccount.bind(this))}meddleEvents(){this.overwritePush(be.globalRef.events,(...e)=>{this.processEvent(e[0])}),be.globalRef.events.forEach(this.processEvent.bind(this))}meddleProfile(){this.overwritePush(be.globalRef.profile,(...e)=>{this.processProfile(e[0])}),be.globalRef.profile.forEach(this.processProfile.bind(this))}meddleScreen(){this.overwritePush(be.globalRef.screen,(...e)=>{this.processPageName(e[0])}),be.globalRef.screen.forEach(this.processPageName.bind(this))}processAccount(e){e&&(e.appID&&be.authenticate(e),e.flags&&Ln.setFlags(e.flags))}processEvent(e){e&&(N.JS_LOAD_WHITELIST_EVENTS.includes(e[0])?be.sendEvent(e[0],e[1],w({occurred:this.runtimeData.jsLoadTime},e[2])):be.sendEvent(e[0],e[1],e[2]))}processProfile(e){e&&be.updateProfile(e)}processPageName(e){e&&be.setPageName(e)}meddlePage(){this.overwritePush(be.globalRef.page,(...e)=>{this.processPage(e[0])}),be.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.locale&&(this.runtimeData.locale=e.locale),e.pageName&&be.setPageName(e.pageName),e.activeExperiment&&(this.runtimeData.activeExperiment=e.activeExperiment)}},ji=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))}},Vi=class zo{static INSTANCE;static DEBOUNCE_TIME=1e3;static THRESHOLD=10;safeHttpService=se.get(fe);_lastScreenOrScroll=new Date;lastPercent=0;constructor(){}set lastScreenOrScroll(t){this._lastScreenOrScroll=t}static getInstance(){return this.INSTANCE||(this.INSTANCE=new zo),this.INSTANCE}resetScrollID(t){ji.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)}Q.onDocumentLoaded(()=>{this.observeWindowScroll()})}observeWindowScroll(){Pn(window,"scroll").pipe(ar(zo.DEBOUNCE_TIME),On(()=>{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)>=zo.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=ji.getString(N.SESSION_STORAGE_SCROLL_ID,""),i=new Ee(N.EVENT_SCROLL,r,null,n);this.safeHttpService.sendEvent(i),ji.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)}},vc=class Qh{static ACTIVE_DURATION="aDur";static INACTIVE_DURATION="iaDur";apiService=se.get(fe);runtimeData=ue.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 Ee(N.EVENT_APP_BACKGROUND,r))}},Ec=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)&&(ue.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,d=Math.abs(c.quantity-o.quantity),m=te(w({},o),{quantity:d});u?i.push(m):s.push(m)}r&&Q.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)&&Cr.get().broadcast(N.CART_UPDATE_BROADCAST,{itemsAdded:i,itemsRemoved:s})}sendEvent(e,t){let r=new Ee(e,t);se.get(fe).sendEvent(r)}async compareCartItems(){let e=await De.get(oe.CURRENT_CART,{}),t=await de.getCurrent().getNormalisedCart(!0);this.sendChangesAsEvents(e,t)}},_c=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){Le.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 Q.getCartAttributes();return e.variables.input.attributes=[...t,...r],JSON.stringify(e)}sendBuyNowEvent(){let e=ue.get().getCurrentItem();if(!e)return;let t=new Ee(N.EVENT_BUY_NOW_CLICKED,{items:[e]});fe.getInstance().sendEvent(t)}},Wi=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 Ee(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 Q.retrySelectorForElements(this.selectorString),this.elements.forEach(e=>{e.addEventListener("click",this.clickListenerCallback)})}removeClickListener(e){this.elements?.forEach(t=>{t.removeEventListener("click",e)})}},Sc=class Lc extends Wi{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(Lc.selectors,N.EVENT_ITEM_THUMBNAIL_CLICKED)}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Lc),this.INSTANCE}},wc=class il extends Wi{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(il.selectors,N.EVENT_REVIEW_CLICKED)}static getInstance(){return this.INSTANCE||(this.INSTANCE=new il),this.INSTANCE}},bc=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(){Q.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()}},Ic=class{trackSilently(){this.track().catch(e=>Le.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 se.get(qe).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 Ee(N.EVENT_CHECKOUT_STARTED,t);fe.getInstance().sendEvent(r)})}},Tc=class{async migrate(){}};Et.escape=wh.MustacheUtils.escapeHtml;var be=class{static globalRef;static authenticated;static async initForMerchantWebsiteOnly(){window.cooeeSDKPreview||(this.initGlobalReference(),await new Tc().migrate(),this.autoAuthenticate(),new yc().meddle(),se.get(rn).loadExperimentSilently(),new vc().listen(),new Ic().trackSilently(),new Ec().listen(),new _c().listen(),new bc().listen(),se.get(Vi).listen(),se.get(wc).listenSilently(),se.get(Sc).listenSilently(),se.get(cr).loadPageWidgetsSilently(),this.attachGoKwikListeners(),this.storePreviewParams(),this.setupPreviewListeners(),er.watch())}static async initForAll(){this.injectWidgetAssets()}static initGlobalReference(){window.CooeeSDK||ui(window,"CooeeSDK",{}),this.globalRef=window.CooeeSDK,ui(this.globalRef,"config",new Pe),ui(this.globalRef,"runtimeData",new ue),b.debug("Global reference initialised")}static injectWidgetAssets(){At.injectScriptURL(Dt.widgetURL,"cooee-widget-sdk"),At.injectStylesheet(Dt.styleURL)}static autoAuthenticate(){let e=Be.getShopName();e&&this.authenticate({shopifyShop:e})}static authenticate(e){if(this.authenticated)return;let t=e.appID?.trim(),r=e.shopifyShop;if((Q.isNull(t)||t.length!==24)&&Q.isNull(r)){b.warn("Cooee App ID or Shop name is not configured");return}this.authenticated=!0,se.get(qe).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 Ee(e,t,r?.triggerData);r?.occurred&&(n.occurred=r.occurred),se.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 '");se.get(fe).updateProfile(e)}static setPageName(e){if(!e)return;let t=ue.get(),r=t.pageName;if(e===r)return;if(t.pageName=e,e==="cart"&&se.get(cr).loadOrRenderWidgetsAfterCartChange(),N.BLACKLISTED_PAGE_NAMES.some(s=>e.includes(s))){se.get(Vi).resetScrollID();return}let n={};r&&(n.ps=r);let i=new Ee(N.EVENT_SCREEN_VIEW,n);i.occurred=t.jsLoadTime,se.get(fe).sendEvent(i),se.get(Vi).resetScrollID(i.occurred)}static previewPopup(e,t){new Ui(t).render(e)}static previewWidget(e){new Nt(new Tt(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=ue.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=ue.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 be.initForMerchantWebsiteOnly(),await be.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 pc(e,t,r){let n={color:e.navigation.color?.rgba};return e.pagination.enabled&&(n.transform="translateY(-25%)"),$("div",{class:"swiper-container",ref:t,children:[$("div",{class:"swiper-wrapper",children:r()}),e.navigation.enabled&&$("div",{class:"swiper-button-next",style:n,children:$("span",{})}),e.navigation.enabled&&$("div",{class:"swiper-button-prev",style:n,children:$("span",{})}),e.pagination.enabled&&$("div",{className:"swiper-pagination",style:{bottom:0,top:"unset",position:"relative",color:e.pagination.color?.rgba}})]})}var jo=class extends Ne{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&&lc().then(()=>{this.swiperInstance=uc(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=>$("div",{class:"swiper-slide",children:this.getProductFragment(i)}));t=$("div",{style:te(w({},this.getCompiledStyles()),{display:"block"}),class:"lc-product-swiper-list",children:pc(this.configuration,r,n)})}else t=$("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 $(fr,{children:[$(kn,{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&&$("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:$(Ft,{element:this.props.element.prod.symbol,triggerContext:this.props.triggerContext})})]},e.mID)}},Vo=class extends Ne{swiperRef=null;swiperInstance=null;constructor(e,t){super(e,t)}componentDidMount(){lc().then(()=>{this.swiperInstance=uc(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=>$("div",{class:"swiper-slide",onClick:i=>this.onClick(i,{clickAction:this.getClickAction(n)}),children:this.renderElement(n)}));return pc(e.conf,t,r)}getComponentStyles(){return{}}renderElement(e){let t=this.valueAddedSlide(this.props.element.slide,e);switch(t?.t){case 1:return $(kr,{element:t,triggerContext:this.props.triggerContext});case 4:return $(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 Ne{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 $(Fr,{element:t,triggerContext:this.props.triggerContext,elements:t.elems})}if(e.t===61)return $(Uo,{element:e,triggerContext:this.props.triggerContext});if(e.t===3)return this.state.showButton?$(Mn,{element:e,triggerContext:this.props.triggerContext}):void 0;if(e.t===2)return $(Ft,{element:e,triggerContext:this.props.triggerContext});if(e.t===1)return $(kr,{element:e,triggerContext:this.props.triggerContext});if(e.t===11)return $(jo,{element:e,triggerContext:this.props.triggerContext});if(e.t===12)return $(kn,{element:e,item:this.props.triggerContext.triggerData.items[0],triggerContext:this.props.triggerContext});if(e.t===62)return $(Vo,{element:e,triggerContext:this.props.triggerContext})}}render(){return this.props.elements.map(e=>this.renderElement(e))}getComponentStyles(){return{}}},Wo=class extends Ne{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 $(fr,{children:[$("div",{style:this.getCompiledStyles(),class:"lc-container",onClick:e=>{this.onClick(e,{clickAction:this.clickAction})},children:$(tn,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})}),this.props.triggerContext.triggerData.id==="preview"&&$("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,t){if(this.isClickable)return super.onClick(e,t)}},Nt=class ss{constructor(t){this.engagementTrigger=t,this.triggerContext=new Pi(new Date,this.engagementTrigger)}static renderedEngagements=[];static engagementIDsWithTrackedDisplay=new Set;static DEBOUNCE_TIME=1e3;rootContainer;widgetElement;widget;triggerContext;observers=[];runtimeData=ue.get();widgetAPIService=se.get(cr);safeHTTPService=se.get(fe);scrollSubscription;variation;isExclusionWithBVariation;renderSilently(){this.render().catch(t=>Le.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(),ss.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){Eh.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&&vh.JSUtils.hasKeys(t.props)&&(this.engagementTrigger.props=w(w({},this.engagementTrigger.props),t.props)),this.triggerContext.triggerData.widget=this.widget=new wi(t.widget),this.triggerContext.triggerData.contentID=t.contentID,this.triggerContext.triggerData.variation=this.variation=t.variation,this.triggerContext.triggerData.placement=t.placement,this.triggerContext.triggerData.manipulation=t.manipulation,this.triggerContext.triggerData.content=t.content,this.isExclusionWithBVariation=this.engagementTrigger.isExclusionTesting()&&this.variation==="b",this.isExclusionWithBVariation&&(this.rootContainer.style.height="0.5px"))}addToRendered(){ss.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=Pn(window,"scroll").pipe(ar(ss.DEBOUNCE_TIME)).subscribe(()=>{this.checkAndSendEvent()})}async checkAndSendEvent(){let t=this.engagementTrigger.shortID;if(ss.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 Ee(n,r,this.engagementTrigger);i.name===N.EVENT_CAMPAIGN_HOLDOUT&&(i.trigger.holdout=!0),this.safeHTTPService.sendEvent(i),ss.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 Q.retrySelector(u[0].trim()))?.shadowRoot,n=u[1].trim(),i&&At.injectStylesheet(Dt.styleURL,i);let d=Pe.get().website.commonCSS;i&&d&&At.injectRawCSS(d,i)}b.debug(`${this.engagementTrigger} attempt to render ${r.position}-${n}`);let s=await Q.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 Mi.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=Pe.get().website.commonCSS;n&&At.injectRawCSS(n,r),At.injectStylesheet(Dt.styleURL,r),At.injectStylesheet("https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css",r),t=r}af(Vc(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)yh.ArrayUtils.remove(r,s)}getItemDiff(t,r){return t.filter(n=>!r.some(i=>i.selectedOrFirstVariant.value.mID===n.selectedOrFirstVariant.value.mID))}},Dr=class Yh extends Nt{static renderedEngagements=[];constructor(t){super(t)}addToRendered(){Yh.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()}},fc=class Xh{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 Xh(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 Tt(this.engagementTrigger);u.placement.selector=`.${c}`,u.items=[o];let d=new Dr(u);d.renderSilently(),this.watchForCartItemDeletion(d,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))})}},_h=Se(Rr()),mc=class extends Dr{ctaListener=new en;constructor(e){super(e),Cr.get().subscriber(N.CART_UPDATE_BROADCAST).pipe(Xu(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];for(let r of t){if(e.amount<r.minValue)break;if(b.log("Current milestone",r),r.rewardType===_h.MilestoneRewardType.FREE_AUTO_GIFT){let n=r.items[0],i=e.items.find(s=>s.vID===n.vID||s.mID===n.mID);if(i)b.log(`Item(vID:${n.vID}) already present in the cart. Updating item's properties`),await this.ctaListener.performUpdate(i,{properties:this.engagementTrigger.getPrivateAttributesForLineItem()});else{let s=await this.ctaListener.performAddToCart([n],this.engagementTrigger);ze.get().refreshUI(s,!1)}}}}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})}},dc=class extends Nt{constructor(e){super(e)}shouldStopRendering(){return!1}renderContainer(){if(this.widgetElement?.isConnected){this.addToRendered();return}let e=this.widgetElement=document.createElement("cooee-shoppable-videos");e.className="cooee-root",e.triggerContext=this.triggerContext,e.addEventListener("sendEvent",t=>{let r=t.detail;this.safeHTTPService.sendEvent(r)}),e.setAttribute("engagement",this.engagementTrigger.shortID),this.rootContainer.appendChild(e),this.addToRendered()}},Sh=Se(ti()),hc=class extends Nt{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(!Sh.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}})}},Hi=class{runtimeData=ue.get();processCartWidgetResponse(e){this.runtimeData.isCartDirty=!1,this.runtimeData.cartEngagements=e;let t=[...Dr.renderedEngagements];Dr.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 mc(r).renderSilently():r.isSubscriptionUpsell()?fc.renderCartUpsell(r):new Dr(r).renderSilently());this.removeOldWidgets(t)}processPageWidgetResponse(e){let t=[...Nt.renderedEngagements];Nt.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 dc(r).renderSilently():r.isBYOB()?new hc(r).renderSilently():new Nt(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()}},$i=class{runtimeData=ue.get();httpService=se.get(dt);sessionManager=se.get(qe);constructor(){}async getWidgetProps(){let e={};e.engagementIDs=this.addAvailableEngagementShortIDs(),e.locale=this.runtimeData.locale,await this.addSessionContext(e),e.currentItem=this.runtimeData.getCurrentItem();try{e.cart=await de.getCurrent().getNormalisedCart()}catch(i){b.error("Error fetching Shopify cart before sending widget call",i)}let t=new URLSearchParams(location.search),r=t.get("cooee-preview");r?e.previewIDs=r.trim().split(",").filter(i=>Number.isInteger(+i)):this.runtimeData.previewIDs?.length&&(e.previewIDs=this.runtimeData.previewIDs);let n=t.get("cooee-variant");return n?e.previewVariant=n:this.runtimeData.previewVariant&&(e.previewVariant=this.runtimeData.previewVariant),e}async addSessionContext(e){let t=await this.sessionManager.checkSessionAndGetContext();e.sessionID=t[0],e.sessionNumber=t[1],e.landingPage=t[2],e.page=Tr.parseFromCurrent()}addAvailableEngagementShortIDs(){let e=document.querySelectorAll(".letscooee-engagement"),t=[];return e.forEach(r=>{let n=r.dataset.engagementId;n&&+n&&t.push(n)}),t}},cr=class zh extends $i{static INSTANCE;loadWidgetsSubject=new Ct;constructor(){super(),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))}),Cr.get().subscriber(N.CART_UPDATE_BROADCAST).subscribe(()=>this.loadWidgetsSubject.next())}static getInstance(){return this.INSTANCE||(this.INSTANCE=new zh),this.INSTANCE}loadOrRenderWidgetsAfterCartChange(){this.runtimeData.isCartDirty?this.loadWidgetsSilently():this.renderCachedCartWidgets()}loadPageWidgetsSilently(){qe.replaySubject.subscribe(async()=>{this.loadPageWidgets().catch(t=>b.error("Unable to initiate load page widgets",t))})}loadCartWidgetsSilently(){qe.replaySubject.subscribe(async()=>{this.loadCartWidgets().catch(t=>b.error("Unable to initiate cart widgets",t))})}loadWidgetsSilently(){qe.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 Tt(i));new Hi().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 Tt(i));new Hi().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 Hi().processCartWidgetResponse(this.runtimeData.cartEngagements)}},gc=class{eventAPIService;constructor(){this.eventAPIService=se.get(rn)}processResponse(e){for(let t of e)t.experiment?.cssSelector&&this.runExperiment(t)}async runExperiment(e){if(!e.experiment?.cssSelector){b.error("No CSS selector present in experiment",e.toString);return}let t;try{t=await Q.retrySelectors(e.experiment.cssSelector)}catch{b.error("Fail to get CSS selector for experiment",e.toString());return}if(t?.length){for(let r of t)if(e.experiment.op==="SHOW")r.style.display="block";else if(e.experiment.op==="HIDE")r.style.display="none";else{b.error("Invalid experiment operation",e.toString);return}this.eventAPIService.trackExperiment({name:N.EVENT_EXPERIMENT_START,experiment:new Qr(e)}).catch(r=>{b.error("Fail to track experiment",r)})}}},rn=class Jh extends $i{static INSTANCE;constructor(){super()}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Jh),this.INSTANCE}loadExperimentSilently(){De.get(oe.SDK_TOKEN).then(t=>{t?this.loadExperiments().catch(r=>b.error("Unable to initiate experiment",r)):qe.replaySubject.subscribe(async()=>{this.loadExperiments().catch(r=>b.error("Unable to initiate experiment",r))})})}async loadExperiments(){if(!this.runtimeData.activeExperiment)return;let t=await this.getWidgetProps();b.log("Load experiments",t),this.httpService.post("/v1/engagement/experiments",t).then(async r=>{let n=r.experiments.map(i=>new Tt(i));new gc().processResponse(n)}).catch(r=>{b.error("Error sending experiment getter",r)})}async trackExperiment(t){await this.addSessionContext(t),await this.httpService.post("/v1/event/experiment",t)}},yc=class{runtimeData=ue.get();widgetAPIService=se.get(cr);experimentAPIService=se.get(rn);meddle(){let e=be.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=be.globalRef;e.loadPageWidgets=()=>{this.widgetAPIService.loadPageWidgetsSilently()},e.loadCartWidgets=()=>{this.widgetAPIService.loadCartWidgetsSilently()},e.loadExperiments=()=>{this.experimentAPIService.loadExperimentSilently()},e.previewWidget=be.previewWidget.bind(be),e.previewPopup=be.previewPopup.bind(be)}overwritePush(e,t){ui(e,"push",t)}meddleAccount(){this.overwritePush(be.globalRef.account,(...e)=>{this.processAccount(e[0])}),be.globalRef.account.forEach(this.processAccount.bind(this))}meddleEvents(){this.overwritePush(be.globalRef.events,(...e)=>{this.processEvent(e[0])}),be.globalRef.events.forEach(this.processEvent.bind(this))}meddleProfile(){this.overwritePush(be.globalRef.profile,(...e)=>{this.processProfile(e[0])}),be.globalRef.profile.forEach(this.processProfile.bind(this))}meddleScreen(){this.overwritePush(be.globalRef.screen,(...e)=>{this.processPageName(e[0])}),be.globalRef.screen.forEach(this.processPageName.bind(this))}processAccount(e){e&&(e.appID&&be.authenticate(e),e.flags&&Ln.setFlags(e.flags))}processEvent(e){e&&(N.JS_LOAD_WHITELIST_EVENTS.includes(e[0])?be.sendEvent(e[0],e[1],w({occurred:this.runtimeData.jsLoadTime},e[2])):be.sendEvent(e[0],e[1],e[2]))}processProfile(e){e&&be.updateProfile(e)}processPageName(e){e&&be.setPageName(e)}meddlePage(){this.overwritePush(be.globalRef.page,(...e)=>{this.processPage(e[0])}),be.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.locale&&(this.runtimeData.locale=e.locale),e.pageName&&be.setPageName(e.pageName),e.activeExperiment&&(this.runtimeData.activeExperiment=e.activeExperiment)}},ji=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))}},Vi=class zo{static INSTANCE;static DEBOUNCE_TIME=1e3;static THRESHOLD=10;safeHttpService=se.get(fe);_lastScreenOrScroll=new Date;lastPercent=0;constructor(){}set lastScreenOrScroll(t){this._lastScreenOrScroll=t}static getInstance(){return this.INSTANCE||(this.INSTANCE=new zo),this.INSTANCE}resetScrollID(t){ji.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)}Q.onDocumentLoaded(()=>{this.observeWindowScroll()})}observeWindowScroll(){Pn(window,"scroll").pipe(ar(zo.DEBOUNCE_TIME),On(()=>{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)>=zo.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=ji.getString(N.SESSION_STORAGE_SCROLL_ID,""),i=new Ee(N.EVENT_SCROLL,r,null,n);this.safeHttpService.sendEvent(i),ji.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)}},vc=class Qh{static ACTIVE_DURATION="aDur";static INACTIVE_DURATION="iaDur";apiService=se.get(fe);runtimeData=ue.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 Ee(N.EVENT_APP_BACKGROUND,r))}},Ec=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)&&(ue.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,d=Math.abs(c.quantity-o.quantity),m=te(w({},o),{quantity:d});u?i.push(m):s.push(m)}r&&Q.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)&&Cr.get().broadcast(N.CART_UPDATE_BROADCAST,{itemsAdded:i,itemsRemoved:s})}sendEvent(e,t){let r=new Ee(e,t);se.get(fe).sendEvent(r)}async compareCartItems(){let e=await De.get(oe.CURRENT_CART,{}),t=await de.getCurrent().getNormalisedCart(!0);this.sendChangesAsEvents(e,t)}},_c=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){Le.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 Q.getCartAttributes();return e.variables.input.attributes=[...t,...r],JSON.stringify(e)}sendBuyNowEvent(){let e=ue.get().getCurrentItem();if(!e)return;let t=new Ee(N.EVENT_BUY_NOW_CLICKED,{items:[e]});fe.getInstance().sendEvent(t)}},Wi=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 Ee(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 Q.retrySelectorForElements(this.selectorString),this.elements.forEach(e=>{e.addEventListener("click",this.clickListenerCallback)})}removeClickListener(e){this.elements?.forEach(t=>{t.removeEventListener("click",e)})}},Sc=class Lc extends Wi{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(Lc.selectors,N.EVENT_ITEM_THUMBNAIL_CLICKED)}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Lc),this.INSTANCE}},wc=class il extends Wi{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(il.selectors,N.EVENT_REVIEW_CLICKED)}static getInstance(){return this.INSTANCE||(this.INSTANCE=new il),this.INSTANCE}},bc=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(){Q.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()}},Ic=class{trackSilently(){this.track().catch(e=>Le.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 se.get(qe).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 Ee(N.EVENT_CHECKOUT_STARTED,t);fe.getInstance().sendEvent(r)})}},Tc=class{async migrate(){}};Et.escape=wh.MustacheUtils.escapeHtml;var be=class{static globalRef;static authenticated;static async initForMerchantWebsiteOnly(){window.cooeeSDKPreview||(this.initGlobalReference(),await new Tc().migrate(),this.autoAuthenticate(),new yc().meddle(),se.get(rn).loadExperimentSilently(),new vc().listen(),new Ic().trackSilently(),new Ec().listen(),new _c().listen(),new bc().listen(),se.get(Vi).listen(),se.get(wc).listenSilently(),se.get(Sc).listenSilently(),se.get(cr).loadPageWidgetsSilently(),this.attachGoKwikListeners(),this.storePreviewParams(),this.setupPreviewListeners(),er.watch())}static async initForAll(){this.injectWidgetAssets()}static initGlobalReference(){window.CooeeSDK||ui(window,"CooeeSDK",{}),this.globalRef=window.CooeeSDK,ui(this.globalRef,"config",new Pe),ui(this.globalRef,"runtimeData",new ue),b.debug("Global reference initialised")}static injectWidgetAssets(){At.injectScriptURL(Dt.widgetURL,"cooee-widget-sdk"),At.injectStylesheet(Dt.styleURL)}static autoAuthenticate(){let e=Be.getShopName();e&&this.authenticate({shopifyShop:e})}static authenticate(e){if(this.authenticated)return;let t=e.appID?.trim(),r=e.shopifyShop;if((Q.isNull(t)||t.length!==24)&&Q.isNull(r)){b.warn("Cooee App ID or Shop name is not configured");return}this.authenticated=!0,se.get(qe).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 Ee(e,t,r?.triggerData);r?.occurred&&(n.occurred=r.occurred),se.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 '");se.get(fe).updateProfile(e)}static setPageName(e){if(!e)return;let t=ue.get(),r=t.pageName;if(e===r)return;if(t.pageName=e,e==="cart"&&se.get(cr).loadOrRenderWidgetsAfterCartChange(),N.BLACKLISTED_PAGE_NAMES.some(s=>e.includes(s))){se.get(Vi).resetScrollID();return}let n={};r&&(n.ps=r);let i=new Ee(N.EVENT_SCREEN_VIEW,n);i.occurred=t.jsLoadTime,se.get(fe).sendEvent(i),se.get(Vi).resetScrollID(i.occurred)}static previewPopup(e,t){new Ui(t).render(e)}static previewWidget(e){new Nt(new Tt(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=ue.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=ue.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 be.initForMerchantWebsiteOnly(),await be.initForAll(),b.debug("Execution order:","IIFE end")))());b.debug("Execution order:","bottom");})();
|