@letscooee/web-sdk 9.10.12 → 9.10.14
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 +21 -21
- package/dist/widget.min.js +31 -30
- package/package.json +1 -1
package/dist/main.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";(()=>{var dd=Object.create;var bc=Object.defineProperty;var fd=Object.getOwnPropertyDescriptor;var gd=Object.getOwnPropertyNames;var md=Object.getPrototypeOf,yd=Object.prototype.hasOwnProperty;var vd=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of gd(e))!yd.call(t,i)&&i!==r&&bc(t,i,{get:()=>e[i],enumerable:!(n=fd(e,i))||n.enumerable});return t};var wd=(t,e,r)=>(r=t!=null?dd(md(t)):{},vd(e||!t||!t.__esModule?bc(r,"default",{value:t,enumerable:!0}):r,t));var bd=Object.create,Zo=Object.defineProperty,_d=Object.defineProperties,Ed=Object.getOwnPropertyDescriptor,Sd=Object.getOwnPropertyDescriptors,Id=Object.getOwnPropertyNames,_c=Object.getOwnPropertySymbols,Cd=Object.getPrototypeOf,hu=Object.prototype.hasOwnProperty,Td=Object.prototype.propertyIsEnumerable,Ec=(t,e,r)=>e in t?Zo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,D=(t,e)=>{for(var r in e||={})hu.call(e,r)&&Ec(t,r,e[r]);if(_c)for(var r of _c(e))Td.call(e,r)&&Ec(t,r,e[r]);return t},wt=(t,e)=>_d(t,Sd(e)),fi=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')}),qe=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),xd=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Id(e))!hu.call(t,i)&&i!==r&&Zo(t,i,{get:()=>e[i],enumerable:!(n=Ed(e,i))||n.enumerable});return t},dt=(t,e,r)=>(r=t!=null?bd(Cd(t)):{},xd(e||!t||!t.__esModule?Zo(r,"default",{value:t,enumerable:!0}):r,t)),an=qe((t,e)=>{"use strict";(function(r){"use strict";var n={};n.VERSION="1.6.1";var i,s={},o=function(p,_){return function(){return _.apply(p,arguments)}},a=function(){var p=arguments,_=p[0],w,b;for(b=1;b<p.length;b++)for(w in p[b])!(w in _)&&p[b].hasOwnProperty(w)&&(_[w]=p[b][w]);return _},l=function(p,_){return{value:p,name:_}};n.TRACE=l(1,"TRACE"),n.DEBUG=l(2,"DEBUG"),n.INFO=l(3,"INFO"),n.TIME=l(4,"TIME"),n.WARN=l(5,"WARN"),n.ERROR=l(8,"ERROR"),n.OFF=l(99,"OFF");var h=function(p){this.context=p,this.setLevel(p.filterLevel),this.log=this.info};h.prototype={setLevel:function(p){p&&"value"in p&&(this.context.filterLevel=p)},getLevel:function(){return this.context.filterLevel},enabledFor:function(p){var _=this.context.filterLevel;return p.value>=_.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(p){typeof p=="string"&&p.length>0&&this.invoke(n.TIME,[p,"start"])},timeEnd:function(p){typeof p=="string"&&p.length>0&&this.invoke(n.TIME,[p,"end"])},invoke:function(p,_){i&&this.enabledFor(p)&&i(_,a({level:p},this.context))}};var g=new h({filterLevel:n.OFF});(function(){var p=n;p.enabledFor=o(g,g.enabledFor),p.trace=o(g,g.trace),p.debug=o(g,g.debug),p.time=o(g,g.time),p.timeEnd=o(g,g.timeEnd),p.info=o(g,g.info),p.warn=o(g,g.warn),p.error=o(g,g.error),p.log=p.info})(),n.setHandler=function(p){i=p},n.setLevel=function(p){g.setLevel(p);for(var _ in s)s.hasOwnProperty(_)&&s[_].setLevel(p)},n.getLevel=function(){return g.getLevel()},n.get=function(p){return s[p]||(s[p]=new h(a({name:p},g.context)))},n.createDefaultHandler=function(p){p=p||{},p.formatter=p.formatter||function(b,E){E.name&&b.unshift("["+E.name+"]")};var _={},w=function(b,E){Function.prototype.apply.call(b,console,E)};return typeof console>"u"?function(){}:function(b,E){b=Array.prototype.slice.call(b);var P=console.log,A;E.level===n.TIME?(A=(E.name?"["+E.name+"] ":"")+b[0],b[1]==="start"?console.time?console.time(A):_[A]=new Date().getTime():console.timeEnd?console.timeEnd(A):w(P,[A+": "+(new Date().getTime()-_[A])+"ms"])):(E.level===n.WARN&&console.warn?P=console.warn:E.level===n.ERROR&&console.error?P=console.error:E.level===n.INFO&&console.info?P=console.info:E.level===n.DEBUG&&console.debug?P=console.debug:E.level===n.TRACE&&console.trace&&(P=console.trace),p.formatter(b,E),w(P,b))}},n.useDefaults=function(p){n.setLevel(p&&p.defaultLevel||n.DEBUG),n.setHandler(n.createDefaultHandler(p))},n.setDefaults=n.useDefaults,typeof define=="function"&&define.amd?define(n):typeof e<"u"&&e.exports?e.exports=n:(n._prevLogger=r.Logger,n.noConflict=function(){return r.Logger=n._prevLogger,n},r.Logger=n)})(t)}),pu=qe(t=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MustacheUtils=void 0;var e=class du{static escapeHtml(n){return String(n).replace(/"/g,i=>du.entityMap[i])}};t.MustacheUtils=e,e.entityMap={'"':"""}}),lr=qe(t=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MilestoneRewardType=t.ProgressBarLayout=t.EngagementContentSource=t.EngagementObjective=t.OnsiteDeliveryType=t.ClickActionType=t.FrequencyGapUnit=t.FrequencyType=t.RedirectBehaviour=t.EngagementPlacementPosition=t.EngagementCollectionSource=t.PromotionType=t.CartFilterEnum=t.CartCurrencyOperator=t.CartCriteria=t.URLCriteria=t.UTMCriteria=t.CartItemSource=t.EngagementItemSource=t.PurchasedVisitor=t.LoggedInVisitor=t.SessionType=t.EngagementContentType=t.TriggerType=t.EngagementType=t.EngagementStatus=t.TimePreference=t.ScheduleFrequency=t.CriteriaFrequency=void 0;var e=function(m){return m[m.ONCE_PER_USER=1]="ONCE_PER_USER",m[m.ONCE_PER_SESSION=2]="ONCE_PER_SESSION",m[m.EVERY_TIME=3]="EVERY_TIME",m}(e||(t.CriteriaFrequency=e={})),r=function(m){return m[m.ONE_TIME=1]="ONE_TIME",m[m.MULTIPLE=2]="MULTIPLE",m[m.RECURRING=3]="RECURRING",m}(r||(t.ScheduleFrequency=r={})),n=function(m){return m[m.NOW=1]="NOW",m[m.LATER=2]="LATER",m[m.NEVER=3]="NEVER",m}(n||(t.TimePreference=n={})),i=function(m){return m[m.PUBLISHED=1]="PUBLISHED",m[m.DRAFT=2]="DRAFT",m[m.PAUSED=3]="PAUSED",m[m.STOPPED=5]="STOPPED",m[m.COMPLETED=6]="COMPLETED",m[m.UNINSTALLED=8]="UNINSTALLED",m}(i||(t.EngagementStatus=i={})),s=function(m){return m.CAMPAIGN="CAMPAIGN",m.NATIVE_AB="NATIVE_AB",m.CRO_COPILOT="CRO_COPILOT",m}(s||(t.EngagementType=s={})),o=function(m){return m[m.NONE=0]="NONE",m[m.RULE_BASED=1]="RULE_BASED",m[m.INTENT_BASED=2]="INTENT_BASED",m}(o||(t.TriggerType=o={})),a=function(m){return m[m.SINGLE=1]="SINGLE",m[m.EXCLUSION=2]="EXCLUSION",m[m.ABTESTING=3]="ABTESTING",m}(a||(t.EngagementContentType=a={})),l=function(m){return m[m.ALL=0]="ALL",m[m.NEW_ONLY=1]="NEW_ONLY",m[m.RETURNING_ONLY=2]="RETURNING_ONLY",m}(l||(t.SessionType=l={})),h=function(m){return m.ALL="ALL",m.LOGGED_IN="LOGGED_IN",m.NON_LOGGED_IN="NON_LOGGED_IN",m}(h||(t.LoggedInVisitor=h={})),g=function(m){return m.ALL="ALL",m.PURCHASED="PURCHASED",m.NON_PURCHASED="NON_PURCHASED",m}(g||(t.PurchasedVisitor=g={})),p=function(m){return m[m.NONE=0]="NONE",m[m.ITEM_RECOMMENDATION=1]="ITEM_RECOMMENDATION",m[m.MULTIPLE_ITEMS=2]="MULTIPLE_ITEMS",m[m.SINGLE_ITEM=3]="SINGLE_ITEM",m[m.TOP_SELLING=4]="TOP_SELLING",m[m.STOCK_CLEARANCE=5]="STOCK_CLEARANCE",m[m.NEW_ARRIVALS=6]="NEW_ARRIVALS",m[m.RECENTLY_VIEWED=7]="RECENTLY_VIEWED",m[m.EVENT_ITEM=8]="EVENT_ITEM",m[m.CART_ITEM=9]="CART_ITEM",m[m.BUNDLE=10]="BUNDLE",m[m.CURRENT_ITEM=11]="CURRENT_ITEM",m[m.PURCHASED_PREVIOUSLY=12]="PURCHASED_PREVIOUSLY",m[m.COLLECTION_ITEMS=13]="COLLECTION_ITEMS",m[m.TRENDING_ITEMS=14]="TRENDING_ITEMS",m}(p||(t.EngagementItemSource=p={})),_=function(m){return m[m.LAST_ADDED=1]="LAST_ADDED",m[m.FIRST_ADDED=2]="FIRST_ADDED",m[m.HIGHEST_PRICE=3]="HIGHEST_PRICE",m[m.LOWEST_PRICE=4]="LOWEST_PRICE",m[m.FIRST_MATCHING_TAG=5]="FIRST_MATCHING_TAG",m[m.ALL=6]="ALL",m}(_||(t.CartItemSource=_={})),w=function(m){return m[m.ALL=0]="ALL",m[m.ONLY_ORGANIC=1]="ONLY_ORGANIC",m[m.ONLY_NON_ORGANIC=2]="ONLY_NON_ORGANIC",m[m.INCLUDES=3]="INCLUDES",m[m.EXCLUDES=4]="EXCLUDES",m}(w||(t.UTMCriteria=w={})),b=function(m){return m[m.NONE=0]="NONE",m[m.LIKE=1]="LIKE",m[m.NOT_LIKE=2]="NOT_LIKE",m[m.EQUALS=3]="EQUALS",m[m.NOT_EQUALS=4]="NOT_EQUALS",m}(b||(t.URLCriteria=b={})),E=function(m){return m[m.NONE=0]="NONE",m[m.LESS_THAN=1]="LESS_THAN",m[m.GREATER_THAN=2]="GREATER_THAN",m[m.BETWEEN=3]="BETWEEN",m[m.EQUALS=4]="EQUALS",m}(E||(t.CartCriteria=E={})),P=function(m){return m[m.ALL=0]="ALL",m[m.INCLUDES=1]="INCLUDES",m[m.EXCLUDES=2]="EXCLUDES",m}(P||(t.CartCurrencyOperator=P={})),A=function(m){return m[m.NONE=0]="NONE",m[m.AMOUNT=1]="AMOUNT",m[m.TOTAL_PRODUCT=2]="TOTAL_PRODUCT",m[m.UNIQUE_PRODUCT=3]="UNIQUE_PRODUCT",m}(A||(t.CartFilterEnum=A={})),M=function(m){return m[m.NONE=0]="NONE",m[m.ITEM=1]="ITEM",m[m.COLLECTION=2]="COLLECTION",m}(M||(t.PromotionType=M={})),z=function(m){return m[m.NONE=0]="NONE",m[m.SINGLE=1]="SINGLE",m[m.MULTIPLE=2]="MULTIPLE",m}(z||(t.EngagementCollectionSource=z={})),B=function(m){return m.BEFORE="before",m.AFTER="after",m.INSIDE_FIRST="insideFirst",m.INSIDE_LAST="insideLast",m}(B||(t.EngagementPlacementPosition=B={})),Z=function(m){return m.SHOPIFY_CHECKOUT="shopify_checkout",m.THIRD_PARTY_CHECKOUT="third_party_checkout",m.CART_PAGE="cart_page",m.CART_DRAWER="cart_drawer",m}(Z||(t.RedirectBehaviour=Z={})),bt=function(m){return m.ONCE_IN_SESSION="ONCE_IN_SESSION",m.ACROSS_SESSIONS="ACROSS_SESSIONS",m}(bt||(t.FrequencyType=bt={})),It=function(m){return m.DAYS="DAYS",m.HOURS="HOURS",m.MINUTES="MINUTES",m.SECONDS="SECONDS",m}(It||(t.FrequencyGapUnit=It={})),H=function(m){return m[m.NONE=0]="NONE",m[m.REJECT_POPUP=1]="REJECT_POPUP",m[m.ACCEPT_POPUP=2]="ACCEPT_POPUP",m[m.GO_TO_URL=4]="GO_TO_URL",m[m.SHARE=5]="SHARE",m[m.KEY_VALUE=100]="KEY_VALUE",m[m.GO_TO_PRODUCT=101]="GO_TO_PRODUCT",m[m.ADD_TO_CART=102]="ADD_TO_CART",m[m.COPY_COUPON_CODE=103]="COPY_COUPON_CODE",m[m.GO_TO_COLLECTION=104]="GO_TO_COLLECTION",m[m.OPEN_CART=105]="OPEN_CART",m[m.SUBMIT_FORM=106]="SUBMIT_FORM",m[m.INITIATE_CHECKOUT=107]="INITIATE_CHECKOUT",m[m.ADD_BUNDLE=108]="ADD_BUNDLE",m[m.UPGRADE_TO_SUBSCRIPTION=109]="UPGRADE_TO_SUBSCRIPTION",m}(H||(t.ClickActionType=H={})),rt=function(m){return m.POPUP="POPUP",m.PAGE_EMBED="PAGE_EMBED",m.CART_EMBED="CART_EMBED",m.ANNOUNCEMENT_BAR="ANNOUNCEMENT_BAR",m}(rt||(t.OnsiteDeliveryType=rt={})),X=function(m){return m.PRODUCT_PROMOTION="PRODUCT_PROMOTION",m.BUNDLE_AND_UPSELL="BUNDLE_AND_UPSELL",m.CART_RECOVERY="CART_RECOVERY",m.ANNOUNCEMENT="ANNOUNCEMENT",m.LEAD_GENERATION="LEAD_GENERATION",m.DATA_COLLECTION="DATA_COLLECTION",m.SALE_PROMOTION="SALE_PROMOTION",m.SUBSCRIPTION_UPSELL="SUBSCRIPTION_UPSELL",m.SHOPPABLE_VIDEO="SHOPPABLE_VIDEO",m.BYOB="BYOB",m.PROGRESS_BAR="PROGRESS_BAR",m.BUY_NOW="BUY_NOW",m.STICKY_ATC="STICKY_ATC",m.EXPERIMENT="EXPERIMENT",m}(X||(t.EngagementObjective=X={})),tt=function(m){return m.COOEE="COOEE",m.KLAVIYO="KLAVIYO",m}(tt||(t.EngagementContentSource=tt={})),ct=function(m){return m.ICONS="ICONS",m.TILES="TILES",m}(ct||(t.ProgressBarLayout=ct={})),Tt=function(m){return m.FREE_SHIPPING="FREE_SHIPPING",m.DISCOUNT="DISCOUNT",m.FREE_AUTO_GIFT="FREE_AUTO_GIFT",m.FREE_GIFT_SELECT="FREE_GIFT_SELECT",m}(Tt||(t.MilestoneRewardType=Tt={}))}),Xo=qe(t=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PriceRuleType=t.DiscountType=void 0;var e=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}(e||(t.DiscountType=e={})),r=function(n){return n.FIXED_AMOUNT="fixed_amount",n.PERCENTAGE="percentage",n}(r||(t.PriceRuleType=r={}))}),fu=qe(t=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ArrayUtils=void 0;var e=class gu{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,a)=>a.findIndex(l=>l[i]===s[i])===o)}static shuffle(n){let i=n.length;for(;i!=0;){let s=Math.floor(Math.random()*i);i--,gu.swap(n,i,s)}}};t.ArrayUtils=e}),Dd=qe((t,e)=>{"use strict";(function(r){if(typeof t=="object"&&typeof e<"u")e.exports=r();else if(typeof define=="function"&&define.amd)define([],r);else{var n;typeof window<"u"?n=window:typeof global<"u"?n=global:typeof self<"u"?n=self:n=this,n.localforage=r()}})(function(){var r,n,i;return function s(o,a,l){function h(_,w){if(!a[_]){if(!o[_]){var b=typeof fi=="function"&&fi;if(!w&&b)return b(_,!0);if(g)return g(_,!0);var E=new Error("Cannot find module '"+_+"'");throw E.code="MODULE_NOT_FOUND",E}var P=a[_]={exports:{}};o[_][0].call(P.exports,function(A){var M=o[_][1][A];return h(M||A)},P,P.exports,s,o,a,l)}return a[_].exports}for(var g=typeof fi=="function"&&fi,p=0;p<l.length;p++)h(l[p]);return h}({1:[function(s,o,a){(function(l){"use strict";var h=l.MutationObserver||l.WebKitMutationObserver,g;if(h){var p=0,_=new h(A),w=l.document.createTextNode("");_.observe(w,{characterData:!0}),g=function(){w.data=p=++p%2}}else if(!l.setImmediate&&typeof l.MessageChannel<"u"){var b=new l.MessageChannel;b.port1.onmessage=A,g=function(){b.port2.postMessage(0)}}else"document"in l&&"onreadystatechange"in l.document.createElement("script")?g=function(){var z=l.document.createElement("script");z.onreadystatechange=function(){A(),z.onreadystatechange=null,z.parentNode.removeChild(z),z=null},l.document.documentElement.appendChild(z)}:g=function(){setTimeout(A,0)};var E,P=[];function A(){E=!0;for(var z,B,Z=P.length;Z;){for(B=P,P=[],z=-1;++z<Z;)B[z]();Z=P.length}E=!1}o.exports=M;function M(z){P.push(z)===1&&!E&&g()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(s,o,a){"use strict";var l=s(1);function h(){}var g={},p=["REJECTED"],_=["FULFILLED"],w=["PENDING"];o.exports=b;function b(H){if(typeof H!="function")throw new TypeError("resolver must be a function");this.state=w,this.queue=[],this.outcome=void 0,H!==h&&M(this,H)}b.prototype.catch=function(H){return this.then(null,H)},b.prototype.then=function(H,rt){if(typeof H!="function"&&this.state===_||typeof rt!="function"&&this.state===p)return this;var X=new this.constructor(h);if(this.state!==w){var tt=this.state===_?H:rt;P(X,tt,this.outcome)}else this.queue.push(new E(X,H,rt));return X};function E(H,rt,X){this.promise=H,typeof rt=="function"&&(this.onFulfilled=rt,this.callFulfilled=this.otherCallFulfilled),typeof X=="function"&&(this.onRejected=X,this.callRejected=this.otherCallRejected)}E.prototype.callFulfilled=function(H){g.resolve(this.promise,H)},E.prototype.otherCallFulfilled=function(H){P(this.promise,this.onFulfilled,H)},E.prototype.callRejected=function(H){g.reject(this.promise,H)},E.prototype.otherCallRejected=function(H){P(this.promise,this.onRejected,H)};function P(H,rt,X){l(function(){var tt;try{tt=rt(X)}catch(ct){return g.reject(H,ct)}tt===H?g.reject(H,new TypeError("Cannot resolve promise with itself")):g.resolve(H,tt)})}g.resolve=function(H,rt){var X=z(A,rt);if(X.status==="error")return g.reject(H,X.value);var tt=X.value;if(tt)M(H,tt);else{H.state=_,H.outcome=rt;for(var ct=-1,Tt=H.queue.length;++ct<Tt;)H.queue[ct].callFulfilled(rt)}return H},g.reject=function(H,rt){H.state=p,H.outcome=rt;for(var X=-1,tt=H.queue.length;++X<tt;)H.queue[X].callRejected(rt);return H};function A(H){var rt=H&&H.then;if(H&&(typeof H=="object"||typeof H=="function")&&typeof rt=="function")return function(){rt.apply(H,arguments)}}function M(H,rt){var X=!1;function tt(Ft){X||(X=!0,g.reject(H,Ft))}function ct(Ft){X||(X=!0,g.resolve(H,Ft))}function Tt(){rt(ct,tt)}var m=z(Tt);m.status==="error"&&tt(m.value)}function z(H,rt){var X={};try{X.value=H(rt),X.status="success"}catch(tt){X.status="error",X.value=tt}return X}b.resolve=B;function B(H){return H instanceof this?H:g.resolve(new this(h),H)}b.reject=Z;function Z(H){var rt=new this(h);return g.reject(rt,H)}b.all=bt;function bt(H){var rt=this;if(Object.prototype.toString.call(H)!=="[object Array]")return this.reject(new TypeError("must be an array"));var X=H.length,tt=!1;if(!X)return this.resolve([]);for(var ct=new Array(X),Tt=0,m=-1,Ft=new this(h);++m<X;)qt(H[m],m);return Ft;function qt(mt,zt){rt.resolve(mt).then(ot,function(nt){tt||(tt=!0,g.reject(Ft,nt))});function ot(nt){ct[zt]=nt,++Tt===X&&!tt&&(tt=!0,g.resolve(Ft,ct))}}}b.race=It;function It(H){var rt=this;if(Object.prototype.toString.call(H)!=="[object Array]")return this.reject(new TypeError("must be an array"));var X=H.length,tt=!1;if(!X)return this.resolve([]);for(var ct=-1,Tt=new this(h);++ct<X;)m(H[ct]);return Tt;function m(Ft){rt.resolve(Ft).then(function(qt){tt||(tt=!0,g.resolve(Tt,qt))},function(qt){tt||(tt=!0,g.reject(Tt,qt))})}}},{1:1}],3:[function(s,o,a){(function(l){"use strict";typeof l.Promise!="function"&&(l.Promise=s(2))}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(s,o,a){"use strict";var l=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 h(f,y){if(!(f instanceof y))throw new TypeError("Cannot call a class as a function")}function g(){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 p=g();function _(){try{if(!p||!p.open)return!1;var f=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),y=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!f||y)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function w(f,y){f=f||[],y=y||{};try{return new Blob(f,y)}catch(T){if(T.name!=="TypeError")throw T;for(var v=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,C=new v,I=0;I<f.length;I+=1)C.append(f[I]);return C.getBlob(y.type)}}typeof Promise>"u"&&s(3);var b=Promise;function E(f,y){y&&f.then(function(v){y(null,v)},function(v){y(v)})}function P(f,y,v){typeof y=="function"&&f.then(y),typeof v=="function"&&f.catch(v)}function A(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 z="local-forage-detect-blob-support",B=void 0,Z={},bt=Object.prototype.toString,It="readonly",H="readwrite";function rt(f){for(var y=f.length,v=new ArrayBuffer(y),C=new Uint8Array(v),I=0;I<y;I++)C[I]=f.charCodeAt(I);return v}function X(f){return new b(function(y){var v=f.transaction(z,H),C=w([""]);v.objectStore(z).put(C,"key"),v.onabort=function(I){I.preventDefault(),I.stopPropagation(),y(!1)},v.oncomplete=function(){var I=navigator.userAgent.match(/Chrome\/(\d+)/),T=navigator.userAgent.match(/Edge\//);y(T||!I||parseInt(I[1],10)>=43)}}).catch(function(){return!1})}function tt(f){return typeof B=="boolean"?b.resolve(B):X(f).then(function(y){return B=y,B})}function ct(f){var y=Z[f.name],v={};v.promise=new b(function(C,I){v.resolve=C,v.reject=I}),y.deferredOperations.push(v),y.dbReady?y.dbReady=y.dbReady.then(function(){return v.promise}):y.dbReady=v.promise}function Tt(f){var y=Z[f.name],v=y.deferredOperations.pop();if(v)return v.resolve(),v.promise}function m(f,y){var v=Z[f.name],C=v.deferredOperations.pop();if(C)return C.reject(y),C.promise}function Ft(f,y){return new b(function(v,C){if(Z[f.name]=Z[f.name]||hi(),f.db)if(y)ct(f),f.db.close();else return v(f.db);var I=[f.name];y&&I.push(f.version);var T=p.open.apply(p,I);y&&(T.onupgradeneeded=function(k){var F=T.result;try{F.createObjectStore(f.storeName),k.oldVersion<=1&&F.createObjectStore(z)}catch(G){if(G.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 G}}),T.onerror=function(k){k.preventDefault(),C(T.error)},T.onsuccess=function(){var k=T.result;k.onversionchange=function(F){F.target.close()},v(k),Tt(f)}})}function qt(f){return Ft(f,!1)}function mt(f){return Ft(f,!0)}function zt(f,y){if(!f.db)return!0;var v=!f.db.objectStoreNames.contains(f.storeName),C=f.version<f.db.version,I=f.version>f.db.version;if(C&&(f.version!==y&&console.warn('The database "'+f.name+`" can't be downgraded from version `+f.db.version+" to version "+f.version+"."),f.version=f.db.version),I||v){if(v){var T=f.db.version+1;T>f.version&&(f.version=T)}return!0}return!1}function ot(f){return new b(function(y,v){var C=new FileReader;C.onerror=v,C.onloadend=function(I){var T=btoa(I.target.result||"");y({__local_forage_encoded_blob:!0,data:T,type:f.type})},C.readAsBinaryString(f)})}function nt(f){var y=rt(atob(f.data));return w([y],{type:f.type})}function Ht(f){return f&&f.__local_forage_encoded_blob}function li(f){var y=this,v=y._initReady().then(function(){var C=Z[y._dbInfo.name];if(C&&C.dbReady)return C.dbReady});return P(v,f,f),v}function ui(f){ct(f);for(var y=Z[f.name],v=y.forages,C=0;C<v.length;C++){var I=v[C];I._dbInfo.db&&(I._dbInfo.db.close(),I._dbInfo.db=null)}return f.db=null,qt(f).then(function(T){return f.db=T,zt(f)?mt(f):T}).then(function(T){f.db=y.db=T;for(var k=0;k<v.length;k++)v[k]._dbInfo.db=T}).catch(function(T){throw m(f,T),T})}function ce(f,y,v,C){C===void 0&&(C=1);try{var I=f.db.transaction(f.storeName,y);v(null,I)}catch(T){if(C>0&&(!f.db||T.name==="InvalidStateError"||T.name==="NotFoundError"))return b.resolve().then(function(){if(!f.db||T.name==="NotFoundError"&&!f.db.objectStoreNames.contains(f.storeName)&&f.version<=f.db.version)return f.db&&(f.version=f.db.version+1),mt(f)}).then(function(){return ui(f).then(function(){ce(f,y,v,C-1)})}).catch(v);v(T)}}function hi(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function _s(f){var y=this,v={db:null};if(f)for(var C in f)v[C]=f[C];var I=Z[v.name];I||(I=hi(),Z[v.name]=I),I.forages.push(y),y._initReady||(y._initReady=y.ready,y.ready=li);var T=[];function k(){return b.resolve()}for(var F=0;F<I.forages.length;F++){var G=I.forages[F];G!==y&&T.push(G._initReady().catch(k))}var W=I.forages.slice(0);return b.all(T).then(function(){return v.db=I.db,qt(v)}).then(function(V){return v.db=V,zt(v,y._defaultConfig.version)?mt(v):V}).then(function(V){v.db=I.db=V,y._dbInfo=v;for(var Q=0;Q<W.length;Q++){var st=W[Q];st!==y&&(st._dbInfo.db=v.db,st._dbInfo.version=v.version)}})}function gn(f,y){var v=this;f=A(f);var C=new b(function(I,T){v.ready().then(function(){ce(v._dbInfo,It,function(k,F){if(k)return T(k);try{var G=F.objectStore(v._dbInfo.storeName),W=G.get(f);W.onsuccess=function(){var V=W.result;V===void 0&&(V=null),Ht(V)&&(V=nt(V)),I(V)},W.onerror=function(){T(W.error)}}catch(V){T(V)}})}).catch(T)});return E(C,y),C}function Es(f,y){var v=this,C=new b(function(I,T){v.ready().then(function(){ce(v._dbInfo,It,function(k,F){if(k)return T(k);try{var G=F.objectStore(v._dbInfo.storeName),W=G.openCursor(),V=1;W.onsuccess=function(){var Q=W.result;if(Q){var st=Q.value;Ht(st)&&(st=nt(st));var _t=f(st,Q.key,V++);_t!==void 0?I(_t):Q.continue()}else I()},W.onerror=function(){T(W.error)}}catch(Q){T(Q)}})}).catch(T)});return E(C,y),C}function Ss(f,y,v){var C=this;f=A(f);var I=new b(function(T,k){var F;C.ready().then(function(){return F=C._dbInfo,bt.call(y)==="[object Blob]"?tt(F.db).then(function(G){return G?y:ot(y)}):y}).then(function(G){ce(C._dbInfo,H,function(W,V){if(W)return k(W);try{var Q=V.objectStore(C._dbInfo.storeName);G===null&&(G=void 0);var st=Q.put(G,f);V.oncomplete=function(){G===void 0&&(G=null),T(G)},V.onabort=V.onerror=function(){var _t=st.error?st.error:st.transaction.error;k(_t)}}catch(_t){k(_t)}})}).catch(k)});return E(I,v),I}function pi(f,y){var v=this;f=A(f);var C=new b(function(I,T){v.ready().then(function(){ce(v._dbInfo,H,function(k,F){if(k)return T(k);try{var G=F.objectStore(v._dbInfo.storeName),W=G.delete(f);F.oncomplete=function(){I()},F.onerror=function(){T(W.error)},F.onabort=function(){var V=W.error?W.error:W.transaction.error;T(V)}}catch(V){T(V)}})}).catch(T)});return E(C,y),C}function Ur(f){var y=this,v=new b(function(C,I){y.ready().then(function(){ce(y._dbInfo,H,function(T,k){if(T)return I(T);try{var F=k.objectStore(y._dbInfo.storeName),G=F.clear();k.oncomplete=function(){C()},k.onabort=k.onerror=function(){var W=G.error?G.error:G.transaction.error;I(W)}}catch(W){I(W)}})}).catch(I)});return E(v,f),v}function le(f){var y=this,v=new b(function(C,I){y.ready().then(function(){ce(y._dbInfo,It,function(T,k){if(T)return I(T);try{var F=k.objectStore(y._dbInfo.storeName),G=F.count();G.onsuccess=function(){C(G.result)},G.onerror=function(){I(G.error)}}catch(W){I(W)}})}).catch(I)});return E(v,f),v}function mn(f,y){var v=this,C=new b(function(I,T){if(f<0){I(null);return}v.ready().then(function(){ce(v._dbInfo,It,function(k,F){if(k)return T(k);try{var G=F.objectStore(v._dbInfo.storeName),W=!1,V=G.openKeyCursor();V.onsuccess=function(){var Q=V.result;if(!Q){I(null);return}f===0||W?I(Q.key):(W=!0,Q.advance(f))},V.onerror=function(){T(V.error)}}catch(Q){T(Q)}})}).catch(T)});return E(C,y),C}function Is(f){var y=this,v=new b(function(C,I){y.ready().then(function(){ce(y._dbInfo,It,function(T,k){if(T)return I(T);try{var F=k.objectStore(y._dbInfo.storeName),G=F.openKeyCursor(),W=[];G.onsuccess=function(){var V=G.result;if(!V){C(W);return}W.push(V.key),V.continue()},G.onerror=function(){I(G.error)}}catch(V){I(V)}})}).catch(I)});return E(v,f),v}function c(f,y){y=M.apply(this,arguments);var v=this.config();f=typeof f!="function"&&f||{},f.name||(f.name=f.name||v.name,f.storeName=f.storeName||v.storeName);var C=this,I;if(!f.name)I=b.reject("Invalid arguments");else{var T=f.name===v.name&&C._dbInfo.db,k=T?b.resolve(C._dbInfo.db):qt(f).then(function(F){var G=Z[f.name],W=G.forages;G.db=F;for(var V=0;V<W.length;V++)W[V]._dbInfo.db=F;return F});f.storeName?I=k.then(function(F){if(F.objectStoreNames.contains(f.storeName)){var G=F.version+1;ct(f);var W=Z[f.name],V=W.forages;F.close();for(var Q=0;Q<V.length;Q++){var st=V[Q];st._dbInfo.db=null,st._dbInfo.version=G}var _t=new b(function(ft,Rt){var Dt=p.open(f.name,G);Dt.onerror=function(ue){var Ns=Dt.result;Ns.close(),Rt(ue)},Dt.onupgradeneeded=function(){var ue=Dt.result;ue.deleteObjectStore(f.storeName)},Dt.onsuccess=function(){var ue=Dt.result;ue.close(),ft(ue)}});return _t.then(function(ft){W.db=ft;for(var Rt=0;Rt<V.length;Rt++){var Dt=V[Rt];Dt._dbInfo.db=ft,Tt(Dt._dbInfo)}}).catch(function(ft){throw(m(f,ft)||b.resolve()).catch(function(){}),ft})}}):I=k.then(function(F){ct(f);var G=Z[f.name],W=G.forages;F.close();for(var V=0;V<W.length;V++){var Q=W[V];Q._dbInfo.db=null}var st=new b(function(_t,ft){var Rt=p.deleteDatabase(f.name);Rt.onerror=function(){var Dt=Rt.result;Dt&&Dt.close(),ft(Rt.error)},Rt.onblocked=function(){console.warn('dropInstance blocked for database "'+f.name+'" until all open connections are closed')},Rt.onsuccess=function(){var Dt=Rt.result;Dt&&Dt.close(),_t(Dt)}});return st.then(function(_t){G.db=_t;for(var ft=0;ft<W.length;ft++){var Rt=W[ft];Tt(Rt._dbInfo)}}).catch(function(_t){throw(m(f,_t)||b.resolve()).catch(function(){}),_t})})}return E(I,y),I}var u={_driver:"asyncStorage",_initStorage:_s,_support:_(),iterate:Es,getItem:gn,setItem:Ss,removeItem:pi,clear:Ur,length:le,key:mn,keys:Is,dropInstance:c};function d(){return typeof openDatabase=="function"}var S="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",N="~~local_forage_type~",j=/^~~local_forage_type~([^~]+)~/,K="__lfsc__:",ht=K.length,kt="arbf",yt="blob",xt="si08",Bt="ui08",pr="uic8",yn="si16",vn="si32",ac="ur16",cc="ui32",lc="fl32",uc="fl64",hc=ht+kt.length,pc=Object.prototype.toString;function dc(f){var y=f.length*.75,v=f.length,C,I=0,T,k,F,G;f[f.length-1]==="="&&(y--,f[f.length-2]==="="&&y--);var W=new ArrayBuffer(y),V=new Uint8Array(W);for(C=0;C<v;C+=4)T=S.indexOf(f[C]),k=S.indexOf(f[C+1]),F=S.indexOf(f[C+2]),G=S.indexOf(f[C+3]),V[I++]=T<<2|k>>4,V[I++]=(k&15)<<4|F>>2,V[I++]=(F&3)<<6|G&63;return W}function Cs(f){var y=new Uint8Array(f),v="",C;for(C=0;C<y.length;C+=3)v+=S[y[C]>>2],v+=S[(y[C]&3)<<4|y[C+1]>>4],v+=S[(y[C+1]&15)<<2|y[C+2]>>6],v+=S[y[C+2]&63];return y.length%3===2?v=v.substring(0,v.length-1)+"=":y.length%3===1&&(v=v.substring(0,v.length-2)+"=="),v}function Ap(f,y){var v="";if(f&&(v=pc.call(f)),f&&(v==="[object ArrayBuffer]"||f.buffer&&pc.call(f.buffer)==="[object ArrayBuffer]")){var C,I=K;f instanceof ArrayBuffer?(C=f,I+=kt):(C=f.buffer,v==="[object Int8Array]"?I+=xt:v==="[object Uint8Array]"?I+=Bt:v==="[object Uint8ClampedArray]"?I+=pr:v==="[object Int16Array]"?I+=yn:v==="[object Uint16Array]"?I+=ac:v==="[object Int32Array]"?I+=vn:v==="[object Uint32Array]"?I+=cc:v==="[object Float32Array]"?I+=lc:v==="[object Float64Array]"?I+=uc:y(new Error("Failed to get type for BinaryArray"))),y(I+Cs(C))}else if(v==="[object Blob]"){var T=new FileReader;T.onload=function(){var k=N+f.type+"~"+Cs(this.result);y(K+yt+k)},T.readAsArrayBuffer(f)}else try{y(JSON.stringify(f))}catch(k){console.error("Couldn't convert value into a JSON string: ",f),y(null,k)}}function Op(f){if(f.substring(0,ht)!==K)return JSON.parse(f);var y=f.substring(hc),v=f.substring(ht,hc),C;if(v===yt&&j.test(y)){var I=y.match(j);C=I[1],y=y.substring(I[0].length)}var T=dc(y);switch(v){case kt:return T;case yt:return w([T],{type:C});case xt:return new Int8Array(T);case Bt:return new Uint8Array(T);case pr:return new Uint8ClampedArray(T);case yn:return new Int16Array(T);case ac:return new Uint16Array(T);case vn:return new Int32Array(T);case cc:return new Uint32Array(T);case lc:return new Float32Array(T);case uc:return new Float64Array(T);default:throw new Error("Unkown type: "+v)}}var Ts={serialize:Ap,deserialize:Op,stringToBuffer:dc,bufferToString:Cs};function fc(f,y,v,C){f.executeSql("CREATE TABLE IF NOT EXISTS "+y.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],v,C)}function kp(f){var y=this,v={db:null};if(f)for(var C in f)v[C]=typeof f[C]!="string"?f[C].toString():f[C];var I=new b(function(T,k){try{v.db=openDatabase(v.name,String(v.version),v.description,v.size)}catch(F){return k(F)}v.db.transaction(function(F){fc(F,v,function(){y._dbInfo=v,T()},function(G,W){k(W)})},k)});return v.serializer=Ts,I}function Ye(f,y,v,C,I,T){f.executeSql(v,C,I,function(k,F){F.code===F.SYNTAX_ERR?k.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[y.storeName],function(G,W){W.rows.length?T(G,F):fc(G,y,function(){G.executeSql(v,C,I,T)},T)},T):T(k,F)},T)}function Pp(f,y){var v=this;f=A(f);var C=new b(function(I,T){v.ready().then(function(){var k=v._dbInfo;k.db.transaction(function(F){Ye(F,k,"SELECT * FROM "+k.storeName+" WHERE key = ? LIMIT 1",[f],function(G,W){var V=W.rows.length?W.rows.item(0).value:null;V&&(V=k.serializer.deserialize(V)),I(V)},function(G,W){T(W)})})}).catch(T)});return E(C,y),C}function Rp(f,y){var v=this,C=new b(function(I,T){v.ready().then(function(){var k=v._dbInfo;k.db.transaction(function(F){Ye(F,k,"SELECT * FROM "+k.storeName,[],function(G,W){for(var V=W.rows,Q=V.length,st=0;st<Q;st++){var _t=V.item(st),ft=_t.value;if(ft&&(ft=k.serializer.deserialize(ft)),ft=f(ft,_t.key,st+1),ft!==void 0){I(ft);return}}I()},function(G,W){T(W)})})}).catch(T)});return E(C,y),C}function gc(f,y,v,C){var I=this;f=A(f);var T=new b(function(k,F){I.ready().then(function(){y===void 0&&(y=null);var G=y,W=I._dbInfo;W.serializer.serialize(y,function(V,Q){Q?F(Q):W.db.transaction(function(st){Ye(st,W,"INSERT OR REPLACE INTO "+W.storeName+" (key, value) VALUES (?, ?)",[f,V],function(){k(G)},function(_t,ft){F(ft)})},function(st){if(st.code===st.QUOTA_ERR){if(C>0){k(gc.apply(I,[f,G,v,C-1]));return}F(st)}})})}).catch(F)});return E(T,v),T}function Lp(f,y,v){return gc.apply(this,[f,y,v,1])}function Up(f,y){var v=this;f=A(f);var C=new b(function(I,T){v.ready().then(function(){var k=v._dbInfo;k.db.transaction(function(F){Ye(F,k,"DELETE FROM "+k.storeName+" WHERE key = ?",[f],function(){I()},function(G,W){T(W)})})}).catch(T)});return E(C,y),C}function Mp(f){var y=this,v=new b(function(C,I){y.ready().then(function(){var T=y._dbInfo;T.db.transaction(function(k){Ye(k,T,"DELETE FROM "+T.storeName,[],function(){C()},function(F,G){I(G)})})}).catch(I)});return E(v,f),v}function Bp(f){var y=this,v=new b(function(C,I){y.ready().then(function(){var T=y._dbInfo;T.db.transaction(function(k){Ye(k,T,"SELECT COUNT(key) as c FROM "+T.storeName,[],function(F,G){var W=G.rows.item(0).c;C(W)},function(F,G){I(G)})})}).catch(I)});return E(v,f),v}function jp(f,y){var v=this,C=new b(function(I,T){v.ready().then(function(){var k=v._dbInfo;k.db.transaction(function(F){Ye(F,k,"SELECT key FROM "+k.storeName+" WHERE id = ? LIMIT 1",[f+1],function(G,W){var V=W.rows.length?W.rows.item(0).key:null;I(V)},function(G,W){T(W)})})}).catch(T)});return E(C,y),C}function $p(f){var y=this,v=new b(function(C,I){y.ready().then(function(){var T=y._dbInfo;T.db.transaction(function(k){Ye(k,T,"SELECT key FROM "+T.storeName,[],function(F,G){for(var W=[],V=0;V<G.rows.length;V++)W.push(G.rows.item(V).key);C(W)},function(F,G){I(G)})})}).catch(I)});return E(v,f),v}function Fp(f){return new b(function(y,v){f.transaction(function(C){C.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(I,T){for(var k=[],F=0;F<T.rows.length;F++)k.push(T.rows.item(F).name);y({db:f,storeNames:k})},function(I,T){v(T)})},function(C){v(C)})})}function Hp(f,y){y=M.apply(this,arguments);var v=this.config();f=typeof f!="function"&&f||{},f.name||(f.name=f.name||v.name,f.storeName=f.storeName||v.storeName);var C=this,I;return f.name?I=new b(function(T){var k;f.name===v.name?k=C._dbInfo.db:k=openDatabase(f.name,"","",0),f.storeName?T({db:k,storeNames:[f.storeName]}):T(Fp(k))}).then(function(T){return new b(function(k,F){T.db.transaction(function(G){function W(_t){return new b(function(ft,Rt){G.executeSql("DROP TABLE IF EXISTS "+_t,[],function(){ft()},function(Dt,ue){Rt(ue)})})}for(var V=[],Q=0,st=T.storeNames.length;Q<st;Q++)V.push(W(T.storeNames[Q]));b.all(V).then(function(){k()}).catch(function(_t){F(_t)})},function(G){F(G)})})}):I=b.reject("Invalid arguments"),E(I,y),I}var Vp={_driver:"webSQLStorage",_initStorage:kp,_support:d(),iterate:Rp,getItem:Pp,setItem:Lp,removeItem:Up,clear:Mp,length:Bp,key:jp,keys:$p,dropInstance:Hp};function Wp(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function mc(f,y){var v=f.name+"/";return f.storeName!==y.storeName&&(v+=f.storeName+"/"),v}function Gp(){var f="_localforage_support_test";try{return localStorage.setItem(f,!0),localStorage.removeItem(f),!1}catch{return!0}}function qp(){return!Gp()||localStorage.length>0}function zp(f){var y=this,v={};if(f)for(var C in f)v[C]=f[C];return v.keyPrefix=mc(f,y._defaultConfig),qp()?(y._dbInfo=v,v.serializer=Ts,b.resolve()):b.reject()}function Yp(f){var y=this,v=y.ready().then(function(){for(var C=y._dbInfo.keyPrefix,I=localStorage.length-1;I>=0;I--){var T=localStorage.key(I);T.indexOf(C)===0&&localStorage.removeItem(T)}});return E(v,f),v}function Kp(f,y){var v=this;f=A(f);var C=v.ready().then(function(){var I=v._dbInfo,T=localStorage.getItem(I.keyPrefix+f);return T&&(T=I.serializer.deserialize(T)),T});return E(C,y),C}function Jp(f,y){var v=this,C=v.ready().then(function(){for(var I=v._dbInfo,T=I.keyPrefix,k=T.length,F=localStorage.length,G=1,W=0;W<F;W++){var V=localStorage.key(W);if(V.indexOf(T)===0){var Q=localStorage.getItem(V);if(Q&&(Q=I.serializer.deserialize(Q)),Q=f(Q,V.substring(k),G++),Q!==void 0)return Q}}});return E(C,y),C}function Qp(f,y){var v=this,C=v.ready().then(function(){var I=v._dbInfo,T;try{T=localStorage.key(f)}catch{T=null}return T&&(T=T.substring(I.keyPrefix.length)),T});return E(C,y),C}function Zp(f){var y=this,v=y.ready().then(function(){for(var C=y._dbInfo,I=localStorage.length,T=[],k=0;k<I;k++){var F=localStorage.key(k);F.indexOf(C.keyPrefix)===0&&T.push(F.substring(C.keyPrefix.length))}return T});return E(v,f),v}function Xp(f){var y=this,v=y.keys().then(function(C){return C.length});return E(v,f),v}function td(f,y){var v=this;f=A(f);var C=v.ready().then(function(){var I=v._dbInfo;localStorage.removeItem(I.keyPrefix+f)});return E(C,y),C}function ed(f,y,v){var C=this;f=A(f);var I=C.ready().then(function(){y===void 0&&(y=null);var T=y;return new b(function(k,F){var G=C._dbInfo;G.serializer.serialize(y,function(W,V){if(V)F(V);else try{localStorage.setItem(G.keyPrefix+f,W),k(T)}catch(Q){(Q.name==="QuotaExceededError"||Q.name==="NS_ERROR_DOM_QUOTA_REACHED")&&F(Q),F(Q)}})})});return E(I,v),I}function rd(f,y){if(y=M.apply(this,arguments),f=typeof f!="function"&&f||{},!f.name){var v=this.config();f.name=f.name||v.name,f.storeName=f.storeName||v.storeName}var C=this,I;return f.name?I=new b(function(T){f.storeName?T(mc(f,C._defaultConfig)):T(f.name+"/")}).then(function(T){for(var k=localStorage.length-1;k>=0;k--){var F=localStorage.key(k);F.indexOf(T)===0&&localStorage.removeItem(F)}}):I=b.reject("Invalid arguments"),E(I,y),I}var nd={_driver:"localStorageWrapper",_initStorage:zp,_support:Wp(),iterate:Jp,getItem:Kp,setItem:ed,removeItem:td,clear:Yp,length:Xp,key:Qp,keys:Zp,dropInstance:rd},id=function(f,y){return f===y||typeof f=="number"&&typeof y=="number"&&isNaN(f)&&isNaN(y)},sd=function(f,y){for(var v=f.length,C=0;C<v;){if(id(f[C],y))return!0;C++}return!1},yc=Array.isArray||function(f){return Object.prototype.toString.call(f)==="[object Array]"},wn={},vc={},Mr={INDEXEDDB:u,WEBSQL:Vp,LOCALSTORAGE:nd},od=[Mr.INDEXEDDB._driver,Mr.WEBSQL._driver,Mr.LOCALSTORAGE._driver],di=["dropInstance"],xs=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(di),ad={description:"",driver:od.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function cd(f,y){f[y]=function(){var v=arguments;return f.ready().then(function(){return f[y].apply(f,v)})}}function Ds(){for(var f=1;f<arguments.length;f++){var y=arguments[f];if(y)for(var v in y)y.hasOwnProperty(v)&&(yc(y[v])?arguments[0][v]=y[v].slice():arguments[0][v]=y[v])}return arguments[0]}var ld=function(){function f(y){h(this,f);for(var v in Mr)if(Mr.hasOwnProperty(v)){var C=Mr[v],I=C._driver;this[v]=I,wn[I]||this.defineDriver(C)}this._defaultConfig=Ds({},ad),this._config=Ds({},this._defaultConfig,y),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(y){if((typeof y>"u"?"undefined":l(y))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var v in y){if(v==="storeName"&&(y[v]=y[v].replace(/\W/g,"_")),v==="version"&&typeof y[v]!="number")return new Error("Database version must be a number.");this._config[v]=y[v]}return"driver"in y&&y.driver?this.setDriver(this._config.driver):!0}else return typeof y=="string"?this._config[y]:this._config},f.prototype.defineDriver=function(y,v,C){var I=new b(function(T,k){try{var F=y._driver,G=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!y._driver){k(G);return}for(var W=xs.concat("_initStorage"),V=0,Q=W.length;V<Q;V++){var st=W[V],_t=!sd(di,st);if((_t||y[st])&&typeof y[st]!="function"){k(G);return}}var ft=function(){for(var Dt=function(hd){return function(){var pd=new Error("Method "+hd+" is not implemented by the current driver"),wc=b.reject(pd);return E(wc,arguments[arguments.length-1]),wc}},ue=0,Ns=di.length;ue<Ns;ue++){var As=di[ue];y[As]||(y[As]=Dt(As))}};ft();var Rt=function(Dt){wn[F]&&console.info("Redefining LocalForage driver: "+F),wn[F]=y,vc[F]=Dt,T()};"_support"in y?y._support&&typeof y._support=="function"?y._support().then(Rt,k):Rt(!!y._support):Rt(!0)}catch(Dt){k(Dt)}});return P(I,v,C),I},f.prototype.driver=function(){return this._driver||null},f.prototype.getDriver=function(y,v,C){var I=wn[y]?b.resolve(wn[y]):b.reject(new Error("Driver not found."));return P(I,v,C),I},f.prototype.getSerializer=function(y){var v=b.resolve(Ts);return P(v,y),v},f.prototype.ready=function(y){var v=this,C=v._driverSet.then(function(){return v._ready===null&&(v._ready=v._initDriver()),v._ready});return P(C,y,y),C},f.prototype.setDriver=function(y,v,C){var I=this;yc(y)||(y=[y]);var T=this._getSupportedDrivers(y);function k(){I._config.driver=I.driver()}function F(V){return I._extend(V),k(),I._ready=I._initStorage(I._config),I._ready}function G(V){return function(){var Q=0;function st(){for(;Q<V.length;){var _t=V[Q];return Q++,I._dbInfo=null,I._ready=null,I.getDriver(_t).then(F).catch(st)}k();var ft=new Error("No available storage method found.");return I._driverSet=b.reject(ft),I._driverSet}return st()}}var W=this._driverSet!==null?this._driverSet.catch(function(){return b.resolve()}):b.resolve();return this._driverSet=W.then(function(){var V=T[0];return I._dbInfo=null,I._ready=null,I.getDriver(V).then(function(Q){I._driver=Q._driver,k(),I._wrapLibraryMethodsWithReady(),I._initDriver=G(T)})}).catch(function(){k();var V=new Error("No available storage method found.");return I._driverSet=b.reject(V),I._driverSet}),P(this._driverSet,v,C),this._driverSet},f.prototype.supports=function(y){return!!vc[y]},f.prototype._extend=function(y){Ds(this,y)},f.prototype._getSupportedDrivers=function(y){for(var v=[],C=0,I=y.length;C<I;C++){var T=y[C];this.supports(T)&&v.push(T)}return v},f.prototype._wrapLibraryMethodsWithReady=function(){for(var y=0,v=xs.length;y<v;y++)cd(this,xs[y])},f.prototype.createInstance=function(y){return new f(y)},f}(),ud=new ld;o.exports=ud},{3:3}]},{},[4])(4)})}),Qn=qe(t=>{"use strict";var e=t&&t.__awaiter||function(n,i,s,o){function a(l){return l instanceof s?l:new s(function(h){h(l)})}return new(s||(s=Promise))(function(l,h){function g(w){try{_(o.next(w))}catch(b){h(b)}}function p(w){try{_(o.throw(w))}catch(b){h(b)}}function _(w){w.done?l(w.value):a(w.value).then(g,p)}_((o=o.apply(n,i||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.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 e(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})}};t.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)/)}),mu=qe(t=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.URLBuilder=void 0;var e=function(){function r(n){try{this.base=new URL(n),this.params=new URLSearchParams(this.base.search.slice(1))}catch(i){console.error("Un-parsable URL",i)}}return r.prototype.appendQueryParam=function(n,i){this.params.append(n,i?i.toString():"")},r.prototype.clearQueryParams=function(){return this.params=new URLSearchParams,this},r.prototype.deleteQueryParam=function(n){this.params.delete(n)},r.prototype.getBase=function(){return this.base},r.prototype.getPath=function(){return this.base.pathname},r.prototype.getHostname=function(){return this.base.hostname},r.prototype.getParams=function(){return this.params},r.prototype.getQueryParam=function(n){if(!this.params)return"";var i=this.params.get(n);return!i||i==="undefined"||i==="null"?void 0:i},r.prototype.getQueryString=function(){return this.params.toString()},r.prototype.setPath=function(n){return this.base.pathname=n,this},r.prototype.setQueryParam=function(n,i){return this.params.set(n,i?i.toString():""),this},r.prototype.setQueryString=function(n){if(n)return n[0]==="?"&&(n=n.slice(1)),this.params=new URLSearchParams(n),this},r.prototype.toString=function(){var n=this.params.toString();return n===""?this.base.search="":this.base.search="?"+n,this.base.toString()},r}();t.URLBuilder=e}),Nd=qe((t,e)=>{"use strict";(function(r,n){typeof t=="object"&&typeof e<"u"?e.exports=n():typeof define=="function"&&define.amd?define(n):(r=typeof globalThis<"u"?globalThis:r||self,r.fetchRetry=n())})(t,function(){"use strict";var r=function(s,o){if(o=o||{},typeof s!="function")throw new i("fetch must be a function");if(typeof o!="object")throw new i("defaults must be an object");if(o.retries!==void 0&&!n(o.retries))throw new i("retries must be a positive integer");if(o.retryDelay!==void 0&&!n(o.retryDelay)&&typeof o.retryDelay!="function")throw new i("retryDelay must be a positive integer or a function returning a positive integer");if(o.retryOn!==void 0&&!Array.isArray(o.retryOn)&&typeof o.retryOn!="function")throw new i("retryOn property expects an array or function");var a={retries:3,retryDelay:1e3,retryOn:[]};return o=Object.assign(a,o),function(l,h){var g=o.retries,p=o.retryDelay,_=o.retryOn;if(h&&h.retries!==void 0)if(n(h.retries))g=h.retries;else throw new i("retries must be a positive integer");if(h&&h.retryDelay!==void 0)if(n(h.retryDelay)||typeof h.retryDelay=="function")p=h.retryDelay;else throw new i("retryDelay must be a positive integer or a function returning a positive integer");if(h&&h.retryOn)if(Array.isArray(h.retryOn)||typeof h.retryOn=="function")_=h.retryOn;else throw new i("retryOn property expects an array or function");return new Promise(function(w,b){var E=function(A){var M=typeof Request<"u"&&l instanceof Request?l.clone():l;s(M,h).then(function(z){if(Array.isArray(_)&&_.indexOf(z.status)===-1)w(z);else if(typeof _=="function")try{return Promise.resolve(_(A,null,z)).then(function(B){B?P(A,null,z):w(z)}).catch(b)}catch(B){b(B)}else A<g?P(A,null,z):w(z)}).catch(function(z){if(typeof _=="function")try{Promise.resolve(_(A,z,null)).then(function(B){B?P(A,z,null):b(z)}).catch(function(B){b(B)})}catch(B){b(B)}else A<g?P(A,z,null):b(z)})};function P(A,M,z){var B=typeof p=="function"?p(A,M,z):p;setTimeout(function(){E(++A)},B)}E(0)})}};function n(s){return Number.isInteger(s)&&s>=0}function i(s){this.name="ArgumentError",this.message=s}return r})}),Ad="9.10.12",q=class co{static SDK_VERSION=Ad;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 e=co.SDK_VERSION.split(".").map(r=>r.padStart(2,"0")).join("");co.SDK_VERSION_CODE=parseInt(e,10)}},ke={apiURL:"https://api.sdk.letscooee.com",debug:!1,mode:"production",styleURL:`https://cdn.jsdelivr.net/npm/@letscooee/web-sdk@${q.SDK_VERSION}/dist/widget.min.css`,widgetURL:`https://cdn.jsdelivr.net/npm/@letscooee/web-sdk@${q.SDK_VERSION}/dist/widget.min.js`},de=dt(an()),x=class{static log(...t){de.default.info(...t)}static debug(...t){de.default.debug(...t)}static error(...t){de.default.error(...t)}static warn(...t){de.default.warn(...t)}static info(...t){de.default.info(...t)}static trace(...t){de.default.trace(...t)}};function Od(t=q.LOG_PREFIX){de.default.useDefaults({formatter:function(r){r.unshift(`${t} (v${q.SDK_VERSION}):`)}});let e=yu();(e==="1"||e==="on")&&(localStorage.cooeeLogLevel="TRACE"),localStorage.cooeeLogLevel?de.default.setLevel(de.default[localStorage.cooeeLogLevel]):de.default.setLevel(ke.debug?de.default.TRACE:de.default.OFF)}function yu(){return new URL(location.href).searchParams?.get("cooee-debug")}function kd(){let t=`
|
|
1
|
+
"use strict";(()=>{var dd=Object.create;var _c=Object.defineProperty;var fd=Object.getOwnPropertyDescriptor;var gd=Object.getOwnPropertyNames;var md=Object.getPrototypeOf,yd=Object.prototype.hasOwnProperty;var vd=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of gd(e))!yd.call(t,i)&&i!==r&&_c(t,i,{get:()=>e[i],enumerable:!(n=fd(e,i))||n.enumerable});return t};var wd=(t,e,r)=>(r=t!=null?dd(md(t)):{},vd(e||!t||!t.__esModule?_c(r,"default",{value:t,enumerable:!0}):r,t));var bd=Object.create,Zo=Object.defineProperty,_d=Object.defineProperties,Ed=Object.getOwnPropertyDescriptor,Sd=Object.getOwnPropertyDescriptors,Id=Object.getOwnPropertyNames,Ec=Object.getOwnPropertySymbols,Cd=Object.getPrototypeOf,pu=Object.prototype.hasOwnProperty,Td=Object.prototype.propertyIsEnumerable,Sc=(t,e,r)=>e in t?Zo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,D=(t,e)=>{for(var r in e||={})pu.call(e,r)&&Sc(t,r,e[r]);if(Ec)for(var r of Ec(e))Td.call(e,r)&&Sc(t,r,e[r]);return t},wt=(t,e)=>_d(t,Sd(e)),fi=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')}),qe=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),xd=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Id(e))!pu.call(t,i)&&i!==r&&Zo(t,i,{get:()=>e[i],enumerable:!(n=Ed(e,i))||n.enumerable});return t},dt=(t,e,r)=>(r=t!=null?bd(Cd(t)):{},xd(e||!t||!t.__esModule?Zo(r,"default",{value:t,enumerable:!0}):r,t)),an=qe((t,e)=>{"use strict";(function(r){"use strict";var n={};n.VERSION="1.6.1";var i,s={},o=function(p,_){return function(){return _.apply(p,arguments)}},a=function(){var p=arguments,_=p[0],w,b;for(b=1;b<p.length;b++)for(w in p[b])!(w in _)&&p[b].hasOwnProperty(w)&&(_[w]=p[b][w]);return _},l=function(p,_){return{value:p,name:_}};n.TRACE=l(1,"TRACE"),n.DEBUG=l(2,"DEBUG"),n.INFO=l(3,"INFO"),n.TIME=l(4,"TIME"),n.WARN=l(5,"WARN"),n.ERROR=l(8,"ERROR"),n.OFF=l(99,"OFF");var h=function(p){this.context=p,this.setLevel(p.filterLevel),this.log=this.info};h.prototype={setLevel:function(p){p&&"value"in p&&(this.context.filterLevel=p)},getLevel:function(){return this.context.filterLevel},enabledFor:function(p){var _=this.context.filterLevel;return p.value>=_.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(p){typeof p=="string"&&p.length>0&&this.invoke(n.TIME,[p,"start"])},timeEnd:function(p){typeof p=="string"&&p.length>0&&this.invoke(n.TIME,[p,"end"])},invoke:function(p,_){i&&this.enabledFor(p)&&i(_,a({level:p},this.context))}};var g=new h({filterLevel:n.OFF});(function(){var p=n;p.enabledFor=o(g,g.enabledFor),p.trace=o(g,g.trace),p.debug=o(g,g.debug),p.time=o(g,g.time),p.timeEnd=o(g,g.timeEnd),p.info=o(g,g.info),p.warn=o(g,g.warn),p.error=o(g,g.error),p.log=p.info})(),n.setHandler=function(p){i=p},n.setLevel=function(p){g.setLevel(p);for(var _ in s)s.hasOwnProperty(_)&&s[_].setLevel(p)},n.getLevel=function(){return g.getLevel()},n.get=function(p){return s[p]||(s[p]=new h(a({name:p},g.context)))},n.createDefaultHandler=function(p){p=p||{},p.formatter=p.formatter||function(b,E){E.name&&b.unshift("["+E.name+"]")};var _={},w=function(b,E){Function.prototype.apply.call(b,console,E)};return typeof console>"u"?function(){}:function(b,E){b=Array.prototype.slice.call(b);var k=console.log,A;E.level===n.TIME?(A=(E.name?"["+E.name+"] ":"")+b[0],b[1]==="start"?console.time?console.time(A):_[A]=new Date().getTime():console.timeEnd?console.timeEnd(A):w(k,[A+": "+(new Date().getTime()-_[A])+"ms"])):(E.level===n.WARN&&console.warn?k=console.warn:E.level===n.ERROR&&console.error?k=console.error:E.level===n.INFO&&console.info?k=console.info:E.level===n.DEBUG&&console.debug?k=console.debug:E.level===n.TRACE&&console.trace&&(k=console.trace),p.formatter(b,E),w(k,b))}},n.useDefaults=function(p){n.setLevel(p&&p.defaultLevel||n.DEBUG),n.setHandler(n.createDefaultHandler(p))},n.setDefaults=n.useDefaults,typeof define=="function"&&define.amd?define(n):typeof e<"u"&&e.exports?e.exports=n:(n._prevLogger=r.Logger,n.noConflict=function(){return r.Logger=n._prevLogger,n},r.Logger=n)})(t)}),du=qe(t=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MustacheUtils=void 0;var e=class fu{static escapeHtml(n){return String(n).replace(/"/g,i=>fu.entityMap[i])}};t.MustacheUtils=e,e.entityMap={'"':"""}}),lr=qe(t=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MilestoneRewardType=t.ProgressBarLayout=t.EngagementContentSource=t.EngagementObjective=t.OnsiteDeliveryType=t.ClickActionType=t.FrequencyGapUnit=t.FrequencyType=t.RedirectBehaviour=t.EngagementPlacementPosition=t.EngagementCollectionSource=t.PromotionType=t.CartFilterEnum=t.CartCurrencyOperator=t.CartCriteria=t.URLCriteria=t.UTMCriteria=t.CartItemSource=t.EngagementItemSource=t.PurchasedVisitor=t.LoggedInVisitor=t.SessionType=t.EngagementContentType=t.TriggerType=t.EngagementType=t.EngagementStatus=t.TimePreference=t.ScheduleFrequency=t.CriteriaFrequency=void 0;var e=function(m){return m[m.ONCE_PER_USER=1]="ONCE_PER_USER",m[m.ONCE_PER_SESSION=2]="ONCE_PER_SESSION",m[m.EVERY_TIME=3]="EVERY_TIME",m}(e||(t.CriteriaFrequency=e={})),r=function(m){return m[m.ONE_TIME=1]="ONE_TIME",m[m.MULTIPLE=2]="MULTIPLE",m[m.RECURRING=3]="RECURRING",m}(r||(t.ScheduleFrequency=r={})),n=function(m){return m[m.NOW=1]="NOW",m[m.LATER=2]="LATER",m[m.NEVER=3]="NEVER",m}(n||(t.TimePreference=n={})),i=function(m){return m[m.PUBLISHED=1]="PUBLISHED",m[m.DRAFT=2]="DRAFT",m[m.PAUSED=3]="PAUSED",m[m.STOPPED=5]="STOPPED",m[m.COMPLETED=6]="COMPLETED",m[m.UNINSTALLED=8]="UNINSTALLED",m}(i||(t.EngagementStatus=i={})),s=function(m){return m.CAMPAIGN="CAMPAIGN",m.NATIVE_AB="NATIVE_AB",m.CRO_COPILOT="CRO_COPILOT",m}(s||(t.EngagementType=s={})),o=function(m){return m[m.NONE=0]="NONE",m[m.RULE_BASED=1]="RULE_BASED",m[m.INTENT_BASED=2]="INTENT_BASED",m}(o||(t.TriggerType=o={})),a=function(m){return m[m.SINGLE=1]="SINGLE",m[m.EXCLUSION=2]="EXCLUSION",m[m.ABTESTING=3]="ABTESTING",m}(a||(t.EngagementContentType=a={})),l=function(m){return m[m.ALL=0]="ALL",m[m.NEW_ONLY=1]="NEW_ONLY",m[m.RETURNING_ONLY=2]="RETURNING_ONLY",m}(l||(t.SessionType=l={})),h=function(m){return m.ALL="ALL",m.LOGGED_IN="LOGGED_IN",m.NON_LOGGED_IN="NON_LOGGED_IN",m}(h||(t.LoggedInVisitor=h={})),g=function(m){return m.ALL="ALL",m.PURCHASED="PURCHASED",m.NON_PURCHASED="NON_PURCHASED",m}(g||(t.PurchasedVisitor=g={})),p=function(m){return m[m.NONE=0]="NONE",m[m.ITEM_RECOMMENDATION=1]="ITEM_RECOMMENDATION",m[m.MULTIPLE_ITEMS=2]="MULTIPLE_ITEMS",m[m.SINGLE_ITEM=3]="SINGLE_ITEM",m[m.TOP_SELLING=4]="TOP_SELLING",m[m.STOCK_CLEARANCE=5]="STOCK_CLEARANCE",m[m.NEW_ARRIVALS=6]="NEW_ARRIVALS",m[m.RECENTLY_VIEWED=7]="RECENTLY_VIEWED",m[m.EVENT_ITEM=8]="EVENT_ITEM",m[m.CART_ITEM=9]="CART_ITEM",m[m.BUNDLE=10]="BUNDLE",m[m.CURRENT_ITEM=11]="CURRENT_ITEM",m[m.PURCHASED_PREVIOUSLY=12]="PURCHASED_PREVIOUSLY",m[m.COLLECTION_ITEMS=13]="COLLECTION_ITEMS",m[m.TRENDING_ITEMS=14]="TRENDING_ITEMS",m}(p||(t.EngagementItemSource=p={})),_=function(m){return m[m.LAST_ADDED=1]="LAST_ADDED",m[m.FIRST_ADDED=2]="FIRST_ADDED",m[m.HIGHEST_PRICE=3]="HIGHEST_PRICE",m[m.LOWEST_PRICE=4]="LOWEST_PRICE",m[m.FIRST_MATCHING_TAG=5]="FIRST_MATCHING_TAG",m[m.ALL=6]="ALL",m}(_||(t.CartItemSource=_={})),w=function(m){return m[m.ALL=0]="ALL",m[m.ONLY_ORGANIC=1]="ONLY_ORGANIC",m[m.ONLY_NON_ORGANIC=2]="ONLY_NON_ORGANIC",m[m.INCLUDES=3]="INCLUDES",m[m.EXCLUDES=4]="EXCLUDES",m}(w||(t.UTMCriteria=w={})),b=function(m){return m[m.NONE=0]="NONE",m[m.LIKE=1]="LIKE",m[m.NOT_LIKE=2]="NOT_LIKE",m[m.EQUALS=3]="EQUALS",m[m.NOT_EQUALS=4]="NOT_EQUALS",m}(b||(t.URLCriteria=b={})),E=function(m){return m[m.NONE=0]="NONE",m[m.LESS_THAN=1]="LESS_THAN",m[m.GREATER_THAN=2]="GREATER_THAN",m[m.BETWEEN=3]="BETWEEN",m[m.EQUALS=4]="EQUALS",m}(E||(t.CartCriteria=E={})),k=function(m){return m[m.ALL=0]="ALL",m[m.INCLUDES=1]="INCLUDES",m[m.EXCLUDES=2]="EXCLUDES",m}(k||(t.CartCurrencyOperator=k={})),A=function(m){return m[m.NONE=0]="NONE",m[m.AMOUNT=1]="AMOUNT",m[m.TOTAL_PRODUCT=2]="TOTAL_PRODUCT",m[m.UNIQUE_PRODUCT=3]="UNIQUE_PRODUCT",m}(A||(t.CartFilterEnum=A={})),M=function(m){return m[m.NONE=0]="NONE",m[m.ITEM=1]="ITEM",m[m.COLLECTION=2]="COLLECTION",m}(M||(t.PromotionType=M={})),z=function(m){return m[m.NONE=0]="NONE",m[m.SINGLE=1]="SINGLE",m[m.MULTIPLE=2]="MULTIPLE",m}(z||(t.EngagementCollectionSource=z={})),B=function(m){return m.BEFORE="before",m.AFTER="after",m.INSIDE_FIRST="insideFirst",m.INSIDE_LAST="insideLast",m}(B||(t.EngagementPlacementPosition=B={})),X=function(m){return m.SHOPIFY_CHECKOUT="shopify_checkout",m.THIRD_PARTY_CHECKOUT="third_party_checkout",m.CART_PAGE="cart_page",m.CART_DRAWER="cart_drawer",m}(X||(t.RedirectBehaviour=X={})),bt=function(m){return m.ONCE_IN_SESSION="ONCE_IN_SESSION",m.ACROSS_SESSIONS="ACROSS_SESSIONS",m}(bt||(t.FrequencyType=bt={})),It=function(m){return m.DAYS="DAYS",m.HOURS="HOURS",m.MINUTES="MINUTES",m.SECONDS="SECONDS",m}(It||(t.FrequencyGapUnit=It={})),H=function(m){return m[m.NONE=0]="NONE",m[m.REJECT_POPUP=1]="REJECT_POPUP",m[m.ACCEPT_POPUP=2]="ACCEPT_POPUP",m[m.GO_TO_URL=4]="GO_TO_URL",m[m.SHARE=5]="SHARE",m[m.KEY_VALUE=100]="KEY_VALUE",m[m.GO_TO_PRODUCT=101]="GO_TO_PRODUCT",m[m.ADD_TO_CART=102]="ADD_TO_CART",m[m.COPY_COUPON_CODE=103]="COPY_COUPON_CODE",m[m.GO_TO_COLLECTION=104]="GO_TO_COLLECTION",m[m.OPEN_CART=105]="OPEN_CART",m[m.SUBMIT_FORM=106]="SUBMIT_FORM",m[m.INITIATE_CHECKOUT=107]="INITIATE_CHECKOUT",m[m.ADD_BUNDLE=108]="ADD_BUNDLE",m[m.UPGRADE_TO_SUBSCRIPTION=109]="UPGRADE_TO_SUBSCRIPTION",m}(H||(t.ClickActionType=H={})),rt=function(m){return m.POPUP="POPUP",m.PAGE_EMBED="PAGE_EMBED",m.CART_EMBED="CART_EMBED",m.ANNOUNCEMENT_BAR="ANNOUNCEMENT_BAR",m}(rt||(t.OnsiteDeliveryType=rt={})),Z=function(m){return m.PRODUCT_PROMOTION="PRODUCT_PROMOTION",m.BUNDLE_AND_UPSELL="BUNDLE_AND_UPSELL",m.CART_RECOVERY="CART_RECOVERY",m.ANNOUNCEMENT="ANNOUNCEMENT",m.LEAD_GENERATION="LEAD_GENERATION",m.DATA_COLLECTION="DATA_COLLECTION",m.SALE_PROMOTION="SALE_PROMOTION",m.SUBSCRIPTION_UPSELL="SUBSCRIPTION_UPSELL",m.SHOPPABLE_VIDEO="SHOPPABLE_VIDEO",m.BYOB="BYOB",m.PROGRESS_BAR="PROGRESS_BAR",m.BUY_NOW="BUY_NOW",m.STICKY_ATC="STICKY_ATC",m.EXPERIMENT="EXPERIMENT",m}(Z||(t.EngagementObjective=Z={})),tt=function(m){return m.COOEE="COOEE",m.KLAVIYO="KLAVIYO",m}(tt||(t.EngagementContentSource=tt={})),ct=function(m){return m.ICONS="ICONS",m.TILES="TILES",m}(ct||(t.ProgressBarLayout=ct={})),Tt=function(m){return m.FREE_SHIPPING="FREE_SHIPPING",m.DISCOUNT="DISCOUNT",m.FREE_AUTO_GIFT="FREE_AUTO_GIFT",m.FREE_GIFT_SELECT="FREE_GIFT_SELECT",m}(Tt||(t.MilestoneRewardType=Tt={}))}),ta=qe(t=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PriceRuleType=t.DiscountType=void 0;var e=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}(e||(t.DiscountType=e={})),r=function(n){return n.FIXED_AMOUNT="fixed_amount",n.PERCENTAGE="percentage",n}(r||(t.PriceRuleType=r={}))}),gu=qe(t=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ArrayUtils=void 0;var e=class mu{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,a)=>a.findIndex(l=>l[i]===s[i])===o)}static shuffle(n){let i=n.length;for(;i!=0;){let s=Math.floor(Math.random()*i);i--,mu.swap(n,i,s)}}};t.ArrayUtils=e}),Dd=qe((t,e)=>{"use strict";(function(r){if(typeof t=="object"&&typeof e<"u")e.exports=r();else if(typeof define=="function"&&define.amd)define([],r);else{var n;typeof window<"u"?n=window:typeof global<"u"?n=global:typeof self<"u"?n=self:n=this,n.localforage=r()}})(function(){var r,n,i;return function s(o,a,l){function h(_,w){if(!a[_]){if(!o[_]){var b=typeof fi=="function"&&fi;if(!w&&b)return b(_,!0);if(g)return g(_,!0);var E=new Error("Cannot find module '"+_+"'");throw E.code="MODULE_NOT_FOUND",E}var k=a[_]={exports:{}};o[_][0].call(k.exports,function(A){var M=o[_][1][A];return h(M||A)},k,k.exports,s,o,a,l)}return a[_].exports}for(var g=typeof fi=="function"&&fi,p=0;p<l.length;p++)h(l[p]);return h}({1:[function(s,o,a){(function(l){"use strict";var h=l.MutationObserver||l.WebKitMutationObserver,g;if(h){var p=0,_=new h(A),w=l.document.createTextNode("");_.observe(w,{characterData:!0}),g=function(){w.data=p=++p%2}}else if(!l.setImmediate&&typeof l.MessageChannel<"u"){var b=new l.MessageChannel;b.port1.onmessage=A,g=function(){b.port2.postMessage(0)}}else"document"in l&&"onreadystatechange"in l.document.createElement("script")?g=function(){var z=l.document.createElement("script");z.onreadystatechange=function(){A(),z.onreadystatechange=null,z.parentNode.removeChild(z),z=null},l.document.documentElement.appendChild(z)}:g=function(){setTimeout(A,0)};var E,k=[];function A(){E=!0;for(var z,B,X=k.length;X;){for(B=k,k=[],z=-1;++z<X;)B[z]();X=k.length}E=!1}o.exports=M;function M(z){k.push(z)===1&&!E&&g()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(s,o,a){"use strict";var l=s(1);function h(){}var g={},p=["REJECTED"],_=["FULFILLED"],w=["PENDING"];o.exports=b;function b(H){if(typeof H!="function")throw new TypeError("resolver must be a function");this.state=w,this.queue=[],this.outcome=void 0,H!==h&&M(this,H)}b.prototype.catch=function(H){return this.then(null,H)},b.prototype.then=function(H,rt){if(typeof H!="function"&&this.state===_||typeof rt!="function"&&this.state===p)return this;var Z=new this.constructor(h);if(this.state!==w){var tt=this.state===_?H:rt;k(Z,tt,this.outcome)}else this.queue.push(new E(Z,H,rt));return Z};function E(H,rt,Z){this.promise=H,typeof rt=="function"&&(this.onFulfilled=rt,this.callFulfilled=this.otherCallFulfilled),typeof Z=="function"&&(this.onRejected=Z,this.callRejected=this.otherCallRejected)}E.prototype.callFulfilled=function(H){g.resolve(this.promise,H)},E.prototype.otherCallFulfilled=function(H){k(this.promise,this.onFulfilled,H)},E.prototype.callRejected=function(H){g.reject(this.promise,H)},E.prototype.otherCallRejected=function(H){k(this.promise,this.onRejected,H)};function k(H,rt,Z){l(function(){var tt;try{tt=rt(Z)}catch(ct){return g.reject(H,ct)}tt===H?g.reject(H,new TypeError("Cannot resolve promise with itself")):g.resolve(H,tt)})}g.resolve=function(H,rt){var Z=z(A,rt);if(Z.status==="error")return g.reject(H,Z.value);var tt=Z.value;if(tt)M(H,tt);else{H.state=_,H.outcome=rt;for(var ct=-1,Tt=H.queue.length;++ct<Tt;)H.queue[ct].callFulfilled(rt)}return H},g.reject=function(H,rt){H.state=p,H.outcome=rt;for(var Z=-1,tt=H.queue.length;++Z<tt;)H.queue[Z].callRejected(rt);return H};function A(H){var rt=H&&H.then;if(H&&(typeof H=="object"||typeof H=="function")&&typeof rt=="function")return function(){rt.apply(H,arguments)}}function M(H,rt){var Z=!1;function tt($t){Z||(Z=!0,g.reject(H,$t))}function ct($t){Z||(Z=!0,g.resolve(H,$t))}function Tt(){rt(ct,tt)}var m=z(Tt);m.status==="error"&&tt(m.value)}function z(H,rt){var Z={};try{Z.value=H(rt),Z.status="success"}catch(tt){Z.status="error",Z.value=tt}return Z}b.resolve=B;function B(H){return H instanceof this?H:g.resolve(new this(h),H)}b.reject=X;function X(H){var rt=new this(h);return g.reject(rt,H)}b.all=bt;function bt(H){var rt=this;if(Object.prototype.toString.call(H)!=="[object Array]")return this.reject(new TypeError("must be an array"));var Z=H.length,tt=!1;if(!Z)return this.resolve([]);for(var ct=new Array(Z),Tt=0,m=-1,$t=new this(h);++m<Z;)qt(H[m],m);return $t;function qt(mt,zt){rt.resolve(mt).then(ot,function(nt){tt||(tt=!0,g.reject($t,nt))});function ot(nt){ct[zt]=nt,++Tt===Z&&!tt&&(tt=!0,g.resolve($t,ct))}}}b.race=It;function It(H){var rt=this;if(Object.prototype.toString.call(H)!=="[object Array]")return this.reject(new TypeError("must be an array"));var Z=H.length,tt=!1;if(!Z)return this.resolve([]);for(var ct=-1,Tt=new this(h);++ct<Z;)m(H[ct]);return Tt;function m($t){rt.resolve($t).then(function(qt){tt||(tt=!0,g.resolve(Tt,qt))},function(qt){tt||(tt=!0,g.reject(Tt,qt))})}}},{1:1}],3:[function(s,o,a){(function(l){"use strict";typeof l.Promise!="function"&&(l.Promise=s(2))}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(s,o,a){"use strict";var l=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 h(f,y){if(!(f instanceof y))throw new TypeError("Cannot call a class as a function")}function g(){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 p=g();function _(){try{if(!p||!p.open)return!1;var f=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),y=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!f||y)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function w(f,y){f=f||[],y=y||{};try{return new Blob(f,y)}catch(T){if(T.name!=="TypeError")throw T;for(var v=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,C=new v,I=0;I<f.length;I+=1)C.append(f[I]);return C.getBlob(y.type)}}typeof Promise>"u"&&s(3);var b=Promise;function E(f,y){y&&f.then(function(v){y(null,v)},function(v){y(v)})}function k(f,y,v){typeof y=="function"&&f.then(y),typeof v=="function"&&f.catch(v)}function A(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 z="local-forage-detect-blob-support",B=void 0,X={},bt=Object.prototype.toString,It="readonly",H="readwrite";function rt(f){for(var y=f.length,v=new ArrayBuffer(y),C=new Uint8Array(v),I=0;I<y;I++)C[I]=f.charCodeAt(I);return v}function Z(f){return new b(function(y){var v=f.transaction(z,H),C=w([""]);v.objectStore(z).put(C,"key"),v.onabort=function(I){I.preventDefault(),I.stopPropagation(),y(!1)},v.oncomplete=function(){var I=navigator.userAgent.match(/Chrome\/(\d+)/),T=navigator.userAgent.match(/Edge\//);y(T||!I||parseInt(I[1],10)>=43)}}).catch(function(){return!1})}function tt(f){return typeof B=="boolean"?b.resolve(B):Z(f).then(function(y){return B=y,B})}function ct(f){var y=X[f.name],v={};v.promise=new b(function(C,I){v.resolve=C,v.reject=I}),y.deferredOperations.push(v),y.dbReady?y.dbReady=y.dbReady.then(function(){return v.promise}):y.dbReady=v.promise}function Tt(f){var y=X[f.name],v=y.deferredOperations.pop();if(v)return v.resolve(),v.promise}function m(f,y){var v=X[f.name],C=v.deferredOperations.pop();if(C)return C.reject(y),C.promise}function $t(f,y){return new b(function(v,C){if(X[f.name]=X[f.name]||hi(),f.db)if(y)ct(f),f.db.close();else return v(f.db);var I=[f.name];y&&I.push(f.version);var T=p.open.apply(p,I);y&&(T.onupgradeneeded=function(P){var F=T.result;try{F.createObjectStore(f.storeName),P.oldVersion<=1&&F.createObjectStore(z)}catch(G){if(G.name==="ConstraintError")console.warn('The database "'+f.name+'" has been upgraded from version '+P.oldVersion+" to version "+P.newVersion+', but the storage "'+f.storeName+'" already exists.');else throw G}}),T.onerror=function(P){P.preventDefault(),C(T.error)},T.onsuccess=function(){var P=T.result;P.onversionchange=function(F){F.target.close()},v(P),Tt(f)}})}function qt(f){return $t(f,!1)}function mt(f){return $t(f,!0)}function zt(f,y){if(!f.db)return!0;var v=!f.db.objectStoreNames.contains(f.storeName),C=f.version<f.db.version,I=f.version>f.db.version;if(C&&(f.version!==y&&console.warn('The database "'+f.name+`" can't be downgraded from version `+f.db.version+" to version "+f.version+"."),f.version=f.db.version),I||v){if(v){var T=f.db.version+1;T>f.version&&(f.version=T)}return!0}return!1}function ot(f){return new b(function(y,v){var C=new FileReader;C.onerror=v,C.onloadend=function(I){var T=btoa(I.target.result||"");y({__local_forage_encoded_blob:!0,data:T,type:f.type})},C.readAsBinaryString(f)})}function nt(f){var y=rt(atob(f.data));return w([y],{type:f.type})}function Ft(f){return f&&f.__local_forage_encoded_blob}function li(f){var y=this,v=y._initReady().then(function(){var C=X[y._dbInfo.name];if(C&&C.dbReady)return C.dbReady});return k(v,f,f),v}function ui(f){ct(f);for(var y=X[f.name],v=y.forages,C=0;C<v.length;C++){var I=v[C];I._dbInfo.db&&(I._dbInfo.db.close(),I._dbInfo.db=null)}return f.db=null,qt(f).then(function(T){return f.db=T,zt(f)?mt(f):T}).then(function(T){f.db=y.db=T;for(var P=0;P<v.length;P++)v[P]._dbInfo.db=T}).catch(function(T){throw m(f,T),T})}function ce(f,y,v,C){C===void 0&&(C=1);try{var I=f.db.transaction(f.storeName,y);v(null,I)}catch(T){if(C>0&&(!f.db||T.name==="InvalidStateError"||T.name==="NotFoundError"))return b.resolve().then(function(){if(!f.db||T.name==="NotFoundError"&&!f.db.objectStoreNames.contains(f.storeName)&&f.version<=f.db.version)return f.db&&(f.version=f.db.version+1),mt(f)}).then(function(){return ui(f).then(function(){ce(f,y,v,C-1)})}).catch(v);v(T)}}function hi(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function _s(f){var y=this,v={db:null};if(f)for(var C in f)v[C]=f[C];var I=X[v.name];I||(I=hi(),X[v.name]=I),I.forages.push(y),y._initReady||(y._initReady=y.ready,y.ready=li);var T=[];function P(){return b.resolve()}for(var F=0;F<I.forages.length;F++){var G=I.forages[F];G!==y&&T.push(G._initReady().catch(P))}var W=I.forages.slice(0);return b.all(T).then(function(){return v.db=I.db,qt(v)}).then(function(V){return v.db=V,zt(v,y._defaultConfig.version)?mt(v):V}).then(function(V){v.db=I.db=V,y._dbInfo=v;for(var Q=0;Q<W.length;Q++){var st=W[Q];st!==y&&(st._dbInfo.db=v.db,st._dbInfo.version=v.version)}})}function gn(f,y){var v=this;f=A(f);var C=new b(function(I,T){v.ready().then(function(){ce(v._dbInfo,It,function(P,F){if(P)return T(P);try{var G=F.objectStore(v._dbInfo.storeName),W=G.get(f);W.onsuccess=function(){var V=W.result;V===void 0&&(V=null),Ft(V)&&(V=nt(V)),I(V)},W.onerror=function(){T(W.error)}}catch(V){T(V)}})}).catch(T)});return E(C,y),C}function Es(f,y){var v=this,C=new b(function(I,T){v.ready().then(function(){ce(v._dbInfo,It,function(P,F){if(P)return T(P);try{var G=F.objectStore(v._dbInfo.storeName),W=G.openCursor(),V=1;W.onsuccess=function(){var Q=W.result;if(Q){var st=Q.value;Ft(st)&&(st=nt(st));var _t=f(st,Q.key,V++);_t!==void 0?I(_t):Q.continue()}else I()},W.onerror=function(){T(W.error)}}catch(Q){T(Q)}})}).catch(T)});return E(C,y),C}function Ss(f,y,v){var C=this;f=A(f);var I=new b(function(T,P){var F;C.ready().then(function(){return F=C._dbInfo,bt.call(y)==="[object Blob]"?tt(F.db).then(function(G){return G?y:ot(y)}):y}).then(function(G){ce(C._dbInfo,H,function(W,V){if(W)return P(W);try{var Q=V.objectStore(C._dbInfo.storeName);G===null&&(G=void 0);var st=Q.put(G,f);V.oncomplete=function(){G===void 0&&(G=null),T(G)},V.onabort=V.onerror=function(){var _t=st.error?st.error:st.transaction.error;P(_t)}}catch(_t){P(_t)}})}).catch(P)});return E(I,v),I}function pi(f,y){var v=this;f=A(f);var C=new b(function(I,T){v.ready().then(function(){ce(v._dbInfo,H,function(P,F){if(P)return T(P);try{var G=F.objectStore(v._dbInfo.storeName),W=G.delete(f);F.oncomplete=function(){I()},F.onerror=function(){T(W.error)},F.onabort=function(){var V=W.error?W.error:W.transaction.error;T(V)}}catch(V){T(V)}})}).catch(T)});return E(C,y),C}function Ur(f){var y=this,v=new b(function(C,I){y.ready().then(function(){ce(y._dbInfo,H,function(T,P){if(T)return I(T);try{var F=P.objectStore(y._dbInfo.storeName),G=F.clear();P.oncomplete=function(){C()},P.onabort=P.onerror=function(){var W=G.error?G.error:G.transaction.error;I(W)}}catch(W){I(W)}})}).catch(I)});return E(v,f),v}function le(f){var y=this,v=new b(function(C,I){y.ready().then(function(){ce(y._dbInfo,It,function(T,P){if(T)return I(T);try{var F=P.objectStore(y._dbInfo.storeName),G=F.count();G.onsuccess=function(){C(G.result)},G.onerror=function(){I(G.error)}}catch(W){I(W)}})}).catch(I)});return E(v,f),v}function mn(f,y){var v=this,C=new b(function(I,T){if(f<0){I(null);return}v.ready().then(function(){ce(v._dbInfo,It,function(P,F){if(P)return T(P);try{var G=F.objectStore(v._dbInfo.storeName),W=!1,V=G.openKeyCursor();V.onsuccess=function(){var Q=V.result;if(!Q){I(null);return}f===0||W?I(Q.key):(W=!0,Q.advance(f))},V.onerror=function(){T(V.error)}}catch(Q){T(Q)}})}).catch(T)});return E(C,y),C}function Is(f){var y=this,v=new b(function(C,I){y.ready().then(function(){ce(y._dbInfo,It,function(T,P){if(T)return I(T);try{var F=P.objectStore(y._dbInfo.storeName),G=F.openKeyCursor(),W=[];G.onsuccess=function(){var V=G.result;if(!V){C(W);return}W.push(V.key),V.continue()},G.onerror=function(){I(G.error)}}catch(V){I(V)}})}).catch(I)});return E(v,f),v}function c(f,y){y=M.apply(this,arguments);var v=this.config();f=typeof f!="function"&&f||{},f.name||(f.name=f.name||v.name,f.storeName=f.storeName||v.storeName);var C=this,I;if(!f.name)I=b.reject("Invalid arguments");else{var T=f.name===v.name&&C._dbInfo.db,P=T?b.resolve(C._dbInfo.db):qt(f).then(function(F){var G=X[f.name],W=G.forages;G.db=F;for(var V=0;V<W.length;V++)W[V]._dbInfo.db=F;return F});f.storeName?I=P.then(function(F){if(F.objectStoreNames.contains(f.storeName)){var G=F.version+1;ct(f);var W=X[f.name],V=W.forages;F.close();for(var Q=0;Q<V.length;Q++){var st=V[Q];st._dbInfo.db=null,st._dbInfo.version=G}var _t=new b(function(ft,Rt){var Dt=p.open(f.name,G);Dt.onerror=function(ue){var Ns=Dt.result;Ns.close(),Rt(ue)},Dt.onupgradeneeded=function(){var ue=Dt.result;ue.deleteObjectStore(f.storeName)},Dt.onsuccess=function(){var ue=Dt.result;ue.close(),ft(ue)}});return _t.then(function(ft){W.db=ft;for(var Rt=0;Rt<V.length;Rt++){var Dt=V[Rt];Dt._dbInfo.db=ft,Tt(Dt._dbInfo)}}).catch(function(ft){throw(m(f,ft)||b.resolve()).catch(function(){}),ft})}}):I=P.then(function(F){ct(f);var G=X[f.name],W=G.forages;F.close();for(var V=0;V<W.length;V++){var Q=W[V];Q._dbInfo.db=null}var st=new b(function(_t,ft){var Rt=p.deleteDatabase(f.name);Rt.onerror=function(){var Dt=Rt.result;Dt&&Dt.close(),ft(Rt.error)},Rt.onblocked=function(){console.warn('dropInstance blocked for database "'+f.name+'" until all open connections are closed')},Rt.onsuccess=function(){var Dt=Rt.result;Dt&&Dt.close(),_t(Dt)}});return st.then(function(_t){G.db=_t;for(var ft=0;ft<W.length;ft++){var Rt=W[ft];Tt(Rt._dbInfo)}}).catch(function(_t){throw(m(f,_t)||b.resolve()).catch(function(){}),_t})})}return E(I,y),I}var u={_driver:"asyncStorage",_initStorage:_s,_support:_(),iterate:Es,getItem:gn,setItem:Ss,removeItem:pi,clear:Ur,length:le,key:mn,keys:Is,dropInstance:c};function d(){return typeof openDatabase=="function"}var S="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",N="~~local_forage_type~",j=/^~~local_forage_type~([^~]+)~/,K="__lfsc__:",ht=K.length,Pt="arbf",yt="blob",xt="si08",Bt="ui08",pr="uic8",yn="si16",vn="si32",cc="ur16",lc="ui32",uc="fl32",hc="fl64",pc=ht+Pt.length,dc=Object.prototype.toString;function fc(f){var y=f.length*.75,v=f.length,C,I=0,T,P,F,G;f[f.length-1]==="="&&(y--,f[f.length-2]==="="&&y--);var W=new ArrayBuffer(y),V=new Uint8Array(W);for(C=0;C<v;C+=4)T=S.indexOf(f[C]),P=S.indexOf(f[C+1]),F=S.indexOf(f[C+2]),G=S.indexOf(f[C+3]),V[I++]=T<<2|P>>4,V[I++]=(P&15)<<4|F>>2,V[I++]=(F&3)<<6|G&63;return W}function Cs(f){var y=new Uint8Array(f),v="",C;for(C=0;C<y.length;C+=3)v+=S[y[C]>>2],v+=S[(y[C]&3)<<4|y[C+1]>>4],v+=S[(y[C+1]&15)<<2|y[C+2]>>6],v+=S[y[C+2]&63];return y.length%3===2?v=v.substring(0,v.length-1)+"=":y.length%3===1&&(v=v.substring(0,v.length-2)+"=="),v}function Ap(f,y){var v="";if(f&&(v=dc.call(f)),f&&(v==="[object ArrayBuffer]"||f.buffer&&dc.call(f.buffer)==="[object ArrayBuffer]")){var C,I=K;f instanceof ArrayBuffer?(C=f,I+=Pt):(C=f.buffer,v==="[object Int8Array]"?I+=xt:v==="[object Uint8Array]"?I+=Bt:v==="[object Uint8ClampedArray]"?I+=pr:v==="[object Int16Array]"?I+=yn:v==="[object Uint16Array]"?I+=cc:v==="[object Int32Array]"?I+=vn:v==="[object Uint32Array]"?I+=lc:v==="[object Float32Array]"?I+=uc:v==="[object Float64Array]"?I+=hc:y(new Error("Failed to get type for BinaryArray"))),y(I+Cs(C))}else if(v==="[object Blob]"){var T=new FileReader;T.onload=function(){var P=N+f.type+"~"+Cs(this.result);y(K+yt+P)},T.readAsArrayBuffer(f)}else try{y(JSON.stringify(f))}catch(P){console.error("Couldn't convert value into a JSON string: ",f),y(null,P)}}function Op(f){if(f.substring(0,ht)!==K)return JSON.parse(f);var y=f.substring(pc),v=f.substring(ht,pc),C;if(v===yt&&j.test(y)){var I=y.match(j);C=I[1],y=y.substring(I[0].length)}var T=fc(y);switch(v){case Pt:return T;case yt:return w([T],{type:C});case xt:return new Int8Array(T);case Bt:return new Uint8Array(T);case pr:return new Uint8ClampedArray(T);case yn:return new Int16Array(T);case cc:return new Uint16Array(T);case vn:return new Int32Array(T);case lc:return new Uint32Array(T);case uc:return new Float32Array(T);case hc:return new Float64Array(T);default:throw new Error("Unkown type: "+v)}}var Ts={serialize:Ap,deserialize:Op,stringToBuffer:fc,bufferToString:Cs};function gc(f,y,v,C){f.executeSql("CREATE TABLE IF NOT EXISTS "+y.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],v,C)}function Pp(f){var y=this,v={db:null};if(f)for(var C in f)v[C]=typeof f[C]!="string"?f[C].toString():f[C];var I=new b(function(T,P){try{v.db=openDatabase(v.name,String(v.version),v.description,v.size)}catch(F){return P(F)}v.db.transaction(function(F){gc(F,v,function(){y._dbInfo=v,T()},function(G,W){P(W)})},P)});return v.serializer=Ts,I}function Ye(f,y,v,C,I,T){f.executeSql(v,C,I,function(P,F){F.code===F.SYNTAX_ERR?P.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[y.storeName],function(G,W){W.rows.length?T(G,F):gc(G,y,function(){G.executeSql(v,C,I,T)},T)},T):T(P,F)},T)}function kp(f,y){var v=this;f=A(f);var C=new b(function(I,T){v.ready().then(function(){var P=v._dbInfo;P.db.transaction(function(F){Ye(F,P,"SELECT * FROM "+P.storeName+" WHERE key = ? LIMIT 1",[f],function(G,W){var V=W.rows.length?W.rows.item(0).value:null;V&&(V=P.serializer.deserialize(V)),I(V)},function(G,W){T(W)})})}).catch(T)});return E(C,y),C}function Rp(f,y){var v=this,C=new b(function(I,T){v.ready().then(function(){var P=v._dbInfo;P.db.transaction(function(F){Ye(F,P,"SELECT * FROM "+P.storeName,[],function(G,W){for(var V=W.rows,Q=V.length,st=0;st<Q;st++){var _t=V.item(st),ft=_t.value;if(ft&&(ft=P.serializer.deserialize(ft)),ft=f(ft,_t.key,st+1),ft!==void 0){I(ft);return}}I()},function(G,W){T(W)})})}).catch(T)});return E(C,y),C}function mc(f,y,v,C){var I=this;f=A(f);var T=new b(function(P,F){I.ready().then(function(){y===void 0&&(y=null);var G=y,W=I._dbInfo;W.serializer.serialize(y,function(V,Q){Q?F(Q):W.db.transaction(function(st){Ye(st,W,"INSERT OR REPLACE INTO "+W.storeName+" (key, value) VALUES (?, ?)",[f,V],function(){P(G)},function(_t,ft){F(ft)})},function(st){if(st.code===st.QUOTA_ERR){if(C>0){P(mc.apply(I,[f,G,v,C-1]));return}F(st)}})})}).catch(F)});return E(T,v),T}function Lp(f,y,v){return mc.apply(this,[f,y,v,1])}function Up(f,y){var v=this;f=A(f);var C=new b(function(I,T){v.ready().then(function(){var P=v._dbInfo;P.db.transaction(function(F){Ye(F,P,"DELETE FROM "+P.storeName+" WHERE key = ?",[f],function(){I()},function(G,W){T(W)})})}).catch(T)});return E(C,y),C}function Mp(f){var y=this,v=new b(function(C,I){y.ready().then(function(){var T=y._dbInfo;T.db.transaction(function(P){Ye(P,T,"DELETE FROM "+T.storeName,[],function(){C()},function(F,G){I(G)})})}).catch(I)});return E(v,f),v}function Bp(f){var y=this,v=new b(function(C,I){y.ready().then(function(){var T=y._dbInfo;T.db.transaction(function(P){Ye(P,T,"SELECT COUNT(key) as c FROM "+T.storeName,[],function(F,G){var W=G.rows.item(0).c;C(W)},function(F,G){I(G)})})}).catch(I)});return E(v,f),v}function jp(f,y){var v=this,C=new b(function(I,T){v.ready().then(function(){var P=v._dbInfo;P.db.transaction(function(F){Ye(F,P,"SELECT key FROM "+P.storeName+" WHERE id = ? LIMIT 1",[f+1],function(G,W){var V=W.rows.length?W.rows.item(0).key:null;I(V)},function(G,W){T(W)})})}).catch(T)});return E(C,y),C}function $p(f){var y=this,v=new b(function(C,I){y.ready().then(function(){var T=y._dbInfo;T.db.transaction(function(P){Ye(P,T,"SELECT key FROM "+T.storeName,[],function(F,G){for(var W=[],V=0;V<G.rows.length;V++)W.push(G.rows.item(V).key);C(W)},function(F,G){I(G)})})}).catch(I)});return E(v,f),v}function Fp(f){return new b(function(y,v){f.transaction(function(C){C.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(I,T){for(var P=[],F=0;F<T.rows.length;F++)P.push(T.rows.item(F).name);y({db:f,storeNames:P})},function(I,T){v(T)})},function(C){v(C)})})}function Hp(f,y){y=M.apply(this,arguments);var v=this.config();f=typeof f!="function"&&f||{},f.name||(f.name=f.name||v.name,f.storeName=f.storeName||v.storeName);var C=this,I;return f.name?I=new b(function(T){var P;f.name===v.name?P=C._dbInfo.db:P=openDatabase(f.name,"","",0),f.storeName?T({db:P,storeNames:[f.storeName]}):T(Fp(P))}).then(function(T){return new b(function(P,F){T.db.transaction(function(G){function W(_t){return new b(function(ft,Rt){G.executeSql("DROP TABLE IF EXISTS "+_t,[],function(){ft()},function(Dt,ue){Rt(ue)})})}for(var V=[],Q=0,st=T.storeNames.length;Q<st;Q++)V.push(W(T.storeNames[Q]));b.all(V).then(function(){P()}).catch(function(_t){F(_t)})},function(G){F(G)})})}):I=b.reject("Invalid arguments"),E(I,y),I}var Vp={_driver:"webSQLStorage",_initStorage:Pp,_support:d(),iterate:Rp,getItem:kp,setItem:Lp,removeItem:Up,clear:Mp,length:Bp,key:jp,keys:$p,dropInstance:Hp};function Wp(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function yc(f,y){var v=f.name+"/";return f.storeName!==y.storeName&&(v+=f.storeName+"/"),v}function Gp(){var f="_localforage_support_test";try{return localStorage.setItem(f,!0),localStorage.removeItem(f),!1}catch{return!0}}function qp(){return!Gp()||localStorage.length>0}function zp(f){var y=this,v={};if(f)for(var C in f)v[C]=f[C];return v.keyPrefix=yc(f,y._defaultConfig),qp()?(y._dbInfo=v,v.serializer=Ts,b.resolve()):b.reject()}function Yp(f){var y=this,v=y.ready().then(function(){for(var C=y._dbInfo.keyPrefix,I=localStorage.length-1;I>=0;I--){var T=localStorage.key(I);T.indexOf(C)===0&&localStorage.removeItem(T)}});return E(v,f),v}function Kp(f,y){var v=this;f=A(f);var C=v.ready().then(function(){var I=v._dbInfo,T=localStorage.getItem(I.keyPrefix+f);return T&&(T=I.serializer.deserialize(T)),T});return E(C,y),C}function Jp(f,y){var v=this,C=v.ready().then(function(){for(var I=v._dbInfo,T=I.keyPrefix,P=T.length,F=localStorage.length,G=1,W=0;W<F;W++){var V=localStorage.key(W);if(V.indexOf(T)===0){var Q=localStorage.getItem(V);if(Q&&(Q=I.serializer.deserialize(Q)),Q=f(Q,V.substring(P),G++),Q!==void 0)return Q}}});return E(C,y),C}function Qp(f,y){var v=this,C=v.ready().then(function(){var I=v._dbInfo,T;try{T=localStorage.key(f)}catch{T=null}return T&&(T=T.substring(I.keyPrefix.length)),T});return E(C,y),C}function Xp(f){var y=this,v=y.ready().then(function(){for(var C=y._dbInfo,I=localStorage.length,T=[],P=0;P<I;P++){var F=localStorage.key(P);F.indexOf(C.keyPrefix)===0&&T.push(F.substring(C.keyPrefix.length))}return T});return E(v,f),v}function Zp(f){var y=this,v=y.keys().then(function(C){return C.length});return E(v,f),v}function td(f,y){var v=this;f=A(f);var C=v.ready().then(function(){var I=v._dbInfo;localStorage.removeItem(I.keyPrefix+f)});return E(C,y),C}function ed(f,y,v){var C=this;f=A(f);var I=C.ready().then(function(){y===void 0&&(y=null);var T=y;return new b(function(P,F){var G=C._dbInfo;G.serializer.serialize(y,function(W,V){if(V)F(V);else try{localStorage.setItem(G.keyPrefix+f,W),P(T)}catch(Q){(Q.name==="QuotaExceededError"||Q.name==="NS_ERROR_DOM_QUOTA_REACHED")&&F(Q),F(Q)}})})});return E(I,v),I}function rd(f,y){if(y=M.apply(this,arguments),f=typeof f!="function"&&f||{},!f.name){var v=this.config();f.name=f.name||v.name,f.storeName=f.storeName||v.storeName}var C=this,I;return f.name?I=new b(function(T){f.storeName?T(yc(f,C._defaultConfig)):T(f.name+"/")}).then(function(T){for(var P=localStorage.length-1;P>=0;P--){var F=localStorage.key(P);F.indexOf(T)===0&&localStorage.removeItem(F)}}):I=b.reject("Invalid arguments"),E(I,y),I}var nd={_driver:"localStorageWrapper",_initStorage:zp,_support:Wp(),iterate:Jp,getItem:Kp,setItem:ed,removeItem:td,clear:Yp,length:Zp,key:Qp,keys:Xp,dropInstance:rd},id=function(f,y){return f===y||typeof f=="number"&&typeof y=="number"&&isNaN(f)&&isNaN(y)},sd=function(f,y){for(var v=f.length,C=0;C<v;){if(id(f[C],y))return!0;C++}return!1},vc=Array.isArray||function(f){return Object.prototype.toString.call(f)==="[object Array]"},wn={},wc={},Mr={INDEXEDDB:u,WEBSQL:Vp,LOCALSTORAGE:nd},od=[Mr.INDEXEDDB._driver,Mr.WEBSQL._driver,Mr.LOCALSTORAGE._driver],di=["dropInstance"],xs=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(di),ad={description:"",driver:od.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function cd(f,y){f[y]=function(){var v=arguments;return f.ready().then(function(){return f[y].apply(f,v)})}}function Ds(){for(var f=1;f<arguments.length;f++){var y=arguments[f];if(y)for(var v in y)y.hasOwnProperty(v)&&(vc(y[v])?arguments[0][v]=y[v].slice():arguments[0][v]=y[v])}return arguments[0]}var ld=function(){function f(y){h(this,f);for(var v in Mr)if(Mr.hasOwnProperty(v)){var C=Mr[v],I=C._driver;this[v]=I,wn[I]||this.defineDriver(C)}this._defaultConfig=Ds({},ad),this._config=Ds({},this._defaultConfig,y),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(y){if((typeof y>"u"?"undefined":l(y))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var v in y){if(v==="storeName"&&(y[v]=y[v].replace(/\W/g,"_")),v==="version"&&typeof y[v]!="number")return new Error("Database version must be a number.");this._config[v]=y[v]}return"driver"in y&&y.driver?this.setDriver(this._config.driver):!0}else return typeof y=="string"?this._config[y]:this._config},f.prototype.defineDriver=function(y,v,C){var I=new b(function(T,P){try{var F=y._driver,G=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!y._driver){P(G);return}for(var W=xs.concat("_initStorage"),V=0,Q=W.length;V<Q;V++){var st=W[V],_t=!sd(di,st);if((_t||y[st])&&typeof y[st]!="function"){P(G);return}}var ft=function(){for(var Dt=function(hd){return function(){var pd=new Error("Method "+hd+" is not implemented by the current driver"),bc=b.reject(pd);return E(bc,arguments[arguments.length-1]),bc}},ue=0,Ns=di.length;ue<Ns;ue++){var As=di[ue];y[As]||(y[As]=Dt(As))}};ft();var Rt=function(Dt){wn[F]&&console.info("Redefining LocalForage driver: "+F),wn[F]=y,wc[F]=Dt,T()};"_support"in y?y._support&&typeof y._support=="function"?y._support().then(Rt,P):Rt(!!y._support):Rt(!0)}catch(Dt){P(Dt)}});return k(I,v,C),I},f.prototype.driver=function(){return this._driver||null},f.prototype.getDriver=function(y,v,C){var I=wn[y]?b.resolve(wn[y]):b.reject(new Error("Driver not found."));return k(I,v,C),I},f.prototype.getSerializer=function(y){var v=b.resolve(Ts);return k(v,y),v},f.prototype.ready=function(y){var v=this,C=v._driverSet.then(function(){return v._ready===null&&(v._ready=v._initDriver()),v._ready});return k(C,y,y),C},f.prototype.setDriver=function(y,v,C){var I=this;vc(y)||(y=[y]);var T=this._getSupportedDrivers(y);function P(){I._config.driver=I.driver()}function F(V){return I._extend(V),P(),I._ready=I._initStorage(I._config),I._ready}function G(V){return function(){var Q=0;function st(){for(;Q<V.length;){var _t=V[Q];return Q++,I._dbInfo=null,I._ready=null,I.getDriver(_t).then(F).catch(st)}P();var ft=new Error("No available storage method found.");return I._driverSet=b.reject(ft),I._driverSet}return st()}}var W=this._driverSet!==null?this._driverSet.catch(function(){return b.resolve()}):b.resolve();return this._driverSet=W.then(function(){var V=T[0];return I._dbInfo=null,I._ready=null,I.getDriver(V).then(function(Q){I._driver=Q._driver,P(),I._wrapLibraryMethodsWithReady(),I._initDriver=G(T)})}).catch(function(){P();var V=new Error("No available storage method found.");return I._driverSet=b.reject(V),I._driverSet}),k(this._driverSet,v,C),this._driverSet},f.prototype.supports=function(y){return!!wc[y]},f.prototype._extend=function(y){Ds(this,y)},f.prototype._getSupportedDrivers=function(y){for(var v=[],C=0,I=y.length;C<I;C++){var T=y[C];this.supports(T)&&v.push(T)}return v},f.prototype._wrapLibraryMethodsWithReady=function(){for(var y=0,v=xs.length;y<v;y++)cd(this,xs[y])},f.prototype.createInstance=function(y){return new f(y)},f}(),ud=new ld;o.exports=ud},{3:3}]},{},[4])(4)})}),Qn=qe(t=>{"use strict";var e=t&&t.__awaiter||function(n,i,s,o){function a(l){return l instanceof s?l:new s(function(h){h(l)})}return new(s||(s=Promise))(function(l,h){function g(w){try{_(o.next(w))}catch(b){h(b)}}function p(w){try{_(o.throw(w))}catch(b){h(b)}}function _(w){w.done?l(w.value):a(w.value).then(g,p)}_((o=o.apply(n,i||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.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 e(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})}};t.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)/)}),yu=qe(t=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.URLBuilder=void 0;var e=function(){function r(n){try{this.base=new URL(n),this.params=new URLSearchParams(this.base.search.slice(1))}catch(i){console.error("Un-parsable URL",i)}}return r.prototype.appendQueryParam=function(n,i){this.params.append(n,i?i.toString():"")},r.prototype.clearQueryParams=function(){return this.params=new URLSearchParams,this},r.prototype.deleteQueryParam=function(n){this.params.delete(n)},r.prototype.getBase=function(){return this.base},r.prototype.getPath=function(){return this.base.pathname},r.prototype.getHostname=function(){return this.base.hostname},r.prototype.getParams=function(){return this.params},r.prototype.getQueryParam=function(n){if(!this.params)return"";var i=this.params.get(n);return!i||i==="undefined"||i==="null"?void 0:i},r.prototype.getQueryString=function(){return this.params.toString()},r.prototype.setPath=function(n){return this.base.pathname=n,this},r.prototype.setQueryParam=function(n,i){return this.params.set(n,i?i.toString():""),this},r.prototype.setQueryString=function(n){if(n)return n[0]==="?"&&(n=n.slice(1)),this.params=new URLSearchParams(n),this},r.prototype.toString=function(){var n=this.params.toString();return n===""?this.base.search="":this.base.search="?"+n,this.base.toString()},r}();t.URLBuilder=e}),Nd=qe((t,e)=>{"use strict";(function(r,n){typeof t=="object"&&typeof e<"u"?e.exports=n():typeof define=="function"&&define.amd?define(n):(r=typeof globalThis<"u"?globalThis:r||self,r.fetchRetry=n())})(t,function(){"use strict";var r=function(s,o){if(o=o||{},typeof s!="function")throw new i("fetch must be a function");if(typeof o!="object")throw new i("defaults must be an object");if(o.retries!==void 0&&!n(o.retries))throw new i("retries must be a positive integer");if(o.retryDelay!==void 0&&!n(o.retryDelay)&&typeof o.retryDelay!="function")throw new i("retryDelay must be a positive integer or a function returning a positive integer");if(o.retryOn!==void 0&&!Array.isArray(o.retryOn)&&typeof o.retryOn!="function")throw new i("retryOn property expects an array or function");var a={retries:3,retryDelay:1e3,retryOn:[]};return o=Object.assign(a,o),function(l,h){var g=o.retries,p=o.retryDelay,_=o.retryOn;if(h&&h.retries!==void 0)if(n(h.retries))g=h.retries;else throw new i("retries must be a positive integer");if(h&&h.retryDelay!==void 0)if(n(h.retryDelay)||typeof h.retryDelay=="function")p=h.retryDelay;else throw new i("retryDelay must be a positive integer or a function returning a positive integer");if(h&&h.retryOn)if(Array.isArray(h.retryOn)||typeof h.retryOn=="function")_=h.retryOn;else throw new i("retryOn property expects an array or function");return new Promise(function(w,b){var E=function(A){var M=typeof Request<"u"&&l instanceof Request?l.clone():l;s(M,h).then(function(z){if(Array.isArray(_)&&_.indexOf(z.status)===-1)w(z);else if(typeof _=="function")try{return Promise.resolve(_(A,null,z)).then(function(B){B?k(A,null,z):w(z)}).catch(b)}catch(B){b(B)}else A<g?k(A,null,z):w(z)}).catch(function(z){if(typeof _=="function")try{Promise.resolve(_(A,z,null)).then(function(B){B?k(A,z,null):b(z)}).catch(function(B){b(B)})}catch(B){b(B)}else A<g?k(A,z,null):b(z)})};function k(A,M,z){var B=typeof p=="function"?p(A,M,z):p;setTimeout(function(){E(++A)},B)}E(0)})}};function n(s){return Number.isInteger(s)&&s>=0}function i(s){this.name="ArgumentError",this.message=s}return r})}),Ad="9.10.14",q=class co{static SDK_VERSION=Ad;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 e=co.SDK_VERSION.split(".").map(r=>r.padStart(2,"0")).join("");co.SDK_VERSION_CODE=parseInt(e,10)}},Pe={apiURL:"https://api.sdk.letscooee.com",debug:!1,mode:"production",styleURL:`https://cdn.jsdelivr.net/npm/@letscooee/web-sdk@${q.SDK_VERSION}/dist/widget.min.css`,widgetURL:`https://cdn.jsdelivr.net/npm/@letscooee/web-sdk@${q.SDK_VERSION}/dist/widget.min.js`},de=dt(an()),x=class{static log(...t){de.default.info(...t)}static debug(...t){de.default.debug(...t)}static error(...t){de.default.error(...t)}static warn(...t){de.default.warn(...t)}static info(...t){de.default.info(...t)}static trace(...t){de.default.trace(...t)}};function Od(t=q.LOG_PREFIX){de.default.useDefaults({formatter:function(r){r.unshift(`${t} (v${q.SDK_VERSION}):`)}});let e=vu();(e==="1"||e==="on")&&(localStorage.cooeeLogLevel="TRACE"),localStorage.cooeeLogLevel?de.default.setLevel(de.default[localStorage.cooeeLogLevel]):de.default.setLevel(Pe.debug?de.default.TRACE:de.default.OFF)}function vu(){return new URL(location.href).searchParams?.get("cooee-debug")}function Pd(){let t=`
|
|
2
2
|
display: inline-block;
|
|
3
3
|
font-size: 14px;
|
|
4
4
|
background: linear-gradient(90deg, #d52dc8 25%, #2179e2 82%);
|
|
@@ -13,29 +13,29 @@
|
|
|
13
13
|
`,e+=`
|
|
14
14
|
|
|
15
15
|
`,e+=`Learn more: https://www.letscooee.com
|
|
16
|
-
Cooee SDK: v${q.SDK_VERSION}`,console.group("%c Elevate your ecommerce experience with Cooee \u{1F680} ",t),console.log(`%c${e}`,"font-size: 13px; line-height: 1.8;"),console.groupEnd()}var Pd=dt(pu()),se=class{gaEnabled;gaMeasurementID;pixelPush;website;currencyCount;money;storefrontToken;skipItemAttribute;currency;static get(){return window.CooeeSDK.config}update(t){return t??={},this.gaEnabled=t.gaEnabled,this.gaMeasurementID=t.gaMeasurementID,this.pixelPush=t.pixelPush,this.website=t.website??{},this.currencyCount=t.currencyCount??0,this.money=t.money,this.currency=t.currency,this.storefrontToken=t.storefrontToken,this.skipItemAttribute=t.skipItemAttribute,this}},Zt=dt(lr()),Ke=dt(Xo()),Os=dt(fu()),rs,gt,vu,wu,yr,Sc,bu,lo,_u,ta,uo,ho,Rd,Hn={},Eu=[],Ld=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,ea=Array.isArray;function nr(t,e){for(var r in e)t[r]=e[r];return t}function ra(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function Su(t,e,r){var n,i,s,o={};for(s in e)s=="key"?n=e[s]:s=="ref"?i=e[s]:o[s]=e[s];if(arguments.length>2&&(o.children=arguments.length>3?rs.call(arguments,2):r),typeof t=="function"&&t.defaultProps!=null)for(s in t.defaultProps)o[s]===void 0&&(o[s]=t.defaultProps[s]);return Oi(t,o,n,i,null)}function Oi(t,e,r,n,i){var s={type:t,props:e,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++vu,__i:-1,__u:0};return i==null&>.vnode!=null&>.vnode(s),s}function cn(t){return t.children}function br(t,e){this.props=t,this.context=e}function Qr(t,e){if(e==null)return t.__?Qr(t.__,t.__i+1):null;for(var r;e<t.__k.length;e++)if((r=t.__k[e])!=null&&r.__e!=null)return r.__e;return typeof t.type=="function"?Qr(t):null}function Iu(t){var e,r;if((t=t.__)!=null&&t.__c!=null){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if((r=t.__k[e])!=null&&r.__e!=null){t.__e=t.__c.base=r.__e;break}return Iu(t)}}function Ic(t){(!t.__d&&(t.__d=!0)&&yr.push(t)&&!Bi.__r++||Sc!==gt.debounceRendering)&&((Sc=gt.debounceRendering)||bu)(Bi)}function Bi(){var t,e,r,n,i,s,o,a;for(yr.sort(lo);t=yr.shift();)t.__d&&(e=yr.length,n=void 0,s=(i=(r=t).__v).__e,o=[],a=[],r.__P&&((n=nr({},i)).__v=i.__v+1,gt.vnode&>.vnode(n),na(r.__P,n,i,r.__n,r.__P.namespaceURI,32&i.__u?[s]:null,o,s??Qr(i),!!(32&i.__u),a),n.__v=i.__v,n.__.__k[n.__i]=n,xu(o,n,a),n.__e!=s&&Iu(n)),yr.length>e&&yr.sort(lo));Bi.__r=0}function Cu(t,e,r,n,i,s,o,a,l,h,g){var p,_,w,b,E,P,A=n&&n.__k||Eu,M=e.length;for(l=Ud(r,e,A,l,M),p=0;p<M;p++)(w=r.__k[p])!=null&&(_=w.__i===-1?Hn:A[w.__i]||Hn,w.__i=p,P=na(t,w,_,i,s,o,a,l,h,g),b=w.__e,w.ref&&_.ref!=w.ref&&(_.ref&&ia(_.ref,null,w),g.push(w.ref,w.__c||b,w)),E==null&&b!=null&&(E=b),4&w.__u||_.__k===w.__k?l=Tu(w,l,t):typeof w.type=="function"&&P!==void 0?l=P:b&&(l=b.nextSibling),w.__u&=-7);return r.__e=E,l}function Ud(t,e,r,n,i){var s,o,a,l,h,g=r.length,p=g,_=0;for(t.__k=new Array(i),s=0;s<i;s++)(o=e[s])!=null&&typeof o!="boolean"&&typeof o!="function"?(l=s+_,(o=t.__k[s]=typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?Oi(null,o,null,null,null):ea(o)?Oi(cn,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?Oi(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=t,o.__b=t.__b+1,a=null,(h=o.__i=Md(o,r,l,p))!==-1&&(p--,(a=r[h])&&(a.__u|=2)),a==null||a.__v===null?(h==-1&&_--,typeof o.type!="function"&&(o.__u|=4)):h!=l&&(h==l-1?_--:h==l+1?_++:(h>l?_--:_++,o.__u|=4))):t.__k[s]=null;if(p)for(s=0;s<g;s++)(a=r[s])!=null&&(2&a.__u)==0&&(a.__e==n&&(n=Qr(a)),Du(a,a));return n}function Tu(t,e,r){var n,i;if(typeof t.type=="function"){for(n=t.__k,i=0;n&&i<n.length;i++)n[i]&&(n[i].__=t,e=Tu(n[i],e,r));return e}t.__e!=e&&(e&&t.type&&!r.contains(e)&&(e=Qr(t)),r.insertBefore(t.__e,e||null),e=t.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function Md(t,e,r,n){var i,s,o=t.key,a=t.type,l=e[r];if(l===null||l&&o==l.key&&a===l.type&&(2&l.__u)==0)return r;if(n>(l!=null&&(2&l.__u)==0?1:0))for(i=r-1,s=r+1;i>=0||s<e.length;){if(i>=0){if((l=e[i])&&(2&l.__u)==0&&o==l.key&&a===l.type)return i;i--}if(s<e.length){if((l=e[s])&&(2&l.__u)==0&&o==l.key&&a===l.type)return s;s++}}return-1}function Cc(t,e,r){e[0]=="-"?t.setProperty(e,r??""):t[e]=r==null?"":typeof r!="number"||Ld.test(e)?r:r+"px"}function gi(t,e,r,n,i){var s;t:if(e=="style")if(typeof r=="string")t.style.cssText=r;else{if(typeof n=="string"&&(t.style.cssText=n=""),n)for(e in n)r&&e in r||Cc(t.style,e,"");if(r)for(e in r)n&&r[e]===n[e]||Cc(t.style,e,r[e])}else if(e[0]=="o"&&e[1]=="n")s=e!=(e=e.replace(_u,"$1")),e=e.toLowerCase()in t||e=="onFocusOut"||e=="onFocusIn"?e.toLowerCase().slice(2):e.slice(2),t.l||(t.l={}),t.l[e+s]=r,r?n?r.u=n.u:(r.u=ta,t.addEventListener(e,s?ho:uo,s)):t.removeEventListener(e,s?ho:uo,s);else{if(i=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in t)try{t[e]=r??"";break t}catch{}typeof r=="function"||(r==null||r===!1&&e[4]!="-"?t.removeAttribute(e):t.setAttribute(e,e=="popover"&&r==1?"":r))}}function Tc(t){return function(e){if(this.l){var r=this.l[e.type+t];if(e.t==null)e.t=ta++;else if(e.t<r.u)return;return r(gt.event?gt.event(e):e)}}}function na(t,e,r,n,i,s,o,a,l,h){var g,p,_,w,b,E,P,A,M,z,B,Z,bt,It,H,rt,X,tt=e.type;if(e.constructor!==void 0)return null;128&r.__u&&(l=!!(32&r.__u),s=[a=e.__e=r.__e]),(g=gt.__b)&&g(e);t:if(typeof tt=="function")try{if(A=e.props,M="prototype"in tt&&tt.prototype.render,z=(g=tt.contextType)&&n[g.__c],B=g?z?z.props.value:g.__:n,r.__c?P=(p=e.__c=r.__c).__=p.__E:(M?e.__c=p=new tt(A,B):(e.__c=p=new br(A,B),p.constructor=tt,p.render=jd),z&&z.sub(p),p.props=A,p.state||(p.state={}),p.context=B,p.__n=n,_=p.__d=!0,p.__h=[],p._sb=[]),M&&p.__s==null&&(p.__s=p.state),M&&tt.getDerivedStateFromProps!=null&&(p.__s==p.state&&(p.__s=nr({},p.__s)),nr(p.__s,tt.getDerivedStateFromProps(A,p.__s))),w=p.props,b=p.state,p.__v=e,_)M&&tt.getDerivedStateFromProps==null&&p.componentWillMount!=null&&p.componentWillMount(),M&&p.componentDidMount!=null&&p.__h.push(p.componentDidMount);else{if(M&&tt.getDerivedStateFromProps==null&&A!==w&&p.componentWillReceiveProps!=null&&p.componentWillReceiveProps(A,B),!p.__e&&(p.shouldComponentUpdate!=null&&p.shouldComponentUpdate(A,p.__s,B)===!1||e.__v==r.__v)){for(e.__v!=r.__v&&(p.props=A,p.state=p.__s,p.__d=!1),e.__e=r.__e,e.__k=r.__k,e.__k.some(function(ct){ct&&(ct.__=e)}),Z=0;Z<p._sb.length;Z++)p.__h.push(p._sb[Z]);p._sb=[],p.__h.length&&o.push(p);break t}p.componentWillUpdate!=null&&p.componentWillUpdate(A,p.__s,B),M&&p.componentDidUpdate!=null&&p.__h.push(function(){p.componentDidUpdate(w,b,E)})}if(p.context=B,p.props=A,p.__P=t,p.__e=!1,bt=gt.__r,It=0,M){for(p.state=p.__s,p.__d=!1,bt&&bt(e),g=p.render(p.props,p.state,p.context),H=0;H<p._sb.length;H++)p.__h.push(p._sb[H]);p._sb=[]}else do p.__d=!1,bt&&bt(e),g=p.render(p.props,p.state,p.context),p.state=p.__s;while(p.__d&&++It<25);p.state=p.__s,p.getChildContext!=null&&(n=nr(nr({},n),p.getChildContext())),M&&!_&&p.getSnapshotBeforeUpdate!=null&&(E=p.getSnapshotBeforeUpdate(w,b)),a=Cu(t,ea(rt=g!=null&&g.type===cn&&g.key==null?g.props.children:g)?rt:[rt],e,r,n,i,s,o,a,l,h),p.base=e.__e,e.__u&=-161,p.__h.length&&o.push(p),P&&(p.__E=p.__=null)}catch(ct){if(e.__v=null,l||s!=null)if(ct.then){for(e.__u|=l?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;s[s.indexOf(a)]=null,e.__e=a}else for(X=s.length;X--;)ra(s[X]);else e.__e=r.__e,e.__k=r.__k;gt.__e(ct,e,r)}else s==null&&e.__v==r.__v?(e.__k=r.__k,e.__e=r.__e):a=e.__e=Bd(r.__e,e,r,n,i,s,o,l,h);return(g=gt.diffed)&&g(e),128&e.__u?void 0:a}function xu(t,e,r){for(var n=0;n<r.length;n++)ia(r[n],r[++n],r[++n]);gt.__c&>.__c(e,t),t.some(function(i){try{t=i.__h,i.__h=[],t.some(function(s){s.call(i)})}catch(s){gt.__e(s,i.__v)}})}function Bd(t,e,r,n,i,s,o,a,l){var h,g,p,_,w,b,E,P=r.props,A=e.props,M=e.type;if(M=="svg"?i="http://www.w3.org/2000/svg":M=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),s!=null){for(h=0;h<s.length;h++)if((w=s[h])&&"setAttribute"in w==!!M&&(M?w.localName==M:w.nodeType==3)){t=w,s[h]=null;break}}if(t==null){if(M==null)return document.createTextNode(A);t=document.createElementNS(i,M,A.is&&A),a&&(gt.__m&>.__m(e,s),a=!1),s=null}if(M===null)P===A||a&&t.data===A||(t.data=A);else{if(s=s&&rs.call(t.childNodes),P=r.props||Hn,!a&&s!=null)for(P={},h=0;h<t.attributes.length;h++)P[(w=t.attributes[h]).name]=w.value;for(h in P)if(w=P[h],h!="children"){if(h=="dangerouslySetInnerHTML")p=w;else if(!(h in A)){if(h=="value"&&"defaultValue"in A||h=="checked"&&"defaultChecked"in A)continue;gi(t,h,null,w,i)}}for(h in A)w=A[h],h=="children"?_=w:h=="dangerouslySetInnerHTML"?g=w:h=="value"?b=w:h=="checked"?E=w:a&&typeof w!="function"||P[h]===w||gi(t,h,w,P[h],i);if(g)a||p&&(g.__html===p.__html||g.__html===t.innerHTML)||(t.innerHTML=g.__html),e.__k=[];else if(p&&(t.innerHTML=""),Cu(t,ea(_)?_:[_],e,r,n,M=="foreignObject"?"http://www.w3.org/1999/xhtml":i,s,o,s?s[0]:r.__k&&Qr(r,0),a,l),s!=null)for(h=s.length;h--;)ra(s[h]);a||(h="value",M=="progress"&&b==null?t.removeAttribute("value"):b!==void 0&&(b!==t[h]||M=="progress"&&!b||M=="option"&&b!==P[h])&&gi(t,h,b,P[h],i),h="checked",E!==void 0&&E!==t[h]&&gi(t,h,E,P[h],i))}return t}function ia(t,e,r){try{if(typeof t=="function"){var n=typeof t.__u=="function";n&&t.__u(),n&&e==null||(t.__u=t(e))}else t.current=e}catch(i){gt.__e(i,r)}}function Du(t,e,r){var n,i;if(gt.unmount&>.unmount(t),(n=t.ref)&&(n.current&&n.current!==t.__e||ia(n,null,e)),(n=t.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(s){gt.__e(s,e)}n.base=n.__P=null}if(n=t.__k)for(i=0;i<n.length;i++)n[i]&&Du(n[i],e,r||typeof t.type!="function");r||ra(t.__e),t.__c=t.__=t.__e=void 0}function jd(t,e,r){return this.constructor(t,r)}function $d(t,e,r){var n,i,s,o;e==document&&(e=document.documentElement),gt.__&>.__(t,e),i=(n=typeof r=="function")?null:r&&r.__k||e.__k,s=[],o=[],na(e,t=(!n&&r||e).__k=Su(cn,null,[t]),i||Hn,Hn,e.namespaceURI,!n&&r?[r]:i?null:e.firstChild?rs.call(e.childNodes):null,s,!n&&r?r:i?i.__e:e.firstChild,n,o),xu(s,t,o)}rs=Eu.slice,gt={__e:function(t,e,r,n){for(var i,s,o;e=e.__;)if((i=e.__c)&&!i.__)try{if((s=i.constructor)&&s.getDerivedStateFromError!=null&&(i.setState(s.getDerivedStateFromError(t)),o=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(t,n||{}),o=i.__d),o)return i.__E=i}catch(a){t=a}throw t}},vu=0,wu=function(t){return t!=null&&t.constructor==null},br.prototype.setState=function(t,e){var r;r=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=nr({},this.state),typeof t=="function"&&(t=t(nr({},r),this.props)),t&&nr(r,t),t!=null&&this.__v&&(e&&this._sb.push(e),Ic(this))},br.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),Ic(this))},br.prototype.render=cn,yr=[],bu=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,lo=function(t,e){return t.__v.__b-e.__v.__b},Bi.__r=0,_u=/(PointerCapture)$|Capture$/i,ta=0,uo=Tc(!1),ho=Tc(!0),Rd=0;var po,ne,ks,xc,Dc=0,Nu=[],Mt=gt,Nc=Mt.__b,Ac=Mt.__r,Oc=Mt.diffed,kc=Mt.__c,Pc=Mt.unmount,Rc=Mt.__;function Fd(t,e){Mt.__h&&Mt.__h(ne,t,Dc||e),Dc=0;var r=ne.__H||(ne.__H={__:[],__h:[]});return t>=r.__.length&&r.__.push({}),r.__[t]}function Au(t,e){var r=Fd(po++,7);return Wd(r.__H,e)&&(r.__=t(),r.__H=e,r.__h=t),r.__}function Hd(){for(var t;t=Nu.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(ki),t.__H.__h.forEach(fo),t.__H.__h=[]}catch(e){t.__H.__h=[],Mt.__e(e,t.__v)}}Mt.__b=function(t){ne=null,Nc&&Nc(t)},Mt.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),Rc&&Rc(t,e)},Mt.__r=function(t){Ac&&Ac(t),po=0;var e=(ne=t.__c).__H;e&&(ks===ne?(e.__h=[],ne.__h=[],e.__.forEach(function(r){r.__N&&(r.__=r.__N),r.i=r.__N=void 0})):(e.__h.forEach(ki),e.__h.forEach(fo),e.__h=[],po=0)),ks=ne},Mt.diffed=function(t){Oc&&Oc(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(Nu.push(e)!==1&&xc===Mt.requestAnimationFrame||((xc=Mt.requestAnimationFrame)||Vd)(Hd)),e.__H.__.forEach(function(r){r.i&&(r.__H=r.i),r.i=void 0})),ks=ne=null},Mt.__c=function(t,e){e.some(function(r){try{r.__h.forEach(ki),r.__h=r.__h.filter(function(n){return!n.__||fo(n)})}catch(n){e.some(function(i){i.__h&&(i.__h=[])}),e=[],Mt.__e(n,r.__v)}}),kc&&kc(t,e)},Mt.unmount=function(t){Pc&&Pc(t);var e,r=t.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{ki(n)}catch(i){e=i}}),r.__H=void 0,e&&Mt.__e(e,r.__v))};var Lc=typeof requestAnimationFrame=="function";function Vd(t){var e,r=function(){clearTimeout(n),Lc&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(r,100);Lc&&(e=requestAnimationFrame(r))}function ki(t){var e=ne,r=t.__c;typeof r=="function"&&(t.__c=void 0,r()),ne=e}function fo(t){var e=ne;t.__c=t.__(),ne=e}function Wd(t,e){return!t||t.length!==e.length||e.some(function(r,n){return r!==t[n]})}var Gd=Symbol.for("preact-signals");function sa(){if(Gr>1)Gr--;else{for(var t,e=!1;Bn!==void 0;){var r=Bn;for(Bn=void 0,go++;r!==void 0;){var n=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&ku(r))try{r.c()}catch(i){e||(t=i,e=!0)}r=n}}if(go=0,Gr--,e)throw t}}var Et=void 0,Bn=void 0,Gr=0,go=0,ji=0;function Ou(t){if(Et!==void 0){var e=t.n;if(e===void 0||e.t!==Et)return e={i:0,S:t,p:Et.s,n:void 0,t:Et,e:void 0,x:void 0,r:e},Et.s!==void 0&&(Et.s.n=e),Et.s=e,t.n=e,32&Et.f&&t.S(e),e;if(e.i===-1)return e.i=0,e.n!==void 0&&(e.n.p=e.p,e.p!==void 0&&(e.p.n=e.n),e.p=Et.s,e.n=void 0,Et.s.n=e,Et.s=e),e}}function Gt(t){this.v=t,this.i=0,this.n=void 0,this.t=void 0}Gt.prototype.brand=Gd;Gt.prototype.h=function(){return!0};Gt.prototype.S=function(t){this.t!==t&&t.e===void 0&&(t.x=this.t,this.t!==void 0&&(this.t.e=t),this.t=t)};Gt.prototype.U=function(t){if(this.t!==void 0){var e=t.e,r=t.x;e!==void 0&&(e.x=r,t.e=void 0),r!==void 0&&(r.e=e,t.x=void 0),t===this.t&&(this.t=r)}};Gt.prototype.subscribe=function(t){var e=this;return ze(function(){var r=e.value,n=Et;Et=void 0;try{t(r)}finally{Et=n}})};Gt.prototype.valueOf=function(){return this.value};Gt.prototype.toString=function(){return this.value+""};Gt.prototype.toJSON=function(){return this.value};Gt.prototype.peek=function(){var t=Et;Et=void 0;try{return this.value}finally{Et=t}};Object.defineProperty(Gt.prototype,"value",{get:function(){var t=Ou(this);return t!==void 0&&(t.i=this.i),this.v},set:function(t){if(t!==this.v){if(go>100)throw new Error("Cycle detected");this.v=t,this.i++,ji++,Gr++;try{for(var e=this.t;e!==void 0;e=e.x)e.t.N()}finally{sa()}}}});function Ir(t){return new Gt(t)}function ku(t){for(var e=t.s;e!==void 0;e=e.n)if(e.S.i!==e.i||!e.S.h()||e.S.i!==e.i)return!0;return!1}function Pu(t){for(var e=t.s;e!==void 0;e=e.n){var r=e.S.n;if(r!==void 0&&(e.r=r),e.S.n=e,e.i=-1,e.n===void 0){t.s=e;break}}}function Ru(t){for(var e=t.s,r=void 0;e!==void 0;){var n=e.p;e.i===-1?(e.S.U(e),n!==void 0&&(n.n=e.n),e.n!==void 0&&(e.n.p=n)):r=e,e.S.n=e.r,e.r!==void 0&&(e.r=void 0),e=n}t.s=r}function ln(t){Gt.call(this,void 0),this.x=t,this.s=void 0,this.g=ji-1,this.f=4}(ln.prototype=new Gt).h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===ji))return!0;if(this.g=ji,this.f|=1,this.i>0&&!ku(this))return this.f&=-2,!0;var t=Et;try{Pu(this),Et=this;var e=this.x();(16&this.f||this.v!==e||this.i===0)&&(this.v=e,this.f&=-17,this.i++)}catch(r){this.v=r,this.f|=16,this.i++}return Et=t,Ru(this),this.f&=-2,!0};ln.prototype.S=function(t){if(this.t===void 0){this.f|=36;for(var e=this.s;e!==void 0;e=e.n)e.S.S(e)}Gt.prototype.S.call(this,t)};ln.prototype.U=function(t){if(this.t!==void 0&&(Gt.prototype.U.call(this,t),this.t===void 0)){this.f&=-33;for(var e=this.s;e!==void 0;e=e.n)e.S.U(e)}};ln.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var t=this.t;t!==void 0;t=t.x)t.t.N()}};Object.defineProperty(ln.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var t=Ou(this);if(this.h(),t!==void 0&&(t.i=this.i),16&this.f)throw this.v;return this.v}});function qd(t){return new ln(t)}function Lu(t){var e=t.u;if(t.u=void 0,typeof e=="function"){Gr++;var r=Et;Et=void 0;try{e()}catch(n){throw t.f&=-2,t.f|=8,oa(t),n}finally{Et=r,sa()}}}function oa(t){for(var e=t.s;e!==void 0;e=e.n)e.S.U(e);t.x=void 0,t.s=void 0,Lu(t)}function zd(t){if(Et!==this)throw new Error("Out-of-order effect");Ru(this),Et=t,this.f&=-2,8&this.f&&oa(this),sa()}function Zn(t){this.x=t,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}Zn.prototype.c=function(){var t=this.S();try{if(8&this.f||this.x===void 0)return;var e=this.x();typeof e=="function"&&(this.u=e)}finally{t()}};Zn.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Lu(this),Pu(this),Gr++;var t=Et;return Et=this,zd.bind(this,t)};Zn.prototype.N=function(){2&this.f||(this.f|=2,this.o=Bn,Bn=this)};Zn.prototype.d=function(){this.f|=8,1&this.f||oa(this)};function ze(t){var e=new Zn(t);try{e.c()}catch(r){throw e.d(),r}return e.d.bind(e)}var aa,Ps;function un(t,e){gt[t]=e.bind(null,gt[t]||function(){})}function $i(t){Ps&&Ps(),Ps=t&&t.S()}function Uu(t){var e=this,r=t.data,n=Kd(r);n.value=r;var i=Au(function(){for(var s=e.__v;s=s.__;)if(s.__c){s.__c.__$f|=4;break}return e.__$u.c=function(){var o,a=e.__$u.S(),l=i.value;a(),wu(l)||((o=e.base)==null?void 0:o.nodeType)!==3?(e.__$f|=1,e.setState({})):e.base.data=l},qd(function(){var o=n.value.value;return o===0?0:o===!0?"":o||""})},[]);return i.value}Uu.displayName="_st";Object.defineProperties(Gt.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:Uu},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}});un("__b",function(t,e){if(typeof e.type=="string"){var r,n=e.props;for(var i in n)if(i!=="children"){var s=n[i];s instanceof Gt&&(r||(e.__np=r={}),r[i]=s,n[i]=s.peek())}}t(e)});un("__r",function(t,e){$i();var r,n=e.__c;n&&(n.__$f&=-2,(r=n.__$u)===void 0&&(n.__$u=r=function(i){var s;return ze(function(){s=this}),s.c=function(){n.__$f|=1,n.setState({})},s}())),aa=n,$i(r),t(e)});un("__e",function(t,e,r,n){$i(),aa=void 0,t(e,r,n)});un("diffed",function(t,e){$i(),aa=void 0;var r;if(typeof e.type=="string"&&(r=e.__e)){var n=e.__np,i=e.props;if(n){var s=r.U;if(s)for(var o in s){var a=s[o];a!==void 0&&!(o in n)&&(a.d(),s[o]=void 0)}else r.U=s={};for(var l in n){var h=s[l],g=n[l];h===void 0?(h=Yd(r,l,g,i),s[l]=h):h.o(g,i)}}}t(e)});function Yd(t,e,r,n){var i=e in t&&t.ownerSVGElement===void 0,s=Ir(r);return{o:function(o,a){s.value=o,n=a},d:ze(function(){var o=s.value.value;n[e]!==o&&(n[e]=o,i?t[e]=o:o?t.setAttribute(e,o):t.removeAttribute(e))})}}un("unmount",function(t,e){if(typeof e.type=="string"){var r=e.__e;if(r){var n=r.U;if(n){r.U=void 0;for(var i in n){var s=n[i];s&&s.d()}}}}else{var o=e.__c;if(o){var a=o.__$u;a&&(o.__$u=void 0,a.d())}}t(e)});un("__h",function(t,e,r,n){(n<3||n===9)&&(e.__$f|=2),t(e,r,n)});br.prototype.shouldComponentUpdate=function(t,e){var r=this.__$u,n=r&&r.s!==void 0;for(var i in e)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){if(!(n||2&this.__$f||4&this.__$f)||1&this.__$f)return!0}else if(!(n||4&this.__$f)||3&this.__$f)return!0;for(var s in t)if(s!=="__source"&&t[s]!==this.props[s])return!0;for(var o in this.props)if(!(o in t))return!0;return!1};function Kd(t){return Au(function(){return Ir(t)},[])}var Jd=Object.prototype.toString,hn=Array.isArray||function(t){return Jd.call(t)==="[object Array]"};function ca(t){return typeof t=="function"}function Qd(t){return hn(t)?"array":typeof t}function Rs(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Uc(t,e){return t!=null&&typeof t=="object"&&e in t}function Zd(t,e){return t!=null&&typeof t!="object"&&t.hasOwnProperty&&t.hasOwnProperty(e)}var Xd=RegExp.prototype.test;function tf(t,e){return Xd.call(t,e)}var ef=/\S/;function rf(t){return!tf(ef,t)}var nf={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};function sf(t){return String(t).replace(/[&<>"'`=\/]/g,function(e){return nf[e]})}var of=/\s*/,af=/\s+/,Mc=/\s*=/,cf=/\s*\}/,lf=/#|\^|\/|>|\{|&|=|!/;function uf(t,e){if(!t)return[];var r=!1,n=[],i=[],s=[],o=!1,a=!1,l="",h=0;function g(){if(o&&!a)for(;s.length;)delete i[s.pop()];else s=[];o=!1,a=!1}var p,_,w;function b(H){if(typeof H=="string"&&(H=H.split(af,2)),!hn(H)||H.length!==2)throw new Error("Invalid tags: "+H);p=new RegExp(Rs(H[0])+"\\s*"),_=new RegExp("\\s*"+Rs(H[1])),w=new RegExp("\\s*"+Rs("}"+H[1]))}b(e||me.tags);for(var E=new Xn(t),P,A,M,z,B,Z;!E.eos();){if(P=E.pos,M=E.scanUntil(p),M)for(var bt=0,It=M.length;bt<It;++bt)z=M.charAt(bt),rf(z)?(s.push(i.length),l+=z):(a=!0,r=!0,l+=" "),i.push(["text",z,P,P+1]),P+=1,z===`
|
|
17
|
-
`&&(g(),l="",h=0,r=!1);if(!E.scan(p))break;if(o=!0,A=E.scan(lf)||"name",E.scan(of),A==="="?(M=E.scanUntil(
|
|
16
|
+
Cooee SDK: v${q.SDK_VERSION}`,console.group("%c Elevate your ecommerce experience with Cooee \u{1F680} ",t),console.log(`%c${e}`,"font-size: 13px; line-height: 1.8;"),console.groupEnd()}var kd=dt(du()),se=class{gaEnabled;gaMeasurementID;pixelPush;website;currencyCount;money;storefrontToken;skipItemAttribute;currency;static get(){return window.CooeeSDK.config}update(t){return t??={},this.gaEnabled=t.gaEnabled,this.gaMeasurementID=t.gaMeasurementID,this.pixelPush=t.pixelPush,this.website=t.website??{},this.currencyCount=t.currencyCount??0,this.money=t.money,this.currency=t.currency,this.storefrontToken=t.storefrontToken,this.skipItemAttribute=t.skipItemAttribute,this}},Xt=dt(lr()),Ke=dt(ta()),Os=dt(gu()),rs,gt,wu,bu,yr,Ic,_u,lo,Eu,ea,uo,ho,Rd,Hn={},Su=[],Ld=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,ra=Array.isArray;function nr(t,e){for(var r in e)t[r]=e[r];return t}function na(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function Iu(t,e,r){var n,i,s,o={};for(s in e)s=="key"?n=e[s]:s=="ref"?i=e[s]:o[s]=e[s];if(arguments.length>2&&(o.children=arguments.length>3?rs.call(arguments,2):r),typeof t=="function"&&t.defaultProps!=null)for(s in t.defaultProps)o[s]===void 0&&(o[s]=t.defaultProps[s]);return Oi(t,o,n,i,null)}function Oi(t,e,r,n,i){var s={type:t,props:e,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++wu,__i:-1,__u:0};return i==null&>.vnode!=null&>.vnode(s),s}function cn(t){return t.children}function br(t,e){this.props=t,this.context=e}function Qr(t,e){if(e==null)return t.__?Qr(t.__,t.__i+1):null;for(var r;e<t.__k.length;e++)if((r=t.__k[e])!=null&&r.__e!=null)return r.__e;return typeof t.type=="function"?Qr(t):null}function Cu(t){var e,r;if((t=t.__)!=null&&t.__c!=null){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if((r=t.__k[e])!=null&&r.__e!=null){t.__e=t.__c.base=r.__e;break}return Cu(t)}}function Cc(t){(!t.__d&&(t.__d=!0)&&yr.push(t)&&!Bi.__r++||Ic!==gt.debounceRendering)&&((Ic=gt.debounceRendering)||_u)(Bi)}function Bi(){var t,e,r,n,i,s,o,a;for(yr.sort(lo);t=yr.shift();)t.__d&&(e=yr.length,n=void 0,s=(i=(r=t).__v).__e,o=[],a=[],r.__P&&((n=nr({},i)).__v=i.__v+1,gt.vnode&>.vnode(n),ia(r.__P,n,i,r.__n,r.__P.namespaceURI,32&i.__u?[s]:null,o,s??Qr(i),!!(32&i.__u),a),n.__v=i.__v,n.__.__k[n.__i]=n,Du(o,n,a),n.__e!=s&&Cu(n)),yr.length>e&&yr.sort(lo));Bi.__r=0}function Tu(t,e,r,n,i,s,o,a,l,h,g){var p,_,w,b,E,k,A=n&&n.__k||Su,M=e.length;for(l=Ud(r,e,A,l,M),p=0;p<M;p++)(w=r.__k[p])!=null&&(_=w.__i===-1?Hn:A[w.__i]||Hn,w.__i=p,k=ia(t,w,_,i,s,o,a,l,h,g),b=w.__e,w.ref&&_.ref!=w.ref&&(_.ref&&sa(_.ref,null,w),g.push(w.ref,w.__c||b,w)),E==null&&b!=null&&(E=b),4&w.__u||_.__k===w.__k?l=xu(w,l,t):typeof w.type=="function"&&k!==void 0?l=k:b&&(l=b.nextSibling),w.__u&=-7);return r.__e=E,l}function Ud(t,e,r,n,i){var s,o,a,l,h,g=r.length,p=g,_=0;for(t.__k=new Array(i),s=0;s<i;s++)(o=e[s])!=null&&typeof o!="boolean"&&typeof o!="function"?(l=s+_,(o=t.__k[s]=typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?Oi(null,o,null,null,null):ra(o)?Oi(cn,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?Oi(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=t,o.__b=t.__b+1,a=null,(h=o.__i=Md(o,r,l,p))!==-1&&(p--,(a=r[h])&&(a.__u|=2)),a==null||a.__v===null?(h==-1&&_--,typeof o.type!="function"&&(o.__u|=4)):h!=l&&(h==l-1?_--:h==l+1?_++:(h>l?_--:_++,o.__u|=4))):t.__k[s]=null;if(p)for(s=0;s<g;s++)(a=r[s])!=null&&(2&a.__u)==0&&(a.__e==n&&(n=Qr(a)),Nu(a,a));return n}function xu(t,e,r){var n,i;if(typeof t.type=="function"){for(n=t.__k,i=0;n&&i<n.length;i++)n[i]&&(n[i].__=t,e=xu(n[i],e,r));return e}t.__e!=e&&(e&&t.type&&!r.contains(e)&&(e=Qr(t)),r.insertBefore(t.__e,e||null),e=t.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function Md(t,e,r,n){var i,s,o=t.key,a=t.type,l=e[r];if(l===null||l&&o==l.key&&a===l.type&&(2&l.__u)==0)return r;if(n>(l!=null&&(2&l.__u)==0?1:0))for(i=r-1,s=r+1;i>=0||s<e.length;){if(i>=0){if((l=e[i])&&(2&l.__u)==0&&o==l.key&&a===l.type)return i;i--}if(s<e.length){if((l=e[s])&&(2&l.__u)==0&&o==l.key&&a===l.type)return s;s++}}return-1}function Tc(t,e,r){e[0]=="-"?t.setProperty(e,r??""):t[e]=r==null?"":typeof r!="number"||Ld.test(e)?r:r+"px"}function gi(t,e,r,n,i){var s;t:if(e=="style")if(typeof r=="string")t.style.cssText=r;else{if(typeof n=="string"&&(t.style.cssText=n=""),n)for(e in n)r&&e in r||Tc(t.style,e,"");if(r)for(e in r)n&&r[e]===n[e]||Tc(t.style,e,r[e])}else if(e[0]=="o"&&e[1]=="n")s=e!=(e=e.replace(Eu,"$1")),e=e.toLowerCase()in t||e=="onFocusOut"||e=="onFocusIn"?e.toLowerCase().slice(2):e.slice(2),t.l||(t.l={}),t.l[e+s]=r,r?n?r.u=n.u:(r.u=ea,t.addEventListener(e,s?ho:uo,s)):t.removeEventListener(e,s?ho:uo,s);else{if(i=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in t)try{t[e]=r??"";break t}catch{}typeof r=="function"||(r==null||r===!1&&e[4]!="-"?t.removeAttribute(e):t.setAttribute(e,e=="popover"&&r==1?"":r))}}function xc(t){return function(e){if(this.l){var r=this.l[e.type+t];if(e.t==null)e.t=ea++;else if(e.t<r.u)return;return r(gt.event?gt.event(e):e)}}}function ia(t,e,r,n,i,s,o,a,l,h){var g,p,_,w,b,E,k,A,M,z,B,X,bt,It,H,rt,Z,tt=e.type;if(e.constructor!==void 0)return null;128&r.__u&&(l=!!(32&r.__u),s=[a=e.__e=r.__e]),(g=gt.__b)&&g(e);t:if(typeof tt=="function")try{if(A=e.props,M="prototype"in tt&&tt.prototype.render,z=(g=tt.contextType)&&n[g.__c],B=g?z?z.props.value:g.__:n,r.__c?k=(p=e.__c=r.__c).__=p.__E:(M?e.__c=p=new tt(A,B):(e.__c=p=new br(A,B),p.constructor=tt,p.render=jd),z&&z.sub(p),p.props=A,p.state||(p.state={}),p.context=B,p.__n=n,_=p.__d=!0,p.__h=[],p._sb=[]),M&&p.__s==null&&(p.__s=p.state),M&&tt.getDerivedStateFromProps!=null&&(p.__s==p.state&&(p.__s=nr({},p.__s)),nr(p.__s,tt.getDerivedStateFromProps(A,p.__s))),w=p.props,b=p.state,p.__v=e,_)M&&tt.getDerivedStateFromProps==null&&p.componentWillMount!=null&&p.componentWillMount(),M&&p.componentDidMount!=null&&p.__h.push(p.componentDidMount);else{if(M&&tt.getDerivedStateFromProps==null&&A!==w&&p.componentWillReceiveProps!=null&&p.componentWillReceiveProps(A,B),!p.__e&&(p.shouldComponentUpdate!=null&&p.shouldComponentUpdate(A,p.__s,B)===!1||e.__v==r.__v)){for(e.__v!=r.__v&&(p.props=A,p.state=p.__s,p.__d=!1),e.__e=r.__e,e.__k=r.__k,e.__k.some(function(ct){ct&&(ct.__=e)}),X=0;X<p._sb.length;X++)p.__h.push(p._sb[X]);p._sb=[],p.__h.length&&o.push(p);break t}p.componentWillUpdate!=null&&p.componentWillUpdate(A,p.__s,B),M&&p.componentDidUpdate!=null&&p.__h.push(function(){p.componentDidUpdate(w,b,E)})}if(p.context=B,p.props=A,p.__P=t,p.__e=!1,bt=gt.__r,It=0,M){for(p.state=p.__s,p.__d=!1,bt&&bt(e),g=p.render(p.props,p.state,p.context),H=0;H<p._sb.length;H++)p.__h.push(p._sb[H]);p._sb=[]}else do p.__d=!1,bt&&bt(e),g=p.render(p.props,p.state,p.context),p.state=p.__s;while(p.__d&&++It<25);p.state=p.__s,p.getChildContext!=null&&(n=nr(nr({},n),p.getChildContext())),M&&!_&&p.getSnapshotBeforeUpdate!=null&&(E=p.getSnapshotBeforeUpdate(w,b)),a=Tu(t,ra(rt=g!=null&&g.type===cn&&g.key==null?g.props.children:g)?rt:[rt],e,r,n,i,s,o,a,l,h),p.base=e.__e,e.__u&=-161,p.__h.length&&o.push(p),k&&(p.__E=p.__=null)}catch(ct){if(e.__v=null,l||s!=null)if(ct.then){for(e.__u|=l?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;s[s.indexOf(a)]=null,e.__e=a}else for(Z=s.length;Z--;)na(s[Z]);else e.__e=r.__e,e.__k=r.__k;gt.__e(ct,e,r)}else s==null&&e.__v==r.__v?(e.__k=r.__k,e.__e=r.__e):a=e.__e=Bd(r.__e,e,r,n,i,s,o,l,h);return(g=gt.diffed)&&g(e),128&e.__u?void 0:a}function Du(t,e,r){for(var n=0;n<r.length;n++)sa(r[n],r[++n],r[++n]);gt.__c&>.__c(e,t),t.some(function(i){try{t=i.__h,i.__h=[],t.some(function(s){s.call(i)})}catch(s){gt.__e(s,i.__v)}})}function Bd(t,e,r,n,i,s,o,a,l){var h,g,p,_,w,b,E,k=r.props,A=e.props,M=e.type;if(M=="svg"?i="http://www.w3.org/2000/svg":M=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),s!=null){for(h=0;h<s.length;h++)if((w=s[h])&&"setAttribute"in w==!!M&&(M?w.localName==M:w.nodeType==3)){t=w,s[h]=null;break}}if(t==null){if(M==null)return document.createTextNode(A);t=document.createElementNS(i,M,A.is&&A),a&&(gt.__m&>.__m(e,s),a=!1),s=null}if(M===null)k===A||a&&t.data===A||(t.data=A);else{if(s=s&&rs.call(t.childNodes),k=r.props||Hn,!a&&s!=null)for(k={},h=0;h<t.attributes.length;h++)k[(w=t.attributes[h]).name]=w.value;for(h in k)if(w=k[h],h!="children"){if(h=="dangerouslySetInnerHTML")p=w;else if(!(h in A)){if(h=="value"&&"defaultValue"in A||h=="checked"&&"defaultChecked"in A)continue;gi(t,h,null,w,i)}}for(h in A)w=A[h],h=="children"?_=w:h=="dangerouslySetInnerHTML"?g=w:h=="value"?b=w:h=="checked"?E=w:a&&typeof w!="function"||k[h]===w||gi(t,h,w,k[h],i);if(g)a||p&&(g.__html===p.__html||g.__html===t.innerHTML)||(t.innerHTML=g.__html),e.__k=[];else if(p&&(t.innerHTML=""),Tu(t,ra(_)?_:[_],e,r,n,M=="foreignObject"?"http://www.w3.org/1999/xhtml":i,s,o,s?s[0]:r.__k&&Qr(r,0),a,l),s!=null)for(h=s.length;h--;)na(s[h]);a||(h="value",M=="progress"&&b==null?t.removeAttribute("value"):b!==void 0&&(b!==t[h]||M=="progress"&&!b||M=="option"&&b!==k[h])&&gi(t,h,b,k[h],i),h="checked",E!==void 0&&E!==t[h]&&gi(t,h,E,k[h],i))}return t}function sa(t,e,r){try{if(typeof t=="function"){var n=typeof t.__u=="function";n&&t.__u(),n&&e==null||(t.__u=t(e))}else t.current=e}catch(i){gt.__e(i,r)}}function Nu(t,e,r){var n,i;if(gt.unmount&>.unmount(t),(n=t.ref)&&(n.current&&n.current!==t.__e||sa(n,null,e)),(n=t.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(s){gt.__e(s,e)}n.base=n.__P=null}if(n=t.__k)for(i=0;i<n.length;i++)n[i]&&Nu(n[i],e,r||typeof t.type!="function");r||na(t.__e),t.__c=t.__=t.__e=void 0}function jd(t,e,r){return this.constructor(t,r)}function $d(t,e,r){var n,i,s,o;e==document&&(e=document.documentElement),gt.__&>.__(t,e),i=(n=typeof r=="function")?null:r&&r.__k||e.__k,s=[],o=[],ia(e,t=(!n&&r||e).__k=Iu(cn,null,[t]),i||Hn,Hn,e.namespaceURI,!n&&r?[r]:i?null:e.firstChild?rs.call(e.childNodes):null,s,!n&&r?r:i?i.__e:e.firstChild,n,o),Du(s,t,o)}rs=Su.slice,gt={__e:function(t,e,r,n){for(var i,s,o;e=e.__;)if((i=e.__c)&&!i.__)try{if((s=i.constructor)&&s.getDerivedStateFromError!=null&&(i.setState(s.getDerivedStateFromError(t)),o=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(t,n||{}),o=i.__d),o)return i.__E=i}catch(a){t=a}throw t}},wu=0,bu=function(t){return t!=null&&t.constructor==null},br.prototype.setState=function(t,e){var r;r=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=nr({},this.state),typeof t=="function"&&(t=t(nr({},r),this.props)),t&&nr(r,t),t!=null&&this.__v&&(e&&this._sb.push(e),Cc(this))},br.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),Cc(this))},br.prototype.render=cn,yr=[],_u=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,lo=function(t,e){return t.__v.__b-e.__v.__b},Bi.__r=0,Eu=/(PointerCapture)$|Capture$/i,ea=0,uo=xc(!1),ho=xc(!0),Rd=0;var po,ne,Ps,Dc,Nc=0,Au=[],Mt=gt,Ac=Mt.__b,Oc=Mt.__r,Pc=Mt.diffed,kc=Mt.__c,Rc=Mt.unmount,Lc=Mt.__;function Fd(t,e){Mt.__h&&Mt.__h(ne,t,Nc||e),Nc=0;var r=ne.__H||(ne.__H={__:[],__h:[]});return t>=r.__.length&&r.__.push({}),r.__[t]}function Ou(t,e){var r=Fd(po++,7);return Wd(r.__H,e)&&(r.__=t(),r.__H=e,r.__h=t),r.__}function Hd(){for(var t;t=Au.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(Pi),t.__H.__h.forEach(fo),t.__H.__h=[]}catch(e){t.__H.__h=[],Mt.__e(e,t.__v)}}Mt.__b=function(t){ne=null,Ac&&Ac(t)},Mt.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),Lc&&Lc(t,e)},Mt.__r=function(t){Oc&&Oc(t),po=0;var e=(ne=t.__c).__H;e&&(Ps===ne?(e.__h=[],ne.__h=[],e.__.forEach(function(r){r.__N&&(r.__=r.__N),r.i=r.__N=void 0})):(e.__h.forEach(Pi),e.__h.forEach(fo),e.__h=[],po=0)),Ps=ne},Mt.diffed=function(t){Pc&&Pc(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(Au.push(e)!==1&&Dc===Mt.requestAnimationFrame||((Dc=Mt.requestAnimationFrame)||Vd)(Hd)),e.__H.__.forEach(function(r){r.i&&(r.__H=r.i),r.i=void 0})),Ps=ne=null},Mt.__c=function(t,e){e.some(function(r){try{r.__h.forEach(Pi),r.__h=r.__h.filter(function(n){return!n.__||fo(n)})}catch(n){e.some(function(i){i.__h&&(i.__h=[])}),e=[],Mt.__e(n,r.__v)}}),kc&&kc(t,e)},Mt.unmount=function(t){Rc&&Rc(t);var e,r=t.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{Pi(n)}catch(i){e=i}}),r.__H=void 0,e&&Mt.__e(e,r.__v))};var Uc=typeof requestAnimationFrame=="function";function Vd(t){var e,r=function(){clearTimeout(n),Uc&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(r,100);Uc&&(e=requestAnimationFrame(r))}function Pi(t){var e=ne,r=t.__c;typeof r=="function"&&(t.__c=void 0,r()),ne=e}function fo(t){var e=ne;t.__c=t.__(),ne=e}function Wd(t,e){return!t||t.length!==e.length||e.some(function(r,n){return r!==t[n]})}var Gd=Symbol.for("preact-signals");function oa(){if(Gr>1)Gr--;else{for(var t,e=!1;Bn!==void 0;){var r=Bn;for(Bn=void 0,go++;r!==void 0;){var n=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&ku(r))try{r.c()}catch(i){e||(t=i,e=!0)}r=n}}if(go=0,Gr--,e)throw t}}var Et=void 0,Bn=void 0,Gr=0,go=0,ji=0;function Pu(t){if(Et!==void 0){var e=t.n;if(e===void 0||e.t!==Et)return e={i:0,S:t,p:Et.s,n:void 0,t:Et,e:void 0,x:void 0,r:e},Et.s!==void 0&&(Et.s.n=e),Et.s=e,t.n=e,32&Et.f&&t.S(e),e;if(e.i===-1)return e.i=0,e.n!==void 0&&(e.n.p=e.p,e.p!==void 0&&(e.p.n=e.n),e.p=Et.s,e.n=void 0,Et.s.n=e,Et.s=e),e}}function Gt(t){this.v=t,this.i=0,this.n=void 0,this.t=void 0}Gt.prototype.brand=Gd;Gt.prototype.h=function(){return!0};Gt.prototype.S=function(t){this.t!==t&&t.e===void 0&&(t.x=this.t,this.t!==void 0&&(this.t.e=t),this.t=t)};Gt.prototype.U=function(t){if(this.t!==void 0){var e=t.e,r=t.x;e!==void 0&&(e.x=r,t.e=void 0),r!==void 0&&(r.e=e,t.x=void 0),t===this.t&&(this.t=r)}};Gt.prototype.subscribe=function(t){var e=this;return ze(function(){var r=e.value,n=Et;Et=void 0;try{t(r)}finally{Et=n}})};Gt.prototype.valueOf=function(){return this.value};Gt.prototype.toString=function(){return this.value+""};Gt.prototype.toJSON=function(){return this.value};Gt.prototype.peek=function(){var t=Et;Et=void 0;try{return this.value}finally{Et=t}};Object.defineProperty(Gt.prototype,"value",{get:function(){var t=Pu(this);return t!==void 0&&(t.i=this.i),this.v},set:function(t){if(t!==this.v){if(go>100)throw new Error("Cycle detected");this.v=t,this.i++,ji++,Gr++;try{for(var e=this.t;e!==void 0;e=e.x)e.t.N()}finally{oa()}}}});function Ir(t){return new Gt(t)}function ku(t){for(var e=t.s;e!==void 0;e=e.n)if(e.S.i!==e.i||!e.S.h()||e.S.i!==e.i)return!0;return!1}function Ru(t){for(var e=t.s;e!==void 0;e=e.n){var r=e.S.n;if(r!==void 0&&(e.r=r),e.S.n=e,e.i=-1,e.n===void 0){t.s=e;break}}}function Lu(t){for(var e=t.s,r=void 0;e!==void 0;){var n=e.p;e.i===-1?(e.S.U(e),n!==void 0&&(n.n=e.n),e.n!==void 0&&(e.n.p=n)):r=e,e.S.n=e.r,e.r!==void 0&&(e.r=void 0),e=n}t.s=r}function ln(t){Gt.call(this,void 0),this.x=t,this.s=void 0,this.g=ji-1,this.f=4}(ln.prototype=new Gt).h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===ji))return!0;if(this.g=ji,this.f|=1,this.i>0&&!ku(this))return this.f&=-2,!0;var t=Et;try{Ru(this),Et=this;var e=this.x();(16&this.f||this.v!==e||this.i===0)&&(this.v=e,this.f&=-17,this.i++)}catch(r){this.v=r,this.f|=16,this.i++}return Et=t,Lu(this),this.f&=-2,!0};ln.prototype.S=function(t){if(this.t===void 0){this.f|=36;for(var e=this.s;e!==void 0;e=e.n)e.S.S(e)}Gt.prototype.S.call(this,t)};ln.prototype.U=function(t){if(this.t!==void 0&&(Gt.prototype.U.call(this,t),this.t===void 0)){this.f&=-33;for(var e=this.s;e!==void 0;e=e.n)e.S.U(e)}};ln.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var t=this.t;t!==void 0;t=t.x)t.t.N()}};Object.defineProperty(ln.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var t=Pu(this);if(this.h(),t!==void 0&&(t.i=this.i),16&this.f)throw this.v;return this.v}});function qd(t){return new ln(t)}function Uu(t){var e=t.u;if(t.u=void 0,typeof e=="function"){Gr++;var r=Et;Et=void 0;try{e()}catch(n){throw t.f&=-2,t.f|=8,aa(t),n}finally{Et=r,oa()}}}function aa(t){for(var e=t.s;e!==void 0;e=e.n)e.S.U(e);t.x=void 0,t.s=void 0,Uu(t)}function zd(t){if(Et!==this)throw new Error("Out-of-order effect");Lu(this),Et=t,this.f&=-2,8&this.f&&aa(this),oa()}function Xn(t){this.x=t,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}Xn.prototype.c=function(){var t=this.S();try{if(8&this.f||this.x===void 0)return;var e=this.x();typeof e=="function"&&(this.u=e)}finally{t()}};Xn.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Uu(this),Ru(this),Gr++;var t=Et;return Et=this,zd.bind(this,t)};Xn.prototype.N=function(){2&this.f||(this.f|=2,this.o=Bn,Bn=this)};Xn.prototype.d=function(){this.f|=8,1&this.f||aa(this)};function ze(t){var e=new Xn(t);try{e.c()}catch(r){throw e.d(),r}return e.d.bind(e)}var ca,ks;function un(t,e){gt[t]=e.bind(null,gt[t]||function(){})}function $i(t){ks&&ks(),ks=t&&t.S()}function Mu(t){var e=this,r=t.data,n=Kd(r);n.value=r;var i=Ou(function(){for(var s=e.__v;s=s.__;)if(s.__c){s.__c.__$f|=4;break}return e.__$u.c=function(){var o,a=e.__$u.S(),l=i.value;a(),bu(l)||((o=e.base)==null?void 0:o.nodeType)!==3?(e.__$f|=1,e.setState({})):e.base.data=l},qd(function(){var o=n.value.value;return o===0?0:o===!0?"":o||""})},[]);return i.value}Mu.displayName="_st";Object.defineProperties(Gt.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:Mu},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}});un("__b",function(t,e){if(typeof e.type=="string"){var r,n=e.props;for(var i in n)if(i!=="children"){var s=n[i];s instanceof Gt&&(r||(e.__np=r={}),r[i]=s,n[i]=s.peek())}}t(e)});un("__r",function(t,e){$i();var r,n=e.__c;n&&(n.__$f&=-2,(r=n.__$u)===void 0&&(n.__$u=r=function(i){var s;return ze(function(){s=this}),s.c=function(){n.__$f|=1,n.setState({})},s}())),ca=n,$i(r),t(e)});un("__e",function(t,e,r,n){$i(),ca=void 0,t(e,r,n)});un("diffed",function(t,e){$i(),ca=void 0;var r;if(typeof e.type=="string"&&(r=e.__e)){var n=e.__np,i=e.props;if(n){var s=r.U;if(s)for(var o in s){var a=s[o];a!==void 0&&!(o in n)&&(a.d(),s[o]=void 0)}else r.U=s={};for(var l in n){var h=s[l],g=n[l];h===void 0?(h=Yd(r,l,g,i),s[l]=h):h.o(g,i)}}}t(e)});function Yd(t,e,r,n){var i=e in t&&t.ownerSVGElement===void 0,s=Ir(r);return{o:function(o,a){s.value=o,n=a},d:ze(function(){var o=s.value.value;n[e]!==o&&(n[e]=o,i?t[e]=o:o?t.setAttribute(e,o):t.removeAttribute(e))})}}un("unmount",function(t,e){if(typeof e.type=="string"){var r=e.__e;if(r){var n=r.U;if(n){r.U=void 0;for(var i in n){var s=n[i];s&&s.d()}}}}else{var o=e.__c;if(o){var a=o.__$u;a&&(o.__$u=void 0,a.d())}}t(e)});un("__h",function(t,e,r,n){(n<3||n===9)&&(e.__$f|=2),t(e,r,n)});br.prototype.shouldComponentUpdate=function(t,e){var r=this.__$u,n=r&&r.s!==void 0;for(var i in e)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){if(!(n||2&this.__$f||4&this.__$f)||1&this.__$f)return!0}else if(!(n||4&this.__$f)||3&this.__$f)return!0;for(var s in t)if(s!=="__source"&&t[s]!==this.props[s])return!0;for(var o in this.props)if(!(o in t))return!0;return!1};function Kd(t){return Ou(function(){return Ir(t)},[])}var Jd=Object.prototype.toString,hn=Array.isArray||function(t){return Jd.call(t)==="[object Array]"};function la(t){return typeof t=="function"}function Qd(t){return hn(t)?"array":typeof t}function Rs(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Mc(t,e){return t!=null&&typeof t=="object"&&e in t}function Xd(t,e){return t!=null&&typeof t!="object"&&t.hasOwnProperty&&t.hasOwnProperty(e)}var Zd=RegExp.prototype.test;function tf(t,e){return Zd.call(t,e)}var ef=/\S/;function rf(t){return!tf(ef,t)}var nf={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};function sf(t){return String(t).replace(/[&<>"'`=\/]/g,function(e){return nf[e]})}var of=/\s*/,af=/\s+/,Bc=/\s*=/,cf=/\s*\}/,lf=/#|\^|\/|>|\{|&|=|!/;function uf(t,e){if(!t)return[];var r=!1,n=[],i=[],s=[],o=!1,a=!1,l="",h=0;function g(){if(o&&!a)for(;s.length;)delete i[s.pop()];else s=[];o=!1,a=!1}var p,_,w;function b(H){if(typeof H=="string"&&(H=H.split(af,2)),!hn(H)||H.length!==2)throw new Error("Invalid tags: "+H);p=new RegExp(Rs(H[0])+"\\s*"),_=new RegExp("\\s*"+Rs(H[1])),w=new RegExp("\\s*"+Rs("}"+H[1]))}b(e||ge.tags);for(var E=new Zn(t),k,A,M,z,B,X;!E.eos();){if(k=E.pos,M=E.scanUntil(p),M)for(var bt=0,It=M.length;bt<It;++bt)z=M.charAt(bt),rf(z)?(s.push(i.length),l+=z):(a=!0,r=!0,l+=" "),i.push(["text",z,k,k+1]),k+=1,z===`
|
|
17
|
+
`&&(g(),l="",h=0,r=!1);if(!E.scan(p))break;if(o=!0,A=E.scan(lf)||"name",E.scan(of),A==="="?(M=E.scanUntil(Bc),E.scan(Bc),E.scanUntil(_)):A==="{"?(M=E.scanUntil(w),E.scan(cf),E.scanUntil(_),A="&"):M=E.scanUntil(_),!E.scan(_))throw new Error("Unclosed tag at "+E.pos);if(A==">"?B=[A,M,k,E.pos,l,h,r]:B=[A,M,k,E.pos],h++,i.push(B),A==="#"||A==="^")n.push(B);else if(A==="/"){if(X=n.pop(),!X)throw new Error('Unopened section "'+M+'" at '+k);if(X[1]!==M)throw new Error('Unclosed section "'+X[1]+'" at '+k)}else A==="name"||A==="{"||A==="&"?a=!0:A==="="&&b(M)}if(g(),X=n.pop(),X)throw new Error('Unclosed section "'+X[1]+'" at '+E.pos);return pf(hf(i))}function hf(t){for(var e=[],r,n,i=0,s=t.length;i<s;++i)r=t[i],r&&(r[0]==="text"&&n&&n[0]==="text"?(n[1]+=r[1],n[3]=r[3]):(e.push(r),n=r));return e}function pf(t){for(var e=[],r=e,n=[],i,s,o=0,a=t.length;o<a;++o)switch(i=t[o],i[0]){case"#":case"^":r.push(i),n.push(i),r=i[4]=[];break;case"/":s=n.pop(),s[5]=i[2],r=n.length>0?n[n.length-1][4]:e;break;default:r.push(i)}return e}function Zn(t){this.string=t,this.tail=t,this.pos=0}Zn.prototype.eos=function(){return this.tail===""};Zn.prototype.scan=function(t){var e=this.tail.match(t);if(!e||e.index!==0)return"";var r=e[0];return this.tail=this.tail.substring(r.length),this.pos+=r.length,r};Zn.prototype.scanUntil=function(t){var e=this.tail.search(t),r;switch(e){case-1:r=this.tail,this.tail="";break;case 0:r="";break;default:r=this.tail.substring(0,e),this.tail=this.tail.substring(e)}return this.pos+=r.length,r};function Xr(t,e){this.view=t,this.cache={".":this.view},this.parent=e}Xr.prototype.push=function(t){return new Xr(t,this)};Xr.prototype.lookup=function(t){var e=this.cache,r;if(e.hasOwnProperty(t))r=e[t];else{for(var n=this,i,s,o,a=!1;n;){if(t.indexOf(".")>0)for(i=n.view,s=t.split("."),o=0;i!=null&&o<s.length;)o===s.length-1&&(a=Mc(i,s[o])||Xd(i,s[o])),i=i[s[o++]];else i=n.view[t],a=Mc(n.view,t);if(a){r=i;break}n=n.parent}e[t]=r}return la(r)&&(r=r.call(this.view)),r};function Qt(){this.templateCache={_cache:{},set:function(t,e){this._cache[t]=e},get:function(t){return this._cache[t]},clear:function(){this._cache={}}}}Qt.prototype.clearCache=function(){typeof this.templateCache<"u"&&this.templateCache.clear()};Qt.prototype.parse=function(t,e){var r=this.templateCache,n=t+":"+(e||ge.tags).join(":"),i=typeof r<"u",s=i?r.get(n):void 0;return s==null&&(s=uf(t,e),i&&r.set(n,s)),s};Qt.prototype.render=function(t,e,r,n){var i=this.getConfigTags(n),s=this.parse(t,i),o=e instanceof Xr?e:new Xr(e,void 0);return this.renderTokens(s,o,r,t,n)};Qt.prototype.renderTokens=function(t,e,r,n,i){for(var s="",o,a,l,h=0,g=t.length;h<g;++h)l=void 0,o=t[h],a=o[0],a==="#"?l=this.renderSection(o,e,r,n,i):a==="^"?l=this.renderInverted(o,e,r,n,i):a===">"?l=this.renderPartial(o,e,r,i):a==="&"?l=this.unescapedValue(o,e):a==="name"?l=this.escapedValue(o,e,i):a==="text"&&(l=this.rawValue(o)),l!==void 0&&(s+=l);return s};Qt.prototype.renderSection=function(t,e,r,n,i){var s=this,o="",a=e.lookup(t[1]);function l(p){return s.render(p,e,r,i)}if(a){if(hn(a))for(var h=0,g=a.length;h<g;++h)o+=this.renderTokens(t[4],e.push(a[h]),r,n,i);else if(typeof a=="object"||typeof a=="string"||typeof a=="number")o+=this.renderTokens(t[4],e.push(a),r,n,i);else if(la(a)){if(typeof n!="string")throw new Error("Cannot use higher-order sections without the original template");a=a.call(e.view,n.slice(t[3],t[5]),l),a!=null&&(o+=a)}else o+=this.renderTokens(t[4],e,r,n,i);return o}};Qt.prototype.renderInverted=function(t,e,r,n,i){var s=e.lookup(t[1]);if(!s||hn(s)&&s.length===0)return this.renderTokens(t[4],e,r,n,i)};Qt.prototype.indentPartial=function(t,e,r){for(var n=e.replace(/[^ \t]/g,""),i=t.split(`
|
|
18
18
|
`),s=0;s<i.length;s++)i[s].length&&(s>0||!r)&&(i[s]=n+i[s]);return i.join(`
|
|
19
|
-
`)};Qt.prototype.renderPartial=function(t,e,r,n){if(r){var i=this.getConfigTags(n),s=ca(r)?r(t[1]):r[t[1]];if(s!=null){var o=t[6],a=t[5],l=t[4],h=s;a==0&&l&&(h=this.indentPartial(s,l,o));var g=this.parse(h,i);return this.renderTokens(g,e,r,h,n)}}};Qt.prototype.unescapedValue=function(t,e){var r=e.lookup(t[1]);if(r!=null)return r};Qt.prototype.escapedValue=function(t,e,r){var n=this.getConfigEscape(r)||me.escape,i=e.lookup(t[1]);if(i!=null)return typeof i=="number"&&n===me.escape?String(i):n(i)};Qt.prototype.rawValue=function(t){return t[1]};Qt.prototype.getConfigTags=function(t){return hn(t)?t:t&&typeof t=="object"?t.tags:void 0};Qt.prototype.getConfigEscape=function(t){if(t&&typeof t=="object"&&!hn(t))return t.escape};var me={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(t){Vn.templateCache=t},get templateCache(){return Vn.templateCache}},Vn=new Qt;me.clearCache=function(){return Vn.clearCache()};me.parse=function(t,e){return Vn.parse(t,e)};me.render=function(t,e,r,n){if(typeof t!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+Qd(t)+'" was given as the first argument for mustache#render(template, view, partials)');return Vn.render(t,e,r,n)};me.escape=sf;me.Scanner=Xn;me.Context=Zr;me.Writer=Qt;var je=me,Wn=class Pe{static DOCUMENT_STANDARD_MODE="CSS1Compat";static _instance;parentContainer;scalingFactor=1;doc=document;constructor(){}static get(){return Pe._instance||(Pe._instance=new Pe),Pe._instance}getWidth(){return this.parentContainer&&this.parentContainer!==document.body?this.parentContainer.clientWidth:document.compatMode===Pe.DOCUMENT_STANDARD_MODE?document.documentElement.clientWidth:window.innerWidth}getHeight(){return this.isParentNotBody()?this.parentContainer.clientHeight:document.compatMode===Pe.DOCUMENT_STANDARD_MODE?document.documentElement.clientHeight:window.innerHeight}isMobile(){return window.CooeeSDK.uaParser.getDevice().type==="mobile"}calculateScalingFactor(e){let r=e.max,n=e.cont.w,i=e.cont.h,s=e.spc,o=Pe.get().getWidth(),a=Pe.get().getHeight();r&&(o=o?Math.min(o,r):r,a=a?Math.min(a,r):r),a&&(o-=s.getHorizontal(),a-=s.getVertical(),o/a<n/i?this.scalingFactor=o/n:this.scalingFactor=a/i,this.scalingFactor=Math.min(this.scalingFactor,1))}getScalingFactor(){return this.scalingFactor}createElement(e){return this.doc.createElement(e)}appendChild(e,r){e.appendChild(r)}setStyles(e,r){Object.assign(e.style,r)}setStyle(e,r,n){if(r){if(!n){e.style.removeProperty(r);return}e.style.setProperty(r,n,"important")}}setAttribute(e,r,n){e.setAttribute(r,n)}removeInApp(e){let r=document.querySelector(`.${e.rootClassName}`);r&&r.parentElement.removeChild(r)}setParentContainer(e){this.parentContainer=e,this.parentContainer&&this.isParentNotBody()&&this.setStyle(this.parentContainer,"position","relative")}isParentNotBody(){return this.parentContainer!==document.body}},at=class{static ID="id";static SESSION_LANDING_PAGE="landing";static SESSION_LAST_USED_TIME="lastUsedTime";static SESSION_SYNCED="synced";static APP_CONFIG="conf";static DEVICE_ID="did";static SDK_TOKEN="token";static FIRST_SEEN="firstSeen";static SESSION_NUMBER="sessionNumber";static GA_CLIENT_ID="gacid";static CURRENT_CART="cart";static MUTED="muted"},Bc=dt(Dd());function la(t){return Bc.default.createInstance({name:"lc",storeName:t,driver:Bc.default.LOCALSTORAGE})}var ua=class{static storage;static async get(t,e){return await this.storage?.getItem(t)??e}static set(t,e){return this.storage?.setItem(t,e)}static remove(t){return this.storage?.removeItem(t)}static clear(){return this.storage?.clear()}static getForage(){return this.storage}},re=class extends ua{static storeName="ses";static{this.storage=la(this.storeName)}},Ut=class extends ua{static storeName="usr";static{this.storage=la(this.storeName)}},pn=class{id;mID;vID;vName;imageURL;name;link;quantity;price;finalPrice;constructor(t){this.id=t.id,this.mID=t.mID,this.vID=t.vID,this.vName=t.vName,this.imageURL=t.imageURL,this.name=t.name,this.link=t.link,this.quantity=t.quantity,this.price=t.price,this.finalPrice=t.finalPrice??t.price}},Pt=class{isCartDirty=!0;cartEngagements;isGoKwikPopupOpen;previewIDs;previewVariant;pageName;moneyFormat;jsLoadTime=new Date;shopCurrencyCode;locale;activeExperiment;inInactive=!1;lastEnterActive=new Date;lastEnterInactive=null;currentItem;_currencyCode;get currencyCode(){return this._currencyCode}set currencyCode(t){this._currencyCode=t}static get(){return window.CooeeSDK.runtimeData}isInactive(){return this.inInactive}async setInactive(){return this.inInactive?0:(this.inInactive=!0,this.lastEnterInactive=new Date,Math.max((this.lastEnterInactive.getTime()-this.lastEnterActive.getTime())/1e3,0))}setActive(){return this.inInactive?(this.inInactive=!1,this.lastEnterActive=new Date,Math.max((this.lastEnterActive.getTime()-this.lastEnterInactive.getTime())/1e3,0)):0}isFirstActive(){return this.lastEnterInactive==null}getCurrentItem(){return this.currentItem}setCurrentItem(t){this.currentItem=new pn(t)}},df="?from=cooee";function ha(){return!!window.Shopify}function ff(){if(ha())return window.Shopify.shop?.split(".")?.[0]}function gf(t){let e=(t.includes("://")?new URL(t).pathname:t).match(/\/products\/([^/]+?)(?:\.html)?$/);return e?e[1]:null}function Fi(){return window.Shopify?.routes?.root??"/"}function jn(t){return Fi()+t+df}var Mu=class{isLocked=!1;queue=[];async acquire(){if(this.isLocked)await new Promise(t=>this.queue.push(t));else{this.isLocked=!0;return}}release(){if(this.queue.length>0){let t=this.queue.shift();t&&t()}else this.isLocked=!1}},Ot=class Bu{static CURRENT;token;items;total_price;original_total_price;currency;item_count;attributes;cart_level_discount_applications;lock=new Mu;constructor(){}static getCurrent(){return this.CURRENT||(this.CURRENT=new Bu),this.CURRENT}async getNormalisedCart(e){await this.fetchCartFromShopify(e);let r=this.convertToCooeeCart();return e&&await Ut.set(at.CURRENT_CART,r),r}async addCooeeAttributes(){await this.lock.acquire();let e=await re.get(at.ID),r=await Ut.get(at.DEVICE_ID);if(this.attributes?.letscooee_did===r&&this.attributes?.letscooee_sid===e){x.debug("Not calling Shopify update.js API.","Current attributes:",this.attributes),this.lock.release();return}let n={letscooee_did:r,letscooee_sid:e,__letscooee_time:new Date().toLocaleString()};x.debug("Updating Shopify cart with attributes:",n);let i=jn("cart/update.js"),s=await(await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({attributes:n})})).json();x.debug("Updated cart attributes",JSON.stringify(s)),this.update(s),this.lock.release()}update(e){return this.token=e.token,this.items=e.items,this.total_price=e.total_price,this.original_total_price=e.original_total_price,this.currency=e.currency,this.item_count=e.item_count,this.attributes=e.attributes,this.cart_level_discount_applications=e.cart_level_discount_applications,Pt.get().currencyCode=this.currency,x.log("Updated ShopifyCart",this),this}toString(){return`ShopifyCart(token: ${this.token}, itemCount: ${this.item_count})`}convertToCooeeCart(){return{amount:this.total_price/100,originalAmount:this.original_total_price/100,currency:this.currency,itemCount:this.item_count,items:this.normaliseItems(this.items),token:this.token}}normaliseItems(e){if(!e)return x.error("No item received to be sent"),[];Array.isArray(e)||(e=[e]);let r=[];for(let n of e){if(!n.id||!n.title){x.warn("Invalid item received",n);continue}let i={name:n.title,quantity:+n.quantity||1,mID:n.product_id?.toString(),vID:n.id.toString(),price:+n.price/100||0,finalPrice:+n.final_price/100||0,properties:n.properties,key:n.key},s=n.selling_plan_allocation?.selling_plan;if(!s){r.push(i);continue}i.sellingPlanAllocation={sellingPlan:{fixedSellingPlan:s.fixed_selling_plan,id:s.id,name:s.name,recurringDeliveries:s.recurring_deliveries}},r.push(i)}return r}async fetchCartFromShopify(e){if(!e&&this.token){x.debug("Not fetching cart");return}x.debug("Fetching cart");let r=jn("cart.js"),n=await(await fetch(r)).json();this.update(n)}},mf=dt(Qn()),ju=Object.prototype.toString;function pa(t){switch(ju.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return Cr(t,Error)}}function dn(t,e){return ju.call(t)===`[object ${e}]`}function $u(t){return dn(t,"ErrorEvent")}function jc(t){return dn(t,"DOMError")}function yf(t){return dn(t,"DOMException")}function $e(t){return dn(t,"String")}function da(t){return typeof t=="object"&&t!==null&&"__sentry_template_string__"in t&&"__sentry_template_values__"in t}function fa(t){return t===null||da(t)||typeof t!="object"&&typeof t!="function"}function Xr(t){return dn(t,"Object")}function ns(t){return typeof Event<"u"&&Cr(t,Event)}function vf(t){return typeof Element<"u"&&Cr(t,Element)}function wf(t){return dn(t,"RegExp")}function is(t){return!!(t&&t.then&&typeof t.then=="function")}function bf(t){return Xr(t)&&"nativeEvent"in t&&"preventDefault"in t&&"stopPropagation"in t}function Cr(t,e){try{return t instanceof e}catch{return!1}}function Fu(t){return!!(typeof t=="object"&&t!==null&&(t.__isVue||t._isVue))}function qr(t,e=0){return typeof t!="string"||e===0||t.length<=e?t:`${t.slice(0,e)}...`}function $c(t,e){if(!Array.isArray(t))return"";let r=[];for(let n=0;n<t.length;n++){let i=t[n];try{Fu(i)?r.push("[VueViewModel]"):r.push(String(i))}catch{r.push("[value cannot be serialized]")}}return r.join(e)}function _f(t,e,r=!1){return $e(t)?wf(e)?e.test(t):$e(e)?r?t===e:t.includes(e):!1:!1}function ss(t,e=[],r=!1){return e.some(n=>_f(t,n,r))}function Ef(t,e,r=250,n,i,s,o){if(!s.exception||!s.exception.values||!o||!Cr(o.originalException,Error))return;let a=s.exception.values.length>0?s.exception.values[s.exception.values.length-1]:void 0;a&&(s.exception.values=Sf(mo(t,e,i,o.originalException,n,s.exception.values,a,0),r))}function mo(t,e,r,n,i,s,o,a){if(s.length>=r+1)return s;let l=[...s];if(Cr(n[i],Error)){Fc(o,a);let h=t(e,n[i]),g=l.length;Hc(h,i,g,a),l=mo(t,e,r,n[i],i,[h,...l],h,g)}return Array.isArray(n.errors)&&n.errors.forEach((h,g)=>{if(Cr(h,Error)){Fc(o,a);let p=t(e,h),_=l.length;Hc(p,`errors[${g}]`,_,a),l=mo(t,e,r,h,i,[p,...l],p,_)}}),l}function Fc(t,e){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism=wt(D(D({},t.mechanism),t.type==="AggregateError"&&{is_exception_group:!0}),{exception_id:e})}function Hc(t,e,r,n){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism=wt(D({},t.mechanism),{type:"chained",source:e,exception_id:r,parent_id:n})}function Sf(t,e){return t.map(r=>(r.value&&(r.value=qr(r.value,e)),r))}var _r="8.18.0",pt=globalThis;function ga(t,e,r){let n=r||pt,i=n.__SENTRY__=n.__SENTRY__||{},s=i[_r]=i[_r]||{};return s[t]||(s[t]=e())}var ma=pt,If=80;function Hu(t,e={}){if(!t)return"<unknown>";try{let r=t,n=5,i=[],s=0,o=0,a=" > ",l=a.length,h,g=Array.isArray(e)?e:e.keyAttrs,p=!Array.isArray(e)&&e.maxStringLength||If;for(;r&&s++<n&&(h=Cf(r,g),!(h==="html"||s>1&&o+i.length*l+h.length>=p));)i.push(h),o+=h.length,r=r.parentNode;return i.reverse().join(a)}catch{return"<unknown>"}}function Cf(t,e){let r=t,n=[];if(!r||!r.tagName)return"";if(ma.HTMLElement&&r instanceof HTMLElement&&r.dataset){if(r.dataset.sentryComponent)return r.dataset.sentryComponent;if(r.dataset.sentryElement)return r.dataset.sentryElement}n.push(r.tagName.toLowerCase());let i=e&&e.length?e.filter(o=>r.getAttribute(o)).map(o=>[o,r.getAttribute(o)]):null;if(i&&i.length)i.forEach(o=>{n.push(`[${o[0]}="${o[1]}"]`)});else{r.id&&n.push(`#${r.id}`);let o=r.className;if(o&&$e(o)){let a=o.split(/\s+/);for(let l of a)n.push(`.${l}`)}}let s=["aria-label","type","name","title","alt"];for(let o of s){let a=r.getAttribute(o);a&&n.push(`[${o}="${a}"]`)}return n.join("")}function Tf(){try{return ma.document.location.href}catch{return""}}function xf(t){if(!ma.HTMLElement)return null;let e=t,r=5;for(let n=0;n<r;n++){if(!e)return null;if(e instanceof HTMLElement){if(e.dataset.sentryComponent)return e.dataset.sentryComponent;if(e.dataset.sentryElement)return e.dataset.sentryElement}e=e.parentNode}return null}var ti=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,Df="Sentry Logger ",yo=["debug","info","warn","error","log","assert","trace"],Hi={};function ya(t){if(!("console"in pt))return t();let e=pt.console,r={},n=Object.keys(Hi);n.forEach(i=>{let s=Hi[i];r[i]=e[i],e[i]=s});try{return t()}finally{n.forEach(i=>{e[i]=r[i]})}}function Nf(){let t=!1,e={enable:()=>{t=!0},disable:()=>{t=!1},isEnabled:()=>t};return ti?yo.forEach(r=>{e[r]=(...n)=>{t&&ya(()=>{pt.console[r](`${Df}[${r}]:`,...n)})}}):yo.forEach(r=>{e[r]=()=>{}}),e}var it=Nf(),Af=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function Of(t){return t==="http"||t==="https"}function os(t,e=!1){let{host:r,path:n,pass:i,port:s,projectId:o,protocol:a,publicKey:l}=t;return`${a}://${l}${e&&i?`:${i}`:""}@${r}${s?`:${s}`:""}/${n&&`${n}/`}${o}`}function kf(t){let e=Af.exec(t);if(!e){ya(()=>{console.error(`Invalid Sentry Dsn: ${t}`)});return}let[r,n,i="",s="",o="",a=""]=e.slice(1),l="",h=a,g=h.split("/");if(g.length>1&&(l=g.slice(0,-1).join("/"),h=g.pop()),h){let p=h.match(/^\d+/);p&&(h=p[0])}return Vu({host:s,pass:i,path:l,projectId:h,port:o,protocol:r,publicKey:n})}function Vu(t){return{protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function Pf(t){if(!ti)return!0;let{port:e,projectId:r,protocol:n}=t;return["protocol","publicKey","host","projectId"].find(i=>t[i]?!1:(it.error(`Invalid Sentry Dsn: ${i} missing`),!0))?!1:r.match(/^\d+$/)?Of(n)?e&&isNaN(parseInt(e,10))?(it.error(`Invalid Sentry Dsn: Invalid port ${e}`),!1):!0:(it.error(`Invalid Sentry Dsn: Invalid protocol ${n}`),!1):(it.error(`Invalid Sentry Dsn: Invalid projectId ${r}`),!1)}function Rf(t){let e=typeof t=="string"?kf(t):Vu(t);if(!(!e||!Pf(e)))return e}var De=class extends Error{constructor(t,e="warn"){super(t),this.message=t,this.name=new.target.prototype.constructor.name,Object.setPrototypeOf(this,new.target.prototype),this.logLevel=e}};function Wt(t,e,r){if(!(e in t))return;let n=t[e],i=r(n);typeof i=="function"&&Wu(i,n),t[e]=i}function Tr(t,e,r){try{Object.defineProperty(t,e,{value:r,writable:!0,configurable:!0})}catch{ti&&it.log(`Failed to add non-enumerable property "${e}" to object`,t)}}function Wu(t,e){try{let r=e.prototype||{};t.prototype=e.prototype=r,Tr(t,"__sentry_original__",e)}catch{}}function va(t){return t.__sentry_original__}function Lf(t){return Object.keys(t).map(e=>`${encodeURIComponent(e)}=${encodeURIComponent(t[e])}`).join("&")}function Gu(t){if(pa(t))return D({message:t.message,name:t.name,stack:t.stack},Wc(t));if(ns(t)){let e=D({type:t.type,target:Vc(t.target),currentTarget:Vc(t.currentTarget)},Wc(t));return typeof CustomEvent<"u"&&Cr(t,CustomEvent)&&(e.detail=t.detail),e}else return t}function Vc(t){try{return vf(t)?Hu(t):Object.prototype.toString.call(t)}catch{return"<unknown>"}}function Wc(t){if(typeof t=="object"&&t!==null){let e={};for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}else return{}}function Uf(t,e=40){let r=Object.keys(Gu(t));r.sort();let n=r[0];if(!n)return"[object has no keys]";if(n.length>=e)return qr(n,e);for(let i=r.length;i>0;i--){let s=r.slice(0,i).join(", ");if(!(s.length>e))return i===r.length?s:qr(s,e)}return""}function we(t){return vo(t,new Map)}function vo(t,e){if(Mf(t)){let r=e.get(t);if(r!==void 0)return r;let n={};e.set(t,n);for(let i of Object.keys(t))typeof t[i]<"u"&&(n[i]=vo(t[i],e));return n}if(Array.isArray(t)){let r=e.get(t);if(r!==void 0)return r;let n=[];return e.set(t,n),t.forEach(i=>{n.push(vo(i,e))}),n}return t}function Mf(t){if(!Xr(t))return!1;try{let e=Object.getPrototypeOf(t).constructor.name;return!e||e==="Object"}catch{return!0}}var xr="?",Gc=/\(error: (.*)\)/,qc=/captureMessage|captureException/;function Bf(...t){let e=t.sort((r,n)=>r[0]-n[0]).map(r=>r[1]);return(r,n=0,i=0)=>{let s=[],o=r.split(`
|
|
20
|
-
`);for(let a=n;a<o.length;a++){let l=o[a];if(l.length>1024)continue;let h=
|
|
19
|
+
`)};Qt.prototype.renderPartial=function(t,e,r,n){if(r){var i=this.getConfigTags(n),s=la(r)?r(t[1]):r[t[1]];if(s!=null){var o=t[6],a=t[5],l=t[4],h=s;a==0&&l&&(h=this.indentPartial(s,l,o));var g=this.parse(h,i);return this.renderTokens(g,e,r,h,n)}}};Qt.prototype.unescapedValue=function(t,e){var r=e.lookup(t[1]);if(r!=null)return r};Qt.prototype.escapedValue=function(t,e,r){var n=this.getConfigEscape(r)||ge.escape,i=e.lookup(t[1]);if(i!=null)return typeof i=="number"&&n===ge.escape?String(i):n(i)};Qt.prototype.rawValue=function(t){return t[1]};Qt.prototype.getConfigTags=function(t){return hn(t)?t:t&&typeof t=="object"?t.tags:void 0};Qt.prototype.getConfigEscape=function(t){if(t&&typeof t=="object"&&!hn(t))return t.escape};var ge={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(t){Vn.templateCache=t},get templateCache(){return Vn.templateCache}},Vn=new Qt;ge.clearCache=function(){return Vn.clearCache()};ge.parse=function(t,e){return Vn.parse(t,e)};ge.render=function(t,e,r,n){if(typeof t!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+Qd(t)+'" was given as the first argument for mustache#render(template, view, partials)');return Vn.render(t,e,r,n)};ge.escape=sf;ge.Scanner=Zn;ge.Context=Xr;ge.Writer=Qt;var je=ge,Wn=class ke{static DOCUMENT_STANDARD_MODE="CSS1Compat";static _instance;parentContainer;scalingFactor=1;doc=document;constructor(){}static get(){return ke._instance||(ke._instance=new ke),ke._instance}getWidth(){return this.parentContainer&&this.parentContainer!==document.body?this.parentContainer.clientWidth:document.compatMode===ke.DOCUMENT_STANDARD_MODE?document.documentElement.clientWidth:window.innerWidth}getHeight(){return this.isParentNotBody()?this.parentContainer.clientHeight:document.compatMode===ke.DOCUMENT_STANDARD_MODE?document.documentElement.clientHeight:window.innerHeight}isMobile(){return window.CooeeSDK.uaParser.getDevice().type==="mobile"}calculateScalingFactor(e){let r=e.max,n=e.cont.w,i=e.cont.h,s=e.spc,o=ke.get().getWidth(),a=ke.get().getHeight();r&&(o=o?Math.min(o,r):r,a=a?Math.min(a,r):r),a&&(o-=s.getHorizontal(),a-=s.getVertical(),o/a<n/i?this.scalingFactor=o/n:this.scalingFactor=a/i,this.scalingFactor=Math.min(this.scalingFactor,1))}getScalingFactor(){return this.scalingFactor}createElement(e){return this.doc.createElement(e)}appendChild(e,r){e.appendChild(r)}setStyles(e,r){Object.assign(e.style,r)}setStyle(e,r,n){if(r){if(!n){e.style.removeProperty(r);return}e.style.setProperty(r,n,"important")}}setAttribute(e,r,n){e.setAttribute(r,n)}removeInApp(e){let r=document.querySelector(`.${e.rootClassName}`);r&&r.parentElement.removeChild(r)}setParentContainer(e){this.parentContainer=e,this.parentContainer&&this.isParentNotBody()&&this.setStyle(this.parentContainer,"position","relative")}isParentNotBody(){return this.parentContainer!==document.body}},at=class{static ID="id";static SESSION_LANDING_PAGE="landing";static SESSION_LAST_USED_TIME="lastUsedTime";static SESSION_SYNCED="synced";static APP_CONFIG="conf";static DEVICE_ID="did";static SDK_TOKEN="token";static FIRST_SEEN="firstSeen";static SESSION_NUMBER="sessionNumber";static GA_CLIENT_ID="gacid";static CURRENT_CART="cart";static MUTED="muted"},jc=dt(Dd());function ua(t){return jc.default.createInstance({name:"lc",storeName:t,driver:jc.default.LOCALSTORAGE})}var ha=class{static storage;static async get(t,e){return await this.storage?.getItem(t)??e}static set(t,e){return this.storage?.setItem(t,e)}static remove(t){return this.storage?.removeItem(t)}static clear(){return this.storage?.clear()}static getForage(){return this.storage}},re=class extends ha{static storeName="ses";static{this.storage=ua(this.storeName)}},Ut=class extends ha{static storeName="usr";static{this.storage=ua(this.storeName)}},pn=class{id;mID;vID;vName;imageURL;name;link;quantity;price;finalPrice;constructor(t){this.id=t.id,this.mID=t.mID,this.vID=t.vID,this.vName=t.vName,this.imageURL=t.imageURL,this.name=t.name,this.link=t.link,this.quantity=t.quantity,this.price=t.price,this.finalPrice=t.finalPrice??t.price}},kt=class{isCartDirty=!0;cartEngagements;isGoKwikPopupOpen;previewIDs;previewVariant;pageName;moneyFormat;jsLoadTime=new Date;shopCurrencyCode;locale;activeExperiment;inInactive=!1;lastEnterActive=new Date;lastEnterInactive=null;currentItem;_currencyCode;get currencyCode(){return this._currencyCode}set currencyCode(t){this._currencyCode=t}static get(){return window.CooeeSDK.runtimeData}isInactive(){return this.inInactive}async setInactive(){return this.inInactive?0:(this.inInactive=!0,this.lastEnterInactive=new Date,Math.max((this.lastEnterInactive.getTime()-this.lastEnterActive.getTime())/1e3,0))}setActive(){return this.inInactive?(this.inInactive=!1,this.lastEnterActive=new Date,Math.max((this.lastEnterActive.getTime()-this.lastEnterInactive.getTime())/1e3,0)):0}isFirstActive(){return this.lastEnterInactive==null}getCurrentItem(){return this.currentItem}setCurrentItem(t){this.currentItem=new pn(t)}},df="?from=cooee";function pa(){return!!window.Shopify}function ff(){if(pa())return window.Shopify.shop?.split(".")?.[0]}function gf(t){let e=(t.includes("://")?new URL(t).pathname:t).match(/\/products\/([^/]+?)(?:\.html)?$/);return e?e[1]:null}function Fi(){return window.Shopify?.routes?.root??"/"}function jn(t){return Fi()+t+df}var mf=class{isLocked=!1;queue=[];async acquire(){if(this.isLocked)await new Promise(t=>this.queue.push(t));else{this.isLocked=!0;return}}release(){if(this.queue.length>0){let t=this.queue.shift();t&&t()}else this.isLocked=!1}},yf=class mo{static LOCK_TIMEOUT=1e4;static RETRY_INTERVAL=200;static MAX_RETRIES=50;static async request(e,r){if(e=`__cooee_${e}_lock__`,"locks"in navigator)return navigator.locks.request(e,r);let n=!1,i=0,s=Math.random().toString(36).substring(2,10);for(;i++<this.MAX_RETRIES&&(x.debug(`Lock retry ${i}`),n=await this.acquire(e,s),!n);)await this.sleep(mo.RETRY_INTERVAL*i+Math.random()*100);try{return await r()}finally{this.release(e,s)}}static async acquire(e,r){let n=Date.now(),i=localStorage.getItem(e),s=i?JSON.parse(i):null;if(s&&n<=s.expiry)return!1;let o={owner:r,expiry:n+mo.LOCK_TIMEOUT};return localStorage.setItem(e,JSON.stringify(o)),await this.sleep(150+Math.random()*100),JSON.parse(localStorage.getItem(e)||"{}").owner===r?(x.debug(`${r}: Lock acquired!`),!0):(x.debug(`${r}: Race lost. Another tab acquired the lock.`),!1)}static release(e,r){let n=localStorage.getItem(e);if(!n)return;let i=JSON.parse(n);i.owner===r?(localStorage.removeItem(e),x.debug(`${r}: Lock released`)):x.debug(`${r}: Cannot release lock. Current owner: ${i.owner}`)}static sleep(e){return new Promise(r=>setTimeout(r,e))}},Ot=class Bu{static CURRENT;token;items;total_price;original_total_price;currency;item_count;attributes;cart_level_discount_applications;lock=new mf;constructor(){}static getCurrent(){return this.CURRENT||(this.CURRENT=new Bu),this.CURRENT}async getNormalisedCart(e){await this.fetchCartFromShopify(e);let r=this.convertToCooeeCart();return e&&await Ut.set(at.CURRENT_CART,r),r}async addCooeeAttributes(){await this.lock.acquire();let e=await re.get(at.ID),r=await Ut.get(at.DEVICE_ID);if(this.attributes?.letscooee_did===r&&this.attributes?.letscooee_sid===e){x.debug("Not calling Shopify update.js API.","Current attributes:",this.attributes),this.lock.release();return}let n={letscooee_did:r,letscooee_sid:e,__letscooee_time:new Date().toLocaleString()};x.debug("Updating Shopify cart with attributes:",n);let i=jn("cart/update.js"),s=await(await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({attributes:n})})).json();x.debug("Updated cart attributes",JSON.stringify(s)),this.update(s),this.lock.release()}update(e){return this.token=e.token,this.items=e.items,this.total_price=e.total_price,this.original_total_price=e.original_total_price,this.currency=e.currency,this.item_count=e.item_count,this.attributes=e.attributes,this.cart_level_discount_applications=e.cart_level_discount_applications,kt.get().currencyCode=this.currency,x.log("Updated ShopifyCart",this),this}toString(){return`ShopifyCart(token: ${this.token}, itemCount: ${this.item_count})`}convertToCooeeCart(){return{amount:this.total_price/100,originalAmount:this.original_total_price/100,currency:this.currency,itemCount:this.item_count,items:this.normaliseItems(this.items),token:this.token}}normaliseItems(e){if(!e)return x.error("No item received to be sent"),[];Array.isArray(e)||(e=[e]);let r=[];for(let n of e){if(!n.id||!n.title){x.warn("Invalid item received",n);continue}let i={name:n.title,quantity:+n.quantity||1,mID:n.product_id?.toString(),vID:n.id.toString(),price:+n.price/100||0,finalPrice:+n.final_price/100||0,properties:n.properties,key:n.key},s=n.selling_plan_allocation?.selling_plan;if(!s){r.push(i);continue}i.sellingPlanAllocation={sellingPlan:{fixedSellingPlan:s.fixed_selling_plan,id:s.id,name:s.name,recurringDeliveries:s.recurring_deliveries}},r.push(i)}return r}async fetchCartFromShopify(e){if(!e&&this.token){x.debug("Not fetching cart");return}x.debug("Fetching cart");let r=jn("cart.js"),n=await(await fetch(r)).json();this.update(n)}},vf=dt(Qn()),ju=Object.prototype.toString;function da(t){switch(ju.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return Cr(t,Error)}}function dn(t,e){return ju.call(t)===`[object ${e}]`}function $u(t){return dn(t,"ErrorEvent")}function $c(t){return dn(t,"DOMError")}function wf(t){return dn(t,"DOMException")}function $e(t){return dn(t,"String")}function fa(t){return typeof t=="object"&&t!==null&&"__sentry_template_string__"in t&&"__sentry_template_values__"in t}function ga(t){return t===null||fa(t)||typeof t!="object"&&typeof t!="function"}function Zr(t){return dn(t,"Object")}function ns(t){return typeof Event<"u"&&Cr(t,Event)}function bf(t){return typeof Element<"u"&&Cr(t,Element)}function _f(t){return dn(t,"RegExp")}function is(t){return!!(t&&t.then&&typeof t.then=="function")}function Ef(t){return Zr(t)&&"nativeEvent"in t&&"preventDefault"in t&&"stopPropagation"in t}function Cr(t,e){try{return t instanceof e}catch{return!1}}function Fu(t){return!!(typeof t=="object"&&t!==null&&(t.__isVue||t._isVue))}function qr(t,e=0){return typeof t!="string"||e===0||t.length<=e?t:`${t.slice(0,e)}...`}function Fc(t,e){if(!Array.isArray(t))return"";let r=[];for(let n=0;n<t.length;n++){let i=t[n];try{Fu(i)?r.push("[VueViewModel]"):r.push(String(i))}catch{r.push("[value cannot be serialized]")}}return r.join(e)}function Sf(t,e,r=!1){return $e(t)?_f(e)?e.test(t):$e(e)?r?t===e:t.includes(e):!1:!1}function ss(t,e=[],r=!1){return e.some(n=>Sf(t,n,r))}function If(t,e,r=250,n,i,s,o){if(!s.exception||!s.exception.values||!o||!Cr(o.originalException,Error))return;let a=s.exception.values.length>0?s.exception.values[s.exception.values.length-1]:void 0;a&&(s.exception.values=Cf(yo(t,e,i,o.originalException,n,s.exception.values,a,0),r))}function yo(t,e,r,n,i,s,o,a){if(s.length>=r+1)return s;let l=[...s];if(Cr(n[i],Error)){Hc(o,a);let h=t(e,n[i]),g=l.length;Vc(h,i,g,a),l=yo(t,e,r,n[i],i,[h,...l],h,g)}return Array.isArray(n.errors)&&n.errors.forEach((h,g)=>{if(Cr(h,Error)){Hc(o,a);let p=t(e,h),_=l.length;Vc(p,`errors[${g}]`,_,a),l=yo(t,e,r,h,i,[p,...l],p,_)}}),l}function Hc(t,e){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism=wt(D(D({},t.mechanism),t.type==="AggregateError"&&{is_exception_group:!0}),{exception_id:e})}function Vc(t,e,r,n){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism=wt(D({},t.mechanism),{type:"chained",source:e,exception_id:r,parent_id:n})}function Cf(t,e){return t.map(r=>(r.value&&(r.value=qr(r.value,e)),r))}var _r="8.18.0",pt=globalThis;function ma(t,e,r){let n=r||pt,i=n.__SENTRY__=n.__SENTRY__||{},s=i[_r]=i[_r]||{};return s[t]||(s[t]=e())}var ya=pt,Tf=80;function Hu(t,e={}){if(!t)return"<unknown>";try{let r=t,n=5,i=[],s=0,o=0,a=" > ",l=a.length,h,g=Array.isArray(e)?e:e.keyAttrs,p=!Array.isArray(e)&&e.maxStringLength||Tf;for(;r&&s++<n&&(h=xf(r,g),!(h==="html"||s>1&&o+i.length*l+h.length>=p));)i.push(h),o+=h.length,r=r.parentNode;return i.reverse().join(a)}catch{return"<unknown>"}}function xf(t,e){let r=t,n=[];if(!r||!r.tagName)return"";if(ya.HTMLElement&&r instanceof HTMLElement&&r.dataset){if(r.dataset.sentryComponent)return r.dataset.sentryComponent;if(r.dataset.sentryElement)return r.dataset.sentryElement}n.push(r.tagName.toLowerCase());let i=e&&e.length?e.filter(o=>r.getAttribute(o)).map(o=>[o,r.getAttribute(o)]):null;if(i&&i.length)i.forEach(o=>{n.push(`[${o[0]}="${o[1]}"]`)});else{r.id&&n.push(`#${r.id}`);let o=r.className;if(o&&$e(o)){let a=o.split(/\s+/);for(let l of a)n.push(`.${l}`)}}let s=["aria-label","type","name","title","alt"];for(let o of s){let a=r.getAttribute(o);a&&n.push(`[${o}="${a}"]`)}return n.join("")}function Df(){try{return ya.document.location.href}catch{return""}}function Nf(t){if(!ya.HTMLElement)return null;let e=t,r=5;for(let n=0;n<r;n++){if(!e)return null;if(e instanceof HTMLElement){if(e.dataset.sentryComponent)return e.dataset.sentryComponent;if(e.dataset.sentryElement)return e.dataset.sentryElement}e=e.parentNode}return null}var ti=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,Af="Sentry Logger ",vo=["debug","info","warn","error","log","assert","trace"],Hi={};function va(t){if(!("console"in pt))return t();let e=pt.console,r={},n=Object.keys(Hi);n.forEach(i=>{let s=Hi[i];r[i]=e[i],e[i]=s});try{return t()}finally{n.forEach(i=>{e[i]=r[i]})}}function Of(){let t=!1,e={enable:()=>{t=!0},disable:()=>{t=!1},isEnabled:()=>t};return ti?vo.forEach(r=>{e[r]=(...n)=>{t&&va(()=>{pt.console[r](`${Af}[${r}]:`,...n)})}}):vo.forEach(r=>{e[r]=()=>{}}),e}var it=Of(),Pf=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function kf(t){return t==="http"||t==="https"}function os(t,e=!1){let{host:r,path:n,pass:i,port:s,projectId:o,protocol:a,publicKey:l}=t;return`${a}://${l}${e&&i?`:${i}`:""}@${r}${s?`:${s}`:""}/${n&&`${n}/`}${o}`}function Rf(t){let e=Pf.exec(t);if(!e){va(()=>{console.error(`Invalid Sentry Dsn: ${t}`)});return}let[r,n,i="",s="",o="",a=""]=e.slice(1),l="",h=a,g=h.split("/");if(g.length>1&&(l=g.slice(0,-1).join("/"),h=g.pop()),h){let p=h.match(/^\d+/);p&&(h=p[0])}return Vu({host:s,pass:i,path:l,projectId:h,port:o,protocol:r,publicKey:n})}function Vu(t){return{protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function Lf(t){if(!ti)return!0;let{port:e,projectId:r,protocol:n}=t;return["protocol","publicKey","host","projectId"].find(i=>t[i]?!1:(it.error(`Invalid Sentry Dsn: ${i} missing`),!0))?!1:r.match(/^\d+$/)?kf(n)?e&&isNaN(parseInt(e,10))?(it.error(`Invalid Sentry Dsn: Invalid port ${e}`),!1):!0:(it.error(`Invalid Sentry Dsn: Invalid protocol ${n}`),!1):(it.error(`Invalid Sentry Dsn: Invalid projectId ${r}`),!1)}function Uf(t){let e=typeof t=="string"?Rf(t):Vu(t);if(!(!e||!Lf(e)))return e}var De=class extends Error{constructor(t,e="warn"){super(t),this.message=t,this.name=new.target.prototype.constructor.name,Object.setPrototypeOf(this,new.target.prototype),this.logLevel=e}};function Vt(t,e,r){if(!(e in t))return;let n=t[e],i=r(n);typeof i=="function"&&Wu(i,n),t[e]=i}function Tr(t,e,r){try{Object.defineProperty(t,e,{value:r,writable:!0,configurable:!0})}catch{ti&&it.log(`Failed to add non-enumerable property "${e}" to object`,t)}}function Wu(t,e){try{let r=e.prototype||{};t.prototype=e.prototype=r,Tr(t,"__sentry_original__",e)}catch{}}function wa(t){return t.__sentry_original__}function Mf(t){return Object.keys(t).map(e=>`${encodeURIComponent(e)}=${encodeURIComponent(t[e])}`).join("&")}function Gu(t){if(da(t))return D({message:t.message,name:t.name,stack:t.stack},Gc(t));if(ns(t)){let e=D({type:t.type,target:Wc(t.target),currentTarget:Wc(t.currentTarget)},Gc(t));return typeof CustomEvent<"u"&&Cr(t,CustomEvent)&&(e.detail=t.detail),e}else return t}function Wc(t){try{return bf(t)?Hu(t):Object.prototype.toString.call(t)}catch{return"<unknown>"}}function Gc(t){if(typeof t=="object"&&t!==null){let e={};for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}else return{}}function Bf(t,e=40){let r=Object.keys(Gu(t));r.sort();let n=r[0];if(!n)return"[object has no keys]";if(n.length>=e)return qr(n,e);for(let i=r.length;i>0;i--){let s=r.slice(0,i).join(", ");if(!(s.length>e))return i===r.length?s:qr(s,e)}return""}function ve(t){return wo(t,new Map)}function wo(t,e){if(jf(t)){let r=e.get(t);if(r!==void 0)return r;let n={};e.set(t,n);for(let i of Object.keys(t))typeof t[i]<"u"&&(n[i]=wo(t[i],e));return n}if(Array.isArray(t)){let r=e.get(t);if(r!==void 0)return r;let n=[];return e.set(t,n),t.forEach(i=>{n.push(wo(i,e))}),n}return t}function jf(t){if(!Zr(t))return!1;try{let e=Object.getPrototypeOf(t).constructor.name;return!e||e==="Object"}catch{return!0}}var xr="?",qc=/\(error: (.*)\)/,zc=/captureMessage|captureException/;function $f(...t){let e=t.sort((r,n)=>r[0]-n[0]).map(r=>r[1]);return(r,n=0,i=0)=>{let s=[],o=r.split(`
|
|
20
|
+
`);for(let a=n;a<o.length;a++){let l=o[a];if(l.length>1024)continue;let h=qc.test(l)?l.replace(qc,"$1"):l;if(!h.match(/\S*Error: /)){for(let g of e){let p=g(h);if(p){s.push(p);break}}if(s.length>=50+i)break}}return Ff(s.slice(i))}}function Ff(t){if(!t.length)return[];let e=Array.from(t);return/sentryWrapped/.test(mi(e).function||"")&&e.pop(),e.reverse(),zc.test(mi(e).function||"")&&(e.pop(),zc.test(mi(e).function||"")&&e.pop()),e.slice(0,50).map(r=>wt(D({},r),{filename:r.filename||mi(e).filename,function:r.function||xr}))}function mi(t){return t[t.length-1]||{}}var Ls="<anonymous>";function ar(t){try{return!t||typeof t!="function"?Ls:t.name||Ls}catch{return Ls}}function Yc(t){let e=t.exception;if(e){let r=[];try{return e.values.forEach(n=>{n.stacktrace.frames&&r.push(...n.stacktrace.frames)}),r}catch{return}}}var ki={},Kc={};function Pr(t,e){ki[t]=ki[t]||[],ki[t].push(e)}function kr(t,e){Kc[t]||(e(),Kc[t]=!0)}function be(t,e){let r=t&&ki[t];if(r)for(let n of r)try{n(e)}catch(i){ti&&it.error(`Error while triggering instrumentation handler.
|
|
21
21
|
Type: ${t}
|
|
22
22
|
Name: ${ar(n)}
|
|
23
|
-
Error:`,i)}}function
|
|
23
|
+
Error:`,i)}}function Hf(t){let e="console";Pr(e,t),kr(e,Vf)}function Vf(){"console"in pt&&vo.forEach(function(t){t in pt.console&&Vt(pt.console,t,function(e){return Hi[t]=e,function(...r){be("console",{args:r,level:t});let n=Hi[t];n&&n.apply(pt.console,r)}})})}var bo=pt;function Wf(){if(!("fetch"in bo))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}function _o(t){return t&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(t.toString())}function Gf(){if(typeof EdgeRuntime=="string")return!0;if(!Wf())return!1;if(_o(bo.fetch))return!0;let t=!1,e=bo.document;if(e&&typeof e.createElement=="function")try{let r=e.createElement("iframe");r.hidden=!0,e.head.appendChild(r),r.contentWindow&&r.contentWindow.fetch&&(t=_o(r.contentWindow.fetch)),e.head.removeChild(r)}catch(r){ti&&it.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",r)}return t}var qu=1e3;function ei(){return Date.now()/qu}function qf(){let{performance:t}=pt;if(!t||!t.now)return ei;let e=Date.now()-t.now(),r=t.timeOrigin==null?e:t.timeOrigin;return()=>(r+t.now())/qu}var sr=qf(),yi,xE=(()=>{let{performance:t}=pt;if(!t||!t.now){yi="none";return}let e=3600*1e3,r=t.now(),n=Date.now(),i=t.timeOrigin?Math.abs(t.timeOrigin+r-n):e,s=i<e,o=t.timing&&t.timing.navigationStart,a=typeof o=="number"?Math.abs(o+r-n):e,l=a<e;return s||l?i<=a?(yi="timeOrigin",t.timeOrigin):(yi="navigationStart",o):(yi="dateNow",n)})();function zf(t){let e="fetch";Pr(e,t),kr(e,Yf)}function Yf(){Gf()&&Vt(pt,"fetch",function(t){return function(...e){let{method:r,url:n}=Kf(e),i={args:e,fetchData:{method:r,url:n},startTimestamp:sr()*1e3};be("fetch",D({},i));let s=new Error().stack;return t.apply(pt,e).then(o=>{let a=wt(D({},i),{endTimestamp:sr()*1e3,response:o});return be("fetch",a),o},o=>{let a=wt(D({},i),{endTimestamp:sr()*1e3,error:o});throw be("fetch",a),da(o)&&o.stack===void 0&&(o.stack=s,Tr(o,"framesToPop",1)),o})}})}function Eo(t,e){return!!t&&typeof t=="object"&&!!t[e]}function Jc(t){return typeof t=="string"?t:t?Eo(t,"url")?t.url:t.toString?t.toString():"":""}function Kf(t){if(t.length===0)return{method:"GET",url:""};if(t.length===2){let[r,n]=t;return{url:Jc(r),method:Eo(n,"method")?String(n.method).toUpperCase():"GET"}}let e=t[0];return{url:Jc(e),method:Eo(e,"method")?String(e.method).toUpperCase():"GET"}}var vi=null;function Jf(t){let e="error";Pr(e,t),kr(e,Qf)}function Qf(){vi=pt.onerror,pt.onerror=function(t,e,r,n,i){return be("error",{column:n,error:i,line:r,msg:t,url:e}),vi&&!vi.__SENTRY_LOADER__?vi.apply(this,arguments):!1},pt.onerror.__SENTRY_INSTRUMENTED__=!0}var wi=null;function Xf(t){let e="unhandledrejection";Pr(e,t),kr(e,Zf)}function Zf(){wi=pt.onunhandledrejection,pt.onunhandledrejection=function(t){return be("unhandledrejection",t),wi&&!wi.__SENTRY_LOADER__?wi.apply(this,arguments):!0},pt.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}function tg(){return"npm"}function eg(){let t=typeof WeakSet=="function",e=t?new WeakSet:[];function r(i){if(t)return e.has(i)?!0:(e.add(i),!1);for(let s=0;s<e.length;s++)if(e[s]===i)return!0;return e.push(i),!1}function n(i){if(t)e.delete(i);else for(let s=0;s<e.length;s++)if(e[s]===i){e.splice(s,1);break}}return[r,n]}function _e(){let t=pt,e=t.crypto||t.msCrypto,r=()=>Math.random()*16;try{if(e&&e.randomUUID)return e.randomUUID().replace(/-/g,"");e&&e.getRandomValues&&(r=()=>{let n=new Uint8Array(1);return e.getRandomValues(n),n[0]})}catch{}return("10000000100040008000"+1e11).replace(/[018]/g,n=>(n^(r()&15)>>n/4).toString(16))}function zu(t){return t.exception&&t.exception.values?t.exception.values[0]:void 0}function Xe(t){let{message:e,event_id:r}=t;if(e)return e;let n=zu(t);return n?n.type&&n.value?`${n.type}: ${n.value}`:n.type||n.value||r||"<unknown>":r||"<unknown>"}function So(t,e,r){let n=t.exception=t.exception||{},i=n.values=n.values||[],s=i[0]=i[0]||{};s.value||(s.value=e||""),s.type||(s.type=r||"Error")}function Gn(t,e){let r=zu(t);if(!r)return;let n={type:"generic",handled:!0},i=r.mechanism;if(r.mechanism=D(D(D({},n),i),e),e&&"data"in e){let s=D(D({},i&&i.data),e.data);r.mechanism.data=s}}function Qc(t){if(t&&t.__sentry_captured__)return!0;try{Tr(t,"__sentry_captured__",!0)}catch{}return!1}function rg(t){return Array.isArray(t)?t:[t]}function Ze(t,e=100,r=1/0){try{return Io("",t,e,r)}catch(n){return{ERROR:`**non-serializable** (${n})`}}}function Yu(t,e=3,r=100*1024){let n=Ze(t,e);return og(n)>r?Yu(t,e-1,r):n}function Io(t,e,r=1/0,n=1/0,i=eg()){let[s,o]=i;if(e==null||["number","boolean","string"].includes(typeof e)&&!Number.isNaN(e))return e;let a=ng(t,e);if(!a.startsWith("[object "))return a;if(e.__sentry_skip_normalization__)return e;let l=typeof e.__sentry_override_normalization_depth__=="number"?e.__sentry_override_normalization_depth__:r;if(l===0)return a.replace("object ","");if(s(e))return"[Circular ~]";let h=e;if(h&&typeof h.toJSON=="function")try{let w=h.toJSON();return Io("",w,l-1,n,i)}catch{}let g=Array.isArray(e)?[]:{},p=0,_=Gu(e);for(let w in _){if(!Object.prototype.hasOwnProperty.call(_,w))continue;if(p>=n){g[w]="[MaxProperties ~]";break}let b=_[w];g[w]=Io(w,b,l-1,n,i),p++}return o(e),g}function ng(t,e){try{if(t==="domain"&&e&&typeof e=="object"&&e._events)return"[Domain]";if(t==="domainEmitter")return"[DomainEmitter]";if(typeof global<"u"&&e===global)return"[Global]";if(typeof window<"u"&&e===window)return"[Window]";if(typeof document<"u"&&e===document)return"[Document]";if(Fu(e))return"[VueViewModel]";if(Ef(e))return"[SyntheticEvent]";if(typeof e=="number"&&e!==e)return"[NaN]";if(typeof e=="function")return`[Function: ${ar(e)}]`;if(typeof e=="symbol")return`[${String(e)}]`;if(typeof e=="bigint")return`[BigInt: ${String(e)}]`;let r=ig(e);return/^HTML(\w*)Element$/.test(r)?`[HTMLElement: ${r}]`:`[object ${r}]`}catch(r){return`**non-serializable** (${r})`}}function ig(t){let e=Object.getPrototypeOf(t);return e?e.constructor.name:"null prototype"}function sg(t){return~-encodeURI(t).split(/%..|./).length}function og(t){return sg(JSON.stringify(t))}var Le;(function(t){t[t.PENDING=0]="PENDING";let e=1;t[t.RESOLVED=e]="RESOLVED";let r=2;t[t.REJECTED=r]="REJECTED"})(Le||(Le={}));function Dr(t){return new ri(e=>{e(t)})}function Vi(t){return new ri((e,r)=>{r(t)})}var ri=class mr{constructor(e){mr.prototype.__init.call(this),mr.prototype.__init2.call(this),mr.prototype.__init3.call(this),mr.prototype.__init4.call(this),this._state=Le.PENDING,this._handlers=[];try{e(this._resolve,this._reject)}catch(r){this._reject(r)}}then(e,r){return new mr((n,i)=>{this._handlers.push([!1,s=>{if(!e)n(s);else try{n(e(s))}catch(o){i(o)}},s=>{if(!r)i(s);else try{n(r(s))}catch(o){i(o)}}]),this._executeHandlers()})}catch(e){return this.then(r=>r,e)}finally(e){return new mr((r,n)=>{let i,s;return this.then(o=>{s=!1,i=o,e&&e()},o=>{s=!0,i=o,e&&e()}).then(()=>{if(s){n(i);return}r(i)})})}__init(){this._resolve=e=>{this._setResult(Le.RESOLVED,e)}}__init2(){this._reject=e=>{this._setResult(Le.REJECTED,e)}}__init3(){this._setResult=(e,r)=>{if(this._state===Le.PENDING){if(is(r)){r.then(this._resolve,this._reject);return}this._state=e,this._value=r,this._executeHandlers()}}}__init4(){this._executeHandlers=()=>{if(this._state===Le.PENDING)return;let e=this._handlers.slice();this._handlers=[],e.forEach(r=>{r[0]||(this._state===Le.RESOLVED&&r[1](this._value),this._state===Le.REJECTED&&r[2](this._value),r[0]=!0)})}}};function ag(t){let e=[];function r(){return t===void 0||e.length<t}function n(o){return e.splice(e.indexOf(o),1)[0]||Promise.resolve(void 0)}function i(o){if(!r())return Vi(new De("Not adding Promise because buffer limit was reached."));let a=o();return e.indexOf(a)===-1&&e.push(a),a.then(()=>n(a)).then(null,()=>n(a).then(null,()=>{})),a}function s(o){return new ri((a,l)=>{let h=e.length;if(!h)return a(!0);let g=setTimeout(()=>{o&&o>0&&a(!1)},o);e.forEach(p=>{Dr(p).then(()=>{--h||(clearTimeout(g),a(!0))},l)})})}return{$:e,add:i,drain:s}}function Us(t){if(!t)return{};let e=t.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!e)return{};let r=e[6]||"",n=e[8]||"";return{host:e[4],path:e[5],protocol:e[2],search:r,hash:n,relative:e[5]+r+n}}var cg=["fatal","error","warning","log","info","debug"];function lg(t){return t==="warn"?"warning":cg.includes(t)?t:"log"}var ug="sentry-",hg=/^sentry-/;function pg(t){let e=dg(t);if(!e)return;let r=Object.entries(e).reduce((n,[i,s])=>{if(i.match(hg)){let o=i.slice(ug.length);n[o]=s}return n},{});if(Object.keys(r).length>0)return r}function dg(t){if(!(!t||!$e(t)&&!Array.isArray(t)))return Array.isArray(t)?t.reduce((e,r)=>{let n=Xc(r);return Object.entries(n).forEach(([i,s])=>{e[i]=s}),e},{}):Xc(t)}function Xc(t){return t.split(",").map(e=>e.split("=").map(r=>decodeURIComponent(r.trim()))).reduce((e,[r,n])=>(r&&n&&(e[r]=n),e),{})}function ni(t,e=[]){return[t,e]}function fg(t,e){let[r,n]=t;return[r,[...n,e]]}function Zc(t,e){let r=t[1];for(let n of r){let i=n[0].type;if(e(n,i))return!0}return!1}function Co(t){return pt.__SENTRY__&&pt.__SENTRY__.encodePolyfill?pt.__SENTRY__.encodePolyfill(t):new TextEncoder().encode(t)}function gg(t){let[e,r]=t,n=JSON.stringify(e);function i(s){typeof n=="string"?n=typeof s=="string"?n+s:[Co(n),s]:n.push(typeof s=="string"?Co(s):s)}for(let s of r){let[o,a]=s;if(i(`
|
|
24
24
|
${JSON.stringify(o)}
|
|
25
|
-
`),typeof a=="string"||a instanceof Uint8Array)i(a);else{let l;try{l=JSON.stringify(a)}catch{l=JSON.stringify(Xe(a))}i(l)}}return typeof n=="string"?n:fg(n)}function fg(t){let e=t.reduce((i,s)=>i+s.length,0),r=new Uint8Array(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return r}function gg(t){let e=typeof t.data=="string"?Io(t.data):t.data;return[we({type:"attachment",length:e.length,filename:t.filename,content_type:t.contentType,attachment_type:t.attachmentType}),e]}var mg={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",statsd:"metric_bucket"};function Xc(t){return mg[t]}function Ku(t){if(!t||!t.sdk)return;let{name:e,version:r}=t.sdk;return{name:e,version:r}}function yg(t,e,r,n){let i=t.sdkProcessingMetadata&&t.sdkProcessingMetadata.dynamicSamplingContext;return D(D(D({event_id:t.event_id,sent_at:new Date().toISOString()},e&&{sdk:e}),!!r&&n&&{dsn:os(n)}),i&&{trace:we(D({},i))})}function vg(t,e,r){let n=[{type:"client_report"},{timestamp:r||ei(),discarded_events:t}];return ni(e?{dsn:e}:{},[n])}function wg(t,e=Date.now()){let r=parseInt(`${t}`,10);if(!isNaN(r))return r*1e3;let n=Date.parse(`${t}`);return isNaN(n)?6e4:n-e}function bg(t,e){return t[e]||t.all||0}function _g(t,e,r=Date.now()){return bg(t,e)>r}function Eg(t,{statusCode:e,headers:r},n=Date.now()){let i=D({},t),s=r&&r["x-sentry-rate-limits"],o=r&&r["retry-after"];if(s)for(let a of s.trim().split(",")){let[l,h,,,g]=a.split(":",5),p=parseInt(l,10),_=(isNaN(p)?60:p)*1e3;if(!h)i.all=n+_;else for(let w of h.split(";"))w==="metric_bucket"?(!g||g.split(";").includes("custom"))&&(i[w]=n+_):i[w]=n+_}else o?i.all=n+wg(o,n):e===429&&(i.all=n+60*1e3);return i}function tl(){return{traceId:_e(),spanId:_e().substring(16)}}var bi=pt;function Sg(){let t=bi.chrome,e=t&&t.app&&t.app.runtime,r="history"in bi&&!!bi.history.pushState&&!!bi.history.replaceState;return!e&&r}var Nt=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function as(){return wa(pt),pt}function wa(t){let e=t.__SENTRY__=t.__SENTRY__||{};return e.version=e.version||_r,e[_r]=e[_r]||{}}function Co(t,e={}){if(e.user&&(!t.ipAddress&&e.user.ip_address&&(t.ipAddress=e.user.ip_address),!t.did&&!e.did&&(t.did=e.user.id||e.user.email||e.user.username)),t.timestamp=e.timestamp||sr(),e.abnormal_mechanism&&(t.abnormal_mechanism=e.abnormal_mechanism),e.ignoreDuration&&(t.ignoreDuration=e.ignoreDuration),e.sid&&(t.sid=e.sid.length===32?e.sid:_e()),e.init!==void 0&&(t.init=e.init),!t.did&&e.did&&(t.did=`${e.did}`),typeof e.started=="number"&&(t.started=e.started),t.ignoreDuration)t.duration=void 0;else if(typeof e.duration=="number")t.duration=e.duration;else{let r=t.timestamp-t.started;t.duration=r>=0?r:0}e.release&&(t.release=e.release),e.environment&&(t.environment=e.environment),!t.ipAddress&&e.ipAddress&&(t.ipAddress=e.ipAddress),!t.userAgent&&e.userAgent&&(t.userAgent=e.userAgent),typeof e.errors=="number"&&(t.errors=e.errors),e.status&&(t.status=e.status)}var To="_sentrySpan";function el(t,e){e?Tr(t,To,e):delete t[To]}function rl(t){return t[To]}var Ig=100,Cg=class Ju{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext=tl()}clone(){let e=new Ju;return e._breadcrumbs=[...this._breadcrumbs],e._tags=D({},this._tags),e._extra=D({},this._extra),e._contexts=D({},this._contexts),e._user=this._user,e._level=this._level,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._requestSession=this._requestSession,e._attachments=[...this._attachments],e._sdkProcessingMetadata=D({},this._sdkProcessingMetadata),e._propagationContext=D({},this._propagationContext),e._client=this._client,e._lastEventId=this._lastEventId,el(e,rl(this)),e}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&Co(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){return this._requestSession}setRequestSession(e){return this._requestSession=e,this}setTags(e){return this._tags=D(D({},this._tags),e),this._notifyScopeListeners(),this}setTag(e,r){return this._tags=wt(D({},this._tags),{[e]:r}),this._notifyScopeListeners(),this}setExtras(e){return this._extra=D(D({},this._extra),e),this._notifyScopeListeners(),this}setExtra(e,r){return this._extra=wt(D({},this._extra),{[e]:r}),this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,r){return r===null?delete this._contexts[e]:this._contexts[e]=r,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;let r=typeof e=="function"?e(this):e,[n,i]=r instanceof He?[r.getScopeData(),r.getRequestSession()]:Xr(r)?[e,e.requestSession]:[],{tags:s,extra:o,user:a,contexts:l,level:h,fingerprint:g=[],propagationContext:p}=n||{};return this._tags=D(D({},this._tags),s),this._extra=D(D({},this._extra),o),this._contexts=D(D({},this._contexts),l),a&&Object.keys(a).length&&(this._user=a),h&&(this._level=h),g.length&&(this._fingerprint=g),p&&(this._propagationContext=p),i&&(this._requestSession=i),this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._requestSession=void 0,this._session=void 0,el(this,void 0),this._attachments=[],this._propagationContext=tl(),this._notifyScopeListeners(),this}addBreadcrumb(e,r){let n=typeof r=="number"?r:Ig;if(n<=0)return this;let i=D({timestamp:ei()},e),s=this._breadcrumbs;return s.push(i),this._breadcrumbs=s.length>n?s.slice(-n):s,this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:rl(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=D(D({},this._sdkProcessingMetadata),e),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,r){let n=r&&r.event_id?r.event_id:_e();if(!this._client)return it.warn("No client configured on scope - will not capture exception!"),n;let i=new Error("Sentry syntheticException");return this._client.captureException(e,wt(D({originalException:e,syntheticException:i},r),{event_id:n}),this),n}captureMessage(e,r,n){let i=n&&n.event_id?n.event_id:_e();if(!this._client)return it.warn("No client configured on scope - will not capture message!"),i;let s=new Error(e);return this._client.captureMessage(e,r,wt(D({originalException:e,syntheticException:s},n),{event_id:i}),this),i}captureEvent(e,r){let n=r&&r.event_id?r.event_id:_e();return this._client?(this._client.captureEvent(e,wt(D({},r),{event_id:n}),this),n):(it.warn("No client configured on scope - will not capture event!"),n)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),this._notifyingListeners=!1)}},He=Cg;function Tg(){return ga("defaultCurrentScope",()=>new He)}function xg(){return ga("defaultIsolationScope",()=>new He)}var Dg=class{constructor(t,e){let r;t?r=t:r=new He;let n;e?n=e:n=new He,this._stack=[{scope:r}],this._isolationScope=n}withScope(t){let e=this._pushScope(),r;try{r=t(e)}catch(n){throw this._popScope(),n}return is(r)?r.then(n=>(this._popScope(),n),n=>{throw this._popScope(),n}):(this._popScope(),r)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){let t=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:t}),t}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}};function tn(){let t=as(),e=wa(t);return e.stack=e.stack||new Dg(Tg(),xg())}function Ng(t){return tn().withScope(t)}function Ag(t,e){let r=tn();return r.withScope(()=>(r.getStackTop().scope=t,e(t)))}function nl(t){return tn().withScope(()=>t(tn().getIsolationScope()))}function Og(){return{withIsolationScope:nl,withScope:Ng,withSetScope:Ag,withSetIsolationScope:(t,e)=>nl(e),getCurrentScope:()=>tn().getScope(),getIsolationScope:()=>tn().getIsolationScope()}}function ba(t){let e=wa(t);return e.acs?e.acs:Og()}function _a(){let t=as();return ba(t).getCurrentScope()}function Qu(){let t=as();return ba(t).getIsolationScope()}function kg(){return ga("globalScope",()=>new He)}function Pg(...t){let e=as(),r=ba(e);if(t.length===2){let[n,i]=t;return n?r.withSetScope(n,i):r.withScope(i)}return r.withScope(t[0])}function oe(){return _a().getClient()}var Rg="_sentryMetrics";function Lg(t){let e=t[Rg];if(!e)return;let r={};for(let[,[n,i]]of e)(r[n]||(r[n]=[])).push(we(i));return r}var Ug="sentry.source",Mg="sentry.sample_rate",Bg="sentry.op",jg="sentry.origin",$g=1;function Fg(t){let{spanId:e,traceId:r}=t.spanContext(),{parent_span_id:n}=Wi(t);return we({parent_span_id:n,span_id:e,trace_id:r})}function il(t){return typeof t=="number"?sl(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?sl(t.getTime()):sr()}function sl(t){return t>9999999999?t/1e3:t}function Wi(t){if(Vg(t))return t.getSpanJSON();try{let{spanId:e,traceId:r}=t.spanContext();if(Hg(t)){let{attributes:n,startTime:i,name:s,endTime:o,parentSpanId:a,status:l}=t;return we({span_id:e,trace_id:r,data:n,description:s,parent_span_id:a,start_timestamp:il(i),timestamp:il(o)||void 0,status:Gg(l),op:n[Bg],origin:n[jg],_metrics_summary:Lg(t)})}return{span_id:e,trace_id:r}}catch{return{}}}function Hg(t){let e=t;return!!e.attributes&&!!e.startTime&&!!e.name&&!!e.endTime&&!!e.status}function Vg(t){return typeof t.getSpanJSON=="function"}function Wg(t){let{traceFlags:e}=t.spanContext();return e===$g}function Gg(t){if(!(!t||t.code===0))return t.code===1?"ok":t.message||"unknown_error"}var qg="_sentryRootSpan";function Zu(t){return t[qg]||t}var Xu="production",zg="_frozenDsc";function th(t,e){let r=e.getOptions(),{publicKey:n}=e.getDsn()||{},i=we({environment:r.environment||Xu,release:r.release,public_key:n,trace_id:t});return e.emit("createDsc",i),i}function Yg(t){let e=oe();if(!e)return{};let r=th(Wi(t).trace_id||"",e),n=Zu(t),i=n[zg];if(i)return i;let s=n.spanContext().traceState,o=s&&s.get("sentry.dsc"),a=o&&ug(o);if(a)return a;let l=Wi(n),h=l.data||{},g=h[Mg];g!=null&&(r.sample_rate=`${g}`);let p=h[Ug],_=l.description;return p!=="url"&&_&&(r.transaction=_),r.sampled=String(Wg(n)),e.emit("createDsc",r,n),r}function Kg(t){if(typeof t=="boolean")return Number(t);let e=typeof t=="string"?parseFloat(t):t;if(typeof e!="number"||isNaN(e)||e<0||e>1){Nt&&it.warn(`[Tracing] Given sample rate is invalid. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(t)} of type ${JSON.stringify(typeof t)}.`);return}return e}function Jg(t,e){return e&&(t.sdk=t.sdk||{},t.sdk.name=t.sdk.name||e.name,t.sdk.version=t.sdk.version||e.version,t.sdk.integrations=[...t.sdk.integrations||[],...e.integrations||[]],t.sdk.packages=[...t.sdk.packages||[],...e.packages||[]]),t}function Qg(t,e,r,n){let i=Ku(r),s=D(D({sent_at:new Date().toISOString()},i&&{sdk:i}),!!n&&e&&{dsn:os(e)}),o="aggregates"in t?[{type:"sessions"},t]:[{type:"session"},t.toJSON()];return ni(s,[o])}function Zg(t,e,r,n){let i=Ku(r),s=t.type&&t.type!=="replay_event"?t.type:"event";Jg(t,r&&r.sdk);let o=yg(t,i,n,e);return delete t.sdkProcessingMetadata,ni(o,[[{type:s},t]])}function xo(t,e,r,n=0){return new ri((i,s)=>{let o=t[n];if(e===null||typeof o!="function")i(e);else{let a=o(D({},e),r);Nt&&o.id&&a===null&&it.log(`Event processor "${o.id}" dropped event`),is(a)?a.then(l=>xo(t,l,r,n+1).then(i)).then(null,s):xo(t,a,r,n+1).then(i).then(null,s)}})}function Xg(t,e){let{fingerprint:r,span:n,breadcrumbs:i,sdkProcessingMetadata:s}=e;tm(t,e),n&&nm(t,n),im(t,r),em(t,i),rm(t,s)}function ol(t,e){let{extra:r,tags:n,user:i,contexts:s,level:o,sdkProcessingMetadata:a,breadcrumbs:l,fingerprint:h,eventProcessors:g,attachments:p,propagationContext:_,transactionName:w,span:b}=e;bn(t,"extra",r),bn(t,"tags",n),bn(t,"user",i),bn(t,"contexts",s),bn(t,"sdkProcessingMetadata",a),o&&(t.level=o),w&&(t.transactionName=w),b&&(t.span=b),l.length&&(t.breadcrumbs=[...t.breadcrumbs,...l]),h.length&&(t.fingerprint=[...t.fingerprint,...h]),g.length&&(t.eventProcessors=[...t.eventProcessors,...g]),p.length&&(t.attachments=[...t.attachments,...p]),t.propagationContext=D(D({},t.propagationContext),_)}function bn(t,e,r){if(r&&Object.keys(r).length){t[e]=D({},t[e]);for(let n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[e][n]=r[n])}}function tm(t,e){let{extra:r,tags:n,user:i,contexts:s,level:o,transactionName:a}=e,l=we(r);l&&Object.keys(l).length&&(t.extra=D(D({},l),t.extra));let h=we(n);h&&Object.keys(h).length&&(t.tags=D(D({},h),t.tags));let g=we(i);g&&Object.keys(g).length&&(t.user=D(D({},g),t.user));let p=we(s);p&&Object.keys(p).length&&(t.contexts=D(D({},p),t.contexts)),o&&(t.level=o),a&&t.type!=="transaction"&&(t.transaction=a)}function em(t,e){let r=[...t.breadcrumbs||[],...e];t.breadcrumbs=r.length?r:void 0}function rm(t,e){t.sdkProcessingMetadata=D(D({},t.sdkProcessingMetadata),e)}function nm(t,e){t.contexts=D({trace:Fg(e)},t.contexts),t.sdkProcessingMetadata=D({dynamicSamplingContext:Yg(e)},t.sdkProcessingMetadata);let r=Zu(e),n=Wi(r).description;n&&!t.transaction&&t.type==="transaction"&&(t.transaction=n)}function im(t,e){t.fingerprint=t.fingerprint?tg(t.fingerprint):[],e&&(t.fingerprint=t.fingerprint.concat(e)),t.fingerprint&&!t.fingerprint.length&&delete t.fingerprint}function sm(t,e,r,n,i,s){let{normalizeDepth:o=3,normalizeMaxBreadth:a=1e3}=t,l=wt(D({},e),{event_id:e.event_id||r.event_id||_e(),timestamp:e.timestamp||ei()}),h=r.integrations||t.integrations.map(E=>E.name);om(l,t),lm(l,h),i&&i.emit("applyFrameMetadata",e),e.type===void 0&&am(l,t.stackParser);let g=hm(n,r.captureContext);r.mechanism&&Gn(l,r.mechanism);let p=i?i.getEventProcessors():[],_=kg().getScopeData();if(s){let E=s.getScopeData();ol(_,E)}if(g){let E=g.getScopeData();ol(_,E)}let w=[...r.attachments||[],..._.attachments];w.length&&(r.attachments=w),Xg(l,_);let b=[...p,..._.eventProcessors];return xo(b,l,r).then(E=>(E&&cm(E),typeof o=="number"&&o>0?um(E,o,a):E))}function om(t,e){let{environment:r,release:n,dist:i,maxValueLength:s=250}=e;"environment"in t||(t.environment="environment"in e?r:Xu),t.release===void 0&&n!==void 0&&(t.release=n),t.dist===void 0&&i!==void 0&&(t.dist=i),t.message&&(t.message=qr(t.message,s));let o=t.exception&&t.exception.values&&t.exception.values[0];o&&o.value&&(o.value=qr(o.value,s));let a=t.request;a&&a.url&&(a.url=qr(a.url,s))}var al=new WeakMap;function am(t,e){let r=pt._sentryDebugIds;if(!r)return;let n,i=al.get(e);i?n=i:(n=new Map,al.set(e,n));let s=Object.entries(r).reduce((o,[a,l])=>{let h,g=n.get(a);g?h=g:(h=e(a),n.set(a,h));for(let p=h.length-1;p>=0;p--){let _=h[p];if(_.filename){o[_.filename]=l;break}}return o},{});try{t.exception.values.forEach(o=>{o.stacktrace.frames.forEach(a=>{a.filename&&(a.debug_id=s[a.filename])})})}catch{}}function cm(t){let e={};try{t.exception.values.forEach(n=>{n.stacktrace.frames.forEach(i=>{i.debug_id&&(i.abs_path?e[i.abs_path]=i.debug_id:i.filename&&(e[i.filename]=i.debug_id),delete i.debug_id)})})}catch{}if(Object.keys(e).length===0)return;t.debug_meta=t.debug_meta||{},t.debug_meta.images=t.debug_meta.images||[];let r=t.debug_meta.images;Object.entries(e).forEach(([n,i])=>{r.push({type:"sourcemap",code_file:n,debug_id:i})})}function lm(t,e){e.length>0&&(t.sdk=t.sdk||{},t.sdk.integrations=[...t.sdk.integrations||[],...e])}function um(t,e,r){if(!t)return null;let n=D(D(D(D(D({},t),t.breadcrumbs&&{breadcrumbs:t.breadcrumbs.map(i=>D(D({},i),i.data&&{data:Xe(i.data,e,r)}))}),t.user&&{user:Xe(t.user,e,r)}),t.contexts&&{contexts:Xe(t.contexts,e,r)}),t.extra&&{extra:Xe(t.extra,e,r)});return t.contexts&&t.contexts.trace&&n.contexts&&(n.contexts.trace=t.contexts.trace,t.contexts.trace.data&&(n.contexts.trace.data=Xe(t.contexts.trace.data,e,r))),t.spans&&(n.spans=t.spans.map(i=>D(D({},i),i.data&&{data:Xe(i.data,e,r)}))),n}function hm(t,e){if(!e)return t;let r=t?t.clone():new He;return r.update(e),r}function pm(t){if(t)return dm(t)?{captureContext:t}:gm(t)?{captureContext:t}:t}function dm(t){return t instanceof He||typeof t=="function"}var fm=["user","level","extra","contexts","tags","fingerprint","requestSession","propagationContext"];function gm(t){return Object.keys(t).some(e=>fm.includes(e))}function mm(t,e){return _a().captureException(t,pm(e))}function eh(t,e){return _a().captureEvent(t,e)}var ym="7";function vm(t){let e=t.protocol?`${t.protocol}:`:"",r=t.port?`:${t.port}`:"";return`${e}//${t.host}${r}${t.path?`/${t.path}`:""}/api/`}function wm(t){return`${vm(t)}${t.projectId}/envelope/`}function bm(t,e){return Lf(D({sentry_key:t.publicKey,sentry_version:ym},e&&{sentry_client:`${e.name}/${e.version}`}))}function _m(t,e,r){return e||`${wm(t)}?${bm(t,r)}`}var cl=[];function Em(t,e){let r={};return e.forEach(n=>{n&&rh(t,n,r)}),r}function ll(t,e){for(let r of e)r&&r.afterAllSetup&&r.afterAllSetup(t)}function rh(t,e,r){if(r[e.name]){Nt&&it.log(`Integration skipped because it was already installed: ${e.name}`);return}if(r[e.name]=e,cl.indexOf(e.name)===-1&&typeof e.setupOnce=="function"&&(e.setupOnce(),cl.push(e.name)),e.setup&&typeof e.setup=="function"&&e.setup(t),typeof e.preprocessEvent=="function"){let n=e.preprocessEvent.bind(e);t.on("preprocessEvent",(i,s)=>n(i,s,t))}if(typeof e.processEvent=="function"){let n=e.processEvent.bind(e),i=Object.assign((s,o)=>n(s,o,t),{id:e.name});t.addEventProcessor(i)}Nt&&it.log(`Integration installed: ${e.name}`)}var ul="Not capturing exception because it's already been captured.",Sm=class{constructor(t){if(this._options=t,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],t.dsn?this._dsn=Rf(t.dsn):Nt&&it.warn("No DSN provided, client will not send events."),this._dsn){let e=_m(this._dsn,t.tunnel,t._metadata?t._metadata.sdk:void 0);this._transport=t.transport(wt(D({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this)},t.transportOptions),{url:e}))}}captureException(t,e,r){let n=_e();if(Jc(t))return Nt&&it.log(ul),n;let i=D({event_id:n},e);return this._process(this.eventFromException(t,i).then(s=>this._captureEvent(s,i,r))),i.event_id}captureMessage(t,e,r,n){let i=D({event_id:_e()},r),s=da(t)?t:String(t),o=fa(t)?this.eventFromMessage(s,e,i):this.eventFromException(t,i);return this._process(o.then(a=>this._captureEvent(a,i,n))),i.event_id}captureEvent(t,e,r){let n=_e();if(e&&e.originalException&&Jc(e.originalException))return Nt&&it.log(ul),n;let i=D({event_id:n},e),s=(t.sdkProcessingMetadata||{}).capturedSpanScope;return this._process(this._captureEvent(t,i,s||r)),i.event_id}captureSession(t){typeof t.release!="string"?Nt&&it.warn("Discarded session because of missing or non-string release"):(this.sendSession(t),Co(t,{init:!1}))}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}flush(t){let e=this._transport;return e?(this.emit("flush"),this._isClientDoneProcessing(t).then(r=>e.flush(t).then(n=>r&&n))):Dr(!0)}close(t){return this.flush(t).then(e=>(this.getOptions().enabled=!1,this.emit("close"),e))}getEventProcessors(){return this._eventProcessors}addEventProcessor(t){this._eventProcessors.push(t)}init(){this._isEnabled()&&this._setupIntegrations()}getIntegrationByName(t){return this._integrations[t]}addIntegration(t){let e=this._integrations[t.name];rh(this,t,this._integrations),e||ll(this,[t])}sendEvent(t,e={}){this.emit("beforeSendEvent",t,e);let r=Zg(t,this._dsn,this._options._metadata,this._options.tunnel);for(let i of e.attachments||[])r=pg(r,gg(i));let n=this.sendEnvelope(r);n&&n.then(i=>this.emit("afterSendEvent",t,i),null)}sendSession(t){let e=Qg(t,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(e)}recordDroppedEvent(t,e,r){if(this._options.sendClientReports){let n=`${t}:${e}`;Nt&&it.log(`Adding outcome: "${n}"`),this._outcomes[n]=(this._outcomes[n]||0)+1}}on(t,e){let r=this._hooks[t]=this._hooks[t]||[];return r.push(e),()=>{let n=r.indexOf(e);n>-1&&r.splice(n,1)}}emit(t,...e){let r=this._hooks[t];r&&r.forEach(n=>n(...e))}sendEnvelope(t){return this.emit("beforeEnvelope",t),this._isEnabled()&&this._transport?this._transport.send(t).then(null,e=>(Nt&&it.error("Error while sending event:",e),e)):(Nt&&it.error("Transport disabled"),Dr({}))}_setupIntegrations(){let{integrations:t}=this._options;this._integrations=Em(this,t),ll(this,t)}_updateSessionFromEvent(t,e){let r=!1,n=!1,i=e.exception&&e.exception.values;if(i){n=!0;for(let o of i){let a=o.mechanism;if(a&&a.handled===!1){r=!0;break}}}let s=t.status==="ok";(s&&t.errors===0||s&&r)&&(Co(t,wt(D({},r&&{status:"crashed"}),{errors:t.errors||Number(n||r)})),this.captureSession(t))}_isClientDoneProcessing(t){return new ri(e=>{let r=0,n=1,i=setInterval(()=>{this._numProcessing==0?(clearInterval(i),e(!0)):(r+=n,t&&r>=t&&(clearInterval(i),e(!1)))},n)})}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(t,e,r,n=Qu()){let i=this.getOptions(),s=Object.keys(this._integrations);return!e.integrations&&s.length>0&&(e.integrations=s),this.emit("preprocessEvent",t,e),t.type||n.setLastEventId(t.event_id||e.event_id),sm(i,t,e,r,this,n).then(o=>{if(o===null)return o;let a=D(D({},n.getPropagationContext()),r?r.getPropagationContext():void 0);if(!(o.contexts&&o.contexts.trace)&&a){let{traceId:l,spanId:h,parentSpanId:g,dsc:p}=a;o.contexts=D({trace:we({trace_id:l,span_id:h,parent_span_id:g})},o.contexts);let _=p||th(l,this);o.sdkProcessingMetadata=D({dynamicSamplingContext:_},o.sdkProcessingMetadata)}return o})}_captureEvent(t,e={},r){return this._processEvent(t,e,r).then(n=>n.event_id,n=>{if(Nt){let i=n;i.logLevel==="log"?it.log(i.message):it.warn(i)}})}_processEvent(t,e,r){let n=this.getOptions(),{sampleRate:i}=n,s=Do(t),o=nh(t),a=t.type||"error",l=`before send for type \`${a}\``,h=typeof i>"u"?void 0:Kg(i);if(o&&typeof h=="number"&&Math.random()>h)return this.recordDroppedEvent("sample_rate","error",t),Vi(new De(`Discarding event because it's not included in the random sample (sampling rate = ${i})`,"log"));let g=a==="replay_event"?"replay":a,p=(t.sdkProcessingMetadata||{}).capturedSpanIsolationScope;return this._prepareEvent(t,e,r,p).then(_=>{if(_===null)throw this.recordDroppedEvent("event_processor",g,t),new De("An event processor returned `null`, will not send event.","log");if(e.data&&e.data.__sentry__===!0)return _;let w=Cm(this,n,_,e);return Im(w,l)}).then(_=>{if(_===null){if(this.recordDroppedEvent("before_send",g,t),Do(t)){let E=1+(t.spans||[]).length;this._outcomes.span=(this._outcomes.span||0)+E}throw new De(`${l} returned \`null\`, will not send event.`,"log")}let w=r&&r.getSession();!s&&w&&this._updateSessionFromEvent(w,_);let b=_.transaction_info;if(s&&b&&_.transaction!==t.transaction){let E="custom";_.transaction_info=wt(D({},b),{source:E})}return this.sendEvent(_,e),_}).then(null,_=>{throw _ instanceof De?_:(this.captureException(_,{data:{__sentry__:!0},originalException:_}),new De(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
|
|
26
|
-
Reason: ${_}`))})}_process(t){this._numProcessing++,t.then(e=>(this._numProcessing--,e),e=>(this._numProcessing--,e))}_clearOutcomes(){let t=this._outcomes;return this._outcomes={},Object.entries(t).map(([e,r])=>{let[n,i]=e.split(":");return{reason:n,category:i,quantity:r}})}};function
|
|
27
|
-
Event: ${
|
|
28
|
-
Event: ${
|
|
29
|
-
Event: ${
|
|
30
|
-
Event: ${
|
|
31
|
-
Event: ${
|
|
32
|
-
Url: ${Gi(t)}`),!0):
|
|
33
|
-
Event: ${
|
|
34
|
-
Url: ${Gi(t)}`),!0)}function jm(t,e){return t.type||!e||!e.length?!1:Vm(t).some(r=>ss(r,e))}function $m(t,e){if(t.type!=="transaction"||!e||!e.length)return!1;let r=t.transaction;return r?ss(r,e):!1}function Fm(t,e){if(!e||!e.length)return!1;let r=Gi(t);return r?ss(r,e):!1}function Hm(t,e){if(!e||!e.length)return!0;let r=Gi(t);return r?ss(r,e):!0}function Vm(t){let e=[];t.message&&e.push(t.message);let r;try{r=t.exception.values[t.exception.values.length-1]}catch{}return r&&r.value&&(e.push(r.value),r.type&&e.push(`${r.type}: ${r.value}`)),e}function Wm(t){try{return t.exception.values[0].type==="SentryError"}catch{}return!1}function Gm(t=[]){for(let e=t.length-1;e>=0;e--){let r=t[e];if(r&&r.filename!=="<anonymous>"&&r.filename!=="[native code]")return r.filename||null}return null}function Gi(t){try{let e;try{e=t.exception.values[0].stacktrace.frames}catch{}return e?Gm(e):null}catch{return Nt&&it.error(`Cannot extract url for event ${Ze(t)}`),null}}function qm(t){return t.type||!t.exception||!t.exception.values||t.exception.values.length===0?!1:!t.message&&!t.exception.values.some(e=>e.stacktrace||e.type&&e.type!=="Error"||e.value)}var zm="Dedupe",Ym=()=>{let t;return{name:zm,processEvent(e){if(e.type)return e;try{if(Jm(e,t))return Nt&&it.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return t=e}}},Km=Ym;function Jm(t,e){return e?!!(Qm(t,e)||Zm(t,e)):!1}function Qm(t,e){let r=t.message,n=e.message;return!(!r&&!n||r&&!n||!r&&n||r!==n||!sh(t,e)||!ih(t,e))}function Zm(t,e){let r=fl(e),n=fl(t);return!(!r||!n||r.type!==n.type||r.value!==n.value||!sh(t,e)||!ih(t,e))}function ih(t,e){let r=zc(t),n=zc(e);if(!r&&!n)return!0;if(r&&!n||!r&&n||(r=r,n=n,n.length!==r.length))return!1;for(let i=0;i<n.length;i++){let s=n[i],o=r[i];if(s.filename!==o.filename||s.lineno!==o.lineno||s.colno!==o.colno||s.function!==o.function)return!1}return!0}function sh(t,e){let r=t.fingerprint,n=e.fingerprint;if(!r&&!n)return!0;if(r&&!n||!r&&n)return!1;r=r,n=n;try{return r.join("")===n.join("")}catch{return!1}}function fl(t){return t.exception&&t.exception.values&&t.exception.values[0]}var Vt=pt,No=0;function oh(){return No>0}function Xm(){No++,setTimeout(()=>{No--})}function en(t,e={},r){if(typeof t!="function")return t;try{let i=t.__sentry_wrapped__;if(i)return i;if(va(t))return t}catch{return t}let n=function(){let i=Array.prototype.slice.call(arguments);try{r&&typeof r=="function"&&r.apply(this,arguments);let s=i.map(o=>en(o,e));return t.apply(this,s)}catch(s){throw Xm(),Pg(o=>{o.addEventProcessor(a=>(e.mechanism&&(Eo(a,void 0,void 0),Gn(a,e.mechanism)),a.extra=wt(D({},a.extra),{arguments:i}),a)),mm(s)}),s}};try{for(let i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i])}catch{}Wu(n,t),Tr(t,"__sentry_wrapped__",n);try{Object.getOwnPropertyDescriptor(n,"name").configurable&&Object.defineProperty(n,"name",{get(){return t.name}})}catch{}return n}var Vr=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function Ea(t,e){let r=Sa(t,e),n={type:e&&e.name,value:iy(e)};return r.length&&(n.stacktrace={frames:r}),n.type===void 0&&n.value===""&&(n.value="Unrecoverable error caught"),n}function ty(t,e,r,n){let i=oe(),s=i&&i.getOptions().normalizeDepth,o=ly(e),a={__serialized__:Yu(e,s)};if(o)return{exception:{values:[Ea(t,o)]},extra:a};let l={exception:{values:[{type:ns(e)?e.constructor.name:n?"UnhandledRejection":"Error",value:ay(e,{isUnhandledRejection:n})}]},extra:a};if(r){let h=Sa(t,r);h.length&&(l.exception.values[0].stacktrace={frames:h})}return l}function Ms(t,e){return{exception:{values:[Ea(t,e)]}}}function Sa(t,e){let r=e.stacktrace||e.stack||"",n=ry(e),i=ny(e);try{return t(r,n,i)}catch{}return[]}var ey=/Minified React error #\d+;/i;function ry(t){return t&&ey.test(t.message)?1:0}function ny(t){return typeof t.framesToPop=="number"?t.framesToPop:0}function iy(t){let e=t&&t.message;return e?e.error&&typeof e.error.message=="string"?e.error.message:e:"No error message"}function sy(t,e,r,n){let i=r&&r.syntheticException||void 0,s=Ia(t,e,i,n);return Gn(s),s.level="error",r&&r.event_id&&(s.event_id=r.event_id),Dr(s)}function oy(t,e,r="info",n,i){let s=n&&n.syntheticException||void 0,o=Ao(t,e,s,i);return o.level=r,n&&n.event_id&&(o.event_id=n.event_id),Dr(o)}function Ia(t,e,r,n,i){let s;if($u(e)&&e.error)return Ms(t,e.error);if(jc(e)||yf(e)){let o=e;if("stack"in e)s=Ms(t,e);else{let a=o.name||(jc(o)?"DOMError":"DOMException"),l=o.message?`${a}: ${o.message}`:a;s=Ao(t,l,r,n),Eo(s,l)}return"code"in o&&(s.tags=wt(D({},s.tags),{"DOMException.code":`${o.code}`})),s}return pa(e)?Ms(t,e):Xr(e)||ns(e)?(s=ty(t,e,r,i),Gn(s,{synthetic:!0}),s):(s=Ao(t,e,r,n),Eo(s,`${e}`,void 0),Gn(s,{synthetic:!0}),s)}function Ao(t,e,r,n){let i={};if(n&&r){let s=Sa(t,r);s.length&&(i.exception={values:[{value:e,stacktrace:{frames:s}}]})}if(da(e)){let{__sentry_template_string__:s,__sentry_template_values__:o}=e;return i.logentry={message:s,params:o},i}return i.message=e,i}function ay(t,{isUnhandledRejection:e}){let r=Uf(t),n=e?"promise rejection":"exception";return $u(t)?`Event \`ErrorEvent\` captured as ${n} with message \`${t.message}\``:ns(t)?`Event \`${cy(t)}\` (type=${t.type}) captured as ${n}`:`Object captured as ${n} with keys: ${r}`}function cy(t){try{let e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch{}}function ly(t){for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)){let r=t[e];if(r instanceof Error)return r}}function uy(t,{metadata:e,tunnel:r,dsn:n}){let i=D(D({event_id:t.event_id,sent_at:new Date().toISOString()},e&&e.sdk&&{sdk:{name:e.sdk.name,version:e.sdk.version}}),!!r&&!!n&&{dsn:os(n)}),s=hy(t);return ni(i,[s])}function hy(t){return[{type:"user_report"},t]}var py=class extends Sm{constructor(t){let e=D({parentSpanIsAlwaysRootSpan:!0},t),r=Vt.SENTRY_SDK_SOURCE||Zf();Dm(e,"browser",["browser"],r),super(e),e.sendClientReports&&Vt.document&&Vt.document.addEventListener("visibilitychange",()=>{Vt.document.visibilityState==="hidden"&&this._flushOutcomes()})}eventFromException(t,e){return sy(this._options.stackParser,t,e,this._options.attachStacktrace)}eventFromMessage(t,e="info",r){return oy(this._options.stackParser,t,e,r,this._options.attachStacktrace)}captureUserFeedback(t){if(!this._isEnabled()){Vr&&it.warn("SDK not enabled, will not capture user feedback.");return}let e=uy(t,{metadata:this.getSdkMetadata(),dsn:this.getDsn(),tunnel:this.getOptions().tunnel});this.sendEnvelope(e)}_prepareEvent(t,e,r){return t.platform=t.platform||"javascript",super._prepareEvent(t,e,r)}_flushOutcomes(){let t=this._clearOutcomes();if(t.length===0){Vr&&it.log("No outcomes to send");return}if(!this._dsn){Vr&&it.log("No dsn provided, will not send outcomes");return}Vr&&it.log("Sending outcomes:",t);let e=vg(t,this._options.tunnel&&os(this._dsn));this.sendEnvelope(e)}},dy=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,Yt=pt,fy=1e3,gl,Oo,ko;function gy(t){let e="dom";kr(e,t),Pr(e,my)}function my(){if(!Yt.document)return;let t=be.bind(null,"dom"),e=ml(t,!0);Yt.document.addEventListener("click",e,!1),Yt.document.addEventListener("keypress",e,!1),["EventTarget","Node"].forEach(r=>{let n=Yt[r]&&Yt[r].prototype;!n||!n.hasOwnProperty||!n.hasOwnProperty("addEventListener")||(Wt(n,"addEventListener",function(i){return function(s,o,a){if(s==="click"||s=="keypress")try{let l=this,h=l.__sentry_instrumentation_handlers__=l.__sentry_instrumentation_handlers__||{},g=h[s]=h[s]||{refCount:0};if(!g.handler){let p=ml(t);g.handler=p,i.call(this,s,p,a)}g.refCount++}catch{}return i.call(this,s,o,a)}}),Wt(n,"removeEventListener",function(i){return function(s,o,a){if(s==="click"||s=="keypress")try{let l=this,h=l.__sentry_instrumentation_handlers__||{},g=h[s];g&&(g.refCount--,g.refCount<=0&&(i.call(this,s,g.handler,a),g.handler=void 0,delete h[s]),Object.keys(h).length===0&&delete l.__sentry_instrumentation_handlers__)}catch{}return i.call(this,s,o,a)}}))})}function yy(t){if(t.type!==Oo)return!1;try{if(!t.target||t.target._sentryId!==ko)return!1}catch{}return!0}function vy(t,e){return t!=="keypress"?!1:!e||!e.tagName?!0:!(e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable)}function ml(t,e=!1){return r=>{if(!r||r._sentryCaptured)return;let n=wy(r);if(vy(r.type,n))return;Tr(r,"_sentryCaptured",!0),n&&!n._sentryId&&Tr(n,"_sentryId",_e());let i=r.type==="keypress"?"input":r.type;yy(r)||(t({event:r,name:i,global:e}),Oo=r.type,ko=n?n._sentryId:void 0),clearTimeout(gl),gl=Yt.setTimeout(()=>{ko=void 0,Oo=void 0},fy)}}function wy(t){try{return t.target}catch{return null}}var _i;function by(t){let e="history";kr(e,t),Pr(e,_y)}function _y(){if(!Sg())return;let t=Yt.onpopstate;Yt.onpopstate=function(...r){let n=Yt.location.href,i=_i;if(_i=n,be("history",{from:i,to:n}),t)try{return t.apply(this,r)}catch{}};function e(r){return function(...n){let i=n.length>2?n[2]:void 0;if(i){let s=_i,o=String(i);_i=o,be("history",{from:s,to:o})}return r.apply(this,n)}}Wt(Yt.history,"pushState",e),Wt(Yt.history,"replaceState",e)}var Ri={};function Ey(t){let e=Ri[t];if(e)return e;let r=Yt[t];if(bo(r))return Ri[t]=r.bind(Yt);let n=Yt.document;if(n&&typeof n.createElement=="function")try{let i=n.createElement("iframe");i.hidden=!0,n.head.appendChild(i);let s=i.contentWindow;s&&s[t]&&(r=s[t]),n.head.removeChild(i)}catch(i){dy&&it.warn(`Could not create sandbox iframe for ${t} check, bailing to window.${t}: `,i)}return r&&(Ri[t]=r.bind(Yt))}function yl(t){Ri[t]=void 0}var kn="__sentry_xhr_v3__";function Sy(t){let e="xhr";kr(e,t),Pr(e,Iy)}function Iy(){if(!Yt.XMLHttpRequest)return;let t=XMLHttpRequest.prototype;Wt(t,"open",function(e){return function(...r){let n=sr()*1e3,i=$e(r[0])?r[0].toUpperCase():void 0,s=Cy(r[1]);if(!i||!s)return e.apply(this,r);this[kn]={method:i,url:s,request_headers:{}},i==="POST"&&s.match(/sentry_key/)&&(this.__sentry_own_request__=!0);let o=()=>{let a=this[kn];if(a&&this.readyState===4){try{a.status_code=this.status}catch{}let l={endTimestamp:sr()*1e3,startTimestamp:n,xhr:this};be("xhr",l)}};return"onreadystatechange"in this&&typeof this.onreadystatechange=="function"?Wt(this,"onreadystatechange",function(a){return function(...l){return o(),a.apply(this,l)}}):this.addEventListener("readystatechange",o),Wt(this,"setRequestHeader",function(a){return function(...l){let[h,g]=l,p=this[kn];return p&&$e(h)&&$e(g)&&(p.request_headers[h.toLowerCase()]=g),a.apply(this,l)}}),e.apply(this,r)}}),Wt(t,"send",function(e){return function(...r){let n=this[kn];if(!n)return e.apply(this,r);r[0]!==void 0&&(n.body=r[0]);let i={startTimestamp:sr()*1e3,xhr:this};return be("xhr",i),e.apply(this,r)}})}function Cy(t){if($e(t))return t;try{return t.toString()}catch{}}function Ty(t,e=Ey("fetch")){let r=0,n=0;function i(s){let o=s.body.length;r+=o,n++;let a=D({body:s.body,method:"POST",referrerPolicy:"origin",headers:t.headers,keepalive:r<=6e4&&n<15},t.fetchOptions);if(!e)return yl("fetch"),Vi("No fetch implementation available");try{return e(t.url,a).then(l=>(r-=o,n--,{statusCode:l.status,headers:{"x-sentry-rate-limits":l.headers.get("X-Sentry-Rate-Limits"),"retry-after":l.headers.get("Retry-After")}}))}catch(l){return yl("fetch"),r-=o,n--,Vi(l)}}return xm(t,i)}var xy=30,Dy=50;function Po(t,e,r,n){let i={filename:t,function:e==="<anonymous>"?xr:e,in_app:!0};return r!==void 0&&(i.lineno=r),n!==void 0&&(i.colno=n),i}var Ny=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Ay=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Oy=/\((\S*)(?::(\d+))(?::(\d+))\)/,ky=t=>{let e=Ny.exec(t);if(e){let[,n,i,s]=e;return Po(n,xr,+i,+s)}let r=Ay.exec(t);if(r){if(r[2]&&r[2].indexOf("eval")===0){let s=Oy.exec(r[2]);s&&(r[2]=s[1],r[3]=s[2],r[4]=s[3])}let[n,i]=ah(r[1]||xr,r[2]);return Po(i,n,r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},Py=[xy,ky],Ry=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Ly=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Uy=t=>{let e=Ry.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){let i=Ly.exec(e[3]);i&&(e[1]=e[1]||"eval",e[3]=i[1],e[4]=i[2],e[5]="")}let r=e[3],n=e[1]||xr;return[n,r]=ah(n,r),Po(r,n,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},My=[Dy,Uy],By=[Py,My],jy=Bf(...By),ah=(t,e)=>{let r=t.indexOf("safari-extension")!==-1,n=t.indexOf("safari-web-extension")!==-1;return r||n?[t.indexOf("@")!==-1?t.split("@")[0]:xr,r?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]},Ei=1024,$y="Breadcrumbs",Fy=(t={})=>{let e=D({console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0},t);return{name:$y,setup(r){e.console&&$f(Gy(r)),e.dom&&gy(Wy(r,e.dom)),e.xhr&&Sy(qy(r)),e.fetch&&Gf(zy(r)),e.history&&by(Yy(r)),e.sentry&&r.on("beforeSendEvent",Vy(r))}}},Hy=Fy;function Vy(t){return function(e){oe()===t&&Nr({category:`sentry.${e.type==="transaction"?"transaction":"event"}`,event_id:e.event_id,level:e.level,message:Ze(e)},{event:e})}}function Wy(t,e){return function(r){if(oe()!==t)return;let n,i,s=typeof e=="object"?e.serializeAttribute:void 0,o=typeof e=="object"&&typeof e.maxStringLength=="number"?e.maxStringLength:void 0;o&&o>Ei&&(Vr&&it.warn(`\`dom.maxStringLength\` cannot exceed ${Ei}, but a value of ${o} was configured. Sentry will use ${Ei} instead.`),o=Ei),typeof s=="string"&&(s=[s]);try{let l=r.event,h=Ky(l)?l.target:l;n=Hu(h,{keyAttrs:s,maxStringLength:o}),i=xf(h)}catch{n="<unknown>"}if(n.length===0)return;let a={category:`ui.${r.name}`,message:n};i&&(a.data={"ui.component_name":i}),Nr(a,{event:r.event,name:r.name,global:r.global})}}function Gy(t){return function(e){if(oe()!==t)return;let r={category:"console",data:{arguments:e.args,logger:"console"},level:ag(e.level),message:$c(e.args," ")};if(e.level==="assert")if(e.args[0]===!1)r.message=`Assertion failed: ${$c(e.args.slice(1)," ")||"console.assert"}`,r.data.arguments=e.args.slice(1);else return;Nr(r,{input:e.args,level:e.level})}}function qy(t){return function(e){if(oe()!==t)return;let{startTimestamp:r,endTimestamp:n}=e,i=e.xhr[kn];if(!r||!n||!i)return;let{method:s,url:o,status_code:a,body:l}=i,h={method:s,url:o,status_code:a},g={xhr:e.xhr,input:l,startTimestamp:r,endTimestamp:n};Nr({category:"xhr",data:h,type:"http"},g)}}function zy(t){return function(e){if(oe()!==t)return;let{startTimestamp:r,endTimestamp:n}=e;if(n&&!(e.fetchData.url.match(/sentry_key/)&&e.fetchData.method==="POST"))if(e.error){let i=e.fetchData,s={data:e.error,input:e.args,startTimestamp:r,endTimestamp:n};Nr({category:"fetch",data:i,level:"error",type:"http"},s)}else{let i=e.response,s=wt(D({},e.fetchData),{status_code:i&&i.status}),o={input:e.args,response:i,startTimestamp:r,endTimestamp:n};Nr({category:"fetch",data:s,type:"http"},o)}}}function Yy(t){return function(e){if(oe()!==t)return;let r=e.from,n=e.to,i=Us(Vt.location.href),s=r?Us(r):void 0,o=Us(n);(!s||!s.path)&&(s=i),i.protocol===o.protocol&&i.host===o.host&&(n=o.relative),i.protocol===s.protocol&&i.host===s.host&&(r=s.relative),Nr({category:"navigation",data:{from:r,to:n}})}}function Ky(t){return!!t&&!!t.target}var Jy=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","BroadcastChannel","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","SharedWorker","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],Qy="BrowserApiErrors",Zy=(t={})=>{let e=D({XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0},t);return{name:Qy,setupOnce(){e.setTimeout&&Wt(Vt,"setTimeout",vl),e.setInterval&&Wt(Vt,"setInterval",vl),e.requestAnimationFrame&&Wt(Vt,"requestAnimationFrame",tv),e.XMLHttpRequest&&"XMLHttpRequest"in Vt&&Wt(XMLHttpRequest.prototype,"send",ev);let r=e.eventTarget;r&&(Array.isArray(r)?r:Jy).forEach(rv)}}},Xy=Zy;function vl(t){return function(...e){let r=e[0];return e[0]=en(r,{mechanism:{data:{function:ar(t)},handled:!1,type:"instrument"}}),t.apply(this,e)}}function tv(t){return function(e){return t.apply(this,[en(e,{mechanism:{data:{function:"requestAnimationFrame",handler:ar(t)},handled:!1,type:"instrument"}})])}}function ev(t){return function(...e){let r=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(n=>{n in r&&typeof r[n]=="function"&&Wt(r,n,function(i){let s={mechanism:{data:{function:n,handler:ar(i)},handled:!1,type:"instrument"}},o=va(i);return o&&(s.mechanism.data.handler=ar(o)),en(i,s)})}),t.apply(this,e)}}function rv(t){let e=Vt,r=e[t]&&e[t].prototype;!r||!r.hasOwnProperty||!r.hasOwnProperty("addEventListener")||(Wt(r,"addEventListener",function(n){return function(i,s,o){try{typeof s.handleEvent=="function"&&(s.handleEvent=en(s.handleEvent,{mechanism:{data:{function:"handleEvent",handler:ar(s),target:t},handled:!1,type:"instrument"}}))}catch{}return n.apply(this,[i,en(s,{mechanism:{data:{function:"addEventListener",handler:ar(s),target:t},handled:!1,type:"instrument"}}),o])}}),Wt(r,"removeEventListener",function(n){return function(i,s,o){let a=s;try{let l=a&&a.__sentry_wrapped__;l&&n.call(this,i,l,o)}catch{}return n.call(this,i,a,o)}}))}var nv="GlobalHandlers",iv=(t={})=>{let e=D({onerror:!0,onunhandledrejection:!0},t);return{name:nv,setupOnce(){Error.stackTraceLimit=50},setup(r){e.onerror&&(ov(r),wl("onerror")),e.onunhandledrejection&&(av(r),wl("onunhandledrejection"))}}},sv=iv;function ov(t){Yf(e=>{let{stackParser:r,attachStacktrace:n}=ch();if(oe()!==t||oh())return;let{msg:i,url:s,line:o,column:a,error:l}=e,h=uv(Ia(r,l||i,void 0,n,!1),s,o,a);h.level="error",eh(h,{originalException:l,mechanism:{handled:!1,type:"onerror"}})})}function av(t){Jf(e=>{let{stackParser:r,attachStacktrace:n}=ch();if(oe()!==t||oh())return;let i=cv(e),s=fa(i)?lv(i):Ia(r,i,void 0,n,!0);s.level="error",eh(s,{originalException:i,mechanism:{handled:!1,type:"onunhandledrejection"}})})}function cv(t){if(fa(t))return t;try{if("reason"in t)return t.reason;if("detail"in t&&"reason"in t.detail)return t.detail.reason}catch{}return t}function lv(t){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(t)}`}]}}}function uv(t,e,r,n){let i=t.exception=t.exception||{},s=i.values=i.values||[],o=s[0]=s[0]||{},a=o.stacktrace=o.stacktrace||{},l=a.frames=a.frames||[],h=isNaN(parseInt(n,10))?void 0:n,g=isNaN(parseInt(r,10))?void 0:r,p=$e(e)&&e.length>0?e:Tf();return l.length===0&&l.push({colno:h,filename:p,function:xr,in_app:!0,lineno:g}),t}function wl(t){Vr&&it.log(`Global Handler attached: ${t}`)}function ch(){let t=oe();return t&&t.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}var hv=()=>({name:"HttpContext",preprocessEvent(t){if(!Vt.navigator&&!Vt.location&&!Vt.document)return;let e=t.request&&t.request.url||Vt.location&&Vt.location.href,{referrer:r}=Vt.document||{},{userAgent:n}=Vt.navigator||{},i=D(D(D({},t.request&&t.request.headers),r&&{Referer:r}),n&&{"User-Agent":n}),s=wt(D(D({},t.request),e&&{url:e}),{headers:i});t.request=s}}),pv="cause",dv=5,fv="LinkedErrors",gv=(t={})=>{let e=t.limit||dv,r=t.key||pv;return{name:fv,preprocessEvent(n,i,s){let o=s.getOptions();Ef(Ea,o.stackParser,o.maxValueLength,r,e,n,i)}}},mv=gv;function yv(t){return[Um(),km(),Xy(),Hy(),sv(),mv(),Km(),hv()]}var vv=class extends Error{cause;constructor(t,e){super(t),this.cause=e}},Kt=class lh{static INSTANCE;contexts={};tags;client;user;constructor(){this.init()}static getInstance(){return this.INSTANCE||(this.INSTANCE=new lh),this.INSTANCE}captureException(e,r,n){x.error(e),this.getNewScope(r,n).captureException(e)}captureMessage(e,r,n,i){this.getNewScope(n,i).captureMessage(e,r??"error")}captureError(e,r,n,i){x.error(e,r);let s=this.getNewScope(n,i),o=new vv(e,r);s.captureException(o)}setGlobalContext(e,r){this.contexts[e]=D({context:r},this.contexts[e])}setUser(e){this.user=e}setTags(e){this.tags=e}getNewScope(e,r){let n=new He;if(n.setClient(this.client),n.setUser(this.user),e?.triggerContext){let i=e.triggerContext;n.setExtras(i.triggerData.sentryContext()),delete e.triggerContext}return e&&n.setExtras(e),this.tags&&n.setTags(this.tags),r&&n.setTags(r),Object.keys(this.contexts).forEach(i=>{n.setContext(i,this.contexts[i])}),n.setTag("language",navigator.language),n.setTag("timezone",Ev()),n}init(){let e=yv({}).filter(r=>!["BrowserApiErrors","Breadcrumbs","GlobalHandlers"].includes(r.name));this.client=new py({dsn:"https://1bc3dda4c861f60cd6be1b67584f4bc6@o559187.ingest.us.sentry.io/4507626484203520",transport:Ty,stackParser:jy,integrations:e,environment:ke.mode,release:`web-sdk@${q.SDK_VERSION}`,debug:ke.debug}),this.client.init()}},wv=class{static format(t,e){let r=/{{\s*(\w+)\s*}}/;return e.replace(r,(n,i)=>{switch(i){case"amount":return this.formatWithDelimiters(t,2);case"amount_no_decimals":return this.formatWithDelimiters(t,0);case"amount_with_comma_separator":return this.formatWithDelimiters(t,2,".",",");case"amount_no_decimals_with_comma_separator":return this.formatWithDelimiters(t,0,".",",");case"amount_with_apostrophe_separator":return this.formatWithDelimiters(t,2,"'",".");case"amount_no_decimals_with_space_separator":return this.formatWithDelimiters(t,0," ");case"amount_with_space_separator":return this.formatWithDelimiters(t,2," ",",");case"amount_with_period_and_space_separator":return this.formatWithDelimiters(t,2," ",".");default:return n}})}static formatWithDelimiters(t,e=2,r=",",n="."){if(isNaN(t)||t==null)return"0";let i=(t/100).toFixed(e).split("."),s=i[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+r),o=i[1]?n+i[1]:"";return s+o}};function uh(t){try{return new URL(t)}catch{return}}function bl(t){return!t||t==="null"||t==="undefined"}function bv(t,e){let r=t.indexOf(e);return r===-1?!1:(t.splice(r,1),!0)}function Ne(t,e){if(t==0&&e)return"Free";let r=Pt.get(),n=se.get(),i=r.shopCurrencyCode||n.currency,s=r.currencyCode;s||x.warn("Currency code is not set in RuntimeData");let o=n.money?.format??r.moneyFormat,a;if(o&&i===s)a=wv.format(t*100,o);else{let l;try{l=new Intl.NumberFormat(hh(),{style:"currency",currency:s||i,minimumFractionDigits:0,maximumFractionDigits:2})}catch(h){return Kt.getInstance().captureException(h,{currentCurrency:s,shopCurrency:i}),""}a=l.format(t),a=a.replace("\u20B9","Rs. "),n.money?.showCurrency&&s!=="INR"&&(a=a.concat(` ${s}`))}return a}function _v(t){return new Intl.NumberFormat(hh(),{notation:"compact"}).format(t)}function hh(){return navigator.languages!==void 0?navigator.languages[0].split("-")[0]:navigator.language??"en"}var Si;function Ev(){if(Si)return Si;try{return Si=Intl.DateTimeFormat().resolvedOptions().timeZone,Si}catch{return""}}function Ca(t){document.readyState==="complete"?t():document.addEventListener("readystatechange",()=>{document.readyState==="complete"&&t()})}function tr(t){let e=document.createElement("span");e.id="snackbar",e.innerText=t,document.body.appendChild(e),e.className="show",setTimeout(()=>{e.classList.remove("show"),document.body.removeChild(e)},3e3)}async function ph(t,e=10,r=document){let n=0,i=document.querySelectorAll("nonexistent-tag");for(;n<e;){let s=Math.min(100*2**n,5e3);if(await mf.JSUtils.sleep(s),i=r.querySelectorAll(t),i.length)return x.debug(`Attempt ${n+1}: ${i.length} elements found with ${t}`),i;x.debug(`Attempt ${n+1}: Elements not found with ${t}. Retrying after ${s}ms.`),n++}return x.warn(`Max attempts reached. Element not found with ${t}.`),i}async function qi(t,e=10,r=document){return(await ph(t,e,r)).item(0)}function Sv(t,e,r=document.body){let n=new MutationObserver(i=>{i.forEach(s=>{s.removedNodes.forEach(o=>{(o===t||o.contains(t))&&(e(),n.disconnect())})})});n.observe(r,{childList:!0})}async function dh(){let t=await Ut.get(at.DEVICE_ID),e=await re.get(at.ID,"");return[{key:"letscooee_did",value:t},{key:"letscooee_sid",value:e},{key:"__letscooee_time",value:new Date().toLocaleString()},{key:"__letscooee_via",value:"Buy Now"}]}function Pn(t,e,r){Object.defineProperty(t,e,{enumerable:!1,configurable:!1,writable:!1,value:r})}var Iv=class{url;alt;constructor(t){t.alt&&(this.alt=t.alt),this.url=t.url}},Cv=class{d;cmp;effective;constructor(t={}){this.d=t.d,this.cmp=t.cmp,this.effective=this.d}},Tv=class{id;mID;name;groupID;groupName;isSelected;constructor(t){t??={},this.id=t.id,this.mID=t.mID,this.name=t.name,this.groupID=t.groupID,this.groupName=t.groupName,this.isSelected=t.isSelected??!1}},cs=class{mID;name;imgs;link;price;sku;isAvailable;quantity;sellingPlans;selectedSellingPlan;effectivePrice;constructor(t){t=t??{},this.mID=t.mID,this.name=t.name,this.imgs=t.imgs?.map(e=>new Iv(e))??[],this.link=t.link,this.price=new Cv(t.price),this.sku=t.sku,this.isAvailable=t.isAvailable,this.quantity=t.quantity,this.effectivePrice=Ir(this.price.effective),t.sellingPlans?.length&&(this.selectedSellingPlan=Ir(void 0)),this.sellingPlans=t.sellingPlans?.map(e=>{let r=new Tv(e);return r.isSelected&&(this.selectedSellingPlan.value=r),r})}getOneImage(){return this.imgs[0]?.url}changeSellingPlan(t){this.selectedSellingPlan.value=t}hasEffectivePrice(){return this.effectivePrice.value!==this.price.d}},Fe=class{id;mID;name;status;ctg;imgs;videos;portraitVideos;vars;desc;sDesc;link;slug;quantity;category;meta;reviews;tags;selectedOrFirstVariant;selected=Ir(!0);constructor(t){this.update(t),this.selectedOrFirstVariant=Ir(this.selectedVariant)}get imageURL(){return this.imgs?.[0]?.url}get secondaryImageURL(){return this.imgs?.[1]?.url}get getVariantImages(){return this.selectedOrFirstVariant.value.imgs}get variantImage(){return this.getVariantImages[0]?.url}get variantSecondaryImage(){return this.getVariantImages[1]?.url}set variants(t){this.vars=t,this.selectedOrFirstVariant.value=this.selectedVariant}get selectedVariant(){return this.vars.find(t=>t.isAvailable)??this.vars[0]}update(t){return this.id=t.id,this.mID=t.mID,this.name=t.name,this.status=t.status,this.ctg=t.ctg,this.imgs=t.imgs,this.desc=t.desc,this.sDesc=t.sDesc,this.link=t.link,this.slug=t.slug,this.quantity=t.quantity,this.meta=t.meta,this.category=t.category,this.videos=t.videos,this.reviews=t.reviews,this.portraitVideos=t.videos?.filter(e=>e.orientation==="PORTRAIT"),this.tags=t.tags,t.vars&&(this.vars=t.vars.map(e=>new cs(e))),this}toEmbed(t){return t=t??this.selectedOrFirstVariant.value,new pn({id:this.id,mID:this.mID,vID:t.mID,vName:t.name,name:this.name,link:this.link,slug:this.slug,price:t.price.d,imageURL:t.getOneImage()??this.imgs?.[0].url})}getTemplateVariables(){let t=this.selectedOrFirstVariant.value,e=t.price,r=this.name,n=this.category,i=Ne(e.d,!0),s=this.variantImage??this.imageURL,o=this.meta,a=this.tags?.join(",")??"",l=this.reviews?.rating,h=this.reviews?.totalReviews,g=e.cmp&&e.cmp>e.d,p={name:r,price:i,image_url:s,meta:o,category:n,rating:l,reviews:h,tags:a};if(t.hasEffectivePrice()&&(p.effective_price=Ne(t.effectivePrice.value)),g){p.compare_price=Ne(e.cmp);let w=e.cmp-e.d;p.discount_percent=(w/e.cmp*100).toFixed(0),p.discount_price=Ne(w)}let _={name:t.name,quantity:t.quantity};return{product:p,variant:_}}},xv=class{id;mID;handle;title;imageURL;constructor(t){t??={},this.id=t.id,this.mID=t.mID,this.handle=t.handle,this.title=t.title,this.imageURL=t.imageURL}},Dv=class{enabled;constructor(t){this.enabled=t.enabled}},Nv=class extends Dv{max;min;constructor(t){t??={},super(t),this.min=t.min,this.max=t.max}},Av=class{productQuantity;constructor(t){t??={},this.productQuantity=new Nv(t.productQuantity)}},fh=class{s;g;i;constructor(t){t.s&&(this.s=new ie(t.s)),t.g&&(this.g=new Uv(t.g)),this.i=t.i}get solid(){return this.s}get glossy(){return this.g}get img(){return this.i}},qn="a-f\\d",Ov=`#?[${qn}]{3}[${qn}]?`,kv=`#?[${qn}]{6}([${qn}]{2})?`,Pv=new RegExp(`[^#${qn}]`,"gi"),Rv=new RegExp(`^${Ov}$|^${kv}$`,"i");function Lv(t,e={}){if(typeof t!="string"||Pv.test(t)||!Rv.test(t))throw new TypeError("Expected a valid hex string");t=t.replace(/^#/,"");let r=1;t.length===8&&(r=Number.parseInt(t.slice(6,8),16)/255,t=t.slice(0,6)),t.length===4&&(r=Number.parseInt(t.slice(3,4).repeat(2),16)/255,t=t.slice(0,3)),t.length===3&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]);let n=Number.parseInt(t,16),i=n>>16,s=n>>8&255,o=n&255,a=typeof e.alpha=="number"?e.alpha:r;if(e.format==="array")return[i,s,o,a];if(e.format==="css"){let l=a===1?"":` / ${Number((a*100).toFixed(2))}%`;return`rgb(${i} ${s} ${o}${l})`}return{red:i,green:s,blue:o,alpha:a}}var ie=class{h;a=100;g;constructor(t){t??={},this.h=t.h,this.a=t.a,this.g=t.g}get hex(){return this.h}get grad(){return this.g}get rgba(){if(!this.hex)return"";try{return Lv(this.hex,{format:"css",alpha:this.getAlpha()})}catch(t){return console.error("Invalid hex",t),"#000000"}}getAlpha(){return(this.a??100)/100}},Ta=class{s;r;w;c;constructor(t){this.s=t.s,this.r=t.r,this.w=t.w,t.c&&(this.c=new ie(t.c))}get radius(){return this.r}get width(){return this.w}get color(){return this.c}get style(){return xa[this.s??1]}},xa=(t=>(t[t.SOLID=1]="SOLID",t[t.DASHED=2]="DASHED",t))(xa||{}),Uv=class gh{static DEFAULT_FALLBACK=new ie({h:"#000000",a:50});r;c;fb;constructor(e){this.r=e.r,e.c&&(this.c=new ie(e.c)),e.fb&&(this.fb=new ie(e.fb))}get radius(){return this.r}get color(){return this.c}get fallback(){return this.fb??gh.DEFAULT_FALLBACK}},Mv=class{blur;spr;clr;x;y;constructor(t){t=t??{},this.blur=t.blur??0,this.spr=t.spr??0,this.x=t.x??0,this.y=t.y??0,this.clr=new ie(t.clr)}getStyle(t){return`${this.x*t}px ${this.y*t}px ${this.blur*t}px ${this.spr*t}px ${this.clr.rgba}`}},Da=class{pl;pr;pt;pb;ml;mr;mt;mb;cent;constructor(t){t=t??{},this.pl=t.pl??0,this.pr=t.pr??0,this.pt=t.pt??0,this.pb=t.pb??0,this.ml=t.ml??0,this.mr=t.mr??0,this.mt=t.mt??0,this.mb=t.mb??0,this.cent=t.cent??!1}getHorizontal(){return this.pl+this.pr}getVertical(){return this.pt+this.pb}getPaddingCSS(){return`${this.pt}px ${this.pr}px ${this.pb}px ${this.pl}px`}},mh=class{rot;constructor(t){t?.rot&&(this.rot=t.rot)}get rotate(){return this.rot}},ii=class{t;bg;br;clc;shd;spc;trf;a;w;h;x;y;constructor(t){this.t=t.t,t.bg&&(this.bg=new fh(t.bg)),t.br&&(this.br=new Ta(t.br)),t.shd&&(this.shd=new Mv(t.shd)),t.spc&&(this.spc=new Da(t.spc)),this.trf=new mh(t.trf),this.clc=t.clc,this.w=t.w,this.h=t.h,this.x=t.x,this.y=t.y,this.a=t.a}get alpha(){return this.a??100}get type(){return this.t}get typeAsString(){return Na[this.t]}get click(){return this.clc}},Na=(t=>(t[t.IMAGE=1]="IMAGE",t[t.TEXT=2]="TEXT",t[t.BUTTON=3]="BUTTON",t[t.FLEXBOX=4]="FLEXBOX",t[t.MULTI_COLUMN=5]="MULTI_COLUMN",t[t.CHECKBOX=6]="CHECKBOX",t[t.PRODUCTS=11]="PRODUCTS",t[t.PRODUCT=12]="PRODUCT",t[t.PRODUCT_IMAGE=13]="PRODUCT_IMAGE",t[t.PRODUCT_TITLE=14]="PRODUCT_TITLE",t[t.PRODUCT_VARIATIONS=15]="PRODUCT_VARIATIONS",t[t.PRODUCT_VARIATIONS_SELLING_PLANS=16]="PRODUCT_VARIATIONS_SELLING_PLANS",t[t.PRODUCT_BUTTON=18]="PRODUCT_BUTTON",t[t.PRODUCT_RATING=19]="PRODUCT_RATING",t[t.EMAIL_INPUT=51]="EMAIL_INPUT",t[t.PHONE_INPUT=52]="PHONE_INPUT",t[t.COUNTDOWN_TIMER=61]="COUNTDOWN_TIMER",t[t.CAROUSEL=62]="CAROUSEL",t[t.SHAPE=100]="SHAPE",t))(Na||{}),yh=class extends ii{constructor(t){super(t)}},Aa=class extends ii{src;constructor(t){super(t),this.src=t.src}},Oa=(t=>(t[t.START=0]="START",t[t.CENTER=1]="CENTER",t[t.END=2]="END",t[t.JUSTIFY=3]="JUSTIFY",t))(Oa||{}),Bv=class{name;fonts;constructor(t){t=t??{},t.name&&(t.name=t.name!=="Arial"?t.name:""),this.name=t.name,this.fonts=t.fonts?.map(e=>new jv(e))}},jv=class{style;url;constructor(t){t=t??{},this.style=t.style,this.url=t.url}getFontDescriptor(){return{style:this.style===2||this.style===4?"italic":"normal",weight:this.style===4||this.style===3?"700":"400"}}getURL(){return`url('${this.url}') format('truetype')`}},Ve=class{fw;fs;fam;fmly;lh=1.2;ls;s;tc;ta;td;tdc;constructor(t){this.update(t)}get alignment(){return Oa[this.ta]}get letterSpacing(){return this.ls?this.ls+"px":"normal"}update(t){t=t??{},t.lh&&(this.lh=t.lh),t.tdc&&(this.tdc=new ie(t.tdc)),this.td=t.td,this.fs=t.s??t.fs??60,this.tc=new ie(t.tc),this.ta=t.ta??1,this.fw=t.fw??400,this.ls=t.ls??0,this.tc.h??="#000000",this.fam=new Bv(t.fam??t.fmly)}resize(t){this.s*=t,this.ls*=t}},ls=class extends ii{typo;constructor(t){super(t);let e=D(D({},t.f),t.typo);t.alg&&(e.ta=t.alg),t.c&&(e.tc=t.c),this.typo=new Ve(e)}get color(){return this.typography.tc}get typography(){return this.typo}},Ro=class extends ls{prs;constructor(t){super(t),this.prs=t.prs}get parts(){return this.prs}},$v=class extends ii{o;constructor(t){super(t),this.o=t.o??5,this.w=this.w??1080,this.h=this.h??1920}getOrigin(){return this.o}},vh=class{dd;hh;mm;ss;date;constructor(t){t??={},this.dd=t.dd??0,this.hh=t.hh??0,this.mm=t.mm??0,this.ss=t.ss??0,this.date=t.date?new Date(t.date):void 0}start(t,e){let r=new Date;t===2?(r.setSeconds(r.getSeconds()+this.ss),r.setMinutes(r.getMinutes()+this.mm),r.setHours(r.getHours()+this.hh),r.setDate(r.getDate()+this.dd)):r=this.date??new Date;let n=window.setInterval(()=>{let i=new Date().getTime(),s=r.getTime()-i;if(s<1){clearInterval(n);return}let o=Math.floor(s/(1e3*60*60*24)),a=Math.floor(s%(1e3*60*60*24)/(1e3*60*60)),l=Math.floor(s%(1e3*60*60)/(1e3*60)),h=Math.floor(s%(1e3*60)/1e3);e({days:o,hours:a,minutes:l,seconds:h})},1e3);return n}},wh=class extends ls{gap;timer;timerType;horizontal;lblPos;show;constructor(t){t??={},super(t),this.gap=t.gap,this.timerType=t.type,this.timer=new vh(t.timer),this.show=t.show??{day:!0,hour:!0,minute:!0,second:!0},this.horizontal=t.horizontal,this.lblPos=t.lblPos}},Fv=class{txt;c;constructor(t){t??={},this.txt=t.txt,this.c=new ie(t.c??{})}get text(){return this.txt}get color(){return this.c}},ka=class extends ls{ph;constructor(t){super(t),this.ph=new Fv(t.ph)}get placeholderText(){return this.ph.text}get placeholderColor(){return this.ph.color.rgba}},bh=class extends ka{constructor(t){t??={},super(t)}},_h=class extends ka{},Eh=class extends ka{},Sh=class extends Aa{},us=(t=>(t[t.LOW=1]="LOW",t[t.MEDIUM=2]="MEDIUM",t[t.HIGH=3]="HIGH",t))(us||{}),Hv=class{en;ex;constructor(t){t=t??{},this.en=t.en,this.ex=t.ex}getEnterAnimation(){switch(this.en){case 2:return[{transform:"translateY(-100%)"},{transform:"translateY(0%)"}];case 3:return[{transform:"translateY(100%)"},{transform:"translateY(0%)"}];case 4:return[{transform:"translateX(-100%)"},{transform:"translateX(0%)"}];case 5:return[{transform:"translateX(100%)"},{transform:"translateX(0%)"}];case 6:return[{transform:"translate(-100%, -100%)"},{transform:"translate(0%, 0%)"}];case 7:return[{transform:"translate(100%, -100%)"},{transform:"translate(0%, 0%)"}];case 8:return[{transform:"translate(-100%, 100%)"},{transform:"translate(0%, 0%)"}];case 9:return[{transform:"translate(100%, 100%)"},{transform:"translate(0%, 0%)"}];case 10:return[{transform:"scale(0.1)"},{transform:"scale(1)"}];default:return[]}}getExitAnimation(){switch(this.ex){case 2:return[{transform:"translateY(0%)"},{transform:"translateY(-100%)"}];case 3:return[{transform:"translateY(0%)"},{transform:"translateY(100%)"}];case 4:return[{transform:"translateX(0%)"},{transform:"translateX(-100%)"}];case 5:return[{transform:"translateX(0%)"},{transform:"translateX(100%)"}];case 6:return[{transform:"translate(0%, 0%)"},{transform:"translate(-100%, -100%)"}];case 7:return[{transform:"translate(0%, 0%)"},{transform:"translate(100%, -100%)"}];case 8:return[{transform:"translate(0%, 0%)"},{transform:"translate(-100%, 100%)"}];case 9:return[{transform:"translate(0%, 0%)"},{transform:"translate(100%, 100%)"}];case 10:return[{transform:"scale(1)"},{transform:"scale(0)"}];default:return[]}}},_l=class extends ii{gvt;max;cover;anim;embedded;position;constructor(t){t=t??{},super(t),this.gvt=t.gvt??5,this.max=t.max,this.cover=t.cover??!0,this.anim=new Hv(t.anim),this.embedded=t.embedded,this.position=t.position??1,this.spc||(this.spc=new Da({pl:q.IN_APP_DEFAULT_PADDING,pr:q.IN_APP_DEFAULT_PADDING,pt:q.IN_APP_DEFAULT_PADDING,pb:q.IN_APP_DEFAULT_PADDING}))}isEmbedded(){return this.position===2&&!!this.embedded}getEmbeddedSelector(){return`.letscooee-engagement.container-${this.embedded}`}},Vv=class extends _l{cont;elems=[];mob;constructor(t){t=t??{},super(t),this.cont=new $v(t.cont),this.mob=new _l(t.mob),this.bg||(this.bg=this.cont.bg,delete this.cont.bg),t.elems.forEach(e=>{e.t===1?this.elems.push(new Aa(e)):e.t===2?this.elems.push(new Ro(e)):e.t===3?this.elems.push(new Ro(e)):e.t===100?this.elems.push(new yh(e)):e.t===51?this.elems.push(new _h(e)):e.t===52?this.elems.push(new Eh(e)):e.t===61?this.elems.push(new wh(e)):e.t===15||e.t===16?this.elems.push(new bh(e)):e.t===13&&this.elems.push(new Sh(e))})}getStylesForWrapper(){if(this.cover)return{};let t;return this.gvt===1?t={top:0,left:0}:this.gvt===2?t={top:0,left:"50%",transform:"translateX(-50%)"}:this.gvt===3?t={top:0,right:0}:this.gvt===6?t={top:"50%",right:0,transform:"translateY(-50%)"}:this.gvt===9?t={bottom:0,right:0}:this.gvt===8?t={bottom:0,left:"50%",transform:"translateX(-50%)"}:this.gvt===7?t={bottom:0,left:0}:this.gvt===4?t={top:"50%",left:0,transform:"translateY(-50%)"}:t={top:"50%",left:"50%",transform:"translateX(-50%) translateY(-50%)"},t.overflow="visible",t}getFlexStylesForContainer(){let t={display:"flex",flexDirection:"row"},e,r;return this.gvt===1?(e="flex-start",r="flex-start"):this.gvt===2?(e="center",r="flex-start"):this.gvt===3?(e="flex-end",r="flex-start"):this.gvt===4?(e="flex-start",r="center"):this.gvt===6?(e="flex-end",r="center"):this.gvt===7?(e="flex-start",r="flex-end"):this.gvt===8?(e="center",r="flex-end"):this.gvt===9?(e="flex-end",r="flex-end"):(e="center",r="center"),t.alignItems=r,t.justifyContent=e,t.overflow="visible",t}overrideForMobileView(){this.max=this.mob.max??this.max,this.cover=this.mob.cover??this.cover,this.gvt=this.mob.gvt??this.gvt,this.bg=this.mob.bg??this.bg,this.spc=this.mob.spc??this.spc,this.anim=this.mob.anim??this.anim,this.position=this.mob.position??this.position,this.embedded=this.mob.embedded??this.embedded}},Ih=class{gap;dir;wrap;jc;ai;scroll;constructor(t){t??={},this.gap=t.gap??0,this.dir=t.dir??"row",this.wrap=t.wrap??"nowrap",this.jc=t.jc??"flex-start",this.ai=t.ai??"flex-start",this.scroll=t.scroll}},Wv=class{of;disp;pos;top;bottom;left;right;zIndex;constructor(t){t??={},this.of=t.of,this.disp=t.disp,this.pos=t.pos,this.top=t.top,this.bottom=t.bottom,this.left=t.left,this.right=t.right,this.zIndex=t.zIndex}},Gv=class{w;h;maxW;maxH;minW;minH;constructor(t){t??={},this.w=t.w??"100%",this.h=t.h??"auto",this.maxW=t.maxW,this.maxH=t.maxH,this.minW=t.minW,this.minH=t.minH}},El=class{size;bg;br;spc;typo;lout;flex;constructor(t){t??={},this.spc=new Da(t.spc),t.size&&(this.size=new Gv(t.size)),t.bg&&(this.bg=new fh(t.bg)),t.br&&(this.br=new Ta(t.br)),t.typo&&(this.typo=new Ve(t.typo)),t.lout&&(this.lout=new Wv(t.lout)),t.flex&&(this.flex=new Ih(t.flex))}},Ch=class{sm;lg;constructor(t){t??={},this.sm=new El(t.sm),this.lg=new El(t.lg)}},ur=class{t;style;hide;when;clc;constructor(t,e){e??={},this.t=t,this.style=new Ch(e.style),this.hide=e.hide,e.when?.op&&(this.when=e.when),e.clc&&(this.clc=e.clc)}get stringType(){return Na[this.t]}},Oe=class extends ur{text;constructor(t,e){t?.style?.lg?.typo?.s&&delete t.style.lg.typo.s,t?.style?.sm?.typo?.s&&delete t.style.sm.typo.s,super(e??2,t),t??={},this.text=t.text}},Lo=class extends Oe{constructor(t,e){super(t,e??3)}},Th=class extends ur{value;constructor(t){super(6,t),t??={},this.value=t.value}},xh=class extends Oe{constructor(t=15,e){super(e,t)}},qv=class extends ur{c;iconSize;showSingleStar;fullStar;halfStart;constructor(t){super(19,t),t??={},this.c=new ie(t.c),this.iconSize=t.iconSize??24,this.showSingleStar=t.showSingleStar??!1,this.fullStar=t.fullStar,this.halfStart=t.halfStart}},zv=dt(an()),Yv=class{enabled;type;color;constructor(t){t??={},this.enabled=t.enabled,this.type=t.type,this.color=new ie(t.color)}},Kv=class{size;enabled;color;constructor(t){t??={},this.enabled=t.enabled,this.size=t.size,this.color=new ie(t.color)}},Dh=class{navigation;pagination;autoplay;maxInRow;gap;slidesPerView;constructor(t){t??={},this.navigation=new Kv(t.navigation),this.pagination=new Yv(t.pagination),this.autoplay=t.autoplay,this.slidesPerView=t.slidesPerView??1,this.maxInRow=t.maxInRow??t.slidesPerView??4,this.gap=t.gap??0}},Jv=class extends ur{conf;slide;formData;values;allowedTypes;constructor(t){super(62,t),t&&this.update(t)}update(t){t??={},this.slide=rn.getParsedElement(t.slide),this.formData=t.formData,this.values=t.values,this.conf=new Dh(t.conf),this.allowedTypes=t.allowedTypes}},Qv=class extends Oe{gap;timer;timerType;horizontal;lblPos;show;constructor(t){t??={},super(t,61),this.gap=t.gap,this.timerType=t.type,this.timer=new vh(t.timer),this.show=t.show??{days:!0,hours:!0,minutes:!0,seconds:!0},this.horizontal=t.horizontal,this.lblPos=t.lblPos}},Pa=class extends ur{elems;constructor(t){super(4,t),this.update(t)}update(t){t??={},this.elems??=[],t.elems?.forEach(e=>{let r=rn.getParsedElement(e);r&&this.elems.push(r)})}},Uo=class extends ur{src;sm;lg;constructor(t,e){super(e??1,t),t&&this.update(t)}update(t){this.src=t.src,this.sm=t.sm,this.lg=t.lg}},rn=class Nh{static getParsedElements(e){let r=[];return e?.forEach(n=>{let i=Nh.getParsedElement(n);i&&r.push(i)}),r}static getParsedElement(e){switch(e.t){case 2:return new Oe(e);case 3:return new Lo(e);case 6:return new Th(e);case 11:return new Zv(e);case 12:return new Ra(e);case 61:return new Qv(e);case 4:return new Pa(e);case 1:return new Uo(e);case 13:return new Uo(e,13);case 14:return new Oe(e,14);case 15:case 16:return new xh(e.t,e);case 18:return new Lo(e,18);case 62:return new Jv(e);case 19:return new qv(e);default:zv.default.error("Unknown element type",e.t);return}}static parseAlignmentToJustifyContent(e){switch(e){case 1:return"center";case 2:return"flex-end";case 0:return"flex-start";default:return"flex-start"}}},Ra=class extends ur{img;title;desc;price;compareAt;btn;variantDD;show;symbol;cBox;elems;noLinks;constructor(t){if(t??={},super(12,t),this.show=t.show,this.elems=rn.getParsedElements(t.elems),this.noLinks=t.noLinks,!this.elems.length){t.cBox&&this.elems.push(new Th(t.cBox)),this.elems.push(new Uo(t.img,13));let e=new Oe(t.title,14);e.hide=!t.show?.title,e.text="{{ product.name }}",this.elems.push(e);let r=new Oe(t.price);r.text="{{ product.price }}",r.hide=!t.show?.price;let n=new Oe(t.compareAt);n.text="{{ product.compare_price }}",n.hide=!t.show?.price,t.compareAt||(n.style=new Ch(r.style),n.style.lg.typo=new Ve(wt(D({},n.style.lg.typo),{td:"line-through"})),n.style.sm.typo=new Ve(wt(D({},n.style.sm.typo),{td:"line-through"})));let i=new Pa({style:{lg:{spc:{mb:10},flex:{dir:"row",gap:10,ai:"center",jc:rn.parseAlignmentToJustifyContent(r.style.lg.typo?.ta)}}}});i.elems.push(n),i.elems.push(r),this.elems.push(i);let s=new xh(15,t.variantDD);if(s.hide=!t.show?.variantDD,this.elems.push(s),t.btn){let o=new Lo(t.btn,18);o.hide=!t.show?.btn,this.elems.push(o)}}t.symbol&&(this.symbol=new Oe(t.symbol))}},Zv=class extends ur{conf;prod;constructor(t){super(11,t),t??={},this.conf=new Xv(t.conf),this.prod=new Ra(t.prod)}},Sl=class extends Dh{disp;maxItems;constructor(t){t??={},super(t),this.disp=t.disp,this.maxItems=t.maxItems}},Xv=class{lg;sm;constructor(t){t??={},this.lg=new Sl(t.lg),this.sm=new Sl(t.sm)}},tw=class extends Pa{constructor(t){super(t)}},Ah=class{cont;elems=[];constructor(t){t=t??{},this.cont=new tw(t.cont),t.elems?.forEach(e=>{this.addRawElement(e)})}addRawElement(t){let e=rn.getParsedElement(t);return e&&this.elems.push(e),e}},ew=dt(lr()),rw=class{minValue;rewardType;label;reachingText;reachedText;discount;items;calculatedAlignment;constructor(t){this.calculatedAlignment=t.calculatedAlignment,this.minValue=t.minValue,this.rewardType=t.rewardType,this.label=t.label,this.reachingText=t.reachingText,this.reachedText=t.reachedText,this.discount=t.discount,this.items=t.items?.map(e=>new pn(e))}},nw=class{layout;milestones;totalProgress;coupons;onlyLatestGift;noConfetti;removeIneligibleItem;constructor(t){this.layout=t.layout??ew.ProgressBarLayout.ICONS,this.onlyLatestGift=t.onlyLatestGift,this.noConfetti=t.noConfetti,this.removeIneligibleItem=t.removeIneligibleItem??!0,this.update(t)}update(t){t=t??{},this.milestones=t.milestones?.map(e=>new rw(e))??[],this.totalProgress=t.totalProgress,this.coupons=t.coupons}},iw=class{applyDiscountOnMinimum;constructor(t){this.applyDiscountOnMinimum=t.applyDiscountOnMinimum}},sw=class{id;alt;sources;items;durationMS;thumbnail;constructor(t={}){this.id=t.id,this.alt=t.alt,this.sources=t.sources?.sort((e,r)=>r.height-e.height),this.durationMS=t.durationMS,this.thumbnail=t.thumbnail,this.items=t.items?t.items.map(e=>new Fe(e)):[]}},ow=class{videos;source;template;heading;slidePerViewCount;autoPlay;showMuteButton;footerContent;detailPopup;constructor(t={}){this.videos=t.videos?.map(e=>new sw(e))??[],this.source=t.source,this.template=t.template,this.detailPopup=t.detailPopup??{template:"VIDEO_ONLY_VIEW"},this.heading=t.heading,this.showMuteButton=t.showMuteButton,this.slidePerViewCount=t.slidePerViewCount??4,this.autoPlay=t.autoPlay??"ON",this.footerContent=t.footerContent??"FIRST_ITEM"}},aw=class{modifications;constructor(t={}){t.modifications?.length?this.modifications=t.modifications.map(e=>new Il(e)):t.experiments?.length&&(this.modifications=t.experiments.map(e=>new Il(e)))}},Il=class{cssSelector;type;display;bg;typo;br;text;constructor(t={}){this.cssSelector=t.cssSelector??"",this.type=t.type??"OTHER",this.display=t.display,t.bg&&(this.bg=new ie(t.bg)),t.typo&&(this.typo=new Ve(t.typo)),t.br&&(this.br=new Ta(t.br)),this.text=t.text}get style(){let t={};return this.display==="HIDE"?t.display="none":this.display==="BLOCK"?t.display="block":this.display==="INLINE"&&(t.display="inline"),this.br?.r&&(t.borderRadius=this.br.r+"px"),this.br?.w&&(t.borderWidth=this.br.w+"px"),this.br?.s&&(t.borderStyle=xa[this.br.s]?.toLowerCase()),this.br?.c?.h&&(t.borderColor=this.br.color?.rgba),this.bg?.h&&(t.backgroundColor=this.bg.rgba),this.type==="TEXT"&&this.typo&&(this.typo.fs&&(t.fontSize=this.typo.fs+"px"),this.typo.lh&&(t.lineHeight=this.typo.lh),this.typo.fw&&(t.fontWeight=this.typo.fw),this.typo.ta&&(t.textAlign=this.typo.alignment),this.typo.tc.h&&(t.color=this.typo.tc.rgba),this.typo.ls&&(t.letterSpacing=this.typo.letterSpacing),this.typo.td&&(t.textDecoration=this.typo.td??"none")),t}toString(){return`Experiment(cssSelector=${this.cssSelector})`}},cw=class{engagementID;shortID;contentType;delay;onsiteDeliveryType;objective;redirectBehaviour;constructor(t){this.shortID=t.shortID,this.contentType=t.contentType,this.engagementID=t.engagementID,this.delay=t.delay??0,this.redirectBehaviour=t.redirectBehaviour,this.onsiteDeliveryType=t.onsiteDeliveryType,this.objective=t.objective}isAnySplit(){return this.isABTesting()||this.isExclusionTesting()}isExclusionTesting(){return this.contentType===Zt.EngagementContentType.EXCLUSION}isABTesting(){return this.contentType===Zt.EngagementContentType.ABTESTING}isSingleContent(){return this.contentType===Zt.EngagementContentType.SINGLE}},Ar=class Oh extends cw{static SWIPER_ELEMENTS=new Set([11,62]);nudgeID;contentID;variation;ian;widget;discount;placement;promotionType;contentSource;manipulation;klaviyoFormID;hasMultiplePlacement;skipSubscribedItems;progressBarConfig;stickyATCConfig;bundleConfig;content;previewType;occurred;id;currency;props;items;nonMutableItems;embeddedItems;bundleFrom;collections;customerData;experimentConfig;discountData=Ir({});constructor(e){super(e),this.id=e.id,this.nudgeID=e.nudgeID,this.currency=Pt.get().currencyCode??"USD",this.contentID=e.contentID,this.variation=e.variation,e.widget&&(this.widget=new Ah(e.widget)),this.previewType=e.previewType,this.occurred=e.occurred??new Date,this.props=e.props,this.embeddedItems=e.embeddedItems?.map(r=>new pn(r)),this.items=e.items?.map(r=>new Fe(r))??[],this.nonMutableItems=e.items?.map(r=>new Fe(r))??[],this.collections=e.collections?.map(r=>new xv(r))??[],this.discount=e.discount,this.placement=e.placement,this.customerData=e.customerData,this.ian=e.ian?this.processPopup(e.ian):void 0,this.promotionType=e.promotionType,this.manipulation=new Av(e.manipulation),this.contentSource=e.contentSource,this.klaviyoFormID=e.klaviyoFormID,this.hasMultiplePlacement=e.hasMultiplePlacement,this.skipSubscribedItems=e.skipSubscribedItems,this.stickyATCConfig=e.stickyATCConfig,e.experimentConfig&&(this.experimentConfig=new aw(e.experimentConfig)),e.progressBarConfig&&(this.progressBarConfig=new nw(e.progressBarConfig)),e.bundleConfig&&(this.bundleConfig=new iw(e.bundleConfig)),e.bundleFrom&&(this.bundleFrom=new Fe(e.bundleFrom)),e.content?.videoConfig&&(this.content={videoConfig:new ow(e.content.videoConfig)})}shouldDelay(){return this.delay>0}sentryContext(){return{id:this.id,shortID:this.shortID,currency:this.currency,contentType:this.contentType,objective:this.objective,onsiteDeliveryType:this.onsiteDeliveryType,engagementID:this.engagementID,contentID:this.contentID,nudgeID:this.nudgeID,variation:this.variation}}getDelaySeconds(){let e=new Date().getTime()-this.occurred.getTime();return this.delay*1e3-e}isBundle(){return this.objective===Zt.EngagementObjective.BUNDLE_AND_UPSELL}isCartEmbed(){return this.onsiteDeliveryType===Zt.OnsiteDeliveryType.CART_EMBED}isPageEmbed(){return this.onsiteDeliveryType===Zt.OnsiteDeliveryType.PAGE_EMBED}isProgressBar(){return this.objective===Zt.EngagementObjective.PROGRESS_BAR}isSubscriptionUpsell(){return this.objective===Zt.EngagementObjective.SUBSCRIPTION_UPSELL}isCartRecovery(){return this.objective===Zt.EngagementObjective.CART_RECOVERY}isProductPromotion(){return this.objective===Zt.EngagementObjective.PRODUCT_PROMOTION}isProductPromoted(){return this.isProductPromotion()||this.isBundle()||this.isCartRecovery()}isCollectionPromoted(){return this.isProductPromotion()&&this.collections.length>0&&this.promotionType===Zt.PromotionType.COLLECTION}isBYOB(){return this.objective===Zt.EngagementObjective.BYOB}isStickyATC(){return this.objective===Zt.EngagementObjective.STICKY_ATC}isShoppableVideo(){return this.objective===Zt.EngagementObjective.SHOPPABLE_VIDEO}processPopup(e){let r=JSON.stringify(e),n=this.items[0],i={},s={};if(n){let l=n.selectedOrFirstVariant.value;i={name:n.name,id:n.mID,link:n.link,vID:l.mID,image:n.variantImage,price:Ne(l.price.d),comparePrice:Ne(l.price.cmp),quantity:n.quantity},s={quantity:l.quantity}}let o={productCount:Ot.getCurrent().item_count},a=je.render(r,{product:i,variant:s,cart:o,discount:this.discount,customer:this.customerData});return n&&(a=a.replace(new RegExp(q.PLACEHOLDER_IMAGE,"gi"),n.variantImage??n.imageURL)),new Vv(JSON.parse(a))}calculateDiscountData(e,r){let n=Os.ArrayUtils.sum(e,o=>o.selectedOrFirstVariant.value.price.d),i=Os.ArrayUtils.sum(e,o=>{let a=o.selectedOrFirstVariant.value.price;return a.cmp??a.d}),s={actualPrice:n,totalComparePrice:i,discountAmount:0,discountPercentage:0,discountedPrice:n};if(!e?.length||!r||!this.discount?.type){this.discountData.value=this.formatCurrencyAndNumber(s);return}if(Ke.DiscountType.BXGY===this.discount.type&&this.discount.values?.length)s.discountPercentage=this.discount.values[0],this.updateEffectivePrice(e,s.discountPercentage,!0),s.discountAmount=s.actualPrice-Os.ArrayUtils.sum(e,o=>o.selectedOrFirstVariant.value.effectivePrice.value);else if([Ke.DiscountType.UNIQUE_FLAT_ITEMS,Ke.DiscountType.STATIC,Ke.DiscountType.UNIQUE_FLAT].includes(this.discount.type)&&this.discount.values?.length)s.discountPercentage=this.discount.values[0],s.discountAmount=s.actualPrice*s.discountPercentage/100,this.updateEffectivePrice(e,s.discountPercentage);else if(this.discount.type===Ke.DiscountType.UNIQUE_FIXED_ITEMS&&this.discount.values?.length)s.discountAmount=s.actualPrice-this.discount.values[0],s.discountPercentage=s.discountAmount/s.actualPrice*100,this.updateEffectivePrice(e,s.discountPercentage);else if(this.discount.type===Ke.DiscountType.UNIQUE_CHEAPEST_ITEM_FREE){e.sort((a,l)=>l.selectedOrFirstVariant.value.price.d-a.selectedOrFirstVariant.value.price.d);let o=e[e.length-1];o.selectedOrFirstVariant.value.effectivePrice.value=0,s.discountAmount=o.selectedOrFirstVariant.value.price.d,s.discountPercentage=s.discountAmount/s.actualPrice*100}s.discountedPrice=s.actualPrice-s.discountAmount,this.discountData.value=this.formatCurrencyAndNumber(s)}getPrivateAttributesForLineItem(){return se.get().skipItemAttribute?{}:{[q.VIA]:"Cooee",[q.CAMPAIGN_ATTRIBUTE]:this.shortID,[q.CONTENT_ATTRIBUTE]:this.contentID}}getKVFormatPrivateAttributesForLineItem(){return se.get().skipItemAttribute?[]:[{key:q.VIA,value:"Cooee"},{key:q.CAMPAIGN_ATTRIBUTE,value:this.shortID},{key:q.CONTENT_ATTRIBUTE,value:this.contentID}]}isBundleDiscount(){return[Ke.DiscountType.UNIQUE_FIXED_ITEMS,Ke.DiscountType.UNIQUE_FLAT_ITEMS].includes(this.discount.type)}isBundleOnCartDrawer(){return this.isBundle()&&this.isCartEmbed()}isBundleOnPDP(){return this.isPageEmbed()&&this.isBundle()}hasSwiperElement(){let e=this.widget?.elems.find(n=>Oh.SWIPER_ELEMENTS.has(n.t));if(!e)return!1;if(e.t===62)return!0;let r=Wn.get().isMobile()?"sm":"lg";return e.conf[r].disp===2}toString(){return`Engagement(id=${this.shortID})`}getCartMagicVariables(){let e=Ot.getCurrent();return{productCount:e.item_count,amount:Ne(e.total_price/100),originalAmount:Ne(e.original_total_price/100)}}updateEffectivePrice(e,r,n=!1){let i=Pt.get().getCurrentItem();e.forEach(s=>{let o=s.selectedOrFirstVariant.value,a=o.price;if(n&&s.mID===i.mID)o.effectivePrice.value=a.d;else{let l=a.d*r/100;o.effectivePrice.value=a.d-l}})}formatCurrencyAndNumber(e){if(!e)return{};let r={discountPercentage:_v(e.discountPercentage??0),discountCode:this.discount?.code};return["actualPrice","discountAmount","discountedPrice","totalComparePrice"].map(n=>{r[n]=Ne(e[n])}),r}};function lw(t,e){return e={exports:{}},t(e,e.exports),e.exports}var uw=fw,hw=mw,pw=ww,Ae=[],pe=[],dw=typeof Uint8Array<"u"?Uint8Array:Array,Bs="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(dr=0,Cl=Bs.length;dr<Cl;++dr)Ae[dr]=Bs[dr],pe[Bs.charCodeAt(dr)]=dr;var dr,Cl;pe[45]=62;pe[95]=63;function kh(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function fw(t){var e=kh(t),r=e[0],n=e[1];return(r+n)*3/4-n}function gw(t,e,r){return(e+r)*3/4-r}function mw(t){var e,r=kh(t),n=r[0],i=r[1],s=new dw(gw(t,n,i)),o=0,a=i>0?n-4:n,l;for(l=0;l<a;l+=4)e=pe[t.charCodeAt(l)]<<18|pe[t.charCodeAt(l+1)]<<12|pe[t.charCodeAt(l+2)]<<6|pe[t.charCodeAt(l+3)],s[o++]=e>>16&255,s[o++]=e>>8&255,s[o++]=e&255;return i===2&&(e=pe[t.charCodeAt(l)]<<2|pe[t.charCodeAt(l+1)]>>4,s[o++]=e&255),i===1&&(e=pe[t.charCodeAt(l)]<<10|pe[t.charCodeAt(l+1)]<<4|pe[t.charCodeAt(l+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function yw(t){return Ae[t>>18&63]+Ae[t>>12&63]+Ae[t>>6&63]+Ae[t&63]}function vw(t,e,r){for(var n,i=[],s=e;s<r;s+=3)n=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(t[s+2]&255),i.push(yw(n));return i.join("")}function ww(t){for(var e,r=t.length,n=r%3,i=[],s=16383,o=0,a=r-n;o<a;o+=s)i.push(vw(t,o,o+s>a?a:o+s));return n===1?(e=t[r-1],i.push(Ae[e>>2]+Ae[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(Ae[e>>10]+Ae[e>>4&63]+Ae[e<<2&63]+"=")),i.join("")}var js={byteLength:uw,toByteArray:hw,fromByteArray:pw},bw=function(t,e,r,n,i){var s,o,a=i*8-n-1,l=(1<<a)-1,h=l>>1,g=-7,p=r?i-1:0,_=r?-1:1,w=t[e+p];for(p+=_,s=w&(1<<-g)-1,w>>=-g,g+=a;g>0;s=s*256+t[e+p],p+=_,g-=8);for(o=s&(1<<-g)-1,s>>=-g,g+=n;g>0;o=o*256+t[e+p],p+=_,g-=8);if(s===0)s=1-h;else{if(s===l)return o?NaN:(w?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-h}return(w?-1:1)*o*Math.pow(2,s-n)},_w=function(t,e,r,n,i,s){var o,a,l,h=s*8-i-1,g=(1<<h)-1,p=g>>1,_=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,w=n?0:s-1,b=n?1:-1,E=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=g):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+p>=1?e+=_/l:e+=_*Math.pow(2,1-p),e*l>=2&&(o++,l/=2),o+p>=g?(a=0,o=g):o+p>=1?(a=(e*l-1)*Math.pow(2,i),o=o+p):(a=e*Math.pow(2,p-1)*Math.pow(2,i),o=0));i>=8;t[r+w]=a&255,w+=b,a/=256,i-=8);for(o=o<<i|a,h+=i;h>0;t[r+w]=o&255,w+=b,o/=256,h-=8);t[r+w-b]|=E*128},Br={read:bw,write:_w},hs=lw(function(t,e){var r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=o,e.SlowBuffer=A,e.INSPECT_MAX_BYTES=50;var n=2147483647;e.kMaxLength=n,o.TYPED_ARRAY_SUPPORT=i(),!o.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function i(){try{var c=new Uint8Array(1),u={foo:function(){return 42}};return Object.setPrototypeOf(u,Uint8Array.prototype),Object.setPrototypeOf(c,u),c.foo()===42}catch{return!1}}Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}});function s(c){if(c>n)throw new RangeError('The value "'+c+'" is invalid for option "size"');var u=new Uint8Array(c);return Object.setPrototypeOf(u,o.prototype),u}function o(c,u,d){if(typeof c=="number"){if(typeof u=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return g(c)}return a(c,u,d)}o.poolSize=8192;function a(c,u,d){if(typeof c=="string")return p(c,u);if(ArrayBuffer.isView(c))return w(c);if(c==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(c));if(le(c,ArrayBuffer)||c&&le(c.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(le(c,SharedArrayBuffer)||c&&le(c.buffer,SharedArrayBuffer)))return b(c,u,d);if(typeof c=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var S=c.valueOf&&c.valueOf();if(S!=null&&S!==c)return o.from(S,u,d);var N=E(c);if(N)return N;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof c[Symbol.toPrimitive]=="function")return o.from(c[Symbol.toPrimitive]("string"),u,d);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(c))}o.from=function(c,u,d){return a(c,u,d)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array);function l(c){if(typeof c!="number")throw new TypeError('"size" argument must be of type number');if(c<0)throw new RangeError('The value "'+c+'" is invalid for option "size"')}function h(c,u,d){return l(c),c<=0?s(c):u!==void 0?typeof d=="string"?s(c).fill(u,d):s(c).fill(u):s(c)}o.alloc=function(c,u,d){return h(c,u,d)};function g(c){return l(c),s(c<0?0:P(c)|0)}o.allocUnsafe=function(c){return g(c)},o.allocUnsafeSlow=function(c){return g(c)};function p(c,u){if((typeof u!="string"||u==="")&&(u="utf8"),!o.isEncoding(u))throw new TypeError("Unknown encoding: "+u);var d=M(c,u)|0,S=s(d),N=S.write(c,u);return N!==d&&(S=S.slice(0,N)),S}function _(c){for(var u=c.length<0?0:P(c.length)|0,d=s(u),S=0;S<u;S+=1)d[S]=c[S]&255;return d}function w(c){if(le(c,Uint8Array)){var u=new Uint8Array(c);return b(u.buffer,u.byteOffset,u.byteLength)}return _(c)}function b(c,u,d){if(u<0||c.byteLength<u)throw new RangeError('"offset" is outside of buffer bounds');if(c.byteLength<u+(d||0))throw new RangeError('"length" is outside of buffer bounds');var S;return u===void 0&&d===void 0?S=new Uint8Array(c):d===void 0?S=new Uint8Array(c,u):S=new Uint8Array(c,u,d),Object.setPrototypeOf(S,o.prototype),S}function E(c){if(o.isBuffer(c)){var u=P(c.length)|0,d=s(u);return d.length===0||c.copy(d,0,0,u),d}if(c.length!==void 0)return typeof c.length!="number"||mn(c.length)?s(0):_(c);if(c.type==="Buffer"&&Array.isArray(c.data))return _(c.data)}function P(c){if(c>=n)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n.toString(16)+" bytes");return c|0}function A(c){return+c!=c&&(c=0),o.alloc(+c)}o.isBuffer=function(c){return c!=null&&c._isBuffer===!0&&c!==o.prototype},o.compare=function(c,u){if(le(c,Uint8Array)&&(c=o.from(c,c.offset,c.byteLength)),le(u,Uint8Array)&&(u=o.from(u,u.offset,u.byteLength)),!o.isBuffer(c)||!o.isBuffer(u))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(c===u)return 0;for(var d=c.length,S=u.length,N=0,j=Math.min(d,S);N<j;++N)if(c[N]!==u[N]){d=c[N],S=u[N];break}return d<S?-1:S<d?1:0},o.isEncoding=function(c){switch(String(c).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(c,u){if(!Array.isArray(c))throw new TypeError('"list" argument must be an Array of Buffers');if(c.length===0)return o.alloc(0);var d;if(u===void 0)for(u=0,d=0;d<c.length;++d)u+=c[d].length;var S=o.allocUnsafe(u),N=0;for(d=0;d<c.length;++d){var j=c[d];if(le(j,Uint8Array))N+j.length>S.length?o.from(j).copy(S,N):Uint8Array.prototype.set.call(S,j,N);else if(o.isBuffer(j))j.copy(S,N);else throw new TypeError('"list" argument must be an Array of Buffers');N+=j.length}return S};function M(c,u){if(o.isBuffer(c))return c.length;if(ArrayBuffer.isView(c)||le(c,ArrayBuffer))return c.byteLength;if(typeof c!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+babelHelpers.typeof(c));var d=c.length,S=arguments.length>2&&arguments[2]===!0;if(!S&&d===0)return 0;for(var N=!1;;)switch(u){case"ascii":case"latin1":case"binary":return d;case"utf8":case"utf-8":return gn(c).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return d*2;case"hex":return d>>>1;case"base64":return pi(c).length;default:if(N)return S?-1:gn(c).length;u=(""+u).toLowerCase(),N=!0}}o.byteLength=M;function z(c,u,d){var S=!1;if((u===void 0||u<0)&&(u=0),u>this.length||((d===void 0||d>this.length)&&(d=this.length),d<=0)||(d>>>=0,u>>>=0,d<=u))return"";for(c||(c="utf8");;)switch(c){case"hex":return zt(this,u,d);case"utf8":case"utf-8":return Tt(this,u,d);case"ascii":return qt(this,u,d);case"latin1":case"binary":return mt(this,u,d);case"base64":return ct(this,u,d);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ot(this,u,d);default:if(S)throw new TypeError("Unknown encoding: "+c);c=(c+"").toLowerCase(),S=!0}}o.prototype._isBuffer=!0;function B(c,u,d){var S=c[u];c[u]=c[d],c[d]=S}o.prototype.swap16=function(){var c=this.length;if(c%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var u=0;u<c;u+=2)B(this,u,u+1);return this},o.prototype.swap32=function(){var c=this.length;if(c%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var u=0;u<c;u+=4)B(this,u,u+3),B(this,u+1,u+2);return this},o.prototype.swap64=function(){var c=this.length;if(c%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var u=0;u<c;u+=8)B(this,u,u+7),B(this,u+1,u+6),B(this,u+2,u+5),B(this,u+3,u+4);return this},o.prototype.toString=function(){var c=this.length;return c===0?"":arguments.length===0?Tt(this,0,c):z.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(c){if(!o.isBuffer(c))throw new TypeError("Argument must be a Buffer");return this===c?!0:o.compare(this,c)===0},o.prototype.inspect=function(){var c="",u=e.INSPECT_MAX_BYTES;return c=this.toString("hex",0,u).replace(/(.{2})/g,"$1 ").trim(),this.length>u&&(c+=" ... "),"<Buffer "+c+">"},r&&(o.prototype[r]=o.prototype.inspect),o.prototype.compare=function(c,u,d,S,N){if(le(c,Uint8Array)&&(c=o.from(c,c.offset,c.byteLength)),!o.isBuffer(c))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+babelHelpers.typeof(c));if(u===void 0&&(u=0),d===void 0&&(d=c?c.length:0),S===void 0&&(S=0),N===void 0&&(N=this.length),u<0||d>c.length||S<0||N>this.length)throw new RangeError("out of range index");if(S>=N&&u>=d)return 0;if(S>=N)return-1;if(u>=d)return 1;if(u>>>=0,d>>>=0,S>>>=0,N>>>=0,this===c)return 0;for(var j=N-S,K=d-u,ht=Math.min(j,K),kt=this.slice(S,N),yt=c.slice(u,d),xt=0;xt<ht;++xt)if(kt[xt]!==yt[xt]){j=kt[xt],K=yt[xt];break}return j<K?-1:K<j?1:0};function Z(c,u,d,S,N){if(c.length===0)return-1;if(typeof d=="string"?(S=d,d=0):d>2147483647?d=2147483647:d<-2147483648&&(d=-2147483648),d=+d,mn(d)&&(d=N?0:c.length-1),d<0&&(d=c.length+d),d>=c.length){if(N)return-1;d=c.length-1}else if(d<0)if(N)d=0;else return-1;if(typeof u=="string"&&(u=o.from(u,S)),o.isBuffer(u))return u.length===0?-1:bt(c,u,d,S,N);if(typeof u=="number")return u=u&255,typeof Uint8Array.prototype.indexOf=="function"?N?Uint8Array.prototype.indexOf.call(c,u,d):Uint8Array.prototype.lastIndexOf.call(c,u,d):bt(c,[u],d,S,N);throw new TypeError("val must be string, number or Buffer")}function bt(c,u,d,S,N){var j=1,K=c.length,ht=u.length;if(S!==void 0&&(S=String(S).toLowerCase(),S==="ucs2"||S==="ucs-2"||S==="utf16le"||S==="utf-16le")){if(c.length<2||u.length<2)return-1;j=2,K/=2,ht/=2,d/=2}function kt(yn,vn){return j===1?yn[vn]:yn.readUInt16BE(vn*j)}var yt;if(N){var xt=-1;for(yt=d;yt<K;yt++)if(kt(c,yt)===kt(u,xt===-1?0:yt-xt)){if(xt===-1&&(xt=yt),yt-xt+1===ht)return xt*j}else xt!==-1&&(yt-=yt-xt),xt=-1}else for(d+ht>K&&(d=K-ht),yt=d;yt>=0;yt--){for(var Bt=!0,pr=0;pr<ht;pr++)if(kt(c,yt+pr)!==kt(u,pr)){Bt=!1;break}if(Bt)return yt}return-1}o.prototype.includes=function(c,u,d){return this.indexOf(c,u,d)!==-1},o.prototype.indexOf=function(c,u,d){return Z(this,c,u,d,!0)},o.prototype.lastIndexOf=function(c,u,d){return Z(this,c,u,d,!1)};function It(c,u,d,S){d=Number(d)||0;var N=c.length-d;S?(S=Number(S),S>N&&(S=N)):S=N;var j=u.length;S>j/2&&(S=j/2);for(var K=0;K<S;++K){var ht=parseInt(u.substr(K*2,2),16);if(mn(ht))return K;c[d+K]=ht}return K}function H(c,u,d,S){return Ur(gn(u,c.length-d),c,d,S)}function rt(c,u,d,S){return Ur(Es(u),c,d,S)}function X(c,u,d,S){return Ur(pi(u),c,d,S)}function tt(c,u,d,S){return Ur(Ss(u,c.length-d),c,d,S)}o.prototype.write=function(c,u,d,S){if(u===void 0)S="utf8",d=this.length,u=0;else if(d===void 0&&typeof u=="string")S=u,d=this.length,u=0;else if(isFinite(u))u=u>>>0,isFinite(d)?(d=d>>>0,S===void 0&&(S="utf8")):(S=d,d=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var N=this.length-u;if((d===void 0||d>N)&&(d=N),c.length>0&&(d<0||u<0)||u>this.length)throw new RangeError("Attempt to write outside buffer bounds");S||(S="utf8");for(var j=!1;;)switch(S){case"hex":return It(this,c,u,d);case"utf8":case"utf-8":return H(this,c,u,d);case"ascii":case"latin1":case"binary":return rt(this,c,u,d);case"base64":return X(this,c,u,d);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return tt(this,c,u,d);default:if(j)throw new TypeError("Unknown encoding: "+S);S=(""+S).toLowerCase(),j=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ct(c,u,d){return u===0&&d===c.length?js.fromByteArray(c):js.fromByteArray(c.slice(u,d))}function Tt(c,u,d){d=Math.min(c.length,d);for(var S=[],N=u;N<d;){var j=c[N],K=null,ht=j>239?4:j>223?3:j>191?2:1;if(N+ht<=d){var kt,yt,xt,Bt;switch(ht){case 1:j<128&&(K=j);break;case 2:kt=c[N+1],(kt&192)===128&&(Bt=(j&31)<<6|kt&63,Bt>127&&(K=Bt));break;case 3:kt=c[N+1],yt=c[N+2],(kt&192)===128&&(yt&192)===128&&(Bt=(j&15)<<12|(kt&63)<<6|yt&63,Bt>2047&&(Bt<55296||Bt>57343)&&(K=Bt));break;case 4:kt=c[N+1],yt=c[N+2],xt=c[N+3],(kt&192)===128&&(yt&192)===128&&(xt&192)===128&&(Bt=(j&15)<<18|(kt&63)<<12|(yt&63)<<6|xt&63,Bt>65535&&Bt<1114112&&(K=Bt))}}K===null?(K=65533,ht=1):K>65535&&(K-=65536,S.push(K>>>10&1023|55296),K=56320|K&1023),S.push(K),N+=ht}return Ft(S)}var m=4096;function Ft(c){var u=c.length;if(u<=m)return String.fromCharCode.apply(String,c);for(var d="",S=0;S<u;)d+=String.fromCharCode.apply(String,c.slice(S,S+=m));return d}function qt(c,u,d){var S="";d=Math.min(c.length,d);for(var N=u;N<d;++N)S+=String.fromCharCode(c[N]&127);return S}function mt(c,u,d){var S="";d=Math.min(c.length,d);for(var N=u;N<d;++N)S+=String.fromCharCode(c[N]);return S}function zt(c,u,d){var S=c.length;(!u||u<0)&&(u=0),(!d||d<0||d>S)&&(d=S);for(var N="",j=u;j<d;++j)N+=Is[c[j]];return N}function ot(c,u,d){for(var S=c.slice(u,d),N="",j=0;j<S.length-1;j+=2)N+=String.fromCharCode(S[j]+S[j+1]*256);return N}o.prototype.slice=function(c,u){var d=this.length;c=~~c,u=u===void 0?d:~~u,c<0?(c+=d,c<0&&(c=0)):c>d&&(c=d),u<0?(u+=d,u<0&&(u=0)):u>d&&(u=d),u<c&&(u=c);var S=this.subarray(c,u);return Object.setPrototypeOf(S,o.prototype),S};function nt(c,u,d){if(c%1!==0||c<0)throw new RangeError("offset is not uint");if(c+u>d)throw new RangeError("Trying to access beyond buffer length")}o.prototype.readUintLE=o.prototype.readUIntLE=function(c,u,d){c=c>>>0,u=u>>>0,d||nt(c,u,this.length);for(var S=this[c],N=1,j=0;++j<u&&(N*=256);)S+=this[c+j]*N;return S},o.prototype.readUintBE=o.prototype.readUIntBE=function(c,u,d){c=c>>>0,u=u>>>0,d||nt(c,u,this.length);for(var S=this[c+--u],N=1;u>0&&(N*=256);)S+=this[c+--u]*N;return S},o.prototype.readUint8=o.prototype.readUInt8=function(c,u){return c=c>>>0,u||nt(c,1,this.length),this[c]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(c,u){return c=c>>>0,u||nt(c,2,this.length),this[c]|this[c+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(c,u){return c=c>>>0,u||nt(c,2,this.length),this[c]<<8|this[c+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(c,u){return c=c>>>0,u||nt(c,4,this.length),(this[c]|this[c+1]<<8|this[c+2]<<16)+this[c+3]*16777216},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(c,u){return c=c>>>0,u||nt(c,4,this.length),this[c]*16777216+(this[c+1]<<16|this[c+2]<<8|this[c+3])},o.prototype.readIntLE=function(c,u,d){c=c>>>0,u=u>>>0,d||nt(c,u,this.length);for(var S=this[c],N=1,j=0;++j<u&&(N*=256);)S+=this[c+j]*N;return N*=128,S>=N&&(S-=Math.pow(2,8*u)),S},o.prototype.readIntBE=function(c,u,d){c=c>>>0,u=u>>>0,d||nt(c,u,this.length);for(var S=u,N=1,j=this[c+--S];S>0&&(N*=256);)j+=this[c+--S]*N;return N*=128,j>=N&&(j-=Math.pow(2,8*u)),j},o.prototype.readInt8=function(c,u){return c=c>>>0,u||nt(c,1,this.length),this[c]&128?(255-this[c]+1)*-1:this[c]},o.prototype.readInt16LE=function(c,u){c=c>>>0,u||nt(c,2,this.length);var d=this[c]|this[c+1]<<8;return d&32768?d|4294901760:d},o.prototype.readInt16BE=function(c,u){c=c>>>0,u||nt(c,2,this.length);var d=this[c+1]|this[c]<<8;return d&32768?d|4294901760:d},o.prototype.readInt32LE=function(c,u){return c=c>>>0,u||nt(c,4,this.length),this[c]|this[c+1]<<8|this[c+2]<<16|this[c+3]<<24},o.prototype.readInt32BE=function(c,u){return c=c>>>0,u||nt(c,4,this.length),this[c]<<24|this[c+1]<<16|this[c+2]<<8|this[c+3]},o.prototype.readFloatLE=function(c,u){return c=c>>>0,u||nt(c,4,this.length),Br.read(this,c,!0,23,4)},o.prototype.readFloatBE=function(c,u){return c=c>>>0,u||nt(c,4,this.length),Br.read(this,c,!1,23,4)},o.prototype.readDoubleLE=function(c,u){return c=c>>>0,u||nt(c,8,this.length),Br.read(this,c,!0,52,8)},o.prototype.readDoubleBE=function(c,u){return c=c>>>0,u||nt(c,8,this.length),Br.read(this,c,!1,52,8)};function Ht(c,u,d,S,N,j){if(!o.isBuffer(c))throw new TypeError('"buffer" argument must be a Buffer instance');if(u>N||u<j)throw new RangeError('"value" argument is out of bounds');if(d+S>c.length)throw new RangeError("Index out of range")}o.prototype.writeUintLE=o.prototype.writeUIntLE=function(c,u,d,S){if(c=+c,u=u>>>0,d=d>>>0,!S){var N=Math.pow(2,8*d)-1;Ht(this,c,u,d,N,0)}var j=1,K=0;for(this[u]=c&255;++K<d&&(j*=256);)this[u+K]=c/j&255;return u+d},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(c,u,d,S){if(c=+c,u=u>>>0,d=d>>>0,!S){var N=Math.pow(2,8*d)-1;Ht(this,c,u,d,N,0)}var j=d-1,K=1;for(this[u+j]=c&255;--j>=0&&(K*=256);)this[u+j]=c/K&255;return u+d},o.prototype.writeUint8=o.prototype.writeUInt8=function(c,u,d){return c=+c,u=u>>>0,d||Ht(this,c,u,1,255,0),this[u]=c&255,u+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(c,u,d){return c=+c,u=u>>>0,d||Ht(this,c,u,2,65535,0),this[u]=c&255,this[u+1]=c>>>8,u+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(c,u,d){return c=+c,u=u>>>0,d||Ht(this,c,u,2,65535,0),this[u]=c>>>8,this[u+1]=c&255,u+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(c,u,d){return c=+c,u=u>>>0,d||Ht(this,c,u,4,4294967295,0),this[u+3]=c>>>24,this[u+2]=c>>>16,this[u+1]=c>>>8,this[u]=c&255,u+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(c,u,d){return c=+c,u=u>>>0,d||Ht(this,c,u,4,4294967295,0),this[u]=c>>>24,this[u+1]=c>>>16,this[u+2]=c>>>8,this[u+3]=c&255,u+4},o.prototype.writeIntLE=function(c,u,d,S){if(c=+c,u=u>>>0,!S){var N=Math.pow(2,8*d-1);Ht(this,c,u,d,N-1,-N)}var j=0,K=1,ht=0;for(this[u]=c&255;++j<d&&(K*=256);)c<0&&ht===0&&this[u+j-1]!==0&&(ht=1),this[u+j]=(c/K>>0)-ht&255;return u+d},o.prototype.writeIntBE=function(c,u,d,S){if(c=+c,u=u>>>0,!S){var N=Math.pow(2,8*d-1);Ht(this,c,u,d,N-1,-N)}var j=d-1,K=1,ht=0;for(this[u+j]=c&255;--j>=0&&(K*=256);)c<0&&ht===0&&this[u+j+1]!==0&&(ht=1),this[u+j]=(c/K>>0)-ht&255;return u+d},o.prototype.writeInt8=function(c,u,d){return c=+c,u=u>>>0,d||Ht(this,c,u,1,127,-128),c<0&&(c=255+c+1),this[u]=c&255,u+1},o.prototype.writeInt16LE=function(c,u,d){return c=+c,u=u>>>0,d||Ht(this,c,u,2,32767,-32768),this[u]=c&255,this[u+1]=c>>>8,u+2},o.prototype.writeInt16BE=function(c,u,d){return c=+c,u=u>>>0,d||Ht(this,c,u,2,32767,-32768),this[u]=c>>>8,this[u+1]=c&255,u+2},o.prototype.writeInt32LE=function(c,u,d){return c=+c,u=u>>>0,d||Ht(this,c,u,4,2147483647,-2147483648),this[u]=c&255,this[u+1]=c>>>8,this[u+2]=c>>>16,this[u+3]=c>>>24,u+4},o.prototype.writeInt32BE=function(c,u,d){return c=+c,u=u>>>0,d||Ht(this,c,u,4,2147483647,-2147483648),c<0&&(c=4294967295+c+1),this[u]=c>>>24,this[u+1]=c>>>16,this[u+2]=c>>>8,this[u+3]=c&255,u+4};function li(c,u,d,S,N,j){if(d+S>c.length)throw new RangeError("Index out of range");if(d<0)throw new RangeError("Index out of range")}function ui(c,u,d,S,N){return u=+u,d=d>>>0,N||li(c,u,d,4),Br.write(c,u,d,S,23,4),d+4}o.prototype.writeFloatLE=function(c,u,d){return ui(this,c,u,!0,d)},o.prototype.writeFloatBE=function(c,u,d){return ui(this,c,u,!1,d)};function ce(c,u,d,S,N){return u=+u,d=d>>>0,N||li(c,u,d,8),Br.write(c,u,d,S,52,8),d+8}o.prototype.writeDoubleLE=function(c,u,d){return ce(this,c,u,!0,d)},o.prototype.writeDoubleBE=function(c,u,d){return ce(this,c,u,!1,d)},o.prototype.copy=function(c,u,d,S){if(!o.isBuffer(c))throw new TypeError("argument should be a Buffer");if(d||(d=0),!S&&S!==0&&(S=this.length),u>=c.length&&(u=c.length),u||(u=0),S>0&&S<d&&(S=d),S===d||c.length===0||this.length===0)return 0;if(u<0)throw new RangeError("targetStart out of bounds");if(d<0||d>=this.length)throw new RangeError("Index out of range");if(S<0)throw new RangeError("sourceEnd out of bounds");S>this.length&&(S=this.length),c.length-u<S-d&&(S=c.length-u+d);var N=S-d;return this===c&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(u,d,S):Uint8Array.prototype.set.call(c,this.subarray(d,S),u),N},o.prototype.fill=function(c,u,d,S){if(typeof c=="string"){if(typeof u=="string"?(S=u,u=0,d=this.length):typeof d=="string"&&(S=d,d=this.length),S!==void 0&&typeof S!="string")throw new TypeError("encoding must be a string");if(typeof S=="string"&&!o.isEncoding(S))throw new TypeError("Unknown encoding: "+S);if(c.length===1){var N=c.charCodeAt(0);(S==="utf8"&&N<128||S==="latin1")&&(c=N)}}else typeof c=="number"?c=c&255:typeof c=="boolean"&&(c=Number(c));if(u<0||this.length<u||this.length<d)throw new RangeError("Out of range index");if(d<=u)return this;u=u>>>0,d=d===void 0?this.length:d>>>0,c||(c=0);var j;if(typeof c=="number")for(j=u;j<d;++j)this[j]=c;else{var K=o.isBuffer(c)?c:o.from(c,S),ht=K.length;if(ht===0)throw new TypeError('The value "'+c+'" is invalid for argument "value"');for(j=0;j<d-u;++j)this[j+u]=K[j%ht]}return this};var hi=/[^+/0-9A-Za-z-_]/g;function _s(c){if(c=c.split("=")[0],c=c.trim().replace(hi,""),c.length<2)return"";for(;c.length%4!==0;)c=c+"=";return c}function gn(c,u){u=u||1/0;for(var d,S=c.length,N=null,j=[],K=0;K<S;++K){if(d=c.charCodeAt(K),d>55295&&d<57344){if(!N){if(d>56319){(u-=3)>-1&&j.push(239,191,189);continue}else if(K+1===S){(u-=3)>-1&&j.push(239,191,189);continue}N=d;continue}if(d<56320){(u-=3)>-1&&j.push(239,191,189),N=d;continue}d=(N-55296<<10|d-56320)+65536}else N&&(u-=3)>-1&&j.push(239,191,189);if(N=null,d<128){if((u-=1)<0)break;j.push(d)}else if(d<2048){if((u-=2)<0)break;j.push(d>>6|192,d&63|128)}else if(d<65536){if((u-=3)<0)break;j.push(d>>12|224,d>>6&63|128,d&63|128)}else if(d<1114112){if((u-=4)<0)break;j.push(d>>18|240,d>>12&63|128,d>>6&63|128,d&63|128)}else throw new Error("Invalid code point")}return j}function Es(c){for(var u=[],d=0;d<c.length;++d)u.push(c.charCodeAt(d)&255);return u}function Ss(c,u){for(var d,S,N,j=[],K=0;K<c.length&&!((u-=2)<0);++K)d=c.charCodeAt(K),S=d>>8,N=d%256,j.push(N),j.push(S);return j}function pi(c){return js.toByteArray(_s(c))}function Ur(c,u,d,S){for(var N=0;N<S&&!(N+d>=u.length||N>=c.length);++N)u[N+d]=c[N];return N}function le(c,u){return c instanceof u||c!=null&&c.constructor!=null&&c.constructor.name!=null&&c.constructor.name===u.name}function mn(c){return c!==c}var Is=function(){for(var c="0123456789abcdef",u=new Array(256),d=0;d<16;++d)for(var S=d*16,N=0;N<16;++N)u[S+N]=c[d]+c[N];return u}()}),ut=hs.Buffer;hs.SlowBuffer;hs.INSPECT_MAX_BYTES;hs.kMaxLength;var Mo=function(t,e){return Mo=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},Mo(t,e)};function ps(t,e){Mo(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var Er=function(t){ps(e,t);function e(r){var n=t.call(this,r)||this;return Object.setPrototypeOf(n,e.prototype),n}return Object.defineProperty(e.prototype,"name",{get:function(){return"BSONError"},enumerable:!1,configurable:!0}),e}(Error),At=function(t){ps(e,t);function e(r){var n=t.call(this,r)||this;return Object.setPrototypeOf(n,e.prototype),n}return Object.defineProperty(e.prototype,"name",{get:function(){return"BSONTypeError"},enumerable:!1,configurable:!0}),e}(TypeError);function Ii(t){return t&&t.Math==Math&&t}function Ph(){return Ii(typeof globalThis=="object"&&globalThis)||Ii(typeof window=="object"&&window)||Ii(typeof self=="object"&&self)||Ii(typeof global=="object"&&global)||Function("return this")()}function Ew(){var t=Ph();return typeof t.navigator=="object"&&t.navigator.product==="ReactNative"}var Sw=function(t){var e=Ew()?"BSON: For React Native please polyfill crypto.getRandomValues, e.g. using: https://www.npmjs.com/package/react-native-get-random-values.":"BSON: No cryptographic implementation for random bytes present, falling back to a less secure implementation.";console.warn(e);for(var r=ut.alloc(t),n=0;n<t;++n)r[n]=Math.floor(Math.random()*256);return r},Iw=function(){{if(typeof window<"u"){var t=window.crypto||window.msCrypto;if(t&&t.getRandomValues)return function(e){return t.getRandomValues(ut.alloc(e))}}return typeof global<"u"&&global.crypto&&global.crypto.getRandomValues?function(e){return global.crypto.getRandomValues(ut.alloc(e))}:Sw}},Rh=Iw();function Cw(t){return["[object ArrayBuffer]","[object SharedArrayBuffer]"].includes(Object.prototype.toString.call(t))}function La(t){return Object.prototype.toString.call(t)==="[object Uint8Array]"}function Tw(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function xw(t){return si(t)&&Object.prototype.toString.call(t)==="[object Date]"}function si(t){return typeof t=="object"&&t!==null}function ds(t,e){var r=!1;function n(){for(var i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];return r||(console.warn(e),r=!0),t.apply(this,i)}return n}function zi(t){if(ArrayBuffer.isView(t))return ut.from(t.buffer,t.byteOffset,t.byteLength);if(Cw(t))return ut.from(t);throw new At("Must use either Buffer or TypedArray")}var Dw=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|[0-9a-f]{12}4[0-9a-f]{3}[89ab][0-9a-f]{15})$/i,Lh=function(t){return typeof t=="string"&&Dw.test(t)},Bo=function(t){if(!Lh(t))throw new At('UUID string representations must be a 32 or 36 character hex string (dashes excluded/included). Format: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" or "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".');var e=t.replace(/-/g,"");return ut.from(e,"hex")},Tl=function(t,e){return e===void 0&&(e=!0),e?t.toString("hex",0,4)+"-"+t.toString("hex",4,6)+"-"+t.toString("hex",6,8)+"-"+t.toString("hex",8,10)+"-"+t.toString("hex",10,16):t.toString("hex")},xE=Math.pow(2,63)-1,DE=-Math.pow(2,63),Nw=Math.pow(2,53),Aw=-Math.pow(2,53),Uh=4,Sr=function(){function t(e,r){if(!(this instanceof t))return new t(e,r);if(e!=null&&typeof e!="string"&&!ArrayBuffer.isView(e)&&!(e instanceof ArrayBuffer)&&!Array.isArray(e))throw new At("Binary can only be constructed from string, Buffer, TypedArray, or Array<number>");this.sub_type=r??t.BSON_BINARY_SUBTYPE_DEFAULT,e==null?(this.buffer=ut.alloc(t.BUFFER_SIZE),this.position=0):(typeof e=="string"?this.buffer=ut.from(e,"binary"):Array.isArray(e)?this.buffer=ut.from(e):this.buffer=zi(e),this.position=this.buffer.byteLength)}return t.prototype.put=function(e){if(typeof e=="string"&&e.length!==1)throw new At("only accepts single character String");if(typeof e!="number"&&e.length!==1)throw new At("only accepts single character Uint8Array or Array");var r;if(typeof e=="string"?r=e.charCodeAt(0):typeof e=="number"?r=e:r=e[0],r<0||r>255)throw new At("only accepts number in a valid unsigned byte range 0-255");if(this.buffer.length>this.position)this.buffer[this.position++]=r;else{var n=ut.alloc(t.BUFFER_SIZE+this.buffer.length);this.buffer.copy(n,0,0,this.buffer.length),this.buffer=n,this.buffer[this.position++]=r}},t.prototype.write=function(e,r){if(r=typeof r=="number"?r:this.position,this.buffer.length<r+e.length){var n=ut.alloc(this.buffer.length+e.length);this.buffer.copy(n,0,0,this.buffer.length),this.buffer=n}ArrayBuffer.isView(e)?(this.buffer.set(zi(e),r),this.position=r+e.byteLength>this.position?r+e.length:this.position):typeof e=="string"&&(this.buffer.write(e,r,e.length,"binary"),this.position=r+e.length>this.position?r+e.length:this.position)},t.prototype.read=function(e,r){return r=r&&r>0?r:this.position,this.buffer.slice(e,e+r)},t.prototype.value=function(e){return e=!!e,e&&this.buffer.length===this.position?this.buffer:e?this.buffer.slice(0,this.position):this.buffer.toString("binary",0,this.position)},t.prototype.length=function(){return this.position},t.prototype.toJSON=function(){return this.buffer.toString("base64")},t.prototype.toString=function(e){return this.buffer.toString(e)},t.prototype.toExtendedJSON=function(e){e=e||{};var r=this.buffer.toString("base64"),n=Number(this.sub_type).toString(16);return e.legacy?{$binary:r,$type:n.length===1?"0"+n:n}:{$binary:{base64:r,subType:n.length===1?"0"+n:n}}},t.prototype.toUUID=function(){if(this.sub_type===t.SUBTYPE_UUID)return new xl(this.buffer.slice(0,this.position));throw new Er('Binary sub_type "'.concat(this.sub_type,'" is not supported for converting to UUID. Only "').concat(t.SUBTYPE_UUID,'" is currently supported.'))},t.fromExtendedJSON=function(e,r){r=r||{};var n,i;if("$binary"in e?r.legacy&&typeof e.$binary=="string"&&"$type"in e?(i=e.$type?parseInt(e.$type,16):0,n=ut.from(e.$binary,"base64")):typeof e.$binary!="string"&&(i=e.$binary.subType?parseInt(e.$binary.subType,16):0,n=ut.from(e.$binary.base64,"base64")):"$uuid"in e&&(i=4,n=Bo(e.$uuid)),!n)throw new At("Unexpected Binary Extended JSON format ".concat(JSON.stringify(e)));return i===Uh?new xl(n):new t(n,i)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var e=this.value(!0);return'new Binary(Buffer.from("'.concat(e.toString("hex"),'", "hex"), ').concat(this.sub_type,")")},t.BSON_BINARY_SUBTYPE_DEFAULT=0,t.BUFFER_SIZE=256,t.SUBTYPE_DEFAULT=0,t.SUBTYPE_FUNCTION=1,t.SUBTYPE_BYTE_ARRAY=2,t.SUBTYPE_UUID_OLD=3,t.SUBTYPE_UUID=4,t.SUBTYPE_MD5=5,t.SUBTYPE_ENCRYPTED=6,t.SUBTYPE_COLUMN=7,t.SUBTYPE_USER_DEFINED=128,t}();Object.defineProperty(Sr.prototype,"_bsontype",{value:"Binary"});var $s=16,xl=function(t){ps(e,t);function e(r){var n=this,i,s;if(r==null)i=e.generate();else if(r instanceof e)i=ut.from(r.buffer),s=r.__id;else if(ArrayBuffer.isView(r)&&r.byteLength===$s)i=zi(r);else if(typeof r=="string")i=Bo(r);else throw new At("Argument passed in UUID constructor must be a UUID, a 16 byte Buffer or a 32/36 character hex string (dashes excluded/included, format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).");return n=t.call(this,i,Uh)||this,n.__id=s,n}return Object.defineProperty(e.prototype,"id",{get:function(){return this.buffer},set:function(r){this.buffer=r,e.cacheHexString&&(this.__id=Tl(r))},enumerable:!1,configurable:!0}),e.prototype.toHexString=function(r){if(r===void 0&&(r=!0),e.cacheHexString&&this.__id)return this.__id;var n=Tl(this.id,r);return e.cacheHexString&&(this.__id=n),n},e.prototype.toString=function(r){return r?this.id.toString(r):this.toHexString()},e.prototype.toJSON=function(){return this.toHexString()},e.prototype.equals=function(r){if(!r)return!1;if(r instanceof e)return r.id.equals(this.id);try{return new e(r).id.equals(this.id)}catch{return!1}},e.prototype.toBinary=function(){return new Sr(this.id,Sr.SUBTYPE_UUID)},e.generate=function(){var r=Rh($s);return r[6]=r[6]&15|64,r[8]=r[8]&63|128,ut.from(r)},e.isValid=function(r){return r?r instanceof e?!0:typeof r=="string"?Lh(r):La(r)?r.length!==$s?!1:(r[6]&240)===64&&(r[8]&128)===128:!1:!1},e.createFromHexString=function(r){var n=Bo(r);return new e(n)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return'new UUID("'.concat(this.toHexString(),'")')},e}(Sr),fs=function(){function t(e,r){if(!(this instanceof t))return new t(e,r);this.code=e,this.scope=r}return t.prototype.toJSON=function(){return{code:this.code,scope:this.scope}},t.prototype.toExtendedJSON=function(){return this.scope?{$code:this.code,$scope:this.scope}:{$code:this.code}},t.fromExtendedJSON=function(e){return new t(e.$code,e.$scope)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var e=this.toJSON();return'new Code("'.concat(String(e.code),'"').concat(e.scope?", ".concat(JSON.stringify(e.scope)):"",")")},t}();Object.defineProperty(fs.prototype,"_bsontype",{value:"Code"});function Ow(t){return si(t)&&t.$id!=null&&typeof t.$ref=="string"&&(t.$db==null||typeof t.$db=="string")}var zn=function(){function t(e,r,n,i){if(!(this instanceof t))return new t(e,r,n,i);var s=e.split(".");s.length===2&&(n=s.shift(),e=s.shift()),this.collection=e,this.oid=r,this.db=n,this.fields=i||{}}return Object.defineProperty(t.prototype,"namespace",{get:function(){return this.collection},set:function(e){this.collection=e},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){var e=Object.assign({$ref:this.collection,$id:this.oid},this.fields);return this.db!=null&&(e.$db=this.db),e},t.prototype.toExtendedJSON=function(e){e=e||{};var r={$ref:this.collection,$id:this.oid};return e.legacy||(this.db&&(r.$db=this.db),r=Object.assign(r,this.fields)),r},t.fromExtendedJSON=function(e){var r=Object.assign({},e);return delete r.$ref,delete r.$id,delete r.$db,new t(e.$ref,e.$id,e.$db,r)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var e=this.oid===void 0||this.oid.toString===void 0?this.oid:this.oid.toString();return'new DBRef("'.concat(this.namespace,'", new ObjectId("').concat(String(e),'")').concat(this.db?', "'.concat(this.db,'"'):"",")")},t}();Object.defineProperty(zn.prototype,"_bsontype",{value:"DBRef"});var he=void 0;try{he=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}var Dl=65536,kw=1<<24,Wr=Dl*Dl,Mh=Wr*Wr,Nl=Mh/2,Al={},Ol={},J=function(){function t(e,r,n){if(e===void 0&&(e=0),!(this instanceof t))return new t(e,r,n);typeof e=="bigint"?Object.assign(this,t.fromBigInt(e,!!r)):typeof e=="string"?Object.assign(this,t.fromString(e,!!r)):(this.low=e|0,this.high=r|0,this.unsigned=!!n),Object.defineProperty(this,"__isLong__",{value:!0,configurable:!1,writable:!1,enumerable:!1})}return t.fromBits=function(e,r,n){return new t(e,r,n)},t.fromInt=function(e,r){var n,i,s;return r?(e>>>=0,(s=0<=e&&e<256)&&(i=Ol[e],i)?i:(n=t.fromBits(e,(e|0)<0?-1:0,!0),s&&(Ol[e]=n),n)):(e|=0,(s=-128<=e&&e<128)&&(i=Al[e],i)?i:(n=t.fromBits(e,e<0?-1:0,!1),s&&(Al[e]=n),n))},t.fromNumber=function(e,r){if(isNaN(e))return r?t.UZERO:t.ZERO;if(r){if(e<0)return t.UZERO;if(e>=Mh)return t.MAX_UNSIGNED_VALUE}else{if(e<=-Nl)return t.MIN_VALUE;if(e+1>=Nl)return t.MAX_VALUE}return e<0?t.fromNumber(-e,r).neg():t.fromBits(e%Wr|0,e/Wr|0,r)},t.fromBigInt=function(e,r){return t.fromString(e.toString(),r)},t.fromString=function(e,r,n){if(e.length===0)throw Error("empty string");if(e==="NaN"||e==="Infinity"||e==="+Infinity"||e==="-Infinity")return t.ZERO;if(typeof r=="number"?(n=r,r=!1):r=!!r,n=n||10,n<2||36<n)throw RangeError("radix");var i;if((i=e.indexOf("-"))>0)throw Error("interior hyphen");if(i===0)return t.fromString(e.substring(1),r,n).neg();for(var s=t.fromNumber(Math.pow(n,8)),o=t.ZERO,a=0;a<e.length;a+=8){var l=Math.min(8,e.length-a),h=parseInt(e.substring(a,a+l),n);if(l<8){var g=t.fromNumber(Math.pow(n,l));o=o.mul(g).add(t.fromNumber(h))}else o=o.mul(s),o=o.add(t.fromNumber(h))}return o.unsigned=r,o},t.fromBytes=function(e,r,n){return n?t.fromBytesLE(e,r):t.fromBytesBE(e,r)},t.fromBytesLE=function(e,r){return new t(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,r)},t.fromBytesBE=function(e,r){return new t(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],r)},t.isLong=function(e){return si(e)&&e.__isLong__===!0},t.fromValue=function(e,r){return typeof e=="number"?t.fromNumber(e,r):typeof e=="string"?t.fromString(e,r):t.fromBits(e.low,e.high,typeof r=="boolean"?r:e.unsigned)},t.prototype.add=function(e){t.isLong(e)||(e=t.fromValue(e));var r=this.high>>>16,n=this.high&65535,i=this.low>>>16,s=this.low&65535,o=e.high>>>16,a=e.high&65535,l=e.low>>>16,h=e.low&65535,g=0,p=0,_=0,w=0;return w+=s+h,_+=w>>>16,w&=65535,_+=i+l,p+=_>>>16,_&=65535,p+=n+a,g+=p>>>16,p&=65535,g+=r+o,g&=65535,t.fromBits(_<<16|w,g<<16|p,this.unsigned)},t.prototype.and=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low&e.low,this.high&e.high,this.unsigned)},t.prototype.compare=function(e){if(t.isLong(e)||(e=t.fromValue(e)),this.eq(e))return 0;var r=this.isNegative(),n=e.isNegative();return r&&!n?-1:!r&&n?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},t.prototype.comp=function(e){return this.compare(e)},t.prototype.divide=function(e){if(t.isLong(e)||(e=t.fromValue(e)),e.isZero())throw Error("division by zero");if(he){if(!this.unsigned&&this.high===-2147483648&&e.low===-1&&e.high===-1)return this;var r=(this.unsigned?he.div_u:he.div_s)(this.low,this.high,e.low,e.high);return t.fromBits(r,he.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?t.UZERO:t.ZERO;var n,i,s;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return t.UZERO;if(e.gt(this.shru(1)))return t.UONE;s=t.UZERO}else{if(this.eq(t.MIN_VALUE)){if(e.eq(t.ONE)||e.eq(t.NEG_ONE))return t.MIN_VALUE;if(e.eq(t.MIN_VALUE))return t.ONE;var o=this.shr(1);return n=o.div(e).shl(1),n.eq(t.ZERO)?e.isNegative()?t.ONE:t.NEG_ONE:(i=this.sub(e.mul(n)),s=n.add(i.div(e)),s)}else if(e.eq(t.MIN_VALUE))return this.unsigned?t.UZERO:t.ZERO;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();s=t.ZERO}for(i=this;i.gte(e);){n=Math.max(1,Math.floor(i.toNumber()/e.toNumber()));for(var a=Math.ceil(Math.log(n)/Math.LN2),l=a<=48?1:Math.pow(2,a-48),h=t.fromNumber(n),g=h.mul(e);g.isNegative()||g.gt(i);)n-=l,h=t.fromNumber(n,this.unsigned),g=h.mul(e);h.isZero()&&(h=t.ONE),s=s.add(h),i=i.sub(g)}return s},t.prototype.div=function(e){return this.divide(e)},t.prototype.equals=function(e){return t.isLong(e)||(e=t.fromValue(e)),this.unsigned!==e.unsigned&&this.high>>>31===1&&e.high>>>31===1?!1:this.high===e.high&&this.low===e.low},t.prototype.eq=function(e){return this.equals(e)},t.prototype.getHighBits=function(){return this.high},t.prototype.getHighBitsUnsigned=function(){return this.high>>>0},t.prototype.getLowBits=function(){return this.low},t.prototype.getLowBitsUnsigned=function(){return this.low>>>0},t.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.eq(t.MIN_VALUE)?64:this.neg().getNumBitsAbs();var e=this.high!==0?this.high:this.low,r;for(r=31;r>0&&(e&1<<r)===0;r--);return this.high!==0?r+33:r+1},t.prototype.greaterThan=function(e){return this.comp(e)>0},t.prototype.gt=function(e){return this.greaterThan(e)},t.prototype.greaterThanOrEqual=function(e){return this.comp(e)>=0},t.prototype.gte=function(e){return this.greaterThanOrEqual(e)},t.prototype.ge=function(e){return this.greaterThanOrEqual(e)},t.prototype.isEven=function(){return(this.low&1)===0},t.prototype.isNegative=function(){return!this.unsigned&&this.high<0},t.prototype.isOdd=function(){return(this.low&1)===1},t.prototype.isPositive=function(){return this.unsigned||this.high>=0},t.prototype.isZero=function(){return this.high===0&&this.low===0},t.prototype.lessThan=function(e){return this.comp(e)<0},t.prototype.lt=function(e){return this.lessThan(e)},t.prototype.lessThanOrEqual=function(e){return this.comp(e)<=0},t.prototype.lte=function(e){return this.lessThanOrEqual(e)},t.prototype.modulo=function(e){if(t.isLong(e)||(e=t.fromValue(e)),he){var r=(this.unsigned?he.rem_u:he.rem_s)(this.low,this.high,e.low,e.high);return t.fromBits(r,he.get_high(),this.unsigned)}return this.sub(this.div(e).mul(e))},t.prototype.mod=function(e){return this.modulo(e)},t.prototype.rem=function(e){return this.modulo(e)},t.prototype.multiply=function(e){if(this.isZero())return t.ZERO;if(t.isLong(e)||(e=t.fromValue(e)),he){var r=he.mul(this.low,this.high,e.low,e.high);return t.fromBits(r,he.get_high(),this.unsigned)}if(e.isZero())return t.ZERO;if(this.eq(t.MIN_VALUE))return e.isOdd()?t.MIN_VALUE:t.ZERO;if(e.eq(t.MIN_VALUE))return this.isOdd()?t.MIN_VALUE:t.ZERO;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(t.TWO_PWR_24)&&e.lt(t.TWO_PWR_24))return t.fromNumber(this.toNumber()*e.toNumber(),this.unsigned);var n=this.high>>>16,i=this.high&65535,s=this.low>>>16,o=this.low&65535,a=e.high>>>16,l=e.high&65535,h=e.low>>>16,g=e.low&65535,p=0,_=0,w=0,b=0;return b+=o*g,w+=b>>>16,b&=65535,w+=s*g,_+=w>>>16,w&=65535,w+=o*h,_+=w>>>16,w&=65535,_+=i*g,p+=_>>>16,_&=65535,_+=s*h,p+=_>>>16,_&=65535,_+=o*l,p+=_>>>16,_&=65535,p+=n*g+i*h+s*l+o*a,p&=65535,t.fromBits(w<<16|b,p<<16|_,this.unsigned)},t.prototype.mul=function(e){return this.multiply(e)},t.prototype.negate=function(){return!this.unsigned&&this.eq(t.MIN_VALUE)?t.MIN_VALUE:this.not().add(t.ONE)},t.prototype.neg=function(){return this.negate()},t.prototype.not=function(){return t.fromBits(~this.low,~this.high,this.unsigned)},t.prototype.notEquals=function(e){return!this.equals(e)},t.prototype.neq=function(e){return this.notEquals(e)},t.prototype.ne=function(e){return this.notEquals(e)},t.prototype.or=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low|e.low,this.high|e.high,this.unsigned)},t.prototype.shiftLeft=function(e){return t.isLong(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?t.fromBits(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):t.fromBits(0,this.low<<e-32,this.unsigned)},t.prototype.shl=function(e){return this.shiftLeft(e)},t.prototype.shiftRight=function(e){return t.isLong(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?t.fromBits(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):t.fromBits(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},t.prototype.shr=function(e){return this.shiftRight(e)},t.prototype.shiftRightUnsigned=function(e){if(t.isLong(e)&&(e=e.toInt()),e&=63,e===0)return this;var r=this.high;if(e<32){var n=this.low;return t.fromBits(n>>>e|r<<32-e,r>>>e,this.unsigned)}else return e===32?t.fromBits(r,0,this.unsigned):t.fromBits(r>>>e-32,0,this.unsigned)},t.prototype.shr_u=function(e){return this.shiftRightUnsigned(e)},t.prototype.shru=function(e){return this.shiftRightUnsigned(e)},t.prototype.subtract=function(e){return t.isLong(e)||(e=t.fromValue(e)),this.add(e.neg())},t.prototype.sub=function(e){return this.subtract(e)},t.prototype.toInt=function(){return this.unsigned?this.low>>>0:this.low},t.prototype.toNumber=function(){return this.unsigned?(this.high>>>0)*Wr+(this.low>>>0):this.high*Wr+(this.low>>>0)},t.prototype.toBigInt=function(){return BigInt(this.toString())},t.prototype.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},t.prototype.toBytesLE=function(){var e=this.high,r=this.low;return[r&255,r>>>8&255,r>>>16&255,r>>>24,e&255,e>>>8&255,e>>>16&255,e>>>24]},t.prototype.toBytesBE=function(){var e=this.high,r=this.low;return[e>>>24,e>>>16&255,e>>>8&255,e&255,r>>>24,r>>>16&255,r>>>8&255,r&255]},t.prototype.toSigned=function(){return this.unsigned?t.fromBits(this.low,this.high,!1):this},t.prototype.toString=function(e){if(e=e||10,e<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(t.MIN_VALUE)){var r=t.fromNumber(e),n=this.div(r),i=n.mul(r).sub(this);return n.toString(e)+i.toInt().toString(e)}else return"-"+this.neg().toString(e);for(var s=t.fromNumber(Math.pow(e,6),this.unsigned),o=this,a="";;){var l=o.div(s),h=o.sub(l.mul(s)).toInt()>>>0,g=h.toString(e);if(o=l,o.isZero())return g+a;for(;g.length<6;)g="0"+g;a=""+g+a}},t.prototype.toUnsigned=function(){return this.unsigned?this:t.fromBits(this.low,this.high,!0)},t.prototype.xor=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low^e.low,this.high^e.high,this.unsigned)},t.prototype.eqz=function(){return this.isZero()},t.prototype.le=function(e){return this.lessThanOrEqual(e)},t.prototype.toExtendedJSON=function(e){return e&&e.relaxed?this.toNumber():{$numberLong:this.toString()}},t.fromExtendedJSON=function(e,r){var n=t.fromString(e.$numberLong);return r&&r.relaxed?n.toNumber():n},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new Long("'.concat(this.toString(),'"').concat(this.unsigned?", true":"",")")},t.TWO_PWR_24=t.fromInt(kw),t.MAX_UNSIGNED_VALUE=t.fromBits(-1,-1,!0),t.ZERO=t.fromInt(0),t.UZERO=t.fromInt(0,!0),t.ONE=t.fromInt(1),t.UONE=t.fromInt(1,!0),t.NEG_ONE=t.fromInt(-1),t.MAX_VALUE=t.fromBits(-1,2147483647,!1),t.MIN_VALUE=t.fromBits(0,-2147483648,!1),t}();Object.defineProperty(J.prototype,"__isLong__",{value:!0});Object.defineProperty(J.prototype,"_bsontype",{value:"Long"});var Pw=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,Rw=/^(\+|-)?(Infinity|inf)$/i,Lw=/^(\+|-)?NaN$/i,_n=6111,Fs=-6176,kl=6176,Uw=34,Hs=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Pl=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Rl=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Mw=/^([-+])?(\d+)?$/,Bw=31,Ll=16383,jw=30,$w=31;function Ul(t){return!isNaN(parseInt(t,10))}function Fw(t){var e=J.fromNumber(1e9),r=J.fromNumber(0);if(!t.parts[0]&&!t.parts[1]&&!t.parts[2]&&!t.parts[3])return{quotient:t,rem:r};for(var n=0;n<=3;n++)r=r.shiftLeft(32),r=r.add(new J(t.parts[n],0)),t.parts[n]=r.div(e).low,r=r.modulo(e);return{quotient:t,rem:r}}function Hw(t,e){if(!t&&!e)return{high:J.fromNumber(0),low:J.fromNumber(0)};var r=t.shiftRightUnsigned(32),n=new J(t.getLowBits(),0),i=e.shiftRightUnsigned(32),s=new J(e.getLowBits(),0),o=r.multiply(i),a=r.multiply(s),l=n.multiply(i),h=n.multiply(s);return o=o.add(a.shiftRightUnsigned(32)),a=new J(a.getLowBits(),0).add(l).add(h.shiftRightUnsigned(32)),o=o.add(a.shiftRightUnsigned(32)),h=a.shiftLeft(32).add(new J(h.getLowBits(),0)),{high:o,low:h}}function Vw(t,e){var r=t.high>>>0,n=e.high>>>0;if(r<n)return!0;if(r===n){var i=t.low>>>0,s=e.low>>>0;if(i<s)return!0}return!1}function jr(t,e){throw new At('"'.concat(t,'" is not a valid Decimal128 string - ').concat(e))}var Ua=function(){function t(e){if(!(this instanceof t))return new t(e);if(typeof e=="string")this.bytes=t.fromString(e).bytes;else if(La(e)){if(e.byteLength!==16)throw new At("Decimal128 must take a Buffer of 16 bytes");this.bytes=e}else throw new At("Decimal128 must take a Buffer or string")}return t.fromString=function(e){var r=!1,n=!1,i=!1,s=0,o=0,a=0,l=0,h=0,g=[0],p=0,_=0,w=0,b=0,E=0,P=0,A=new J(0,0),M=new J(0,0),z=0,B=0;if(e.length>=7e3)throw new At(""+e+" not a valid Decimal128 string");var Z=e.match(Pw),bt=e.match(Rw),It=e.match(Lw);if(!Z&&!bt&&!It||e.length===0)throw new At(""+e+" not a valid Decimal128 string");if(Z){var H=Z[2],rt=Z[4],X=Z[5],tt=Z[6];rt&&tt===void 0&&jr(e,"missing exponent power"),rt&&H===void 0&&jr(e,"missing exponent base"),rt===void 0&&(X||tt)&&jr(e,"missing e before exponent")}if((e[B]==="+"||e[B]==="-")&&(r=e[B++]==="-"),!Ul(e[B])&&e[B]!=="."){if(e[B]==="i"||e[B]==="I")return new t(ut.from(r?Pl:Rl));if(e[B]==="N")return new t(ut.from(Hs))}for(;Ul(e[B])||e[B]===".";){if(e[B]==="."){n&&jr(e,"contains multiple periods"),n=!0,B=B+1;continue}p<34&&(e[B]!=="0"||i)&&(i||(h=o),i=!0,g[_++]=parseInt(e[B],10),p=p+1),i&&(a=a+1),n&&(l=l+1),o=o+1,B=B+1}if(n&&!o)throw new At(""+e+" not a valid Decimal128 string");if(e[B]==="e"||e[B]==="E"){var ct=e.substr(++B).match(Mw);if(!ct||!ct[2])return new t(ut.from(Hs));E=parseInt(ct[0],10),B=B+ct[0].length}if(e[B])return new t(ut.from(Hs));if(w=0,!p)w=0,b=0,g[0]=0,a=1,p=1,s=0;else if(b=p-1,s=a,s!==1)for(;g[h+s-1]===0;)s=s-1;for(E<=l&&l-E>16384?E=Fs:E=E-l;E>_n;){if(b=b+1,b-w>Uw){var Tt=g.join("");if(Tt.match(/^0+$/)){E=_n;break}jr(e,"overflow")}E=E-1}for(;E<Fs||p<a;){if(b===0&&s<p){E=Fs,s=0;break}if(p<a?a=a-1:b=b-1,E<_n)E=E+1;else{var Tt=g.join("");if(Tt.match(/^0+$/)){E=_n;break}jr(e,"overflow")}}if(b-w+1<s){var m=o;n&&(h=h+1,m=m+1),r&&(h=h+1,m=m+1);var Ft=parseInt(e[h+b+1],10),qt=0;if(Ft>=5&&(qt=1,Ft===5)){for(qt=g[b]%2===1?1:0,P=h+b+2;P<m;P++)if(parseInt(e[P],10)){qt=1;break}}if(qt){for(var mt=b;mt>=0;mt--)if(++g[mt]>9&&(g[mt]=0,mt===0))if(E<_n)E=E+1,g[mt]=1;else return new t(ut.from(r?Pl:Rl))}}if(A=J.fromNumber(0),M=J.fromNumber(0),s===0)A=J.fromNumber(0),M=J.fromNumber(0);else if(b-w<17){var mt=w;for(M=J.fromNumber(g[mt++]),A=new J(0,0);mt<=b;mt++)M=M.multiply(J.fromNumber(10)),M=M.add(J.fromNumber(g[mt]))}else{var mt=w;for(A=J.fromNumber(g[mt++]);mt<=b-17;mt++)A=A.multiply(J.fromNumber(10)),A=A.add(J.fromNumber(g[mt]));for(M=J.fromNumber(g[mt++]);mt<=b;mt++)M=M.multiply(J.fromNumber(10)),M=M.add(J.fromNumber(g[mt]))}var zt=Hw(A,J.fromString("100000000000000000"));zt.low=zt.low.add(M),Vw(zt.low,M)&&(zt.high=zt.high.add(J.fromNumber(1))),z=E+kl;var ot={low:J.fromNumber(0),high:J.fromNumber(0)};zt.high.shiftRightUnsigned(49).and(J.fromNumber(1)).equals(J.fromNumber(1))?(ot.high=ot.high.or(J.fromNumber(3).shiftLeft(61)),ot.high=ot.high.or(J.fromNumber(z).and(J.fromNumber(16383).shiftLeft(47))),ot.high=ot.high.or(zt.high.and(J.fromNumber(0x7fffffffffff)))):(ot.high=ot.high.or(J.fromNumber(z&16383).shiftLeft(49)),ot.high=ot.high.or(zt.high.and(J.fromNumber(562949953421311)))),ot.low=zt.low,r&&(ot.high=ot.high.or(J.fromString("9223372036854775808")));var nt=ut.alloc(16);return B=0,nt[B++]=ot.low.low&255,nt[B++]=ot.low.low>>8&255,nt[B++]=ot.low.low>>16&255,nt[B++]=ot.low.low>>24&255,nt[B++]=ot.low.high&255,nt[B++]=ot.low.high>>8&255,nt[B++]=ot.low.high>>16&255,nt[B++]=ot.low.high>>24&255,nt[B++]=ot.high.low&255,nt[B++]=ot.high.low>>8&255,nt[B++]=ot.high.low>>16&255,nt[B++]=ot.high.low>>24&255,nt[B++]=ot.high.high&255,nt[B++]=ot.high.high>>8&255,nt[B++]=ot.high.high>>16&255,nt[B++]=ot.high.high>>24&255,new t(nt)},t.prototype.toString=function(){for(var e,r=0,n=new Array(36),i=0;i<n.length;i++)n[i]=0;var s=0,o=!1,a,l={parts:[0,0,0,0]},h,g,p=[];s=0;var _=this.bytes,w=_[s++]|_[s++]<<8|_[s++]<<16|_[s++]<<24,b=_[s++]|_[s++]<<8|_[s++]<<16|_[s++]<<24,E=_[s++]|_[s++]<<8|_[s++]<<16|_[s++]<<24,P=_[s++]|_[s++]<<8|_[s++]<<16|_[s++]<<24;s=0;var A={low:new J(w,b),high:new J(E,P)};A.high.lessThan(J.ZERO)&&p.push("-");var M=P>>26&Bw;if(M>>3===3){if(M===jw)return p.join("")+"Infinity";if(M===$w)return"NaN";e=P>>15&Ll,a=8+(P>>14&1)}else a=P>>14&7,e=P>>17⋘var z=e-kl;if(l.parts[0]=(P&16383)+((a&15)<<14),l.parts[1]=E,l.parts[2]=b,l.parts[3]=w,l.parts[0]===0&&l.parts[1]===0&&l.parts[2]===0&&l.parts[3]===0)o=!0;else for(g=3;g>=0;g--){var B=0,Z=Fw(l);if(l=Z.quotient,B=Z.rem.low,!!B)for(h=8;h>=0;h--)n[g*9+h]=B%10,B=Math.floor(B/10)}if(o)r=1,n[s]=0;else for(r=36;!n[s];)r=r-1,s=s+1;var bt=r-1+z;if(bt>=34||bt<=-7||z>0){if(r>34)return p.push("".concat(0)),z>0?p.push("E+".concat(z)):z<0&&p.push("E".concat(z)),p.join("");p.push("".concat(n[s++])),r=r-1,r&&p.push(".");for(var i=0;i<r;i++)p.push("".concat(n[s++]));p.push("E"),bt>0?p.push("+".concat(bt)):p.push("".concat(bt))}else if(z>=0)for(var i=0;i<r;i++)p.push("".concat(n[s++]));else{var It=r+z;if(It>0)for(var i=0;i<It;i++)p.push("".concat(n[s++]));else p.push("0");for(p.push(".");It++<0;)p.push("0");for(var i=0;i<r-Math.max(It-1,0);i++)p.push("".concat(n[s++]))}return p.join("")},t.prototype.toJSON=function(){return{$numberDecimal:this.toString()}},t.prototype.toExtendedJSON=function(){return{$numberDecimal:this.toString()}},t.fromExtendedJSON=function(e){return t.fromString(e.$numberDecimal)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new Decimal128("'.concat(this.toString(),'")')},t}();Object.defineProperty(Ua.prototype,"_bsontype",{value:"Decimal128"});var gs=function(){function t(e){if(!(this instanceof t))return new t(e);e instanceof Number&&(e=e.valueOf()),this.value=+e}return t.prototype.valueOf=function(){return this.value},t.prototype.toJSON=function(){return this.value},t.prototype.toString=function(e){return this.value.toString(e)},t.prototype.toExtendedJSON=function(e){return e&&(e.legacy||e.relaxed&&isFinite(this.value))?this.value:Object.is(Math.sign(this.value),-0)?{$numberDouble:"-".concat(this.value.toFixed(1))}:{$numberDouble:Number.isInteger(this.value)?this.value.toFixed(1):this.value.toString()}},t.fromExtendedJSON=function(e,r){var n=parseFloat(e.$numberDouble);return r&&r.relaxed?n:new t(n)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var e=this.toExtendedJSON();return"new Double(".concat(e.$numberDouble,")")},t}();Object.defineProperty(gs.prototype,"_bsontype",{value:"Double"});var ms=function(){function t(e){if(!(this instanceof t))return new t(e);e instanceof Number&&(e=e.valueOf()),this.value=+e|0}return t.prototype.valueOf=function(){return this.value},t.prototype.toString=function(e){return this.value.toString(e)},t.prototype.toJSON=function(){return this.value},t.prototype.toExtendedJSON=function(e){return e&&(e.relaxed||e.legacy)?this.value:{$numberInt:this.value.toString()}},t.fromExtendedJSON=function(e,r){return r&&r.relaxed?parseInt(e.$numberInt,10):new t(e.$numberInt)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new Int32(".concat(this.valueOf(),")")},t}();Object.defineProperty(ms.prototype,"_bsontype",{value:"Int32"});var Ma=function(){function t(){if(!(this instanceof t))return new t}return t.prototype.toExtendedJSON=function(){return{$maxKey:1}},t.fromExtendedJSON=function(){return new t},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new MaxKey()"},t}();Object.defineProperty(Ma.prototype,"_bsontype",{value:"MaxKey"});var Ba=function(){function t(){if(!(this instanceof t))return new t}return t.prototype.toExtendedJSON=function(){return{$minKey:1}},t.fromExtendedJSON=function(){return new t},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new MinKey()"},t}();Object.defineProperty(Ba.prototype,"_bsontype",{value:"MinKey"});var Ww=new RegExp("^[0-9a-fA-F]{24}$"),fr=null,Se=Symbol("id"),Jt=function(){function t(e){if(!(this instanceof t))return new t(e);var r;if(typeof e=="object"&&e&&"id"in e){if(typeof e.id!="string"&&!ArrayBuffer.isView(e.id))throw new At("Argument passed in must have an id that is of type string or Buffer");"toHexString"in e&&typeof e.toHexString=="function"?r=ut.from(e.toHexString(),"hex"):r=e.id}else r=e;if(r==null||typeof r=="number")this[Se]=t.generate(typeof r=="number"?r:void 0);else if(ArrayBuffer.isView(r)&&r.byteLength===12)this[Se]=r instanceof ut?r:zi(r);else if(typeof r=="string")if(r.length===12){var n=ut.from(r);if(n.byteLength===12)this[Se]=n;else throw new At("Argument passed in must be a string of 12 bytes")}else if(r.length===24&&Ww.test(r))this[Se]=ut.from(r,"hex");else throw new At("Argument passed in must be a string of 12 bytes or a string of 24 hex characters or an integer");else throw new At("Argument passed in does not match the accepted types");t.cacheHexString&&(this.__id=this.id.toString("hex"))}return Object.defineProperty(t.prototype,"id",{get:function(){return this[Se]},set:function(e){this[Se]=e,t.cacheHexString&&(this.__id=e.toString("hex"))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"generationTime",{get:function(){return this.id.readInt32BE(0)},set:function(e){this.id.writeUInt32BE(e,0)},enumerable:!1,configurable:!0}),t.prototype.toHexString=function(){if(t.cacheHexString&&this.__id)return this.__id;var e=this.id.toString("hex");return t.cacheHexString&&!this.__id&&(this.__id=e),e},t.getInc=function(){return t.index=(t.index+1)%16777215},t.generate=function(e){typeof e!="number"&&(e=Math.floor(Date.now()/1e3));var r=t.getInc(),n=ut.alloc(12);return n.writeUInt32BE(e,0),fr===null&&(fr=Rh(5)),n[4]=fr[0],n[5]=fr[1],n[6]=fr[2],n[7]=fr[3],n[8]=fr[4],n[11]=r&255,n[10]=r>>8&255,n[9]=r>>16&255,n},t.prototype.toString=function(e){return e?this.id.toString(e):this.toHexString()},t.prototype.toJSON=function(){return this.toHexString()},t.prototype.equals=function(e){if(e==null)return!1;if(e instanceof t)return this[Se][11]===e[Se][11]&&this[Se].equals(e[Se]);if(typeof e=="string"&&t.isValid(e)&&e.length===12&&La(this.id))return e===ut.prototype.toString.call(this.id,"latin1");if(typeof e=="string"&&t.isValid(e)&&e.length===24)return e.toLowerCase()===this.toHexString();if(typeof e=="string"&&t.isValid(e)&&e.length===12)return ut.from(e).equals(this.id);if(typeof e=="object"&&"toHexString"in e&&typeof e.toHexString=="function"){var r=e.toHexString(),n=this.toHexString().toLowerCase();return typeof r=="string"&&r.toLowerCase()===n}return!1},t.prototype.getTimestamp=function(){var e=new Date,r=this.id.readUInt32BE(0);return e.setTime(Math.floor(r)*1e3),e},t.createPk=function(){return new t},t.createFromTime=function(e){var r=ut.from([0,0,0,0,0,0,0,0,0,0,0,0]);return r.writeUInt32BE(e,0),new t(r)},t.createFromHexString=function(e){if(typeof e>"u"||e!=null&&e.length!==24)throw new At("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");return new t(ut.from(e,"hex"))},t.isValid=function(e){if(e==null)return!1;try{return new t(e),!0}catch{return!1}},t.prototype.toExtendedJSON=function(){return this.toHexString?{$oid:this.toHexString()}:{$oid:this.toString("hex")}},t.fromExtendedJSON=function(e){return new t(e.$oid)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new ObjectId("'.concat(this.toHexString(),'")')},t.index=Math.floor(Math.random()*16777215),t}();Object.defineProperty(Jt.prototype,"generate",{value:ds(function(t){return Jt.generate(t)},"Please use the static `ObjectId.generate(time)` instead")});Object.defineProperty(Jt.prototype,"getInc",{value:ds(function(){return Jt.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(Jt.prototype,"get_inc",{value:ds(function(){return Jt.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(Jt,"get_inc",{value:ds(function(){return Jt.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(Jt.prototype,"_bsontype",{value:"ObjectID"});function Gw(t){return t.split("").sort().join("")}var Yn=function(){function t(e,r){if(!(this instanceof t))return new t(e,r);if(this.pattern=e,this.options=Gw(r??""),this.pattern.indexOf("\0")!==-1)throw new Er("BSON Regex patterns cannot contain null bytes, found: ".concat(JSON.stringify(this.pattern)));if(this.options.indexOf("\0")!==-1)throw new Er("BSON Regex options cannot contain null bytes, found: ".concat(JSON.stringify(this.options)));for(var n=0;n<this.options.length;n++)if(!(this.options[n]==="i"||this.options[n]==="m"||this.options[n]==="x"||this.options[n]==="l"||this.options[n]==="s"||this.options[n]==="u"))throw new Er("The regular expression option [".concat(this.options[n],"] is not supported"))}return t.parseOptions=function(e){return e?e.split("").sort().join(""):""},t.prototype.toExtendedJSON=function(e){return e=e||{},e.legacy?{$regex:this.pattern,$options:this.options}:{$regularExpression:{pattern:this.pattern,options:this.options}}},t.fromExtendedJSON=function(e){if("$regex"in e)if(typeof e.$regex!="string"){if(e.$regex._bsontype==="BSONRegExp")return e}else return new t(e.$regex,t.parseOptions(e.$options));if("$regularExpression"in e)return new t(e.$regularExpression.pattern,t.parseOptions(e.$regularExpression.options));throw new At("Unexpected BSONRegExp EJSON object form: ".concat(JSON.stringify(e)))},t}();Object.defineProperty(Yn.prototype,"_bsontype",{value:"BSONRegExp"});var ja=function(){function t(e){if(!(this instanceof t))return new t(e);this.value=e}return t.prototype.valueOf=function(){return this.value},t.prototype.toString=function(){return this.value},t.prototype.inspect=function(){return'new BSONSymbol("'.concat(this.value,'")')},t.prototype.toJSON=function(){return this.value},t.prototype.toExtendedJSON=function(){return{$symbol:this.value}},t.fromExtendedJSON=function(e){return new t(e.$symbol)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t}();Object.defineProperty(ja.prototype,"_bsontype",{value:"Symbol"});var qw=J,Bh=function(t){ps(e,t);function e(r,n){var i=this;return i instanceof e?(J.isLong(r)?i=t.call(this,r.low,r.high,!0)||this:si(r)&&typeof r.t<"u"&&typeof r.i<"u"?i=t.call(this,r.i,r.t,!0)||this:i=t.call(this,r,n,!0)||this,Object.defineProperty(i,"_bsontype",{value:"Timestamp",writable:!1,configurable:!1,enumerable:!1}),i):new e(r,n)}return e.prototype.toJSON=function(){return{$timestamp:this.toString()}},e.fromInt=function(r){return new e(J.fromInt(r,!0))},e.fromNumber=function(r){return new e(J.fromNumber(r,!0))},e.fromBits=function(r,n){return new e(r,n)},e.fromString=function(r,n){return new e(J.fromString(r,!0,n))},e.prototype.toExtendedJSON=function(){return{$timestamp:{t:this.high>>>0,i:this.low>>>0}}},e.fromExtendedJSON=function(r){return new e(r.$timestamp)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return"new Timestamp({ t: ".concat(this.getHighBits(),", i: ").concat(this.getLowBits()," })")},e.MAX_VALUE=J.MAX_UNSIGNED_VALUE,e}(qw);function zw(t){return si(t)&&Reflect.has(t,"_bsontype")&&typeof t._bsontype=="string"}var jh=2147483647,$h=-2147483648,Fh=9223372036854776e3,Hh=-9223372036854776e3,Yw={$oid:Jt,$binary:Sr,$uuid:Sr,$symbol:ja,$numberInt:ms,$numberDecimal:Ua,$numberDouble:gs,$numberLong:J,$minKey:Ba,$maxKey:Ma,$regex:Yn,$regularExpression:Yn,$timestamp:Bh};function Vh(t,e){if(e===void 0&&(e={}),typeof t=="number"){if(e.relaxed||e.legacy)return t;if(Math.floor(t)===t){if(t>=$h&&t<=jh)return new ms(t);if(t>=Hh&&t<=Fh)return J.fromNumber(t)}return new gs(t)}if(t==null||typeof t!="object")return t;if(t.$undefined)return null;for(var r=Object.keys(t).filter(function(p){return p.startsWith("$")&&t[p]!=null}),n=0;n<r.length;n++){var i=Yw[r[n]];if(i)return i.fromExtendedJSON(t,e)}if(t.$date!=null){var s=t.$date,o=new Date;return e.legacy?typeof s=="number"?o.setTime(s):typeof s=="string"&&o.setTime(Date.parse(s)):typeof s=="string"?o.setTime(Date.parse(s)):J.isLong(s)?o.setTime(s.toNumber()):typeof s=="number"&&e.relaxed&&o.setTime(s),o}if(t.$code!=null){var a=Object.assign({},t);return t.$scope&&(a.$scope=Vh(t.$scope)),fs.fromExtendedJSON(t)}if(Ow(t)||t.$dbPointer){var l=t.$ref?t:t.$dbPointer;if(l instanceof zn)return l;var h=Object.keys(l).filter(function(p){return p.startsWith("$")}),g=!0;if(h.forEach(function(p){["$ref","$id","$db"].indexOf(p)===-1&&(g=!1)}),g)return zn.fromExtendedJSON(l)}return t}function Kw(t,e){return t.map(function(r,n){e.seenObjects.push({propertyName:"index ".concat(n),obj:null});try{return er(r,e)}finally{e.seenObjects.pop()}})}function Ml(t){var e=t.toISOString();return t.getUTCMilliseconds()!==0?e:e.slice(0,-5)+"Z"}function er(t,e){if((typeof t=="object"||typeof t=="function")&&t!==null){var r=e.seenObjects.findIndex(function(A){return A.obj===t});if(r!==-1){var n=e.seenObjects.map(function(A){return A.propertyName}),i=n.slice(0,r).map(function(A){return"".concat(A," -> ")}).join(""),s=n[r],o=" -> "+n.slice(r+1,n.length-1).map(function(A){return"".concat(A," -> ")}).join(""),a=n[n.length-1],l=" ".repeat(i.length+s.length/2),h="-".repeat(o.length+(s.length+a.length)/2-1);throw new At(`Converting circular structure to EJSON:
|
|
25
|
+
`),typeof a=="string"||a instanceof Uint8Array)i(a);else{let l;try{l=JSON.stringify(a)}catch{l=JSON.stringify(Ze(a))}i(l)}}return typeof n=="string"?n:mg(n)}function mg(t){let e=t.reduce((i,s)=>i+s.length,0),r=new Uint8Array(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return r}function yg(t){let e=typeof t.data=="string"?Co(t.data):t.data;return[ve({type:"attachment",length:e.length,filename:t.filename,content_type:t.contentType,attachment_type:t.attachmentType}),e]}var vg={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",statsd:"metric_bucket"};function tl(t){return vg[t]}function Ku(t){if(!t||!t.sdk)return;let{name:e,version:r}=t.sdk;return{name:e,version:r}}function wg(t,e,r,n){let i=t.sdkProcessingMetadata&&t.sdkProcessingMetadata.dynamicSamplingContext;return D(D(D({event_id:t.event_id,sent_at:new Date().toISOString()},e&&{sdk:e}),!!r&&n&&{dsn:os(n)}),i&&{trace:ve(D({},i))})}function bg(t,e,r){let n=[{type:"client_report"},{timestamp:r||ei(),discarded_events:t}];return ni(e?{dsn:e}:{},[n])}function _g(t,e=Date.now()){let r=parseInt(`${t}`,10);if(!isNaN(r))return r*1e3;let n=Date.parse(`${t}`);return isNaN(n)?6e4:n-e}function Eg(t,e){return t[e]||t.all||0}function Sg(t,e,r=Date.now()){return Eg(t,e)>r}function Ig(t,{statusCode:e,headers:r},n=Date.now()){let i=D({},t),s=r&&r["x-sentry-rate-limits"],o=r&&r["retry-after"];if(s)for(let a of s.trim().split(",")){let[l,h,,,g]=a.split(":",5),p=parseInt(l,10),_=(isNaN(p)?60:p)*1e3;if(!h)i.all=n+_;else for(let w of h.split(";"))w==="metric_bucket"?(!g||g.split(";").includes("custom"))&&(i[w]=n+_):i[w]=n+_}else o?i.all=n+_g(o,n):e===429&&(i.all=n+60*1e3);return i}function el(){return{traceId:_e(),spanId:_e().substring(16)}}var bi=pt;function Cg(){let t=bi.chrome,e=t&&t.app&&t.app.runtime,r="history"in bi&&!!bi.history.pushState&&!!bi.history.replaceState;return!e&&r}var Nt=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function as(){return ba(pt),pt}function ba(t){let e=t.__SENTRY__=t.__SENTRY__||{};return e.version=e.version||_r,e[_r]=e[_r]||{}}function To(t,e={}){if(e.user&&(!t.ipAddress&&e.user.ip_address&&(t.ipAddress=e.user.ip_address),!t.did&&!e.did&&(t.did=e.user.id||e.user.email||e.user.username)),t.timestamp=e.timestamp||sr(),e.abnormal_mechanism&&(t.abnormal_mechanism=e.abnormal_mechanism),e.ignoreDuration&&(t.ignoreDuration=e.ignoreDuration),e.sid&&(t.sid=e.sid.length===32?e.sid:_e()),e.init!==void 0&&(t.init=e.init),!t.did&&e.did&&(t.did=`${e.did}`),typeof e.started=="number"&&(t.started=e.started),t.ignoreDuration)t.duration=void 0;else if(typeof e.duration=="number")t.duration=e.duration;else{let r=t.timestamp-t.started;t.duration=r>=0?r:0}e.release&&(t.release=e.release),e.environment&&(t.environment=e.environment),!t.ipAddress&&e.ipAddress&&(t.ipAddress=e.ipAddress),!t.userAgent&&e.userAgent&&(t.userAgent=e.userAgent),typeof e.errors=="number"&&(t.errors=e.errors),e.status&&(t.status=e.status)}var xo="_sentrySpan";function rl(t,e){e?Tr(t,xo,e):delete t[xo]}function nl(t){return t[xo]}var Tg=100,xg=class Ju{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext=el()}clone(){let e=new Ju;return e._breadcrumbs=[...this._breadcrumbs],e._tags=D({},this._tags),e._extra=D({},this._extra),e._contexts=D({},this._contexts),e._user=this._user,e._level=this._level,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._requestSession=this._requestSession,e._attachments=[...this._attachments],e._sdkProcessingMetadata=D({},this._sdkProcessingMetadata),e._propagationContext=D({},this._propagationContext),e._client=this._client,e._lastEventId=this._lastEventId,rl(e,nl(this)),e}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&To(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){return this._requestSession}setRequestSession(e){return this._requestSession=e,this}setTags(e){return this._tags=D(D({},this._tags),e),this._notifyScopeListeners(),this}setTag(e,r){return this._tags=wt(D({},this._tags),{[e]:r}),this._notifyScopeListeners(),this}setExtras(e){return this._extra=D(D({},this._extra),e),this._notifyScopeListeners(),this}setExtra(e,r){return this._extra=wt(D({},this._extra),{[e]:r}),this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,r){return r===null?delete this._contexts[e]:this._contexts[e]=r,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;let r=typeof e=="function"?e(this):e,[n,i]=r instanceof He?[r.getScopeData(),r.getRequestSession()]:Zr(r)?[e,e.requestSession]:[],{tags:s,extra:o,user:a,contexts:l,level:h,fingerprint:g=[],propagationContext:p}=n||{};return this._tags=D(D({},this._tags),s),this._extra=D(D({},this._extra),o),this._contexts=D(D({},this._contexts),l),a&&Object.keys(a).length&&(this._user=a),h&&(this._level=h),g.length&&(this._fingerprint=g),p&&(this._propagationContext=p),i&&(this._requestSession=i),this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._requestSession=void 0,this._session=void 0,rl(this,void 0),this._attachments=[],this._propagationContext=el(),this._notifyScopeListeners(),this}addBreadcrumb(e,r){let n=typeof r=="number"?r:Tg;if(n<=0)return this;let i=D({timestamp:ei()},e),s=this._breadcrumbs;return s.push(i),this._breadcrumbs=s.length>n?s.slice(-n):s,this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:nl(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=D(D({},this._sdkProcessingMetadata),e),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,r){let n=r&&r.event_id?r.event_id:_e();if(!this._client)return it.warn("No client configured on scope - will not capture exception!"),n;let i=new Error("Sentry syntheticException");return this._client.captureException(e,wt(D({originalException:e,syntheticException:i},r),{event_id:n}),this),n}captureMessage(e,r,n){let i=n&&n.event_id?n.event_id:_e();if(!this._client)return it.warn("No client configured on scope - will not capture message!"),i;let s=new Error(e);return this._client.captureMessage(e,r,wt(D({originalException:e,syntheticException:s},n),{event_id:i}),this),i}captureEvent(e,r){let n=r&&r.event_id?r.event_id:_e();return this._client?(this._client.captureEvent(e,wt(D({},r),{event_id:n}),this),n):(it.warn("No client configured on scope - will not capture event!"),n)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),this._notifyingListeners=!1)}},He=xg;function Dg(){return ma("defaultCurrentScope",()=>new He)}function Ng(){return ma("defaultIsolationScope",()=>new He)}var Ag=class{constructor(t,e){let r;t?r=t:r=new He;let n;e?n=e:n=new He,this._stack=[{scope:r}],this._isolationScope=n}withScope(t){let e=this._pushScope(),r;try{r=t(e)}catch(n){throw this._popScope(),n}return is(r)?r.then(n=>(this._popScope(),n),n=>{throw this._popScope(),n}):(this._popScope(),r)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){let t=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:t}),t}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}};function tn(){let t=as(),e=ba(t);return e.stack=e.stack||new Ag(Dg(),Ng())}function Og(t){return tn().withScope(t)}function Pg(t,e){let r=tn();return r.withScope(()=>(r.getStackTop().scope=t,e(t)))}function il(t){return tn().withScope(()=>t(tn().getIsolationScope()))}function kg(){return{withIsolationScope:il,withScope:Og,withSetScope:Pg,withSetIsolationScope:(t,e)=>il(e),getCurrentScope:()=>tn().getScope(),getIsolationScope:()=>tn().getIsolationScope()}}function _a(t){let e=ba(t);return e.acs?e.acs:kg()}function Ea(){let t=as();return _a(t).getCurrentScope()}function Qu(){let t=as();return _a(t).getIsolationScope()}function Rg(){return ma("globalScope",()=>new He)}function Lg(...t){let e=as(),r=_a(e);if(t.length===2){let[n,i]=t;return n?r.withSetScope(n,i):r.withScope(i)}return r.withScope(t[0])}function oe(){return Ea().getClient()}var Ug="_sentryMetrics";function Mg(t){let e=t[Ug];if(!e)return;let r={};for(let[,[n,i]]of e)(r[n]||(r[n]=[])).push(ve(i));return r}var Bg="sentry.source",jg="sentry.sample_rate",$g="sentry.op",Fg="sentry.origin",Hg=1;function Vg(t){let{spanId:e,traceId:r}=t.spanContext(),{parent_span_id:n}=Wi(t);return ve({parent_span_id:n,span_id:e,trace_id:r})}function sl(t){return typeof t=="number"?ol(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?ol(t.getTime()):sr()}function ol(t){return t>9999999999?t/1e3:t}function Wi(t){if(Gg(t))return t.getSpanJSON();try{let{spanId:e,traceId:r}=t.spanContext();if(Wg(t)){let{attributes:n,startTime:i,name:s,endTime:o,parentSpanId:a,status:l}=t;return ve({span_id:e,trace_id:r,data:n,description:s,parent_span_id:a,start_timestamp:sl(i),timestamp:sl(o)||void 0,status:zg(l),op:n[$g],origin:n[Fg],_metrics_summary:Mg(t)})}return{span_id:e,trace_id:r}}catch{return{}}}function Wg(t){let e=t;return!!e.attributes&&!!e.startTime&&!!e.name&&!!e.endTime&&!!e.status}function Gg(t){return typeof t.getSpanJSON=="function"}function qg(t){let{traceFlags:e}=t.spanContext();return e===Hg}function zg(t){if(!(!t||t.code===0))return t.code===1?"ok":t.message||"unknown_error"}var Yg="_sentryRootSpan";function Xu(t){return t[Yg]||t}var Zu="production",Kg="_frozenDsc";function th(t,e){let r=e.getOptions(),{publicKey:n}=e.getDsn()||{},i=ve({environment:r.environment||Zu,release:r.release,public_key:n,trace_id:t});return e.emit("createDsc",i),i}function Jg(t){let e=oe();if(!e)return{};let r=th(Wi(t).trace_id||"",e),n=Xu(t),i=n[Kg];if(i)return i;let s=n.spanContext().traceState,o=s&&s.get("sentry.dsc"),a=o&&pg(o);if(a)return a;let l=Wi(n),h=l.data||{},g=h[jg];g!=null&&(r.sample_rate=`${g}`);let p=h[Bg],_=l.description;return p!=="url"&&_&&(r.transaction=_),r.sampled=String(qg(n)),e.emit("createDsc",r,n),r}function Qg(t){if(typeof t=="boolean")return Number(t);let e=typeof t=="string"?parseFloat(t):t;if(typeof e!="number"||isNaN(e)||e<0||e>1){Nt&&it.warn(`[Tracing] Given sample rate is invalid. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(t)} of type ${JSON.stringify(typeof t)}.`);return}return e}function Xg(t,e){return e&&(t.sdk=t.sdk||{},t.sdk.name=t.sdk.name||e.name,t.sdk.version=t.sdk.version||e.version,t.sdk.integrations=[...t.sdk.integrations||[],...e.integrations||[]],t.sdk.packages=[...t.sdk.packages||[],...e.packages||[]]),t}function Zg(t,e,r,n){let i=Ku(r),s=D(D({sent_at:new Date().toISOString()},i&&{sdk:i}),!!n&&e&&{dsn:os(e)}),o="aggregates"in t?[{type:"sessions"},t]:[{type:"session"},t.toJSON()];return ni(s,[o])}function tm(t,e,r,n){let i=Ku(r),s=t.type&&t.type!=="replay_event"?t.type:"event";Xg(t,r&&r.sdk);let o=wg(t,i,n,e);return delete t.sdkProcessingMetadata,ni(o,[[{type:s},t]])}function Do(t,e,r,n=0){return new ri((i,s)=>{let o=t[n];if(e===null||typeof o!="function")i(e);else{let a=o(D({},e),r);Nt&&o.id&&a===null&&it.log(`Event processor "${o.id}" dropped event`),is(a)?a.then(l=>Do(t,l,r,n+1).then(i)).then(null,s):Do(t,a,r,n+1).then(i).then(null,s)}})}function em(t,e){let{fingerprint:r,span:n,breadcrumbs:i,sdkProcessingMetadata:s}=e;rm(t,e),n&&sm(t,n),om(t,r),nm(t,i),im(t,s)}function al(t,e){let{extra:r,tags:n,user:i,contexts:s,level:o,sdkProcessingMetadata:a,breadcrumbs:l,fingerprint:h,eventProcessors:g,attachments:p,propagationContext:_,transactionName:w,span:b}=e;bn(t,"extra",r),bn(t,"tags",n),bn(t,"user",i),bn(t,"contexts",s),bn(t,"sdkProcessingMetadata",a),o&&(t.level=o),w&&(t.transactionName=w),b&&(t.span=b),l.length&&(t.breadcrumbs=[...t.breadcrumbs,...l]),h.length&&(t.fingerprint=[...t.fingerprint,...h]),g.length&&(t.eventProcessors=[...t.eventProcessors,...g]),p.length&&(t.attachments=[...t.attachments,...p]),t.propagationContext=D(D({},t.propagationContext),_)}function bn(t,e,r){if(r&&Object.keys(r).length){t[e]=D({},t[e]);for(let n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[e][n]=r[n])}}function rm(t,e){let{extra:r,tags:n,user:i,contexts:s,level:o,transactionName:a}=e,l=ve(r);l&&Object.keys(l).length&&(t.extra=D(D({},l),t.extra));let h=ve(n);h&&Object.keys(h).length&&(t.tags=D(D({},h),t.tags));let g=ve(i);g&&Object.keys(g).length&&(t.user=D(D({},g),t.user));let p=ve(s);p&&Object.keys(p).length&&(t.contexts=D(D({},p),t.contexts)),o&&(t.level=o),a&&t.type!=="transaction"&&(t.transaction=a)}function nm(t,e){let r=[...t.breadcrumbs||[],...e];t.breadcrumbs=r.length?r:void 0}function im(t,e){t.sdkProcessingMetadata=D(D({},t.sdkProcessingMetadata),e)}function sm(t,e){t.contexts=D({trace:Vg(e)},t.contexts),t.sdkProcessingMetadata=D({dynamicSamplingContext:Jg(e)},t.sdkProcessingMetadata);let r=Xu(e),n=Wi(r).description;n&&!t.transaction&&t.type==="transaction"&&(t.transaction=n)}function om(t,e){t.fingerprint=t.fingerprint?rg(t.fingerprint):[],e&&(t.fingerprint=t.fingerprint.concat(e)),t.fingerprint&&!t.fingerprint.length&&delete t.fingerprint}function am(t,e,r,n,i,s){let{normalizeDepth:o=3,normalizeMaxBreadth:a=1e3}=t,l=wt(D({},e),{event_id:e.event_id||r.event_id||_e(),timestamp:e.timestamp||ei()}),h=r.integrations||t.integrations.map(E=>E.name);cm(l,t),hm(l,h),i&&i.emit("applyFrameMetadata",e),e.type===void 0&&lm(l,t.stackParser);let g=dm(n,r.captureContext);r.mechanism&&Gn(l,r.mechanism);let p=i?i.getEventProcessors():[],_=Rg().getScopeData();if(s){let E=s.getScopeData();al(_,E)}if(g){let E=g.getScopeData();al(_,E)}let w=[...r.attachments||[],..._.attachments];w.length&&(r.attachments=w),em(l,_);let b=[...p,..._.eventProcessors];return Do(b,l,r).then(E=>(E&&um(E),typeof o=="number"&&o>0?pm(E,o,a):E))}function cm(t,e){let{environment:r,release:n,dist:i,maxValueLength:s=250}=e;"environment"in t||(t.environment="environment"in e?r:Zu),t.release===void 0&&n!==void 0&&(t.release=n),t.dist===void 0&&i!==void 0&&(t.dist=i),t.message&&(t.message=qr(t.message,s));let o=t.exception&&t.exception.values&&t.exception.values[0];o&&o.value&&(o.value=qr(o.value,s));let a=t.request;a&&a.url&&(a.url=qr(a.url,s))}var cl=new WeakMap;function lm(t,e){let r=pt._sentryDebugIds;if(!r)return;let n,i=cl.get(e);i?n=i:(n=new Map,cl.set(e,n));let s=Object.entries(r).reduce((o,[a,l])=>{let h,g=n.get(a);g?h=g:(h=e(a),n.set(a,h));for(let p=h.length-1;p>=0;p--){let _=h[p];if(_.filename){o[_.filename]=l;break}}return o},{});try{t.exception.values.forEach(o=>{o.stacktrace.frames.forEach(a=>{a.filename&&(a.debug_id=s[a.filename])})})}catch{}}function um(t){let e={};try{t.exception.values.forEach(n=>{n.stacktrace.frames.forEach(i=>{i.debug_id&&(i.abs_path?e[i.abs_path]=i.debug_id:i.filename&&(e[i.filename]=i.debug_id),delete i.debug_id)})})}catch{}if(Object.keys(e).length===0)return;t.debug_meta=t.debug_meta||{},t.debug_meta.images=t.debug_meta.images||[];let r=t.debug_meta.images;Object.entries(e).forEach(([n,i])=>{r.push({type:"sourcemap",code_file:n,debug_id:i})})}function hm(t,e){e.length>0&&(t.sdk=t.sdk||{},t.sdk.integrations=[...t.sdk.integrations||[],...e])}function pm(t,e,r){if(!t)return null;let n=D(D(D(D(D({},t),t.breadcrumbs&&{breadcrumbs:t.breadcrumbs.map(i=>D(D({},i),i.data&&{data:Ze(i.data,e,r)}))}),t.user&&{user:Ze(t.user,e,r)}),t.contexts&&{contexts:Ze(t.contexts,e,r)}),t.extra&&{extra:Ze(t.extra,e,r)});return t.contexts&&t.contexts.trace&&n.contexts&&(n.contexts.trace=t.contexts.trace,t.contexts.trace.data&&(n.contexts.trace.data=Ze(t.contexts.trace.data,e,r))),t.spans&&(n.spans=t.spans.map(i=>D(D({},i),i.data&&{data:Ze(i.data,e,r)}))),n}function dm(t,e){if(!e)return t;let r=t?t.clone():new He;return r.update(e),r}function fm(t){if(t)return gm(t)?{captureContext:t}:ym(t)?{captureContext:t}:t}function gm(t){return t instanceof He||typeof t=="function"}var mm=["user","level","extra","contexts","tags","fingerprint","requestSession","propagationContext"];function ym(t){return Object.keys(t).some(e=>mm.includes(e))}function vm(t,e){return Ea().captureException(t,fm(e))}function eh(t,e){return Ea().captureEvent(t,e)}var wm="7";function bm(t){let e=t.protocol?`${t.protocol}:`:"",r=t.port?`:${t.port}`:"";return`${e}//${t.host}${r}${t.path?`/${t.path}`:""}/api/`}function _m(t){return`${bm(t)}${t.projectId}/envelope/`}function Em(t,e){return Mf(D({sentry_key:t.publicKey,sentry_version:wm},e&&{sentry_client:`${e.name}/${e.version}`}))}function Sm(t,e,r){return e||`${_m(t)}?${Em(t,r)}`}var ll=[];function Im(t,e){let r={};return e.forEach(n=>{n&&rh(t,n,r)}),r}function ul(t,e){for(let r of e)r&&r.afterAllSetup&&r.afterAllSetup(t)}function rh(t,e,r){if(r[e.name]){Nt&&it.log(`Integration skipped because it was already installed: ${e.name}`);return}if(r[e.name]=e,ll.indexOf(e.name)===-1&&typeof e.setupOnce=="function"&&(e.setupOnce(),ll.push(e.name)),e.setup&&typeof e.setup=="function"&&e.setup(t),typeof e.preprocessEvent=="function"){let n=e.preprocessEvent.bind(e);t.on("preprocessEvent",(i,s)=>n(i,s,t))}if(typeof e.processEvent=="function"){let n=e.processEvent.bind(e),i=Object.assign((s,o)=>n(s,o,t),{id:e.name});t.addEventProcessor(i)}Nt&&it.log(`Integration installed: ${e.name}`)}var hl="Not capturing exception because it's already been captured.",Cm=class{constructor(t){if(this._options=t,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],t.dsn?this._dsn=Uf(t.dsn):Nt&&it.warn("No DSN provided, client will not send events."),this._dsn){let e=Sm(this._dsn,t.tunnel,t._metadata?t._metadata.sdk:void 0);this._transport=t.transport(wt(D({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this)},t.transportOptions),{url:e}))}}captureException(t,e,r){let n=_e();if(Qc(t))return Nt&&it.log(hl),n;let i=D({event_id:n},e);return this._process(this.eventFromException(t,i).then(s=>this._captureEvent(s,i,r))),i.event_id}captureMessage(t,e,r,n){let i=D({event_id:_e()},r),s=fa(t)?t:String(t),o=ga(t)?this.eventFromMessage(s,e,i):this.eventFromException(t,i);return this._process(o.then(a=>this._captureEvent(a,i,n))),i.event_id}captureEvent(t,e,r){let n=_e();if(e&&e.originalException&&Qc(e.originalException))return Nt&&it.log(hl),n;let i=D({event_id:n},e),s=(t.sdkProcessingMetadata||{}).capturedSpanScope;return this._process(this._captureEvent(t,i,s||r)),i.event_id}captureSession(t){typeof t.release!="string"?Nt&&it.warn("Discarded session because of missing or non-string release"):(this.sendSession(t),To(t,{init:!1}))}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}flush(t){let e=this._transport;return e?(this.emit("flush"),this._isClientDoneProcessing(t).then(r=>e.flush(t).then(n=>r&&n))):Dr(!0)}close(t){return this.flush(t).then(e=>(this.getOptions().enabled=!1,this.emit("close"),e))}getEventProcessors(){return this._eventProcessors}addEventProcessor(t){this._eventProcessors.push(t)}init(){this._isEnabled()&&this._setupIntegrations()}getIntegrationByName(t){return this._integrations[t]}addIntegration(t){let e=this._integrations[t.name];rh(this,t,this._integrations),e||ul(this,[t])}sendEvent(t,e={}){this.emit("beforeSendEvent",t,e);let r=tm(t,this._dsn,this._options._metadata,this._options.tunnel);for(let i of e.attachments||[])r=fg(r,yg(i));let n=this.sendEnvelope(r);n&&n.then(i=>this.emit("afterSendEvent",t,i),null)}sendSession(t){let e=Zg(t,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(e)}recordDroppedEvent(t,e,r){if(this._options.sendClientReports){let n=`${t}:${e}`;Nt&&it.log(`Adding outcome: "${n}"`),this._outcomes[n]=(this._outcomes[n]||0)+1}}on(t,e){let r=this._hooks[t]=this._hooks[t]||[];return r.push(e),()=>{let n=r.indexOf(e);n>-1&&r.splice(n,1)}}emit(t,...e){let r=this._hooks[t];r&&r.forEach(n=>n(...e))}sendEnvelope(t){return this.emit("beforeEnvelope",t),this._isEnabled()&&this._transport?this._transport.send(t).then(null,e=>(Nt&&it.error("Error while sending event:",e),e)):(Nt&&it.error("Transport disabled"),Dr({}))}_setupIntegrations(){let{integrations:t}=this._options;this._integrations=Im(this,t),ul(this,t)}_updateSessionFromEvent(t,e){let r=!1,n=!1,i=e.exception&&e.exception.values;if(i){n=!0;for(let o of i){let a=o.mechanism;if(a&&a.handled===!1){r=!0;break}}}let s=t.status==="ok";(s&&t.errors===0||s&&r)&&(To(t,wt(D({},r&&{status:"crashed"}),{errors:t.errors||Number(n||r)})),this.captureSession(t))}_isClientDoneProcessing(t){return new ri(e=>{let r=0,n=1,i=setInterval(()=>{this._numProcessing==0?(clearInterval(i),e(!0)):(r+=n,t&&r>=t&&(clearInterval(i),e(!1)))},n)})}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(t,e,r,n=Qu()){let i=this.getOptions(),s=Object.keys(this._integrations);return!e.integrations&&s.length>0&&(e.integrations=s),this.emit("preprocessEvent",t,e),t.type||n.setLastEventId(t.event_id||e.event_id),am(i,t,e,r,this,n).then(o=>{if(o===null)return o;let a=D(D({},n.getPropagationContext()),r?r.getPropagationContext():void 0);if(!(o.contexts&&o.contexts.trace)&&a){let{traceId:l,spanId:h,parentSpanId:g,dsc:p}=a;o.contexts=D({trace:ve({trace_id:l,span_id:h,parent_span_id:g})},o.contexts);let _=p||th(l,this);o.sdkProcessingMetadata=D({dynamicSamplingContext:_},o.sdkProcessingMetadata)}return o})}_captureEvent(t,e={},r){return this._processEvent(t,e,r).then(n=>n.event_id,n=>{if(Nt){let i=n;i.logLevel==="log"?it.log(i.message):it.warn(i)}})}_processEvent(t,e,r){let n=this.getOptions(),{sampleRate:i}=n,s=No(t),o=nh(t),a=t.type||"error",l=`before send for type \`${a}\``,h=typeof i>"u"?void 0:Qg(i);if(o&&typeof h=="number"&&Math.random()>h)return this.recordDroppedEvent("sample_rate","error",t),Vi(new De(`Discarding event because it's not included in the random sample (sampling rate = ${i})`,"log"));let g=a==="replay_event"?"replay":a,p=(t.sdkProcessingMetadata||{}).capturedSpanIsolationScope;return this._prepareEvent(t,e,r,p).then(_=>{if(_===null)throw this.recordDroppedEvent("event_processor",g,t),new De("An event processor returned `null`, will not send event.","log");if(e.data&&e.data.__sentry__===!0)return _;let w=xm(this,n,_,e);return Tm(w,l)}).then(_=>{if(_===null){if(this.recordDroppedEvent("before_send",g,t),No(t)){let E=1+(t.spans||[]).length;this._outcomes.span=(this._outcomes.span||0)+E}throw new De(`${l} returned \`null\`, will not send event.`,"log")}let w=r&&r.getSession();!s&&w&&this._updateSessionFromEvent(w,_);let b=_.transaction_info;if(s&&b&&_.transaction!==t.transaction){let E="custom";_.transaction_info=wt(D({},b),{source:E})}return this.sendEvent(_,e),_}).then(null,_=>{throw _ instanceof De?_:(this.captureException(_,{data:{__sentry__:!0},originalException:_}),new De(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
|
|
26
|
+
Reason: ${_}`))})}_process(t){this._numProcessing++,t.then(e=>(this._numProcessing--,e),e=>(this._numProcessing--,e))}_clearOutcomes(){let t=this._outcomes;return this._outcomes={},Object.entries(t).map(([e,r])=>{let[n,i]=e.split(":");return{reason:n,category:i,quantity:r}})}};function Tm(t,e){let r=`${e} must return \`null\` or a valid event.`;if(is(t))return t.then(n=>{if(!Zr(n)&&n!==null)throw new De(r);return n},n=>{throw new De(`${e} rejected with ${n}`)});if(!Zr(t)&&t!==null)throw new De(r);return t}function xm(t,e,r,n){let{beforeSend:i,beforeSendTransaction:s,beforeSendSpan:o}=e;if(nh(r)&&i)return i(r,n);if(No(r)){if(r.spans&&o){let a=[];for(let l of r.spans){let h=o(l);h?a.push(h):t.recordDroppedEvent("before_send","span")}r.spans=a}if(s)return s(r,n)}return r}function nh(t){return t.type===void 0}function No(t){return t.type==="transaction"}var Dm=64;function Nm(t,e,r=ag(t.bufferSize||Dm)){let n={},i=o=>r.drain(o);function s(o){let a=[];if(Zc(o,(p,_)=>{let w=tl(_);if(Sg(n,w)){let b=pl(p,_);t.recordDroppedEvent("ratelimit_backoff",w,b)}else a.push(p)}),a.length===0)return Dr({});let l=ni(o[0],a),h=p=>{Zc(l,(_,w)=>{let b=pl(_,w);t.recordDroppedEvent(p,tl(w),b)})},g=()=>e({body:gg(l)}).then(p=>(p.statusCode!==void 0&&(p.statusCode<200||p.statusCode>=300)&&Nt&&it.warn(`Sentry responded with status code ${p.statusCode} to sent event.`),n=Ig(n,p),p),p=>{throw h("network_error"),p});return r.add(g).then(p=>p,p=>{if(p instanceof De)return Nt&&it.error("Skipped sending event because buffer is full."),h("queue_overflow"),Dr({});throw p})}return{send:s,flush:i}}function pl(t,e){if(!(e!=="event"&&e!=="transaction"))return Array.isArray(t)?t[1]:void 0}function Am(t,e,r=[e],n="npm"){let i=t._metadata||{};i.sdk||(i.sdk={name:`sentry.javascript.${e}`,packages:r.map(s=>({name:`${n}:@sentry/${s}`,version:_r})),version:_r}),t._metadata=i}var Om=100;function Nr(t,e){let r=oe(),n=Qu();if(!r)return;let{beforeBreadcrumb:i=null,maxBreadcrumbs:s=Om}=r.getOptions();if(s<=0)return;let o=ei(),a=D({timestamp:o},t),l=i?va(()=>i(a,e)):a;l!==null&&(r.emit&&r.emit("beforeAddBreadcrumb",l,e),n.addBreadcrumb(l,s))}var dl,Pm="FunctionToString",fl=new WeakMap,km=()=>({name:Pm,setupOnce(){dl=Function.prototype.toString;try{Function.prototype.toString=function(...t){let e=wa(this),r=fl.has(oe())&&e!==void 0?e:this;return dl.apply(r,t)}}catch{}},setup(t){fl.set(t,!0)}}),Rm=km,Lm=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,"undefined is not an object (evaluating 'a.L')",`can't redefine non-configurable property "solana"`,"vv().getRestrictions is not a function. (In 'vv().getRestrictions(1,a)', 'vv().getRestrictions' is undefined)","Can't find variable: _AutofillCallbackHandler"],Um="InboundFilters",Mm=(t={})=>({name:Um,processEvent(e,r,n){let i=n.getOptions(),s=jm(t,i);return $m(e,s)?null:e}}),Bm=Mm;function jm(t={},e={}){return{allowUrls:[...t.allowUrls||[],...e.allowUrls||[]],denyUrls:[...t.denyUrls||[],...e.denyUrls||[]],ignoreErrors:[...t.ignoreErrors||[],...e.ignoreErrors||[],...t.disableErrorDefaults?[]:Lm],ignoreTransactions:[...t.ignoreTransactions||[],...e.ignoreTransactions||[]],ignoreInternal:t.ignoreInternal!==void 0?t.ignoreInternal:!0}}function $m(t,e){return e.ignoreInternal&&qm(t)?(Nt&&it.warn(`Event dropped due to being internal Sentry Error.
|
|
27
|
+
Event: ${Xe(t)}`),!0):Fm(t,e.ignoreErrors)?(Nt&&it.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
|
|
28
|
+
Event: ${Xe(t)}`),!0):Ym(t)?(Nt&&it.warn(`Event dropped due to not having an error message, error type or stacktrace.
|
|
29
|
+
Event: ${Xe(t)}`),!0):Hm(t,e.ignoreTransactions)?(Nt&&it.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
|
|
30
|
+
Event: ${Xe(t)}`),!0):Vm(t,e.denyUrls)?(Nt&&it.warn(`Event dropped due to being matched by \`denyUrls\` option.
|
|
31
|
+
Event: ${Xe(t)}.
|
|
32
|
+
Url: ${Gi(t)}`),!0):Wm(t,e.allowUrls)?!1:(Nt&&it.warn(`Event dropped due to not being matched by \`allowUrls\` option.
|
|
33
|
+
Event: ${Xe(t)}.
|
|
34
|
+
Url: ${Gi(t)}`),!0)}function Fm(t,e){return t.type||!e||!e.length?!1:Gm(t).some(r=>ss(r,e))}function Hm(t,e){if(t.type!=="transaction"||!e||!e.length)return!1;let r=t.transaction;return r?ss(r,e):!1}function Vm(t,e){if(!e||!e.length)return!1;let r=Gi(t);return r?ss(r,e):!1}function Wm(t,e){if(!e||!e.length)return!0;let r=Gi(t);return r?ss(r,e):!0}function Gm(t){let e=[];t.message&&e.push(t.message);let r;try{r=t.exception.values[t.exception.values.length-1]}catch{}return r&&r.value&&(e.push(r.value),r.type&&e.push(`${r.type}: ${r.value}`)),e}function qm(t){try{return t.exception.values[0].type==="SentryError"}catch{}return!1}function zm(t=[]){for(let e=t.length-1;e>=0;e--){let r=t[e];if(r&&r.filename!=="<anonymous>"&&r.filename!=="[native code]")return r.filename||null}return null}function Gi(t){try{let e;try{e=t.exception.values[0].stacktrace.frames}catch{}return e?zm(e):null}catch{return Nt&&it.error(`Cannot extract url for event ${Xe(t)}`),null}}function Ym(t){return t.type||!t.exception||!t.exception.values||t.exception.values.length===0?!1:!t.message&&!t.exception.values.some(e=>e.stacktrace||e.type&&e.type!=="Error"||e.value)}var Km="Dedupe",Jm=()=>{let t;return{name:Km,processEvent(e){if(e.type)return e;try{if(Xm(e,t))return Nt&&it.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return t=e}}},Qm=Jm;function Xm(t,e){return e?!!(Zm(t,e)||ty(t,e)):!1}function Zm(t,e){let r=t.message,n=e.message;return!(!r&&!n||r&&!n||!r&&n||r!==n||!sh(t,e)||!ih(t,e))}function ty(t,e){let r=gl(e),n=gl(t);return!(!r||!n||r.type!==n.type||r.value!==n.value||!sh(t,e)||!ih(t,e))}function ih(t,e){let r=Yc(t),n=Yc(e);if(!r&&!n)return!0;if(r&&!n||!r&&n||(r=r,n=n,n.length!==r.length))return!1;for(let i=0;i<n.length;i++){let s=n[i],o=r[i];if(s.filename!==o.filename||s.lineno!==o.lineno||s.colno!==o.colno||s.function!==o.function)return!1}return!0}function sh(t,e){let r=t.fingerprint,n=e.fingerprint;if(!r&&!n)return!0;if(r&&!n||!r&&n)return!1;r=r,n=n;try{return r.join("")===n.join("")}catch{return!1}}function gl(t){return t.exception&&t.exception.values&&t.exception.values[0]}var Ht=pt,Ao=0;function oh(){return Ao>0}function ey(){Ao++,setTimeout(()=>{Ao--})}function en(t,e={},r){if(typeof t!="function")return t;try{let i=t.__sentry_wrapped__;if(i)return i;if(wa(t))return t}catch{return t}let n=function(){let i=Array.prototype.slice.call(arguments);try{r&&typeof r=="function"&&r.apply(this,arguments);let s=i.map(o=>en(o,e));return t.apply(this,s)}catch(s){throw ey(),Lg(o=>{o.addEventProcessor(a=>(e.mechanism&&(So(a,void 0,void 0),Gn(a,e.mechanism)),a.extra=wt(D({},a.extra),{arguments:i}),a)),vm(s)}),s}};try{for(let i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i])}catch{}Wu(n,t),Tr(t,"__sentry_wrapped__",n);try{Object.getOwnPropertyDescriptor(n,"name").configurable&&Object.defineProperty(n,"name",{get(){return t.name}})}catch{}return n}var Vr=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function Sa(t,e){let r=Ia(t,e),n={type:e&&e.name,value:oy(e)};return r.length&&(n.stacktrace={frames:r}),n.type===void 0&&n.value===""&&(n.value="Unrecoverable error caught"),n}function ry(t,e,r,n){let i=oe(),s=i&&i.getOptions().normalizeDepth,o=hy(e),a={__serialized__:Yu(e,s)};if(o)return{exception:{values:[Sa(t,o)]},extra:a};let l={exception:{values:[{type:ns(e)?e.constructor.name:n?"UnhandledRejection":"Error",value:ly(e,{isUnhandledRejection:n})}]},extra:a};if(r){let h=Ia(t,r);h.length&&(l.exception.values[0].stacktrace={frames:h})}return l}function Ms(t,e){return{exception:{values:[Sa(t,e)]}}}function Ia(t,e){let r=e.stacktrace||e.stack||"",n=iy(e),i=sy(e);try{return t(r,n,i)}catch{}return[]}var ny=/Minified React error #\d+;/i;function iy(t){return t&&ny.test(t.message)?1:0}function sy(t){return typeof t.framesToPop=="number"?t.framesToPop:0}function oy(t){let e=t&&t.message;return e?e.error&&typeof e.error.message=="string"?e.error.message:e:"No error message"}function ay(t,e,r,n){let i=r&&r.syntheticException||void 0,s=Ca(t,e,i,n);return Gn(s),s.level="error",r&&r.event_id&&(s.event_id=r.event_id),Dr(s)}function cy(t,e,r="info",n,i){let s=n&&n.syntheticException||void 0,o=Oo(t,e,s,i);return o.level=r,n&&n.event_id&&(o.event_id=n.event_id),Dr(o)}function Ca(t,e,r,n,i){let s;if($u(e)&&e.error)return Ms(t,e.error);if($c(e)||wf(e)){let o=e;if("stack"in e)s=Ms(t,e);else{let a=o.name||($c(o)?"DOMError":"DOMException"),l=o.message?`${a}: ${o.message}`:a;s=Oo(t,l,r,n),So(s,l)}return"code"in o&&(s.tags=wt(D({},s.tags),{"DOMException.code":`${o.code}`})),s}return da(e)?Ms(t,e):Zr(e)||ns(e)?(s=ry(t,e,r,i),Gn(s,{synthetic:!0}),s):(s=Oo(t,e,r,n),So(s,`${e}`,void 0),Gn(s,{synthetic:!0}),s)}function Oo(t,e,r,n){let i={};if(n&&r){let s=Ia(t,r);s.length&&(i.exception={values:[{value:e,stacktrace:{frames:s}}]})}if(fa(e)){let{__sentry_template_string__:s,__sentry_template_values__:o}=e;return i.logentry={message:s,params:o},i}return i.message=e,i}function ly(t,{isUnhandledRejection:e}){let r=Bf(t),n=e?"promise rejection":"exception";return $u(t)?`Event \`ErrorEvent\` captured as ${n} with message \`${t.message}\``:ns(t)?`Event \`${uy(t)}\` (type=${t.type}) captured as ${n}`:`Object captured as ${n} with keys: ${r}`}function uy(t){try{let e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch{}}function hy(t){for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)){let r=t[e];if(r instanceof Error)return r}}function py(t,{metadata:e,tunnel:r,dsn:n}){let i=D(D({event_id:t.event_id,sent_at:new Date().toISOString()},e&&e.sdk&&{sdk:{name:e.sdk.name,version:e.sdk.version}}),!!r&&!!n&&{dsn:os(n)}),s=dy(t);return ni(i,[s])}function dy(t){return[{type:"user_report"},t]}var fy=class extends Cm{constructor(t){let e=D({parentSpanIsAlwaysRootSpan:!0},t),r=Ht.SENTRY_SDK_SOURCE||tg();Am(e,"browser",["browser"],r),super(e),e.sendClientReports&&Ht.document&&Ht.document.addEventListener("visibilitychange",()=>{Ht.document.visibilityState==="hidden"&&this._flushOutcomes()})}eventFromException(t,e){return ay(this._options.stackParser,t,e,this._options.attachStacktrace)}eventFromMessage(t,e="info",r){return cy(this._options.stackParser,t,e,r,this._options.attachStacktrace)}captureUserFeedback(t){if(!this._isEnabled()){Vr&&it.warn("SDK not enabled, will not capture user feedback.");return}let e=py(t,{metadata:this.getSdkMetadata(),dsn:this.getDsn(),tunnel:this.getOptions().tunnel});this.sendEnvelope(e)}_prepareEvent(t,e,r){return t.platform=t.platform||"javascript",super._prepareEvent(t,e,r)}_flushOutcomes(){let t=this._clearOutcomes();if(t.length===0){Vr&&it.log("No outcomes to send");return}if(!this._dsn){Vr&&it.log("No dsn provided, will not send outcomes");return}Vr&&it.log("Sending outcomes:",t);let e=bg(t,this._options.tunnel&&os(this._dsn));this.sendEnvelope(e)}},gy=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,Yt=pt,my=1e3,ml,Po,ko;function yy(t){let e="dom";Pr(e,t),kr(e,vy)}function vy(){if(!Yt.document)return;let t=be.bind(null,"dom"),e=yl(t,!0);Yt.document.addEventListener("click",e,!1),Yt.document.addEventListener("keypress",e,!1),["EventTarget","Node"].forEach(r=>{let n=Yt[r]&&Yt[r].prototype;!n||!n.hasOwnProperty||!n.hasOwnProperty("addEventListener")||(Vt(n,"addEventListener",function(i){return function(s,o,a){if(s==="click"||s=="keypress")try{let l=this,h=l.__sentry_instrumentation_handlers__=l.__sentry_instrumentation_handlers__||{},g=h[s]=h[s]||{refCount:0};if(!g.handler){let p=yl(t);g.handler=p,i.call(this,s,p,a)}g.refCount++}catch{}return i.call(this,s,o,a)}}),Vt(n,"removeEventListener",function(i){return function(s,o,a){if(s==="click"||s=="keypress")try{let l=this,h=l.__sentry_instrumentation_handlers__||{},g=h[s];g&&(g.refCount--,g.refCount<=0&&(i.call(this,s,g.handler,a),g.handler=void 0,delete h[s]),Object.keys(h).length===0&&delete l.__sentry_instrumentation_handlers__)}catch{}return i.call(this,s,o,a)}}))})}function wy(t){if(t.type!==Po)return!1;try{if(!t.target||t.target._sentryId!==ko)return!1}catch{}return!0}function by(t,e){return t!=="keypress"?!1:!e||!e.tagName?!0:!(e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable)}function yl(t,e=!1){return r=>{if(!r||r._sentryCaptured)return;let n=_y(r);if(by(r.type,n))return;Tr(r,"_sentryCaptured",!0),n&&!n._sentryId&&Tr(n,"_sentryId",_e());let i=r.type==="keypress"?"input":r.type;wy(r)||(t({event:r,name:i,global:e}),Po=r.type,ko=n?n._sentryId:void 0),clearTimeout(ml),ml=Yt.setTimeout(()=>{ko=void 0,Po=void 0},my)}}function _y(t){try{return t.target}catch{return null}}var _i;function Ey(t){let e="history";Pr(e,t),kr(e,Sy)}function Sy(){if(!Cg())return;let t=Yt.onpopstate;Yt.onpopstate=function(...r){let n=Yt.location.href,i=_i;if(_i=n,be("history",{from:i,to:n}),t)try{return t.apply(this,r)}catch{}};function e(r){return function(...n){let i=n.length>2?n[2]:void 0;if(i){let s=_i,o=String(i);_i=o,be("history",{from:s,to:o})}return r.apply(this,n)}}Vt(Yt.history,"pushState",e),Vt(Yt.history,"replaceState",e)}var Ri={};function Iy(t){let e=Ri[t];if(e)return e;let r=Yt[t];if(_o(r))return Ri[t]=r.bind(Yt);let n=Yt.document;if(n&&typeof n.createElement=="function")try{let i=n.createElement("iframe");i.hidden=!0,n.head.appendChild(i);let s=i.contentWindow;s&&s[t]&&(r=s[t]),n.head.removeChild(i)}catch(i){gy&&it.warn(`Could not create sandbox iframe for ${t} check, bailing to window.${t}: `,i)}return r&&(Ri[t]=r.bind(Yt))}function vl(t){Ri[t]=void 0}var Pn="__sentry_xhr_v3__";function Cy(t){let e="xhr";Pr(e,t),kr(e,Ty)}function Ty(){if(!Yt.XMLHttpRequest)return;let t=XMLHttpRequest.prototype;Vt(t,"open",function(e){return function(...r){let n=sr()*1e3,i=$e(r[0])?r[0].toUpperCase():void 0,s=xy(r[1]);if(!i||!s)return e.apply(this,r);this[Pn]={method:i,url:s,request_headers:{}},i==="POST"&&s.match(/sentry_key/)&&(this.__sentry_own_request__=!0);let o=()=>{let a=this[Pn];if(a&&this.readyState===4){try{a.status_code=this.status}catch{}let l={endTimestamp:sr()*1e3,startTimestamp:n,xhr:this};be("xhr",l)}};return"onreadystatechange"in this&&typeof this.onreadystatechange=="function"?Vt(this,"onreadystatechange",function(a){return function(...l){return o(),a.apply(this,l)}}):this.addEventListener("readystatechange",o),Vt(this,"setRequestHeader",function(a){return function(...l){let[h,g]=l,p=this[Pn];return p&&$e(h)&&$e(g)&&(p.request_headers[h.toLowerCase()]=g),a.apply(this,l)}}),e.apply(this,r)}}),Vt(t,"send",function(e){return function(...r){let n=this[Pn];if(!n)return e.apply(this,r);r[0]!==void 0&&(n.body=r[0]);let i={startTimestamp:sr()*1e3,xhr:this};return be("xhr",i),e.apply(this,r)}})}function xy(t){if($e(t))return t;try{return t.toString()}catch{}}function Dy(t,e=Iy("fetch")){let r=0,n=0;function i(s){let o=s.body.length;r+=o,n++;let a=D({body:s.body,method:"POST",referrerPolicy:"origin",headers:t.headers,keepalive:r<=6e4&&n<15},t.fetchOptions);if(!e)return vl("fetch"),Vi("No fetch implementation available");try{return e(t.url,a).then(l=>(r-=o,n--,{statusCode:l.status,headers:{"x-sentry-rate-limits":l.headers.get("X-Sentry-Rate-Limits"),"retry-after":l.headers.get("Retry-After")}}))}catch(l){return vl("fetch"),r-=o,n--,Vi(l)}}return Nm(t,i)}var Ny=30,Ay=50;function Ro(t,e,r,n){let i={filename:t,function:e==="<anonymous>"?xr:e,in_app:!0};return r!==void 0&&(i.lineno=r),n!==void 0&&(i.colno=n),i}var Oy=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Py=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,ky=/\((\S*)(?::(\d+))(?::(\d+))\)/,Ry=t=>{let e=Oy.exec(t);if(e){let[,n,i,s]=e;return Ro(n,xr,+i,+s)}let r=Py.exec(t);if(r){if(r[2]&&r[2].indexOf("eval")===0){let s=ky.exec(r[2]);s&&(r[2]=s[1],r[3]=s[2],r[4]=s[3])}let[n,i]=ah(r[1]||xr,r[2]);return Ro(i,n,r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},Ly=[Ny,Ry],Uy=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,My=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,By=t=>{let e=Uy.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){let i=My.exec(e[3]);i&&(e[1]=e[1]||"eval",e[3]=i[1],e[4]=i[2],e[5]="")}let r=e[3],n=e[1]||xr;return[n,r]=ah(n,r),Ro(r,n,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},jy=[Ay,By],$y=[Ly,jy],Fy=$f(...$y),ah=(t,e)=>{let r=t.indexOf("safari-extension")!==-1,n=t.indexOf("safari-web-extension")!==-1;return r||n?[t.indexOf("@")!==-1?t.split("@")[0]:xr,r?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]},Ei=1024,Hy="Breadcrumbs",Vy=(t={})=>{let e=D({console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0},t);return{name:Hy,setup(r){e.console&&Hf(zy(r)),e.dom&&yy(qy(r,e.dom)),e.xhr&&Cy(Yy(r)),e.fetch&&zf(Ky(r)),e.history&&Ey(Jy(r)),e.sentry&&r.on("beforeSendEvent",Gy(r))}}},Wy=Vy;function Gy(t){return function(e){oe()===t&&Nr({category:`sentry.${e.type==="transaction"?"transaction":"event"}`,event_id:e.event_id,level:e.level,message:Xe(e)},{event:e})}}function qy(t,e){return function(r){if(oe()!==t)return;let n,i,s=typeof e=="object"?e.serializeAttribute:void 0,o=typeof e=="object"&&typeof e.maxStringLength=="number"?e.maxStringLength:void 0;o&&o>Ei&&(Vr&&it.warn(`\`dom.maxStringLength\` cannot exceed ${Ei}, but a value of ${o} was configured. Sentry will use ${Ei} instead.`),o=Ei),typeof s=="string"&&(s=[s]);try{let l=r.event,h=Qy(l)?l.target:l;n=Hu(h,{keyAttrs:s,maxStringLength:o}),i=Nf(h)}catch{n="<unknown>"}if(n.length===0)return;let a={category:`ui.${r.name}`,message:n};i&&(a.data={"ui.component_name":i}),Nr(a,{event:r.event,name:r.name,global:r.global})}}function zy(t){return function(e){if(oe()!==t)return;let r={category:"console",data:{arguments:e.args,logger:"console"},level:lg(e.level),message:Fc(e.args," ")};if(e.level==="assert")if(e.args[0]===!1)r.message=`Assertion failed: ${Fc(e.args.slice(1)," ")||"console.assert"}`,r.data.arguments=e.args.slice(1);else return;Nr(r,{input:e.args,level:e.level})}}function Yy(t){return function(e){if(oe()!==t)return;let{startTimestamp:r,endTimestamp:n}=e,i=e.xhr[Pn];if(!r||!n||!i)return;let{method:s,url:o,status_code:a,body:l}=i,h={method:s,url:o,status_code:a},g={xhr:e.xhr,input:l,startTimestamp:r,endTimestamp:n};Nr({category:"xhr",data:h,type:"http"},g)}}function Ky(t){return function(e){if(oe()!==t)return;let{startTimestamp:r,endTimestamp:n}=e;if(n&&!(e.fetchData.url.match(/sentry_key/)&&e.fetchData.method==="POST"))if(e.error){let i=e.fetchData,s={data:e.error,input:e.args,startTimestamp:r,endTimestamp:n};Nr({category:"fetch",data:i,level:"error",type:"http"},s)}else{let i=e.response,s=wt(D({},e.fetchData),{status_code:i&&i.status}),o={input:e.args,response:i,startTimestamp:r,endTimestamp:n};Nr({category:"fetch",data:s,type:"http"},o)}}}function Jy(t){return function(e){if(oe()!==t)return;let r=e.from,n=e.to,i=Us(Ht.location.href),s=r?Us(r):void 0,o=Us(n);(!s||!s.path)&&(s=i),i.protocol===o.protocol&&i.host===o.host&&(n=o.relative),i.protocol===s.protocol&&i.host===s.host&&(r=s.relative),Nr({category:"navigation",data:{from:r,to:n}})}}function Qy(t){return!!t&&!!t.target}var Xy=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","BroadcastChannel","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","SharedWorker","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],Zy="BrowserApiErrors",tv=(t={})=>{let e=D({XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0},t);return{name:Zy,setupOnce(){e.setTimeout&&Vt(Ht,"setTimeout",wl),e.setInterval&&Vt(Ht,"setInterval",wl),e.requestAnimationFrame&&Vt(Ht,"requestAnimationFrame",rv),e.XMLHttpRequest&&"XMLHttpRequest"in Ht&&Vt(XMLHttpRequest.prototype,"send",nv);let r=e.eventTarget;r&&(Array.isArray(r)?r:Xy).forEach(iv)}}},ev=tv;function wl(t){return function(...e){let r=e[0];return e[0]=en(r,{mechanism:{data:{function:ar(t)},handled:!1,type:"instrument"}}),t.apply(this,e)}}function rv(t){return function(e){return t.apply(this,[en(e,{mechanism:{data:{function:"requestAnimationFrame",handler:ar(t)},handled:!1,type:"instrument"}})])}}function nv(t){return function(...e){let r=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(n=>{n in r&&typeof r[n]=="function"&&Vt(r,n,function(i){let s={mechanism:{data:{function:n,handler:ar(i)},handled:!1,type:"instrument"}},o=wa(i);return o&&(s.mechanism.data.handler=ar(o)),en(i,s)})}),t.apply(this,e)}}function iv(t){let e=Ht,r=e[t]&&e[t].prototype;!r||!r.hasOwnProperty||!r.hasOwnProperty("addEventListener")||(Vt(r,"addEventListener",function(n){return function(i,s,o){try{typeof s.handleEvent=="function"&&(s.handleEvent=en(s.handleEvent,{mechanism:{data:{function:"handleEvent",handler:ar(s),target:t},handled:!1,type:"instrument"}}))}catch{}return n.apply(this,[i,en(s,{mechanism:{data:{function:"addEventListener",handler:ar(s),target:t},handled:!1,type:"instrument"}}),o])}}),Vt(r,"removeEventListener",function(n){return function(i,s,o){let a=s;try{let l=a&&a.__sentry_wrapped__;l&&n.call(this,i,l,o)}catch{}return n.call(this,i,a,o)}}))}var sv="GlobalHandlers",ov=(t={})=>{let e=D({onerror:!0,onunhandledrejection:!0},t);return{name:sv,setupOnce(){Error.stackTraceLimit=50},setup(r){e.onerror&&(cv(r),bl("onerror")),e.onunhandledrejection&&(lv(r),bl("onunhandledrejection"))}}},av=ov;function cv(t){Jf(e=>{let{stackParser:r,attachStacktrace:n}=ch();if(oe()!==t||oh())return;let{msg:i,url:s,line:o,column:a,error:l}=e,h=pv(Ca(r,l||i,void 0,n,!1),s,o,a);h.level="error",eh(h,{originalException:l,mechanism:{handled:!1,type:"onerror"}})})}function lv(t){Xf(e=>{let{stackParser:r,attachStacktrace:n}=ch();if(oe()!==t||oh())return;let i=uv(e),s=ga(i)?hv(i):Ca(r,i,void 0,n,!0);s.level="error",eh(s,{originalException:i,mechanism:{handled:!1,type:"onunhandledrejection"}})})}function uv(t){if(ga(t))return t;try{if("reason"in t)return t.reason;if("detail"in t&&"reason"in t.detail)return t.detail.reason}catch{}return t}function hv(t){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(t)}`}]}}}function pv(t,e,r,n){let i=t.exception=t.exception||{},s=i.values=i.values||[],o=s[0]=s[0]||{},a=o.stacktrace=o.stacktrace||{},l=a.frames=a.frames||[],h=isNaN(parseInt(n,10))?void 0:n,g=isNaN(parseInt(r,10))?void 0:r,p=$e(e)&&e.length>0?e:Df();return l.length===0&&l.push({colno:h,filename:p,function:xr,in_app:!0,lineno:g}),t}function bl(t){Vr&&it.log(`Global Handler attached: ${t}`)}function ch(){let t=oe();return t&&t.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}var dv=()=>({name:"HttpContext",preprocessEvent(t){if(!Ht.navigator&&!Ht.location&&!Ht.document)return;let e=t.request&&t.request.url||Ht.location&&Ht.location.href,{referrer:r}=Ht.document||{},{userAgent:n}=Ht.navigator||{},i=D(D(D({},t.request&&t.request.headers),r&&{Referer:r}),n&&{"User-Agent":n}),s=wt(D(D({},t.request),e&&{url:e}),{headers:i});t.request=s}}),fv="cause",gv=5,mv="LinkedErrors",yv=(t={})=>{let e=t.limit||gv,r=t.key||fv;return{name:mv,preprocessEvent(n,i,s){let o=s.getOptions();If(Sa,o.stackParser,o.maxValueLength,r,e,n,i)}}},vv=yv;function wv(t){return[Bm(),Rm(),ev(),Wy(),av(),vv(),Qm(),dv()]}var bv=class extends Error{cause;constructor(t,e){super(t),this.cause=e}},Jt=class lh{static INSTANCE;contexts={};tags;client;user;constructor(){this.init()}static getInstance(){return this.INSTANCE||(this.INSTANCE=new lh),this.INSTANCE}captureException(e,r,n){x.error(e),this.getNewScope(r,n).captureException(e)}captureMessage(e,r,n,i){this.getNewScope(n,i).captureMessage(e,r??"error")}captureError(e,r,n,i){x.error(e,r);let s=this.getNewScope(n,i),o=new bv(e,r);s.captureException(o)}setGlobalContext(e,r){this.contexts[e]=D({context:r},this.contexts[e])}setUser(e){this.user=e}setTags(e){this.tags=e}getNewScope(e,r){let n=new He;if(n.setClient(this.client),n.setUser(this.user),e?.triggerContext){let i=e.triggerContext;n.setExtras(i.triggerData.sentryContext()),delete e.triggerContext}return e&&n.setExtras(e),this.tags&&n.setTags(this.tags),r&&n.setTags(r),Object.keys(this.contexts).forEach(i=>{n.setContext(i,this.contexts[i])}),n.setTag("language",navigator.language),n.setTag("timezone",Iv()),n}init(){let e=wv({}).filter(r=>!["BrowserApiErrors","Breadcrumbs","GlobalHandlers"].includes(r.name));this.client=new fy({dsn:"https://1bc3dda4c861f60cd6be1b67584f4bc6@o559187.ingest.us.sentry.io/4507626484203520",transport:Dy,stackParser:Fy,integrations:e,environment:Pe.mode,release:`web-sdk@${q.SDK_VERSION}`,debug:Pe.debug}),this.client.init()}},_v=class{static format(t,e){let r=/{{\s*(\w+)\s*}}/;return e.replace(r,(n,i)=>{switch(i){case"amount":return this.formatWithDelimiters(t,2);case"amount_no_decimals":return this.formatWithDelimiters(t,0);case"amount_with_comma_separator":return this.formatWithDelimiters(t,2,".",",");case"amount_no_decimals_with_comma_separator":return this.formatWithDelimiters(t,0,".",",");case"amount_with_apostrophe_separator":return this.formatWithDelimiters(t,2,"'",".");case"amount_no_decimals_with_space_separator":return this.formatWithDelimiters(t,0," ");case"amount_with_space_separator":return this.formatWithDelimiters(t,2," ",",");case"amount_with_period_and_space_separator":return this.formatWithDelimiters(t,2," ",".");default:return n}})}static formatWithDelimiters(t,e=2,r=",",n="."){if(isNaN(t)||t==null)return"0";let i=(t/100).toFixed(e).split("."),s=i[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+r),o=i[1]?n+i[1]:"";return s+o}};function uh(t){try{return new URL(t)}catch{return}}function _l(t){return!t||t==="null"||t==="undefined"}function Ev(t,e){let r=t.indexOf(e);return r===-1?!1:(t.splice(r,1),!0)}function Ne(t,e){if(t==0&&e)return"Free";let r=kt.get(),n=se.get(),i=r.shopCurrencyCode||n.currency,s=r.currencyCode;s||x.warn("Currency code is not set in RuntimeData");let o=n.money?.format??r.moneyFormat,a;if(o&&i===s)a=_v.format(t*100,o);else{let l;try{l=new Intl.NumberFormat(hh(),{style:"currency",currency:s||i,minimumFractionDigits:0,maximumFractionDigits:2})}catch(h){return Jt.getInstance().captureException(h,{currentCurrency:s,shopCurrency:i}),""}a=l.format(t),a=a.replace("\u20B9","Rs. "),n.money?.showCurrency&&s!=="INR"&&(a=a.concat(` ${s}`))}return a}function Sv(t){return new Intl.NumberFormat(hh(),{notation:"compact"}).format(t)}function hh(){return navigator.languages!==void 0?navigator.languages[0].split("-")[0]:navigator.language??"en"}var Si;function Iv(){if(Si)return Si;try{return Si=Intl.DateTimeFormat().resolvedOptions().timeZone,Si}catch{return""}}function Ta(t){document.readyState==="complete"?t():document.addEventListener("readystatechange",()=>{document.readyState==="complete"&&t()})}function tr(t){let e=document.createElement("span");e.id="snackbar",e.innerText=t,document.body.appendChild(e),e.className="show",setTimeout(()=>{e.classList.remove("show"),document.body.removeChild(e)},3e3)}async function ph(t,e=10,r=document){let n=0,i=document.querySelectorAll("nonexistent-tag");for(;n<e;){let s=Math.min(100*2**n,5e3);if(await vf.JSUtils.sleep(s),i=r.querySelectorAll(t),i.length)return x.debug(`Attempt ${n+1}: ${i.length} elements found with ${t}`),i;x.debug(`Attempt ${n+1}: Elements not found with ${t}. Retrying after ${s}ms.`),n++}return x.warn(`Max attempts reached. Element not found with ${t}.`),i}async function qi(t,e=10,r=document){return(await ph(t,e,r)).item(0)}function Cv(t,e,r=document.body){let n=new MutationObserver(i=>{i.forEach(s=>{s.removedNodes.forEach(o=>{(o===t||o.contains(t))&&(e(),n.disconnect())})})});n.observe(r,{childList:!0})}async function dh(){let t=await Ut.get(at.DEVICE_ID),e=await re.get(at.ID,"");return[{key:"letscooee_did",value:t},{key:"letscooee_sid",value:e},{key:"__letscooee_time",value:new Date().toLocaleString()},{key:"__letscooee_via",value:"Buy Now"}]}function kn(t,e,r){Object.defineProperty(t,e,{enumerable:!1,configurable:!1,writable:!1,value:r})}var Tv=class{url;alt;constructor(t){t.alt&&(this.alt=t.alt),this.url=t.url}},xv=class{d;cmp;effective;constructor(t={}){this.d=t.d,this.cmp=t.cmp,this.effective=this.d}},Dv=class{id;mID;name;groupID;groupName;isSelected;constructor(t){t??={},this.id=t.id,this.mID=t.mID,this.name=t.name,this.groupID=t.groupID,this.groupName=t.groupName,this.isSelected=t.isSelected??!1}},cs=class{mID;name;imgs;link;price;sku;isAvailable;quantity;sellingPlans;selectedSellingPlan;effectivePrice;constructor(t){t=t??{},this.mID=t.mID,this.name=t.name,this.imgs=t.imgs?.map(e=>new Tv(e))??[],this.link=t.link,this.price=new xv(t.price),this.sku=t.sku,this.isAvailable=t.isAvailable,this.quantity=t.quantity,this.effectivePrice=Ir(this.price.effective),t.sellingPlans?.length&&(this.selectedSellingPlan=Ir(void 0)),this.sellingPlans=t.sellingPlans?.map(e=>{let r=new Dv(e);return r.isSelected&&(this.selectedSellingPlan.value=r),r})}getOneImage(){return this.imgs[0]?.url}changeSellingPlan(t){this.selectedSellingPlan.value=t}hasEffectivePrice(){return this.effectivePrice.value!==this.price.d}},Fe=class{id;mID;name;status;ctg;imgs;videos;portraitVideos;vars;desc;sDesc;link;slug;quantity;category;meta;reviews;tags;selectedOrFirstVariant;selected=Ir(!0);constructor(t){this.update(t),this.selectedOrFirstVariant=Ir(this.selectedVariant)}get imageURL(){return this.imgs?.[0]?.url}get secondaryImageURL(){return this.imgs?.[1]?.url}get getVariantImages(){return this.selectedOrFirstVariant.value.imgs}get variantImage(){return this.getVariantImages[0]?.url}get variantSecondaryImage(){return this.getVariantImages[1]?.url}set variants(t){this.vars=t,this.selectedOrFirstVariant.value=this.selectedVariant}get selectedVariant(){return this.vars.find(t=>t.isAvailable)??this.vars[0]}update(t){return this.id=t.id,this.mID=t.mID,this.name=t.name,this.status=t.status,this.ctg=t.ctg,this.imgs=t.imgs,this.desc=t.desc,this.sDesc=t.sDesc,this.link=t.link,this.slug=t.slug,this.quantity=t.quantity,this.meta=t.meta,this.category=t.category,this.videos=t.videos,this.reviews=t.reviews,this.portraitVideos=t.videos?.filter(e=>e.orientation==="PORTRAIT"),this.tags=t.tags,t.vars&&(this.vars=t.vars.map(e=>new cs(e))),this}toEmbed(t){return t=t??this.selectedOrFirstVariant.value,new pn({id:this.id,mID:this.mID,vID:t.mID,vName:t.name,name:this.name,link:this.link,slug:this.slug,price:t.price.d,imageURL:t.getOneImage()??this.imgs?.[0].url})}getTemplateVariables(){let t=this.selectedOrFirstVariant.value,e=t.price,r=this.name,n=this.category,i=Ne(e.d,!0),s=this.variantImage??this.imageURL,o=this.meta,a=this.tags?.join(",")??"",l=this.reviews?.rating,h=this.reviews?.totalReviews,g=e.cmp&&e.cmp>e.d,p={name:r,price:i,image_url:s,meta:o,category:n,rating:l,reviews:h,tags:a};if(t.hasEffectivePrice()&&(p.effective_price=Ne(t.effectivePrice.value)),g){p.compare_price=Ne(e.cmp);let w=e.cmp-e.d;p.discount_percent=(w/e.cmp*100).toFixed(0),p.discount_price=Ne(w)}let _={name:t.name,quantity:t.quantity};return{product:p,variant:_}}},Nv=class{id;mID;handle;title;imageURL;constructor(t){t??={},this.id=t.id,this.mID=t.mID,this.handle=t.handle,this.title=t.title,this.imageURL=t.imageURL}},Av=class{enabled;constructor(t){this.enabled=t.enabled}},Ov=class extends Av{max;min;constructor(t){t??={},super(t),this.min=t.min,this.max=t.max}},Pv=class{productQuantity;constructor(t){t??={},this.productQuantity=new Ov(t.productQuantity)}},fh=class{s;g;i;constructor(t){t.s&&(this.s=new ie(t.s)),t.g&&(this.g=new Bv(t.g)),this.i=t.i}get solid(){return this.s}get glossy(){return this.g}get img(){return this.i}},qn="a-f\\d",kv=`#?[${qn}]{3}[${qn}]?`,Rv=`#?[${qn}]{6}([${qn}]{2})?`,Lv=new RegExp(`[^#${qn}]`,"gi"),Uv=new RegExp(`^${kv}$|^${Rv}$`,"i");function Mv(t,e={}){if(typeof t!="string"||Lv.test(t)||!Uv.test(t))throw new TypeError("Expected a valid hex string");t=t.replace(/^#/,"");let r=1;t.length===8&&(r=Number.parseInt(t.slice(6,8),16)/255,t=t.slice(0,6)),t.length===4&&(r=Number.parseInt(t.slice(3,4).repeat(2),16)/255,t=t.slice(0,3)),t.length===3&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]);let n=Number.parseInt(t,16),i=n>>16,s=n>>8&255,o=n&255,a=typeof e.alpha=="number"?e.alpha:r;if(e.format==="array")return[i,s,o,a];if(e.format==="css"){let l=a===1?"":` / ${Number((a*100).toFixed(2))}%`;return`rgb(${i} ${s} ${o}${l})`}return{red:i,green:s,blue:o,alpha:a}}var ie=class{h;a=100;g;constructor(t){t??={},this.h=t.h,this.a=t.a,this.g=t.g}get hex(){return this.h}get grad(){return this.g}get rgba(){if(!this.hex)return"";try{return Mv(this.hex,{format:"css",alpha:this.getAlpha()})}catch(t){return console.error("Invalid hex",t),"#000000"}}getAlpha(){return(this.a??100)/100}},xa=class{s;r;w;c;constructor(t){this.s=t.s,this.r=t.r,this.w=t.w,t.c&&(this.c=new ie(t.c))}get radius(){return this.r}get width(){return this.w}get color(){return this.c}get style(){return Da[this.s??1]}},Da=(t=>(t[t.SOLID=1]="SOLID",t[t.DASHED=2]="DASHED",t))(Da||{}),Bv=class gh{static DEFAULT_FALLBACK=new ie({h:"#000000",a:50});r;c;fb;constructor(e){this.r=e.r,e.c&&(this.c=new ie(e.c)),e.fb&&(this.fb=new ie(e.fb))}get radius(){return this.r}get color(){return this.c}get fallback(){return this.fb??gh.DEFAULT_FALLBACK}},jv=class{blur;spr;clr;x;y;constructor(t){t=t??{},this.blur=t.blur??0,this.spr=t.spr??0,this.x=t.x??0,this.y=t.y??0,this.clr=new ie(t.clr)}getStyle(t){return`${this.x*t}px ${this.y*t}px ${this.blur*t}px ${this.spr*t}px ${this.clr.rgba}`}},Na=class{pl;pr;pt;pb;ml;mr;mt;mb;cent;constructor(t){t=t??{},this.pl=t.pl??0,this.pr=t.pr??0,this.pt=t.pt??0,this.pb=t.pb??0,this.ml=t.ml??0,this.mr=t.mr??0,this.mt=t.mt??0,this.mb=t.mb??0,this.cent=t.cent??!1}getHorizontal(){return this.pl+this.pr}getVertical(){return this.pt+this.pb}getPaddingCSS(){return`${this.pt}px ${this.pr}px ${this.pb}px ${this.pl}px`}},mh=class{rot;constructor(t){t?.rot&&(this.rot=t.rot)}get rotate(){return this.rot}},ii=class{t;bg;br;clc;shd;spc;trf;a;w;h;x;y;constructor(t){this.t=t.t,t.bg&&(this.bg=new fh(t.bg)),t.br&&(this.br=new xa(t.br)),t.shd&&(this.shd=new jv(t.shd)),t.spc&&(this.spc=new Na(t.spc)),this.trf=new mh(t.trf),this.clc=t.clc,this.w=t.w,this.h=t.h,this.x=t.x,this.y=t.y,this.a=t.a}get alpha(){return this.a??100}get type(){return this.t}get typeAsString(){return Aa[this.t]}get click(){return this.clc}},Aa=(t=>(t[t.IMAGE=1]="IMAGE",t[t.TEXT=2]="TEXT",t[t.BUTTON=3]="BUTTON",t[t.FLEXBOX=4]="FLEXBOX",t[t.MULTI_COLUMN=5]="MULTI_COLUMN",t[t.CHECKBOX=6]="CHECKBOX",t[t.PRODUCTS=11]="PRODUCTS",t[t.PRODUCT=12]="PRODUCT",t[t.PRODUCT_IMAGE=13]="PRODUCT_IMAGE",t[t.PRODUCT_TITLE=14]="PRODUCT_TITLE",t[t.PRODUCT_VARIATIONS=15]="PRODUCT_VARIATIONS",t[t.PRODUCT_VARIATIONS_SELLING_PLANS=16]="PRODUCT_VARIATIONS_SELLING_PLANS",t[t.PRODUCT_BUTTON=18]="PRODUCT_BUTTON",t[t.PRODUCT_RATING=19]="PRODUCT_RATING",t[t.EMAIL_INPUT=51]="EMAIL_INPUT",t[t.PHONE_INPUT=52]="PHONE_INPUT",t[t.COUNTDOWN_TIMER=61]="COUNTDOWN_TIMER",t[t.CAROUSEL=62]="CAROUSEL",t[t.SHAPE=100]="SHAPE",t))(Aa||{}),yh=class extends ii{constructor(t){super(t)}},Oa=class extends ii{src;constructor(t){super(t),this.src=t.src}},Pa=(t=>(t[t.START=0]="START",t[t.CENTER=1]="CENTER",t[t.END=2]="END",t[t.JUSTIFY=3]="JUSTIFY",t))(Pa||{}),$v=class{name;fonts;constructor(t){t=t??{},t.name&&(t.name=t.name!=="Arial"?t.name:""),this.name=t.name,this.fonts=t.fonts?.map(e=>new Fv(e))}},Fv=class{style;url;constructor(t){t=t??{},this.style=t.style,this.url=t.url}getFontDescriptor(){return{style:this.style===2||this.style===4?"italic":"normal",weight:this.style===4||this.style===3?"700":"400"}}getURL(){return`url('${this.url}') format('truetype')`}},Ve=class{fw;fs;fam;fmly;lh=1.2;ls;s;tc;ta;td;tdc;constructor(t){this.update(t)}get alignment(){return Pa[this.ta]}get letterSpacing(){return this.ls?this.ls+"px":"normal"}update(t){t=t??{},t.lh&&(this.lh=t.lh),t.tdc&&(this.tdc=new ie(t.tdc)),this.td=t.td,this.fs=t.s??t.fs??60,this.tc=new ie(t.tc),this.ta=t.ta??1,this.fw=t.fw??400,this.ls=t.ls??0,this.tc.h??="#000000",this.fam=new $v(t.fam??t.fmly)}resize(t){this.s*=t,this.ls*=t}},ls=class extends ii{typo;constructor(t){super(t);let e=D(D({},t.f),t.typo);t.alg&&(e.ta=t.alg),t.c&&(e.tc=t.c),this.typo=new Ve(e)}get color(){return this.typography.tc}get typography(){return this.typo}},Lo=class extends ls{prs;constructor(t){super(t),this.prs=t.prs}get parts(){return this.prs}},Hv=class extends ii{o;constructor(t){super(t),this.o=t.o??5,this.w=this.w??1080,this.h=this.h??1920}getOrigin(){return this.o}},vh=class{dd;hh;mm;ss;date;constructor(t){t??={},this.dd=t.dd??0,this.hh=t.hh??0,this.mm=t.mm??0,this.ss=t.ss??0,this.date=t.date?new Date(t.date):void 0}start(t,e){let r=new Date;t===2?(r.setSeconds(r.getSeconds()+this.ss),r.setMinutes(r.getMinutes()+this.mm),r.setHours(r.getHours()+this.hh),r.setDate(r.getDate()+this.dd)):r=this.date??new Date;let n=window.setInterval(()=>{let i=new Date().getTime(),s=r.getTime()-i;if(s<1){clearInterval(n);return}let o=Math.floor(s/(1e3*60*60*24)),a=Math.floor(s%(1e3*60*60*24)/(1e3*60*60)),l=Math.floor(s%(1e3*60*60)/(1e3*60)),h=Math.floor(s%(1e3*60)/1e3);e({days:o,hours:a,minutes:l,seconds:h})},1e3);return n}},wh=class extends ls{gap;timer;timerType;horizontal;lblPos;show;constructor(t){t??={},super(t),this.gap=t.gap,this.timerType=t.type,this.timer=new vh(t.timer),this.show=t.show??{day:!0,hour:!0,minute:!0,second:!0},this.horizontal=t.horizontal,this.lblPos=t.lblPos}},Vv=class{txt;c;constructor(t){t??={},this.txt=t.txt,this.c=new ie(t.c??{})}get text(){return this.txt}get color(){return this.c}},ka=class extends ls{ph;constructor(t){super(t),this.ph=new Vv(t.ph)}get placeholderText(){return this.ph.text}get placeholderColor(){return this.ph.color.rgba}},bh=class extends ka{constructor(t){t??={},super(t)}},_h=class extends ka{},Eh=class extends ka{},Sh=class extends Oa{},us=(t=>(t[t.LOW=1]="LOW",t[t.MEDIUM=2]="MEDIUM",t[t.HIGH=3]="HIGH",t))(us||{}),Wv=class{en;ex;constructor(t){t=t??{},this.en=t.en,this.ex=t.ex}getEnterAnimation(){switch(this.en){case 2:return[{transform:"translateY(-100%)"},{transform:"translateY(0%)"}];case 3:return[{transform:"translateY(100%)"},{transform:"translateY(0%)"}];case 4:return[{transform:"translateX(-100%)"},{transform:"translateX(0%)"}];case 5:return[{transform:"translateX(100%)"},{transform:"translateX(0%)"}];case 6:return[{transform:"translate(-100%, -100%)"},{transform:"translate(0%, 0%)"}];case 7:return[{transform:"translate(100%, -100%)"},{transform:"translate(0%, 0%)"}];case 8:return[{transform:"translate(-100%, 100%)"},{transform:"translate(0%, 0%)"}];case 9:return[{transform:"translate(100%, 100%)"},{transform:"translate(0%, 0%)"}];case 10:return[{transform:"scale(0.1)"},{transform:"scale(1)"}];default:return[]}}getExitAnimation(){switch(this.ex){case 2:return[{transform:"translateY(0%)"},{transform:"translateY(-100%)"}];case 3:return[{transform:"translateY(0%)"},{transform:"translateY(100%)"}];case 4:return[{transform:"translateX(0%)"},{transform:"translateX(-100%)"}];case 5:return[{transform:"translateX(0%)"},{transform:"translateX(100%)"}];case 6:return[{transform:"translate(0%, 0%)"},{transform:"translate(-100%, -100%)"}];case 7:return[{transform:"translate(0%, 0%)"},{transform:"translate(100%, -100%)"}];case 8:return[{transform:"translate(0%, 0%)"},{transform:"translate(-100%, 100%)"}];case 9:return[{transform:"translate(0%, 0%)"},{transform:"translate(100%, 100%)"}];case 10:return[{transform:"scale(1)"},{transform:"scale(0)"}];default:return[]}}},El=class extends ii{gvt;max;cover;anim;embedded;position;constructor(t){t=t??{},super(t),this.gvt=t.gvt??5,this.max=t.max,this.cover=t.cover??!0,this.anim=new Wv(t.anim),this.embedded=t.embedded,this.position=t.position??1,this.spc||(this.spc=new Na({pl:q.IN_APP_DEFAULT_PADDING,pr:q.IN_APP_DEFAULT_PADDING,pt:q.IN_APP_DEFAULT_PADDING,pb:q.IN_APP_DEFAULT_PADDING}))}isEmbedded(){return this.position===2&&!!this.embedded}getEmbeddedSelector(){return`.letscooee-engagement.container-${this.embedded}`}},Gv=class extends El{cont;elems=[];mob;constructor(t){t=t??{},super(t),this.cont=new Hv(t.cont),this.mob=new El(t.mob),this.bg||(this.bg=this.cont.bg,delete this.cont.bg),t.elems.forEach(e=>{e.t===1?this.elems.push(new Oa(e)):e.t===2?this.elems.push(new Lo(e)):e.t===3?this.elems.push(new Lo(e)):e.t===100?this.elems.push(new yh(e)):e.t===51?this.elems.push(new _h(e)):e.t===52?this.elems.push(new Eh(e)):e.t===61?this.elems.push(new wh(e)):e.t===15||e.t===16?this.elems.push(new bh(e)):e.t===13&&this.elems.push(new Sh(e))})}getStylesForWrapper(){if(this.cover)return{};let t;return this.gvt===1?t={top:0,left:0}:this.gvt===2?t={top:0,left:"50%",transform:"translateX(-50%)"}:this.gvt===3?t={top:0,right:0}:this.gvt===6?t={top:"50%",right:0,transform:"translateY(-50%)"}:this.gvt===9?t={bottom:0,right:0}:this.gvt===8?t={bottom:0,left:"50%",transform:"translateX(-50%)"}:this.gvt===7?t={bottom:0,left:0}:this.gvt===4?t={top:"50%",left:0,transform:"translateY(-50%)"}:t={top:"50%",left:"50%",transform:"translateX(-50%) translateY(-50%)"},t.overflow="visible",t}getFlexStylesForContainer(){let t={display:"flex",flexDirection:"row"},e,r;return this.gvt===1?(e="flex-start",r="flex-start"):this.gvt===2?(e="center",r="flex-start"):this.gvt===3?(e="flex-end",r="flex-start"):this.gvt===4?(e="flex-start",r="center"):this.gvt===6?(e="flex-end",r="center"):this.gvt===7?(e="flex-start",r="flex-end"):this.gvt===8?(e="center",r="flex-end"):this.gvt===9?(e="flex-end",r="flex-end"):(e="center",r="center"),t.alignItems=r,t.justifyContent=e,t.overflow="visible",t}overrideForMobileView(){this.max=this.mob.max??this.max,this.cover=this.mob.cover??this.cover,this.gvt=this.mob.gvt??this.gvt,this.bg=this.mob.bg??this.bg,this.spc=this.mob.spc??this.spc,this.anim=this.mob.anim??this.anim,this.position=this.mob.position??this.position,this.embedded=this.mob.embedded??this.embedded}},Ih=class{gap;dir;wrap;jc;ai;scroll;constructor(t){t??={},this.gap=t.gap??0,this.dir=t.dir??"row",this.wrap=t.wrap??"nowrap",this.jc=t.jc??"flex-start",this.ai=t.ai??"flex-start",this.scroll=t.scroll}},qv=class{of;disp;pos;top;bottom;left;right;zIndex;constructor(t){t??={},this.of=t.of,this.disp=t.disp,this.pos=t.pos,this.top=t.top,this.bottom=t.bottom,this.left=t.left,this.right=t.right,this.zIndex=t.zIndex}},zv=class{w;h;maxW;maxH;minW;minH;constructor(t){t??={},this.w=t.w??"100%",this.h=t.h??"auto",this.maxW=t.maxW,this.maxH=t.maxH,this.minW=t.minW,this.minH=t.minH}},Sl=class{size;bg;br;spc;typo;lout;flex;constructor(t){t??={},this.spc=new Na(t.spc),t.size&&(this.size=new zv(t.size)),t.bg&&(this.bg=new fh(t.bg)),t.br&&(this.br=new xa(t.br)),t.typo&&(this.typo=new Ve(t.typo)),t.lout&&(this.lout=new qv(t.lout)),t.flex&&(this.flex=new Ih(t.flex))}},Ch=class{sm;lg;constructor(t){t??={},this.sm=new Sl(t.sm),this.lg=new Sl(t.lg)}},ur=class{t;style;hide;when;clc;constructor(t,e){e??={},this.t=t,this.style=new Ch(e.style),this.hide=e.hide,e.when?.op&&(this.when=e.when),e.clc&&(this.clc=e.clc)}get stringType(){return Aa[this.t]}},Oe=class extends ur{text;constructor(t,e){t?.style?.lg?.typo?.s&&delete t.style.lg.typo.s,t?.style?.sm?.typo?.s&&delete t.style.sm.typo.s,super(e??2,t),t??={},this.text=t.text}},Uo=class extends Oe{constructor(t,e){super(t,e??3)}},Th=class extends ur{value;constructor(t){super(6,t),t??={},this.value=t.value}},xh=class extends Oe{constructor(t=15,e){super(e,t)}},Yv=class extends ur{c;iconSize;showSingleStar;fullStar;halfStart;constructor(t){super(19,t),t??={},this.c=new ie(t.c),this.iconSize=t.iconSize??24,this.showSingleStar=t.showSingleStar??!1,this.fullStar=t.fullStar,this.halfStart=t.halfStart}},Kv=dt(an()),Jv=class{enabled;type;color;constructor(t){t??={},this.enabled=t.enabled,this.type=t.type,this.color=new ie(t.color)}},Qv=class{size;enabled;color;constructor(t){t??={},this.enabled=t.enabled,this.size=t.size,this.color=new ie(t.color)}},Dh=class{navigation;pagination;autoplay;maxInRow;gap;slidesPerView;constructor(t){t??={},this.navigation=new Qv(t.navigation),this.pagination=new Jv(t.pagination),this.autoplay=t.autoplay,this.slidesPerView=t.slidesPerView??1,this.maxInRow=t.maxInRow??t.slidesPerView??4,this.gap=t.gap??0}},Xv=class extends ur{conf;slide;formData;values;allowedTypes;constructor(t){super(62,t),t&&this.update(t)}update(t){t??={},this.slide=rn.getParsedElement(t.slide),this.formData=t.formData,this.values=t.values,this.conf=new Dh(t.conf),this.allowedTypes=t.allowedTypes}},Zv=class extends Oe{gap;timer;timerType;horizontal;lblPos;show;constructor(t){t??={},super(t,61),this.gap=t.gap,this.timerType=t.type,this.timer=new vh(t.timer),this.show=t.show??{days:!0,hours:!0,minutes:!0,seconds:!0},this.horizontal=t.horizontal,this.lblPos=t.lblPos}},Ra=class extends ur{elems;constructor(t){super(4,t),this.update(t)}update(t){t??={},this.elems??=[],t.elems?.forEach(e=>{let r=rn.getParsedElement(e);r&&this.elems.push(r)})}},Mo=class extends ur{src;sm;lg;constructor(t,e){super(e??1,t),t&&this.update(t)}update(t){this.src=t.src,this.sm=t.sm,this.lg=t.lg}},rn=class Nh{static getParsedElements(e){let r=[];return e?.forEach(n=>{let i=Nh.getParsedElement(n);i&&r.push(i)}),r}static getParsedElement(e){switch(e.t){case 2:return new Oe(e);case 3:return new Uo(e);case 6:return new Th(e);case 11:return new tw(e);case 12:return new La(e);case 61:return new Zv(e);case 4:return new Ra(e);case 1:return new Mo(e);case 13:return new Mo(e,13);case 14:return new Oe(e,14);case 15:case 16:return new xh(e.t,e);case 18:return new Uo(e,18);case 62:return new Xv(e);case 19:return new Yv(e);default:Kv.default.error("Unknown element type",e.t);return}}static parseAlignmentToJustifyContent(e){switch(e){case 1:return"center";case 2:return"flex-end";case 0:return"flex-start";default:return"flex-start"}}},La=class extends ur{img;title;desc;price;compareAt;btn;variantDD;show;symbol;cBox;elems;noLinks;constructor(t){if(t??={},super(12,t),this.show=t.show,this.elems=rn.getParsedElements(t.elems),this.noLinks=t.noLinks,!this.elems.length){t.cBox&&this.elems.push(new Th(t.cBox)),this.elems.push(new Mo(t.img,13));let e=new Oe(t.title,14);e.hide=!t.show?.title,e.text="{{ product.name }}",this.elems.push(e);let r=new Oe(t.price);r.text="{{ product.price }}",r.hide=!t.show?.price;let n=new Oe(t.compareAt);n.text="{{ product.compare_price }}",n.hide=!t.show?.price,t.compareAt||(n.style=new Ch(r.style),n.style.lg.typo=new Ve(wt(D({},n.style.lg.typo),{td:"line-through"})),n.style.sm.typo=new Ve(wt(D({},n.style.sm.typo),{td:"line-through"})));let i=new Ra({style:{lg:{spc:{mb:10},flex:{dir:"row",gap:10,ai:"center",jc:rn.parseAlignmentToJustifyContent(r.style.lg.typo?.ta)}}}});i.elems.push(n),i.elems.push(r),this.elems.push(i);let s=new xh(15,t.variantDD);if(s.hide=!t.show?.variantDD,this.elems.push(s),t.btn){let o=new Uo(t.btn,18);o.hide=!t.show?.btn,this.elems.push(o)}}t.symbol&&(this.symbol=new Oe(t.symbol))}},tw=class extends ur{conf;prod;constructor(t){super(11,t),t??={},this.conf=new ew(t.conf),this.prod=new La(t.prod)}},Il=class extends Dh{disp;maxItems;constructor(t){t??={},super(t),this.disp=t.disp,this.maxItems=t.maxItems}},ew=class{lg;sm;constructor(t){t??={},this.lg=new Il(t.lg),this.sm=new Il(t.sm)}},rw=class extends Ra{constructor(t){super(t)}},Ah=class{cont;elems=[];constructor(t){t=t??{},this.cont=new rw(t.cont),t.elems?.forEach(e=>{this.addRawElement(e)})}addRawElement(t){let e=rn.getParsedElement(t);return e&&this.elems.push(e),e}},nw=dt(lr()),iw=class{minValue;rewardType;label;reachingText;reachedText;discount;items;calculatedAlignment;constructor(t){this.calculatedAlignment=t.calculatedAlignment,this.minValue=t.minValue,this.rewardType=t.rewardType,this.label=t.label,this.reachingText=t.reachingText,this.reachedText=t.reachedText,this.discount=t.discount,this.items=t.items?.map(e=>new pn(e))}},sw=class{layout;milestones;totalProgress;coupons;onlyLatestGift;noConfetti;removeIneligibleItem;constructor(t){this.layout=t.layout??nw.ProgressBarLayout.ICONS,this.onlyLatestGift=t.onlyLatestGift,this.noConfetti=t.noConfetti,this.removeIneligibleItem=t.removeIneligibleItem??!0,this.update(t)}update(t){t=t??{},this.milestones=t.milestones?.map(e=>new iw(e))??[],this.totalProgress=t.totalProgress,this.coupons=t.coupons}},ow=class{applyDiscountOnMinimum;constructor(t){this.applyDiscountOnMinimum=t.applyDiscountOnMinimum}},aw=class{id;alt;sources;items;durationMS;thumbnail;constructor(t={}){this.id=t.id,this.alt=t.alt,this.sources=t.sources?.sort((e,r)=>r.height-e.height),this.durationMS=t.durationMS,this.thumbnail=t.thumbnail,this.items=t.items?t.items.map(e=>new Fe(e)):[]}},cw=class{videos;source;template;heading;slidePerViewCount;autoPlay;showMuteButton;footerContent;detailPopup;constructor(t={}){this.videos=t.videos?.map(e=>new aw(e))??[],this.source=t.source,this.template=t.template,this.detailPopup=t.detailPopup??{template:"VIDEO_ONLY_VIEW"},this.heading=t.heading,this.showMuteButton=t.showMuteButton,this.slidePerViewCount=t.slidePerViewCount??4,this.autoPlay=t.autoPlay??"ON",this.footerContent=t.footerContent??"FIRST_ITEM"}},lw=class{modifications;constructor(t={}){t.modifications?.length?this.modifications=t.modifications.map(e=>new Cl(e)):t.experiments?.length&&(this.modifications=t.experiments.map(e=>new Cl(e)))}},Cl=class{cssSelector;type;display;bg;typo;br;text;constructor(t={}){this.cssSelector=t.cssSelector??"",this.type=t.type??"OTHER",this.display=t.display,t.bg&&(this.bg=new ie(t.bg)),t.typo&&(this.typo=new Ve(t.typo)),t.br&&(this.br=new xa(t.br)),this.text=t.text}get style(){let t={};return this.display==="HIDE"?t.display="none":this.display==="BLOCK"?t.display="block":this.display==="INLINE"&&(t.display="inline"),this.br?.r&&(t.borderRadius=this.br.r+"px"),this.br?.w&&(t.borderWidth=this.br.w+"px"),this.br?.s&&(t.borderStyle=Da[this.br.s]?.toLowerCase()),this.br?.c?.h&&(t.borderColor=this.br.color?.rgba),this.bg?.h&&(t.backgroundColor=this.bg.rgba),this.type==="TEXT"&&this.typo&&(this.typo.fs&&(t.fontSize=this.typo.fs+"px"),this.typo.lh&&(t.lineHeight=this.typo.lh),this.typo.fw&&(t.fontWeight=this.typo.fw),this.typo.ta&&(t.textAlign=this.typo.alignment),this.typo.tc.h&&(t.color=this.typo.tc.rgba),this.typo.ls&&(t.letterSpacing=this.typo.letterSpacing),this.typo.td&&(t.textDecoration=this.typo.td??"none")),t}toString(){return`Experiment(cssSelector=${this.cssSelector})`}},uw=class{engagementID;shortID;contentType;delay;onsiteDeliveryType;objective;redirectBehaviour;constructor(t){this.shortID=t.shortID,this.contentType=t.contentType,this.engagementID=t.engagementID,this.delay=t.delay??0,this.redirectBehaviour=t.redirectBehaviour,this.onsiteDeliveryType=t.onsiteDeliveryType,this.objective=t.objective}isAnySplit(){return this.isABTesting()||this.isExclusionTesting()}isExclusionTesting(){return this.contentType===Xt.EngagementContentType.EXCLUSION}isABTesting(){return this.contentType===Xt.EngagementContentType.ABTESTING}isSingleContent(){return this.contentType===Xt.EngagementContentType.SINGLE}},Ar=class Oh extends uw{static SWIPER_ELEMENTS=new Set([11,62]);nudgeID;contentID;variation;ian;widget;discount;placement;promotionType;contentSource;manipulation;klaviyoFormID;hasMultiplePlacement;skipSubscribedItems;progressBarConfig;stickyATCConfig;bundleConfig;content;previewType;occurred;id;currency;props;items;nonMutableItems;embeddedItems;bundleFrom;collections;customerData;experimentConfig;discountData=Ir({});constructor(e){super(e),this.id=e.id,this.nudgeID=e.nudgeID,this.currency=kt.get().currencyCode??"USD",this.contentID=e.contentID,this.variation=e.variation,e.widget&&(this.widget=new Ah(e.widget)),this.previewType=e.previewType,this.occurred=e.occurred??new Date,this.props=e.props,this.embeddedItems=e.embeddedItems?.map(r=>new pn(r)),this.items=e.items?.map(r=>new Fe(r))??[],this.nonMutableItems=e.items?.map(r=>new Fe(r))??[],this.collections=e.collections?.map(r=>new Nv(r))??[],this.discount=e.discount,this.placement=e.placement,this.customerData=e.customerData,this.ian=e.ian?this.processPopup(e.ian):void 0,this.promotionType=e.promotionType,this.manipulation=new Pv(e.manipulation),this.contentSource=e.contentSource,this.klaviyoFormID=e.klaviyoFormID,this.hasMultiplePlacement=e.hasMultiplePlacement,this.skipSubscribedItems=e.skipSubscribedItems,this.stickyATCConfig=e.stickyATCConfig,e.experimentConfig&&(this.experimentConfig=new lw(e.experimentConfig)),e.progressBarConfig&&(this.progressBarConfig=new sw(e.progressBarConfig)),e.bundleConfig&&(this.bundleConfig=new ow(e.bundleConfig)),e.bundleFrom&&(this.bundleFrom=new Fe(e.bundleFrom)),e.content?.videoConfig&&(this.content={videoConfig:new cw(e.content.videoConfig)})}shouldDelay(){return this.delay>0}sentryContext(){return{id:this.id,shortID:this.shortID,currency:this.currency,contentType:this.contentType,objective:this.objective,onsiteDeliveryType:this.onsiteDeliveryType,engagementID:this.engagementID,contentID:this.contentID,nudgeID:this.nudgeID,variation:this.variation}}getDelaySeconds(){let e=new Date().getTime()-this.occurred.getTime();return this.delay*1e3-e}isBundle(){return this.objective===Xt.EngagementObjective.BUNDLE_AND_UPSELL}isCartEmbed(){return this.onsiteDeliveryType===Xt.OnsiteDeliveryType.CART_EMBED}isPageEmbed(){return this.onsiteDeliveryType===Xt.OnsiteDeliveryType.PAGE_EMBED}isProgressBar(){return this.objective===Xt.EngagementObjective.PROGRESS_BAR}isSubscriptionUpsell(){return this.objective===Xt.EngagementObjective.SUBSCRIPTION_UPSELL}isCartRecovery(){return this.objective===Xt.EngagementObjective.CART_RECOVERY}isProductPromotion(){return this.objective===Xt.EngagementObjective.PRODUCT_PROMOTION}isProductPromoted(){return this.isProductPromotion()||this.isBundle()||this.isCartRecovery()}isCollectionPromoted(){return this.isProductPromotion()&&this.collections.length>0&&this.promotionType===Xt.PromotionType.COLLECTION}isBYOB(){return this.objective===Xt.EngagementObjective.BYOB}isStickyATC(){return this.objective===Xt.EngagementObjective.STICKY_ATC}isShoppableVideo(){return this.objective===Xt.EngagementObjective.SHOPPABLE_VIDEO}processPopup(e){let r=JSON.stringify(e),n=this.items[0],i={},s={};if(n){let l=n.selectedOrFirstVariant.value;i={name:n.name,id:n.mID,link:n.link,vID:l.mID,image:n.variantImage,price:Ne(l.price.d),comparePrice:Ne(l.price.cmp),quantity:n.quantity},s={quantity:l.quantity}}let o={productCount:Ot.getCurrent().item_count},a=je.render(r,{product:i,variant:s,cart:o,discount:this.discount,customer:this.customerData});return n&&(a=a.replace(new RegExp(q.PLACEHOLDER_IMAGE,"gi"),n.variantImage??n.imageURL)),new Gv(JSON.parse(a))}calculateDiscountData(e,r){let n=Os.ArrayUtils.sum(e,o=>o.selectedOrFirstVariant.value.price.d),i=Os.ArrayUtils.sum(e,o=>{let a=o.selectedOrFirstVariant.value.price;return a.cmp??a.d}),s={actualPrice:n,totalComparePrice:i,discountAmount:0,discountPercentage:0,discountedPrice:n};if(!e?.length||!r||!this.discount?.type){this.discountData.value=this.formatCurrencyAndNumber(s);return}if(Ke.DiscountType.BXGY===this.discount.type&&this.discount.values?.length)s.discountPercentage=this.discount.values[0],this.updateEffectivePrice(e,s.discountPercentage,!0),s.discountAmount=s.actualPrice-Os.ArrayUtils.sum(e,o=>o.selectedOrFirstVariant.value.effectivePrice.value);else if([Ke.DiscountType.UNIQUE_FLAT_ITEMS,Ke.DiscountType.STATIC,Ke.DiscountType.UNIQUE_FLAT].includes(this.discount.type)&&this.discount.values?.length)s.discountPercentage=this.discount.values[0],s.discountAmount=s.actualPrice*s.discountPercentage/100,this.updateEffectivePrice(e,s.discountPercentage);else if(this.discount.type===Ke.DiscountType.UNIQUE_FIXED_ITEMS&&this.discount.values?.length)s.discountAmount=s.actualPrice-this.discount.values[0],s.discountPercentage=s.discountAmount/s.actualPrice*100,this.updateEffectivePrice(e,s.discountPercentage);else if(this.discount.type===Ke.DiscountType.UNIQUE_CHEAPEST_ITEM_FREE){e.sort((a,l)=>l.selectedOrFirstVariant.value.price.d-a.selectedOrFirstVariant.value.price.d);let o=e[e.length-1];o.selectedOrFirstVariant.value.effectivePrice.value=0,s.discountAmount=o.selectedOrFirstVariant.value.price.d,s.discountPercentage=s.discountAmount/s.actualPrice*100}s.discountedPrice=s.actualPrice-s.discountAmount,this.discountData.value=this.formatCurrencyAndNumber(s)}getPrivateAttributesForLineItem(){return se.get().skipItemAttribute?{}:{[q.VIA]:"Cooee",[q.CAMPAIGN_ATTRIBUTE]:this.shortID,[q.CONTENT_ATTRIBUTE]:this.contentID}}getKVFormatPrivateAttributesForLineItem(){return se.get().skipItemAttribute?[]:[{key:q.VIA,value:"Cooee"},{key:q.CAMPAIGN_ATTRIBUTE,value:this.shortID},{key:q.CONTENT_ATTRIBUTE,value:this.contentID}]}isBundleDiscount(){return[Ke.DiscountType.UNIQUE_FIXED_ITEMS,Ke.DiscountType.UNIQUE_FLAT_ITEMS].includes(this.discount.type)}isBundleOnCartDrawer(){return this.isBundle()&&this.isCartEmbed()}isBundleOnPDP(){return this.isPageEmbed()&&this.isBundle()}hasSwiperElement(){let e=this.widget?.elems.find(n=>Oh.SWIPER_ELEMENTS.has(n.t));if(!e)return!1;if(e.t===62)return!0;let r=Wn.get().isMobile()?"sm":"lg";return e.conf[r].disp===2}toString(){return`Engagement(id=${this.shortID})`}getCartMagicVariables(){let e=Ot.getCurrent();return{productCount:e.item_count,amount:Ne(e.total_price/100),originalAmount:Ne(e.original_total_price/100)}}updateEffectivePrice(e,r,n=!1){let i=kt.get().getCurrentItem();e.forEach(s=>{let o=s.selectedOrFirstVariant.value,a=o.price;if(n&&s.mID===i.mID)o.effectivePrice.value=a.d;else{let l=a.d*r/100;o.effectivePrice.value=a.d-l}})}formatCurrencyAndNumber(e){if(!e)return{};let r={discountPercentage:Sv(e.discountPercentage??0),discountCode:this.discount?.code};return["actualPrice","discountAmount","discountedPrice","totalComparePrice"].map(n=>{r[n]=Ne(e[n])}),r}};function hw(t,e){return e={exports:{}},t(e,e.exports),e.exports}var pw=mw,dw=vw,fw=_w,Ae=[],pe=[],gw=typeof Uint8Array<"u"?Uint8Array:Array,Bs="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(dr=0,Tl=Bs.length;dr<Tl;++dr)Ae[dr]=Bs[dr],pe[Bs.charCodeAt(dr)]=dr;var dr,Tl;pe[45]=62;pe[95]=63;function Ph(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function mw(t){var e=Ph(t),r=e[0],n=e[1];return(r+n)*3/4-n}function yw(t,e,r){return(e+r)*3/4-r}function vw(t){var e,r=Ph(t),n=r[0],i=r[1],s=new gw(yw(t,n,i)),o=0,a=i>0?n-4:n,l;for(l=0;l<a;l+=4)e=pe[t.charCodeAt(l)]<<18|pe[t.charCodeAt(l+1)]<<12|pe[t.charCodeAt(l+2)]<<6|pe[t.charCodeAt(l+3)],s[o++]=e>>16&255,s[o++]=e>>8&255,s[o++]=e&255;return i===2&&(e=pe[t.charCodeAt(l)]<<2|pe[t.charCodeAt(l+1)]>>4,s[o++]=e&255),i===1&&(e=pe[t.charCodeAt(l)]<<10|pe[t.charCodeAt(l+1)]<<4|pe[t.charCodeAt(l+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function ww(t){return Ae[t>>18&63]+Ae[t>>12&63]+Ae[t>>6&63]+Ae[t&63]}function bw(t,e,r){for(var n,i=[],s=e;s<r;s+=3)n=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(t[s+2]&255),i.push(ww(n));return i.join("")}function _w(t){for(var e,r=t.length,n=r%3,i=[],s=16383,o=0,a=r-n;o<a;o+=s)i.push(bw(t,o,o+s>a?a:o+s));return n===1?(e=t[r-1],i.push(Ae[e>>2]+Ae[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(Ae[e>>10]+Ae[e>>4&63]+Ae[e<<2&63]+"=")),i.join("")}var js={byteLength:pw,toByteArray:dw,fromByteArray:fw},Ew=function(t,e,r,n,i){var s,o,a=i*8-n-1,l=(1<<a)-1,h=l>>1,g=-7,p=r?i-1:0,_=r?-1:1,w=t[e+p];for(p+=_,s=w&(1<<-g)-1,w>>=-g,g+=a;g>0;s=s*256+t[e+p],p+=_,g-=8);for(o=s&(1<<-g)-1,s>>=-g,g+=n;g>0;o=o*256+t[e+p],p+=_,g-=8);if(s===0)s=1-h;else{if(s===l)return o?NaN:(w?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-h}return(w?-1:1)*o*Math.pow(2,s-n)},Sw=function(t,e,r,n,i,s){var o,a,l,h=s*8-i-1,g=(1<<h)-1,p=g>>1,_=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,w=n?0:s-1,b=n?1:-1,E=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=g):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+p>=1?e+=_/l:e+=_*Math.pow(2,1-p),e*l>=2&&(o++,l/=2),o+p>=g?(a=0,o=g):o+p>=1?(a=(e*l-1)*Math.pow(2,i),o=o+p):(a=e*Math.pow(2,p-1)*Math.pow(2,i),o=0));i>=8;t[r+w]=a&255,w+=b,a/=256,i-=8);for(o=o<<i|a,h+=i;h>0;t[r+w]=o&255,w+=b,o/=256,h-=8);t[r+w-b]|=E*128},Br={read:Ew,write:Sw},hs=hw(function(t,e){var r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=o,e.SlowBuffer=A,e.INSPECT_MAX_BYTES=50;var n=2147483647;e.kMaxLength=n,o.TYPED_ARRAY_SUPPORT=i(),!o.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function i(){try{var c=new Uint8Array(1),u={foo:function(){return 42}};return Object.setPrototypeOf(u,Uint8Array.prototype),Object.setPrototypeOf(c,u),c.foo()===42}catch{return!1}}Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}});function s(c){if(c>n)throw new RangeError('The value "'+c+'" is invalid for option "size"');var u=new Uint8Array(c);return Object.setPrototypeOf(u,o.prototype),u}function o(c,u,d){if(typeof c=="number"){if(typeof u=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return g(c)}return a(c,u,d)}o.poolSize=8192;function a(c,u,d){if(typeof c=="string")return p(c,u);if(ArrayBuffer.isView(c))return w(c);if(c==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(c));if(le(c,ArrayBuffer)||c&&le(c.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(le(c,SharedArrayBuffer)||c&&le(c.buffer,SharedArrayBuffer)))return b(c,u,d);if(typeof c=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var S=c.valueOf&&c.valueOf();if(S!=null&&S!==c)return o.from(S,u,d);var N=E(c);if(N)return N;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof c[Symbol.toPrimitive]=="function")return o.from(c[Symbol.toPrimitive]("string"),u,d);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(c))}o.from=function(c,u,d){return a(c,u,d)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array);function l(c){if(typeof c!="number")throw new TypeError('"size" argument must be of type number');if(c<0)throw new RangeError('The value "'+c+'" is invalid for option "size"')}function h(c,u,d){return l(c),c<=0?s(c):u!==void 0?typeof d=="string"?s(c).fill(u,d):s(c).fill(u):s(c)}o.alloc=function(c,u,d){return h(c,u,d)};function g(c){return l(c),s(c<0?0:k(c)|0)}o.allocUnsafe=function(c){return g(c)},o.allocUnsafeSlow=function(c){return g(c)};function p(c,u){if((typeof u!="string"||u==="")&&(u="utf8"),!o.isEncoding(u))throw new TypeError("Unknown encoding: "+u);var d=M(c,u)|0,S=s(d),N=S.write(c,u);return N!==d&&(S=S.slice(0,N)),S}function _(c){for(var u=c.length<0?0:k(c.length)|0,d=s(u),S=0;S<u;S+=1)d[S]=c[S]&255;return d}function w(c){if(le(c,Uint8Array)){var u=new Uint8Array(c);return b(u.buffer,u.byteOffset,u.byteLength)}return _(c)}function b(c,u,d){if(u<0||c.byteLength<u)throw new RangeError('"offset" is outside of buffer bounds');if(c.byteLength<u+(d||0))throw new RangeError('"length" is outside of buffer bounds');var S;return u===void 0&&d===void 0?S=new Uint8Array(c):d===void 0?S=new Uint8Array(c,u):S=new Uint8Array(c,u,d),Object.setPrototypeOf(S,o.prototype),S}function E(c){if(o.isBuffer(c)){var u=k(c.length)|0,d=s(u);return d.length===0||c.copy(d,0,0,u),d}if(c.length!==void 0)return typeof c.length!="number"||mn(c.length)?s(0):_(c);if(c.type==="Buffer"&&Array.isArray(c.data))return _(c.data)}function k(c){if(c>=n)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n.toString(16)+" bytes");return c|0}function A(c){return+c!=c&&(c=0),o.alloc(+c)}o.isBuffer=function(c){return c!=null&&c._isBuffer===!0&&c!==o.prototype},o.compare=function(c,u){if(le(c,Uint8Array)&&(c=o.from(c,c.offset,c.byteLength)),le(u,Uint8Array)&&(u=o.from(u,u.offset,u.byteLength)),!o.isBuffer(c)||!o.isBuffer(u))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(c===u)return 0;for(var d=c.length,S=u.length,N=0,j=Math.min(d,S);N<j;++N)if(c[N]!==u[N]){d=c[N],S=u[N];break}return d<S?-1:S<d?1:0},o.isEncoding=function(c){switch(String(c).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(c,u){if(!Array.isArray(c))throw new TypeError('"list" argument must be an Array of Buffers');if(c.length===0)return o.alloc(0);var d;if(u===void 0)for(u=0,d=0;d<c.length;++d)u+=c[d].length;var S=o.allocUnsafe(u),N=0;for(d=0;d<c.length;++d){var j=c[d];if(le(j,Uint8Array))N+j.length>S.length?o.from(j).copy(S,N):Uint8Array.prototype.set.call(S,j,N);else if(o.isBuffer(j))j.copy(S,N);else throw new TypeError('"list" argument must be an Array of Buffers');N+=j.length}return S};function M(c,u){if(o.isBuffer(c))return c.length;if(ArrayBuffer.isView(c)||le(c,ArrayBuffer))return c.byteLength;if(typeof c!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+babelHelpers.typeof(c));var d=c.length,S=arguments.length>2&&arguments[2]===!0;if(!S&&d===0)return 0;for(var N=!1;;)switch(u){case"ascii":case"latin1":case"binary":return d;case"utf8":case"utf-8":return gn(c).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return d*2;case"hex":return d>>>1;case"base64":return pi(c).length;default:if(N)return S?-1:gn(c).length;u=(""+u).toLowerCase(),N=!0}}o.byteLength=M;function z(c,u,d){var S=!1;if((u===void 0||u<0)&&(u=0),u>this.length||((d===void 0||d>this.length)&&(d=this.length),d<=0)||(d>>>=0,u>>>=0,d<=u))return"";for(c||(c="utf8");;)switch(c){case"hex":return zt(this,u,d);case"utf8":case"utf-8":return Tt(this,u,d);case"ascii":return qt(this,u,d);case"latin1":case"binary":return mt(this,u,d);case"base64":return ct(this,u,d);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ot(this,u,d);default:if(S)throw new TypeError("Unknown encoding: "+c);c=(c+"").toLowerCase(),S=!0}}o.prototype._isBuffer=!0;function B(c,u,d){var S=c[u];c[u]=c[d],c[d]=S}o.prototype.swap16=function(){var c=this.length;if(c%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var u=0;u<c;u+=2)B(this,u,u+1);return this},o.prototype.swap32=function(){var c=this.length;if(c%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var u=0;u<c;u+=4)B(this,u,u+3),B(this,u+1,u+2);return this},o.prototype.swap64=function(){var c=this.length;if(c%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var u=0;u<c;u+=8)B(this,u,u+7),B(this,u+1,u+6),B(this,u+2,u+5),B(this,u+3,u+4);return this},o.prototype.toString=function(){var c=this.length;return c===0?"":arguments.length===0?Tt(this,0,c):z.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(c){if(!o.isBuffer(c))throw new TypeError("Argument must be a Buffer");return this===c?!0:o.compare(this,c)===0},o.prototype.inspect=function(){var c="",u=e.INSPECT_MAX_BYTES;return c=this.toString("hex",0,u).replace(/(.{2})/g,"$1 ").trim(),this.length>u&&(c+=" ... "),"<Buffer "+c+">"},r&&(o.prototype[r]=o.prototype.inspect),o.prototype.compare=function(c,u,d,S,N){if(le(c,Uint8Array)&&(c=o.from(c,c.offset,c.byteLength)),!o.isBuffer(c))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+babelHelpers.typeof(c));if(u===void 0&&(u=0),d===void 0&&(d=c?c.length:0),S===void 0&&(S=0),N===void 0&&(N=this.length),u<0||d>c.length||S<0||N>this.length)throw new RangeError("out of range index");if(S>=N&&u>=d)return 0;if(S>=N)return-1;if(u>=d)return 1;if(u>>>=0,d>>>=0,S>>>=0,N>>>=0,this===c)return 0;for(var j=N-S,K=d-u,ht=Math.min(j,K),Pt=this.slice(S,N),yt=c.slice(u,d),xt=0;xt<ht;++xt)if(Pt[xt]!==yt[xt]){j=Pt[xt],K=yt[xt];break}return j<K?-1:K<j?1:0};function X(c,u,d,S,N){if(c.length===0)return-1;if(typeof d=="string"?(S=d,d=0):d>2147483647?d=2147483647:d<-2147483648&&(d=-2147483648),d=+d,mn(d)&&(d=N?0:c.length-1),d<0&&(d=c.length+d),d>=c.length){if(N)return-1;d=c.length-1}else if(d<0)if(N)d=0;else return-1;if(typeof u=="string"&&(u=o.from(u,S)),o.isBuffer(u))return u.length===0?-1:bt(c,u,d,S,N);if(typeof u=="number")return u=u&255,typeof Uint8Array.prototype.indexOf=="function"?N?Uint8Array.prototype.indexOf.call(c,u,d):Uint8Array.prototype.lastIndexOf.call(c,u,d):bt(c,[u],d,S,N);throw new TypeError("val must be string, number or Buffer")}function bt(c,u,d,S,N){var j=1,K=c.length,ht=u.length;if(S!==void 0&&(S=String(S).toLowerCase(),S==="ucs2"||S==="ucs-2"||S==="utf16le"||S==="utf-16le")){if(c.length<2||u.length<2)return-1;j=2,K/=2,ht/=2,d/=2}function Pt(yn,vn){return j===1?yn[vn]:yn.readUInt16BE(vn*j)}var yt;if(N){var xt=-1;for(yt=d;yt<K;yt++)if(Pt(c,yt)===Pt(u,xt===-1?0:yt-xt)){if(xt===-1&&(xt=yt),yt-xt+1===ht)return xt*j}else xt!==-1&&(yt-=yt-xt),xt=-1}else for(d+ht>K&&(d=K-ht),yt=d;yt>=0;yt--){for(var Bt=!0,pr=0;pr<ht;pr++)if(Pt(c,yt+pr)!==Pt(u,pr)){Bt=!1;break}if(Bt)return yt}return-1}o.prototype.includes=function(c,u,d){return this.indexOf(c,u,d)!==-1},o.prototype.indexOf=function(c,u,d){return X(this,c,u,d,!0)},o.prototype.lastIndexOf=function(c,u,d){return X(this,c,u,d,!1)};function It(c,u,d,S){d=Number(d)||0;var N=c.length-d;S?(S=Number(S),S>N&&(S=N)):S=N;var j=u.length;S>j/2&&(S=j/2);for(var K=0;K<S;++K){var ht=parseInt(u.substr(K*2,2),16);if(mn(ht))return K;c[d+K]=ht}return K}function H(c,u,d,S){return Ur(gn(u,c.length-d),c,d,S)}function rt(c,u,d,S){return Ur(Es(u),c,d,S)}function Z(c,u,d,S){return Ur(pi(u),c,d,S)}function tt(c,u,d,S){return Ur(Ss(u,c.length-d),c,d,S)}o.prototype.write=function(c,u,d,S){if(u===void 0)S="utf8",d=this.length,u=0;else if(d===void 0&&typeof u=="string")S=u,d=this.length,u=0;else if(isFinite(u))u=u>>>0,isFinite(d)?(d=d>>>0,S===void 0&&(S="utf8")):(S=d,d=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var N=this.length-u;if((d===void 0||d>N)&&(d=N),c.length>0&&(d<0||u<0)||u>this.length)throw new RangeError("Attempt to write outside buffer bounds");S||(S="utf8");for(var j=!1;;)switch(S){case"hex":return It(this,c,u,d);case"utf8":case"utf-8":return H(this,c,u,d);case"ascii":case"latin1":case"binary":return rt(this,c,u,d);case"base64":return Z(this,c,u,d);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return tt(this,c,u,d);default:if(j)throw new TypeError("Unknown encoding: "+S);S=(""+S).toLowerCase(),j=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ct(c,u,d){return u===0&&d===c.length?js.fromByteArray(c):js.fromByteArray(c.slice(u,d))}function Tt(c,u,d){d=Math.min(c.length,d);for(var S=[],N=u;N<d;){var j=c[N],K=null,ht=j>239?4:j>223?3:j>191?2:1;if(N+ht<=d){var Pt,yt,xt,Bt;switch(ht){case 1:j<128&&(K=j);break;case 2:Pt=c[N+1],(Pt&192)===128&&(Bt=(j&31)<<6|Pt&63,Bt>127&&(K=Bt));break;case 3:Pt=c[N+1],yt=c[N+2],(Pt&192)===128&&(yt&192)===128&&(Bt=(j&15)<<12|(Pt&63)<<6|yt&63,Bt>2047&&(Bt<55296||Bt>57343)&&(K=Bt));break;case 4:Pt=c[N+1],yt=c[N+2],xt=c[N+3],(Pt&192)===128&&(yt&192)===128&&(xt&192)===128&&(Bt=(j&15)<<18|(Pt&63)<<12|(yt&63)<<6|xt&63,Bt>65535&&Bt<1114112&&(K=Bt))}}K===null?(K=65533,ht=1):K>65535&&(K-=65536,S.push(K>>>10&1023|55296),K=56320|K&1023),S.push(K),N+=ht}return $t(S)}var m=4096;function $t(c){var u=c.length;if(u<=m)return String.fromCharCode.apply(String,c);for(var d="",S=0;S<u;)d+=String.fromCharCode.apply(String,c.slice(S,S+=m));return d}function qt(c,u,d){var S="";d=Math.min(c.length,d);for(var N=u;N<d;++N)S+=String.fromCharCode(c[N]&127);return S}function mt(c,u,d){var S="";d=Math.min(c.length,d);for(var N=u;N<d;++N)S+=String.fromCharCode(c[N]);return S}function zt(c,u,d){var S=c.length;(!u||u<0)&&(u=0),(!d||d<0||d>S)&&(d=S);for(var N="",j=u;j<d;++j)N+=Is[c[j]];return N}function ot(c,u,d){for(var S=c.slice(u,d),N="",j=0;j<S.length-1;j+=2)N+=String.fromCharCode(S[j]+S[j+1]*256);return N}o.prototype.slice=function(c,u){var d=this.length;c=~~c,u=u===void 0?d:~~u,c<0?(c+=d,c<0&&(c=0)):c>d&&(c=d),u<0?(u+=d,u<0&&(u=0)):u>d&&(u=d),u<c&&(u=c);var S=this.subarray(c,u);return Object.setPrototypeOf(S,o.prototype),S};function nt(c,u,d){if(c%1!==0||c<0)throw new RangeError("offset is not uint");if(c+u>d)throw new RangeError("Trying to access beyond buffer length")}o.prototype.readUintLE=o.prototype.readUIntLE=function(c,u,d){c=c>>>0,u=u>>>0,d||nt(c,u,this.length);for(var S=this[c],N=1,j=0;++j<u&&(N*=256);)S+=this[c+j]*N;return S},o.prototype.readUintBE=o.prototype.readUIntBE=function(c,u,d){c=c>>>0,u=u>>>0,d||nt(c,u,this.length);for(var S=this[c+--u],N=1;u>0&&(N*=256);)S+=this[c+--u]*N;return S},o.prototype.readUint8=o.prototype.readUInt8=function(c,u){return c=c>>>0,u||nt(c,1,this.length),this[c]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(c,u){return c=c>>>0,u||nt(c,2,this.length),this[c]|this[c+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(c,u){return c=c>>>0,u||nt(c,2,this.length),this[c]<<8|this[c+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(c,u){return c=c>>>0,u||nt(c,4,this.length),(this[c]|this[c+1]<<8|this[c+2]<<16)+this[c+3]*16777216},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(c,u){return c=c>>>0,u||nt(c,4,this.length),this[c]*16777216+(this[c+1]<<16|this[c+2]<<8|this[c+3])},o.prototype.readIntLE=function(c,u,d){c=c>>>0,u=u>>>0,d||nt(c,u,this.length);for(var S=this[c],N=1,j=0;++j<u&&(N*=256);)S+=this[c+j]*N;return N*=128,S>=N&&(S-=Math.pow(2,8*u)),S},o.prototype.readIntBE=function(c,u,d){c=c>>>0,u=u>>>0,d||nt(c,u,this.length);for(var S=u,N=1,j=this[c+--S];S>0&&(N*=256);)j+=this[c+--S]*N;return N*=128,j>=N&&(j-=Math.pow(2,8*u)),j},o.prototype.readInt8=function(c,u){return c=c>>>0,u||nt(c,1,this.length),this[c]&128?(255-this[c]+1)*-1:this[c]},o.prototype.readInt16LE=function(c,u){c=c>>>0,u||nt(c,2,this.length);var d=this[c]|this[c+1]<<8;return d&32768?d|4294901760:d},o.prototype.readInt16BE=function(c,u){c=c>>>0,u||nt(c,2,this.length);var d=this[c+1]|this[c]<<8;return d&32768?d|4294901760:d},o.prototype.readInt32LE=function(c,u){return c=c>>>0,u||nt(c,4,this.length),this[c]|this[c+1]<<8|this[c+2]<<16|this[c+3]<<24},o.prototype.readInt32BE=function(c,u){return c=c>>>0,u||nt(c,4,this.length),this[c]<<24|this[c+1]<<16|this[c+2]<<8|this[c+3]},o.prototype.readFloatLE=function(c,u){return c=c>>>0,u||nt(c,4,this.length),Br.read(this,c,!0,23,4)},o.prototype.readFloatBE=function(c,u){return c=c>>>0,u||nt(c,4,this.length),Br.read(this,c,!1,23,4)},o.prototype.readDoubleLE=function(c,u){return c=c>>>0,u||nt(c,8,this.length),Br.read(this,c,!0,52,8)},o.prototype.readDoubleBE=function(c,u){return c=c>>>0,u||nt(c,8,this.length),Br.read(this,c,!1,52,8)};function Ft(c,u,d,S,N,j){if(!o.isBuffer(c))throw new TypeError('"buffer" argument must be a Buffer instance');if(u>N||u<j)throw new RangeError('"value" argument is out of bounds');if(d+S>c.length)throw new RangeError("Index out of range")}o.prototype.writeUintLE=o.prototype.writeUIntLE=function(c,u,d,S){if(c=+c,u=u>>>0,d=d>>>0,!S){var N=Math.pow(2,8*d)-1;Ft(this,c,u,d,N,0)}var j=1,K=0;for(this[u]=c&255;++K<d&&(j*=256);)this[u+K]=c/j&255;return u+d},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(c,u,d,S){if(c=+c,u=u>>>0,d=d>>>0,!S){var N=Math.pow(2,8*d)-1;Ft(this,c,u,d,N,0)}var j=d-1,K=1;for(this[u+j]=c&255;--j>=0&&(K*=256);)this[u+j]=c/K&255;return u+d},o.prototype.writeUint8=o.prototype.writeUInt8=function(c,u,d){return c=+c,u=u>>>0,d||Ft(this,c,u,1,255,0),this[u]=c&255,u+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(c,u,d){return c=+c,u=u>>>0,d||Ft(this,c,u,2,65535,0),this[u]=c&255,this[u+1]=c>>>8,u+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(c,u,d){return c=+c,u=u>>>0,d||Ft(this,c,u,2,65535,0),this[u]=c>>>8,this[u+1]=c&255,u+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(c,u,d){return c=+c,u=u>>>0,d||Ft(this,c,u,4,4294967295,0),this[u+3]=c>>>24,this[u+2]=c>>>16,this[u+1]=c>>>8,this[u]=c&255,u+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(c,u,d){return c=+c,u=u>>>0,d||Ft(this,c,u,4,4294967295,0),this[u]=c>>>24,this[u+1]=c>>>16,this[u+2]=c>>>8,this[u+3]=c&255,u+4},o.prototype.writeIntLE=function(c,u,d,S){if(c=+c,u=u>>>0,!S){var N=Math.pow(2,8*d-1);Ft(this,c,u,d,N-1,-N)}var j=0,K=1,ht=0;for(this[u]=c&255;++j<d&&(K*=256);)c<0&&ht===0&&this[u+j-1]!==0&&(ht=1),this[u+j]=(c/K>>0)-ht&255;return u+d},o.prototype.writeIntBE=function(c,u,d,S){if(c=+c,u=u>>>0,!S){var N=Math.pow(2,8*d-1);Ft(this,c,u,d,N-1,-N)}var j=d-1,K=1,ht=0;for(this[u+j]=c&255;--j>=0&&(K*=256);)c<0&&ht===0&&this[u+j+1]!==0&&(ht=1),this[u+j]=(c/K>>0)-ht&255;return u+d},o.prototype.writeInt8=function(c,u,d){return c=+c,u=u>>>0,d||Ft(this,c,u,1,127,-128),c<0&&(c=255+c+1),this[u]=c&255,u+1},o.prototype.writeInt16LE=function(c,u,d){return c=+c,u=u>>>0,d||Ft(this,c,u,2,32767,-32768),this[u]=c&255,this[u+1]=c>>>8,u+2},o.prototype.writeInt16BE=function(c,u,d){return c=+c,u=u>>>0,d||Ft(this,c,u,2,32767,-32768),this[u]=c>>>8,this[u+1]=c&255,u+2},o.prototype.writeInt32LE=function(c,u,d){return c=+c,u=u>>>0,d||Ft(this,c,u,4,2147483647,-2147483648),this[u]=c&255,this[u+1]=c>>>8,this[u+2]=c>>>16,this[u+3]=c>>>24,u+4},o.prototype.writeInt32BE=function(c,u,d){return c=+c,u=u>>>0,d||Ft(this,c,u,4,2147483647,-2147483648),c<0&&(c=4294967295+c+1),this[u]=c>>>24,this[u+1]=c>>>16,this[u+2]=c>>>8,this[u+3]=c&255,u+4};function li(c,u,d,S,N,j){if(d+S>c.length)throw new RangeError("Index out of range");if(d<0)throw new RangeError("Index out of range")}function ui(c,u,d,S,N){return u=+u,d=d>>>0,N||li(c,u,d,4),Br.write(c,u,d,S,23,4),d+4}o.prototype.writeFloatLE=function(c,u,d){return ui(this,c,u,!0,d)},o.prototype.writeFloatBE=function(c,u,d){return ui(this,c,u,!1,d)};function ce(c,u,d,S,N){return u=+u,d=d>>>0,N||li(c,u,d,8),Br.write(c,u,d,S,52,8),d+8}o.prototype.writeDoubleLE=function(c,u,d){return ce(this,c,u,!0,d)},o.prototype.writeDoubleBE=function(c,u,d){return ce(this,c,u,!1,d)},o.prototype.copy=function(c,u,d,S){if(!o.isBuffer(c))throw new TypeError("argument should be a Buffer");if(d||(d=0),!S&&S!==0&&(S=this.length),u>=c.length&&(u=c.length),u||(u=0),S>0&&S<d&&(S=d),S===d||c.length===0||this.length===0)return 0;if(u<0)throw new RangeError("targetStart out of bounds");if(d<0||d>=this.length)throw new RangeError("Index out of range");if(S<0)throw new RangeError("sourceEnd out of bounds");S>this.length&&(S=this.length),c.length-u<S-d&&(S=c.length-u+d);var N=S-d;return this===c&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(u,d,S):Uint8Array.prototype.set.call(c,this.subarray(d,S),u),N},o.prototype.fill=function(c,u,d,S){if(typeof c=="string"){if(typeof u=="string"?(S=u,u=0,d=this.length):typeof d=="string"&&(S=d,d=this.length),S!==void 0&&typeof S!="string")throw new TypeError("encoding must be a string");if(typeof S=="string"&&!o.isEncoding(S))throw new TypeError("Unknown encoding: "+S);if(c.length===1){var N=c.charCodeAt(0);(S==="utf8"&&N<128||S==="latin1")&&(c=N)}}else typeof c=="number"?c=c&255:typeof c=="boolean"&&(c=Number(c));if(u<0||this.length<u||this.length<d)throw new RangeError("Out of range index");if(d<=u)return this;u=u>>>0,d=d===void 0?this.length:d>>>0,c||(c=0);var j;if(typeof c=="number")for(j=u;j<d;++j)this[j]=c;else{var K=o.isBuffer(c)?c:o.from(c,S),ht=K.length;if(ht===0)throw new TypeError('The value "'+c+'" is invalid for argument "value"');for(j=0;j<d-u;++j)this[j+u]=K[j%ht]}return this};var hi=/[^+/0-9A-Za-z-_]/g;function _s(c){if(c=c.split("=")[0],c=c.trim().replace(hi,""),c.length<2)return"";for(;c.length%4!==0;)c=c+"=";return c}function gn(c,u){u=u||1/0;for(var d,S=c.length,N=null,j=[],K=0;K<S;++K){if(d=c.charCodeAt(K),d>55295&&d<57344){if(!N){if(d>56319){(u-=3)>-1&&j.push(239,191,189);continue}else if(K+1===S){(u-=3)>-1&&j.push(239,191,189);continue}N=d;continue}if(d<56320){(u-=3)>-1&&j.push(239,191,189),N=d;continue}d=(N-55296<<10|d-56320)+65536}else N&&(u-=3)>-1&&j.push(239,191,189);if(N=null,d<128){if((u-=1)<0)break;j.push(d)}else if(d<2048){if((u-=2)<0)break;j.push(d>>6|192,d&63|128)}else if(d<65536){if((u-=3)<0)break;j.push(d>>12|224,d>>6&63|128,d&63|128)}else if(d<1114112){if((u-=4)<0)break;j.push(d>>18|240,d>>12&63|128,d>>6&63|128,d&63|128)}else throw new Error("Invalid code point")}return j}function Es(c){for(var u=[],d=0;d<c.length;++d)u.push(c.charCodeAt(d)&255);return u}function Ss(c,u){for(var d,S,N,j=[],K=0;K<c.length&&!((u-=2)<0);++K)d=c.charCodeAt(K),S=d>>8,N=d%256,j.push(N),j.push(S);return j}function pi(c){return js.toByteArray(_s(c))}function Ur(c,u,d,S){for(var N=0;N<S&&!(N+d>=u.length||N>=c.length);++N)u[N+d]=c[N];return N}function le(c,u){return c instanceof u||c!=null&&c.constructor!=null&&c.constructor.name!=null&&c.constructor.name===u.name}function mn(c){return c!==c}var Is=function(){for(var c="0123456789abcdef",u=new Array(256),d=0;d<16;++d)for(var S=d*16,N=0;N<16;++N)u[S+N]=c[d]+c[N];return u}()}),ut=hs.Buffer;hs.SlowBuffer;hs.INSPECT_MAX_BYTES;hs.kMaxLength;var Bo=function(t,e){return Bo=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},Bo(t,e)};function ps(t,e){Bo(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var Er=function(t){ps(e,t);function e(r){var n=t.call(this,r)||this;return Object.setPrototypeOf(n,e.prototype),n}return Object.defineProperty(e.prototype,"name",{get:function(){return"BSONError"},enumerable:!1,configurable:!0}),e}(Error),At=function(t){ps(e,t);function e(r){var n=t.call(this,r)||this;return Object.setPrototypeOf(n,e.prototype),n}return Object.defineProperty(e.prototype,"name",{get:function(){return"BSONTypeError"},enumerable:!1,configurable:!0}),e}(TypeError);function Ii(t){return t&&t.Math==Math&&t}function kh(){return Ii(typeof globalThis=="object"&&globalThis)||Ii(typeof window=="object"&&window)||Ii(typeof self=="object"&&self)||Ii(typeof global=="object"&&global)||Function("return this")()}function Iw(){var t=kh();return typeof t.navigator=="object"&&t.navigator.product==="ReactNative"}var Cw=function(t){var e=Iw()?"BSON: For React Native please polyfill crypto.getRandomValues, e.g. using: https://www.npmjs.com/package/react-native-get-random-values.":"BSON: No cryptographic implementation for random bytes present, falling back to a less secure implementation.";console.warn(e);for(var r=ut.alloc(t),n=0;n<t;++n)r[n]=Math.floor(Math.random()*256);return r},Tw=function(){{if(typeof window<"u"){var t=window.crypto||window.msCrypto;if(t&&t.getRandomValues)return function(e){return t.getRandomValues(ut.alloc(e))}}return typeof global<"u"&&global.crypto&&global.crypto.getRandomValues?function(e){return global.crypto.getRandomValues(ut.alloc(e))}:Cw}},Rh=Tw();function xw(t){return["[object ArrayBuffer]","[object SharedArrayBuffer]"].includes(Object.prototype.toString.call(t))}function Ua(t){return Object.prototype.toString.call(t)==="[object Uint8Array]"}function Dw(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Nw(t){return si(t)&&Object.prototype.toString.call(t)==="[object Date]"}function si(t){return typeof t=="object"&&t!==null}function ds(t,e){var r=!1;function n(){for(var i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];return r||(console.warn(e),r=!0),t.apply(this,i)}return n}function zi(t){if(ArrayBuffer.isView(t))return ut.from(t.buffer,t.byteOffset,t.byteLength);if(xw(t))return ut.from(t);throw new At("Must use either Buffer or TypedArray")}var Aw=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|[0-9a-f]{12}4[0-9a-f]{3}[89ab][0-9a-f]{15})$/i,Lh=function(t){return typeof t=="string"&&Aw.test(t)},jo=function(t){if(!Lh(t))throw new At('UUID string representations must be a 32 or 36 character hex string (dashes excluded/included). Format: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" or "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".');var e=t.replace(/-/g,"");return ut.from(e,"hex")},xl=function(t,e){return e===void 0&&(e=!0),e?t.toString("hex",0,4)+"-"+t.toString("hex",4,6)+"-"+t.toString("hex",6,8)+"-"+t.toString("hex",8,10)+"-"+t.toString("hex",10,16):t.toString("hex")},DE=Math.pow(2,63)-1,NE=-Math.pow(2,63),Ow=Math.pow(2,53),Pw=-Math.pow(2,53),Uh=4,Sr=function(){function t(e,r){if(!(this instanceof t))return new t(e,r);if(e!=null&&typeof e!="string"&&!ArrayBuffer.isView(e)&&!(e instanceof ArrayBuffer)&&!Array.isArray(e))throw new At("Binary can only be constructed from string, Buffer, TypedArray, or Array<number>");this.sub_type=r??t.BSON_BINARY_SUBTYPE_DEFAULT,e==null?(this.buffer=ut.alloc(t.BUFFER_SIZE),this.position=0):(typeof e=="string"?this.buffer=ut.from(e,"binary"):Array.isArray(e)?this.buffer=ut.from(e):this.buffer=zi(e),this.position=this.buffer.byteLength)}return t.prototype.put=function(e){if(typeof e=="string"&&e.length!==1)throw new At("only accepts single character String");if(typeof e!="number"&&e.length!==1)throw new At("only accepts single character Uint8Array or Array");var r;if(typeof e=="string"?r=e.charCodeAt(0):typeof e=="number"?r=e:r=e[0],r<0||r>255)throw new At("only accepts number in a valid unsigned byte range 0-255");if(this.buffer.length>this.position)this.buffer[this.position++]=r;else{var n=ut.alloc(t.BUFFER_SIZE+this.buffer.length);this.buffer.copy(n,0,0,this.buffer.length),this.buffer=n,this.buffer[this.position++]=r}},t.prototype.write=function(e,r){if(r=typeof r=="number"?r:this.position,this.buffer.length<r+e.length){var n=ut.alloc(this.buffer.length+e.length);this.buffer.copy(n,0,0,this.buffer.length),this.buffer=n}ArrayBuffer.isView(e)?(this.buffer.set(zi(e),r),this.position=r+e.byteLength>this.position?r+e.length:this.position):typeof e=="string"&&(this.buffer.write(e,r,e.length,"binary"),this.position=r+e.length>this.position?r+e.length:this.position)},t.prototype.read=function(e,r){return r=r&&r>0?r:this.position,this.buffer.slice(e,e+r)},t.prototype.value=function(e){return e=!!e,e&&this.buffer.length===this.position?this.buffer:e?this.buffer.slice(0,this.position):this.buffer.toString("binary",0,this.position)},t.prototype.length=function(){return this.position},t.prototype.toJSON=function(){return this.buffer.toString("base64")},t.prototype.toString=function(e){return this.buffer.toString(e)},t.prototype.toExtendedJSON=function(e){e=e||{};var r=this.buffer.toString("base64"),n=Number(this.sub_type).toString(16);return e.legacy?{$binary:r,$type:n.length===1?"0"+n:n}:{$binary:{base64:r,subType:n.length===1?"0"+n:n}}},t.prototype.toUUID=function(){if(this.sub_type===t.SUBTYPE_UUID)return new Dl(this.buffer.slice(0,this.position));throw new Er('Binary sub_type "'.concat(this.sub_type,'" is not supported for converting to UUID. Only "').concat(t.SUBTYPE_UUID,'" is currently supported.'))},t.fromExtendedJSON=function(e,r){r=r||{};var n,i;if("$binary"in e?r.legacy&&typeof e.$binary=="string"&&"$type"in e?(i=e.$type?parseInt(e.$type,16):0,n=ut.from(e.$binary,"base64")):typeof e.$binary!="string"&&(i=e.$binary.subType?parseInt(e.$binary.subType,16):0,n=ut.from(e.$binary.base64,"base64")):"$uuid"in e&&(i=4,n=jo(e.$uuid)),!n)throw new At("Unexpected Binary Extended JSON format ".concat(JSON.stringify(e)));return i===Uh?new Dl(n):new t(n,i)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var e=this.value(!0);return'new Binary(Buffer.from("'.concat(e.toString("hex"),'", "hex"), ').concat(this.sub_type,")")},t.BSON_BINARY_SUBTYPE_DEFAULT=0,t.BUFFER_SIZE=256,t.SUBTYPE_DEFAULT=0,t.SUBTYPE_FUNCTION=1,t.SUBTYPE_BYTE_ARRAY=2,t.SUBTYPE_UUID_OLD=3,t.SUBTYPE_UUID=4,t.SUBTYPE_MD5=5,t.SUBTYPE_ENCRYPTED=6,t.SUBTYPE_COLUMN=7,t.SUBTYPE_USER_DEFINED=128,t}();Object.defineProperty(Sr.prototype,"_bsontype",{value:"Binary"});var $s=16,Dl=function(t){ps(e,t);function e(r){var n=this,i,s;if(r==null)i=e.generate();else if(r instanceof e)i=ut.from(r.buffer),s=r.__id;else if(ArrayBuffer.isView(r)&&r.byteLength===$s)i=zi(r);else if(typeof r=="string")i=jo(r);else throw new At("Argument passed in UUID constructor must be a UUID, a 16 byte Buffer or a 32/36 character hex string (dashes excluded/included, format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).");return n=t.call(this,i,Uh)||this,n.__id=s,n}return Object.defineProperty(e.prototype,"id",{get:function(){return this.buffer},set:function(r){this.buffer=r,e.cacheHexString&&(this.__id=xl(r))},enumerable:!1,configurable:!0}),e.prototype.toHexString=function(r){if(r===void 0&&(r=!0),e.cacheHexString&&this.__id)return this.__id;var n=xl(this.id,r);return e.cacheHexString&&(this.__id=n),n},e.prototype.toString=function(r){return r?this.id.toString(r):this.toHexString()},e.prototype.toJSON=function(){return this.toHexString()},e.prototype.equals=function(r){if(!r)return!1;if(r instanceof e)return r.id.equals(this.id);try{return new e(r).id.equals(this.id)}catch{return!1}},e.prototype.toBinary=function(){return new Sr(this.id,Sr.SUBTYPE_UUID)},e.generate=function(){var r=Rh($s);return r[6]=r[6]&15|64,r[8]=r[8]&63|128,ut.from(r)},e.isValid=function(r){return r?r instanceof e?!0:typeof r=="string"?Lh(r):Ua(r)?r.length!==$s?!1:(r[6]&240)===64&&(r[8]&128)===128:!1:!1},e.createFromHexString=function(r){var n=jo(r);return new e(n)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return'new UUID("'.concat(this.toHexString(),'")')},e}(Sr),fs=function(){function t(e,r){if(!(this instanceof t))return new t(e,r);this.code=e,this.scope=r}return t.prototype.toJSON=function(){return{code:this.code,scope:this.scope}},t.prototype.toExtendedJSON=function(){return this.scope?{$code:this.code,$scope:this.scope}:{$code:this.code}},t.fromExtendedJSON=function(e){return new t(e.$code,e.$scope)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var e=this.toJSON();return'new Code("'.concat(String(e.code),'"').concat(e.scope?", ".concat(JSON.stringify(e.scope)):"",")")},t}();Object.defineProperty(fs.prototype,"_bsontype",{value:"Code"});function kw(t){return si(t)&&t.$id!=null&&typeof t.$ref=="string"&&(t.$db==null||typeof t.$db=="string")}var zn=function(){function t(e,r,n,i){if(!(this instanceof t))return new t(e,r,n,i);var s=e.split(".");s.length===2&&(n=s.shift(),e=s.shift()),this.collection=e,this.oid=r,this.db=n,this.fields=i||{}}return Object.defineProperty(t.prototype,"namespace",{get:function(){return this.collection},set:function(e){this.collection=e},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){var e=Object.assign({$ref:this.collection,$id:this.oid},this.fields);return this.db!=null&&(e.$db=this.db),e},t.prototype.toExtendedJSON=function(e){e=e||{};var r={$ref:this.collection,$id:this.oid};return e.legacy||(this.db&&(r.$db=this.db),r=Object.assign(r,this.fields)),r},t.fromExtendedJSON=function(e){var r=Object.assign({},e);return delete r.$ref,delete r.$id,delete r.$db,new t(e.$ref,e.$id,e.$db,r)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var e=this.oid===void 0||this.oid.toString===void 0?this.oid:this.oid.toString();return'new DBRef("'.concat(this.namespace,'", new ObjectId("').concat(String(e),'")').concat(this.db?', "'.concat(this.db,'"'):"",")")},t}();Object.defineProperty(zn.prototype,"_bsontype",{value:"DBRef"});var he=void 0;try{he=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}var Nl=65536,Rw=1<<24,Wr=Nl*Nl,Mh=Wr*Wr,Al=Mh/2,Ol={},Pl={},J=function(){function t(e,r,n){if(e===void 0&&(e=0),!(this instanceof t))return new t(e,r,n);typeof e=="bigint"?Object.assign(this,t.fromBigInt(e,!!r)):typeof e=="string"?Object.assign(this,t.fromString(e,!!r)):(this.low=e|0,this.high=r|0,this.unsigned=!!n),Object.defineProperty(this,"__isLong__",{value:!0,configurable:!1,writable:!1,enumerable:!1})}return t.fromBits=function(e,r,n){return new t(e,r,n)},t.fromInt=function(e,r){var n,i,s;return r?(e>>>=0,(s=0<=e&&e<256)&&(i=Pl[e],i)?i:(n=t.fromBits(e,(e|0)<0?-1:0,!0),s&&(Pl[e]=n),n)):(e|=0,(s=-128<=e&&e<128)&&(i=Ol[e],i)?i:(n=t.fromBits(e,e<0?-1:0,!1),s&&(Ol[e]=n),n))},t.fromNumber=function(e,r){if(isNaN(e))return r?t.UZERO:t.ZERO;if(r){if(e<0)return t.UZERO;if(e>=Mh)return t.MAX_UNSIGNED_VALUE}else{if(e<=-Al)return t.MIN_VALUE;if(e+1>=Al)return t.MAX_VALUE}return e<0?t.fromNumber(-e,r).neg():t.fromBits(e%Wr|0,e/Wr|0,r)},t.fromBigInt=function(e,r){return t.fromString(e.toString(),r)},t.fromString=function(e,r,n){if(e.length===0)throw Error("empty string");if(e==="NaN"||e==="Infinity"||e==="+Infinity"||e==="-Infinity")return t.ZERO;if(typeof r=="number"?(n=r,r=!1):r=!!r,n=n||10,n<2||36<n)throw RangeError("radix");var i;if((i=e.indexOf("-"))>0)throw Error("interior hyphen");if(i===0)return t.fromString(e.substring(1),r,n).neg();for(var s=t.fromNumber(Math.pow(n,8)),o=t.ZERO,a=0;a<e.length;a+=8){var l=Math.min(8,e.length-a),h=parseInt(e.substring(a,a+l),n);if(l<8){var g=t.fromNumber(Math.pow(n,l));o=o.mul(g).add(t.fromNumber(h))}else o=o.mul(s),o=o.add(t.fromNumber(h))}return o.unsigned=r,o},t.fromBytes=function(e,r,n){return n?t.fromBytesLE(e,r):t.fromBytesBE(e,r)},t.fromBytesLE=function(e,r){return new t(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,r)},t.fromBytesBE=function(e,r){return new t(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],r)},t.isLong=function(e){return si(e)&&e.__isLong__===!0},t.fromValue=function(e,r){return typeof e=="number"?t.fromNumber(e,r):typeof e=="string"?t.fromString(e,r):t.fromBits(e.low,e.high,typeof r=="boolean"?r:e.unsigned)},t.prototype.add=function(e){t.isLong(e)||(e=t.fromValue(e));var r=this.high>>>16,n=this.high&65535,i=this.low>>>16,s=this.low&65535,o=e.high>>>16,a=e.high&65535,l=e.low>>>16,h=e.low&65535,g=0,p=0,_=0,w=0;return w+=s+h,_+=w>>>16,w&=65535,_+=i+l,p+=_>>>16,_&=65535,p+=n+a,g+=p>>>16,p&=65535,g+=r+o,g&=65535,t.fromBits(_<<16|w,g<<16|p,this.unsigned)},t.prototype.and=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low&e.low,this.high&e.high,this.unsigned)},t.prototype.compare=function(e){if(t.isLong(e)||(e=t.fromValue(e)),this.eq(e))return 0;var r=this.isNegative(),n=e.isNegative();return r&&!n?-1:!r&&n?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},t.prototype.comp=function(e){return this.compare(e)},t.prototype.divide=function(e){if(t.isLong(e)||(e=t.fromValue(e)),e.isZero())throw Error("division by zero");if(he){if(!this.unsigned&&this.high===-2147483648&&e.low===-1&&e.high===-1)return this;var r=(this.unsigned?he.div_u:he.div_s)(this.low,this.high,e.low,e.high);return t.fromBits(r,he.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?t.UZERO:t.ZERO;var n,i,s;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return t.UZERO;if(e.gt(this.shru(1)))return t.UONE;s=t.UZERO}else{if(this.eq(t.MIN_VALUE)){if(e.eq(t.ONE)||e.eq(t.NEG_ONE))return t.MIN_VALUE;if(e.eq(t.MIN_VALUE))return t.ONE;var o=this.shr(1);return n=o.div(e).shl(1),n.eq(t.ZERO)?e.isNegative()?t.ONE:t.NEG_ONE:(i=this.sub(e.mul(n)),s=n.add(i.div(e)),s)}else if(e.eq(t.MIN_VALUE))return this.unsigned?t.UZERO:t.ZERO;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();s=t.ZERO}for(i=this;i.gte(e);){n=Math.max(1,Math.floor(i.toNumber()/e.toNumber()));for(var a=Math.ceil(Math.log(n)/Math.LN2),l=a<=48?1:Math.pow(2,a-48),h=t.fromNumber(n),g=h.mul(e);g.isNegative()||g.gt(i);)n-=l,h=t.fromNumber(n,this.unsigned),g=h.mul(e);h.isZero()&&(h=t.ONE),s=s.add(h),i=i.sub(g)}return s},t.prototype.div=function(e){return this.divide(e)},t.prototype.equals=function(e){return t.isLong(e)||(e=t.fromValue(e)),this.unsigned!==e.unsigned&&this.high>>>31===1&&e.high>>>31===1?!1:this.high===e.high&&this.low===e.low},t.prototype.eq=function(e){return this.equals(e)},t.prototype.getHighBits=function(){return this.high},t.prototype.getHighBitsUnsigned=function(){return this.high>>>0},t.prototype.getLowBits=function(){return this.low},t.prototype.getLowBitsUnsigned=function(){return this.low>>>0},t.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.eq(t.MIN_VALUE)?64:this.neg().getNumBitsAbs();var e=this.high!==0?this.high:this.low,r;for(r=31;r>0&&(e&1<<r)===0;r--);return this.high!==0?r+33:r+1},t.prototype.greaterThan=function(e){return this.comp(e)>0},t.prototype.gt=function(e){return this.greaterThan(e)},t.prototype.greaterThanOrEqual=function(e){return this.comp(e)>=0},t.prototype.gte=function(e){return this.greaterThanOrEqual(e)},t.prototype.ge=function(e){return this.greaterThanOrEqual(e)},t.prototype.isEven=function(){return(this.low&1)===0},t.prototype.isNegative=function(){return!this.unsigned&&this.high<0},t.prototype.isOdd=function(){return(this.low&1)===1},t.prototype.isPositive=function(){return this.unsigned||this.high>=0},t.prototype.isZero=function(){return this.high===0&&this.low===0},t.prototype.lessThan=function(e){return this.comp(e)<0},t.prototype.lt=function(e){return this.lessThan(e)},t.prototype.lessThanOrEqual=function(e){return this.comp(e)<=0},t.prototype.lte=function(e){return this.lessThanOrEqual(e)},t.prototype.modulo=function(e){if(t.isLong(e)||(e=t.fromValue(e)),he){var r=(this.unsigned?he.rem_u:he.rem_s)(this.low,this.high,e.low,e.high);return t.fromBits(r,he.get_high(),this.unsigned)}return this.sub(this.div(e).mul(e))},t.prototype.mod=function(e){return this.modulo(e)},t.prototype.rem=function(e){return this.modulo(e)},t.prototype.multiply=function(e){if(this.isZero())return t.ZERO;if(t.isLong(e)||(e=t.fromValue(e)),he){var r=he.mul(this.low,this.high,e.low,e.high);return t.fromBits(r,he.get_high(),this.unsigned)}if(e.isZero())return t.ZERO;if(this.eq(t.MIN_VALUE))return e.isOdd()?t.MIN_VALUE:t.ZERO;if(e.eq(t.MIN_VALUE))return this.isOdd()?t.MIN_VALUE:t.ZERO;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(t.TWO_PWR_24)&&e.lt(t.TWO_PWR_24))return t.fromNumber(this.toNumber()*e.toNumber(),this.unsigned);var n=this.high>>>16,i=this.high&65535,s=this.low>>>16,o=this.low&65535,a=e.high>>>16,l=e.high&65535,h=e.low>>>16,g=e.low&65535,p=0,_=0,w=0,b=0;return b+=o*g,w+=b>>>16,b&=65535,w+=s*g,_+=w>>>16,w&=65535,w+=o*h,_+=w>>>16,w&=65535,_+=i*g,p+=_>>>16,_&=65535,_+=s*h,p+=_>>>16,_&=65535,_+=o*l,p+=_>>>16,_&=65535,p+=n*g+i*h+s*l+o*a,p&=65535,t.fromBits(w<<16|b,p<<16|_,this.unsigned)},t.prototype.mul=function(e){return this.multiply(e)},t.prototype.negate=function(){return!this.unsigned&&this.eq(t.MIN_VALUE)?t.MIN_VALUE:this.not().add(t.ONE)},t.prototype.neg=function(){return this.negate()},t.prototype.not=function(){return t.fromBits(~this.low,~this.high,this.unsigned)},t.prototype.notEquals=function(e){return!this.equals(e)},t.prototype.neq=function(e){return this.notEquals(e)},t.prototype.ne=function(e){return this.notEquals(e)},t.prototype.or=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low|e.low,this.high|e.high,this.unsigned)},t.prototype.shiftLeft=function(e){return t.isLong(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?t.fromBits(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):t.fromBits(0,this.low<<e-32,this.unsigned)},t.prototype.shl=function(e){return this.shiftLeft(e)},t.prototype.shiftRight=function(e){return t.isLong(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?t.fromBits(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):t.fromBits(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},t.prototype.shr=function(e){return this.shiftRight(e)},t.prototype.shiftRightUnsigned=function(e){if(t.isLong(e)&&(e=e.toInt()),e&=63,e===0)return this;var r=this.high;if(e<32){var n=this.low;return t.fromBits(n>>>e|r<<32-e,r>>>e,this.unsigned)}else return e===32?t.fromBits(r,0,this.unsigned):t.fromBits(r>>>e-32,0,this.unsigned)},t.prototype.shr_u=function(e){return this.shiftRightUnsigned(e)},t.prototype.shru=function(e){return this.shiftRightUnsigned(e)},t.prototype.subtract=function(e){return t.isLong(e)||(e=t.fromValue(e)),this.add(e.neg())},t.prototype.sub=function(e){return this.subtract(e)},t.prototype.toInt=function(){return this.unsigned?this.low>>>0:this.low},t.prototype.toNumber=function(){return this.unsigned?(this.high>>>0)*Wr+(this.low>>>0):this.high*Wr+(this.low>>>0)},t.prototype.toBigInt=function(){return BigInt(this.toString())},t.prototype.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},t.prototype.toBytesLE=function(){var e=this.high,r=this.low;return[r&255,r>>>8&255,r>>>16&255,r>>>24,e&255,e>>>8&255,e>>>16&255,e>>>24]},t.prototype.toBytesBE=function(){var e=this.high,r=this.low;return[e>>>24,e>>>16&255,e>>>8&255,e&255,r>>>24,r>>>16&255,r>>>8&255,r&255]},t.prototype.toSigned=function(){return this.unsigned?t.fromBits(this.low,this.high,!1):this},t.prototype.toString=function(e){if(e=e||10,e<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(t.MIN_VALUE)){var r=t.fromNumber(e),n=this.div(r),i=n.mul(r).sub(this);return n.toString(e)+i.toInt().toString(e)}else return"-"+this.neg().toString(e);for(var s=t.fromNumber(Math.pow(e,6),this.unsigned),o=this,a="";;){var l=o.div(s),h=o.sub(l.mul(s)).toInt()>>>0,g=h.toString(e);if(o=l,o.isZero())return g+a;for(;g.length<6;)g="0"+g;a=""+g+a}},t.prototype.toUnsigned=function(){return this.unsigned?this:t.fromBits(this.low,this.high,!0)},t.prototype.xor=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low^e.low,this.high^e.high,this.unsigned)},t.prototype.eqz=function(){return this.isZero()},t.prototype.le=function(e){return this.lessThanOrEqual(e)},t.prototype.toExtendedJSON=function(e){return e&&e.relaxed?this.toNumber():{$numberLong:this.toString()}},t.fromExtendedJSON=function(e,r){var n=t.fromString(e.$numberLong);return r&&r.relaxed?n.toNumber():n},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new Long("'.concat(this.toString(),'"').concat(this.unsigned?", true":"",")")},t.TWO_PWR_24=t.fromInt(Rw),t.MAX_UNSIGNED_VALUE=t.fromBits(-1,-1,!0),t.ZERO=t.fromInt(0),t.UZERO=t.fromInt(0,!0),t.ONE=t.fromInt(1),t.UONE=t.fromInt(1,!0),t.NEG_ONE=t.fromInt(-1),t.MAX_VALUE=t.fromBits(-1,2147483647,!1),t.MIN_VALUE=t.fromBits(0,-2147483648,!1),t}();Object.defineProperty(J.prototype,"__isLong__",{value:!0});Object.defineProperty(J.prototype,"_bsontype",{value:"Long"});var Lw=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,Uw=/^(\+|-)?(Infinity|inf)$/i,Mw=/^(\+|-)?NaN$/i,_n=6111,Fs=-6176,kl=6176,Bw=34,Hs=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Rl=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Ll=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),jw=/^([-+])?(\d+)?$/,$w=31,Ul=16383,Fw=30,Hw=31;function Ml(t){return!isNaN(parseInt(t,10))}function Vw(t){var e=J.fromNumber(1e9),r=J.fromNumber(0);if(!t.parts[0]&&!t.parts[1]&&!t.parts[2]&&!t.parts[3])return{quotient:t,rem:r};for(var n=0;n<=3;n++)r=r.shiftLeft(32),r=r.add(new J(t.parts[n],0)),t.parts[n]=r.div(e).low,r=r.modulo(e);return{quotient:t,rem:r}}function Ww(t,e){if(!t&&!e)return{high:J.fromNumber(0),low:J.fromNumber(0)};var r=t.shiftRightUnsigned(32),n=new J(t.getLowBits(),0),i=e.shiftRightUnsigned(32),s=new J(e.getLowBits(),0),o=r.multiply(i),a=r.multiply(s),l=n.multiply(i),h=n.multiply(s);return o=o.add(a.shiftRightUnsigned(32)),a=new J(a.getLowBits(),0).add(l).add(h.shiftRightUnsigned(32)),o=o.add(a.shiftRightUnsigned(32)),h=a.shiftLeft(32).add(new J(h.getLowBits(),0)),{high:o,low:h}}function Gw(t,e){var r=t.high>>>0,n=e.high>>>0;if(r<n)return!0;if(r===n){var i=t.low>>>0,s=e.low>>>0;if(i<s)return!0}return!1}function jr(t,e){throw new At('"'.concat(t,'" is not a valid Decimal128 string - ').concat(e))}var Ma=function(){function t(e){if(!(this instanceof t))return new t(e);if(typeof e=="string")this.bytes=t.fromString(e).bytes;else if(Ua(e)){if(e.byteLength!==16)throw new At("Decimal128 must take a Buffer of 16 bytes");this.bytes=e}else throw new At("Decimal128 must take a Buffer or string")}return t.fromString=function(e){var r=!1,n=!1,i=!1,s=0,o=0,a=0,l=0,h=0,g=[0],p=0,_=0,w=0,b=0,E=0,k=0,A=new J(0,0),M=new J(0,0),z=0,B=0;if(e.length>=7e3)throw new At(""+e+" not a valid Decimal128 string");var X=e.match(Lw),bt=e.match(Uw),It=e.match(Mw);if(!X&&!bt&&!It||e.length===0)throw new At(""+e+" not a valid Decimal128 string");if(X){var H=X[2],rt=X[4],Z=X[5],tt=X[6];rt&&tt===void 0&&jr(e,"missing exponent power"),rt&&H===void 0&&jr(e,"missing exponent base"),rt===void 0&&(Z||tt)&&jr(e,"missing e before exponent")}if((e[B]==="+"||e[B]==="-")&&(r=e[B++]==="-"),!Ml(e[B])&&e[B]!=="."){if(e[B]==="i"||e[B]==="I")return new t(ut.from(r?Rl:Ll));if(e[B]==="N")return new t(ut.from(Hs))}for(;Ml(e[B])||e[B]===".";){if(e[B]==="."){n&&jr(e,"contains multiple periods"),n=!0,B=B+1;continue}p<34&&(e[B]!=="0"||i)&&(i||(h=o),i=!0,g[_++]=parseInt(e[B],10),p=p+1),i&&(a=a+1),n&&(l=l+1),o=o+1,B=B+1}if(n&&!o)throw new At(""+e+" not a valid Decimal128 string");if(e[B]==="e"||e[B]==="E"){var ct=e.substr(++B).match(jw);if(!ct||!ct[2])return new t(ut.from(Hs));E=parseInt(ct[0],10),B=B+ct[0].length}if(e[B])return new t(ut.from(Hs));if(w=0,!p)w=0,b=0,g[0]=0,a=1,p=1,s=0;else if(b=p-1,s=a,s!==1)for(;g[h+s-1]===0;)s=s-1;for(E<=l&&l-E>16384?E=Fs:E=E-l;E>_n;){if(b=b+1,b-w>Bw){var Tt=g.join("");if(Tt.match(/^0+$/)){E=_n;break}jr(e,"overflow")}E=E-1}for(;E<Fs||p<a;){if(b===0&&s<p){E=Fs,s=0;break}if(p<a?a=a-1:b=b-1,E<_n)E=E+1;else{var Tt=g.join("");if(Tt.match(/^0+$/)){E=_n;break}jr(e,"overflow")}}if(b-w+1<s){var m=o;n&&(h=h+1,m=m+1),r&&(h=h+1,m=m+1);var $t=parseInt(e[h+b+1],10),qt=0;if($t>=5&&(qt=1,$t===5)){for(qt=g[b]%2===1?1:0,k=h+b+2;k<m;k++)if(parseInt(e[k],10)){qt=1;break}}if(qt){for(var mt=b;mt>=0;mt--)if(++g[mt]>9&&(g[mt]=0,mt===0))if(E<_n)E=E+1,g[mt]=1;else return new t(ut.from(r?Rl:Ll))}}if(A=J.fromNumber(0),M=J.fromNumber(0),s===0)A=J.fromNumber(0),M=J.fromNumber(0);else if(b-w<17){var mt=w;for(M=J.fromNumber(g[mt++]),A=new J(0,0);mt<=b;mt++)M=M.multiply(J.fromNumber(10)),M=M.add(J.fromNumber(g[mt]))}else{var mt=w;for(A=J.fromNumber(g[mt++]);mt<=b-17;mt++)A=A.multiply(J.fromNumber(10)),A=A.add(J.fromNumber(g[mt]));for(M=J.fromNumber(g[mt++]);mt<=b;mt++)M=M.multiply(J.fromNumber(10)),M=M.add(J.fromNumber(g[mt]))}var zt=Ww(A,J.fromString("100000000000000000"));zt.low=zt.low.add(M),Gw(zt.low,M)&&(zt.high=zt.high.add(J.fromNumber(1))),z=E+kl;var ot={low:J.fromNumber(0),high:J.fromNumber(0)};zt.high.shiftRightUnsigned(49).and(J.fromNumber(1)).equals(J.fromNumber(1))?(ot.high=ot.high.or(J.fromNumber(3).shiftLeft(61)),ot.high=ot.high.or(J.fromNumber(z).and(J.fromNumber(16383).shiftLeft(47))),ot.high=ot.high.or(zt.high.and(J.fromNumber(0x7fffffffffff)))):(ot.high=ot.high.or(J.fromNumber(z&16383).shiftLeft(49)),ot.high=ot.high.or(zt.high.and(J.fromNumber(562949953421311)))),ot.low=zt.low,r&&(ot.high=ot.high.or(J.fromString("9223372036854775808")));var nt=ut.alloc(16);return B=0,nt[B++]=ot.low.low&255,nt[B++]=ot.low.low>>8&255,nt[B++]=ot.low.low>>16&255,nt[B++]=ot.low.low>>24&255,nt[B++]=ot.low.high&255,nt[B++]=ot.low.high>>8&255,nt[B++]=ot.low.high>>16&255,nt[B++]=ot.low.high>>24&255,nt[B++]=ot.high.low&255,nt[B++]=ot.high.low>>8&255,nt[B++]=ot.high.low>>16&255,nt[B++]=ot.high.low>>24&255,nt[B++]=ot.high.high&255,nt[B++]=ot.high.high>>8&255,nt[B++]=ot.high.high>>16&255,nt[B++]=ot.high.high>>24&255,new t(nt)},t.prototype.toString=function(){for(var e,r=0,n=new Array(36),i=0;i<n.length;i++)n[i]=0;var s=0,o=!1,a,l={parts:[0,0,0,0]},h,g,p=[];s=0;var _=this.bytes,w=_[s++]|_[s++]<<8|_[s++]<<16|_[s++]<<24,b=_[s++]|_[s++]<<8|_[s++]<<16|_[s++]<<24,E=_[s++]|_[s++]<<8|_[s++]<<16|_[s++]<<24,k=_[s++]|_[s++]<<8|_[s++]<<16|_[s++]<<24;s=0;var A={low:new J(w,b),high:new J(E,k)};A.high.lessThan(J.ZERO)&&p.push("-");var M=k>>26&$w;if(M>>3===3){if(M===Fw)return p.join("")+"Infinity";if(M===Hw)return"NaN";e=k>>15&Ul,a=8+(k>>14&1)}else a=k>>14&7,e=k>>17&Ul;var z=e-kl;if(l.parts[0]=(k&16383)+((a&15)<<14),l.parts[1]=E,l.parts[2]=b,l.parts[3]=w,l.parts[0]===0&&l.parts[1]===0&&l.parts[2]===0&&l.parts[3]===0)o=!0;else for(g=3;g>=0;g--){var B=0,X=Vw(l);if(l=X.quotient,B=X.rem.low,!!B)for(h=8;h>=0;h--)n[g*9+h]=B%10,B=Math.floor(B/10)}if(o)r=1,n[s]=0;else for(r=36;!n[s];)r=r-1,s=s+1;var bt=r-1+z;if(bt>=34||bt<=-7||z>0){if(r>34)return p.push("".concat(0)),z>0?p.push("E+".concat(z)):z<0&&p.push("E".concat(z)),p.join("");p.push("".concat(n[s++])),r=r-1,r&&p.push(".");for(var i=0;i<r;i++)p.push("".concat(n[s++]));p.push("E"),bt>0?p.push("+".concat(bt)):p.push("".concat(bt))}else if(z>=0)for(var i=0;i<r;i++)p.push("".concat(n[s++]));else{var It=r+z;if(It>0)for(var i=0;i<It;i++)p.push("".concat(n[s++]));else p.push("0");for(p.push(".");It++<0;)p.push("0");for(var i=0;i<r-Math.max(It-1,0);i++)p.push("".concat(n[s++]))}return p.join("")},t.prototype.toJSON=function(){return{$numberDecimal:this.toString()}},t.prototype.toExtendedJSON=function(){return{$numberDecimal:this.toString()}},t.fromExtendedJSON=function(e){return t.fromString(e.$numberDecimal)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new Decimal128("'.concat(this.toString(),'")')},t}();Object.defineProperty(Ma.prototype,"_bsontype",{value:"Decimal128"});var gs=function(){function t(e){if(!(this instanceof t))return new t(e);e instanceof Number&&(e=e.valueOf()),this.value=+e}return t.prototype.valueOf=function(){return this.value},t.prototype.toJSON=function(){return this.value},t.prototype.toString=function(e){return this.value.toString(e)},t.prototype.toExtendedJSON=function(e){return e&&(e.legacy||e.relaxed&&isFinite(this.value))?this.value:Object.is(Math.sign(this.value),-0)?{$numberDouble:"-".concat(this.value.toFixed(1))}:{$numberDouble:Number.isInteger(this.value)?this.value.toFixed(1):this.value.toString()}},t.fromExtendedJSON=function(e,r){var n=parseFloat(e.$numberDouble);return r&&r.relaxed?n:new t(n)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var e=this.toExtendedJSON();return"new Double(".concat(e.$numberDouble,")")},t}();Object.defineProperty(gs.prototype,"_bsontype",{value:"Double"});var ms=function(){function t(e){if(!(this instanceof t))return new t(e);e instanceof Number&&(e=e.valueOf()),this.value=+e|0}return t.prototype.valueOf=function(){return this.value},t.prototype.toString=function(e){return this.value.toString(e)},t.prototype.toJSON=function(){return this.value},t.prototype.toExtendedJSON=function(e){return e&&(e.relaxed||e.legacy)?this.value:{$numberInt:this.value.toString()}},t.fromExtendedJSON=function(e,r){return r&&r.relaxed?parseInt(e.$numberInt,10):new t(e.$numberInt)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new Int32(".concat(this.valueOf(),")")},t}();Object.defineProperty(ms.prototype,"_bsontype",{value:"Int32"});var Ba=function(){function t(){if(!(this instanceof t))return new t}return t.prototype.toExtendedJSON=function(){return{$maxKey:1}},t.fromExtendedJSON=function(){return new t},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new MaxKey()"},t}();Object.defineProperty(Ba.prototype,"_bsontype",{value:"MaxKey"});var ja=function(){function t(){if(!(this instanceof t))return new t}return t.prototype.toExtendedJSON=function(){return{$minKey:1}},t.fromExtendedJSON=function(){return new t},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new MinKey()"},t}();Object.defineProperty(ja.prototype,"_bsontype",{value:"MinKey"});var qw=new RegExp("^[0-9a-fA-F]{24}$"),fr=null,Se=Symbol("id"),Kt=function(){function t(e){if(!(this instanceof t))return new t(e);var r;if(typeof e=="object"&&e&&"id"in e){if(typeof e.id!="string"&&!ArrayBuffer.isView(e.id))throw new At("Argument passed in must have an id that is of type string or Buffer");"toHexString"in e&&typeof e.toHexString=="function"?r=ut.from(e.toHexString(),"hex"):r=e.id}else r=e;if(r==null||typeof r=="number")this[Se]=t.generate(typeof r=="number"?r:void 0);else if(ArrayBuffer.isView(r)&&r.byteLength===12)this[Se]=r instanceof ut?r:zi(r);else if(typeof r=="string")if(r.length===12){var n=ut.from(r);if(n.byteLength===12)this[Se]=n;else throw new At("Argument passed in must be a string of 12 bytes")}else if(r.length===24&&qw.test(r))this[Se]=ut.from(r,"hex");else throw new At("Argument passed in must be a string of 12 bytes or a string of 24 hex characters or an integer");else throw new At("Argument passed in does not match the accepted types");t.cacheHexString&&(this.__id=this.id.toString("hex"))}return Object.defineProperty(t.prototype,"id",{get:function(){return this[Se]},set:function(e){this[Se]=e,t.cacheHexString&&(this.__id=e.toString("hex"))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"generationTime",{get:function(){return this.id.readInt32BE(0)},set:function(e){this.id.writeUInt32BE(e,0)},enumerable:!1,configurable:!0}),t.prototype.toHexString=function(){if(t.cacheHexString&&this.__id)return this.__id;var e=this.id.toString("hex");return t.cacheHexString&&!this.__id&&(this.__id=e),e},t.getInc=function(){return t.index=(t.index+1)%16777215},t.generate=function(e){typeof e!="number"&&(e=Math.floor(Date.now()/1e3));var r=t.getInc(),n=ut.alloc(12);return n.writeUInt32BE(e,0),fr===null&&(fr=Rh(5)),n[4]=fr[0],n[5]=fr[1],n[6]=fr[2],n[7]=fr[3],n[8]=fr[4],n[11]=r&255,n[10]=r>>8&255,n[9]=r>>16&255,n},t.prototype.toString=function(e){return e?this.id.toString(e):this.toHexString()},t.prototype.toJSON=function(){return this.toHexString()},t.prototype.equals=function(e){if(e==null)return!1;if(e instanceof t)return this[Se][11]===e[Se][11]&&this[Se].equals(e[Se]);if(typeof e=="string"&&t.isValid(e)&&e.length===12&&Ua(this.id))return e===ut.prototype.toString.call(this.id,"latin1");if(typeof e=="string"&&t.isValid(e)&&e.length===24)return e.toLowerCase()===this.toHexString();if(typeof e=="string"&&t.isValid(e)&&e.length===12)return ut.from(e).equals(this.id);if(typeof e=="object"&&"toHexString"in e&&typeof e.toHexString=="function"){var r=e.toHexString(),n=this.toHexString().toLowerCase();return typeof r=="string"&&r.toLowerCase()===n}return!1},t.prototype.getTimestamp=function(){var e=new Date,r=this.id.readUInt32BE(0);return e.setTime(Math.floor(r)*1e3),e},t.createPk=function(){return new t},t.createFromTime=function(e){var r=ut.from([0,0,0,0,0,0,0,0,0,0,0,0]);return r.writeUInt32BE(e,0),new t(r)},t.createFromHexString=function(e){if(typeof e>"u"||e!=null&&e.length!==24)throw new At("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");return new t(ut.from(e,"hex"))},t.isValid=function(e){if(e==null)return!1;try{return new t(e),!0}catch{return!1}},t.prototype.toExtendedJSON=function(){return this.toHexString?{$oid:this.toHexString()}:{$oid:this.toString("hex")}},t.fromExtendedJSON=function(e){return new t(e.$oid)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new ObjectId("'.concat(this.toHexString(),'")')},t.index=Math.floor(Math.random()*16777215),t}();Object.defineProperty(Kt.prototype,"generate",{value:ds(function(t){return Kt.generate(t)},"Please use the static `ObjectId.generate(time)` instead")});Object.defineProperty(Kt.prototype,"getInc",{value:ds(function(){return Kt.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(Kt.prototype,"get_inc",{value:ds(function(){return Kt.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(Kt,"get_inc",{value:ds(function(){return Kt.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(Kt.prototype,"_bsontype",{value:"ObjectID"});function zw(t){return t.split("").sort().join("")}var Yn=function(){function t(e,r){if(!(this instanceof t))return new t(e,r);if(this.pattern=e,this.options=zw(r??""),this.pattern.indexOf("\0")!==-1)throw new Er("BSON Regex patterns cannot contain null bytes, found: ".concat(JSON.stringify(this.pattern)));if(this.options.indexOf("\0")!==-1)throw new Er("BSON Regex options cannot contain null bytes, found: ".concat(JSON.stringify(this.options)));for(var n=0;n<this.options.length;n++)if(!(this.options[n]==="i"||this.options[n]==="m"||this.options[n]==="x"||this.options[n]==="l"||this.options[n]==="s"||this.options[n]==="u"))throw new Er("The regular expression option [".concat(this.options[n],"] is not supported"))}return t.parseOptions=function(e){return e?e.split("").sort().join(""):""},t.prototype.toExtendedJSON=function(e){return e=e||{},e.legacy?{$regex:this.pattern,$options:this.options}:{$regularExpression:{pattern:this.pattern,options:this.options}}},t.fromExtendedJSON=function(e){if("$regex"in e)if(typeof e.$regex!="string"){if(e.$regex._bsontype==="BSONRegExp")return e}else return new t(e.$regex,t.parseOptions(e.$options));if("$regularExpression"in e)return new t(e.$regularExpression.pattern,t.parseOptions(e.$regularExpression.options));throw new At("Unexpected BSONRegExp EJSON object form: ".concat(JSON.stringify(e)))},t}();Object.defineProperty(Yn.prototype,"_bsontype",{value:"BSONRegExp"});var $a=function(){function t(e){if(!(this instanceof t))return new t(e);this.value=e}return t.prototype.valueOf=function(){return this.value},t.prototype.toString=function(){return this.value},t.prototype.inspect=function(){return'new BSONSymbol("'.concat(this.value,'")')},t.prototype.toJSON=function(){return this.value},t.prototype.toExtendedJSON=function(){return{$symbol:this.value}},t.fromExtendedJSON=function(e){return new t(e.$symbol)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t}();Object.defineProperty($a.prototype,"_bsontype",{value:"Symbol"});var Yw=J,Bh=function(t){ps(e,t);function e(r,n){var i=this;return i instanceof e?(J.isLong(r)?i=t.call(this,r.low,r.high,!0)||this:si(r)&&typeof r.t<"u"&&typeof r.i<"u"?i=t.call(this,r.i,r.t,!0)||this:i=t.call(this,r,n,!0)||this,Object.defineProperty(i,"_bsontype",{value:"Timestamp",writable:!1,configurable:!1,enumerable:!1}),i):new e(r,n)}return e.prototype.toJSON=function(){return{$timestamp:this.toString()}},e.fromInt=function(r){return new e(J.fromInt(r,!0))},e.fromNumber=function(r){return new e(J.fromNumber(r,!0))},e.fromBits=function(r,n){return new e(r,n)},e.fromString=function(r,n){return new e(J.fromString(r,!0,n))},e.prototype.toExtendedJSON=function(){return{$timestamp:{t:this.high>>>0,i:this.low>>>0}}},e.fromExtendedJSON=function(r){return new e(r.$timestamp)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return"new Timestamp({ t: ".concat(this.getHighBits(),", i: ").concat(this.getLowBits()," })")},e.MAX_VALUE=J.MAX_UNSIGNED_VALUE,e}(Yw);function Kw(t){return si(t)&&Reflect.has(t,"_bsontype")&&typeof t._bsontype=="string"}var jh=2147483647,$h=-2147483648,Fh=9223372036854776e3,Hh=-9223372036854776e3,Jw={$oid:Kt,$binary:Sr,$uuid:Sr,$symbol:$a,$numberInt:ms,$numberDecimal:Ma,$numberDouble:gs,$numberLong:J,$minKey:ja,$maxKey:Ba,$regex:Yn,$regularExpression:Yn,$timestamp:Bh};function Vh(t,e){if(e===void 0&&(e={}),typeof t=="number"){if(e.relaxed||e.legacy)return t;if(Math.floor(t)===t){if(t>=$h&&t<=jh)return new ms(t);if(t>=Hh&&t<=Fh)return J.fromNumber(t)}return new gs(t)}if(t==null||typeof t!="object")return t;if(t.$undefined)return null;for(var r=Object.keys(t).filter(function(p){return p.startsWith("$")&&t[p]!=null}),n=0;n<r.length;n++){var i=Jw[r[n]];if(i)return i.fromExtendedJSON(t,e)}if(t.$date!=null){var s=t.$date,o=new Date;return e.legacy?typeof s=="number"?o.setTime(s):typeof s=="string"&&o.setTime(Date.parse(s)):typeof s=="string"?o.setTime(Date.parse(s)):J.isLong(s)?o.setTime(s.toNumber()):typeof s=="number"&&e.relaxed&&o.setTime(s),o}if(t.$code!=null){var a=Object.assign({},t);return t.$scope&&(a.$scope=Vh(t.$scope)),fs.fromExtendedJSON(t)}if(kw(t)||t.$dbPointer){var l=t.$ref?t:t.$dbPointer;if(l instanceof zn)return l;var h=Object.keys(l).filter(function(p){return p.startsWith("$")}),g=!0;if(h.forEach(function(p){["$ref","$id","$db"].indexOf(p)===-1&&(g=!1)}),g)return zn.fromExtendedJSON(l)}return t}function Qw(t,e){return t.map(function(r,n){e.seenObjects.push({propertyName:"index ".concat(n),obj:null});try{return er(r,e)}finally{e.seenObjects.pop()}})}function Bl(t){var e=t.toISOString();return t.getUTCMilliseconds()!==0?e:e.slice(0,-5)+"Z"}function er(t,e){if((typeof t=="object"||typeof t=="function")&&t!==null){var r=e.seenObjects.findIndex(function(A){return A.obj===t});if(r!==-1){var n=e.seenObjects.map(function(A){return A.propertyName}),i=n.slice(0,r).map(function(A){return"".concat(A," -> ")}).join(""),s=n[r],o=" -> "+n.slice(r+1,n.length-1).map(function(A){return"".concat(A," -> ")}).join(""),a=n[n.length-1],l=" ".repeat(i.length+s.length/2),h="-".repeat(o.length+(s.length+a.length)/2-1);throw new At(`Converting circular structure to EJSON:
|
|
35
35
|
`+" ".concat(i).concat(s).concat(o).concat(a,`
|
|
36
|
-
`)+" ".concat(l,"\\").concat(h,"/"))}e.seenObjects[e.seenObjects.length-1].obj=t}if(Array.isArray(t))return Kw(t,e);if(t===void 0)return null;if(t instanceof Date||xw(t)){var g=t.getTime(),p=g>-1&&g<2534023188e5;return e.legacy?e.relaxed&&p?{$date:t.getTime()}:{$date:Ml(t)}:e.relaxed&&p?{$date:Ml(t)}:{$date:{$numberLong:t.getTime().toString()}}}if(typeof t=="number"&&(!e.relaxed||!isFinite(t))){if(Math.floor(t)===t){var _=t>=$h&&t<=jh,w=t>=Hh&&t<=Fh;if(_)return{$numberInt:t.toString()};if(w)return{$numberLong:t.toString()}}return{$numberDouble:t.toString()}}if(t instanceof RegExp||Tw(t)){var b=t.flags;if(b===void 0){var E=t.toString().match(/[gimuy]*$/);E&&(b=E[0])}var P=new Yn(t.source,b);return P.toExtendedJSON(e)}return t!=null&&typeof t=="object"?Qw(t,e):t}var Jw={Binary:function(t){return new Sr(t.value(),t.sub_type)},Code:function(t){return new fs(t.code,t.scope)},DBRef:function(t){return new zn(t.collection||t.namespace,t.oid,t.db,t.fields)},Decimal128:function(t){return new Ua(t.bytes)},Double:function(t){return new gs(t.value)},Int32:function(t){return new ms(t.value)},Long:function(t){return J.fromBits(t.low!=null?t.low:t.low_,t.low!=null?t.high:t.high_,t.low!=null?t.unsigned:t.unsigned_)},MaxKey:function(){return new Ma},MinKey:function(){return new Ba},ObjectID:function(t){return new Jt(t)},ObjectId:function(t){return new Jt(t)},BSONRegExp:function(t){return new Yn(t.pattern,t.options)},Symbol:function(t){return new ja(t.value)},Timestamp:function(t){return Bh.fromBits(t.low,t.high)}};function Qw(t,e){if(t==null||typeof t!="object")throw new Er("not an object instance");var r=t._bsontype;if(typeof r>"u"){var n={};for(var i in t){e.seenObjects.push({propertyName:i,obj:null});try{var s=er(t[i],e);i==="__proto__"?Object.defineProperty(n,i,{value:s,writable:!0,enumerable:!0,configurable:!0}):n[i]=s}finally{e.seenObjects.pop()}}return n}else if(zw(t)){var o=t;if(typeof o.toExtendedJSON!="function"){var a=Jw[t._bsontype];if(!a)throw new At("Unrecognized or invalid _bsontype: "+t._bsontype);o=a(o)}return r==="Code"&&o.scope?o=new fs(o.code,er(o.scope,e)):r==="DBRef"&&o.oid&&(o=new zn(er(o.collection,e),er(o.oid,e),er(o.db,e),er(o.fields,e))),o.toExtendedJSON(e)}else throw new Er("_bsontype must be a string, but was: "+typeof r)}var Bl;(function(t){function e(s,o){var a=Object.assign({},{relaxed:!0,legacy:!1},o);return typeof a.relaxed=="boolean"&&(a.strict=!a.relaxed),typeof a.strict=="boolean"&&(a.relaxed=!a.strict),JSON.parse(s,function(l,h){if(l.indexOf("\0")!==-1)throw new Er("BSON Document field names cannot contain null bytes, found: ".concat(JSON.stringify(l)));return Vh(h,a)})}t.parse=e;function r(s,o,a,l){a!=null&&typeof a=="object"&&(l=a,a=0),o!=null&&typeof o=="object"&&!Array.isArray(o)&&(l=o,o=void 0,a=0);var h=Object.assign({relaxed:!0,legacy:!1},l,{seenObjects:[{propertyName:"(root)",obj:null}]}),g=er(s,h);return JSON.stringify(g,o,a)}t.stringify=r;function n(s,o){return o=o||{},JSON.parse(r(s,o))}t.serialize=n;function i(s,o){return o=o||{},e(JSON.stringify(s),o)}t.deserialize=i})(Bl||(Bl={}));var jl,$l=Ph();$l.Map?jl=$l.Map:jl=function(){function t(e){e===void 0&&(e=[]),this._keys=[],this._values={};for(var r=0;r<e.length;r++)if(e[r]!=null){var n=e[r],i=n[0],s=n[1];this._keys.push(i),this._values[i]={v:s,i:this._keys.length-1}}}return t.prototype.clear=function(){this._keys=[],this._values={}},t.prototype.delete=function(e){var r=this._values[e];return r==null?!1:(delete this._values[e],this._keys.splice(r.i,1),!0)},t.prototype.entries=function(){var e=this,r=0;return{next:function(){var n=e._keys[r++];return{value:n!==void 0?[n,e._values[n].v]:void 0,done:n===void 0}}}},t.prototype.forEach=function(e,r){r=r||this;for(var n=0;n<this._keys.length;n++){var i=this._keys[n];e.call(r,this._values[i].v,i,r)}},t.prototype.get=function(e){return this._values[e]?this._values[e].v:void 0},t.prototype.has=function(e){return this._values[e]!=null},t.prototype.keys=function(){var e=this,r=0;return{next:function(){var n=e._keys[r++];return{value:n!==void 0?n:void 0,done:n===void 0}}}},t.prototype.set=function(e,r){return this._values[e]?(this._values[e].v=r,this):(this._keys.push(e),this._values[e]={v:r,i:this._keys.length-1},this)},t.prototype.values=function(){var e=this,r=0;return{next:function(){var n=e._keys[r++];return{value:n!==void 0?e._values[n].v:void 0,done:n===void 0}}}},Object.defineProperty(t.prototype,"size",{get:function(){return this._keys.length},enumerable:!1,configurable:!0}),t}();var NE=J.fromNumber(Nw),AE=J.fromNumber(Aw),Vs=new Uint8Array(8),OE=new DataView(Vs.buffer,Vs.byteOffset,Vs.byteLength),Zw=1024*1024*17,kE=ut.alloc(Zw),$a=class{triggerID;nudgeID;engagementID;contentID;shortID;contentType;variation;props;objective;onsiteDeliveryType;holdout;constructor(t){t=t||{},this.triggerID=t.id||t.triggerID,this.nudgeID=t.nudgeID,this.shortID=t.shortID,this.contentType=t.contentType,this.engagementID=t.engagementID,this.contentID=t.contentID,this.variation=t.variation,this.props=t.props,this.objective=t.objective,this.onsiteDeliveryType=t.onsiteDeliveryType,this.holdout=t.holdout}},jt=class{constructor(t,e={},r,n){this.name=t,this.properties=e,this.id=n?new Jt(n):new Jt,this.occurred=new Date,r&&(this.trigger=new $a(r)),this.newEvent=!n}trigger;items;videos;id;newEvent;cart;currentItem;deviceProps;landingPage;occurred;page;sessionID;sessionNumber;locale},ve=class{static SWIPER_CSS="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css";static injectScriptURL(t,e){if(!t)return;let r=document.createElement("script");r.id=e??"",r.src=t,ke.mode==="local"&&(r.type="module"),document.head.appendChild(r)}static injectRawScript(t){if(!t)return;let e=document.createElement("script");e.id="cooee-app-script",e.innerHTML=t,document.head.appendChild(e)}static injectRawCSS(t,e=document.head){if(!t)return;let r=document.createElement("style");r.textContent=t,e.appendChild(r)}static injectSwiperCSS(t=document.head){this.injectStylesheet(this.SWIPER_CSS,t)}static injectStylesheet(t,e=document.head){if(!t)return;let r=document.createElement("link");r.rel="stylesheet",r.href=t,t===this.SWIPER_CSS&&(r.crossOrigin="anonymous",r.onload=n=>{let i=n.currentTarget?.sheet?.cssRules;if(i){for(let s of i)if(s.type==CSSRule.FONT_FACE_RULE){let o=t.split("/"),a=o.slice(0,o.length-1).join("/"),l=s.cssText;l=l.replace(/url\s*\(\s*['"]?(?!((\/)|((?:https?:)?\/\/)|(?:data:?:)))([^'")]+)['"]?\s*\)/g,`url("${a}/$4")`);let h=document.createElement("style");h.appendChild(document.createTextNode(l)),document.head.appendChild(h)}}}),e.appendChild(r)}static async loadSwiperScript(){window.CooeeSDK.Swiper||(window.CooeeSDK.Swiper=(await import("https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.mjs")).Swiper)}},Xw="2.0.4",jo=500,Fl="user-agent",nn="",Hl="?",Yi="function",ir="undefined",sn="object",$o="string",Xt="browser",Ue="cpu",xe="device",ye="engine",fe="os",zr="result",U="name",O="type",L="vendor",$="version",te="architecture",Kn="major",R="model",Rn="console",et="mobile",vt="tablet",Lt="smarttv",Ie="wearable",Ci="xr",Ln="embedded",En="inapp",Fa="brands",vr="formFactors",Ha="fullVersionList",Yr="platform",Va="platformVersion",ys="bitness",hr="sec-ch-ua",tb=hr+"-full-version-list",eb=hr+"-arch",rb=hr+"-"+ys,nb=hr+"-form-factors",ib=hr+"-"+et,sb=hr+"-"+R,Wh=hr+"-"+Yr,ob=Wh+"-version",Gh=[Fa,Ha,et,R,Yr,Va,te,vr,ys],Ti="Amazon",$r="Apple",Vl="ASUS",Wl="BlackBerry",gr="Google",Gl="Huawei",Ws="Lenovo",ql="Honor",xi="LG",Gs="Microsoft",qs="Motorola",zs="Nvidia",zl="OnePlus",Ys="OPPO",Sn="Samsung",Yl="Sharp",In="Sony",Ks="Xiaomi",Js="Zebra",Kl="Chrome",Jl="Chromium",Je="Chromecast",Li="Edge",Cn="Firefox",Tn="Opera",Qs="Facebook",Ql="Sogou",Fr="Mobile ",xn=" Browser",Fo="Windows",ab=typeof window!==ir,ee=ab&&window.navigator?window.navigator:void 0,rr=ee&&ee.userAgentData?ee.userAgentData:void 0,cb=function(t,e){var r={},n=e;if(!Ki(e)){n={};for(var i in e)for(var s in e[i])n[s]=e[i][s].concat(n[s]?n[s]:[])}for(var o in t)r[o]=n[o]&&n[o].length%2===0?n[o].concat(t[o]):t[o];return r},vs=function(t){for(var e={},r=0;r<t.length;r++)e[t[r].toUpperCase()]=t[r];return e},Ho=function(t,e){if(typeof t===sn&&t.length>0){for(var r in t)if(Me(e)==Me(t[r]))return!0;return!1}return fn(t)?Me(e)==Me(t):!1},Ki=function(t,e){for(var r in t)return/^(browser|cpu|device|engine|os)$/.test(r)||(e?Ki(t[r]):!1)},fn=function(t){return typeof t===$o},Zs=function(t){if(t){for(var e=[],r=on(/\\?\"/g,t).split(","),n=0;n<r.length;n++)if(r[n].indexOf(";")>-1){var i=Ji(r[n]).split(";v=");e[n]={brand:i[0],version:i[1]}}else e[n]=Ji(r[n]);return e}},Me=function(t){return fn(t)?t.toLowerCase():t},Xs=function(t){return fn(t)?on(/[^\d\.]/g,t).split(".")[0]:void 0},Be=function(t){for(var e in t){var r=t[e];typeof r==sn&&r.length==2?this[r[0]]=r[1]:this[r]=void 0}return this},on=function(t,e){return fn(e)?e.replace(t,nn):e},Dn=function(t){return on(/\\?\"/g,t)},Ji=function(t,e){if(fn(t))return t=on(/^\s\s*/,t),typeof e===ir?t:t.substring(0,jo)},to=function(t,e){if(!(!t||!e))for(var r=0,n,i,s,o,a,l;r<e.length&&!a;){var h=e[r],g=e[r+1];for(n=i=0;n<h.length&&!a&&h[n];)if(a=h[n++].exec(t),a)for(s=0;s<g.length;s++)l=a[++i],o=g[s],typeof o===sn&&o.length>0?o.length===2?typeof o[1]==Yi?this[o[0]]=o[1].call(this,l):this[o[0]]=o[1]:o.length>=3&&(typeof o[1]===Yi&&!(o[1].exec&&o[1].test)?o.length>3?this[o[0]]=l?o[1].apply(this,o.slice(2)):void 0:this[o[0]]=l?o[1].call(this,l,o[2]):void 0:o.length==3?this[o[0]]=l?l.replace(o[1],o[2]):void 0:o.length==4?this[o[0]]=l?o[3].call(this,l.replace(o[1],o[2])):void 0:o.length>4&&(this[o[0]]=l?o[3].apply(this,[l.replace(o[1],o[2])].concat(o.slice(4))):void 0)):this[o]=l||void 0;r+=2}},Te=function(t,e){for(var r in e)if(typeof e[r]===sn&&e[r].length>0){for(var n=0;n<e[r].length;n++)if(Ho(e[r][n],t))return r===Hl?void 0:r}else if(Ho(e[r],t))return r===Hl?void 0:r;return e.hasOwnProperty("*")?e["*"]:t},Zl={ME:"4.90","NT 3.51":"3.51","NT 4.0":"4.0",2e3:["5.0","5.01"],XP:["5.1","5.2"],Vista:"6.0",7:"6.1",8:"6.2","8.1":"6.3",10:["6.4","10.0"],NT:""},Xl={embedded:"Automotive",mobile:"Mobile",tablet:["Tablet","EInk"],smarttv:"TV",wearable:"Watch",xr:["VR","XR"],"?":["Desktop","Unknown"],"*":void 0},lb={Chrome:"Google Chrome",Edge:"Microsoft Edge","Edge WebView2":"Microsoft Edge WebView2","Chrome WebView":"Android WebView","Chrome Headless":"HeadlessChrome","Huawei Browser":"HuaweiBrowser","MIUI Browser":"Miui Browser","Opera Mobi":"OperaMobile",Yandex:"YaBrowser"},tu={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[$,[U,Fr+"Chrome"]],[/webview.+edge\/([\w\.]+)/i],[$,[U,Li+" WebView"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[$,[U,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[U,$],[/opios[\/ ]+([\w\.]+)/i],[$,[U,Tn+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[$,[U,Tn+" GX"]],[/\bopr\/([\w\.]+)/i],[$,[U,Tn]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[$,[U,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[$,[U,"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|otter|dooble|(?:lg |qute)browser)\/([-\w\.]+)/i,/(heytap|ovi|115|surf)browser\/([\d\.]+)/i,/(ecosia|weibo)(?:__| \w+@)([\d\.]+)/i],[U,$],[/quark(?:pc)?\/([-\w\.]+)/i],[$,[U,"Quark"]],[/\bddg\/([\w\.]+)/i],[$,[U,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[$,[U,"UCBrowser"]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[$,[U,"WeChat"]],[/konqueror\/([\w\.]+)/i],[$,[U,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[$,[U,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[$,[U,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[$,[U,"Smart "+Ws+xn]],[/(avast|avg)\/([\w\.]+)/i],[[U,/(.+)/,"$1 Secure"+xn],$],[/\bfocus\/([\w\.]+)/i],[$,[U,Cn+" Focus"]],[/\bopt\/([\w\.]+)/i],[$,[U,Tn+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[$,[U,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[$,[U,"Dolphin"]],[/coast\/([\w\.]+)/i],[$,[U,Tn+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[$,[U,"MIUI"+xn]],[/fxios\/([\w\.-]+)/i],[$,[U,Fr+Cn]],[/\bqihoobrowser\/?([\w\.]*)/i],[$,[U,"360"]],[/\b(qq)\/([\w\.]+)/i],[[U,/(.+)/,"$1Browser"],$],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[U,/(.+)/,"$1"+xn],$],[/samsungbrowser\/([\w\.]+)/i],[$,[U,Sn+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[$,[U,Ql+" Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[U,Ql+" Mobile"],$],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[U,$],[/(lbbrowser|rekonq)/i],[U],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[$,U],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[U,Qs],$,[O,En]],[/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/(daum)apps[\/ ]([\w\.]+)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(instagram|snapchat|klarna)[\/ ]([-\w\.]+)/i],[U,$,[O,En]],[/\bgsa\/([\w\.]+) .*safari\//i],[$,[U,"GSA"],[O,En]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[$,[U,"TikTok"],[O,En]],[/\[(linkedin)app\]/i],[U,[O,En]],[/(chromium)[\/ ]([-\w\.]+)/i],[U,$],[/headlesschrome(?:\/([\w\.]+)| )/i],[$,[U,Kl+" Headless"]],[/wv\).+chrome\/([\w\.]+).+edgw\//i],[$,[U,Li+" WebView2"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[U,Kl+" WebView"],$],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[$,[U,"Android"+xn]],[/chrome\/([\w\.]+) mobile/i],[$,[U,Fr+"Chrome"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[U,$],[/version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i],[$,[U,Fr+"Safari"]],[/iphone .*mobile(?:\/\w+ | ?)safari/i],[[U,Fr+"Safari"]],[/version\/([\w\.\,]+) .*(safari)/i],[$,U],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[U,[$,"1"]],[/(webkit|khtml)\/([\w\.]+)/i],[U,$],[/(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i],[[U,Fr+Cn],$],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[U,"Netscape"],$],[/(wolvic|librewolf)\/([\w\.]+)/i],[U,$],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[$,[U,Cn+" 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,/(amaya|dillo|doris|icab|ladybird|lynx|mosaic|netsurf|obigo|polaris|w3m|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/\b(links) \(([\w\.]+)/i],[U,[$,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[U,[$,/[^\d\.]+./,nn]]],cpu:[[/\b((amd|x|x86[-_]?|wow|win)64)\b/i],[[te,"amd64"]],[/(ia32(?=;))/i,/\b((i[346]|x)86)(pc)?\b/i],[[te,"ia32"]],[/\b(aarch64|arm(v?[89]e?l?|_?64))\b/i],[[te,"arm64"]],[/\b(arm(v[67])?ht?n?[fl]p?)\b/i],[[te,"armhf"]],[/( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i],[[te,"arm"]],[/((ppc|powerpc)(64)?)( mac|;|\))/i],[[te,/ower/,nn,Me]],[/ sun4\w[;\)]/i],[[te,"sparc"]],[/\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i],[[te,Me]]],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],[R,[L,Sn],[O,vt]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr]|browser)[-\w]+)/i,/sec-(sgh\w+)/i],[R,[L,Sn],[O,et]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[R,[L,$r],[O,et]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[R,[L,$r],[O,vt]],[/(macintosh);/i],[R,[L,$r]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[R,[L,Yl],[O,et]],[/\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i],[R,[L,ql],[O,vt]],[/honor([-\w ]+)[;\)]/i],[R,[L,ql],[O,et]],[/\b((?:ag[rs][2356]?k?|bah[234]?|bg[2o]|bt[kv]|cmr|cpn|db[ry]2?|jdn2|got|kob2?k?|mon|pce|scm|sht?|[tw]gr|vrd)-[ad]?[lw][0125][09]b?|605hw|bg2-u03|(?:gem|fdr|m2|ple|t1)-[7a]0[1-4][lu]|t1-a2[13][lw]|mediapad[\w\. ]*(?= bui|\)))\b(?!.+d\/s)/i],[R,[L,Gl],[O,vt]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[R,[L,Gl],[O,et]],[/oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i,/\b((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i],[[R,/_/g," "],[L,Ks],[O,vt]],[/\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,/ ([\w ]+) miui\/v?\d/i],[[R,/_/g," "],[L,Ks],[O,et]],[/droid.+; (cph2[3-6]\d[13579]|((gm|hd)19|(ac|be|in|kb)20|(d[en]|eb|le|mt)21|ne22)[0-2]\d|p[g-k]\w[1m]10)\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[R,[L,zl],[O,et]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[R,[L,Ys],[O,et]],[/\b(opd2(\d{3}a?))(?: bui|\))/i],[R,[L,Te,{OnePlus:["203","304","403","404","413","415"],"*":Ys}],[O,vt]],[/(vivo (5r?|6|8l?|go|one|s|x[il]?[2-4]?)[\w\+ ]*)(?: bui|\))/i],[R,[L,"BLU"],[O,et]],[/; vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[R,[L,"Vivo"],[O,et]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[R,[L,"Realme"],[O,et]],[/(ideatab[-\w ]+|602lv|d-42a|a101lv|a2109a|a3500-hv|s[56]000|pb-6505[my]|tb-?x?\d{3,4}(?:f[cu]|xu|[av])|yt\d?-[jx]?\d+[lfmx])( bui|;|\)|\/)/i,/lenovo ?(b[68]0[08]0-?[hf]?|tab(?:[\w- ]+?)|tb[\w-]{6,7})( bui|;|\)|\/)/i],[R,[L,Ws],[O,vt]],[/lenovo[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i],[R,[L,Ws],[O,et]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ]([\w\s]+)(\)| bui)/i,/((?:moto(?! 360)[-\w\(\) ]+|xt\d{3,4}[cgkosw\+]?[-\d]*|nexus 6)(?= bui|\)))/i],[R,[L,qs],[O,et]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[R,[L,qs],[O,vt]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[R,[L,xi],[O,vt]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+(?!.*(?:browser|netcast|android tv|watch|webos))(\w+)/i,/\blg-?([\d\w]+) bui/i],[R,[L,xi],[O,et]],[/(nokia) (t[12][01])/i],[L,R,[O,vt]],[/(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i,/nokia[-_ ]?(([-\w\. ]*))/i],[[R,/_/g," "],[O,et],[L,"Nokia"]],[/(pixel (c|tablet))\b/i],[R,[L,gr],[O,vt]],[/droid.+;(?: google)? (g(01[13]a|020[aem]|025[jn]|1b60|1f8f|2ybb|4s1m|576d|5nz6|8hhn|8vou|a02099|c15s|d1yq|e2ae|ec77|gh2x|kv4x|p4bc|pj41|r83y|tt9q|ur25|wvk6)|pixel[\d ]*a?( pro)?( xl)?( fold)?( \(5g\))?)( bui|\))/i],[R,[L,gr],[O,et]],[/(google) (pixelbook( go)?)/i],[L,R],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-\w\w\d\d)(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[R,[L,In],[O,et]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[R,"Xperia Tablet"],[L,In],[O,vt]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[R,[L,Ti],[O,vt]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[R,/(.+)/g,"Fire Phone $1"],[L,Ti],[O,et]],[/(playbook);[-\w\),; ]+(rim)/i],[R,L,[O,vt]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[R,[L,Wl],[O,et]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[R,[L,Vl],[O,vt]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[R,[L,Vl],[O,et]],[/(nexus 9)/i],[R,[L,"HTC"],[O,vt]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[L,[R,/_/g," "],[O,et]],[/tcl (xess p17aa)/i,/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])(_\w(\w|\w\w))?(\)| bui)/i],[R,[L,"TCL"],[O,vt]],[/droid [\w\.]+; (418(?:7d|8v)|5087z|5102l|61(?:02[dh]|25[adfh]|27[ai]|56[dh]|59k|65[ah])|a509dl|t(?:43(?:0w|1[adepqu])|50(?:6d|7[adju])|6(?:09dl|10k|12b|71[efho]|76[hjk])|7(?:66[ahju]|67[hw]|7[045][bh]|71[hk]|73o|76[ho]|79w|81[hks]?|82h|90[bhsy]|99b)|810[hs]))(_\w(\w|\w\w))?(\)| bui)/i],[R,[L,"TCL"],[O,et]],[/(itel) ((\w+))/i],[[L,Me],R,[O,Te,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[R,[L,"Acer"],[O,vt]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[R,[L,"Meizu"],[O,et]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[R,[L,"Ulefone"],[O,et]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[R,[L,"Energizer"],[O,et]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[R,[L,"Cat"],[O,et]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[R,[L,"Smartfren"],[O,et]],[/droid.+; (a(in)?(0(15|59|6[35])|142)p?)/i],[R,[L,"Nothing"],[O,et]],[/; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i,/archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i],[R,[L,"Archos"],[O,vt]],[/archos ([\w ]+)( b|\))/i,/; (ac[3-6]\d\w{2,8})( b|\))/i],[R,[L,"Archos"],[O,et]],[/; (n159v)/i],[R,[L,"HMD"],[O,et]],[/(imo) (tab \w+)/i,/(infinix|tecno) (x1101b?|p904|dp(7c|8d|10a)( pro)?|p70[1-3]a?|p904|t1101)/i],[L,R,[O,vt]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus(?! zenw)|dell|jolla|meizu|motorola|polytron|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (blu|hmd|imo|infinix|lava|oneplus|tcl)[_ ]([\w\+ ]+?)(?: bui|\)|; r)/i,/(hp) ([\w ]+\w)/i,/(microsoft); (lumia[\w ]+)/i,/(oppo) ?([\w ]+) bui/i],[L,R,[O,et]],[/(kobo)\s(ereader|touch)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i],[L,R,[O,vt]],[/(surface duo)/i],[R,[L,Gs],[O,vt]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[R,[L,"Fairphone"],[O,et]],[/((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i],[R,[L,zs],[O,vt]],[/(sprint) (\w+)/i],[L,R,[O,et]],[/(kin\.[onetw]{3})/i],[[R,/\./g," "],[L,Gs],[O,et]],[/droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[R,[L,Js],[O,vt]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[R,[L,Js],[O,et]],[/smart-tv.+(samsung)/i],[L,[O,Lt]],[/hbbtv.+maple;(\d+)/i],[[R,/^/,"SmartTV"],[L,Sn],[O,Lt]],[/(vizio)(?: |.+model\/)(\w+-\w+)/i,/tcast.+(lg)e?. ([-\w]+)/i],[L,R,[O,Lt]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[L,xi],[O,Lt]],[/(apple) ?tv/i],[L,[R,$r+" TV"],[O,Lt]],[/crkey.*devicetype\/chromecast/i],[[R,Je+" Third Generation"],[L,gr],[O,Lt]],[/crkey.*devicetype\/([^/]*)/i],[[R,/^/,"Chromecast "],[L,gr],[O,Lt]],[/fuchsia.*crkey/i],[[R,Je+" Nest Hub"],[L,gr],[O,Lt]],[/crkey/i],[[R,Je],[L,gr],[O,Lt]],[/(portaltv)/i],[R,[L,Qs],[O,Lt]],[/droid.+aft(\w+)( bui|\))/i],[R,[L,Ti],[O,Lt]],[/(shield \w+ tv)/i],[R,[L,zs],[O,Lt]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[R,[L,Yl],[O,Lt]],[/(bravia[\w ]+)( bui|\))/i],[R,[L,In],[O,Lt]],[/(mi(tv|box)-?\w+) bui/i],[R,[L,Ks],[O,Lt]],[/Hbbtv.*(technisat) (.*);/i],[L,R,[O,Lt]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[L,/.+\/(\w+)/,"$1",Te,{LG:"lge"}],[R,Ji],[O,Lt]],[/droid.+; ([\w- ]+) (?:android tv|smart[- ]?tv)/i],[R,[O,Lt]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:|large screen[\w ]+safari)\b/i],[[O,Lt]],[/(playstation \w+)/i],[R,[L,In],[O,Rn]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[R,[L,Gs],[O,Rn]],[/(ouya)/i,/(nintendo) (\w+)/i,/(retroid) (pocket ([^\)]+))/i],[L,R,[O,Rn]],[/droid.+; (shield)( bui|\))/i],[R,[L,zs],[O,Rn]],[/\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i],[R,[L,Sn],[O,Ie]],[/((pebble))app/i,/(asus|google|lg|oppo) ((pixel |zen)?watch[\w ]*)( bui|\))/i],[L,R,[O,Ie]],[/(ow(?:19|20)?we?[1-3]{1,3})/i],[R,[L,Ys],[O,Ie]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[R,[L,$r],[O,Ie]],[/(opwwe\d{3})/i],[R,[L,zl],[O,Ie]],[/(moto 360)/i],[R,[L,qs],[O,Ie]],[/(smartwatch 3)/i],[R,[L,In],[O,Ie]],[/(g watch r)/i],[R,[L,xi],[O,Ie]],[/droid.+; (wt63?0{2,3})\)/i],[R,[L,Js],[O,Ie]],[/droid.+; (glass) \d/i],[R,[L,gr],[O,Ci]],[/(pico) (4|neo3(?: link|pro)?)/i],[L,R,[O,Ci]],[/(quest( \d| pro)?s?).+vr/i],[R,[L,Qs],[O,Ci]],[/mobile vr; rv.+firefox/i],[[O,Ci]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[L,[O,Ln]],[/(aeobc)\b/i],[R,[L,Ti],[O,Ln]],[/(homepod).+mac os/i],[R,[L,$r],[O,Ln]],[/windows iot/i],[[O,Ln]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+?(mobile|vr|\d) safari/i],[R,[O,Te,{mobile:"Mobile",xr:"VR","*":vt}]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[O,vt]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[O,et]],[/droid .+?; ([\w\. -]+)( bui|\))/i],[R,[L,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[$,[U,Li+"HTML"]],[/(arkweb)\/([\w\.]+)/i],[U,$],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[$,[U,"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],[U,$],[/ladybird\//i],[[U,"LibWeb"]],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[$,U]],os:[[/(windows nt) (6\.[23]); arm/i],[[U,/N/,"R"],[$,Te,Zl]],[/(windows (?:phone|mobile|iot))(?: os)?[\/ ]?([\d\.]*( se)?)/i,/(windows)[\/ ](1[01]|2000|3\.1|7|8(\.1)?|9[58]|me|server 20\d\d( r2)?|vista|xp)/i],[U,$],[/windows nt ?([\d\.\)]*)(?!.+xbox)/i,/\bwin(?=3| ?9|n)(?:nt| 9x )?([\d\.;]*)/i],[[$,/(;|\))/g,"",Te,Zl],[U,Fo]],[/(windows ce)\/?([\d\.]*)/i],[U,$],[/[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[$,/_/g,"."],[U,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+(haiku|morphos))/i],[[U,"macOS"],[$,/_/g,"."]],[/android ([\d\.]+).*crkey/i],[$,[U,Je+" Android"]],[/fuchsia.*crkey\/([\d\.]+)/i],[$,[U,Je+" Fuchsia"]],[/crkey\/([\d\.]+).*devicetype\/smartspeaker/i],[$,[U,Je+" SmartSpeaker"]],[/linux.*crkey\/([\d\.]+)/i],[$,[U,Je+" Linux"]],[/crkey\/([\d\.]+)/i],[$,[U,Je]],[/droid ([\w\.]+)\b.+(android[- ]x86)/i],[$,U],[/(ubuntu) ([\w\.]+) like android/i],[[U,/(.+)/,"$1 Touch"],$],[/(harmonyos)[\/ ]?([\d\.]*)/i,/(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen)\w*[-\/\.; ]?([\d\.]*)/i],[U,$],[/\(bb(10);/i],[$,[U,Wl]],[/(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i],[$,[U,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[$,[U,Cn+" OS"]],[/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i,/webos(?:[ \/]?|\.tv-20(?=2[2-9]))(\d[\d\.]*)/i],[$,[U,"webOS"]],[/web0s;.+?(?:chr[o0]me|safari)\/(\d+)/i],[[$,Te,{25:"120",24:"108",23:"94",22:"87",6:"79",5:"68",4:"53",3:"38",2:"538",1:"537","*":"TV"}],[U,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[$,[U,"watchOS"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[U,"Chrome OS"],$],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) (\w+)/i,/(xbox); +xbox ([^\);]+)/i,/(pico) .+os([\w\.]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/linux.+(mint)[\/\(\) ]?([\w\.]*)/i,/(mageia|vectorlinux|fuchsia|arcaos|arch(?= ?linux))[;l ]([\d\.]*)/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire|knoppix)(?: gnu[\/ ]linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/\b(aix)[; ]([1-9\.]{0,4})/i,/(hurd|linux|morphos)(?: (?:arm|x86|ppc)\w*| ?)([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) ?(r\d)?/i],[U,$],[/(sunos) ?([\d\.]*)/i],[[U,"Solaris"],$],[/\b(beos|os\/2|amigaos|openvms|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[U,$]]},Di=function(){var t={init:{},isIgnore:{},isIgnoreRgx:{},toString:{}};return Be.call(t.init,[[Xt,[U,$,Kn,O]],[Ue,[te]],[xe,[O,R,L]],[ye,[U,$]],[fe,[U,$]]]),Be.call(t.isIgnore,[[Xt,[$,Kn]],[ye,[$]],[fe,[$]]]),Be.call(t.isIgnoreRgx,[[Xt,/ ?browser$/i],[fe,/ ?os$/i]]),Be.call(t.toString,[[Xt,[U,$]],[Ue,[te]],[xe,[L,R]],[ye,[U,$]],[fe,[U,$]]]),t}(),ub=function(t,e){var r=Di.init[e],n=Di.isIgnore[e]||0,i=Di.isIgnoreRgx[e]||0,s=Di.toString[e]||0;function o(){Be.call(this,r)}return o.prototype.getItem=function(){return t},o.prototype.withClientHints=function(){return rr?rr.getHighEntropyValues(Gh).then(function(a){return t.setCH(new qh(a,!1)).parseCH().get()}):t.parseCH().get()},o.prototype.withFeatureCheck=function(){return t.detectFeature().get()},e!=zr&&(o.prototype.is=function(a){var l=!1;for(var h in this)if(this.hasOwnProperty(h)&&!Ho(n,h)&&Me(i?on(i,this[h]):this[h])==Me(i?on(i,a):a)){if(l=!0,a!=ir)break}else if(a==ir&&l){l=!l;break}return l},o.prototype.toString=function(){var a=nn;for(var l in s)typeof this[s[l]]!==ir&&(a+=(a?" ":nn)+this[s[l]]);return a||ir}),rr||(o.prototype.then=function(a){var l=this,h=function(){for(var p in l)l.hasOwnProperty(p)&&(this[p]=l[p])};h.prototype={is:o.prototype.is,toString:o.prototype.toString};var g=new h;return a(g),g}),new o};function qh(t,e){if(t=t||{},Be.call(this,Gh),e)Be.call(this,[[Fa,Zs(t[hr])],[Ha,Zs(t[tb])],[et,/\?1/.test(t[ib])],[R,Dn(t[sb])],[Yr,Dn(t[Wh])],[Va,Dn(t[ob])],[te,Dn(t[eb])],[vr,Zs(t[nb])],[ys,Dn(t[rb])]]);else for(var r in t)this.hasOwnProperty(r)&&typeof t[r]!==ir&&(this[r]=t[r])}function eu(t,e,r,n){return this.get=function(i){return i?this.data.hasOwnProperty(i)?this.data[i]:void 0:this.data},this.set=function(i,s){return this.data[i]=s,this},this.setCH=function(i){return this.uaCH=i,this},this.detectFeature=function(){if(ee&&ee.userAgent==this.ua)switch(this.itemType){case Xt:ee.brave&&typeof ee.brave.isBrave==Yi&&this.set(U,"Brave");break;case xe:!this.get(O)&&rr&&rr[et]&&this.set(O,et),this.get(R)=="Macintosh"&&ee&&typeof ee.standalone!==ir&&ee.maxTouchPoints&&ee.maxTouchPoints>2&&this.set(R,"iPad").set(O,vt);break;case fe:!this.get(U)&&rr&&rr[Yr]&&this.set(U,rr[Yr]);break;case zr:var i=this.data,s=function(o){return i[o].getItem().detectFeature().get()};this.set(Xt,s(Xt)).set(Ue,s(Ue)).set(xe,s(xe)).set(ye,s(ye)).set(fe,s(fe))}return this},this.parseUA=function(){return this.itemType!=zr&&to.call(this.data,this.ua,this.rgxMap),this.itemType==Xt&&this.set(Kn,Xs(this.get($))),this},this.parseCH=function(){var i=this.uaCH,s=this.rgxMap;switch(this.itemType){case Xt:case ye:var o=i[Ha]||i[Fa],a;if(o)for(var l in o){var h=o[l].brand||o[l],g=o[l].version;this.itemType==Xt&&!/not.a.brand/i.test(h)&&(!a||/Chrom/.test(a)&&h!=Jl||a==Li&&/WebView2/.test(h))&&(h=Te(h,lb),a=this.get(U),a&&!/Chrom/.test(a)&&/Chrom/.test(h)||this.set(U,h).set($,g).set(Kn,Xs(g)),a=h),this.itemType==ye&&h==Jl&&this.set($,g)}break;case Ue:var p=i[te];p&&(p&&i[ys]=="64"&&(p+="64"),to.call(this.data,p+";",s));break;case xe:if(i[et]&&this.set(O,et),i[R]&&(this.set(R,i[R]),!this.get(O)||!this.get(L))){var _={};to.call(_,"droid 9; "+i[R]+")",s),!this.get(O)&&_.type&&this.set(O,_.type),!this.get(L)&&_.vendor&&this.set(L,_.vendor)}if(i[vr]){var w;if(typeof i[vr]!="string")for(var b=0;!w&&b<i[vr].length;)w=Te(i[vr][b++],Xl);else w=Te(i[vr],Xl);this.set(O,w)}break;case fe:var E=i[Yr];if(E){var P=i[Va];E==Fo&&(P=parseInt(Xs(P),10)>=13?"11":"10"),this.set(U,E).set($,P)}this.get(U)==Fo&&i[R]=="Xbox"&&this.set(U,"Xbox").set($,void 0);break;case zr:var A=this.data,M=function(z){return A[z].getItem().setCH(i).parseCH().get()};this.set(Xt,M(Xt)).set(Ue,M(Ue)).set(xe,M(xe)).set(ye,M(ye)).set(fe,M(fe))}return this},Be.call(this,[["itemType",t],["ua",e],["uaCH",n],["rgxMap",r],["data",ub(this,t)]]),this}function We(t,e,r){if(typeof t===sn?(Ki(t,!0)?(typeof e===sn&&(r=e),e=t):(r=t,e=void 0),t=void 0):typeof t===$o&&!Ki(e,!0)&&(r=e,e=void 0),r&&typeof r.append===Yi){var n={};r.forEach(function(l,h){n[h]=l}),r=n}if(!(this instanceof We))return new We(t,e,r).getResult();var i=typeof t===$o?t:r&&r[Fl]?r[Fl]:ee&&ee.userAgent?ee.userAgent:nn,s=new qh(r,!0),o=e?cb(tu,e):tu,a=function(l){return l==zr?function(){return new eu(l,i,o,s).set("ua",i).set(Xt,this.getBrowser()).set(Ue,this.getCPU()).set(xe,this.getDevice()).set(ye,this.getEngine()).set(fe,this.getOS()).get()}:function(){return new eu(l,i,o[l],s).parseUA().get()}};return Be.call(this,[["getBrowser",a(Xt)],["getCPU",a(Ue)],["getDevice",a(xe)],["getEngine",a(ye)],["getOS",a(fe)],["getResult",a(zr)],["getUA",function(){return i}],["setUA",function(l){return fn(l)&&(i=l.length>jo?Ji(l,jo):l),this}]]).setUA(i),this}We.VERSION=Xw;We.BROWSER=vs([U,$,Kn,O]);We.CPU=vs([te]);We.DEVICE=vs([R,L,O,Rn,et,Lt,vt,Ie,Ln]);We.ENGINE=We.OS=vs([U,$]);var lt=class{static storage=new Map;static get(t){return this.storage.has(t)||this.storage.set(t,t.getInstance()),this.storage.get(t)}};function Ct(t){return typeof t=="function"}function zh(t){let e=t(r=>{Error.call(r),r.stack=new Error().stack});return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}var eo=zh(t=>function(e){t(this),this.message=e?`${e.length} errors occurred during unsubscription:
|
|
36
|
+
`)+" ".concat(l,"\\").concat(h,"/"))}e.seenObjects[e.seenObjects.length-1].obj=t}if(Array.isArray(t))return Qw(t,e);if(t===void 0)return null;if(t instanceof Date||Nw(t)){var g=t.getTime(),p=g>-1&&g<2534023188e5;return e.legacy?e.relaxed&&p?{$date:t.getTime()}:{$date:Bl(t)}:e.relaxed&&p?{$date:Bl(t)}:{$date:{$numberLong:t.getTime().toString()}}}if(typeof t=="number"&&(!e.relaxed||!isFinite(t))){if(Math.floor(t)===t){var _=t>=$h&&t<=jh,w=t>=Hh&&t<=Fh;if(_)return{$numberInt:t.toString()};if(w)return{$numberLong:t.toString()}}return{$numberDouble:t.toString()}}if(t instanceof RegExp||Dw(t)){var b=t.flags;if(b===void 0){var E=t.toString().match(/[gimuy]*$/);E&&(b=E[0])}var k=new Yn(t.source,b);return k.toExtendedJSON(e)}return t!=null&&typeof t=="object"?Zw(t,e):t}var Xw={Binary:function(t){return new Sr(t.value(),t.sub_type)},Code:function(t){return new fs(t.code,t.scope)},DBRef:function(t){return new zn(t.collection||t.namespace,t.oid,t.db,t.fields)},Decimal128:function(t){return new Ma(t.bytes)},Double:function(t){return new gs(t.value)},Int32:function(t){return new ms(t.value)},Long:function(t){return J.fromBits(t.low!=null?t.low:t.low_,t.low!=null?t.high:t.high_,t.low!=null?t.unsigned:t.unsigned_)},MaxKey:function(){return new Ba},MinKey:function(){return new ja},ObjectID:function(t){return new Kt(t)},ObjectId:function(t){return new Kt(t)},BSONRegExp:function(t){return new Yn(t.pattern,t.options)},Symbol:function(t){return new $a(t.value)},Timestamp:function(t){return Bh.fromBits(t.low,t.high)}};function Zw(t,e){if(t==null||typeof t!="object")throw new Er("not an object instance");var r=t._bsontype;if(typeof r>"u"){var n={};for(var i in t){e.seenObjects.push({propertyName:i,obj:null});try{var s=er(t[i],e);i==="__proto__"?Object.defineProperty(n,i,{value:s,writable:!0,enumerable:!0,configurable:!0}):n[i]=s}finally{e.seenObjects.pop()}}return n}else if(Kw(t)){var o=t;if(typeof o.toExtendedJSON!="function"){var a=Xw[t._bsontype];if(!a)throw new At("Unrecognized or invalid _bsontype: "+t._bsontype);o=a(o)}return r==="Code"&&o.scope?o=new fs(o.code,er(o.scope,e)):r==="DBRef"&&o.oid&&(o=new zn(er(o.collection,e),er(o.oid,e),er(o.db,e),er(o.fields,e))),o.toExtendedJSON(e)}else throw new Er("_bsontype must be a string, but was: "+typeof r)}var jl;(function(t){function e(s,o){var a=Object.assign({},{relaxed:!0,legacy:!1},o);return typeof a.relaxed=="boolean"&&(a.strict=!a.relaxed),typeof a.strict=="boolean"&&(a.relaxed=!a.strict),JSON.parse(s,function(l,h){if(l.indexOf("\0")!==-1)throw new Er("BSON Document field names cannot contain null bytes, found: ".concat(JSON.stringify(l)));return Vh(h,a)})}t.parse=e;function r(s,o,a,l){a!=null&&typeof a=="object"&&(l=a,a=0),o!=null&&typeof o=="object"&&!Array.isArray(o)&&(l=o,o=void 0,a=0);var h=Object.assign({relaxed:!0,legacy:!1},l,{seenObjects:[{propertyName:"(root)",obj:null}]}),g=er(s,h);return JSON.stringify(g,o,a)}t.stringify=r;function n(s,o){return o=o||{},JSON.parse(r(s,o))}t.serialize=n;function i(s,o){return o=o||{},e(JSON.stringify(s),o)}t.deserialize=i})(jl||(jl={}));var $l,Fl=kh();Fl.Map?$l=Fl.Map:$l=function(){function t(e){e===void 0&&(e=[]),this._keys=[],this._values={};for(var r=0;r<e.length;r++)if(e[r]!=null){var n=e[r],i=n[0],s=n[1];this._keys.push(i),this._values[i]={v:s,i:this._keys.length-1}}}return t.prototype.clear=function(){this._keys=[],this._values={}},t.prototype.delete=function(e){var r=this._values[e];return r==null?!1:(delete this._values[e],this._keys.splice(r.i,1),!0)},t.prototype.entries=function(){var e=this,r=0;return{next:function(){var n=e._keys[r++];return{value:n!==void 0?[n,e._values[n].v]:void 0,done:n===void 0}}}},t.prototype.forEach=function(e,r){r=r||this;for(var n=0;n<this._keys.length;n++){var i=this._keys[n];e.call(r,this._values[i].v,i,r)}},t.prototype.get=function(e){return this._values[e]?this._values[e].v:void 0},t.prototype.has=function(e){return this._values[e]!=null},t.prototype.keys=function(){var e=this,r=0;return{next:function(){var n=e._keys[r++];return{value:n!==void 0?n:void 0,done:n===void 0}}}},t.prototype.set=function(e,r){return this._values[e]?(this._values[e].v=r,this):(this._keys.push(e),this._values[e]={v:r,i:this._keys.length-1},this)},t.prototype.values=function(){var e=this,r=0;return{next:function(){var n=e._keys[r++];return{value:n!==void 0?e._values[n].v:void 0,done:n===void 0}}}},Object.defineProperty(t.prototype,"size",{get:function(){return this._keys.length},enumerable:!1,configurable:!0}),t}();var AE=J.fromNumber(Ow),OE=J.fromNumber(Pw),Vs=new Uint8Array(8),PE=new DataView(Vs.buffer,Vs.byteOffset,Vs.byteLength),tb=1024*1024*17,kE=ut.alloc(tb),Fa=class{triggerID;nudgeID;engagementID;contentID;shortID;contentType;variation;props;objective;onsiteDeliveryType;holdout;constructor(t){t=t||{},this.triggerID=t.id||t.triggerID,this.nudgeID=t.nudgeID,this.shortID=t.shortID,this.contentType=t.contentType,this.engagementID=t.engagementID,this.contentID=t.contentID,this.variation=t.variation,this.props=t.props,this.objective=t.objective,this.onsiteDeliveryType=t.onsiteDeliveryType,this.holdout=t.holdout}},jt=class{constructor(t,e={},r,n){this.name=t,this.properties=e,this.id=n?new Kt(n):new Kt,this.occurred=new Date,r&&(this.trigger=new Fa(r)),this.newEvent=!n}trigger;items;videos;id;newEvent;cart;currentItem;deviceProps;landingPage;occurred;page;sessionID;sessionNumber;locale},ye=class{static SWIPER_CSS="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css";static injectScriptURL(t,e){if(!t)return;let r=document.createElement("script");r.id=e??"",r.src=t,Pe.mode==="local"&&(r.type="module"),document.head.appendChild(r)}static injectRawScript(t){if(!t)return;let e=document.createElement("script");e.id="cooee-app-script",e.innerHTML=t,document.head.appendChild(e)}static injectRawCSS(t,e=document.head){if(!t)return;let r=document.createElement("style");r.textContent=t,e.appendChild(r)}static injectSwiperCSS(t=document.head){this.injectStylesheet(this.SWIPER_CSS,t)}static injectStylesheet(t,e=document.head){if(!t)return;let r=document.createElement("link");r.rel="stylesheet",r.href=t,t===this.SWIPER_CSS&&(r.crossOrigin="anonymous",r.onload=n=>{let i=n.currentTarget?.sheet?.cssRules;if(i){for(let s of i)if(s.type==CSSRule.FONT_FACE_RULE){let o=t.split("/"),a=o.slice(0,o.length-1).join("/"),l=s.cssText;l=l.replace(/url\s*\(\s*['"]?(?!((\/)|((?:https?:)?\/\/)|(?:data:?:)))([^'")]+)['"]?\s*\)/g,`url("${a}/$4")`);let h=document.createElement("style");h.appendChild(document.createTextNode(l)),document.head.appendChild(h)}}}),e.appendChild(r)}static async loadSwiperScript(){window.CooeeSDK.Swiper||(window.CooeeSDK.Swiper=(await import("https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.mjs")).Swiper)}},eb="2.0.4",$o=500,Hl="user-agent",nn="",Vl="?",Yi="function",ir="undefined",sn="object",Fo="string",Zt="browser",Ue="cpu",xe="device",me="engine",fe="os",zr="result",U="name",O="type",L="vendor",$="version",te="architecture",Kn="major",R="model",Rn="console",et="mobile",vt="tablet",Lt="smarttv",Ie="wearable",Ci="xr",Ln="embedded",En="inapp",Ha="brands",vr="formFactors",Va="fullVersionList",Yr="platform",Wa="platformVersion",ys="bitness",hr="sec-ch-ua",rb=hr+"-full-version-list",nb=hr+"-arch",ib=hr+"-"+ys,sb=hr+"-form-factors",ob=hr+"-"+et,ab=hr+"-"+R,Wh=hr+"-"+Yr,cb=Wh+"-version",Gh=[Ha,Va,et,R,Yr,Wa,te,vr,ys],Ti="Amazon",$r="Apple",Wl="ASUS",Gl="BlackBerry",gr="Google",ql="Huawei",Ws="Lenovo",zl="Honor",xi="LG",Gs="Microsoft",qs="Motorola",zs="Nvidia",Yl="OnePlus",Ys="OPPO",Sn="Samsung",Kl="Sharp",In="Sony",Ks="Xiaomi",Js="Zebra",Jl="Chrome",Ql="Chromium",Je="Chromecast",Li="Edge",Cn="Firefox",Tn="Opera",Qs="Facebook",Xl="Sogou",Fr="Mobile ",xn=" Browser",Ho="Windows",lb=typeof window!==ir,ee=lb&&window.navigator?window.navigator:void 0,rr=ee&&ee.userAgentData?ee.userAgentData:void 0,ub=function(t,e){var r={},n=e;if(!Ki(e)){n={};for(var i in e)for(var s in e[i])n[s]=e[i][s].concat(n[s]?n[s]:[])}for(var o in t)r[o]=n[o]&&n[o].length%2===0?n[o].concat(t[o]):t[o];return r},vs=function(t){for(var e={},r=0;r<t.length;r++)e[t[r].toUpperCase()]=t[r];return e},Vo=function(t,e){if(typeof t===sn&&t.length>0){for(var r in t)if(Me(e)==Me(t[r]))return!0;return!1}return fn(t)?Me(e)==Me(t):!1},Ki=function(t,e){for(var r in t)return/^(browser|cpu|device|engine|os)$/.test(r)||(e?Ki(t[r]):!1)},fn=function(t){return typeof t===Fo},Xs=function(t){if(t){for(var e=[],r=on(/\\?\"/g,t).split(","),n=0;n<r.length;n++)if(r[n].indexOf(";")>-1){var i=Ji(r[n]).split(";v=");e[n]={brand:i[0],version:i[1]}}else e[n]=Ji(r[n]);return e}},Me=function(t){return fn(t)?t.toLowerCase():t},Zs=function(t){return fn(t)?on(/[^\d\.]/g,t).split(".")[0]:void 0},Be=function(t){for(var e in t){var r=t[e];typeof r==sn&&r.length==2?this[r[0]]=r[1]:this[r]=void 0}return this},on=function(t,e){return fn(e)?e.replace(t,nn):e},Dn=function(t){return on(/\\?\"/g,t)},Ji=function(t,e){if(fn(t))return t=on(/^\s\s*/,t),typeof e===ir?t:t.substring(0,$o)},to=function(t,e){if(!(!t||!e))for(var r=0,n,i,s,o,a,l;r<e.length&&!a;){var h=e[r],g=e[r+1];for(n=i=0;n<h.length&&!a&&h[n];)if(a=h[n++].exec(t),a)for(s=0;s<g.length;s++)l=a[++i],o=g[s],typeof o===sn&&o.length>0?o.length===2?typeof o[1]==Yi?this[o[0]]=o[1].call(this,l):this[o[0]]=o[1]:o.length>=3&&(typeof o[1]===Yi&&!(o[1].exec&&o[1].test)?o.length>3?this[o[0]]=l?o[1].apply(this,o.slice(2)):void 0:this[o[0]]=l?o[1].call(this,l,o[2]):void 0:o.length==3?this[o[0]]=l?l.replace(o[1],o[2]):void 0:o.length==4?this[o[0]]=l?o[3].call(this,l.replace(o[1],o[2])):void 0:o.length>4&&(this[o[0]]=l?o[3].apply(this,[l.replace(o[1],o[2])].concat(o.slice(4))):void 0)):this[o]=l||void 0;r+=2}},Te=function(t,e){for(var r in e)if(typeof e[r]===sn&&e[r].length>0){for(var n=0;n<e[r].length;n++)if(Vo(e[r][n],t))return r===Vl?void 0:r}else if(Vo(e[r],t))return r===Vl?void 0:r;return e.hasOwnProperty("*")?e["*"]:t},Zl={ME:"4.90","NT 3.51":"3.51","NT 4.0":"4.0",2e3:["5.0","5.01"],XP:["5.1","5.2"],Vista:"6.0",7:"6.1",8:"6.2","8.1":"6.3",10:["6.4","10.0"],NT:""},tu={embedded:"Automotive",mobile:"Mobile",tablet:["Tablet","EInk"],smarttv:"TV",wearable:"Watch",xr:["VR","XR"],"?":["Desktop","Unknown"],"*":void 0},hb={Chrome:"Google Chrome",Edge:"Microsoft Edge","Edge WebView2":"Microsoft Edge WebView2","Chrome WebView":"Android WebView","Chrome Headless":"HeadlessChrome","Huawei Browser":"HuaweiBrowser","MIUI Browser":"Miui Browser","Opera Mobi":"OperaMobile",Yandex:"YaBrowser"},eu={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[$,[U,Fr+"Chrome"]],[/webview.+edge\/([\w\.]+)/i],[$,[U,Li+" WebView"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[$,[U,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[U,$],[/opios[\/ ]+([\w\.]+)/i],[$,[U,Tn+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[$,[U,Tn+" GX"]],[/\bopr\/([\w\.]+)/i],[$,[U,Tn]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[$,[U,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[$,[U,"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|otter|dooble|(?:lg |qute)browser)\/([-\w\.]+)/i,/(heytap|ovi|115|surf)browser\/([\d\.]+)/i,/(ecosia|weibo)(?:__| \w+@)([\d\.]+)/i],[U,$],[/quark(?:pc)?\/([-\w\.]+)/i],[$,[U,"Quark"]],[/\bddg\/([\w\.]+)/i],[$,[U,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[$,[U,"UCBrowser"]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[$,[U,"WeChat"]],[/konqueror\/([\w\.]+)/i],[$,[U,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[$,[U,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[$,[U,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[$,[U,"Smart "+Ws+xn]],[/(avast|avg)\/([\w\.]+)/i],[[U,/(.+)/,"$1 Secure"+xn],$],[/\bfocus\/([\w\.]+)/i],[$,[U,Cn+" Focus"]],[/\bopt\/([\w\.]+)/i],[$,[U,Tn+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[$,[U,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[$,[U,"Dolphin"]],[/coast\/([\w\.]+)/i],[$,[U,Tn+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[$,[U,"MIUI"+xn]],[/fxios\/([\w\.-]+)/i],[$,[U,Fr+Cn]],[/\bqihoobrowser\/?([\w\.]*)/i],[$,[U,"360"]],[/\b(qq)\/([\w\.]+)/i],[[U,/(.+)/,"$1Browser"],$],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[U,/(.+)/,"$1"+xn],$],[/samsungbrowser\/([\w\.]+)/i],[$,[U,Sn+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[$,[U,Xl+" Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[U,Xl+" Mobile"],$],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[U,$],[/(lbbrowser|rekonq)/i],[U],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[$,U],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[U,Qs],$,[O,En]],[/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/(daum)apps[\/ ]([\w\.]+)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(instagram|snapchat|klarna)[\/ ]([-\w\.]+)/i],[U,$,[O,En]],[/\bgsa\/([\w\.]+) .*safari\//i],[$,[U,"GSA"],[O,En]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[$,[U,"TikTok"],[O,En]],[/\[(linkedin)app\]/i],[U,[O,En]],[/(chromium)[\/ ]([-\w\.]+)/i],[U,$],[/headlesschrome(?:\/([\w\.]+)| )/i],[$,[U,Jl+" Headless"]],[/wv\).+chrome\/([\w\.]+).+edgw\//i],[$,[U,Li+" WebView2"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[U,Jl+" WebView"],$],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[$,[U,"Android"+xn]],[/chrome\/([\w\.]+) mobile/i],[$,[U,Fr+"Chrome"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[U,$],[/version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i],[$,[U,Fr+"Safari"]],[/iphone .*mobile(?:\/\w+ | ?)safari/i],[[U,Fr+"Safari"]],[/version\/([\w\.\,]+) .*(safari)/i],[$,U],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[U,[$,"1"]],[/(webkit|khtml)\/([\w\.]+)/i],[U,$],[/(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i],[[U,Fr+Cn],$],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[U,"Netscape"],$],[/(wolvic|librewolf)\/([\w\.]+)/i],[U,$],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[$,[U,Cn+" 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,/(amaya|dillo|doris|icab|ladybird|lynx|mosaic|netsurf|obigo|polaris|w3m|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/\b(links) \(([\w\.]+)/i],[U,[$,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[U,[$,/[^\d\.]+./,nn]]],cpu:[[/\b((amd|x|x86[-_]?|wow|win)64)\b/i],[[te,"amd64"]],[/(ia32(?=;))/i,/\b((i[346]|x)86)(pc)?\b/i],[[te,"ia32"]],[/\b(aarch64|arm(v?[89]e?l?|_?64))\b/i],[[te,"arm64"]],[/\b(arm(v[67])?ht?n?[fl]p?)\b/i],[[te,"armhf"]],[/( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i],[[te,"arm"]],[/((ppc|powerpc)(64)?)( mac|;|\))/i],[[te,/ower/,nn,Me]],[/ sun4\w[;\)]/i],[[te,"sparc"]],[/\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i],[[te,Me]]],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],[R,[L,Sn],[O,vt]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr]|browser)[-\w]+)/i,/sec-(sgh\w+)/i],[R,[L,Sn],[O,et]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[R,[L,$r],[O,et]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[R,[L,$r],[O,vt]],[/(macintosh);/i],[R,[L,$r]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[R,[L,Kl],[O,et]],[/\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i],[R,[L,zl],[O,vt]],[/honor([-\w ]+)[;\)]/i],[R,[L,zl],[O,et]],[/\b((?:ag[rs][2356]?k?|bah[234]?|bg[2o]|bt[kv]|cmr|cpn|db[ry]2?|jdn2|got|kob2?k?|mon|pce|scm|sht?|[tw]gr|vrd)-[ad]?[lw][0125][09]b?|605hw|bg2-u03|(?:gem|fdr|m2|ple|t1)-[7a]0[1-4][lu]|t1-a2[13][lw]|mediapad[\w\. ]*(?= bui|\)))\b(?!.+d\/s)/i],[R,[L,ql],[O,vt]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[R,[L,ql],[O,et]],[/oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i,/\b((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i],[[R,/_/g," "],[L,Ks],[O,vt]],[/\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,/ ([\w ]+) miui\/v?\d/i],[[R,/_/g," "],[L,Ks],[O,et]],[/droid.+; (cph2[3-6]\d[13579]|((gm|hd)19|(ac|be|in|kb)20|(d[en]|eb|le|mt)21|ne22)[0-2]\d|p[g-k]\w[1m]10)\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[R,[L,Yl],[O,et]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[R,[L,Ys],[O,et]],[/\b(opd2(\d{3}a?))(?: bui|\))/i],[R,[L,Te,{OnePlus:["203","304","403","404","413","415"],"*":Ys}],[O,vt]],[/(vivo (5r?|6|8l?|go|one|s|x[il]?[2-4]?)[\w\+ ]*)(?: bui|\))/i],[R,[L,"BLU"],[O,et]],[/; vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[R,[L,"Vivo"],[O,et]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[R,[L,"Realme"],[O,et]],[/(ideatab[-\w ]+|602lv|d-42a|a101lv|a2109a|a3500-hv|s[56]000|pb-6505[my]|tb-?x?\d{3,4}(?:f[cu]|xu|[av])|yt\d?-[jx]?\d+[lfmx])( bui|;|\)|\/)/i,/lenovo ?(b[68]0[08]0-?[hf]?|tab(?:[\w- ]+?)|tb[\w-]{6,7})( bui|;|\)|\/)/i],[R,[L,Ws],[O,vt]],[/lenovo[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i],[R,[L,Ws],[O,et]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ]([\w\s]+)(\)| bui)/i,/((?:moto(?! 360)[-\w\(\) ]+|xt\d{3,4}[cgkosw\+]?[-\d]*|nexus 6)(?= bui|\)))/i],[R,[L,qs],[O,et]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[R,[L,qs],[O,vt]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[R,[L,xi],[O,vt]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+(?!.*(?:browser|netcast|android tv|watch|webos))(\w+)/i,/\blg-?([\d\w]+) bui/i],[R,[L,xi],[O,et]],[/(nokia) (t[12][01])/i],[L,R,[O,vt]],[/(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i,/nokia[-_ ]?(([-\w\. ]*))/i],[[R,/_/g," "],[O,et],[L,"Nokia"]],[/(pixel (c|tablet))\b/i],[R,[L,gr],[O,vt]],[/droid.+;(?: google)? (g(01[13]a|020[aem]|025[jn]|1b60|1f8f|2ybb|4s1m|576d|5nz6|8hhn|8vou|a02099|c15s|d1yq|e2ae|ec77|gh2x|kv4x|p4bc|pj41|r83y|tt9q|ur25|wvk6)|pixel[\d ]*a?( pro)?( xl)?( fold)?( \(5g\))?)( bui|\))/i],[R,[L,gr],[O,et]],[/(google) (pixelbook( go)?)/i],[L,R],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-\w\w\d\d)(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[R,[L,In],[O,et]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[R,"Xperia Tablet"],[L,In],[O,vt]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[R,[L,Ti],[O,vt]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[R,/(.+)/g,"Fire Phone $1"],[L,Ti],[O,et]],[/(playbook);[-\w\),; ]+(rim)/i],[R,L,[O,vt]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[R,[L,Gl],[O,et]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[R,[L,Wl],[O,vt]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[R,[L,Wl],[O,et]],[/(nexus 9)/i],[R,[L,"HTC"],[O,vt]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[L,[R,/_/g," "],[O,et]],[/tcl (xess p17aa)/i,/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])(_\w(\w|\w\w))?(\)| bui)/i],[R,[L,"TCL"],[O,vt]],[/droid [\w\.]+; (418(?:7d|8v)|5087z|5102l|61(?:02[dh]|25[adfh]|27[ai]|56[dh]|59k|65[ah])|a509dl|t(?:43(?:0w|1[adepqu])|50(?:6d|7[adju])|6(?:09dl|10k|12b|71[efho]|76[hjk])|7(?:66[ahju]|67[hw]|7[045][bh]|71[hk]|73o|76[ho]|79w|81[hks]?|82h|90[bhsy]|99b)|810[hs]))(_\w(\w|\w\w))?(\)| bui)/i],[R,[L,"TCL"],[O,et]],[/(itel) ((\w+))/i],[[L,Me],R,[O,Te,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[R,[L,"Acer"],[O,vt]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[R,[L,"Meizu"],[O,et]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[R,[L,"Ulefone"],[O,et]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[R,[L,"Energizer"],[O,et]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[R,[L,"Cat"],[O,et]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[R,[L,"Smartfren"],[O,et]],[/droid.+; (a(in)?(0(15|59|6[35])|142)p?)/i],[R,[L,"Nothing"],[O,et]],[/; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i,/archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i],[R,[L,"Archos"],[O,vt]],[/archos ([\w ]+)( b|\))/i,/; (ac[3-6]\d\w{2,8})( b|\))/i],[R,[L,"Archos"],[O,et]],[/; (n159v)/i],[R,[L,"HMD"],[O,et]],[/(imo) (tab \w+)/i,/(infinix|tecno) (x1101b?|p904|dp(7c|8d|10a)( pro)?|p70[1-3]a?|p904|t1101)/i],[L,R,[O,vt]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus(?! zenw)|dell|jolla|meizu|motorola|polytron|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (blu|hmd|imo|infinix|lava|oneplus|tcl)[_ ]([\w\+ ]+?)(?: bui|\)|; r)/i,/(hp) ([\w ]+\w)/i,/(microsoft); (lumia[\w ]+)/i,/(oppo) ?([\w ]+) bui/i],[L,R,[O,et]],[/(kobo)\s(ereader|touch)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i],[L,R,[O,vt]],[/(surface duo)/i],[R,[L,Gs],[O,vt]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[R,[L,"Fairphone"],[O,et]],[/((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i],[R,[L,zs],[O,vt]],[/(sprint) (\w+)/i],[L,R,[O,et]],[/(kin\.[onetw]{3})/i],[[R,/\./g," "],[L,Gs],[O,et]],[/droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[R,[L,Js],[O,vt]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[R,[L,Js],[O,et]],[/smart-tv.+(samsung)/i],[L,[O,Lt]],[/hbbtv.+maple;(\d+)/i],[[R,/^/,"SmartTV"],[L,Sn],[O,Lt]],[/(vizio)(?: |.+model\/)(\w+-\w+)/i,/tcast.+(lg)e?. ([-\w]+)/i],[L,R,[O,Lt]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[L,xi],[O,Lt]],[/(apple) ?tv/i],[L,[R,$r+" TV"],[O,Lt]],[/crkey.*devicetype\/chromecast/i],[[R,Je+" Third Generation"],[L,gr],[O,Lt]],[/crkey.*devicetype\/([^/]*)/i],[[R,/^/,"Chromecast "],[L,gr],[O,Lt]],[/fuchsia.*crkey/i],[[R,Je+" Nest Hub"],[L,gr],[O,Lt]],[/crkey/i],[[R,Je],[L,gr],[O,Lt]],[/(portaltv)/i],[R,[L,Qs],[O,Lt]],[/droid.+aft(\w+)( bui|\))/i],[R,[L,Ti],[O,Lt]],[/(shield \w+ tv)/i],[R,[L,zs],[O,Lt]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[R,[L,Kl],[O,Lt]],[/(bravia[\w ]+)( bui|\))/i],[R,[L,In],[O,Lt]],[/(mi(tv|box)-?\w+) bui/i],[R,[L,Ks],[O,Lt]],[/Hbbtv.*(technisat) (.*);/i],[L,R,[O,Lt]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[L,/.+\/(\w+)/,"$1",Te,{LG:"lge"}],[R,Ji],[O,Lt]],[/droid.+; ([\w- ]+) (?:android tv|smart[- ]?tv)/i],[R,[O,Lt]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:|large screen[\w ]+safari)\b/i],[[O,Lt]],[/(playstation \w+)/i],[R,[L,In],[O,Rn]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[R,[L,Gs],[O,Rn]],[/(ouya)/i,/(nintendo) (\w+)/i,/(retroid) (pocket ([^\)]+))/i],[L,R,[O,Rn]],[/droid.+; (shield)( bui|\))/i],[R,[L,zs],[O,Rn]],[/\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i],[R,[L,Sn],[O,Ie]],[/((pebble))app/i,/(asus|google|lg|oppo) ((pixel |zen)?watch[\w ]*)( bui|\))/i],[L,R,[O,Ie]],[/(ow(?:19|20)?we?[1-3]{1,3})/i],[R,[L,Ys],[O,Ie]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[R,[L,$r],[O,Ie]],[/(opwwe\d{3})/i],[R,[L,Yl],[O,Ie]],[/(moto 360)/i],[R,[L,qs],[O,Ie]],[/(smartwatch 3)/i],[R,[L,In],[O,Ie]],[/(g watch r)/i],[R,[L,xi],[O,Ie]],[/droid.+; (wt63?0{2,3})\)/i],[R,[L,Js],[O,Ie]],[/droid.+; (glass) \d/i],[R,[L,gr],[O,Ci]],[/(pico) (4|neo3(?: link|pro)?)/i],[L,R,[O,Ci]],[/(quest( \d| pro)?s?).+vr/i],[R,[L,Qs],[O,Ci]],[/mobile vr; rv.+firefox/i],[[O,Ci]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[L,[O,Ln]],[/(aeobc)\b/i],[R,[L,Ti],[O,Ln]],[/(homepod).+mac os/i],[R,[L,$r],[O,Ln]],[/windows iot/i],[[O,Ln]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+?(mobile|vr|\d) safari/i],[R,[O,Te,{mobile:"Mobile",xr:"VR","*":vt}]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[O,vt]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[O,et]],[/droid .+?; ([\w\. -]+)( bui|\))/i],[R,[L,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[$,[U,Li+"HTML"]],[/(arkweb)\/([\w\.]+)/i],[U,$],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[$,[U,"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],[U,$],[/ladybird\//i],[[U,"LibWeb"]],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[$,U]],os:[[/(windows nt) (6\.[23]); arm/i],[[U,/N/,"R"],[$,Te,Zl]],[/(windows (?:phone|mobile|iot))(?: os)?[\/ ]?([\d\.]*( se)?)/i,/(windows)[\/ ](1[01]|2000|3\.1|7|8(\.1)?|9[58]|me|server 20\d\d( r2)?|vista|xp)/i],[U,$],[/windows nt ?([\d\.\)]*)(?!.+xbox)/i,/\bwin(?=3| ?9|n)(?:nt| 9x )?([\d\.;]*)/i],[[$,/(;|\))/g,"",Te,Zl],[U,Ho]],[/(windows ce)\/?([\d\.]*)/i],[U,$],[/[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[$,/_/g,"."],[U,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+(haiku|morphos))/i],[[U,"macOS"],[$,/_/g,"."]],[/android ([\d\.]+).*crkey/i],[$,[U,Je+" Android"]],[/fuchsia.*crkey\/([\d\.]+)/i],[$,[U,Je+" Fuchsia"]],[/crkey\/([\d\.]+).*devicetype\/smartspeaker/i],[$,[U,Je+" SmartSpeaker"]],[/linux.*crkey\/([\d\.]+)/i],[$,[U,Je+" Linux"]],[/crkey\/([\d\.]+)/i],[$,[U,Je]],[/droid ([\w\.]+)\b.+(android[- ]x86)/i],[$,U],[/(ubuntu) ([\w\.]+) like android/i],[[U,/(.+)/,"$1 Touch"],$],[/(harmonyos)[\/ ]?([\d\.]*)/i,/(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen)\w*[-\/\.; ]?([\d\.]*)/i],[U,$],[/\(bb(10);/i],[$,[U,Gl]],[/(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i],[$,[U,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[$,[U,Cn+" OS"]],[/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i,/webos(?:[ \/]?|\.tv-20(?=2[2-9]))(\d[\d\.]*)/i],[$,[U,"webOS"]],[/web0s;.+?(?:chr[o0]me|safari)\/(\d+)/i],[[$,Te,{25:"120",24:"108",23:"94",22:"87",6:"79",5:"68",4:"53",3:"38",2:"538",1:"537","*":"TV"}],[U,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[$,[U,"watchOS"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[U,"Chrome OS"],$],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) (\w+)/i,/(xbox); +xbox ([^\);]+)/i,/(pico) .+os([\w\.]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/linux.+(mint)[\/\(\) ]?([\w\.]*)/i,/(mageia|vectorlinux|fuchsia|arcaos|arch(?= ?linux))[;l ]([\d\.]*)/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire|knoppix)(?: gnu[\/ ]linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/\b(aix)[; ]([1-9\.]{0,4})/i,/(hurd|linux|morphos)(?: (?:arm|x86|ppc)\w*| ?)([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) ?(r\d)?/i],[U,$],[/(sunos) ?([\d\.]*)/i],[[U,"Solaris"],$],[/\b(beos|os\/2|amigaos|openvms|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[U,$]]},Di=function(){var t={init:{},isIgnore:{},isIgnoreRgx:{},toString:{}};return Be.call(t.init,[[Zt,[U,$,Kn,O]],[Ue,[te]],[xe,[O,R,L]],[me,[U,$]],[fe,[U,$]]]),Be.call(t.isIgnore,[[Zt,[$,Kn]],[me,[$]],[fe,[$]]]),Be.call(t.isIgnoreRgx,[[Zt,/ ?browser$/i],[fe,/ ?os$/i]]),Be.call(t.toString,[[Zt,[U,$]],[Ue,[te]],[xe,[L,R]],[me,[U,$]],[fe,[U,$]]]),t}(),pb=function(t,e){var r=Di.init[e],n=Di.isIgnore[e]||0,i=Di.isIgnoreRgx[e]||0,s=Di.toString[e]||0;function o(){Be.call(this,r)}return o.prototype.getItem=function(){return t},o.prototype.withClientHints=function(){return rr?rr.getHighEntropyValues(Gh).then(function(a){return t.setCH(new qh(a,!1)).parseCH().get()}):t.parseCH().get()},o.prototype.withFeatureCheck=function(){return t.detectFeature().get()},e!=zr&&(o.prototype.is=function(a){var l=!1;for(var h in this)if(this.hasOwnProperty(h)&&!Vo(n,h)&&Me(i?on(i,this[h]):this[h])==Me(i?on(i,a):a)){if(l=!0,a!=ir)break}else if(a==ir&&l){l=!l;break}return l},o.prototype.toString=function(){var a=nn;for(var l in s)typeof this[s[l]]!==ir&&(a+=(a?" ":nn)+this[s[l]]);return a||ir}),rr||(o.prototype.then=function(a){var l=this,h=function(){for(var p in l)l.hasOwnProperty(p)&&(this[p]=l[p])};h.prototype={is:o.prototype.is,toString:o.prototype.toString};var g=new h;return a(g),g}),new o};function qh(t,e){if(t=t||{},Be.call(this,Gh),e)Be.call(this,[[Ha,Xs(t[hr])],[Va,Xs(t[rb])],[et,/\?1/.test(t[ob])],[R,Dn(t[ab])],[Yr,Dn(t[Wh])],[Wa,Dn(t[cb])],[te,Dn(t[nb])],[vr,Xs(t[sb])],[ys,Dn(t[ib])]]);else for(var r in t)this.hasOwnProperty(r)&&typeof t[r]!==ir&&(this[r]=t[r])}function ru(t,e,r,n){return this.get=function(i){return i?this.data.hasOwnProperty(i)?this.data[i]:void 0:this.data},this.set=function(i,s){return this.data[i]=s,this},this.setCH=function(i){return this.uaCH=i,this},this.detectFeature=function(){if(ee&&ee.userAgent==this.ua)switch(this.itemType){case Zt:ee.brave&&typeof ee.brave.isBrave==Yi&&this.set(U,"Brave");break;case xe:!this.get(O)&&rr&&rr[et]&&this.set(O,et),this.get(R)=="Macintosh"&&ee&&typeof ee.standalone!==ir&&ee.maxTouchPoints&&ee.maxTouchPoints>2&&this.set(R,"iPad").set(O,vt);break;case fe:!this.get(U)&&rr&&rr[Yr]&&this.set(U,rr[Yr]);break;case zr:var i=this.data,s=function(o){return i[o].getItem().detectFeature().get()};this.set(Zt,s(Zt)).set(Ue,s(Ue)).set(xe,s(xe)).set(me,s(me)).set(fe,s(fe))}return this},this.parseUA=function(){return this.itemType!=zr&&to.call(this.data,this.ua,this.rgxMap),this.itemType==Zt&&this.set(Kn,Zs(this.get($))),this},this.parseCH=function(){var i=this.uaCH,s=this.rgxMap;switch(this.itemType){case Zt:case me:var o=i[Va]||i[Ha],a;if(o)for(var l in o){var h=o[l].brand||o[l],g=o[l].version;this.itemType==Zt&&!/not.a.brand/i.test(h)&&(!a||/Chrom/.test(a)&&h!=Ql||a==Li&&/WebView2/.test(h))&&(h=Te(h,hb),a=this.get(U),a&&!/Chrom/.test(a)&&/Chrom/.test(h)||this.set(U,h).set($,g).set(Kn,Zs(g)),a=h),this.itemType==me&&h==Ql&&this.set($,g)}break;case Ue:var p=i[te];p&&(p&&i[ys]=="64"&&(p+="64"),to.call(this.data,p+";",s));break;case xe:if(i[et]&&this.set(O,et),i[R]&&(this.set(R,i[R]),!this.get(O)||!this.get(L))){var _={};to.call(_,"droid 9; "+i[R]+")",s),!this.get(O)&&_.type&&this.set(O,_.type),!this.get(L)&&_.vendor&&this.set(L,_.vendor)}if(i[vr]){var w;if(typeof i[vr]!="string")for(var b=0;!w&&b<i[vr].length;)w=Te(i[vr][b++],tu);else w=Te(i[vr],tu);this.set(O,w)}break;case fe:var E=i[Yr];if(E){var k=i[Wa];E==Ho&&(k=parseInt(Zs(k),10)>=13?"11":"10"),this.set(U,E).set($,k)}this.get(U)==Ho&&i[R]=="Xbox"&&this.set(U,"Xbox").set($,void 0);break;case zr:var A=this.data,M=function(z){return A[z].getItem().setCH(i).parseCH().get()};this.set(Zt,M(Zt)).set(Ue,M(Ue)).set(xe,M(xe)).set(me,M(me)).set(fe,M(fe))}return this},Be.call(this,[["itemType",t],["ua",e],["uaCH",n],["rgxMap",r],["data",pb(this,t)]]),this}function We(t,e,r){if(typeof t===sn?(Ki(t,!0)?(typeof e===sn&&(r=e),e=t):(r=t,e=void 0),t=void 0):typeof t===Fo&&!Ki(e,!0)&&(r=e,e=void 0),r&&typeof r.append===Yi){var n={};r.forEach(function(l,h){n[h]=l}),r=n}if(!(this instanceof We))return new We(t,e,r).getResult();var i=typeof t===Fo?t:r&&r[Hl]?r[Hl]:ee&&ee.userAgent?ee.userAgent:nn,s=new qh(r,!0),o=e?ub(eu,e):eu,a=function(l){return l==zr?function(){return new ru(l,i,o,s).set("ua",i).set(Zt,this.getBrowser()).set(Ue,this.getCPU()).set(xe,this.getDevice()).set(me,this.getEngine()).set(fe,this.getOS()).get()}:function(){return new ru(l,i,o[l],s).parseUA().get()}};return Be.call(this,[["getBrowser",a(Zt)],["getCPU",a(Ue)],["getDevice",a(xe)],["getEngine",a(me)],["getOS",a(fe)],["getResult",a(zr)],["getUA",function(){return i}],["setUA",function(l){return fn(l)&&(i=l.length>$o?Ji(l,$o):l),this}]]).setUA(i),this}We.VERSION=eb;We.BROWSER=vs([U,$,Kn,O]);We.CPU=vs([te]);We.DEVICE=vs([R,L,O,Rn,et,Lt,vt,Ie,Ln]);We.ENGINE=We.OS=vs([U,$]);var lt=class{static storage=new Map;static get(t){return this.storage.has(t)||this.storage.set(t,t.getInstance()),this.storage.get(t)}};function Ct(t){return typeof t=="function"}function zh(t){let e=t(r=>{Error.call(r),r.stack=new Error().stack});return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}var eo=zh(t=>function(e){t(this),this.message=e?`${e.length} errors occurred during unsubscription:
|
|
37
37
|
${e.map((r,n)=>`${n+1}) ${r.toString()}`).join(`
|
|
38
|
-
`)}`:"",this.name="UnsubscriptionError",this.errors=e});function Qi(t,e){if(t){let r=t.indexOf(e);0<=r&&t.splice(r,1)}}var Or=class Vo{constructor(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}unsubscribe(){let e;if(!this.closed){this.closed=!0;let{_parentage:r}=this;if(r)if(this._parentage=null,Array.isArray(r))for(let s of r)s.remove(this);else r.remove(this);let{initialTeardown:n}=this;if(Ct(n))try{n()}catch(s){e=s instanceof eo?s.errors:[s]}let{_finalizers:i}=this;if(i){this._finalizers=null;for(let s of i)try{ru(s)}catch(o){e=e??[],o instanceof eo?e=[...e,...o.errors]:e.push(o)}}if(e)throw new eo(e)}}add(e){var r;if(e&&e!==this)if(this.closed)ru(e);else{if(e instanceof Vo){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(e)}}_hasParent(e){let{_parentage:r}=this;return r===e||Array.isArray(r)&&r.includes(e)}_addParent(e){let{_parentage:r}=this;this._parentage=Array.isArray(r)?(r.push(e),r):r?[r,e]:e}_removeParent(e){let{_parentage:r}=this;r===e?this._parentage=null:Array.isArray(r)&&Qi(r,e)}remove(e){let{_finalizers:r}=this;r&&Qi(r,e),e instanceof Vo&&e._removeParent(this)}};Or.EMPTY=(()=>{let t=new Or;return t.closed=!0,t})();var Yh=Or.EMPTY;function Kh(t){return t instanceof Or||t&&"closed"in t&&Ct(t.remove)&&Ct(t.add)&&Ct(t.unsubscribe)}function ru(t){Ct(t)?t():t.unsubscribe()}var Rr={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},Zi={setTimeout(t,e,...r){let{delegate:n}=Zi;return n?.setTimeout?n.setTimeout(t,e,...r):setTimeout(t,e,...r)},clearTimeout(t){let{delegate:e}=Zi;return(e?.clearTimeout||clearTimeout)(t)},delegate:void 0};function Jh(t){Zi.setTimeout(()=>{let{onUnhandledError:e}=Rr;if(e)e(t);else throw t})}function nu(){}var hb=Wa("C",void 0,void 0);function pb(t){return Wa("E",void 0,t)}function db(t){return Wa("N",t,void 0)}function Wa(t,e,r){return{kind:t,value:e,error:r}}var wr=null;function Ui(t){if(Rr.useDeprecatedSynchronousErrorHandling){let e=!wr;if(e&&(wr={errorThrown:!1,error:null}),t(),e){let{errorThrown:r,error:n}=wr;if(wr=null,r)throw n}}else t()}function fb(t){Rr.useDeprecatedSynchronousErrorHandling&&wr&&(wr.errorThrown=!0,wr.error=t)}var Ga=class extends Or{constructor(t){super(),this.isStopped=!1,t?(this.destination=t,Kh(t)&&t.add(this)):this.destination=vb}static create(t,e,r){return new Wo(t,e,r)}next(t){this.isStopped?no(db(t),this):this._next(t)}error(t){this.isStopped?no(pb(t),this):(this.isStopped=!0,this._error(t))}complete(){this.isStopped?no(hb,this):(this.isStopped=!0,this._complete())}unsubscribe(){this.closed||(this.isStopped=!0,super.unsubscribe(),this.destination=null)}_next(t){this.destination.next(t)}_error(t){try{this.destination.error(t)}finally{this.unsubscribe()}}_complete(){try{this.destination.complete()}finally{this.unsubscribe()}}},gb=Function.prototype.bind;function ro(t,e){return gb.call(t,e)}var mb=class{constructor(t){this.partialObserver=t}next(t){let{partialObserver:e}=this;if(e.next)try{e.next(t)}catch(r){Ni(r)}}error(t){let{partialObserver:e}=this;if(e.error)try{e.error(t)}catch(r){Ni(r)}else Ni(t)}complete(){let{partialObserver:t}=this;if(t.complete)try{t.complete()}catch(e){Ni(e)}}},Wo=class extends Ga{constructor(t,e,r){super();let n;if(Ct(t)||!t)n={next:t??void 0,error:e??void 0,complete:r??void 0};else{let i;this&&Rr.useDeprecatedNextContext?(i=Object.create(t),i.unsubscribe=()=>this.unsubscribe(),n={next:t.next&&ro(t.next,i),error:t.error&&ro(t.error,i),complete:t.complete&&ro(t.complete,i)}):n=t}this.destination=new mb(n)}};function Ni(t){Rr.useDeprecatedSynchronousErrorHandling?fb(t):Jh(t)}function yb(t){throw t}function no(t,e){let{onStoppedNotification:r}=Rr;r&&Zi.setTimeout(()=>r(t,e))}var vb={closed:!0,next:nu,error:yb,complete:nu},qa=typeof Symbol=="function"&&Symbol.observable||"@@observable";function wb(t){return t}function bb(t){return t.length===0?wb:t.length===1?t[0]:function(e){return t.reduce((r,n)=>n(r),e)}}var Ge=(()=>{class t{constructor(r){r&&(this._subscribe=r)}lift(r){let n=new t;return n.source=this,n.operator=r,n}subscribe(r,n,i){let s=Eb(r)?r:new Wo(r,n,i);return Ui(()=>{let{operator:o,source:a}=this;s.add(o?o.call(s,a):a?this._subscribe(s):this._trySubscribe(s))}),s}_trySubscribe(r){try{return this._subscribe(r)}catch(n){r.error(n)}}forEach(r,n){return n=iu(n),new n((i,s)=>{let o=new Wo({next:a=>{try{r(a)}catch(l){s(l),o.unsubscribe()}},error:s,complete:i});this.subscribe(o)})}_subscribe(r){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(r)}[qa](){return this}pipe(...r){return bb(r)(this)}toPromise(r){return r=iu(r),new r((n,i)=>{let s;this.subscribe(o=>s=o,o=>i(o),()=>n(s))})}}return t.create=e=>new t(e),t})();function iu(t){var e;return(e=t??Rr.Promise)!==null&&e!==void 0?e:Promise}function _b(t){return t&&Ct(t.next)&&Ct(t.error)&&Ct(t.complete)}function Eb(t){return t&&t instanceof Ga||_b(t)&&Kh(t)}function Sb(t){return Ct(t?.lift)}function za(t){return e=>{if(Sb(e))return e.lift(function(r){try{return t(r,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}function Xi(t,e,r,n,i){return new Ib(t,e,r,n,i)}var Ib=class extends Ga{constructor(t,e,r,n,i,s){super(t),this.onFinalize=i,this.shouldUnsubscribe=s,this._next=e?function(o){try{e(o)}catch(a){t.error(a)}}:super._next,this._error=n?function(o){try{n(o)}catch(a){t.error(a)}finally{this.unsubscribe()}}:super._error,this._complete=r?function(){try{r()}catch(o){t.error(o)}finally{this.unsubscribe()}}:super._complete}unsubscribe(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){let{closed:e}=this;super.unsubscribe(),!e&&((t=this.onFinalize)===null||t===void 0||t.call(this))}}},Cb=zh(t=>function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}),cr=(()=>{class t extends Ge{constructor(){super(),this.closed=!1,this.currentObservers=null,this.observers=[],this.isStopped=!1,this.hasError=!1,this.thrownError=null}lift(r){let n=new su(this,this);return n.operator=r,n}_throwIfClosed(){if(this.closed)throw new Cb}next(r){Ui(()=>{if(this._throwIfClosed(),!this.isStopped){this.currentObservers||(this.currentObservers=Array.from(this.observers));for(let n of this.currentObservers)n.next(r)}})}error(r){Ui(()=>{if(this._throwIfClosed(),!this.isStopped){this.hasError=this.isStopped=!0,this.thrownError=r;let{observers:n}=this;for(;n.length;)n.shift().error(r)}})}complete(){Ui(()=>{if(this._throwIfClosed(),!this.isStopped){this.isStopped=!0;let{observers:r}=this;for(;r.length;)r.shift().complete()}})}unsubscribe(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null}get observed(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0}_trySubscribe(r){return this._throwIfClosed(),super._trySubscribe(r)}_subscribe(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)}_innerSubscribe(r){let{hasError:n,isStopped:i,observers:s}=this;return n||i?Yh:(this.currentObservers=null,s.push(r),new Or(()=>{this.currentObservers=null,Qi(s,r)}))}_checkFinalizedStatuses(r){let{hasError:n,thrownError:i,isStopped:s}=this;n?r.error(i):s&&r.complete()}asObservable(){let r=new Ge;return r.source=this,r}}return t.create=(e,r)=>new su(e,r),t})(),su=class extends cr{constructor(t,e){super(),this.destination=t,this.source=e}next(t){var e,r;(r=(e=this.destination)===null||e===void 0?void 0:e.next)===null||r===void 0||r.call(e,t)}error(t){var e,r;(r=(e=this.destination)===null||e===void 0?void 0:e.error)===null||r===void 0||r.call(e,t)}complete(){var t,e;(e=(t=this.destination)===null||t===void 0?void 0:t.complete)===null||e===void 0||e.call(t)}_subscribe(t){var e,r;return(r=(e=this.source)===null||e===void 0?void 0:e.subscribe(t))!==null&&r!==void 0?r:Yh}},Tb=class extends cr{constructor(t){super(),this._value=t}get value(){return this.getValue()}_subscribe(t){let e=super._subscribe(t);return!e.closed&&t.next(this._value),e}getValue(){let{hasError:t,thrownError:e,_value:r}=this;if(t)throw e;return this._throwIfClosed(),r}next(t){super.next(this._value=t)}},Ya={now(){return(Ya.delegate||Date).now()},delegate:void 0},xb=class extends cr{constructor(t=1/0,e=1/0,r=Ya){super(),this._bufferSize=t,this._windowTime=e,this._timestampProvider=r,this._buffer=[],this._infiniteTimeWindow=!0,this._infiniteTimeWindow=e===1/0,this._bufferSize=Math.max(1,t),this._windowTime=Math.max(1,e)}next(t){let{isStopped:e,_buffer:r,_infiniteTimeWindow:n,_timestampProvider:i,_windowTime:s}=this;e||(r.push(t),!n&&r.push(i.now()+s)),this._trimBuffer(),super.next(t)}_subscribe(t){this._throwIfClosed(),this._trimBuffer();let e=this._innerSubscribe(t),{_infiniteTimeWindow:r,_buffer:n}=this,i=n.slice();for(let s=0;s<i.length&&!t.closed;s+=r?1:2)t.next(i[s]);return this._checkFinalizedStatuses(t),e}_trimBuffer(){let{_bufferSize:t,_timestampProvider:e,_buffer:r,_infiniteTimeWindow:n}=this,i=(n?1:2)*t;if(t<1/0&&i<r.length&&r.splice(0,r.length-i),!n){let s=e.now(),o=0;for(let a=1;a<r.length&&r[a]<=s;a+=2)o=a;o&&r.splice(0,o+1)}}},Db=class extends Or{constructor(t,e){super()}schedule(t,e=0){return this}},ts={setInterval(t,e,...r){let{delegate:n}=ts;return n?.setInterval?n.setInterval(t,e,...r):setInterval(t,e,...r)},clearInterval(t){let{delegate:e}=ts;return(e?.clearInterval||clearInterval)(t)},delegate:void 0},Nb=class extends Db{constructor(t,e){super(t,e),this.scheduler=t,this.work=e,this.pending=!1}schedule(t,e=0){var r;if(this.closed)return this;this.state=t;let n=this.id,i=this.scheduler;return n!=null&&(this.id=this.recycleAsyncId(i,n,e)),this.pending=!0,this.delay=e,this.id=(r=this.id)!==null&&r!==void 0?r:this.requestAsyncId(i,this.id,e),this}requestAsyncId(t,e,r=0){return ts.setInterval(t.flush.bind(t,this),r)}recycleAsyncId(t,e,r=0){if(r!=null&&this.delay===r&&this.pending===!1)return e;e!=null&&ts.clearInterval(e)}execute(t,e){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;let r=this._execute(t,e);if(r)return r;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))}_execute(t,e){let r=!1,n;try{this.work(t)}catch(i){r=!0,n=i||new Error("Scheduled action threw falsy error")}if(r)return this.unsubscribe(),n}unsubscribe(){if(!this.closed){let{id:t,scheduler:e}=this,{actions:r}=e;this.work=this.state=this.scheduler=null,this.pending=!1,Qi(r,this),t!=null&&(this.id=this.recycleAsyncId(e,t,null)),this.delay=null,super.unsubscribe()}}},Go=class Qh{constructor(e,r=Qh.now){this.schedulerActionCtor=e,this.now=r}schedule(e,r=0,n){return new this.schedulerActionCtor(this,e).schedule(n,r)}};Go.now=Ya.now;var Ab=class extends Go{constructor(t,e=Go.now){super(t,e),this.actions=[],this._active=!1}flush(t){let{actions:e}=this;if(this._active){e.push(t);return}let r;this._active=!0;do if(r=t.execute(t.state,t.delay))break;while(t=e.shift());if(this._active=!1,r){for(;t=e.shift();)t.unsubscribe();throw r}}},Ob=new Ab(Nb);function kb(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(g){try{h(n.next(g))}catch(p){o(p)}}function l(g){try{h(n.throw(g))}catch(p){o(p)}}function h(g){g.done?s(g.value):i(g.value).then(a,l)}h((n=n.apply(t,e||[])).next())})}function ou(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Kr(t){return this instanceof Kr?(this.v=t,this):new Kr(t)}function Pb(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,s=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",o),i[Symbol.asyncIterator]=function(){return this},i;function o(w){return function(b){return Promise.resolve(b).then(w,p)}}function a(w,b){n[w]&&(i[w]=function(E){return new Promise(function(P,A){s.push([w,E,P,A])>1||l(w,E)})},b&&(i[w]=b(i[w])))}function l(w,b){try{h(n[w](b))}catch(E){_(s[0][3],E)}}function h(w){w.value instanceof Kr?Promise.resolve(w.value.v).then(g,p):_(s[0][2],w)}function g(w){l("next",w)}function p(w){l("throw",w)}function _(w,b){w(b),s.shift(),s.length&&l(s[0][0],s[0][1])}}function Rb(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof ou=="function"?ou(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(a,l){o=t[s](o),i(a,l,o.done,o.value)})}}function i(s,o,a,l){Promise.resolve(l).then(function(h){s({value:h,done:a})},o)}}var Zh=t=>t&&typeof t.length=="number"&&typeof t!="function";function Lb(t){return Ct(t?.then)}function Ub(t){return Ct(t[qa])}function Mb(t){return Symbol.asyncIterator&&Ct(t?.[Symbol.asyncIterator])}function Bb(t){return new TypeError(`You provided ${t!==null&&typeof t=="object"?"an invalid object":`'${t}'`} where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.`)}function jb(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var $b=jb();function Fb(t){return Ct(t?.[$b])}function Hb(t){return Pb(this,arguments,function*(){let e=t.getReader();try{for(;;){let{value:r,done:n}=yield Kr(e.read());if(n)return yield Kr(void 0);yield yield Kr(r)}}finally{e.releaseLock()}})}function Vb(t){return Ct(t?.getReader)}function Ka(t){if(t instanceof Ge)return t;if(t!=null){if(Ub(t))return Wb(t);if(Zh(t))return Gb(t);if(Lb(t))return qb(t);if(Mb(t))return Xh(t);if(Fb(t))return zb(t);if(Vb(t))return Yb(t)}throw Bb(t)}function Wb(t){return new Ge(e=>{let r=t[qa]();if(Ct(r.subscribe))return r.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function Gb(t){return new Ge(e=>{for(let r=0;r<t.length&&!e.closed;r++)e.next(t[r]);e.complete()})}function qb(t){return new Ge(e=>{t.then(r=>{e.closed||(e.next(r),e.complete())},r=>e.error(r)).then(null,Jh)})}function zb(t){return new Ge(e=>{for(let r of t)if(e.next(r),e.closed)return;e.complete()})}function Xh(t){return new Ge(e=>{Kb(t,e).catch(r=>e.error(r))})}function Yb(t){return Xh(Hb(t))}function Kb(t,e){var r,n,i,s;return kb(this,void 0,void 0,function*(){try{for(r=Rb(t);n=yield r.next(),!n.done;){let o=n.value;if(e.next(o),e.closed)return}}catch(o){i={error:o}}finally{try{n&&!n.done&&(s=r.return)&&(yield s.call(r))}finally{if(i)throw i.error}}e.complete()})}function Jb(t,e,r,n=0,i=!1){let s=e.schedule(function(){r(),i?t.add(this.schedule(null,n)):this.unsubscribe()},n);if(t.add(s),!i)return s}function Ja(t,e){return za((r,n)=>{let i=0;r.subscribe(Xi(n,s=>{n.next(t.call(e,s,i++))}))})}var{isArray:Qb}=Array;function Zb(t,e){return Qb(e)?t(...e):t(e)}function Xb(t){return Ja(e=>Zb(t,e))}function t_(t,e,r,n,i,s,o,a){let l=[],h=0,g=0,p=!1,_=()=>{p&&!l.length&&!h&&e.complete()},w=E=>h<n?b(E):l.push(E),b=E=>{s&&e.next(E),h++;let P=!1;Ka(r(E,g++)).subscribe(Xi(e,A=>{i?.(A),s?w(A):e.next(A)},()=>{P=!0},void 0,()=>{if(P)try{for(h--;l.length&&h<n;){let A=l.shift();o?Jb(e,o,()=>b(A)):b(A)}_()}catch(A){e.error(A)}}))};return t.subscribe(Xi(e,w,()=>{p=!0,_()})),()=>{a?.()}}function tp(t,e,r=1/0){return Ct(e)?tp((n,i)=>Ja((s,o)=>e(n,s,i,o))(Ka(t(n,i))),r):(typeof e=="number"&&(r=e),za((n,i)=>t_(n,i,t,r)))}var e_=["addListener","removeListener"],r_=["addEventListener","removeEventListener"],n_=["on","off"];function es(t,e,r,n){if(Ct(r)&&(n=r,r=void 0),n)return es(t,e,r).pipe(Xb(n));let[i,s]=o_(t)?r_.map(o=>a=>t[o](e,a,r)):i_(t)?e_.map(au(t,e)):s_(t)?n_.map(au(t,e)):[];if(!i&&Zh(t))return tp(o=>es(o,e,r))(Ka(t));if(!i)throw new TypeError("Invalid event target");return new Ge(o=>{let a=(...l)=>o.next(1<l.length?l:l[0]);return i(a),()=>s(a)})}function au(t,e){return r=>n=>t[r](e,n)}function i_(t){return Ct(t.addListener)&&Ct(t.removeListener)}function s_(t){return Ct(t.on)&&Ct(t.off)}function o_(t){return Ct(t.addEventListener)&&Ct(t.removeEventListener)}function oi(t,e=Ob){return za((r,n)=>{let i=null,s=null,o=null,a=()=>{if(i){i.unsubscribe(),i=null;let h=s;s=null,n.next(h)}};function l(){let h=o+t,g=e.now();if(g<h){i=this.schedule(void 0,h-g),n.add(i);return}a()}r.subscribe(Xi(n,h=>{s=h,o=e.now(),i||(i=e.schedule(l,t),n.add(i))},()=>{a(),n.complete()},void 0,()=>{s=i=null}))})}var a_=dt(mu()),cu=class{static UTM_PARAMS=["utm_source","utm_medium","utm_campaign","utm_term","utm_content","utm_id"];static TW_PARAMS={utm_source:"tw_source",utm_campaign:"tw_campaign"};static getReferrer(){if(document.referrer)return document.referrer.replace(location.origin,"")}static getUTMParams(){let t;try{t=new a_.URLBuilder(location.href)}catch{return{}}let e={};this.UTM_PARAMS.forEach(n=>{let i=t.getQueryParam(n);i&&(e[n]=i)});let r={};return Object.keys(this.TW_PARAMS).forEach(n=>{let i=t.getQueryParam(this.TW_PARAMS[n]);i&&(r[n]=i)}),D(D({},r),e)}},ws=class ep{origin;path;qs;name;referrer;utmSource;utmMedium;utmCampaign;utmId;utmTerm;utmContent;constructor(e){this.name=e.name,this.path=e.path,this.qs=e.qs,this.referrer=e.referrer,this.utmSource=e.utmSource||e.utm_source,this.utmMedium=e.utmMedium||e.utm_medium,this.utmCampaign=e.utmCampaign||e.utm_campaign,this.utmId=e.utmId||e.utm_id,this.utmTerm=e.utmTerm||e.utm_term,this.utmContent=e.utmContent||e.utm_content}static parseFromCurrent(){let e=location.pathname==="/"?location.pathname:location.pathname.replace(/\/+$/,"");return new ep(D({origin:location.origin,path:e,qs:location.search,referrer:cu.getReferrer(),name:Pt.get().pageName},cu.getUTMParams()))}},c_=" daum[ /]| deusu/| yadirectfetcher|(?:^|[^g])news(?!sapphire)|(?<! (?:channel/|google/))google(?!(app|/google| pixel))|(?<! cu)bots?(?:\\b|_)|(?<!(?:lib))http|(?<![hg]m)score|(?<!cam)scan|@[a-z][\\w-]+\\.|\\(\\)|\\.com\\b|\\btime/|\\||^<|^[\\w \\.\\-\\(?:\\):%]+(?:/v?\\d+(?:\\.\\d+)?(?:\\.\\d{1,10})*?)?(?:,|$)|^[^ ]{50,}$|^\\d+\\b|^\\w*search\\b|^\\w+/[\\w\\(\\)]*$|^active|^ad muncher|^amaya|^avsdevicesdk/|^biglotron|^bot|^bw/|^clamav[ /]|^client/|^cobweb/|^custom|^ddg[_-]android|^discourse|^dispatch/\\d|^downcast/|^duckduckgo|^email|^facebook|^getright/|^gozilla/|^hobbit|^hotzonu|^hwcdn/|^igetter/|^jeode/|^jetty/|^jigsaw|^microsoft bits|^movabletype|^mozilla/\\d\\.\\d\\s[\\w\\.-]+$|^mozilla/\\d\\.\\d\\s\\(compatible;?(?:\\s\\w+\\/\\d+\\.\\d+)?\\)$|^navermailapp|^netsurf|^offline|^openai/|^owler|^php|^postman|^python|^rank|^read|^reed|^rest|^rss|^snapchat|^space bison|^svn|^swcd |^taringa|^thumbor/|^track|^w3c|^webbandit/|^webcopier|^wget|^whatsapp|^wordpress|^xenu link sleuth|^yahoo|^yandex|^zdm/\\d|^zoom marketplace/|^{{.*}}$|analyzer|archive|ask jeeves/teoma|audit|bit\\.ly/|bluecoat drtr|browsex|burpcollaborator|capture|catch|check\\b|checker|chrome-lighthouse|chromeframe|classifier|cloudflare|convertify|crawl|cypress/|dareboost|datanyze|dejaclick|detect|dmbrowser|download|evc-batch/|exaleadcloudview|feed|firephp|functionize|gomezagent|grab|headless|httrack|hubspot marketing grader|hydra|ibisbrowser|infrawatch|insight|inspect|iplabel|ips-agent|java(?!;)|library|linkcheck|mail\\.ru/|manager|measure|neustar wpm|node|nutch|offbyone|onetrust|optimize|pageburst|pagespeed|parser|perl|phantomjs|pingdom|powermarks|preview|proxy|ptst[ /]\\d|retriever|rexx;|rigor|rss\\b|scrape|server|sogou|sparkler/|speedcurve|spider|splash|statuscake|supercleaner|synapse|synthetic|tools|torrent|transcoder|url|validator|virtuoso|wappalyzer|webglance|webkit2png|whatcms/|xtate/",l_=/bot|crawl|http|lighthouse|scan|search|spider/i,Nn;function u_(){if(Nn instanceof RegExp)return Nn;try{Nn=new RegExp(c_,"i")}catch{Nn=l_}return Nn}function h_(t){return!!t&&u_().test(t)}var qo={d:(t,e)=>{for(var r in e)qo.o(e,r)&&!qo.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},Qa={};qo.d(Qa,{A:()=>p_,k:()=>Za});var An=function(t,e,r,n){return new(r||(r=Promise))(function(i,s){function o(h){try{l(n.next(h))}catch(g){s(g)}}function a(h){try{l(n.throw(h))}catch(g){s(g)}}function l(h){var g;h.done?i(h.value):(g=h.value,g instanceof r?g:new r(function(p){p(g)})).then(o,a)}l((n=n.apply(t,e||[])).next())})},On=function(t,e){var r,n,i,s,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(l){return function(h){return function(g){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,g[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&g[0]?n.return:g[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,g[1])).done)return i;switch(n=0,i&&(g=[2&g[0],i.value]),g[0]){case 0:case 1:i=g;break;case 4:return o.label++,{value:g[1],done:!1};case 5:o.label++,n=g[1],g=[0];continue;case 7:g=o.ops.pop(),o.trys.pop();continue;default:if(i=o.trys,!((i=i.length>0&&i[i.length-1])||g[0]!==6&&g[0]!==2)){o=0;continue}if(g[0]===3&&(!i||g[1]>i[0]&&g[1]<i[3])){o.label=g[1];break}if(g[0]===6&&o.label<i[1]){o.label=i[1],i=g;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(g);break}i[2]&&o.ops.pop(),o.trys.pop();continue}g=e.call(t,o)}catch(p){g=[6,p],n=0}finally{r=i=0}if(5&g[0])throw g[1];return{value:g[0]?g[1]:void 0,done:!0}}([l,h])}}};function Za(){return An(this,void 0,Promise,function(){return On(this,function(t){switch(t.label){case 0:return[4,new Promise(function(e,r){var n="Unknown",i=!1;function s(w){i||(i=!0,e({isPrivate:w,browserName:n}))}function o(){var w=0,b=parseInt("-1");try{b.toFixed(b)}catch(E){w=E.message.length}return w}function a(){return navigator.msSaveBlob!==void 0&&function(w){try{return w===eval.toString().length}catch{return!1}}(39)}function l(){var w;return An(this,void 0,void 0,function(){var b,E;return On(this,function(P){switch(P.label){case 0:return P.trys.push([0,2,,3]),[4,navigator.storage.getDirectory()];case 1:return P.sent(),s(!1),[3,3];case 2:return b=P.sent(),E=b,b instanceof Error&&(E=(w=b.message)!==null&&w!==void 0?w:b),typeof E!="string"?(s(!1),[2]):(s(!!E.includes("unknown transient reason")),[3,3]);case 3:return[2]}})})}function h(){var w;return An(this,void 0,Promise,function(){return On(this,function(b){switch(b.label){case 0:return((w=navigator.storage)===null||w===void 0?void 0:w.getDirectory)===void 0?[3,2]:[4,l()];case 1:return b.sent(),[3,3];case 2:navigator.maxTouchPoints!==void 0?function(){var E=String(Math.random());try{var P=indexedDB.open(E,1);P.onupgradeneeded=function(A){var M=A.target.result,z=function(B){s(B)};try{M.createObjectStore("t",{autoIncrement:!0}).put(new Blob),z(!1)}catch(B){(B.message||"").includes("are not yet supported")?z(!0):z(!1)}finally{M.close(),indexedDB.deleteDatabase(E)}},P.onerror=function(){return s(!1)}}catch{s(!1)}}():function(){var E=window.openDatabase,P=window.localStorage;try{E(null,null,null,null)}catch{return void s(!0)}try{P.setItem("test","1"),P.removeItem("test")}catch{return void s(!0)}s(!1)}(),b.label=3;case 3:return[2]}})})}function g(){navigator.webkitTemporaryStorage.queryUsageAndQuota(function(w,b){var E;s(Math.round(b/1048576)<2*Math.round(((E=window).performance!==void 0&&E.performance.memory!==void 0&&E.performance.memory.jsHeapSizeLimit!==void 0?performance.memory.jsHeapSizeLimit:1073741824)/1048576))},function(w){r(new Error("detectIncognito somehow failed to query storage quota: "+w.message))})}function p(){self.Promise!==void 0&&self.Promise.allSettled!==void 0?g():(0,window.webkitRequestFileSystem)(0,1,function(){s(!1)},function(){s(!0)})}function _(){return An(this,void 0,Promise,function(){var w,b;return On(this,function(E){switch(E.label){case 0:if(!navigator.storage||!navigator.storage.getDirectory)return[3,4];E.label=1;case 1:return E.trys.push([1,3,,4]),[4,navigator.storage.getDirectory()];case 2:return E.sent(),s(!1),[3,4];case 3:return w=E.sent(),typeof(b=w instanceof Error&&typeof w.message=="string"?w.message:String(w))!="string"?(s(!1),[2]):(s(b.includes("Security error")),[2]);case 4:return s(navigator.serviceWorker===void 0),[2]}})})}(function(){return An(this,void 0,Promise,function(){return On(this,function(w){switch(w.label){case 0:return o()!==44?[3,2]:(n="Safari",[4,h()]);case 1:return w.sent(),[3,6];case 2:return o()!==51?[3,3]:(b=navigator.userAgent,n=b.match(/Chrome/)?navigator.brave!==void 0?"Brave":b.match(/Edg/)?"Edge":b.match(/OPR/)?"Opera":"Chrome":"Chromium",p(),[3,6]);case 3:return o()!==25?[3,5]:(n="Firefox",[4,_()]);case 4:return w.sent(),[3,6];case 5:a()?(n="Internet Explorer",s(window.indexedDB===void 0)):r(new Error("detectIncognito cannot determine the browser")),w.label=6;case 6:return[2]}var b})})})().catch(r)})];case 1:return[2,t.sent()]}})})}typeof window<"u"&&(window.detectIncognito=Za);var p_=Za,d_=Qa.A,PE=Qa.k,f_=dt(an()),g_=class{result={};async safeGet(){try{return await this.get()}catch(t){return Kt.getInstance().captureException(t,{message:"Unable to collect device properties"}),this.result}}async get(){let t=this.result,e=window.CooeeSDK.uaParser;this.getDeviceMemory(),this.getNetworkType(),this.getOrientation(),t.referrer=document.referrer,t.host=location.origin,t.path=location.pathname,t.qs=location.search,t.locale=navigator.language,t.display={w:screen.width,h:screen.height,pd:screen.pixelDepth,dpi:this.getDPI()},t.win={ow:window.outerWidth,oh:window.outerHeight,iw:window.innerWidth,ih:window.innerHeight,dpr:window.devicePixelRatio},navigator.webdriver&&(t.headless=!0);let r=e.getResult();return t.browser=r.browser,t.device=r.device,t.engine=r.engine,t.cpu=r.cpu,t.os=r.os,t.navigatorUA=navigator.userAgent,await Promise.all([this.getBatteryInfo(),this.getLocation(),this.checkIncognito()]),t}getDeviceMemory(){let t=navigator;if(!t.deviceMemory)return;let e=t.deviceMemory;this.result.mem={tot:e*1024}}getNetworkType(){let t=navigator,e=t.connection||t.mozConnection||t.webkitConnection;e?.effectiveType&&(this.result.net={type:e.effectiveType})}getOrientation(){let t=screen.orientation?.type;t&&(this.result.orientation=t)}getDPI(){if(!document.body)return;let t=document.createElement("div");t.setAttribute("style","height: 1in; left: -100%; position: absolute; top: -100%; width: 1in;"),document.body.appendChild(t);let e=window.devicePixelRatio||1,r=t.offsetWidth*e;return document.body.removeChild(t),r}async getLocation(){if(!(!navigator.geolocation||!navigator.permissions||(await navigator.permissions.query({name:"geolocation"})).state!="granted"))return new Promise(t=>{navigator.geolocation.getCurrentPosition(e=>{this.result.coords=[e.coords.latitude,e.coords.longitude],t()},()=>t())})}async getBatteryInfo(){if("getBattery"in navigator)try{let t=await navigator.getBattery();this.result.bat={l:t.level*100,c:t.charging}}catch{}}async checkIncognito(){try{(await d_())?.isPrivate&&(this.result.incognito=!0)}catch(t){f_.default.error("Unable to detect private/incognito window",t)}}},rp=class{static trackDeviceID(t){this.isInstalled()}static trackIntent(t){if(!this.isInstalled())return;let e=us[t]?.toLowerCase();e&&(x.debug(`Sending ${e} intent to MS Clarity`),window.clarity("set","Cooee Intent",e))}static isInstalled(){return window.clarity&&typeof window.clarity=="function"}},m_=dt(lr()),np=class{constructor(t,e){this._startTime=t,this._triggerData=e}intervals=[];selectedEmbeddedItems;renderer;closeCallback;inputFields=[];get startTime(){return this._startTime}get triggerData(){return this._triggerData}get inputs(){return this.inputFields}get rootClassName(){let t=this.triggerData.shortID??this.triggerData.id.slice(-6);return t==="test"&&(t="test-"+this.startTime.getTime().toString()),q.IN_APP_WRAPPER_NAME+"-"+t}get selectedItems(){return this.triggerData.items.filter(t=>t.selected.value)}get shouldGiveFBTDiscount(){let t=this.selectedItems.length;return this.triggerData.bundleConfig?.applyDiscountOnMinimum?this.triggerData.bundleConfig.applyDiscountOnMinimum<=t:t===this.triggerData.items.length}onClose(t){this.closeCallback=t}closeInApp(t,e){e??={};let r=(new Date().getTime()-this.startTime.getTime())/1e3,n=D({eventName:t,duration:r},e);this.stopIntervals(),this.closeCallback&&this.closeCallback(n)}addInputField(t,e){this.inputFields.push({id:t,type:e,isValid:!1})}updateValidation(t,e){this.inputFields.forEach(r=>{if(r.id===t){r.isValid=e;return}})}hasManipulatedProductQuantity(){let t=this.triggerData.manipulation.productQuantity;return t?.enabled&&t.min!=null&&t.max!=null}getManipulatedQuantity(t){let{min:e=1,max:r=100}=this.triggerData.manipulation.productQuantity;if(e>r)return x.error("Invalid range: min should be less than or equal to max."),t;if(t>=e&&t<=r)return t;let n=t%100;return n<e?e:n>r?r:n}stopIntervals(){this.intervals.forEach(t=>clearInterval(t))}},y_=class{loadedFonts=[];async loadAllFonts(t){t.elems?.forEach(e=>{e instanceof ls&&this.loadFamily(e.typography?.fam)})}async loadFamily(t){if(!t?.fonts||this.loadedFonts.indexOf(t.name)>-1)return;let e=[];t.fonts.forEach(r=>{if(r.url){let n=new FontFace(q.COOEE+t.name,r.getURL(),r.getFontDescriptor());e.push(n.load())}}),this.loadedFonts.push(t.name),(await Promise.all(e)).forEach(r=>{document.fonts.add(r)})}},io=dt(an()),Xa=class ip{static INSTANCE=new ip;topics={};constructor(){}static get(){return this.INSTANCE}broadcast(e,r){this.topics[e]||(this.topics[e]=new cr),this.topics[e].next(r)}subscriber(e){return this.topics[e]||(this.topics[e]=new cr),this.topics[e].asObservable()}},Ee=class Ce{static DEFAULT_SELECTOR="cart-drawer";static _instance;inShadow=!1;cartDrawerElement;cartDrawerShadowElement;configWebsite=se.get().website??{};currentState=!1;drawerSubject=new Tb({open:!1,firstOpen:!1});mutationObserver;firstOpen=!0;selector;shadowParentElementSelector;iconSelector=['button[drawer-to-open="cart-drawer"]','a[href="/cart"]',".header__icon--cart","#cart-icon-bubble",".cart-icon-bubble",".cart-count",'a[onclick*="handleFloCartBtn"]'].join(",");cartSelector=[Ce.DEFAULT_SELECTOR,"#halo-cart-sidebar",'[role="dialog"][class*="cart" i]','[id*="section-cart" i]',"#sidebar-cart","#rebuy-cart","#mini-cart","#flo-cart-wrapper","#drawer-cart","#UpcartPopupBackDrop",'[id$="CartDrawer" i]'].join(",");constructor(){this.initialize(),document.addEventListener(q.CTA_AFTER_REFRESH_UI,this.updateBubble.bind(this))}get element(){return this.cartDrawerElement}static get(){return Ce._instance||(Ce._instance=new Ce),Ce._instance}static forceUpdate(){Ce._instance=new Ce}isOpen(){let e=this.inShadow?this.isPresent():this.isVisible();return io.default.log(`Cart drawer is currently ${e?"open":"close"}`),e}open(){if(this.isOpen()){x.log("Drawer is already open");return}document.dispatchEvent(new CustomEvent(q.CTA_OPEN_CART_EVENT));let e=document.querySelector(this.iconSelector);if(!e){x.debug("No clickable cart icon found with selector",this.iconSelector);return}e.click()}onToggle(){return this.drawerSubject}isShopifyDefaultDrawer(){return this.element?.tagName.toLowerCase()===Ce.DEFAULT_SELECTOR}isMiniCart(){return this.isShopifyDefaultDrawer()&&this.element?.id==="mini-cart"}refreshUI(e,r=!0){if(this.isMiniCart()&&this.element?._rerenderCart)this.element._rerenderCart({detail:{cart:e}});else if(window.MinimogTheme?.Cart?.renderNewCart)window.MinimogTheme.Cart.renderNewCart();else if(this.isShopifyDefaultDrawer()&&this.element?.renderContents&&e)this.element.classList.remove("is-empty"),this.element.renderContents?.(e);else if(this.element?.onCartDrawerUpdate)this.element.onCartDrawerUpdate();else if(window.cartGiftUpdate){if(!e?.items?.[0])return;let n=e.items[0].id,i=e.items[0].quantity,s=e.items[0].price;window.cartGiftUpdate(n,s,i,"","ADD_TO_CART")}else if(window.icartCartActivityEvent)window.icartCartActivityEvent();else if(window.theme?.CartDrawer)window.theme?.CartDrawer.init?new window.theme.CartDrawer().init():new window.theme.CartDrawer;else if(window.Hs_CartDrawer?.updateSlideCart)window.Hs_CartDrawer.updateSlideCart();else if(window.theme?.fetch_side_cart)window.theme.fetch_side_cart();else if(window.theme?.Cart?.updateCart)window.theme.Cart.updateCart();else if(window.cartUpdate)window.cartUpdate();else if(this.element?._onCartRefresh)this.element._onCartRefresh();else if(window.cart?.getCart)window.cart.getCart();else if(this.element?.tagName?.toLowerCase()==="cart-drawer-component")document.dispatchEvent(new CustomEvent("action:cart:updateCartandShowCart"));else if(this.element?.id==="sidebar-cart")document.body.dispatchEvent(new CustomEvent("cart:refresh",{bubbles:!0,detail:{}}));else if(this.element?.id==="quick-cart"){let n=document.querySelector('a[href="/cart"]');n&&n.click()}else window.Shopify?.KT_onItemAdded?window.Shopify.KT_onItemAdded():window.sideCart?.updateCart?window.sideCart.updateCart():window.SLIDECART_UPDATE?(window.SLIDECART_UPDATE(),window.SLIDECART_OPEN?.()):window.refreshCart?Ot.getCurrent().getNormalisedCart(!0).then(()=>{window.refreshCart(Ot.getCurrent())}):window.OPEN_CART?window.OPEN_CART():window.updateCart?window.updateCart():(x.info("No method found to update the cart drawer. Blindly firing some events to try"),document.dispatchEvent(new CustomEvent("cart:refresh",{bubbles:!0})));document.dispatchEvent(new CustomEvent(q.CTA_AFTER_REFRESH_UI)),r&&Xa.get().broadcast(q.CART_UPDATE_BROADCAST)}async initialize(){let e=this.configWebsite.cartDrawerSelector;if(!e){await this.findCartDrawer();return}let r=e.split(q.SHADOW_SPLITTER);r.length===1?(this.selector=r[0],await this.findCartDrawer()):(this.inShadow=!0,this.shadowParentElementSelector=r[0]?.trim(),this.selector=r[1]?.trim(),await this.findCartDrawerWithShadow())}async findCartDrawer(){if(!ha())return;let e=this.selector||this.cartSelector;if(this.cartDrawerElement=await qi(e),!this.cartDrawerElement){io.default.warn("Max attempts exhausted to find cart drawer");return}io.default.log("Found",this.cartDrawerElement,`from selector: ${e}`),this.createMutationObservers()}async findCartDrawerWithShadow(){if(!this.shadowParentElementSelector)return;let e=(await qi(this.shadowParentElementSelector))?.shadowRoot;e?.mode==="open"&&(this.cartDrawerShadowElement=e,this.createMutationObservers())}isVisible(){if(!this.cartDrawerElement)return!1;if(this.cartDrawerElement.tagName.toLowerCase()===Ce.DEFAULT_SELECTOR&&this.cartDrawerElement.open)return!0;if(this.cartDrawerElement.id==="cart-drawer__container")return this.cartDrawerElement.classList.contains("cart-drawer-open");let e=this.cartDrawerElement.getBoundingClientRect(),r=(window.innerHeight||document.documentElement.clientHeight)+.5,n=(window.innerWidth||document.documentElement.clientWidth)+.5,i=e.top<=r&&e.bottom>=0,s=e.left<=n&&e.right>=0,o=i&&s,a=getComputedStyle(this.cartDrawerElement),l=a.display!=="none"&&a.visibility!=="hidden"&&parseFloat(a.opacity)>0,h=!this.cartDrawerElement.hidden,g=this.cartDrawerElement.offsetWidth>0||this.cartDrawerElement.offsetHeight>0||this.cartDrawerElement.getClientRects().length>0,p=a.transform.match(/matrix\(([^)]+)\)/),_=0,w=0;if(p){let B=p[1].split(", ").map(parseFloat);_=B[4],w=B[5]}let b=_+e.left>n||_+e.right<0||w+e.top>r||w+e.bottom<0,E=Math.max(0,Math.min(e.right,n)-Math.max(e.left,0)),P=Math.max(0,Math.min(e.bottom,r)-Math.max(e.top,0)),A=E*P,M=e.width*e.height,z=M>0&&A/M>=.1;return(o||!b)&&l&&h&&g&&z}createMutationObservers(){!this.cartDrawerElement&&!this.cartDrawerShadowElement||(Sv(this.cartDrawerElement,()=>{this.initialize()}),this.watchForCartToggle())}watchForCartToggle(){let e=this.cartDrawerElement||this.cartDrawerShadowElement,r=new cr;this.mutationObserver?.disconnect(),this.mutationObserver=new MutationObserver(()=>{r.next()}),this.mutationObserver.observe(e,{attributes:!0,subtree:!0,childList:this.inShadow}),r.pipe(oi(500)).subscribe(()=>{let n=this.isOpen();this.currentState!==n&&(this.currentState=n,this.drawerSubject.next({open:n,firstOpen:this.firstOpen}),this.firstOpen&&(this.firstOpen=!1))})}isPresent(){return!this.selector||!this.cartDrawerShadowElement?!1:!!this.cartDrawerShadowElement.querySelector(this.selector)}async updateBubble(){let e=(await Ot.getCurrent().getNormalisedCart(!0)).itemCount,r=document.querySelector(".cart-link__bubble");r&&(r.innerText=e+"")}},Qe=dt(lr()),v_=dt(Nd()),zo=class{static _flags={};static getFlags(){return this._flags}static setFlags(t){this._flags=t??{}}static isECommerceApp(){return ha()}},w_=(0,v_.default)(fetch),b_={retryDelay:q.API_CALL_RETRY_DELAY,retryOn:(t,e,r)=>t>=q.API_CALL_MAX_ATTEMPTS?!1:!!(e!==null||r?.status&&r?.status>=500)},Lr=class sp{static INSTANCE;apiToken="";firstSeen="";constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new sp),this.INSTANCE}async validateSession(e){return this.post("/v1/event/validate-session",e)}updateUserData(e){this.put("/v1/user/update",e).then(async r=>{x.log("Updated user profile"),await Ko.getInstance().storeAndPopulateAuthData(r)}).catch(r=>{x.error("Error saving user profile",r)})}trackOrder(e){this.post("/v1/event/track-order",e).then(()=>{x.log("Sent Order")}).catch(r=>{x.error("Error sending track order",r)})}generateDiscount(e){return this.post("/v1/event/generate-discount",e)}updateDeviceProps(e){this.put("/v1/device/update",e).then(()=>{x.log("Updated device property")}).catch(async r=>{x.error("Error saving device property",r)})}setAPIToken(e){this.apiToken=e??""}setFirstSeen(e){this.firstSeen=e?.toUTCString()??""}get(e){return this.requestBackend("GET",e)}post(e,r){return this.requestBackend("POST",e,r)}put(e,r){return this.requestBackend("PUT",e,r)}async requestBackend(e,r,n){if(!zo.isECommerceApp()&&!zo.getFlags().allowEvents)return x.log(`Rejecting ${e} ${r} as this is not e-commerce app`),Promise.reject();r.startsWith("http")||(r=ke.apiURL+r);let i=this.getDefaultHeaders(),s="keepalive"in new Request("");if(n&&!s&&JSON.stringify(n).includes("CE App Background"))try{return this.performXMLHttpRequest(r,i,n)}catch(a){return Kt.getInstance().captureException(a,{body:JSON.stringify(n)}),{}}let o={method:e,headers:i,keepalive:!0};return n&&(o.body=JSON.stringify(n)),this.request(r,o)}async request(e,r){let n=D(D({},b_),r),i=await w_(e,n);if(!i.ok)throw i;return i.json()}performXMLHttpRequest(e,r,n){return new Promise((i,s)=>{let o=new XMLHttpRequest;o.open("POST",e,!0),r.forEach((a,l)=>{o.setRequestHeader(l,a)}),o.onreadystatechange=()=>{if(o.readyState===XMLHttpRequest.DONE)if(o.status>=200&&o.status<300)try{o.getResponseHeader("Content-Type")?.includes("application/json")?i(JSON.parse(o.responseText)):s(new Error("Content-Type of response header is not json"))}catch(a){s(a)}else s(new Error(`Received status - ${o.status}(${o.statusText})`))},o.onerror=()=>{s(new Error("Network error occurred during the request."))},o.send(JSON.stringify(n))})}getDefaultHeaders(){let e=new Headers;return e.set("content-type","application/json"),e.set("cooee-sdk",q.SDK),e.set("cooee-sdk-code",q.SDK_VERSION_CODE.toString()),e.set("cooee-sdk-version",q.SDK_VERSION),e.set("cooee-first-seen",this.firstSeen),this.apiToken&&e.append("cooee-sdk-token",this.apiToken),ke.debug&&e.set("cooee-sdk-debug",String(1)),e}},__=`
|
|
38
|
+
`)}`:"",this.name="UnsubscriptionError",this.errors=e});function Qi(t,e){if(t){let r=t.indexOf(e);0<=r&&t.splice(r,1)}}var Or=class Wo{constructor(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}unsubscribe(){let e;if(!this.closed){this.closed=!0;let{_parentage:r}=this;if(r)if(this._parentage=null,Array.isArray(r))for(let s of r)s.remove(this);else r.remove(this);let{initialTeardown:n}=this;if(Ct(n))try{n()}catch(s){e=s instanceof eo?s.errors:[s]}let{_finalizers:i}=this;if(i){this._finalizers=null;for(let s of i)try{nu(s)}catch(o){e=e??[],o instanceof eo?e=[...e,...o.errors]:e.push(o)}}if(e)throw new eo(e)}}add(e){var r;if(e&&e!==this)if(this.closed)nu(e);else{if(e instanceof Wo){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(e)}}_hasParent(e){let{_parentage:r}=this;return r===e||Array.isArray(r)&&r.includes(e)}_addParent(e){let{_parentage:r}=this;this._parentage=Array.isArray(r)?(r.push(e),r):r?[r,e]:e}_removeParent(e){let{_parentage:r}=this;r===e?this._parentage=null:Array.isArray(r)&&Qi(r,e)}remove(e){let{_finalizers:r}=this;r&&Qi(r,e),e instanceof Wo&&e._removeParent(this)}};Or.EMPTY=(()=>{let t=new Or;return t.closed=!0,t})();var Yh=Or.EMPTY;function Kh(t){return t instanceof Or||t&&"closed"in t&&Ct(t.remove)&&Ct(t.add)&&Ct(t.unsubscribe)}function nu(t){Ct(t)?t():t.unsubscribe()}var Rr={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},Xi={setTimeout(t,e,...r){let{delegate:n}=Xi;return n?.setTimeout?n.setTimeout(t,e,...r):setTimeout(t,e,...r)},clearTimeout(t){let{delegate:e}=Xi;return(e?.clearTimeout||clearTimeout)(t)},delegate:void 0};function Jh(t){Xi.setTimeout(()=>{let{onUnhandledError:e}=Rr;if(e)e(t);else throw t})}function iu(){}var db=Ga("C",void 0,void 0);function fb(t){return Ga("E",void 0,t)}function gb(t){return Ga("N",t,void 0)}function Ga(t,e,r){return{kind:t,value:e,error:r}}var wr=null;function Ui(t){if(Rr.useDeprecatedSynchronousErrorHandling){let e=!wr;if(e&&(wr={errorThrown:!1,error:null}),t(),e){let{errorThrown:r,error:n}=wr;if(wr=null,r)throw n}}else t()}function mb(t){Rr.useDeprecatedSynchronousErrorHandling&&wr&&(wr.errorThrown=!0,wr.error=t)}var qa=class extends Or{constructor(t){super(),this.isStopped=!1,t?(this.destination=t,Kh(t)&&t.add(this)):this.destination=bb}static create(t,e,r){return new Go(t,e,r)}next(t){this.isStopped?no(gb(t),this):this._next(t)}error(t){this.isStopped?no(fb(t),this):(this.isStopped=!0,this._error(t))}complete(){this.isStopped?no(db,this):(this.isStopped=!0,this._complete())}unsubscribe(){this.closed||(this.isStopped=!0,super.unsubscribe(),this.destination=null)}_next(t){this.destination.next(t)}_error(t){try{this.destination.error(t)}finally{this.unsubscribe()}}_complete(){try{this.destination.complete()}finally{this.unsubscribe()}}},yb=Function.prototype.bind;function ro(t,e){return yb.call(t,e)}var vb=class{constructor(t){this.partialObserver=t}next(t){let{partialObserver:e}=this;if(e.next)try{e.next(t)}catch(r){Ni(r)}}error(t){let{partialObserver:e}=this;if(e.error)try{e.error(t)}catch(r){Ni(r)}else Ni(t)}complete(){let{partialObserver:t}=this;if(t.complete)try{t.complete()}catch(e){Ni(e)}}},Go=class extends qa{constructor(t,e,r){super();let n;if(Ct(t)||!t)n={next:t??void 0,error:e??void 0,complete:r??void 0};else{let i;this&&Rr.useDeprecatedNextContext?(i=Object.create(t),i.unsubscribe=()=>this.unsubscribe(),n={next:t.next&&ro(t.next,i),error:t.error&&ro(t.error,i),complete:t.complete&&ro(t.complete,i)}):n=t}this.destination=new vb(n)}};function Ni(t){Rr.useDeprecatedSynchronousErrorHandling?mb(t):Jh(t)}function wb(t){throw t}function no(t,e){let{onStoppedNotification:r}=Rr;r&&Xi.setTimeout(()=>r(t,e))}var bb={closed:!0,next:iu,error:wb,complete:iu},za=typeof Symbol=="function"&&Symbol.observable||"@@observable";function _b(t){return t}function Eb(t){return t.length===0?_b:t.length===1?t[0]:function(e){return t.reduce((r,n)=>n(r),e)}}var Ge=(()=>{class t{constructor(r){r&&(this._subscribe=r)}lift(r){let n=new t;return n.source=this,n.operator=r,n}subscribe(r,n,i){let s=Ib(r)?r:new Go(r,n,i);return Ui(()=>{let{operator:o,source:a}=this;s.add(o?o.call(s,a):a?this._subscribe(s):this._trySubscribe(s))}),s}_trySubscribe(r){try{return this._subscribe(r)}catch(n){r.error(n)}}forEach(r,n){return n=su(n),new n((i,s)=>{let o=new Go({next:a=>{try{r(a)}catch(l){s(l),o.unsubscribe()}},error:s,complete:i});this.subscribe(o)})}_subscribe(r){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(r)}[za](){return this}pipe(...r){return Eb(r)(this)}toPromise(r){return r=su(r),new r((n,i)=>{let s;this.subscribe(o=>s=o,o=>i(o),()=>n(s))})}}return t.create=e=>new t(e),t})();function su(t){var e;return(e=t??Rr.Promise)!==null&&e!==void 0?e:Promise}function Sb(t){return t&&Ct(t.next)&&Ct(t.error)&&Ct(t.complete)}function Ib(t){return t&&t instanceof qa||Sb(t)&&Kh(t)}function Cb(t){return Ct(t?.lift)}function Ya(t){return e=>{if(Cb(e))return e.lift(function(r){try{return t(r,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}function Zi(t,e,r,n,i){return new Tb(t,e,r,n,i)}var Tb=class extends qa{constructor(t,e,r,n,i,s){super(t),this.onFinalize=i,this.shouldUnsubscribe=s,this._next=e?function(o){try{e(o)}catch(a){t.error(a)}}:super._next,this._error=n?function(o){try{n(o)}catch(a){t.error(a)}finally{this.unsubscribe()}}:super._error,this._complete=r?function(){try{r()}catch(o){t.error(o)}finally{this.unsubscribe()}}:super._complete}unsubscribe(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){let{closed:e}=this;super.unsubscribe(),!e&&((t=this.onFinalize)===null||t===void 0||t.call(this))}}},xb=zh(t=>function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}),cr=(()=>{class t extends Ge{constructor(){super(),this.closed=!1,this.currentObservers=null,this.observers=[],this.isStopped=!1,this.hasError=!1,this.thrownError=null}lift(r){let n=new ou(this,this);return n.operator=r,n}_throwIfClosed(){if(this.closed)throw new xb}next(r){Ui(()=>{if(this._throwIfClosed(),!this.isStopped){this.currentObservers||(this.currentObservers=Array.from(this.observers));for(let n of this.currentObservers)n.next(r)}})}error(r){Ui(()=>{if(this._throwIfClosed(),!this.isStopped){this.hasError=this.isStopped=!0,this.thrownError=r;let{observers:n}=this;for(;n.length;)n.shift().error(r)}})}complete(){Ui(()=>{if(this._throwIfClosed(),!this.isStopped){this.isStopped=!0;let{observers:r}=this;for(;r.length;)r.shift().complete()}})}unsubscribe(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null}get observed(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0}_trySubscribe(r){return this._throwIfClosed(),super._trySubscribe(r)}_subscribe(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)}_innerSubscribe(r){let{hasError:n,isStopped:i,observers:s}=this;return n||i?Yh:(this.currentObservers=null,s.push(r),new Or(()=>{this.currentObservers=null,Qi(s,r)}))}_checkFinalizedStatuses(r){let{hasError:n,thrownError:i,isStopped:s}=this;n?r.error(i):s&&r.complete()}asObservable(){let r=new Ge;return r.source=this,r}}return t.create=(e,r)=>new ou(e,r),t})(),ou=class extends cr{constructor(t,e){super(),this.destination=t,this.source=e}next(t){var e,r;(r=(e=this.destination)===null||e===void 0?void 0:e.next)===null||r===void 0||r.call(e,t)}error(t){var e,r;(r=(e=this.destination)===null||e===void 0?void 0:e.error)===null||r===void 0||r.call(e,t)}complete(){var t,e;(e=(t=this.destination)===null||t===void 0?void 0:t.complete)===null||e===void 0||e.call(t)}_subscribe(t){var e,r;return(r=(e=this.source)===null||e===void 0?void 0:e.subscribe(t))!==null&&r!==void 0?r:Yh}},Db=class extends cr{constructor(t){super(),this._value=t}get value(){return this.getValue()}_subscribe(t){let e=super._subscribe(t);return!e.closed&&t.next(this._value),e}getValue(){let{hasError:t,thrownError:e,_value:r}=this;if(t)throw e;return this._throwIfClosed(),r}next(t){super.next(this._value=t)}},Ka={now(){return(Ka.delegate||Date).now()},delegate:void 0},Nb=class extends cr{constructor(t=1/0,e=1/0,r=Ka){super(),this._bufferSize=t,this._windowTime=e,this._timestampProvider=r,this._buffer=[],this._infiniteTimeWindow=!0,this._infiniteTimeWindow=e===1/0,this._bufferSize=Math.max(1,t),this._windowTime=Math.max(1,e)}next(t){let{isStopped:e,_buffer:r,_infiniteTimeWindow:n,_timestampProvider:i,_windowTime:s}=this;e||(r.push(t),!n&&r.push(i.now()+s)),this._trimBuffer(),super.next(t)}_subscribe(t){this._throwIfClosed(),this._trimBuffer();let e=this._innerSubscribe(t),{_infiniteTimeWindow:r,_buffer:n}=this,i=n.slice();for(let s=0;s<i.length&&!t.closed;s+=r?1:2)t.next(i[s]);return this._checkFinalizedStatuses(t),e}_trimBuffer(){let{_bufferSize:t,_timestampProvider:e,_buffer:r,_infiniteTimeWindow:n}=this,i=(n?1:2)*t;if(t<1/0&&i<r.length&&r.splice(0,r.length-i),!n){let s=e.now(),o=0;for(let a=1;a<r.length&&r[a]<=s;a+=2)o=a;o&&r.splice(0,o+1)}}},Ab=class extends Or{constructor(t,e){super()}schedule(t,e=0){return this}},ts={setInterval(t,e,...r){let{delegate:n}=ts;return n?.setInterval?n.setInterval(t,e,...r):setInterval(t,e,...r)},clearInterval(t){let{delegate:e}=ts;return(e?.clearInterval||clearInterval)(t)},delegate:void 0},Ob=class extends Ab{constructor(t,e){super(t,e),this.scheduler=t,this.work=e,this.pending=!1}schedule(t,e=0){var r;if(this.closed)return this;this.state=t;let n=this.id,i=this.scheduler;return n!=null&&(this.id=this.recycleAsyncId(i,n,e)),this.pending=!0,this.delay=e,this.id=(r=this.id)!==null&&r!==void 0?r:this.requestAsyncId(i,this.id,e),this}requestAsyncId(t,e,r=0){return ts.setInterval(t.flush.bind(t,this),r)}recycleAsyncId(t,e,r=0){if(r!=null&&this.delay===r&&this.pending===!1)return e;e!=null&&ts.clearInterval(e)}execute(t,e){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;let r=this._execute(t,e);if(r)return r;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))}_execute(t,e){let r=!1,n;try{this.work(t)}catch(i){r=!0,n=i||new Error("Scheduled action threw falsy error")}if(r)return this.unsubscribe(),n}unsubscribe(){if(!this.closed){let{id:t,scheduler:e}=this,{actions:r}=e;this.work=this.state=this.scheduler=null,this.pending=!1,Qi(r,this),t!=null&&(this.id=this.recycleAsyncId(e,t,null)),this.delay=null,super.unsubscribe()}}},qo=class Qh{constructor(e,r=Qh.now){this.schedulerActionCtor=e,this.now=r}schedule(e,r=0,n){return new this.schedulerActionCtor(this,e).schedule(n,r)}};qo.now=Ka.now;var Pb=class extends qo{constructor(t,e=qo.now){super(t,e),this.actions=[],this._active=!1}flush(t){let{actions:e}=this;if(this._active){e.push(t);return}let r;this._active=!0;do if(r=t.execute(t.state,t.delay))break;while(t=e.shift());if(this._active=!1,r){for(;t=e.shift();)t.unsubscribe();throw r}}},kb=new Pb(Ob);function Rb(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(g){try{h(n.next(g))}catch(p){o(p)}}function l(g){try{h(n.throw(g))}catch(p){o(p)}}function h(g){g.done?s(g.value):i(g.value).then(a,l)}h((n=n.apply(t,e||[])).next())})}function au(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Kr(t){return this instanceof Kr?(this.v=t,this):new Kr(t)}function Lb(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,s=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",o),i[Symbol.asyncIterator]=function(){return this},i;function o(w){return function(b){return Promise.resolve(b).then(w,p)}}function a(w,b){n[w]&&(i[w]=function(E){return new Promise(function(k,A){s.push([w,E,k,A])>1||l(w,E)})},b&&(i[w]=b(i[w])))}function l(w,b){try{h(n[w](b))}catch(E){_(s[0][3],E)}}function h(w){w.value instanceof Kr?Promise.resolve(w.value.v).then(g,p):_(s[0][2],w)}function g(w){l("next",w)}function p(w){l("throw",w)}function _(w,b){w(b),s.shift(),s.length&&l(s[0][0],s[0][1])}}function Ub(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof au=="function"?au(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(a,l){o=t[s](o),i(a,l,o.done,o.value)})}}function i(s,o,a,l){Promise.resolve(l).then(function(h){s({value:h,done:a})},o)}}var Xh=t=>t&&typeof t.length=="number"&&typeof t!="function";function Mb(t){return Ct(t?.then)}function Bb(t){return Ct(t[za])}function jb(t){return Symbol.asyncIterator&&Ct(t?.[Symbol.asyncIterator])}function $b(t){return new TypeError(`You provided ${t!==null&&typeof t=="object"?"an invalid object":`'${t}'`} where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.`)}function Fb(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Hb=Fb();function Vb(t){return Ct(t?.[Hb])}function Wb(t){return Lb(this,arguments,function*(){let e=t.getReader();try{for(;;){let{value:r,done:n}=yield Kr(e.read());if(n)return yield Kr(void 0);yield yield Kr(r)}}finally{e.releaseLock()}})}function Gb(t){return Ct(t?.getReader)}function Ja(t){if(t instanceof Ge)return t;if(t!=null){if(Bb(t))return qb(t);if(Xh(t))return zb(t);if(Mb(t))return Yb(t);if(jb(t))return Zh(t);if(Vb(t))return Kb(t);if(Gb(t))return Jb(t)}throw $b(t)}function qb(t){return new Ge(e=>{let r=t[za]();if(Ct(r.subscribe))return r.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function zb(t){return new Ge(e=>{for(let r=0;r<t.length&&!e.closed;r++)e.next(t[r]);e.complete()})}function Yb(t){return new Ge(e=>{t.then(r=>{e.closed||(e.next(r),e.complete())},r=>e.error(r)).then(null,Jh)})}function Kb(t){return new Ge(e=>{for(let r of t)if(e.next(r),e.closed)return;e.complete()})}function Zh(t){return new Ge(e=>{Qb(t,e).catch(r=>e.error(r))})}function Jb(t){return Zh(Wb(t))}function Qb(t,e){var r,n,i,s;return Rb(this,void 0,void 0,function*(){try{for(r=Ub(t);n=yield r.next(),!n.done;){let o=n.value;if(e.next(o),e.closed)return}}catch(o){i={error:o}}finally{try{n&&!n.done&&(s=r.return)&&(yield s.call(r))}finally{if(i)throw i.error}}e.complete()})}function Xb(t,e,r,n=0,i=!1){let s=e.schedule(function(){r(),i?t.add(this.schedule(null,n)):this.unsubscribe()},n);if(t.add(s),!i)return s}function Qa(t,e){return Ya((r,n)=>{let i=0;r.subscribe(Zi(n,s=>{n.next(t.call(e,s,i++))}))})}var{isArray:Zb}=Array;function t_(t,e){return Zb(e)?t(...e):t(e)}function e_(t){return Qa(e=>t_(t,e))}function r_(t,e,r,n,i,s,o,a){let l=[],h=0,g=0,p=!1,_=()=>{p&&!l.length&&!h&&e.complete()},w=E=>h<n?b(E):l.push(E),b=E=>{s&&e.next(E),h++;let k=!1;Ja(r(E,g++)).subscribe(Zi(e,A=>{i?.(A),s?w(A):e.next(A)},()=>{k=!0},void 0,()=>{if(k)try{for(h--;l.length&&h<n;){let A=l.shift();o?Xb(e,o,()=>b(A)):b(A)}_()}catch(A){e.error(A)}}))};return t.subscribe(Zi(e,w,()=>{p=!0,_()})),()=>{a?.()}}function tp(t,e,r=1/0){return Ct(e)?tp((n,i)=>Qa((s,o)=>e(n,s,i,o))(Ja(t(n,i))),r):(typeof e=="number"&&(r=e),Ya((n,i)=>r_(n,i,t,r)))}var n_=["addListener","removeListener"],i_=["addEventListener","removeEventListener"],s_=["on","off"];function es(t,e,r,n){if(Ct(r)&&(n=r,r=void 0),n)return es(t,e,r).pipe(e_(n));let[i,s]=c_(t)?i_.map(o=>a=>t[o](e,a,r)):o_(t)?n_.map(cu(t,e)):a_(t)?s_.map(cu(t,e)):[];if(!i&&Xh(t))return tp(o=>es(o,e,r))(Ja(t));if(!i)throw new TypeError("Invalid event target");return new Ge(o=>{let a=(...l)=>o.next(1<l.length?l:l[0]);return i(a),()=>s(a)})}function cu(t,e){return r=>n=>t[r](e,n)}function o_(t){return Ct(t.addListener)&&Ct(t.removeListener)}function a_(t){return Ct(t.on)&&Ct(t.off)}function c_(t){return Ct(t.addEventListener)&&Ct(t.removeEventListener)}function oi(t,e=kb){return Ya((r,n)=>{let i=null,s=null,o=null,a=()=>{if(i){i.unsubscribe(),i=null;let h=s;s=null,n.next(h)}};function l(){let h=o+t,g=e.now();if(g<h){i=this.schedule(void 0,h-g),n.add(i);return}a()}r.subscribe(Zi(n,h=>{s=h,o=e.now(),i||(i=e.schedule(l,t),n.add(i))},()=>{a(),n.complete()},void 0,()=>{s=i=null}))})}var l_=dt(yu()),lu=class{static UTM_PARAMS=["utm_source","utm_medium","utm_campaign","utm_term","utm_content","utm_id"];static TW_PARAMS={utm_source:"tw_source",utm_campaign:"tw_campaign"};static getReferrer(){if(document.referrer)return document.referrer.replace(location.origin,"")}static getUTMParams(){let t;try{t=new l_.URLBuilder(location.href)}catch{return{}}let e={};this.UTM_PARAMS.forEach(n=>{let i=t.getQueryParam(n);i&&(e[n]=i)});let r={};return Object.keys(this.TW_PARAMS).forEach(n=>{let i=t.getQueryParam(this.TW_PARAMS[n]);i&&(r[n]=i)}),D(D({},r),e)}},ws=class ep{origin;path;qs;name;referrer;utmSource;utmMedium;utmCampaign;utmId;utmTerm;utmContent;constructor(e){this.name=e.name,this.path=e.path,this.qs=e.qs,this.referrer=e.referrer,this.utmSource=e.utmSource||e.utm_source,this.utmMedium=e.utmMedium||e.utm_medium,this.utmCampaign=e.utmCampaign||e.utm_campaign,this.utmId=e.utmId||e.utm_id,this.utmTerm=e.utmTerm||e.utm_term,this.utmContent=e.utmContent||e.utm_content}static parseFromCurrent(){let e=location.pathname==="/"?location.pathname:location.pathname.replace(/\/+$/,"");return new ep(D({origin:location.origin,path:e,qs:location.search,referrer:lu.getReferrer(),name:kt.get().pageName},lu.getUTMParams()))}},u_=" daum[ /]| deusu/| yadirectfetcher|(?:^|[^g])news(?!sapphire)|(?<! (?:channel/|google/))google(?!(app|/google| pixel))|(?<! cu)bots?(?:\\b|_)|(?<!(?:lib))http|(?<![hg]m)score|(?<!cam)scan|@[a-z][\\w-]+\\.|\\(\\)|\\.com\\b|\\btime/|\\||^<|^[\\w \\.\\-\\(?:\\):%]+(?:/v?\\d+(?:\\.\\d+)?(?:\\.\\d{1,10})*?)?(?:,|$)|^[^ ]{50,}$|^\\d+\\b|^\\w*search\\b|^\\w+/[\\w\\(\\)]*$|^active|^ad muncher|^amaya|^avsdevicesdk/|^biglotron|^bot|^bw/|^clamav[ /]|^client/|^cobweb/|^custom|^ddg[_-]android|^discourse|^dispatch/\\d|^downcast/|^duckduckgo|^email|^facebook|^getright/|^gozilla/|^hobbit|^hotzonu|^hwcdn/|^igetter/|^jeode/|^jetty/|^jigsaw|^microsoft bits|^movabletype|^mozilla/\\d\\.\\d\\s[\\w\\.-]+$|^mozilla/\\d\\.\\d\\s\\(compatible;?(?:\\s\\w+\\/\\d+\\.\\d+)?\\)$|^navermailapp|^netsurf|^offline|^openai/|^owler|^php|^postman|^python|^rank|^read|^reed|^rest|^rss|^snapchat|^space bison|^svn|^swcd |^taringa|^thumbor/|^track|^w3c|^webbandit/|^webcopier|^wget|^whatsapp|^wordpress|^xenu link sleuth|^yahoo|^yandex|^zdm/\\d|^zoom marketplace/|^{{.*}}$|analyzer|archive|ask jeeves/teoma|audit|bit\\.ly/|bluecoat drtr|browsex|burpcollaborator|capture|catch|check\\b|checker|chrome-lighthouse|chromeframe|classifier|cloudflare|convertify|crawl|cypress/|dareboost|datanyze|dejaclick|detect|dmbrowser|download|evc-batch/|exaleadcloudview|feed|firephp|functionize|gomezagent|grab|headless|httrack|hubspot marketing grader|hydra|ibisbrowser|infrawatch|insight|inspect|iplabel|ips-agent|java(?!;)|library|linkcheck|mail\\.ru/|manager|measure|neustar wpm|node|nutch|offbyone|onetrust|optimize|pageburst|pagespeed|parser|perl|phantomjs|pingdom|powermarks|preview|proxy|ptst[ /]\\d|retriever|rexx;|rigor|rss\\b|scrape|server|sogou|sparkler/|speedcurve|spider|splash|statuscake|supercleaner|synapse|synthetic|tools|torrent|transcoder|url|validator|virtuoso|wappalyzer|webglance|webkit2png|whatcms/|xtate/",h_=/bot|crawl|http|lighthouse|scan|search|spider/i,Nn;function p_(){if(Nn instanceof RegExp)return Nn;try{Nn=new RegExp(u_,"i")}catch{Nn=h_}return Nn}function d_(t){return!!t&&p_().test(t)}var zo={d:(t,e)=>{for(var r in e)zo.o(e,r)&&!zo.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},Xa={};zo.d(Xa,{A:()=>f_,k:()=>Za});var An=function(t,e,r,n){return new(r||(r=Promise))(function(i,s){function o(h){try{l(n.next(h))}catch(g){s(g)}}function a(h){try{l(n.throw(h))}catch(g){s(g)}}function l(h){var g;h.done?i(h.value):(g=h.value,g instanceof r?g:new r(function(p){p(g)})).then(o,a)}l((n=n.apply(t,e||[])).next())})},On=function(t,e){var r,n,i,s,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(l){return function(h){return function(g){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,g[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&g[0]?n.return:g[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,g[1])).done)return i;switch(n=0,i&&(g=[2&g[0],i.value]),g[0]){case 0:case 1:i=g;break;case 4:return o.label++,{value:g[1],done:!1};case 5:o.label++,n=g[1],g=[0];continue;case 7:g=o.ops.pop(),o.trys.pop();continue;default:if(i=o.trys,!((i=i.length>0&&i[i.length-1])||g[0]!==6&&g[0]!==2)){o=0;continue}if(g[0]===3&&(!i||g[1]>i[0]&&g[1]<i[3])){o.label=g[1];break}if(g[0]===6&&o.label<i[1]){o.label=i[1],i=g;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(g);break}i[2]&&o.ops.pop(),o.trys.pop();continue}g=e.call(t,o)}catch(p){g=[6,p],n=0}finally{r=i=0}if(5&g[0])throw g[1];return{value:g[0]?g[1]:void 0,done:!0}}([l,h])}}};function Za(){return An(this,void 0,Promise,function(){return On(this,function(t){switch(t.label){case 0:return[4,new Promise(function(e,r){var n="Unknown",i=!1;function s(w){i||(i=!0,e({isPrivate:w,browserName:n}))}function o(){var w=0,b=parseInt("-1");try{b.toFixed(b)}catch(E){w=E.message.length}return w}function a(){return navigator.msSaveBlob!==void 0&&function(w){try{return w===eval.toString().length}catch{return!1}}(39)}function l(){var w;return An(this,void 0,void 0,function(){var b,E;return On(this,function(k){switch(k.label){case 0:return k.trys.push([0,2,,3]),[4,navigator.storage.getDirectory()];case 1:return k.sent(),s(!1),[3,3];case 2:return b=k.sent(),E=b,b instanceof Error&&(E=(w=b.message)!==null&&w!==void 0?w:b),typeof E!="string"?(s(!1),[2]):(s(!!E.includes("unknown transient reason")),[3,3]);case 3:return[2]}})})}function h(){var w;return An(this,void 0,Promise,function(){return On(this,function(b){switch(b.label){case 0:return((w=navigator.storage)===null||w===void 0?void 0:w.getDirectory)===void 0?[3,2]:[4,l()];case 1:return b.sent(),[3,3];case 2:navigator.maxTouchPoints!==void 0?function(){var E=String(Math.random());try{var k=indexedDB.open(E,1);k.onupgradeneeded=function(A){var M=A.target.result,z=function(B){s(B)};try{M.createObjectStore("t",{autoIncrement:!0}).put(new Blob),z(!1)}catch(B){(B.message||"").includes("are not yet supported")?z(!0):z(!1)}finally{M.close(),indexedDB.deleteDatabase(E)}},k.onerror=function(){return s(!1)}}catch{s(!1)}}():function(){var E=window.openDatabase,k=window.localStorage;try{E(null,null,null,null)}catch{return void s(!0)}try{k.setItem("test","1"),k.removeItem("test")}catch{return void s(!0)}s(!1)}(),b.label=3;case 3:return[2]}})})}function g(){navigator.webkitTemporaryStorage.queryUsageAndQuota(function(w,b){var E;s(Math.round(b/1048576)<2*Math.round(((E=window).performance!==void 0&&E.performance.memory!==void 0&&E.performance.memory.jsHeapSizeLimit!==void 0?performance.memory.jsHeapSizeLimit:1073741824)/1048576))},function(w){r(new Error("detectIncognito somehow failed to query storage quota: "+w.message))})}function p(){self.Promise!==void 0&&self.Promise.allSettled!==void 0?g():(0,window.webkitRequestFileSystem)(0,1,function(){s(!1)},function(){s(!0)})}function _(){return An(this,void 0,Promise,function(){var w,b;return On(this,function(E){switch(E.label){case 0:if(!navigator.storage||!navigator.storage.getDirectory)return[3,4];E.label=1;case 1:return E.trys.push([1,3,,4]),[4,navigator.storage.getDirectory()];case 2:return E.sent(),s(!1),[3,4];case 3:return w=E.sent(),typeof(b=w instanceof Error&&typeof w.message=="string"?w.message:String(w))!="string"?(s(!1),[2]):(s(b.includes("Security error")),[2]);case 4:return s(navigator.serviceWorker===void 0),[2]}})})}(function(){return An(this,void 0,Promise,function(){return On(this,function(w){switch(w.label){case 0:return o()!==44?[3,2]:(n="Safari",[4,h()]);case 1:return w.sent(),[3,6];case 2:return o()!==51?[3,3]:(b=navigator.userAgent,n=b.match(/Chrome/)?navigator.brave!==void 0?"Brave":b.match(/Edg/)?"Edge":b.match(/OPR/)?"Opera":"Chrome":"Chromium",p(),[3,6]);case 3:return o()!==25?[3,5]:(n="Firefox",[4,_()]);case 4:return w.sent(),[3,6];case 5:a()?(n="Internet Explorer",s(window.indexedDB===void 0)):r(new Error("detectIncognito cannot determine the browser")),w.label=6;case 6:return[2]}var b})})})().catch(r)})];case 1:return[2,t.sent()]}})})}typeof window<"u"&&(window.detectIncognito=Za);var f_=Za,g_=Xa.A,RE=Xa.k,m_=dt(an()),y_=class{result={};async safeGet(){try{return await this.get()}catch(t){return Jt.getInstance().captureException(t,{message:"Unable to collect device properties"}),this.result}}async get(){let t=this.result,e=window.CooeeSDK.uaParser;this.getDeviceMemory(),this.getNetworkType(),this.getOrientation(),t.referrer=document.referrer,t.host=location.origin,t.path=location.pathname,t.qs=location.search,t.locale=navigator.language,t.display={w:screen.width,h:screen.height,pd:screen.pixelDepth,dpi:this.getDPI()},t.win={ow:window.outerWidth,oh:window.outerHeight,iw:window.innerWidth,ih:window.innerHeight,dpr:window.devicePixelRatio},navigator.webdriver&&(t.headless=!0);let r=e.getResult();return t.browser=r.browser,t.device=r.device,t.engine=r.engine,t.cpu=r.cpu,t.os=r.os,t.navigatorUA=navigator.userAgent,await Promise.all([this.getBatteryInfo(),this.getLocation(),this.checkIncognito()]),t}getDeviceMemory(){let t=navigator;if(!t.deviceMemory)return;let e=t.deviceMemory;this.result.mem={tot:e*1024}}getNetworkType(){let t=navigator,e=t.connection||t.mozConnection||t.webkitConnection;e?.effectiveType&&(this.result.net={type:e.effectiveType})}getOrientation(){let t=screen.orientation?.type;t&&(this.result.orientation=t)}getDPI(){if(!document.body)return;let t=document.createElement("div");t.setAttribute("style","height: 1in; left: -100%; position: absolute; top: -100%; width: 1in;"),document.body.appendChild(t);let e=window.devicePixelRatio||1,r=t.offsetWidth*e;return document.body.removeChild(t),r}async getLocation(){if(!(!navigator.geolocation||!navigator.permissions||!navigator.permissions.query)){if((await navigator.permissions.query.bind(navigator.permissions)({name:"geolocation"})).state!="granted"){console.log("getLocation:155");return}return new Promise(t=>{navigator.geolocation.getCurrentPosition(e=>{this.result.coords=[e.coords.latitude,e.coords.longitude],t()},()=>t())})}}async getBatteryInfo(){if("getBattery"in navigator)try{let t=await navigator.getBattery();this.result.bat={l:t.level*100,c:t.charging}}catch{}}async checkIncognito(){try{(await g_())?.isPrivate&&(this.result.incognito=!0)}catch(t){m_.default.error("Unable to detect private/incognito window",t)}}},rp=class{static trackDeviceID(t){this.isInstalled()}static trackIntent(t){if(!this.isInstalled())return;let e=us[t]?.toLowerCase();e&&(x.debug(`Sending ${e} intent to MS Clarity`),window.clarity("set","Cooee Intent",e))}static isInstalled(){return window.clarity&&typeof window.clarity=="function"}},v_=dt(lr()),np=class{constructor(t,e){this._startTime=t,this._triggerData=e}intervals=[];selectedEmbeddedItems;renderer;closeCallback;inputFields=[];get startTime(){return this._startTime}get triggerData(){return this._triggerData}get inputs(){return this.inputFields}get rootClassName(){let t=this.triggerData.shortID??this.triggerData.id.slice(-6);return t==="test"&&(t="test-"+this.startTime.getTime().toString()),q.IN_APP_WRAPPER_NAME+"-"+t}get selectedItems(){return this.triggerData.items.filter(t=>t.selected.value)}get shouldGiveFBTDiscount(){let t=this.selectedItems.length;return this.triggerData.bundleConfig?.applyDiscountOnMinimum?this.triggerData.bundleConfig.applyDiscountOnMinimum<=t:t===this.triggerData.items.length}onClose(t){this.closeCallback=t}closeInApp(t,e){e??={};let r=(new Date().getTime()-this.startTime.getTime())/1e3,n=D({eventName:t,duration:r},e);this.stopIntervals(),this.closeCallback&&this.closeCallback(n)}addInputField(t,e){this.inputFields.push({id:t,type:e,isValid:!1})}updateValidation(t,e){this.inputFields.forEach(r=>{if(r.id===t){r.isValid=e;return}})}hasManipulatedProductQuantity(){let t=this.triggerData.manipulation.productQuantity;return t?.enabled&&t.min!=null&&t.max!=null}getManipulatedQuantity(t){let{min:e=1,max:r=100}=this.triggerData.manipulation.productQuantity;if(e>r)return x.error("Invalid range: min should be less than or equal to max."),t;if(t>=e&&t<=r)return t;let n=t%100;return n<e?e:n>r?r:n}stopIntervals(){this.intervals.forEach(t=>clearInterval(t))}},w_=class{loadedFonts=[];async loadAllFonts(t){t.elems?.forEach(e=>{e instanceof ls&&this.loadFamily(e.typography?.fam)})}async loadFamily(t){if(!t?.fonts||this.loadedFonts.indexOf(t.name)>-1)return;let e=[];t.fonts.forEach(r=>{if(r.url){let n=new FontFace(q.COOEE+t.name,r.getURL(),r.getFontDescriptor());e.push(n.load())}}),this.loadedFonts.push(t.name),(await Promise.all(e)).forEach(r=>{document.fonts.add(r)})}},io=dt(an()),tc=class ip{static INSTANCE=new ip;topics={};constructor(){}static get(){return this.INSTANCE}broadcast(e,r){this.topics[e]||(this.topics[e]=new cr),this.topics[e].next(r)}subscriber(e){return this.topics[e]||(this.topics[e]=new cr),this.topics[e].asObservable()}},Ee=class Ce{static DEFAULT_SELECTOR="cart-drawer";static _instance;inShadow=!1;cartDrawerElement;cartDrawerShadowElement;configWebsite=se.get().website??{};currentState=!1;drawerSubject=new Db({open:!1,firstOpen:!1});mutationObserver;firstOpen=!0;selector;shadowParentElementSelector;iconSelector=['button[drawer-to-open="cart-drawer"]','a[href="/cart"]',".header__icon--cart","#cart-icon-bubble",".cart-icon-bubble",".cart-count",'a[onclick*="handleFloCartBtn"]'].join(",");cartSelector=[Ce.DEFAULT_SELECTOR,"#halo-cart-sidebar",'[role="dialog"][class*="cart" i]','[id*="section-cart" i]',"#sidebar-cart","#rebuy-cart","#mini-cart","#flo-cart-wrapper","#drawer-cart","#UpcartPopupBackDrop",'[id$="CartDrawer" i]'].join(",");constructor(){this.initialize(),document.addEventListener(q.CTA_AFTER_REFRESH_UI,this.updateBubble.bind(this))}get element(){return this.cartDrawerElement}static get(){return Ce._instance||(Ce._instance=new Ce),Ce._instance}static forceUpdate(){Ce._instance=new Ce}isOpen(){let e=this.inShadow?this.isPresent():this.isVisible();return io.default.log(`Cart drawer is currently ${e?"open":"close"}`),e}open(){if(this.isOpen()){x.log("Drawer is already open");return}document.dispatchEvent(new CustomEvent(q.CTA_OPEN_CART_EVENT));let e=document.querySelector(this.iconSelector);if(!e){x.debug("No clickable cart icon found with selector",this.iconSelector);return}e.click()}onToggle(){return this.drawerSubject}isShopifyDefaultDrawer(){return this.element?.tagName.toLowerCase()===Ce.DEFAULT_SELECTOR}isMiniCart(){return this.isShopifyDefaultDrawer()&&this.element?.id==="mini-cart"}refreshUI(e,r=!0){if(this.isMiniCart()&&this.element?._rerenderCart)this.element._rerenderCart({detail:{cart:e}});else if(window.MinimogTheme?.Cart?.renderNewCart)window.MinimogTheme.Cart.renderNewCart();else if(this.isShopifyDefaultDrawer()&&this.element?.renderContents&&e)this.element.classList.remove("is-empty"),this.element.renderContents?.(e);else if(this.element?.onCartDrawerUpdate)this.element.onCartDrawerUpdate();else if(window.cartGiftUpdate){if(!e?.items?.[0])return;let n=e.items[0].id,i=e.items[0].quantity,s=e.items[0].price;window.cartGiftUpdate(n,s,i,"","ADD_TO_CART")}else if(window.icartCartActivityEvent)window.icartCartActivityEvent();else if(window.theme?.CartDrawer)window.theme?.CartDrawer.init?new window.theme.CartDrawer().init():new window.theme.CartDrawer;else if(window.Hs_CartDrawer?.updateSlideCart)window.Hs_CartDrawer.updateSlideCart();else if(window.theme?.fetch_side_cart)window.theme.fetch_side_cart();else if(window.theme?.Cart?.updateCart)window.theme.Cart.updateCart();else if(window.cartUpdate)window.cartUpdate();else if(this.element?._onCartRefresh)this.element._onCartRefresh();else if(window.cart?.getCart)window.cart.getCart();else if(this.element?.tagName?.toLowerCase()==="cart-drawer-component")document.dispatchEvent(new CustomEvent("action:cart:updateCartandShowCart"));else if(this.element?.id==="sidebar-cart")document.body.dispatchEvent(new CustomEvent("cart:refresh",{bubbles:!0,detail:{}}));else if(this.element?.id==="quick-cart"){let n=document.querySelector('a[href="/cart"]');n&&n.click()}else window.Shopify?.KT_onItemAdded?window.Shopify.KT_onItemAdded():window.sideCart?.updateCart?window.sideCart.updateCart():window.SLIDECART_UPDATE?(window.SLIDECART_UPDATE(),window.SLIDECART_OPEN?.()):window.refreshCart?Ot.getCurrent().getNormalisedCart(!0).then(()=>{window.refreshCart(Ot.getCurrent())}):window.OPEN_CART?window.OPEN_CART():window.updateCart?window.updateCart():(x.info("No method found to update the cart drawer. Blindly firing some events to try"),document.dispatchEvent(new CustomEvent("cart:refresh",{bubbles:!0})));document.dispatchEvent(new CustomEvent(q.CTA_AFTER_REFRESH_UI)),r&&tc.get().broadcast(q.CART_UPDATE_BROADCAST)}async initialize(){let e=this.configWebsite.cartDrawerSelector;if(!e){await this.findCartDrawer();return}let r=e.split(q.SHADOW_SPLITTER);r.length===1?(this.selector=r[0],await this.findCartDrawer()):(this.inShadow=!0,this.shadowParentElementSelector=r[0]?.trim(),this.selector=r[1]?.trim(),await this.findCartDrawerWithShadow())}async findCartDrawer(){if(!pa())return;let e=this.selector||this.cartSelector;if(this.cartDrawerElement=await qi(e),!this.cartDrawerElement){io.default.warn("Max attempts exhausted to find cart drawer");return}io.default.log("Found",this.cartDrawerElement,`from selector: ${e}`),this.createMutationObservers()}async findCartDrawerWithShadow(){if(!this.shadowParentElementSelector)return;let e=(await qi(this.shadowParentElementSelector))?.shadowRoot;e?.mode==="open"&&(this.cartDrawerShadowElement=e,this.createMutationObservers())}isVisible(){if(!this.cartDrawerElement)return!1;if(this.cartDrawerElement.tagName.toLowerCase()===Ce.DEFAULT_SELECTOR&&this.cartDrawerElement.open)return!0;if(this.cartDrawerElement.id==="cart-drawer__container")return this.cartDrawerElement.classList.contains("cart-drawer-open");let e=this.cartDrawerElement.getBoundingClientRect(),r=(window.innerHeight||document.documentElement.clientHeight)+.5,n=(window.innerWidth||document.documentElement.clientWidth)+.5,i=e.top<=r&&e.bottom>=0,s=e.left<=n&&e.right>=0,o=i&&s,a=getComputedStyle(this.cartDrawerElement),l=a.display!=="none"&&a.visibility!=="hidden"&&parseFloat(a.opacity)>0,h=!this.cartDrawerElement.hidden,g=this.cartDrawerElement.offsetWidth>0||this.cartDrawerElement.offsetHeight>0||this.cartDrawerElement.getClientRects().length>0,p=a.transform.match(/matrix\(([^)]+)\)/),_=0,w=0;if(p){let B=p[1].split(", ").map(parseFloat);_=B[4],w=B[5]}let b=_+e.left>n||_+e.right<0||w+e.top>r||w+e.bottom<0,E=Math.max(0,Math.min(e.right,n)-Math.max(e.left,0)),k=Math.max(0,Math.min(e.bottom,r)-Math.max(e.top,0)),A=E*k,M=e.width*e.height,z=M>0&&A/M>=.1;return(o||!b)&&l&&h&&g&&z}createMutationObservers(){!this.cartDrawerElement&&!this.cartDrawerShadowElement||(Cv(this.cartDrawerElement,()=>{this.initialize()}),this.watchForCartToggle())}watchForCartToggle(){let e=this.cartDrawerElement||this.cartDrawerShadowElement,r=new cr;this.mutationObserver?.disconnect(),this.mutationObserver=new MutationObserver(()=>{r.next()}),this.mutationObserver.observe(e,{attributes:!0,subtree:!0,childList:this.inShadow}),r.pipe(oi(500)).subscribe(()=>{let n=this.isOpen();this.currentState!==n&&(this.currentState=n,this.drawerSubject.next({open:n,firstOpen:this.firstOpen}),this.firstOpen&&(this.firstOpen=!1))})}isPresent(){return!this.selector||!this.cartDrawerShadowElement?!1:!!this.cartDrawerShadowElement.querySelector(this.selector)}async updateBubble(){let e=(await Ot.getCurrent().getNormalisedCart(!0)).itemCount,r=document.querySelector(".cart-link__bubble");r&&(r.innerText=e+"")}},Qe=dt(lr()),b_=dt(Nd()),Yo=class{static _flags={};static getFlags(){return this._flags}static setFlags(t){this._flags=t??{}}static isECommerceApp(){return pa()}},__=(0,b_.default)(fetch),E_={retryDelay:q.API_CALL_RETRY_DELAY,retryOn:(t,e,r)=>t>=q.API_CALL_MAX_ATTEMPTS?!1:!!(e!==null||r?.status&&r?.status>=500)},Lr=class sp{static INSTANCE;apiToken="";firstSeen="";constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new sp),this.INSTANCE}async validateSession(e){return this.post("/v1/event/validate-session",e)}updateUserData(e){this.put("/v1/user/update",e).then(async r=>{x.log("Updated user profile"),await Jo.getInstance().storeAndPopulateAuthData(r)}).catch(r=>{x.error("Error saving user profile",r)})}trackOrder(e){this.post("/v1/event/track-order",e).then(()=>{x.log("Sent Order")}).catch(r=>{x.error("Error sending track order",r)})}generateDiscount(e){return this.post("/v1/event/generate-discount",e)}updateDeviceProps(e){this.put("/v1/device/update",e).then(()=>{x.log("Updated device property")}).catch(async r=>{x.error("Error saving device property",r)})}setAPIToken(e){this.apiToken=e??""}setFirstSeen(e){this.firstSeen=e?.toUTCString()??""}get(e){return this.requestBackend("GET",e)}post(e,r){return this.requestBackend("POST",e,r)}put(e,r){return this.requestBackend("PUT",e,r)}async requestBackend(e,r,n){if(!Yo.isECommerceApp()&&!Yo.getFlags().allowEvents)return x.log(`Rejecting ${e} ${r} as this is not e-commerce app`),Promise.reject();r.startsWith("http")||(r=Pe.apiURL+r);let i=this.getDefaultHeaders(),s="keepalive"in new Request("");if(n&&!s&&JSON.stringify(n).includes("CE App Background"))try{return this.performXMLHttpRequest(r,i,n)}catch(a){return Jt.getInstance().captureException(a,{body:JSON.stringify(n)}),{}}let o={method:e,headers:i,keepalive:!0};return n&&(o.body=JSON.stringify(n)),this.request(r,o)}async request(e,r){let n=D(D({},E_),r),i=await __(e,n);if(!i.ok)throw i;return i.json()}performXMLHttpRequest(e,r,n){return new Promise((i,s)=>{let o=new XMLHttpRequest;o.open("POST",e,!0),r.forEach((a,l)=>{o.setRequestHeader(l,a)}),o.onreadystatechange=()=>{if(o.readyState===XMLHttpRequest.DONE)if(o.status>=200&&o.status<300)try{o.getResponseHeader("Content-Type")?.includes("application/json")?i(JSON.parse(o.responseText)):s(new Error("Content-Type of response header is not json"))}catch(a){s(a)}else s(new Error(`Received status - ${o.status}(${o.statusText})`))},o.onerror=()=>{s(new Error("Network error occurred during the request."))},o.send(JSON.stringify(n))})}getDefaultHeaders(){let e=new Headers;return e.set("content-type","application/json"),e.set("cooee-sdk",q.SDK),e.set("cooee-sdk-code",q.SDK_VERSION_CODE.toString()),e.set("cooee-sdk-version",q.SDK_VERSION),e.set("cooee-first-seen",this.firstSeen),this.apiToken&&e.append("cooee-sdk-token",this.apiToken),Pe.debug&&e.set("cooee-sdk-debug",String(1)),e}},S_=`
|
|
39
39
|
mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]) {
|
|
40
40
|
cartDiscountCodesUpdate(cartId: $cartId, discountCodes: $discountCodes) {
|
|
41
41
|
cart {
|
|
@@ -47,7 +47,7 @@ mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]) {
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
-
`,$n=class{static navigate(t,e,r){let n=`${location.origin}/discount/${t}`;switch(x.log(`Applying discount code ${t}`,e,r),e){case Qe.RedirectBehaviour.CART_PAGE:location.href=`${n}?redirect=/cart`;break;case Qe.RedirectBehaviour.CART_DRAWER:location.href=`${n}?redirect=${location.pathname}#${q.HASH_OPEN_CART_DRAWER}=1`;break;case Qe.RedirectBehaviour.SHOPIFY_CHECKOUT:location.href=`${n}?redirect=/checkout`;break;case Qe.RedirectBehaviour.THIRD_PARTY_CHECKOUT:this.checkThirdPartyMethods(`${n}?redirect=/cart#${q.HASH_INITIATE_CHECKOUT}=1`);break;default:location.href=`${n}?redirect=${r||location.pathname}`}}static navigateWithoutDiscount(t,e){let r=Ee.get();switch(t){case Qe.RedirectBehaviour.CART_PAGE:location.href="/cart";break;case Qe.RedirectBehaviour.SHOPIFY_CHECKOUT:location.href="/checkout";break;case Qe.RedirectBehaviour.THIRD_PARTY_CHECKOUT:this.checkThirdPartyMethods(`/cart#${q.HASH_INITIATE_CHECKOUT}=1`);break;case Qe.RedirectBehaviour.CART_DRAWER:{r.open();break}}e&&r.refreshUI(e)}static async applyWithStorefront(t){let e=se.get().storefrontToken;if(!e)throw new Error("Storefront token not set for the store");let r=new Headers;r.append("Content-Type","application/json"),r.append("X-Shopify-Storefront-Access-Token",e);let n=JSON.stringify({query:
|
|
50
|
+
`,$n=class{static navigate(t,e,r){let n=`${location.origin}/discount/${t}`;switch(x.log(`Applying discount code ${t}`,e,r),e){case Qe.RedirectBehaviour.CART_PAGE:location.href=`${n}?redirect=/cart`;break;case Qe.RedirectBehaviour.CART_DRAWER:location.href=`${n}?redirect=${location.pathname}#${q.HASH_OPEN_CART_DRAWER}=1`;break;case Qe.RedirectBehaviour.SHOPIFY_CHECKOUT:location.href=`${n}?redirect=/checkout`;break;case Qe.RedirectBehaviour.THIRD_PARTY_CHECKOUT:this.checkThirdPartyMethods(`${n}?redirect=/cart#${q.HASH_INITIATE_CHECKOUT}=1`);break;default:location.href=`${n}?redirect=${r||location.pathname}`}}static navigateWithoutDiscount(t,e){let r=Ee.get();switch(t){case Qe.RedirectBehaviour.CART_PAGE:location.href="/cart";break;case Qe.RedirectBehaviour.SHOPIFY_CHECKOUT:location.href="/checkout";break;case Qe.RedirectBehaviour.THIRD_PARTY_CHECKOUT:this.checkThirdPartyMethods(`/cart#${q.HASH_INITIATE_CHECKOUT}=1`);break;case Qe.RedirectBehaviour.CART_DRAWER:{r.open();break}}e&&r.refreshUI(e)}static async applyWithStorefront(t){let e=se.get().storefrontToken;if(!e)throw new Error("Storefront token not set for the store");let r=new Headers;r.append("Content-Type","application/json"),r.append("X-Shopify-Storefront-Access-Token",e);let n=JSON.stringify({query:S_,variables:{cartId:`gid://shopify/Cart/${Ot.getCurrent().token}`,discountCodes:t}}),i={method:"POST",headers:r,body:n};x.debug(`Applying ${t.length} coupons on cart`),await Lr.getInstance().request(q.GRAPHQL_API_PATH,i)}static checkThirdPartyMethods(t){window.triggerGokwikCustomCheckout?window.triggerGokwikCustomCheckout():window.shiprocketCheckoutEvents?.buyCart?window.shiprocketCheckoutEvents.buyCart():window.openCheckout?window.openCheckout():window.openRzpCheckout?window.openRzpCheckout():location.href=t}},I_=dt(Qn()),C_=`
|
|
51
51
|
mutation cartCreate($input: CartInput) {
|
|
52
52
|
cartCreate(input: $input) {
|
|
53
53
|
cart {
|
|
@@ -60,11 +60,11 @@ mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]) {
|
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
-
`,tc=class{sentryService=lt.get(Kt);async addToCart(t,e){if(!t.length)return;let r=t.map(a=>{let{vID:l,quantity:h}=this.getVIDAndQuantity(a);return{id:l?+l:+a.mID,quantity:h,properties:e.getPrivateAttributesForLineItem()}}),n=jn("cart/add.js"),i={items:r},s=Ee.get();s.isMiniCart()?i.sections=["mini-cart"]:s.isShopifyDefaultDrawer()&&(i.sections=s.element.getSectionsToRender?.().map(a=>a.section??a.id));let o=JSON.stringify(i);try{let a=await fetch(n,{body:o,method:"post",headers:{"Content-Type":"application/json"}});if(a.status===200||a.status===302)return x.log(`Added ${t.length} items to Cart`),tr("Product added to your cart"),a.json()}catch(a){tr("Fail to add product in cart"),this.sentryService.captureError("Fail to add product in cart",a,{body:o},{"shopify.shop":window.Shopify?.shop})}}async updateLineItem(t,e){if(!E_.JSUtils.hasKeys(e)){x.warn("No update fields provided");return}let r=jn("cart/change.js"),n=D({id:t.key},e),i=JSON.stringify(n);try{let s=await fetch(r,{body:i,method:"post",headers:{"Content-Type":"application/json"}});if(s.status===200||s.status===302){let o=await s.json();x.log(`Updated ${t}`),Ot.getCurrent().update(o)}}catch(s){tr("Failed to update item in cart"),this.sentryService.captureError("Failed to update item in cart",s,{body:i},{"shopify.shop":window.Shopify?.shop})}}async copyDiscountCode(t){if(t)try{await navigator.clipboard.writeText(t),x.log(`Code-${t} copied`),tr("Discount code copied")}catch(e){x.error("Failed to copy code",e)}}goToItem(t){if(!t?.link)return;let e=gf(t.link);e&&(location.pathname=Fi()+"products/"+e)}async upgradeToSubscription(t,e){if(!t){x.warn("Trying to upgrade to subscription with no item");return}let r=await Ot.getCurrent().getNormalisedCart(),n=t.selectedOrFirstVariant.value,i=r.items.findIndex(h=>h.vID===n.mID),s=n.selectedSellingPlan.value,o=jn("cart/change.js"),a={line:i+1,selling_plan:s?.mID||null,properties:e.getPrivateAttributesForLineItem()},l=JSON.stringify(a);try{let h=await fetch(o,{body:l,method:"post",headers:{"Content-Type":"application/json"}});if(h.status===200||h.status===302){x.log(`Upgraded ${t} selling plan`),tr("Line item updated");let g=await h.json();return Ot.getCurrent().update(g),g}}catch(h){tr("Failed to update subscription"),this.sentryService.captureError("Failed to update subscription",h,{body:l},{"shopify.shop":window.Shopify?.shop})}}async createNewCart(t,e,r){let n=se.get().storefrontToken;if(!n)throw new Error("Storefront token not set for the store");if(!t?.vID){x.error("No variant ID found to perform Buy now",t);return}let i=e?[e]:[],s=[{merchandiseId:`gid://shopify/ProductVariant/${t.vID}`,quantity:1,attributes:r.getKVFormatPrivateAttributesForLineItem()}],o=await dh(),a=new Headers;a.append("Content-Type","application/json"),a.append("X-Shopify-Storefront-Access-Token",n);let l=JSON.stringify({query:S_,variables:{input:{lines:s,discountCodes:i,attributes:o}}});return(await Lr.getInstance().request(q.GRAPHQL_API_PATH,{method:"POST",headers:a,body:l})).data?.cartCreate?.cart?.checkoutUrl}async process(t){let e=t.clickAction,r=t.items,n=t.triggerData;if(e.at){let i=e;if(x.log(`Performing ${JSON.stringify(i)} action`),i.at===101)r?.length&&this.goToItem(r[0]);else if(i.at===102)r?.length&&await this.addToCart(r,n);else if(i.at===103)await this.copyDiscountCode(n.discount.code);else if(i.at===105)Ee.get().open();else if(i.at===104){let s=t.collections;if(!s?.length)return;location.pathname=Fi()+"collections/"+s[0].handle}}e.applyDiscount&&n.discount?.code&&$n.navigate(n.discount.code,n.redirectBehaviour)}getVIDAndQuantity(t){let e,r;if(t instanceof pn)e=t.vID,r=t.quantity??1;else{if(!t.vars?.length)return{};e=t.selectedOrFirstVariant.value.mID,r=1}return{vID:e,quantity:r}}},I_=class{static updateIdentity(t){if(!this.isInstalled())return;let e={};t.email&&(e.email=t.email),t.mobile&&(e.phone_number=t.mobile),x.debug("Sending email/mobile to Klaviyo"),window.klaviyo.push(["identify",e])}static isInstalled(){return window.klaviyo&&typeof window.klaviyo=="object"}},C_=class{apiService;action;triggerContext;constructor(t,e){this.action=t,this.apiService=$t.getInstance(),this.triggerContext=e}async execute(){let t=this.containsCTA()?q.EVENT_TRIGGER_CLICKED:q.EVENT_TRIGGER_CLOSED;switch(this.action.at!==106&&await this.closeTriggerAndSendEvent(t),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:x.error("Received an invalid ClickActionType: ",this.action.at);return}}externalAction(){this.action.ext?.u&&window.open(this.action.ext.u,"_blank")?.focus()}gotoURLAction(){if(this.action.gu?.u){let t=this.action.gu.u;uh(t)||(t=`//${t}`),window.open(t,"_self")}}async closeTriggerAndSendEvent(t,e){this.triggerContext.closeInApp(t,e),await this.dispatchEvent()}shareAction(){if(this.action.share){if(!navigator.share){x.warn("Navigator.share is not compatible with this browser");return}navigator.share({text:this.action.share.text,title:"Share"}).then(t=>console.log(t)).catch(t=>console.error(t))}}containsCTA(){return this.action.at&&this.action.at!==1?!0:!(this.isEmpty(this.action.custKV)&&this.isEmpty(this.action.up))}isEmpty(t){return t?Object.keys(t).length===0:!0}async collectFormData(){let t={};for(let e of this.triggerContext.inputs){if(!e.isValid)return;let r=document.getElementById(e.id).value;e.type===51?t.email=r:e.type===52&&(t.mobile=r)}await this.closeTriggerAndSendEvent(q.EVENT_FORM_SUBMITTED,{form:t}),tr("Coupon applied on cart"),I_.updateIdentity(t)}async dispatchEvent(){let t=this.triggerContext.triggerData,e={clickAction:this.action,items:this.triggerContext.selectedEmbeddedItems??t.embeddedItems??t.items,collections:t.collections,triggerData:t};await new tc().process(e);let r={action:this.containsCTA()?q.CAMPAIGN_CLICKED_ACTIVITY:q.CAMPAIGN_CLOSED_ACTIVITY};document.dispatchEvent(new CustomEvent(q.POPUP_ACTIVITY_EVENT,{detail:r}))}},op=class{constructor(t){this.scalingFactor=t}getLayoutStyles(t){if(!t)return{display:"block"};let e={display:t.disp};return t.of&&(e.objectFit=t.of),t.pos==="absolute"&&(e.width="auto !important",e.position="absolute",e.right=t.right+"px",e.left=t.left+"px",e.top=t.top+"px",e.bottom=t.bottom+"px"),e}getSizeStyles(t){let e={};return t?.w&&(e.width=t.w),t?.h&&(e.height=t.h),t?.maxW&&(e.maxWidth=t.maxW),t?.maxH&&(e.maxHeight=t.maxH),t?.minW&&(e.minWidth=t.minW),t?.minH&&(e.minHeight=t.minH),e}getBorderStyles(t){if(!t)return{};let e={};return t.radius&&t.radius>0&&(e.borderRadius=this.getSizePx(t.radius)),t.width&&t.width>0&&(e.borderWidth=this.getSizePx(t.width),e.borderStyle=t.style?.toLowerCase(),t.color?this.getColourStyles(t.color,"border-color",e):e.borderColor="black"),e}getFlexStyles(t){return t?{gap:t.gap+"px",flexWrap:t.wrap,flexDirection:t.dir,justifyContent:t.jc,alignItems:t.ai,width:"100%"}:{}}getSpaceStyles(t){let e={};return t?(e.paddingTop=this.getSizePx(t.pt),e.paddingBottom=this.getSizePx(t.pb),e.paddingLeft=this.getSizePx(t.pl),e.paddingRight=this.getSizePx(t.pr),e.marginTop=this.getSizePx(t.mt),e.marginBottom=this.getSizePx(t.mb),e.marginLeft=t.cent?"auto":this.getSizePx(t.ml),e.marginRight=t.cent?"auto":this.getSizePx(t.mr),e):(e.margin="0 !important",e.padding="unset",e)}getBackgroundStyles(t){if(!t)return{};let e={};if(t.glossy){let r="backdrop-filter",n="-webkit-"+r,i=`blur(${t.glossy.radius}px)`;if(!CSS.supports(n,i)&&!CSS.supports(r,i))return{background:t.glossy.fallback.rgba};if(e[n]=i,e[r]=i,t.glossy.color)return this.getColourStyles(t.glossy.color,"background",e)}else if(t.solid){if(t.solid.grad)return this.getGradientStyles(t.solid.grad,"background",e);if(t.solid.hex)return{backgroundColor:t.solid.rgba}}else if(t.img){if(!t.img.src)return{};let r=(t.img.a??0)/100;e.background=`linear-gradient(rgba(0, 0, 0, ${r}), rgba(0, 0, 0, ${r})),url("${t.img.src}") no-repeat center`,e.backgroundSize="cover",t.img.a&&(e["-webkit-backdrop-filter"]=`opacity(${t.img.a})`,e.backdropFilter=`opacity(${t.img.a})`)}return e}getGradientStyles(t,e,r){if(r??={},t.type==="LINEAR"){let n=`linear-gradient(${t.ang}deg, ${t.c1}, ${t.c2}`;t.c3&&(n+=`, ${t.c3}`),n+=")",r[e]=n}return r}getColourStyles(t,e="color",r){return r??={},t?t.grad?this.getGradientStyles(t.grad,e,r):(t.hex&&(r[e]=t.rgba),r):r}getSizePx(t){return this.getScaledSize(t)+"px"}getScaledSize(t){return(t??0)*this.scalingFactor}},ai=class{renderer=Wn.get();parentHTMLEl;inappElement;inappHTMLEl;triggerContext;stylesConverter;scalingFactor;constructor(t,e,r){this.parentHTMLEl=t,this.inappElement=e,this.triggerContext=r,this.stylesConverter=new op(this.renderer.getScalingFactor())}getHTMLElement(){return this.inappHTMLEl}insertElement(){this.renderer.appendChild(this.parentHTMLEl,this.inappHTMLEl)}processCommonBlocks(){this.processWidthAndHeight(),this.processPositionBlock(),this.processTransformBlock(),this.processTransparency(),this.processShadow(),this.registerAction();let t=wt(D(D(D(D({},this.getDisplayStyles()),this.getSpaceStyles()),this.getBorderStyles()),this.getBackgroundStyles()),{boxSizing:"border-box",outline:"none"});this.renderer.setStyles(this.inappHTMLEl,t)}getDisplayStyles(){return{display:"block"}}processWidthAndHeight(){this.inappElement.w&&this.renderer.setStyle(this.inappHTMLEl,"width",this.stylesConverter.getSizePx(this.inappElement.w)),this.inappElement.h&&this.renderer.setStyle(this.inappHTMLEl,"height",this.stylesConverter.getSizePx(this.inappElement.h))}processPositionBlock(){let t={position:"absolute",left:this.stylesConverter.getSizePx(this.inappElement.x),top:this.stylesConverter.getSizePx(this.inappElement.y)};this.renderer.setStyles(this.inappHTMLEl,t)}getBorderStyles(){return this.stylesConverter.getBorderStyles(this.inappElement.br)}getSpaceStyles(){return this.stylesConverter.getSpaceStyles(this.inappElement.spc)}processTransparency(){let t=this.inappElement.alpha;if(!isNaN(t)){let e=(t/100).toFixed(2);this.renderer.setStyle(this.inappHTMLEl,"opacity",e)}}processShadow(){let t=this.inappElement.shd;t?this.renderer.setStyle(this.inappHTMLEl,"box-shadow",t.getStyle(this.scalingFactor)):this.renderer.setStyle(this.inappHTMLEl,"box-shadow","unset")}processTransformBlock(){let t=new mh(this.inappElement.trf);t&&t.rotate&&this.renderer.setStyle(this.inappHTMLEl,"transform",`rotate(${t.rotate}deg)`)}registerAction(){let t=this.inappElement.clc;!t||Object.keys(t).length===0||(this.inappHTMLEl.addEventListener("click",e=>{e.stopPropagation(),new C_(t,this.triggerContext).execute()}),this.renderer.setStyle(this.inappHTMLEl,"cursor","pointer"))}getBackgroundStyles(){return this.stylesConverter.getBackgroundStyles(this.inappElement.bg)}},bs=class extends ai{constructor(t,e,r){super(t,e,r)}processCommonBlocks(){super.processCommonBlocks(),this.processFontBlock(),this.processAlignment()}processFontBlock(){let t={},e=this.inappElement.typography;return e&&(t.fontSize=this.stylesConverter.getSizePx(e.fs),t.fontFamily=q.COOEE+e.fam?.name,t.lineHeight=`${e.lh}`,t.letterSpacing=e.letterSpacing),this.stylesConverter.getColourStyles(this.inappElement.color,"color",t),this.renderer.setStyles(this.inappHTMLEl,t),t}processPart(t,e){let r=[];e.u&&r.push("underline"),e.st&&r.push("line-through"),r.length||r.push("normal"),this.renderer.setStyle(t,"font-weight",e.b?"bold":"normal"),this.renderer.setStyle(t,"font-style",e.i?"italic":"normal"),this.renderer.setStyle(t,"text-decoration",r.join(" ")),this.renderer.setStyle(t,"color",e.c??"inherit"),this.renderer.setStyle(t,"font-family","inherit")}processAlignment(){let t=this.inappElement.typography.ta,e=t?Oa[t]?.toLowerCase():this.inappElement.typography.alignment;e||(e="start"),this.renderer.setStyle(this.inappHTMLEl,"text-align",e)}},T_=class extends bs{constructor(t,e,r){super(t,e,r),this.inappHTMLEl=this.renderer.createElement("div"),this.insertElement()}render(){this.inappElement.parts?.forEach(t=>{let e=this.renderer.createElement("span");e.innerHTML=t.txt?.toString()?.replace(/\n/g,"<br />"),this.processPart(e,t),this.renderer.appendChild(this.inappHTMLEl,e)}),this.processCommonBlocks()}},x_=class extends ai{constructor(t,e,r){super(t,e,r),this.inappHTMLEl=this.renderer.createElement("div"),this.insertElement()}render(){this.processCommonBlocks()}},ap=class extends ai{constructor(t,e,r){super(t,e,r),this.inappHTMLEl=this.renderer.createElement("img"),this.insertElement()}render(){this.renderer.setAttribute(this.inappHTMLEl,"src",this.inappElement.src),this.renderer.setStyle(this.inappHTMLEl,"max-width","none"),this.renderer.setStyle(this.inappHTMLEl,"max-height","none"),this.renderer.setStyle(this.inappHTMLEl,"margin","0 auto"),this.processCommonBlocks()}},D_=class cp extends ai{constructor(e,r,n){super(e,r,n),this.parent=e,this.inappHTMLEl=this.renderer.createElement("div")}static MAX_Z_INDEX="2147483647";render(){return this.parent||this.renderer.removeInApp(this.triggerContext),this.insertElement(),this.processCommonBlocks(),this.inappHTMLEl.classList.add(q.IN_APP_WRAPPER_NAME),this.inappHTMLEl.classList.add(this.triggerContext.rootClassName),this.renderer.setStyle(this.inappHTMLEl,"z-index",cp.MAX_Z_INDEX),this.inappHTMLEl}getBackgroundStyles(){return this.inappElement.cover?super.getBackgroundStyles():{}}processWidthAndHeight(){let e=this.inappElement.cont;if(this.inappElement.cover)this.renderer.isParentNotBody()?(this.renderer.setStyle(this.inappHTMLEl,"width","100%"),this.renderer.setStyle(this.inappHTMLEl,"height","100%")):(this.renderer.setStyle(this.inappHTMLEl,"width","100vw"),this.renderer.setStyle(this.inappHTMLEl,"height","100vh")),this.renderer.setStyle(this.inappHTMLEl,"top","0"),this.renderer.setStyle(this.inappHTMLEl,"left","0");else{let r=this.inappElement.spc,n=this.stylesConverter.getScaledSize(e.w)+r.getHorizontal(),i=this.stylesConverter.getScaledSize(e.h)+r.getVertical();this.renderer.setStyle(this.inappHTMLEl,"width",n+"px"),this.renderer.setStyle(this.inappHTMLEl,"height",i+"px")}}getSpaceStyles(){return{padding:this.inappElement.spc.getPaddingCSS()}}getDisplayStyles(){return D(D({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(){}},N_=class extends ai{constructor(t,e,r){super(t,e,r),this.inappHTMLEl=this.renderer.createElement("div"),this.insertElement()}render(){return this.processCommonBlocks(),this.renderer.setStyle(this.inappHTMLEl,"position","relative"),this.renderer.setStyle(this.inappHTMLEl,"overflow","hidden"),this.inappHTMLEl.classList.add(q.IN_APP_CONTAINER_NAME),this}},lp=class extends bs{borderColor="";constructor(t,e,r){super(t,e,r),this.inappHTMLEl=this.renderer.createElement("input"),this.insertElement()}render(){let t=this.setInputType();this.renderer.setAttribute(this.inappHTMLEl,"placeholder",this.inappElement.placeholderText),this.renderer.setStyle(this.inappHTMLEl,"background","#ffffff00"),this.renderer.setStyle(this.inappHTMLEl,"outline","none"),this.inappHTMLEl.addEventListener("click",e=>{e.stopPropagation()}),this.processCommonBlocks(),this.addListener(this.inappHTMLEl,t),this.triggerContext.addInputField(t,this.inappElement.t)}},A_=class up extends lp{static EMAIL_REGEX=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;constructor(e,r,n){super(e,r,n)}setInputType(){let e=`coo-${this.inappElement.t}`;return this.renderer.setAttribute(this.inappHTMLEl,"type","email"),this.renderer.setAttribute(this.inappHTMLEl,"id",e),e}addListener(e,r){e.addEventListener("keydown",n=>{this.borderColor||(this.borderColor=this.inappHTMLEl.style.borderColor),e.value.match(up.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()})}},O_=class hp extends lp{static MOBILE_REGEX=/^\d+$/;constructor(e,r,n){super(e,r,n)}setInputType(){let e=`coo-${this.inappElement.t}`;return this.renderer.setAttribute(this.inappHTMLEl,"type","tel"),this.renderer.setAttribute(this.inappHTMLEl,"id",e),e}addListener(e,r){e.addEventListener("keydown",n=>{this.borderColor||(this.borderColor=this.inappHTMLEl.style.borderColor),e.value.match(hp.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()})}},k_=class Re extends bs{static DAYS="Days";static HOURS="Hours";static MINUTES="Minutes";static SECONDS="Seconds";elements;spans=[];constructor(e,r,n){super(e,r,n),this.inappHTMLEl=this.renderer.createElement("div"),this.insertElement()}render(){this.addTimerChildren(),this.processAndStartTimer(),this.processCommonBlocks();let e=wt(D(D(D({flex:"1 1 0"},this.stylesConverter.getBackgroundStyles(this.inappElement.bg)),this.stylesConverter.getBorderStyles(this.inappElement.br)),this.stylesConverter.getSpaceStyles(this.inappElement.spc)),{marginLeft:this.stylesConverter.getSizePx(this.inappElement.gap),marginRight:this.stylesConverter.getSizePx(this.inappElement.gap)});this.addStylesToTimer(e)}getBackgroundStyles(){return{}}processFontBlock(){let e=super.processFontBlock();return this.stylesConverter.getColourStyles(this.inappElement.color,"color",e),this.addStylesToTimer(e),e}getSpaceStyles(){return{}}getBorderStyles(){return{}}getDisplayStyles(){return{display:"flex",flexWrap:"nowrap",justifyContent:"center"}}addStylesToTimer(e){this.elements.forEach(r=>this.renderer.setStyles(r,e))}addTimerChildren(){let e=this.inappElement.show;this.elements=[],e.day&&this.elements.push(this.getChild(Re.DAYS)),e.hour&&this.elements.push(this.getChild(Re.HOURS)),e.minute&&this.elements.push(this.getChild(Re.MINUTES)),e.second&&this.elements.push(this.getChild(Re.SECONDS)),this.elements.forEach(r=>this.inappHTMLEl.appendChild(r))}getChild(e){let r=this.renderer.createElement("div"),n=this.renderer.createElement("span"),i=this.renderer.createElement("span");return i.innerText=e,n.innerText="00",n.id=`lc-${e}`,this.renderer.setStyle(i,"font-size","0.5em"),this.renderer.setStyle(i,"text-align","center"),this.renderer.setStyle(i,"font-family","inherit"),this.renderer.setStyle(n,"text-align","center"),this.renderer.setStyle(n,"font-family","inherit"),this.inappElement.lblPos==="start"?(r.appendChild(i),r.appendChild(n)):(r.appendChild(n),r.appendChild(i)),this.renderer.setStyle(r,"display","flex"),this.renderer.setStyle(r,"flex-direction",this.inappElement.horizontal?"":"column"),this.renderer.setStyle(r,"justify-content","center"),this.renderer.setStyle(r,"align-items","center"),this.renderer.setStyle(r,"gap","5px"),this.spans.push(n),r}processAndStartTimer(){let e=this.inappElement.timer.start(this.inappElement.timerType,r=>{this.spans.forEach(n=>{n.id===`lc-${Re.DAYS}`?n.innerText=String(r.days).padStart(2,"0"):n.id===`lc-${Re.HOURS}`?n.innerText=String(r.hours).padStart(2,"0"):n.id===`lc-${Re.MINUTES}`?n.innerText=String(r.minutes).padStart(2,"0"):n.id===`lc-${Re.SECONDS}`&&(n.innerText=String(r.seconds).padStart(2,"0"))})});this.triggerContext.intervals.push(e)}},P_=class extends bs{constructor(t,e,r){super(t,e,r),this.inappHTMLEl=this.renderer.createElement("select"),this.insertElement()}render(){this.renderer.setStyle(this.inappHTMLEl,"background","#ffffff00"),this.renderer.setStyle(this.inappHTMLEl,"outline","none"),this.processCommonBlocks(),this.addListener(this.inappHTMLEl),this.addOptions()}addListener(t){this.triggerContext.selectedEmbeddedItems?.length||this.updateItems(this.triggerContext.triggerData.items[0].vars[0]),t.addEventListener("click",e=>{e.stopPropagation()}),t.addEventListener("change",()=>{let e=new cs(JSON.parse(t.value));this.updateItems(e)})}updateItems(t){let e=this.triggerContext.triggerData.items[0];this.triggerContext.selectedEmbeddedItems=[e.toEmbed(t)];let r=this.parentHTMLEl.querySelector("#coo-13");if(!r)return;let n=t.imgs[0]??e.imgs?.at(0);n?.url&&r.setAttribute("src",n.url)}addOptions(){let t=this.triggerContext.triggerData.items,e=this.inappHTMLEl;if(!t?.length){e.add(this.createOption(this.inappElement.placeholderText));return}let r=this.triggerContext.selectedEmbeddedItems?.at(0);t[0].vars.forEach(n=>{e.add(this.createOption(n.name??"Default",n,n.mID===r?.vID))})}createOption(t,e,r){let n=this.renderer.createElement("option");return n.text=t,n.value=JSON.stringify(e),r&&(n.selected=!0),e||(n.disabled=!0),n}},R_=class extends ap{constructor(t,e,r){super(t,e,r)}render(){super.render(),this.inappHTMLEl.setAttribute("id",`coo-${this.inappElement.type}`)}},pp=class Un{static ACTIVE_TRIGGER_DATA;renderer=Wn.get();safeHTTP;parent;rootContainer;containerHTMLElement;ian;triggerContext;resizeListener;cartDrawerToggleSubscription;constructor(e){this.safeHTTP=$t.getInstance(),this.resizeListener=()=>this.screenResized(),this.setParentContainer(e)}setParentContainer(e){this.parent=e??document.body,this.renderer.setParentContainer(this.parent)}render(e){this.renderEngagement(new Ar(e))}async renderEngagement(e){if(this.triggerContext=new np(new Date,e),this.triggerContext.onClose(r=>{this.closeInApp(r)}),this.ian=e.ian,(this.renderer.isMobile()||e.previewType==="mobile")&&this.ian.overrideForMobileView(),this.ian.isEmbedded()){let r=document.querySelector(this.ian.getEmbeddedSelector());this.setParentContainer(r)}await this.preloadImages(e),e.shouldDelay()?window.setTimeout(()=>{this.withCartDrawerClosed()},e.getDelaySeconds()):this.withCartDrawerClosed()}withCartDrawerClosed(){if(!Ee.get().isOpen()||!this.renderer.isMobile()){this.startRenderingOnce();return}this.cartDrawerToggleSubscription=Ee.get().onToggle().subscribe(({open:e})=>{!e&&this.startRenderingOnce()})}startRenderingOnce(){if(!this.shouldSkipCampaign()){Un.ACTIVE_TRIGGER_DATA=this.triggerContext.triggerData;try{this.startRendering()}catch(e){Kt.getInstance().captureException(e,{triggerData:JSON.stringify(this.triggerContext.triggerData)});return}this.sendTriggerDisplayed(),this.renderer.isMobile()||window.addEventListener("resize",this.resizeListener),this.cartDrawerToggleSubscription?.unsubscribe()}}shouldSkipCampaign(){let e=this.triggerContext.triggerData;if(!e.previewType&&Un.ACTIVE_TRIGGER_DATA){let n={triggerShown:new $a(Un.ACTIVE_TRIGGER_DATA??{})};return this.skipTrigger(e,n),!0}if(Pt.get().isGoKwikPopupOpen)return this.skipTrigger(e,{reason:"GoKwik popup is open"}),!0;let r=q.PAYMENT_MODAL_DETAILS.find(n=>!!document.querySelector(n.identifier));return r?(this.skipTrigger(e,{reason:`${r.gateway} modal is open`}),!0):!1}startRendering(){this.renderer.calculateScalingFactor(this.ian),this.rootContainer=new D_(this.parent,this.ian,this.triggerContext).render();try{this.renderContainer(this.triggerContext)}catch(e){throw x.error(e),e}}sendTriggerDisplayed(){let e={};this.triggerContext.triggerData.items?.length&&(e.promotedMIDs=this.triggerContext.triggerData.items?.map(i=>i.mID));let r=new jt(q.EVENT_TRIGGER_DISPLAYED,e,this.triggerContext.triggerData);this.safeHTTP.sendEvent(r);let n={action:q.CAMPAIGN_DISPLAYED_ACTIVITY};document.dispatchEvent(new CustomEvent(q.POPUP_ACTIVITY_EVENT,{detail:n}))}sendTriggerClosed(e){let r=e.eventName;delete e.eventName;let n=new jt(r,e,this.triggerContext.triggerData);n.name===q.EVENT_TRIGGER_CLICKED&&(n.items=this.triggerContext.selectedEmbeddedItems??this.triggerContext.triggerData.items?.map(i=>i.toEmbed())),this.safeHTTP.sendEvent(n)}addEnterAnimation(e){this.containerHTMLElement.animate(e.getEnterAnimation(),{duration:500})}renderElement(e,r,n){r instanceof _h?new A_(e,r,n).render():r instanceof Eh?new O_(e,r,n).render():r instanceof Ro?new T_(e,r,n).render():r instanceof Sh?new R_(e,r,n).render():r instanceof Aa?new ap(e,r,n).render():r instanceof yh?new x_(e,r,n).render():r instanceof wh?new k_(e,r,n).render():r instanceof bh?new P_(e,r,n).render():x.error("Unsupported element type- "+r.type)}renderContainer(e){let r=this.ian?.cont;r&&(this.containerHTMLElement=new N_(this.rootContainer,r,e).render().getHTMLElement(),new y_().loadAllFonts(this.ian),this.ian.elems?.forEach(async n=>{await this.renderElement(this.containerHTMLElement,n,e)}),this.addEnterAnimation(this.ian.anim))}closeInApp(e){let r=this.ian.anim.getExitAnimation();this.sendTriggerClosed(e),Un.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(){Wn.get().removeInApp(this.triggerContext)}skipTrigger(e,r){let n=new jt(q.EVENT_CAMPAIGN_REJECTED,r,e);this.safeHTTP.sendEvent(n)}async preloadImages(e){let r=e.ian;if(!r)return;let n=[];r.elems.forEach(i=>{let s=i.bg?.img?.src;if(s&&n.push(this.getPromise(s)),i.t===1){let o=i.src;if(!o)return;n.push(this.getPromise(o))}}),r.bg?.img?.src&&n.push(this.getPromise(r.bg.img.src)),r.cont.bg?.img?.src&&n.push(this.getPromise(r.cont.bg.img.src)),await Promise.all(n)}getPromise(e){return new Promise(r=>{let n=new Image;n.onload=r,n.src=e,n.style.display="none"})}},L_=dt(lr()),U_=dt(Qn()),M_=class{triggerData;safeHttpService=$t.getInstance();render(t){t.contentSource===L_.EngagementContentSource.KLAVIYO&&(this.triggerData=t,window.addEventListener("klaviyoForms",this.handleKlaviyoEvents.bind(this)),window._klOnsite=window._klOnsite||[],window._klOnsite.push(["openForm",t.klaviyoFormID]))}handleKlaviyoEvents(t){if(t.type!=="klaviyoForms")return;let e=t.detail;if(e.formId!==this.triggerData.klaviyoFormID){x.warn("Received invalid trigger callback");return}switch(e.type){case"open":this.safeHttpService.sendEvent(new jt(q.EVENT_TRIGGER_DISPLAYED,{form:{id:e.formId}},this.triggerData));break;case"stepSubmit":{let r=this.getFormDetails(e);this.safeHttpService.sendEvent(new jt(q.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 jt(q.EVENT_TRIGGER_CLOSED,{form:{id:e.formId}},this.triggerData));break}}getFormDetails(t){let e={id:t.formId},r=t.metaData;if(U_.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)||(e[o]=r[o])}),e.email=r.$email??r.email,e.mobile=r.$phone_number??r.phone_number;let i=r.$first_name??r.first_name,s=r.$last_name??r.last_name;(i?.length||s?.length)&&(e.name=i+" "+s)}return e}},B_=class{static trackIntent(t){if(!this.isInstalled()){x.log("Facebook pixel not installed");return}if(!se.get().pixelPush){x.log("Facebook pixel push not enabled");return}let e=us[t.intent]?.toLowerCase(),r=t.segmentName;!e&&!r||(x.debug(`Sending ${e} intent and ${r} segment to Facebook Pixel`),window.fbq("trackCustom","CooeeIntent",{intent_value:e,segment_value:t.segmentName}))}static isInstalled(){return window.fbq&&typeof window.fbq=="function"}},dp=class{static itemMap=new Map;static async refreshItems(t){if(t.isCartEmbed()&&!t.isSubscriptionUpsell()){let i=(await Ot.getCurrent().getNormalisedCart()).items.map(s=>s.mID);t.items=t.items.filter(s=>!i.includes(s.mID))}if(se.get().currencyCount<=1)return t.items;if(t.isShoppableVideo())return await this.refreshVideoItems(t.content.videoConfig,t.engagementID),t.items;let e=t.items.length,r=t.items.map(i=>this.updatedItem(i,t.engagementID)),n=(await Promise.all(r)).filter(i=>i!=null);if(e&&!n.length){let i="Failed to fetch any product from Ajax API",s=new jt(q.EVENT_CAMPAIGN_FAILED,{reason:i,currency:t.currency},t);throw $t.getInstance().sendEvent(s),new Error(i)}if(t.isCartRecovery()){let i=Ot.getCurrent().items,s=[];for(let o of n)for(let a of o.vars){if(!a.isAvailable)continue;let l=i.find(p=>p.variant_id.toString()===a.mID);if(!l)continue;let h=new Fe(o);h.name=l.title;let g=new cs(a);g.name=l.variant_title,g.price.d=l.discounted_price/100,h.variants=[g],s.push(h)}return s}return n}static async refreshVideoItems(t,e){await Promise.all(t.videos.map(async r=>{r.items=await Promise.all(r.items.map(async n=>await this.updatedItem(n,e)||n))}))}static async updatedItem(t,e){if(this.itemMap.has(t.mID))return this.itemMap.get(t.mID);let r=t,n=Kt.getInstance(),i=lt.get(Lr),s,o=`/products/${r.slug}.js`;try{s=await i.request(o)}catch(l){return x.error(`Failed to fetch ${o}`,l),l instanceof Response?n.captureMessage(`Shopify product fetch failed ${l.status}`,"error",{item:r,path:o},{"engagement.id":e}):n.captureException(l,{item:r,path:o},{"engagement.id":e}),null}if(!s)return x.error("Item not found after AJAX call for:",r),null;r.name=s.title,r.tags=s.tags;let a=r.selectedOrFirstVariant.value;return r.vars.map(l=>{let h=s.variants.find(g=>g.id===+l.mID);l.name=h.title,l.isAvailable=h.available,l.price.d=h.price?h.price/100:h.price,l.price.effective=l.price.d,l.price.cmp=h.compare_at_price?h.compare_at_price/100:h.compare_at_price,+a.mID===h.id&&(a.effectivePrice.value=l.price.d)}),this.itemMap.set(r.mID,r),r}},ec=class fp{static INSTANCE;httpService=lt.get(Lr);sentryService=lt.get(Kt);sessionManager=lt.get(ge);runtime=Pt.get();constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new fp),this.INSTANCE}sendSilently(e){this.send(e).catch(r=>x.error(`Failed to send ${e.name}`,r))}async send(e){if(x.debug(`Sending event ${e.name}`),Jr.prepend(`Sending event <strong>${e.name}</strong> with id ${e.id}`),this.shouldReject(e)){x.warn(`Rejecting event ${e.name}`);return}await Promise.all([this.addSessionContext(e),this.addShopifyContext(e)]),this.addShopifyAttributes(),e.name!==q.EVENT_APP_BACKGROUND&&this.runtime.setActive(),e.currentItem=this.runtime.getCurrentItem(),e.locale=this.runtime.locale,this.httpService.post("/v1/event/track",e).then(async r=>{x.log("\u2705 Event tracked:",e.name),Jr.prepend(`\u2705 Event <strong>${r.eventName}</strong> tracked`),this.processEventResponse(e,r)}).catch(r=>{x.error(`Error sending event ${e.name} to server`,r)})}shouldReject(e){return e.trigger?.triggerID==="test"||e.trigger?.triggerID==="preview"?(x.warn("Not sending event as this is a test trigger"),!0):!1}async addSessionContext(e){let r=await this.sessionManager.checkSessionAndGetContext();e.sessionID=r[0],e.sessionNumber=r[1],e.landingPage=r[2],e.page=ws.parseFromCurrent()}async addShopifyContext(e){try{e.cart=await Ot.getCurrent().getNormalisedCart()}catch(r){x.error("Error fetching Shopify cart before sending the event",r)}}processEventResponse(e,r){this.renderWidgetIfAny(e,r).catch(n=>{x.error("Failed to display a campaign",n,e,r),this.sentryService.captureException(n,{event:e,response:r})}),this.utiliseIntentIfCalculated(r)}async renderWidgetIfAny(e,r){if(!r.triggerData){x.log(`Nothing to engage after ${e.name}`);return}x.log(`\u{1F4E3} Engagement(id=${r.triggerData.shortID}) will be shown`,r.triggerData);let n=new Ar(r.triggerData);n.occurred=e.occurred;let i;try{i=await dp.refreshItems(n)}catch(s){x.error("Failed to refresh the products",s);return}if(n.items=i,n.contentSource===m_.EngagementContentSource.KLAVIYO){new M_().render(n);return}new pp().renderEngagement(n).catch(s=>{x.error("Failed to render popup",s),this.sentryService.captureException(s,{event:e,triggerData:n})})}utiliseIntentIfCalculated(e){e.intent&&(rp.trackIntent(e.intent),B_.trackIntent(e),Jr.prepend(`Intent is <strong>${us[e.intent]}</strong>`))}addShopifyAttributes(){Ot.getCurrent().addCooeeAttributes().catch(e=>{x.error("Fail to add attributes in cart",e)})}},$t=class gp{static INSTANCE;httpApiService=Lr.getInstance();eventAPIService=ec.getInstance();constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new gp),this.INSTANCE}sendEvent(e){x.debug(`Waiting for auth to send event ${e.name}`),ge.replaySubject.subscribe(async()=>{this.eventAPIService.sendSilently(e)})}updateProfile(e){ge.replaySubject.subscribe(()=>{this.httpApiService.updateUserData(e??{})})}trackOrder(e){ge.replaySubject.subscribe(()=>{this.httpApiService.trackOrder(e)})}updateDeviceProps(e){ge.replaySubject.subscribe(()=>{this.httpApiService.updateDeviceProps({props:e})})}generateDiscount(e){return this.httpApiService.generateDiscount(e)}},Jr=class{static isOn=!1;static element;static watch(){let t=yu();(t==="1"||t==="on")&&$t.getInstance().updateDeviceProps({debugTill:this.getDebugMillis()}),t==="on"?sessionStorage.cooeeDebug="1":t==="off"&&sessionStorage.removeItem("cooeeDebug"),sessionStorage.cooeeDebug&&(this.isOn=!0,this.renderDebugBar())}static prepend(t){if(!this.isOn)return;let e=document.createElement("div");e.innerHTML="• "+new Date().toLocaleString()+" - "+t,this.element.prepend(e)}static renderDebugBar(){this.element=document.createElement("div"),this.element.id="cooee-debugger",this.element.setAttribute("draggable","true"),Ca(()=>{document.body.appendChild(this.element)})}static dragElement(){let t=0,e=0,r=0,n=0,i=a=>{a=a||window.event,a.preventDefault(),r=a.clientX,n=a.clientY,document.onmouseup=o,document.onmousemove=s},s=a=>{a=a||window.event,a.preventDefault(),t=r-a.clientX,e=n-a.clientY,r=a.clientX,n=a.clientY,this.element.style.top=this.element.offsetTop-e+"px",this.element.style.left=this.element.offsetLeft-t+"px"},o=()=>{document.onmouseup=null,document.onmousemove=null};this.element.onmousedown=i}static getDebugMillis(){return new Date().getTime()+6*60*60*1e3}},lu=class extends ua{static storeName="app";static{this.storage=la(this.storeName)}},j_=class{static processConfiguration(){let t=se.get();!t.gaMeasurementID||!t.gaEnabled||this.sendClientID()}static async sendClientID(){let t=await this.getClientID();t&&$t.getInstance().updateDeviceProps({gaClientID:t})}static async getClientID(){let t=await Ut.get(at.GA_CLIENT_ID),e=await this.getClientIDViaGTag();if(t!==e)return await Ut.set(at.GA_CLIENT_ID,e),e}static async getClientIDViaGTag(){let t=se.get().gaMeasurementID;if(!(!t||!window.gtag))return new Promise(e=>{window.gtag("get",t,"client_id",r=>{e(r)})})}},$_=class mp{static INSTANCE;constructor(){this.init()}static getInstance(){return this.INSTANCE||(this.INSTANCE=new mp),this.INSTANCE}init(){lu.get(at.APP_CONFIG,{}).then(e=>this.updateGlobalConfig(e))}async processAppConfigurations(e){x.log("Received app configuration",e),e.currencyCount=e.currencies?.length;let r=this.updateGlobalConfig(e);lu.set(at.APP_CONFIG,r).catch(n=>x.error(n)),j_.processConfiguration(),r.website&&(ve.injectRawScript(r.website.commonJS),ve.injectRawCSS(r.website.commonCSS)),Ee.get().onToggle().subscribe(async({open:n})=>{x.info("Cart drawer is now",n?"open":"closed"),n&&(lt.get(Jn).loadOrRenderWidgetsAfterCartChange(),await this.trackViewCartEvent())})}updateGlobalConfig(e){let r=St.globalRef.config.update(e);return Ee.forceUpdate(),x.debug("App configurations",r),r}async trackViewCartEvent(){let e=await Ot.getCurrent().getNormalisedCart(),r={value:e.amount,currency:e.currency},n={items:e.items,amount:r,drawer:!0};$t.getInstance().sendEvent(new jt(q.EVENT_VIEW_CART,n))}},F_=dt(mu()),H_=class Yo{static META_REQUIRED_FIELDS=["ad_id"];static GOOGLE_REQUIRED_FIELDS=["gad_source","gclid"];source;adID;campaignID;adName;campaignName;constructor(e){this.adID=e.adID,this.campaignID=e.campaignID,this.source=e.source}static getAdParams(){let e;try{e=new F_.URLBuilder(location.href)}catch{return{}}let r={};if(this.META_REQUIRED_FIELDS.every(n=>Array.from(e.getParams().keys()).includes(n)))return r={source:"META",adID:e.getQueryParam("ad_id")?.trim(),campaignID:e.getQueryParam("campaign_id")?.trim()},new Yo(r);if(this.GOOGLE_REQUIRED_FIELDS.every(n=>Array.from(e.getParams().keys()).includes(n)))return r={source:"GOOGLE"},new Yo(r)}},Ko=class yp{static INSTANCE;httpAPIService=Lr.getInstance();coreService=$_.getInstance();sentryService=Kt.getInstance();sdkToken="";userID="";deviceID="";appID="";shopifyShop="";constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new yp),this.INSTANCE}init(e){this.appID=e.appID,this.shopifyShop=e.shopifyShop}async storeAndPopulateAuthData(e){e&&(e.userID&&(this.userID=e.userID,await Ut.set(at.ID,e.userID)),e.deviceID&&(this.deviceID=e.deviceID,await Ut.set(at.DEVICE_ID,e.deviceID)),e.sdkToken&&(this.sdkToken=e.sdkToken,await Ut.set(at.SDK_TOKEN,e.sdkToken)),this.updateAPIClient())}async validateSession(e){await this.populateFirstSeen(),await this.populateUserDataFromStorage(),x.log("Validating session with server");let r=await this.getSessionValidateData(e);try{let n=await this.httpAPIService.validateSession(r);x.log("Validating session Response",n),await this.coreService.processAppConfigurations(n.appSettings),await this.storeAndPopulateAuthData(n)}catch(n){throw x.error(n),n}}async populateUserDataFromStorage(){if(this.sdkToken=await Ut.get(at.SDK_TOKEN),!this.sdkToken){x.warn("No SDK token found in local storage");return}this.userID=await Ut.get(at.ID),this.deviceID=await Ut.get(at.DEVICE_ID),this.updateAPIClient()}updateAPIClient(){x.debug("SDK Token:",this.sdkToken),x.log("Device ID:",this.deviceID),x.log("User ID:",this.userID),rp.trackDeviceID(this.deviceID),Jr.prepend(`Device ID: <strong>${this.deviceID}</strong>`),this.httpAPIService.setAPIToken(this.sdkToken),this.sentryService.setGlobalContext("Visitor Info",{device_id:this.deviceID,user_id:this.userID}),this.sentryService.setUser({id:this.deviceID})}async getSessionValidateData(e){let r=await new g_().safeGet(),n=await Ut.get(at.DEVICE_ID);return n||(n=new Jt().toHexString(),await Ut.set(at.DEVICE_ID,n)),wt(D({deviceID:n,deviceProps:r,appID:this.appID,shopifyShop:this.shopifyShop},e),{sdk:q.SDK,page:ws.parseFromCurrent(),ad:H_.getAdParams(),occurred:this.getSessionStartTime(Pt.get().jsLoadTime),currentItem:Pt.get().getCurrentItem(),cart:await Ot.getCurrent().getNormalisedCart(),properties:{}})}async populateFirstSeen(){let e=await Ut.get(at.FIRST_SEEN),r=e?new Date(e):new Date;e||await Ut.set(at.FIRST_SEEN,r.toISOString()),this.httpAPIService.setFirstSeen(r),this.sentryService.setGlobalContext("Visitor Info",{first_seen:r.toISOString()})}getSessionStartTime(e){return(new Date().getTime()-e.getTime())/1e3>q.IDLE_TIME_IN_SECONDS?new Date:e}},ge=class Mn{static replaySubject=new xb(1);static INSTANCE;sentryService=lt.get(Kt);lock=new Mu;constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Mn),this.INSTANCE}init(e){if(x.debug("Initialising SDK",e),h_(navigator.userAgent)){x.info("This seems to be a bot. Disabling SDK");return}Ko.getInstance().init(e),Mn.INSTANCE.checkForNewSession(!0).then(async()=>{Mn.replaySubject.next(!0),Mn.replaySubject.complete()}).catch(r=>{x.error("Unable to initiate session",r)})}getCurrentSessionID(){return re.set(at.SESSION_LAST_USED_TIME,new Date().getTime()),re.get(at.ID,"")}async checkSessionAndGetContext(){return await this.checkForNewSession(),this.getContext()}async getContext(){let e=await Promise.all([this.getCurrentSessionID(),this.getCurrentSessionNumber(),this.getLandingPage()]);return this.sentryService.setGlobalContext("Visitor Session",{id:e[0],number:e[1],landing_page:e[2]}),e}async checkForNewSession(e){await this.lock.acquire();let r=!1;if(await this.isNewSessionRequired()?(await this.startNewSession(),e=!0,r=!0):await this.notSynced()&&(r=!0),e){let n=await this.getContext();await Ko.getInstance().validateSession({sessionID:n[0],sessionNumber:n[1],landingPage:n[2],newSession:r}),await re.set(at.SESSION_SYNCED,!0)}this.lock.release()}async startNewSession(){x.debug("Starting new session"),await re.clear(),x.debug("Cleared SessionStorage before starting new session");let e=new Date,r=new Jt().toHexString();x.debug("New session ID to be used",r);let n=await Ut.get(at.SESSION_NUMBER,0)+1;Jr.prepend(`New Session ID: <strong>${r}</strong> & number: ${n}`),await Promise.all([Ut.set(at.SESSION_NUMBER,n),re.set(at.ID,r),re.set(at.SESSION_LAST_USED_TIME,e.getTime()),re.set(at.SESSION_LANDING_PAGE,ws.parseFromCurrent())])}getLandingPage(){return re.get(at.SESSION_LANDING_PAGE,{})}getCurrentSessionNumber(){return Ut.get(at.SESSION_NUMBER,1)}async isNewSessionRequired(){if(!await re.get(at.ID))return!0;let e=await re.get(at.SESSION_LAST_USED_TIME,0);return e?(new Date().getTime()-e)/1e3>q.IDLE_TIME_IN_SECONDS:!0}async notSynced(){return!await re.get(at.SESSION_SYNCED,!1)}},Ai=dt(lr()),V_=dt(fu()),W_=dt(Qn()),G_=dt(an()),q_=dt(Xo()),z_=dt(an()),rc=class{constructor(t){this.triggerContext=t}safeHTTP=$t.getInstance();eventAPIService=ec.getInstance();async execute(t){let e=Pt.get().getCurrentItem(),r=t.clickAction;if(!r)return;let n=t.item,i=this.triggerContext,s=new tc,o=i.triggerData.redirectBehaviour,a=!!i.triggerData.discount.type&&!!r?.applyDiscount,l={selectedVariants:i.triggerData.nonMutableItems.map(E=>({itemMID:E.mID,mID:E.selectedOrFirstVariant.value.mID})),eID:i.triggerData.engagementID,cID:i.triggerData.contentID},h="",g=[],p=[];if(n?p=[n.toEmbed()]:t.embeddedItem&&(p=[t.embeddedItem]),r.at===108){let E=i.selectedItems;if(p=t.embeddedItems??E.map(P=>P.toEmbed()),i.shouldGiveFBTDiscount||t.embeddedItems?.length){let P;t.embeddedItems?P=t.embeddedItems.map(M=>({itemMID:M.mID,mID:M.vID,quantity:M.quantity})):P=E.map(M=>({itemMID:M.mID,mID:M.selectedOrFirstVariant.value.mID}));let A=i.triggerData.bundleFrom;i.triggerData.isBundleOnCartDrawer()&&A&&(P.push({itemMID:A.mID,mID:A.selectedOrFirstVariant.value.mID,isPrimary:!0}),p.unshift(A.toEmbed())),l.selectedVariants=P,i.triggerData.isBundleOnPDP()&&l.selectedVariants.forEach(M=>{M.mID===e.vID&&(M.isPrimary=!0)})}else l=void 0;g=t.embeddedItems??E}else if(r.at===107){let E=await Ot.getCurrent().getNormalisedCart();p=E.items,l.selectedVariants=E.items.map(P=>({itemMID:P.mID,mID:P.vID}))}else if(r.at===102)g=n?[n]:[t.embeddedItem];else if(r.at===101)h=n?Fi()+"products/"+n.slug:t.embeddedItem?.link;else if(r.at===4){let E=uh(r.gu?.u);E&&(h=E.href)}else if(r.at===109){let E=await s.upgradeToSubscription(n,i.triggerData);this.triggerContext.triggerData.skipSubscribedItems&&this.triggerContext.renderer.destroy(),Ee.get().refreshUI(E)}else if(r.at===104){let E=this.triggerContext.triggerData.collections?.[0];E&&(h="collections/"+E.handle)}if(this.sendTriggerClicked(p,{from:"button"},t.video),x.debug({redirectPath:h,redirectBehaviour:o,hasDiscount:a}),!a&&h){location.href=h;return}let _,w=!1;try{_=await this.getOrGenerateDiscountCode(l),x.debug("Discount code (if any) to apply",_)}catch(E){if(!this.triggerContext.triggerData.isBYOB()){z_.default.error("Unable to get a discount code",E);return}}if(_&&r.at===103)await s.copyDiscountCode(_);else if(r.at===110){let E=await s.createNewCart(e,_,i.triggerData);E&&(location.href=E);return}try{_&&await $n.applyWithStorefront([_])}catch(E){x.error(E),w=!0}let b;if(g?.length&&(b=await s.addToCart(g,i.triggerData)),w&&_){$n.navigate(_,o,h);return}if(h){location.href=h;return}$n.navigateWithoutDiscount(o,b)}sendTriggerClicked(t,e,r){let n=new jt(q.EVENT_TRIGGER_CLICKED,e,this.triggerContext.triggerData);n.items=t,r?.id&&(n.videos=[r.id]),this.eventAPIService.sendSilently(n)}async getOrGenerateDiscountCode(t){let e=this.triggerContext.triggerData.discount;if(!e?.type)return;let r="";if(e.type===q_.DiscountType.STATIC){if(!e.code)throw Kt.getInstance().captureMessage("No discount code found","warning",{triggerContext:this.triggerContext}),new Error("No discount code found");return e.code}if(t){if(r=await this.generateDiscount(t),!r)throw x.error("No discount code found",t),new Error("Discount code not found or generated");return r}}async generateDiscount(t){try{return(await this.safeHTTP.generateDiscount(t))?.code}catch(e){throw tr("Failed to generate a discount code"),x.error("Error generating discount code",e,t),Kt.getInstance().captureMessage("Failed to generate discount code","error",{discountData:JSON.stringify(t),triggerContext:this.triggerContext,error:e}),e}}},ae=class extends br{stylesConverter=new op(1);renderer=Wn.get();mediaStyle={};deviceTypeKey;clickExecutor;componentWillMount(){this.deviceTypeKey=this.renderer.isMobile()?"sm":"lg",this.clickExecutor=new rc(this.props.triggerContext)}getCompiledStyles(){return this.putStyleAccordingToDevice(),D(D(wt(D(D(D(D(D(D({},this.stylesConverter.getFlexStyles(this.mediaStyle.flex)),this.stylesConverter.getBackgroundStyles(this.mediaStyle.bg)),this.stylesConverter.getBorderStyles(this.mediaStyle.br)),this.stylesConverter.getSizeStyles(this.mediaStyle.size)),this.stylesConverter.getSpaceStyles(this.mediaStyle.spc)),this.stylesConverter.getLayoutStyles(this.mediaStyle.lout)),{boxSizing:"border-box",outline:"none"}),this.getComponentStyles()),this.props.style)}matchWhenCondition(t){if(!t?.op)return!0;let{lhs:e,rhs:r}=t;switch(t.op){case"eq":return e===r;case"gt":return+e>+r;case"gte":return+e>=+r;case"lt":return+e<+r;case"lte":return+e<=+r;case"ne":return e!==r;case"null":return e==null;case"empty":return e.trim()==="";case"in":return new RegExp(`\\b${r}\\b`).test(e);case"nin":return!new RegExp(`\\b${r}\\b`).test(e);default:return x.error(`Invalid operator found for when condition - ${t.op}`),!1}}putStyleAccordingToDevice(){let t=this.props.element;this.mediaStyle=t.style.lg,this.renderer.isMobile()&&t.style.sm&&Object.keys(t.style.sm).length&&(this.mediaStyle=D(D({},this.mediaStyle),t.style.sm))}sendTriggerClicked(t,e){this.clickExecutor.sendTriggerClicked(t,e)}async onClick(t,e){t.stopPropagation(),!e.clickAction&&(e.clickAction=this.props.element.clc),await this.clickExecutor.execute(e)}},Y_=0,RE=Array.isArray;function Y(t,e,r,n,i,s){e||(e={});var o,a,l=e;if("ref"in l)for(a in l={},e)a=="ref"?o=e[a]:l[a]=e[a];var h={type:t,props:l,key:r,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Y_,__i:-1,__u:0,__source:i,__self:s};if(typeof t=="function"&&(o=t.defaultProps))for(a in o)l[a]===void 0&&(l[a]=o[a]);return gt.vnode&>.vnode(h),h}var ci=class extends ae{componentDidMount(){this.setState(()=>({text:this.props.element.text})),ze(this.onChange.bind(this))}componentWillReceiveProps(t){this.props.element=t.element,this.onChange()}render(){let t=this.getCompiledStyles(),e=this.state.text;return e||(t.display="none",e=""),Y("div",{style:t,onClick:this.customOnClick.bind(this),className:"lc-text",children:Y("span",{style:this.getSpanStyle(),dangerouslySetInnerHTML:{__html:e}})})}customOnClick(){this.props.onClick&&this.props.onClick("title")}onChange(){if(this.props.element.text==null)return;let t=this.props.triggerContext.triggerData,e={bundle:t.discountData.value,customer:t.customerData,cart:t.getCartMagicVariables()},r=je.render(JSON.stringify(this.props.element),e),n=new Oe(JSON.parse(r));if(!this.matchWhenCondition(n.when)){this.setState(()=>({text:""}));return}this.setState(()=>({text:n.text}))}getTypoStyles(){let t={},e=this.mediaStyle.typo??new Ve;return t.letterSpacing=e.letterSpacing,t.fontSize=e.fs+"px",t.lineHeight=e.lh,t.fontFamily=e.fam.name||"inherit",t.textAlign=e.alignment,t.fontWeight=e.fw,t.textDecoration=e.td??"none",this.stylesConverter.getColourStyles(e.tc,"color",t),t}getComponentStyles(){return D({},this.getTypoStyles())}getSpanStyle(){return{overflow:"hidden",display:"-webkit-box",webkitBoxOrient:"vertical",webkitLineClamp:2,color:"inherit",fontSize:"inherit",fontWeight:"inherit",fontFamily:"inherit"}}},vp=class extends ci{render(){return Y("div",{style:this.getCompiledStyles(),className:"lc-button",onClick:t=>this.onClick(t,{item:this.props.item}),children:Y("span",{style:this.getSpanStyle(),dangerouslySetInnerHTML:{__html:this.state.text}})})}getComponentStyles(){return wt(D({},super.getComponentStyles()),{cursor:"pointer"})}},K_=class extends br{render(){if(this.props.element.show[this.props.label.toLowerCase()])return this.props.element.lblPos==="end"?Y("div",{style:D(D({},this.getElementStyle()),this.props.styles),children:[Y("span",{children:this.props.time}),Y("span",{style:this.getTimeLabelStyle(),children:this.props.label})]}):Y("div",{style:D(D({},this.getElementStyle()),this.props.styles),children:[Y("span",{style:this.getTimeLabelStyle(),children:this.props.label}),Y("span",{children:this.props.time})]})}getDesign(){}getTimeLabelStyle(){return{fontSize:"0.5em",alignContent:"center"}}getElementStyle(){let t={display:"flex",flexDirection:"column",placeContent:"center center",textAlign:"center"};return this.props.element.horizontal&&(t.gridTemplateColumns="repeat(2, minmax(0, 1fr))"),t}},J_=class extends ci{labels={Days:"00",Hours:"00",Minutes:"00",Seconds:"00"};componentWillMount(){super.componentWillMount(),this.setState(()=>D({},this.labels)),this.processAndStartTimer()}render(){return Y("div",{style:this.getLabelsParentStyle(),children:Object.keys(this.labels).map(t=>Y(K_,{styles:this.getCompiledStyles(),label:t,time:this.state[t],element:this.props.element}))})}getLabelsParentStyle(){return{display:"grid",justifyContent:"center",gridTemplateColumns:"repeat(4, auto)",gap:this.stylesConverter.getSizePx(this.props.element.gap)}}getDisplayStyles(){return{display:"grid",placeContent:"center center"}}getComponentStyles(){return D(D({},super.getComponentStyles()),this.getDisplayStyles())}processAndStartTimer(){this.props.element.timer.start(this.props.element.timerType,t=>{this.labels.Days=String(t.days).padStart(2,"0"),this.labels.Hours=String(t.hours).padStart(2,"0"),this.labels.Minutes=String(t.minutes).padStart(2,"0"),this.labels.Seconds=String(t.seconds).padStart(2,"0"),this.setState(()=>D({},this.labels))})}},Q_=dt(Xo()),Z_=class extends ae{componentDidMount(){ze(()=>{this.setState(()=>({checked:this.props.item.selected.value}))})}render(){return Y("div",{style:this.getCompiledStyles(),className:"lc-checkbox",children:Y("input",{type:"checkbox",checked:this.state.checked,onChange:this.onChange.bind(this),style:{appearance:"auto"}})})}onChange(t){let{checked:e}=t.target;this.props.item.selected.value=e}getTypoStyles(){let t={},e=this.mediaStyle.typo??new Ve;return t.textAlign=e.alignment,t.justifyContent=e.alignment,t}getComponentStyles(){return wt(D({},this.getTypoStyles()),{display:"flex"})}},X_=dt(lr()),nc=class extends ae{constructor(t,e){super(t,e)}render(){let t=this.props.element[this.deviceTypeKey],e=t?.src||this.props.element.src||this.props.element.lg?.src;return Y("img",{onClick:this.customOnClick.bind(this),className:"lc-image",alt:t?.name||"Image",onMouseEnter:this.handleMouseEnter.bind(this),onMouseLeave:this.handleMouseLeave.bind(this),src:e,style:this.getCompiledStyles()})}customOnClick(t){this.props.element.clc?.at===X_.ClickActionType.ADD_TO_CART&&this.props.triggerContext.triggerData.items[0]&&this.onClick(t,{item:this.props.triggerContext.triggerData.items[0]}),this.props.onClick&&this.props.onClick("image")}getComponentStyles(){let t=this.mediaStyle.lout;if(!t||t.pos!=="absolute")return{};let e={zIndex:t.zIndex,cursor:this.props.element.clc?.at?"pointer":"auto"};return this.mediaStyle.size?.w&&(e.width=this.mediaStyle.size.w),this.mediaStyle.size?.h&&(e.height=this.mediaStyle.size.h),e}handleMouseEnter(t){let e=this.props.element[this.deviceTypeKey]?.secondarySrc;e&&(t.currentTarget.src=e)}handleMouseLeave(t){t.currentTarget.src=this.props.element[this.deviceTypeKey]?.src}},ic=class extends ae{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return Y("div",{style:this.getCompiledStyles(),class:"lc-flexbox",children:Y(sc,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})})}getComponentStyles(){let t=this.mediaStyle.flex??new Ih,e={display:"flex",gap:t.gap+"px",flexWrap:t.wrap,flexDirection:t.dir,justifyContent:t.jc,alignItems:t.ai};return t.wrap==="nowrap"&&t.scroll&&(t.dir==="column"?e["overflow-y"]="auto":e["overflow-x"]="auto"),e}},tE=class extends ic{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return Y("div",{style:this.getCompiledStyles(),class:"lc-flexbox",children:Y(wp,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext,item:this.props.item,noLinks:this.props.noLinks})})}},eE=class extends ae{render(){return Y("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(){ze(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:!1}))})}getTypoStyles(){let t={},e=this.mediaStyle.typo??new Ve;return t.letterSpacing=e.letterSpacing,t.fontSize=e.fs+"px",t.lineHeight=e.lh,t.fontFamily="inherit",t.textAlign=e.alignment,t.fontWeight=e.fw,this.stylesConverter.getColourStyles(e.tc,"color",t),t.boxShadow="none",t}getComponentStyles(){let t={};return this.props.selectedVariant.sellingPlans?.length||(t.visibility="hidden"),D(D({},t),this.getTypoStyles())}createSelectItems(){let t=[],e=this.props.selectedVariant;if(!e.sellingPlans?.length)return[];this.props.triggerContext.triggerData.skipSubscribedItems?e.selectedSellingPlan.value||(e.sellingPlans[0].isSelected=!0,e.changeSellingPlan(e.sellingPlans[0])):t.push(Y("option",{value:"",selected:!e.selectedSellingPlan,children:"One time purchase"}));for(let r of e.sellingPlans??[])t.push(Y("option",{value:r.mID,selected:r.isSelected,children:r.name}));return t}onChange(t){let e=t.target.value;e?this.props.selectedVariant.selectedSellingPlan.value=this.props.selectedVariant.sellingPlans.find(r=>r.mID===e):this.props.selectedVariant.selectedSellingPlan.value=void 0}},rE=dt(pu()),nE=class extends ae{colorRegex=new RegExp('fill="#[a-zA-Z0-9]+"');constructor(){super(),je.escape=rE.MustacheUtils.escapeHtml}render(){let t=this.getCompiledStyles(),e=this.getRating();return e||(t.display="none",e=""),Y("div",{style:t,className:"lc-star-rating",dangerouslySetInnerHTML:{__html:e}})}getRating(){let t=this.props.element.fullStar,e=this.props.element.halfStart,r={size:this.props.element.iconSize,color:this.props.element.c.hex};t=je.render(t,{svg:r}),e=je.render(e,{svg:r});let n=this.props.review;if(!n?.rating)return"";let i="";if(this.props.element.showSingleStar)i=t;else{let s=5,o=`${n.rating}`.split(".");for(let a=0;a<+o[0];a++)i+=t,s--;o[1]&&(i+=e,s--);for(let a=0;a<s;a++)i+=t.replace(this.colorRegex,'fill="#f1f1f1')}return i}getComponentStyles(){return{display:"flex",alignItems:"center"}}},iE=class extends ae{render(){return Y("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(){ze(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:!1}))})}getTypoStyles(){let t={},e=this.mediaStyle.typo??new Ve;return t.letterSpacing=e.letterSpacing,t.fontSize=e.fs+"px",t.lineHeight=e.lh,t.fontFamily="inherit",t.textAlign=e.alignment,t.fontWeight=e.fw,this.stylesConverter.getColourStyles(e.tc,"color",t),t.boxShadow="none",t}getComponentStyles(){let t={};return this.props.item.vars?.length===1&&this.props.item.vars[0].name==="Default Title"&&(t.visibility="hidden"),D(D({},t),this.getTypoStyles())}createSelectItems(){let t=[];for(let e of this.props.item.vars)t.push(Y("option",{value:e.mID,disabled:!e.isAvailable,children:e.name}));return t}onChange(t){let e=t.target.value;this.props.item.selectedOrFirstVariant.value=this.props.item.vars.find(r=>r.mID===e)}},wp=class extends ae{constructor(t,e){super(t,e),this.setState(()=>({decoration:"unset"}))}renderElement(t){if(!(t.hide||!this.matchWhenCondition(t.when))){if(t.t===4){let e=t;return Y(tE,{element:e,triggerContext:this.props.triggerContext,elements:e.elems,item:this.props.item,noLinks:this.props.noLinks})}if(t.t===6)return this.props.triggerContext.triggerData.isBundle()?Y(Z_,{element:t,item:this.props.item,triggerContext:this.props.triggerContext}):void 0;if(t.t===13){let e=t,r=this.props.item,n=r.variantImage??r.imageURL,i=r.variantSecondaryImage??r.secondaryImageURL;e.lg=e.sm={src:n,name:r.name,secondarySrc:i};let s=Y(nc,{element:e,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?s:Y("a",{href:this.props.item.selectedOrFirstVariant.value.link,style:{display:"block"},children:s})}if(t.t===14)return this.renderProductTitle(t);if(t.t===15){let e=t;return this.props.triggerContext.triggerData.isCartEmbed()&&this.props.item.vars?.length===1&&this.props.item.vars[0].name==="Default Title"?void 0:Y(iE,{element:e,item:this.props.item,triggerContext:this.props.triggerContext})}return t.t===16?Y(eE,{element:t,selectedVariant:this.props.item.selectedOrFirstVariant.value,item:this.props.item,triggerContext:this.props.triggerContext}):t.t===19?Y(nE,{element:t,triggerContext:this.props.triggerContext,review:this.props.item.reviews}):t.t===18||t.t===3?Y(vp,{element:t,item:this.props.item,triggerContext:this.props.triggerContext}):Y(sc,{elements:[t],element:this.props.element,triggerContext:this.props.triggerContext})}}render(){return this.props.elements.map(t=>this.renderElement(t))}getComponentStyles(){return{}}renderProductTitle(t){let e=Y(ci,{element:t,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?e:Y("a",{href:this.props.item.selectedOrFirstVariant.value.link,style:{display:"block",textDecoration:this.state.decoration},onMouseEnter:this.onMouseEnter.bind(this),onMouseLeave:this.onMouseLeave.bind(this),children:e})}customOnClick(t){this.sendTriggerClicked([this.props.item.toEmbed()],{from:t})}onMouseEnter(){this.setState(()=>({decoration:"underline"}))}onMouseLeave(){this.setState(()=>({decoration:"unset"}))}},bp=class extends ae{productElement;constructor(t,e){super(t,e),this.setState(()=>({decoration:"unset"}))}render(){let t=JSON.stringify(this.props.element),e=je.render(t,this.getProductData());if(this.productElement=new Ra(JSON.parse(e)),!(this.productElement.hide||!this.matchWhenCondition(this.productElement.when)))return Y("div",{style:D({},this.getCompiledStyles()),class:"lc-single-product",children:Y(wp,{element:this.productElement,elements:this.productElement.elems,triggerContext:this.props.triggerContext,item:this.props.item,noLinks:this.productElement.noLinks})})}getComponentStyles(){return{flexShrink:0}}getProductData(){if(!this.props.item)return{};let t=this.props.item,e=t.selectedOrFirstVariant.value,r=t.getTemplateVariables();r.product.quantity=this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(this.props.item.quantity):this.props.item.quantity;let n=this.props.triggerContext.triggerData.discount.type===Q_.DiscountType.BXGY;return!e.hasEffectivePrice()&&n&&(r.product.effective_price=Ne(e.effectivePrice.value),r.product.price=""),r.variant.quantity=this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(e.quantity):e.quantity,{product:r.product,variant:r.variant,svg:{color:()=>"{{svg.color}}",size:()=>"{{svg.size}}"}}}};function _p(t,e){if(!t)return;let r=new window.CooeeSDK.Swiper(t,{loop:!0,slidesPerView:e.maxInRow,spaceBetween:e.gap+"px",pagination:{type:e.pagination.type,el:t.querySelector(".swiper-pagination"),clickable:!0,renderBullet:(n,i)=>`
|
|
63
|
+
`,ec=class{sentryService=lt.get(Jt);async addToCart(t,e){if(!t.length)return;let r=t.map(a=>{let{vID:l,quantity:h}=this.getVIDAndQuantity(a);return{id:l?+l:+a.mID,quantity:h,properties:e.getPrivateAttributesForLineItem()}}),n=jn("cart/add.js"),i={items:r},s=Ee.get();s.isMiniCart()?i.sections=["mini-cart"]:s.isShopifyDefaultDrawer()&&(i.sections=s.element.getSectionsToRender?.().map(a=>a.section??a.id));let o=JSON.stringify(i);try{let a=await fetch(n,{body:o,method:"post",headers:{"Content-Type":"application/json"}});if(a.status===200||a.status===302)return x.log(`Added ${t.length} items to Cart`),tr("Product added to your cart"),a.json()}catch(a){tr("Fail to add product in cart"),this.sentryService.captureError("Fail to add product in cart",a,{body:o},{"shopify.shop":window.Shopify?.shop})}}async updateLineItem(t,e){if(!I_.JSUtils.hasKeys(e)){x.warn("No update fields provided");return}let r=jn("cart/change.js"),n=D({id:t.key},e),i=JSON.stringify(n);try{let s=await fetch(r,{body:i,method:"post",headers:{"Content-Type":"application/json"}});if(s.status===200||s.status===302){let o=await s.json();x.log(`Updated ${t}`),Ot.getCurrent().update(o)}}catch(s){tr("Failed to update item in cart"),this.sentryService.captureError("Failed to update item in cart",s,{body:i},{"shopify.shop":window.Shopify?.shop})}}async copyDiscountCode(t){if(t)try{await navigator.clipboard.writeText(t),x.log(`Code-${t} copied`),tr("Discount code copied")}catch(e){x.error("Failed to copy code",e)}}goToItem(t){if(!t?.link)return;let e=gf(t.link);e&&(location.pathname=Fi()+"products/"+e)}async upgradeToSubscription(t,e){if(!t){x.warn("Trying to upgrade to subscription with no item");return}let r=await Ot.getCurrent().getNormalisedCart(),n=t.selectedOrFirstVariant.value,i=r.items.findIndex(h=>h.vID===n.mID),s=n.selectedSellingPlan.value,o=jn("cart/change.js"),a={line:i+1,selling_plan:s?.mID||null,properties:e.getPrivateAttributesForLineItem()},l=JSON.stringify(a);try{let h=await fetch(o,{body:l,method:"post",headers:{"Content-Type":"application/json"}});if(h.status===200||h.status===302){x.log(`Upgraded ${t} selling plan`),tr("Line item updated");let g=await h.json();return Ot.getCurrent().update(g),g}}catch(h){tr("Failed to update subscription"),this.sentryService.captureError("Failed to update subscription",h,{body:l},{"shopify.shop":window.Shopify?.shop})}}async createNewCart(t,e,r){let n=se.get().storefrontToken;if(!n)throw new Error("Storefront token not set for the store");if(!t?.vID){x.error("No variant ID found to perform Buy now",t);return}let i=e?[e]:[],s=[{merchandiseId:`gid://shopify/ProductVariant/${t.vID}`,quantity:1,attributes:r.getKVFormatPrivateAttributesForLineItem()}],o=await dh(),a=new Headers;a.append("Content-Type","application/json"),a.append("X-Shopify-Storefront-Access-Token",n);let l=JSON.stringify({query:C_,variables:{input:{lines:s,discountCodes:i,attributes:o}}});return(await Lr.getInstance().request(q.GRAPHQL_API_PATH,{method:"POST",headers:a,body:l})).data?.cartCreate?.cart?.checkoutUrl}async process(t){let e=t.clickAction,r=t.items,n=t.triggerData;if(e.at){let i=e;if(x.log(`Performing ${JSON.stringify(i)} action`),i.at===101)r?.length&&this.goToItem(r[0]);else if(i.at===102)r?.length&&await this.addToCart(r,n);else if(i.at===103)await this.copyDiscountCode(n.discount.code);else if(i.at===105)Ee.get().open();else if(i.at===104){let s=t.collections;if(!s?.length)return;location.pathname=Fi()+"collections/"+s[0].handle}}e.applyDiscount&&n.discount?.code&&$n.navigate(n.discount.code,n.redirectBehaviour)}getVIDAndQuantity(t){let e,r;if(t instanceof pn)e=t.vID,r=t.quantity??1;else{if(!t.vars?.length)return{};e=t.selectedOrFirstVariant.value.mID,r=1}return{vID:e,quantity:r}}},T_=class{static updateIdentity(t){if(!this.isInstalled())return;let e={};t.email&&(e.email=t.email),t.mobile&&(e.phone_number=t.mobile),x.debug("Sending email/mobile to Klaviyo"),window.klaviyo.push(["identify",e])}static isInstalled(){return window.klaviyo&&typeof window.klaviyo=="object"}},x_=class{apiService;action;triggerContext;constructor(t,e){this.action=t,this.apiService=Wt.getInstance(),this.triggerContext=e}async execute(){let t=this.containsCTA()?q.EVENT_TRIGGER_CLICKED:q.EVENT_TRIGGER_CLOSED;switch(this.action.at!==106&&await this.closeTriggerAndSendEvent(t),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:x.error("Received an invalid ClickActionType: ",this.action.at);return}}externalAction(){this.action.ext?.u&&window.open(this.action.ext.u,"_blank")?.focus()}gotoURLAction(){if(this.action.gu?.u){let t=this.action.gu.u;uh(t)||(t=`//${t}`),window.open(t,"_self")}}async closeTriggerAndSendEvent(t,e){this.triggerContext.closeInApp(t,e),await this.dispatchEvent()}shareAction(){if(this.action.share){if(!navigator.share){x.warn("Navigator.share is not compatible with this browser");return}navigator.share({text:this.action.share.text,title:"Share"}).then(t=>console.log(t)).catch(t=>console.error(t))}}containsCTA(){return this.action.at&&this.action.at!==1?!0:!(this.isEmpty(this.action.custKV)&&this.isEmpty(this.action.up))}isEmpty(t){return t?Object.keys(t).length===0:!0}async collectFormData(){let t={};for(let e of this.triggerContext.inputs){if(!e.isValid)return;let r=document.getElementById(e.id).value;e.type===51?t.email=r:e.type===52&&(t.mobile=r)}await this.closeTriggerAndSendEvent(q.EVENT_FORM_SUBMITTED,{form:t}),tr("Coupon applied on cart"),T_.updateIdentity(t)}async dispatchEvent(){let t=this.triggerContext.triggerData,e={clickAction:this.action,items:this.triggerContext.selectedEmbeddedItems??t.embeddedItems??t.items,collections:t.collections,triggerData:t};await new ec().process(e);let r={action:this.containsCTA()?q.CAMPAIGN_CLICKED_ACTIVITY:q.CAMPAIGN_CLOSED_ACTIVITY};document.dispatchEvent(new CustomEvent(q.POPUP_ACTIVITY_EVENT,{detail:r}))}},op=class{constructor(t){this.scalingFactor=t}getLayoutStyles(t){if(!t)return{display:"block"};let e={display:t.disp};return t.of&&(e.objectFit=t.of),t.pos==="absolute"&&(e.width="auto !important",e.position="absolute",e.right=t.right+"px",e.left=t.left+"px",e.top=t.top+"px",e.bottom=t.bottom+"px"),e}getSizeStyles(t){let e={};return t?.w&&(e.width=t.w),t?.h&&(e.height=t.h),t?.maxW&&(e.maxWidth=t.maxW),t?.maxH&&(e.maxHeight=t.maxH),t?.minW&&(e.minWidth=t.minW),t?.minH&&(e.minHeight=t.minH),e}getBorderStyles(t){if(!t)return{};let e={};return t.radius&&t.radius>0&&(e.borderRadius=this.getSizePx(t.radius)),t.width&&t.width>0&&(e.borderWidth=this.getSizePx(t.width),e.borderStyle=t.style?.toLowerCase(),t.color?this.getColourStyles(t.color,"border-color",e):e.borderColor="black"),e}getFlexStyles(t){return t?{gap:t.gap+"px",flexWrap:t.wrap,flexDirection:t.dir,justifyContent:t.jc,alignItems:t.ai,width:"100%"}:{}}getSpaceStyles(t){let e={};return t?(e.paddingTop=this.getSizePx(t.pt),e.paddingBottom=this.getSizePx(t.pb),e.paddingLeft=this.getSizePx(t.pl),e.paddingRight=this.getSizePx(t.pr),e.marginTop=this.getSizePx(t.mt),e.marginBottom=this.getSizePx(t.mb),e.marginLeft=t.cent?"auto":this.getSizePx(t.ml),e.marginRight=t.cent?"auto":this.getSizePx(t.mr),e):(e.margin="0 !important",e.padding="unset",e)}getBackgroundStyles(t){if(!t)return{};let e={};if(t.glossy){let r="backdrop-filter",n="-webkit-"+r,i=`blur(${t.glossy.radius}px)`;if(!CSS.supports(n,i)&&!CSS.supports(r,i))return{background:t.glossy.fallback.rgba};if(e[n]=i,e[r]=i,t.glossy.color)return this.getColourStyles(t.glossy.color,"background",e)}else if(t.solid){if(t.solid.grad)return this.getGradientStyles(t.solid.grad,"background",e);if(t.solid.hex)return{backgroundColor:t.solid.rgba}}else if(t.img){if(!t.img.src)return{};let r=(t.img.a??0)/100;e.background=`linear-gradient(rgba(0, 0, 0, ${r}), rgba(0, 0, 0, ${r})),url("${t.img.src}") no-repeat center`,e.backgroundSize="cover",t.img.a&&(e["-webkit-backdrop-filter"]=`opacity(${t.img.a})`,e.backdropFilter=`opacity(${t.img.a})`)}return e}getGradientStyles(t,e,r){if(r??={},t.type==="LINEAR"){let n=`linear-gradient(${t.ang}deg, ${t.c1}, ${t.c2}`;t.c3&&(n+=`, ${t.c3}`),n+=")",r[e]=n}return r}getColourStyles(t,e="color",r){return r??={},t?t.grad?this.getGradientStyles(t.grad,e,r):(t.hex&&(r[e]=t.rgba),r):r}getSizePx(t){return this.getScaledSize(t)+"px"}getScaledSize(t){return(t??0)*this.scalingFactor}},ai=class{renderer=Wn.get();parentHTMLEl;inappElement;inappHTMLEl;triggerContext;stylesConverter;scalingFactor;constructor(t,e,r){this.parentHTMLEl=t,this.inappElement=e,this.triggerContext=r,this.stylesConverter=new op(this.renderer.getScalingFactor())}getHTMLElement(){return this.inappHTMLEl}insertElement(){this.renderer.appendChild(this.parentHTMLEl,this.inappHTMLEl)}processCommonBlocks(){this.processWidthAndHeight(),this.processPositionBlock(),this.processTransformBlock(),this.processTransparency(),this.processShadow(),this.registerAction();let t=wt(D(D(D(D({},this.getDisplayStyles()),this.getSpaceStyles()),this.getBorderStyles()),this.getBackgroundStyles()),{boxSizing:"border-box",outline:"none"});this.renderer.setStyles(this.inappHTMLEl,t)}getDisplayStyles(){return{display:"block"}}processWidthAndHeight(){this.inappElement.w&&this.renderer.setStyle(this.inappHTMLEl,"width",this.stylesConverter.getSizePx(this.inappElement.w)),this.inappElement.h&&this.renderer.setStyle(this.inappHTMLEl,"height",this.stylesConverter.getSizePx(this.inappElement.h))}processPositionBlock(){let t={position:"absolute",left:this.stylesConverter.getSizePx(this.inappElement.x),top:this.stylesConverter.getSizePx(this.inappElement.y)};this.renderer.setStyles(this.inappHTMLEl,t)}getBorderStyles(){return this.stylesConverter.getBorderStyles(this.inappElement.br)}getSpaceStyles(){return this.stylesConverter.getSpaceStyles(this.inappElement.spc)}processTransparency(){let t=this.inappElement.alpha;if(!isNaN(t)){let e=(t/100).toFixed(2);this.renderer.setStyle(this.inappHTMLEl,"opacity",e)}}processShadow(){let t=this.inappElement.shd;t?this.renderer.setStyle(this.inappHTMLEl,"box-shadow",t.getStyle(this.scalingFactor)):this.renderer.setStyle(this.inappHTMLEl,"box-shadow","unset")}processTransformBlock(){let t=new mh(this.inappElement.trf);t&&t.rotate&&this.renderer.setStyle(this.inappHTMLEl,"transform",`rotate(${t.rotate}deg)`)}registerAction(){let t=this.inappElement.clc;!t||Object.keys(t).length===0||(this.inappHTMLEl.addEventListener("click",e=>{e.stopPropagation(),new x_(t,this.triggerContext).execute()}),this.renderer.setStyle(this.inappHTMLEl,"cursor","pointer"))}getBackgroundStyles(){return this.stylesConverter.getBackgroundStyles(this.inappElement.bg)}},bs=class extends ai{constructor(t,e,r){super(t,e,r)}processCommonBlocks(){super.processCommonBlocks(),this.processFontBlock(),this.processAlignment()}processFontBlock(){let t={},e=this.inappElement.typography;return e&&(t.fontSize=this.stylesConverter.getSizePx(e.fs),t.fontFamily=q.COOEE+e.fam?.name,t.lineHeight=`${e.lh}`,t.letterSpacing=e.letterSpacing),this.stylesConverter.getColourStyles(this.inappElement.color,"color",t),this.renderer.setStyles(this.inappHTMLEl,t),t}processPart(t,e){let r=[];e.u&&r.push("underline"),e.st&&r.push("line-through"),r.length||r.push("normal"),this.renderer.setStyle(t,"font-weight",e.b?"bold":"normal"),this.renderer.setStyle(t,"font-style",e.i?"italic":"normal"),this.renderer.setStyle(t,"text-decoration",r.join(" ")),this.renderer.setStyle(t,"color",e.c??"inherit"),this.renderer.setStyle(t,"font-family","inherit")}processAlignment(){let t=this.inappElement.typography.ta,e=t?Pa[t]?.toLowerCase():this.inappElement.typography.alignment;e||(e="start"),this.renderer.setStyle(this.inappHTMLEl,"text-align",e)}},D_=class extends bs{constructor(t,e,r){super(t,e,r),this.inappHTMLEl=this.renderer.createElement("div"),this.insertElement()}render(){this.inappElement.parts?.forEach(t=>{let e=this.renderer.createElement("span");e.innerHTML=t.txt?.toString()?.replace(/\n/g,"<br />"),this.processPart(e,t),this.renderer.appendChild(this.inappHTMLEl,e)}),this.processCommonBlocks()}},N_=class extends ai{constructor(t,e,r){super(t,e,r),this.inappHTMLEl=this.renderer.createElement("div"),this.insertElement()}render(){this.processCommonBlocks()}},ap=class extends ai{constructor(t,e,r){super(t,e,r),this.inappHTMLEl=this.renderer.createElement("img"),this.insertElement()}render(){this.renderer.setAttribute(this.inappHTMLEl,"src",this.inappElement.src),this.renderer.setStyle(this.inappHTMLEl,"max-width","none"),this.renderer.setStyle(this.inappHTMLEl,"max-height","none"),this.renderer.setStyle(this.inappHTMLEl,"margin","0 auto"),this.processCommonBlocks()}},A_=class cp extends ai{constructor(e,r,n){super(e,r,n),this.parent=e,this.inappHTMLEl=this.renderer.createElement("div")}static MAX_Z_INDEX="2147483647";render(){return this.parent||this.renderer.removeInApp(this.triggerContext),this.insertElement(),this.processCommonBlocks(),this.inappHTMLEl.classList.add(q.IN_APP_WRAPPER_NAME),this.inappHTMLEl.classList.add(this.triggerContext.rootClassName),this.renderer.setStyle(this.inappHTMLEl,"z-index",cp.MAX_Z_INDEX),this.inappHTMLEl}getBackgroundStyles(){return this.inappElement.cover?super.getBackgroundStyles():{}}processWidthAndHeight(){let e=this.inappElement.cont;if(this.inappElement.cover)this.renderer.isParentNotBody()?(this.renderer.setStyle(this.inappHTMLEl,"width","100%"),this.renderer.setStyle(this.inappHTMLEl,"height","100%")):(this.renderer.setStyle(this.inappHTMLEl,"width","100vw"),this.renderer.setStyle(this.inappHTMLEl,"height","100vh")),this.renderer.setStyle(this.inappHTMLEl,"top","0"),this.renderer.setStyle(this.inappHTMLEl,"left","0");else{let r=this.inappElement.spc,n=this.stylesConverter.getScaledSize(e.w)+r.getHorizontal(),i=this.stylesConverter.getScaledSize(e.h)+r.getVertical();this.renderer.setStyle(this.inappHTMLEl,"width",n+"px"),this.renderer.setStyle(this.inappHTMLEl,"height",i+"px")}}getSpaceStyles(){return{padding:this.inappElement.spc.getPaddingCSS()}}getDisplayStyles(){return D(D({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(){}},O_=class extends ai{constructor(t,e,r){super(t,e,r),this.inappHTMLEl=this.renderer.createElement("div"),this.insertElement()}render(){return this.processCommonBlocks(),this.renderer.setStyle(this.inappHTMLEl,"position","relative"),this.renderer.setStyle(this.inappHTMLEl,"overflow","hidden"),this.inappHTMLEl.classList.add(q.IN_APP_CONTAINER_NAME),this}},lp=class extends bs{borderColor="";constructor(t,e,r){super(t,e,r),this.inappHTMLEl=this.renderer.createElement("input"),this.insertElement()}render(){let t=this.setInputType();this.renderer.setAttribute(this.inappHTMLEl,"placeholder",this.inappElement.placeholderText),this.renderer.setStyle(this.inappHTMLEl,"background","#ffffff00"),this.renderer.setStyle(this.inappHTMLEl,"outline","none"),this.inappHTMLEl.addEventListener("click",e=>{e.stopPropagation()}),this.processCommonBlocks(),this.addListener(this.inappHTMLEl,t),this.triggerContext.addInputField(t,this.inappElement.t)}},P_=class up extends lp{static EMAIL_REGEX=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;constructor(e,r,n){super(e,r,n)}setInputType(){let e=`coo-${this.inappElement.t}`;return this.renderer.setAttribute(this.inappHTMLEl,"type","email"),this.renderer.setAttribute(this.inappHTMLEl,"id",e),e}addListener(e,r){e.addEventListener("keydown",n=>{this.borderColor||(this.borderColor=this.inappHTMLEl.style.borderColor),e.value.match(up.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()})}},k_=class hp extends lp{static MOBILE_REGEX=/^\d+$/;constructor(e,r,n){super(e,r,n)}setInputType(){let e=`coo-${this.inappElement.t}`;return this.renderer.setAttribute(this.inappHTMLEl,"type","tel"),this.renderer.setAttribute(this.inappHTMLEl,"id",e),e}addListener(e,r){e.addEventListener("keydown",n=>{this.borderColor||(this.borderColor=this.inappHTMLEl.style.borderColor),e.value.match(hp.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()})}},R_=class Re extends bs{static DAYS="Days";static HOURS="Hours";static MINUTES="Minutes";static SECONDS="Seconds";elements;spans=[];constructor(e,r,n){super(e,r,n),this.inappHTMLEl=this.renderer.createElement("div"),this.insertElement()}render(){this.addTimerChildren(),this.processAndStartTimer(),this.processCommonBlocks();let e=wt(D(D(D({flex:"1 1 0"},this.stylesConverter.getBackgroundStyles(this.inappElement.bg)),this.stylesConverter.getBorderStyles(this.inappElement.br)),this.stylesConverter.getSpaceStyles(this.inappElement.spc)),{marginLeft:this.stylesConverter.getSizePx(this.inappElement.gap),marginRight:this.stylesConverter.getSizePx(this.inappElement.gap)});this.addStylesToTimer(e)}getBackgroundStyles(){return{}}processFontBlock(){let e=super.processFontBlock();return this.stylesConverter.getColourStyles(this.inappElement.color,"color",e),this.addStylesToTimer(e),e}getSpaceStyles(){return{}}getBorderStyles(){return{}}getDisplayStyles(){return{display:"flex",flexWrap:"nowrap",justifyContent:"center"}}addStylesToTimer(e){this.elements.forEach(r=>this.renderer.setStyles(r,e))}addTimerChildren(){let e=this.inappElement.show;this.elements=[],e.day&&this.elements.push(this.getChild(Re.DAYS)),e.hour&&this.elements.push(this.getChild(Re.HOURS)),e.minute&&this.elements.push(this.getChild(Re.MINUTES)),e.second&&this.elements.push(this.getChild(Re.SECONDS)),this.elements.forEach(r=>this.inappHTMLEl.appendChild(r))}getChild(e){let r=this.renderer.createElement("div"),n=this.renderer.createElement("span"),i=this.renderer.createElement("span");return i.innerText=e,n.innerText="00",n.id=`lc-${e}`,this.renderer.setStyle(i,"font-size","0.5em"),this.renderer.setStyle(i,"text-align","center"),this.renderer.setStyle(i,"font-family","inherit"),this.renderer.setStyle(n,"text-align","center"),this.renderer.setStyle(n,"font-family","inherit"),this.inappElement.lblPos==="start"?(r.appendChild(i),r.appendChild(n)):(r.appendChild(n),r.appendChild(i)),this.renderer.setStyle(r,"display","flex"),this.renderer.setStyle(r,"flex-direction",this.inappElement.horizontal?"":"column"),this.renderer.setStyle(r,"justify-content","center"),this.renderer.setStyle(r,"align-items","center"),this.renderer.setStyle(r,"gap","5px"),this.spans.push(n),r}processAndStartTimer(){let e=this.inappElement.timer.start(this.inappElement.timerType,r=>{this.spans.forEach(n=>{n.id===`lc-${Re.DAYS}`?n.innerText=String(r.days).padStart(2,"0"):n.id===`lc-${Re.HOURS}`?n.innerText=String(r.hours).padStart(2,"0"):n.id===`lc-${Re.MINUTES}`?n.innerText=String(r.minutes).padStart(2,"0"):n.id===`lc-${Re.SECONDS}`&&(n.innerText=String(r.seconds).padStart(2,"0"))})});this.triggerContext.intervals.push(e)}},L_=class extends bs{constructor(t,e,r){super(t,e,r),this.inappHTMLEl=this.renderer.createElement("select"),this.insertElement()}render(){this.renderer.setStyle(this.inappHTMLEl,"background","#ffffff00"),this.renderer.setStyle(this.inappHTMLEl,"outline","none"),this.processCommonBlocks(),this.addListener(this.inappHTMLEl),this.addOptions()}addListener(t){this.triggerContext.selectedEmbeddedItems?.length||this.updateItems(this.triggerContext.triggerData.items[0].vars[0]),t.addEventListener("click",e=>{e.stopPropagation()}),t.addEventListener("change",()=>{let e=new cs(JSON.parse(t.value));this.updateItems(e)})}updateItems(t){let e=this.triggerContext.triggerData.items[0];this.triggerContext.selectedEmbeddedItems=[e.toEmbed(t)];let r=this.parentHTMLEl.querySelector("#coo-13");if(!r)return;let n=t.imgs[0]??e.imgs?.at(0);n?.url&&r.setAttribute("src",n.url)}addOptions(){let t=this.triggerContext.triggerData.items,e=this.inappHTMLEl;if(!t?.length){e.add(this.createOption(this.inappElement.placeholderText));return}let r=this.triggerContext.selectedEmbeddedItems?.at(0);t[0].vars.forEach(n=>{e.add(this.createOption(n.name??"Default",n,n.mID===r?.vID))})}createOption(t,e,r){let n=this.renderer.createElement("option");return n.text=t,n.value=JSON.stringify(e),r&&(n.selected=!0),e||(n.disabled=!0),n}},U_=class extends ap{constructor(t,e,r){super(t,e,r)}render(){super.render(),this.inappHTMLEl.setAttribute("id",`coo-${this.inappElement.type}`)}},pp=class Un{static ACTIVE_TRIGGER_DATA;renderer=Wn.get();safeHTTP;parent;rootContainer;containerHTMLElement;ian;triggerContext;resizeListener;cartDrawerToggleSubscription;constructor(e){this.safeHTTP=Wt.getInstance(),this.resizeListener=()=>this.screenResized(),this.setParentContainer(e)}setParentContainer(e){this.parent=e??document.body,this.renderer.setParentContainer(this.parent)}render(e){this.renderEngagement(new Ar(e))}async renderEngagement(e){if(this.triggerContext=new np(new Date,e),this.triggerContext.onClose(r=>{this.closeInApp(r)}),this.ian=e.ian,(this.renderer.isMobile()||e.previewType==="mobile")&&this.ian.overrideForMobileView(),this.ian.isEmbedded()){let r=document.querySelector(this.ian.getEmbeddedSelector());this.setParentContainer(r)}await this.preloadImages(e),e.shouldDelay()?window.setTimeout(()=>{this.withCartDrawerClosed()},e.getDelaySeconds()):this.withCartDrawerClosed()}withCartDrawerClosed(){if(!Ee.get().isOpen()||!this.renderer.isMobile()){this.startRenderingOnce();return}this.cartDrawerToggleSubscription=Ee.get().onToggle().subscribe(({open:e})=>{!e&&this.startRenderingOnce()})}startRenderingOnce(){if(!this.shouldSkipCampaign()){Un.ACTIVE_TRIGGER_DATA=this.triggerContext.triggerData;try{this.startRendering()}catch(e){Jt.getInstance().captureException(e,{triggerData:JSON.stringify(this.triggerContext.triggerData)});return}this.sendTriggerDisplayed(),this.renderer.isMobile()||window.addEventListener("resize",this.resizeListener),this.cartDrawerToggleSubscription?.unsubscribe()}}shouldSkipCampaign(){let e=this.triggerContext.triggerData;if(!e.previewType&&Un.ACTIVE_TRIGGER_DATA){let n={triggerShown:new Fa(Un.ACTIVE_TRIGGER_DATA??{})};return this.skipTrigger(e,n),!0}if(kt.get().isGoKwikPopupOpen)return this.skipTrigger(e,{reason:"GoKwik popup is open"}),!0;let r=q.PAYMENT_MODAL_DETAILS.find(n=>!!document.querySelector(n.identifier));return r?(this.skipTrigger(e,{reason:`${r.gateway} modal is open`}),!0):!1}startRendering(){this.renderer.calculateScalingFactor(this.ian),this.rootContainer=new A_(this.parent,this.ian,this.triggerContext).render();try{this.renderContainer(this.triggerContext)}catch(e){throw x.error(e),e}}sendTriggerDisplayed(){let e={};this.triggerContext.triggerData.items?.length&&(e.promotedMIDs=this.triggerContext.triggerData.items?.map(i=>i.mID));let r=new jt(q.EVENT_TRIGGER_DISPLAYED,e,this.triggerContext.triggerData);this.safeHTTP.sendEvent(r);let n={action:q.CAMPAIGN_DISPLAYED_ACTIVITY};document.dispatchEvent(new CustomEvent(q.POPUP_ACTIVITY_EVENT,{detail:n}))}sendTriggerClosed(e){let r=e.eventName;delete e.eventName;let n=new jt(r,e,this.triggerContext.triggerData);n.name===q.EVENT_TRIGGER_CLICKED&&(n.items=this.triggerContext.selectedEmbeddedItems??this.triggerContext.triggerData.items?.map(i=>i.toEmbed())),this.safeHTTP.sendEvent(n)}addEnterAnimation(e){this.containerHTMLElement.animate(e.getEnterAnimation(),{duration:500})}renderElement(e,r,n){r instanceof _h?new P_(e,r,n).render():r instanceof Eh?new k_(e,r,n).render():r instanceof Lo?new D_(e,r,n).render():r instanceof Sh?new U_(e,r,n).render():r instanceof Oa?new ap(e,r,n).render():r instanceof yh?new N_(e,r,n).render():r instanceof wh?new R_(e,r,n).render():r instanceof bh?new L_(e,r,n).render():x.error("Unsupported element type- "+r.type)}renderContainer(e){let r=this.ian?.cont;r&&(this.containerHTMLElement=new O_(this.rootContainer,r,e).render().getHTMLElement(),new w_().loadAllFonts(this.ian),this.ian.elems?.forEach(async n=>{await this.renderElement(this.containerHTMLElement,n,e)}),this.addEnterAnimation(this.ian.anim))}closeInApp(e){let r=this.ian.anim.getExitAnimation();this.sendTriggerClosed(e),Un.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(){Wn.get().removeInApp(this.triggerContext)}skipTrigger(e,r){let n=new jt(q.EVENT_CAMPAIGN_REJECTED,r,e);this.safeHTTP.sendEvent(n)}async preloadImages(e){let r=e.ian;if(!r)return;let n=[];r.elems.forEach(i=>{let s=i.bg?.img?.src;if(s&&n.push(this.getPromise(s)),i.t===1){let o=i.src;if(!o)return;n.push(this.getPromise(o))}}),r.bg?.img?.src&&n.push(this.getPromise(r.bg.img.src)),r.cont.bg?.img?.src&&n.push(this.getPromise(r.cont.bg.img.src)),await Promise.all(n)}getPromise(e){return new Promise(r=>{let n=new Image;n.onload=r,n.src=e,n.style.display="none"})}},M_=dt(lr()),B_=dt(Qn()),j_=class{triggerData;safeHttpService=Wt.getInstance();render(t){t.contentSource===M_.EngagementContentSource.KLAVIYO&&(this.triggerData=t,window.addEventListener("klaviyoForms",this.handleKlaviyoEvents.bind(this)),window._klOnsite=window._klOnsite||[],window._klOnsite.push(["openForm",t.klaviyoFormID]))}handleKlaviyoEvents(t){if(t.type!=="klaviyoForms")return;let e=t.detail;if(e.formId!==this.triggerData.klaviyoFormID){x.warn("Received invalid trigger callback");return}switch(e.type){case"open":this.safeHttpService.sendEvent(new jt(q.EVENT_TRIGGER_DISPLAYED,{form:{id:e.formId}},this.triggerData));break;case"stepSubmit":{let r=this.getFormDetails(e);this.safeHttpService.sendEvent(new jt(q.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 jt(q.EVENT_TRIGGER_CLOSED,{form:{id:e.formId}},this.triggerData));break}}getFormDetails(t){let e={id:t.formId},r=t.metaData;if(B_.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)||(e[o]=r[o])}),e.email=r.$email??r.email,e.mobile=r.$phone_number??r.phone_number;let i=r.$first_name??r.first_name,s=r.$last_name??r.last_name;(i?.length||s?.length)&&(e.name=i+" "+s)}return e}},$_=class{static trackIntent(t){if(!this.isInstalled()){x.log("Facebook pixel not installed");return}if(!se.get().pixelPush){x.log("Facebook pixel push not enabled");return}let e=us[t.intent]?.toLowerCase(),r=t.segmentName;!e&&!r||(x.debug(`Sending ${e} intent and ${r} segment to Facebook Pixel`),window.fbq("trackCustom","CooeeIntent",{intent_value:e,segment_value:t.segmentName}))}static isInstalled(){return window.fbq&&typeof window.fbq=="function"}},dp=class{static itemMap=new Map;static async refreshItems(t){if(t.isCartEmbed()&&!t.isSubscriptionUpsell()){let i=(await Ot.getCurrent().getNormalisedCart()).items.map(s=>s.mID);t.items=t.items.filter(s=>!i.includes(s.mID))}if(se.get().currencyCount<=1)return t.items;if(t.isShoppableVideo())return await this.refreshVideoItems(t.content.videoConfig,t.engagementID),t.items;let e=t.items.length,r=t.items.map(i=>this.updatedItem(i,t.engagementID)),n=(await Promise.all(r)).filter(i=>i!=null);if(e&&!n.length){let i="Failed to fetch any product from Ajax API",s=new jt(q.EVENT_CAMPAIGN_FAILED,{reason:i,currency:t.currency},t);throw Wt.getInstance().sendEvent(s),new Error(i)}if(t.isCartRecovery()){let i=Ot.getCurrent().items,s=[];for(let o of n)for(let a of o.vars){if(!a.isAvailable)continue;let l=i.find(p=>p.variant_id.toString()===a.mID);if(!l)continue;let h=new Fe(o);h.name=l.title;let g=new cs(a);g.name=l.variant_title,g.price.d=l.discounted_price/100,h.variants=[g],s.push(h)}return s}return n}static async refreshVideoItems(t,e){await Promise.all(t.videos.map(async r=>{r.items=await Promise.all(r.items.map(async n=>await this.updatedItem(n,e)||n))}))}static async updatedItem(t,e){if(this.itemMap.has(t.mID))return this.itemMap.get(t.mID);let r=t,n=Jt.getInstance(),i=lt.get(Lr),s,o=`/products/${r.slug}.js`;try{s=await i.request(o)}catch(l){return x.error(`Failed to fetch ${o}`,l),l instanceof Response?n.captureMessage(`Shopify product fetch failed ${l.status}`,"error",{item:r,path:o},{"engagement.id":e}):n.captureException(l,{item:r,path:o},{"engagement.id":e}),null}if(!s)return x.error("Item not found after AJAX call for:",r),null;r.name=s.title,r.tags=s.tags;let a=r.selectedOrFirstVariant.value;return r.vars.map(l=>{let h=s.variants.find(g=>g.id===+l.mID);l.name=h.title,l.isAvailable=h.available,l.price.d=h.price?h.price/100:h.price,l.price.effective=l.price.d,l.price.cmp=h.compare_at_price?h.compare_at_price/100:h.compare_at_price,+a.mID===h.id&&(a.effectivePrice.value=l.price.d)}),this.itemMap.set(r.mID,r),r}},rc=class fp{static INSTANCE;httpService=lt.get(Lr);sentryService=lt.get(Jt);sessionManager=lt.get(we);runtime=kt.get();constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new fp),this.INSTANCE}sendSilently(e){this.send(e).catch(r=>x.error(`Failed to send ${e.name}`,r))}async send(e){if(x.debug(`Sending event ${e.name}`),Jr.prepend(`Sending event <strong>${e.name}</strong> with id ${e.id}`),this.shouldReject(e)){x.warn(`Rejecting event ${e.name}`);return}await Promise.all([this.addSessionContext(e),this.addShopifyContext(e)]),this.addShopifyAttributes(),e.name!==q.EVENT_APP_BACKGROUND&&this.runtime.setActive(),e.currentItem=this.runtime.getCurrentItem(),e.locale=this.runtime.locale,this.httpService.post("/v1/event/track",e).then(async r=>{x.log("\u2705 Event tracked:",e.name),Jr.prepend(`\u2705 Event <strong>${r.eventName}</strong> tracked`),this.processEventResponse(e,r)}).catch(r=>{x.error(`Error sending event ${e.name} to server`,r)})}shouldReject(e){return e.trigger?.triggerID==="test"||e.trigger?.triggerID==="preview"?(x.warn("Not sending event as this is a test trigger"),!0):!1}async addSessionContext(e){let r=await this.sessionManager.checkSessionAndGetContext();e.sessionID=r[0],e.sessionNumber=r[1],e.landingPage=r[2],e.page=ws.parseFromCurrent()}async addShopifyContext(e){try{e.cart=await Ot.getCurrent().getNormalisedCart()}catch(r){x.error("Error fetching Shopify cart before sending the event",r)}}processEventResponse(e,r){this.renderWidgetIfAny(e,r).catch(n=>{x.error("Failed to display a campaign",n,e,r),this.sentryService.captureException(n,{event:e,response:r})}),this.utiliseIntentIfCalculated(r)}async renderWidgetIfAny(e,r){if(!r.triggerData){x.log(`Nothing to engage after ${e.name}`);return}x.log(`\u{1F4E3} Engagement(id=${r.triggerData.shortID}) will be shown`,r.triggerData);let n=new Ar(r.triggerData);n.occurred=e.occurred;let i;try{i=await dp.refreshItems(n)}catch(s){x.error("Failed to refresh the products",s);return}if(n.items=i,n.contentSource===v_.EngagementContentSource.KLAVIYO){new j_().render(n);return}new pp().renderEngagement(n).catch(s=>{x.error("Failed to render popup",s),this.sentryService.captureException(s,{event:e,triggerData:n})})}utiliseIntentIfCalculated(e){e.intent&&(rp.trackIntent(e.intent),$_.trackIntent(e),Jr.prepend(`Intent is <strong>${us[e.intent]}</strong>`))}addShopifyAttributes(){Ot.getCurrent().addCooeeAttributes().catch(e=>{x.error("Fail to add attributes in cart",e)})}},Wt=class gp{static INSTANCE;httpApiService=Lr.getInstance();eventAPIService=rc.getInstance();constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new gp),this.INSTANCE}sendEvent(e){x.debug(`Waiting for auth to send event ${e.name}`),we.replaySubject.subscribe(async()=>{this.eventAPIService.sendSilently(e)})}updateProfile(e){we.replaySubject.subscribe(()=>{this.httpApiService.updateUserData(e??{})})}trackOrder(e){we.replaySubject.subscribe(()=>{this.httpApiService.trackOrder(e)})}updateDeviceProps(e){we.replaySubject.subscribe(()=>{this.httpApiService.updateDeviceProps({props:e})})}generateDiscount(e){return this.httpApiService.generateDiscount(e)}},Jr=class{static isOn=!1;static element;static watch(){let t=vu();(t==="1"||t==="on")&&Wt.getInstance().updateDeviceProps({debugTill:this.getDebugMillis()}),t==="on"?sessionStorage.cooeeDebug="1":t==="off"&&sessionStorage.removeItem("cooeeDebug"),sessionStorage.cooeeDebug&&(this.isOn=!0,this.renderDebugBar())}static prepend(t){if(!this.isOn)return;let e=document.createElement("div");e.innerHTML="• "+new Date().toLocaleString()+" - "+t,this.element.prepend(e)}static renderDebugBar(){this.element=document.createElement("div"),this.element.id="cooee-debugger",this.element.setAttribute("draggable","true"),Ta(()=>{document.body.appendChild(this.element)})}static dragElement(){let t=0,e=0,r=0,n=0,i=a=>{a=a||window.event,a.preventDefault(),r=a.clientX,n=a.clientY,document.onmouseup=o,document.onmousemove=s},s=a=>{a=a||window.event,a.preventDefault(),t=r-a.clientX,e=n-a.clientY,r=a.clientX,n=a.clientY,this.element.style.top=this.element.offsetTop-e+"px",this.element.style.left=this.element.offsetLeft-t+"px"},o=()=>{document.onmouseup=null,document.onmousemove=null};this.element.onmousedown=i}static getDebugMillis(){return new Date().getTime()+6*60*60*1e3}},uu=class extends ha{static storeName="app";static{this.storage=ua(this.storeName)}},F_=class{static processConfiguration(){let t=se.get();!t.gaMeasurementID||!t.gaEnabled||this.sendClientID()}static async sendClientID(){let t=await this.getClientID();t&&Wt.getInstance().updateDeviceProps({gaClientID:t})}static async getClientID(){let t=await Ut.get(at.GA_CLIENT_ID),e=await this.getClientIDViaGTag();if(t!==e)return await Ut.set(at.GA_CLIENT_ID,e),e}static async getClientIDViaGTag(){let t=se.get().gaMeasurementID;if(!(!t||!window.gtag))return new Promise(e=>{window.gtag("get",t,"client_id",r=>{e(r)})})}},H_=class mp{static INSTANCE;constructor(){this.init()}static getInstance(){return this.INSTANCE||(this.INSTANCE=new mp),this.INSTANCE}init(){uu.get(at.APP_CONFIG,{}).then(e=>this.updateGlobalConfig(e))}async processAppConfigurations(e){x.log("Received app configuration",e),e.currencyCount=e.currencies?.length;let r=this.updateGlobalConfig(e);uu.set(at.APP_CONFIG,r).catch(n=>x.error(n)),F_.processConfiguration(),r.website&&(ye.injectRawScript(r.website.commonJS),ye.injectRawCSS(r.website.commonCSS)),Ee.get().onToggle().subscribe(async({open:n})=>{x.info("Cart drawer is now",n?"open":"closed"),n&&(lt.get(Jn).loadOrRenderWidgetsAfterCartChange(),await this.trackViewCartEvent())})}updateGlobalConfig(e){let r=St.globalRef.config.update(e);return Ee.forceUpdate(),x.debug("App configurations",r),r}async trackViewCartEvent(){let e=await Ot.getCurrent().getNormalisedCart(),r={value:e.amount,currency:e.currency},n={items:e.items,amount:r,drawer:!0};Wt.getInstance().sendEvent(new jt(q.EVENT_VIEW_CART,n))}},V_=dt(yu()),W_=class Ko{static META_REQUIRED_FIELDS=["ad_id"];static GOOGLE_REQUIRED_FIELDS=["gad_source","gclid"];source;adID;campaignID;adName;campaignName;constructor(e){this.adID=e.adID,this.campaignID=e.campaignID,this.source=e.source}static getAdParams(){let e;try{e=new V_.URLBuilder(location.href)}catch{return{}}let r={};if(this.META_REQUIRED_FIELDS.every(n=>Array.from(e.getParams().keys()).includes(n)))return r={source:"META",adID:e.getQueryParam("ad_id")?.trim(),campaignID:e.getQueryParam("campaign_id")?.trim()},new Ko(r);if(this.GOOGLE_REQUIRED_FIELDS.every(n=>Array.from(e.getParams().keys()).includes(n)))return r={source:"GOOGLE"},new Ko(r)}},Jo=class yp{static INSTANCE;httpAPIService=Lr.getInstance();coreService=H_.getInstance();sentryService=Jt.getInstance();sdkToken="";userID="";deviceID="";appID="";shopifyShop="";constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new yp),this.INSTANCE}init(e){this.appID=e.appID,this.shopifyShop=e.shopifyShop}async storeAndPopulateAuthData(e){e&&(e.userID&&(this.userID=e.userID,await Ut.set(at.ID,e.userID)),e.deviceID&&(this.deviceID=e.deviceID,await Ut.set(at.DEVICE_ID,e.deviceID)),e.sdkToken&&(this.sdkToken=e.sdkToken,await Ut.set(at.SDK_TOKEN,e.sdkToken)),this.updateAPIClient())}async validateSession(e){await this.populateFirstSeen(),await this.populateUserDataFromStorage(),x.log("Validating session with server");let r=await this.getSessionValidateData(e);try{let n=await this.httpAPIService.validateSession(r);x.log("Validating session Response",n),await this.coreService.processAppConfigurations(n.appSettings),await this.storeAndPopulateAuthData(n)}catch(n){throw x.error(n),n}}async populateUserDataFromStorage(){if(this.sdkToken=await Ut.get(at.SDK_TOKEN),!this.sdkToken){x.warn("No SDK token found in local storage");return}this.userID=await Ut.get(at.ID),this.deviceID=await Ut.get(at.DEVICE_ID),this.updateAPIClient()}updateAPIClient(){x.debug("SDK Token:",this.sdkToken),x.log("Device ID:",this.deviceID),x.log("User ID:",this.userID),rp.trackDeviceID(this.deviceID),Jr.prepend(`Device ID: <strong>${this.deviceID}</strong>`),this.httpAPIService.setAPIToken(this.sdkToken),this.sentryService.setGlobalContext("Visitor Info",{device_id:this.deviceID,user_id:this.userID}),this.sentryService.setUser({id:this.deviceID})}async getSessionValidateData(e){let r=await new y_().safeGet(),n=await Ut.get(at.DEVICE_ID);return n||(n=new Kt().toHexString(),await Ut.set(at.DEVICE_ID,n)),wt(D({deviceID:n,deviceProps:r,appID:this.appID,shopifyShop:this.shopifyShop},e),{sdk:q.SDK,page:ws.parseFromCurrent(),ad:W_.getAdParams(),occurred:this.getSessionStartTime(kt.get().jsLoadTime),currentItem:kt.get().getCurrentItem(),cart:await Ot.getCurrent().getNormalisedCart(),properties:{}})}async populateFirstSeen(){let e=await Ut.get(at.FIRST_SEEN),r=e?new Date(e):new Date;e||await Ut.set(at.FIRST_SEEN,r.toISOString()),this.httpAPIService.setFirstSeen(r),this.sentryService.setGlobalContext("Visitor Info",{first_seen:r.toISOString()})}getSessionStartTime(e){return(new Date().getTime()-e.getTime())/1e3>q.IDLE_TIME_IN_SECONDS?new Date:e}},we=class Mn{static replaySubject=new Nb(1);static INSTANCE;sentryService=lt.get(Jt);constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Mn),this.INSTANCE}init(e){if(x.debug("Initialising SDK",e),d_(navigator.userAgent)){x.info("This seems to be a bot. Disabling SDK");return}Jo.getInstance().init(e),Mn.INSTANCE.checkSessionOnPageLoad().then(async()=>{Mn.replaySubject.next(!0),Mn.replaySubject.complete()}).catch(r=>{x.error("Unable to initiate session",r)})}getCurrentSessionID(){return re.set(at.SESSION_LAST_USED_TIME,new Date().getTime()),re.get(at.ID,"")}async checkSessionOnPageLoad(){await yf.request("validate_session",async()=>{await this.checkForNewSession(!0)})}async checkSessionAndGetContext(){return await this.checkForNewSession(),this.getContext()}async getContext(){let e=await Promise.all([this.getCurrentSessionID(),this.getCurrentSessionNumber(),this.getLandingPage()]);return this.sentryService.setGlobalContext("Visitor Session",{id:e[0],number:e[1],landing_page:e[2]}),e}async checkForNewSession(e){let r=!1;if(await this.isNewSessionRequired()?(await this.startNewSession(),e=!0,r=!0):await this.notSynced()&&(r=!0),e){let n=await this.getContext();await Jo.getInstance().validateSession({sessionID:n[0],sessionNumber:n[1],landingPage:n[2],newSession:r}),await re.set(at.SESSION_SYNCED,!0)}}async startNewSession(){x.debug("Starting new session"),await re.clear(),x.debug("Cleared SessionStorage before starting new session");let e=new Date,r=new Kt().toHexString();x.debug("New session ID to be used",r);let n=await Ut.get(at.SESSION_NUMBER,0)+1;Jr.prepend(`New Session ID: <strong>${r}</strong> & number: ${n}`),await Promise.all([Ut.set(at.SESSION_NUMBER,n),re.set(at.ID,r),re.set(at.SESSION_LAST_USED_TIME,e.getTime()),re.set(at.SESSION_LANDING_PAGE,ws.parseFromCurrent())])}getLandingPage(){return re.get(at.SESSION_LANDING_PAGE,{})}getCurrentSessionNumber(){return Ut.get(at.SESSION_NUMBER,1)}async isNewSessionRequired(){if(!await re.get(at.ID))return!0;let e=await re.get(at.SESSION_LAST_USED_TIME,0);return e?(new Date().getTime()-e)/1e3>q.IDLE_TIME_IN_SECONDS:!0}async notSynced(){return!await re.get(at.SESSION_SYNCED,!1)}},Ai=dt(lr()),G_=dt(gu()),q_=dt(Qn()),z_=dt(an()),Y_=dt(ta()),K_=dt(an()),nc=class{constructor(t){this.triggerContext=t}safeHTTP=Wt.getInstance();eventAPIService=rc.getInstance();async execute(t){let e=kt.get().getCurrentItem(),r=t.clickAction;if(!r)return;let n=t.item,i=this.triggerContext,s=new ec,o=i.triggerData.redirectBehaviour,a=!!i.triggerData.discount.type&&!!r?.applyDiscount,l={selectedVariants:i.triggerData.nonMutableItems.map(E=>({itemMID:E.mID,mID:E.selectedOrFirstVariant.value.mID})),eID:i.triggerData.engagementID,cID:i.triggerData.contentID},h="",g=[],p=[];if(n?p=[n.toEmbed()]:t.embeddedItem&&(p=[t.embeddedItem]),r.at===108){let E=i.selectedItems;if(p=t.embeddedItems??E.map(k=>k.toEmbed()),i.shouldGiveFBTDiscount||t.embeddedItems?.length){let k;t.embeddedItems?k=t.embeddedItems.map(M=>({itemMID:M.mID,mID:M.vID,quantity:M.quantity})):k=E.map(M=>({itemMID:M.mID,mID:M.selectedOrFirstVariant.value.mID}));let A=i.triggerData.bundleFrom;i.triggerData.isBundleOnCartDrawer()&&A&&(k.push({itemMID:A.mID,mID:A.selectedOrFirstVariant.value.mID,isPrimary:!0}),p.unshift(A.toEmbed())),l.selectedVariants=k,i.triggerData.isBundleOnPDP()&&l.selectedVariants.forEach(M=>{M.mID===e.vID&&(M.isPrimary=!0)})}else l=void 0;g=t.embeddedItems??E}else if(r.at===107){let E=await Ot.getCurrent().getNormalisedCart();p=E.items,l.selectedVariants=E.items.map(k=>({itemMID:k.mID,mID:k.vID}))}else if(r.at===102)g=n?[n]:[t.embeddedItem];else if(r.at===101)h=n?Fi()+"products/"+n.slug:t.embeddedItem?.link;else if(r.at===4){let E=uh(r.gu?.u);E&&(h=E.href)}else if(r.at===109){let E=await s.upgradeToSubscription(n,i.triggerData);this.triggerContext.triggerData.skipSubscribedItems&&this.triggerContext.renderer.destroy(),Ee.get().refreshUI(E)}else if(r.at===104){let E=this.triggerContext.triggerData.collections?.[0];E&&(h="collections/"+E.handle)}if(this.sendTriggerClicked(p,{from:"button"},t.video),x.debug({redirectPath:h,redirectBehaviour:o,hasDiscount:a}),!a&&h){location.href=h;return}let _,w=!1;try{_=await this.getOrGenerateDiscountCode(l),x.debug("Discount code (if any) to apply",_)}catch(E){if(!this.triggerContext.triggerData.isBYOB()){K_.default.error("Unable to get a discount code",E);return}}if(_&&r.at===103)await s.copyDiscountCode(_);else if(r.at===110){let E=await s.createNewCart(e,_,i.triggerData);E&&(location.href=E);return}try{_&&await $n.applyWithStorefront([_])}catch(E){x.error(E),w=!0}let b;if(g?.length&&(b=await s.addToCart(g,i.triggerData)),w&&_){$n.navigate(_,o,h);return}if(h){location.href=h;return}$n.navigateWithoutDiscount(o,b)}sendTriggerClicked(t,e,r){let n=new jt(q.EVENT_TRIGGER_CLICKED,e,this.triggerContext.triggerData);n.items=t,r?.id&&(n.videos=[r.id]),this.eventAPIService.sendSilently(n)}async getOrGenerateDiscountCode(t){let e=this.triggerContext.triggerData.discount;if(!e?.type)return;let r="";if(e.type===Y_.DiscountType.STATIC){if(!e.code)throw Jt.getInstance().captureMessage("No discount code found","warning",{triggerContext:this.triggerContext}),new Error("No discount code found");return e.code}if(t){if(r=await this.generateDiscount(t),!r)throw x.error("No discount code found",t),new Error("Discount code not found or generated");return r}}async generateDiscount(t){try{return(await this.safeHTTP.generateDiscount(t))?.code}catch(e){throw tr("Failed to generate a discount code"),x.error("Error generating discount code",e,t),Jt.getInstance().captureMessage("Failed to generate discount code","error",{discountData:JSON.stringify(t),triggerContext:this.triggerContext,error:e}),e}}},ae=class extends br{stylesConverter=new op(1);renderer=Wn.get();mediaStyle={};deviceTypeKey;clickExecutor;componentWillMount(){this.deviceTypeKey=this.renderer.isMobile()?"sm":"lg",this.clickExecutor=new nc(this.props.triggerContext)}getCompiledStyles(){return this.putStyleAccordingToDevice(),D(D(wt(D(D(D(D(D(D({},this.stylesConverter.getFlexStyles(this.mediaStyle.flex)),this.stylesConverter.getBackgroundStyles(this.mediaStyle.bg)),this.stylesConverter.getBorderStyles(this.mediaStyle.br)),this.stylesConverter.getSizeStyles(this.mediaStyle.size)),this.stylesConverter.getSpaceStyles(this.mediaStyle.spc)),this.stylesConverter.getLayoutStyles(this.mediaStyle.lout)),{boxSizing:"border-box",outline:"none"}),this.getComponentStyles()),this.props.style)}matchWhenCondition(t){if(!t?.op)return!0;let{lhs:e,rhs:r}=t;switch(t.op){case"eq":return e===r;case"gt":return+e>+r;case"gte":return+e>=+r;case"lt":return+e<+r;case"lte":return+e<=+r;case"ne":return e!==r;case"null":return e==null;case"empty":return e.trim()==="";case"in":return new RegExp(`\\b${r}\\b`).test(e);case"nin":return!new RegExp(`\\b${r}\\b`).test(e);default:return x.error(`Invalid operator found for when condition - ${t.op}`),!1}}putStyleAccordingToDevice(){let t=this.props.element;this.mediaStyle=t.style.lg,this.renderer.isMobile()&&t.style.sm&&Object.keys(t.style.sm).length&&(this.mediaStyle=D(D({},this.mediaStyle),t.style.sm))}sendTriggerClicked(t,e){this.clickExecutor.sendTriggerClicked(t,e)}async onClick(t,e){t.stopPropagation(),!e.clickAction&&(e.clickAction=this.props.element.clc),await this.clickExecutor.execute(e)}},J_=0,LE=Array.isArray;function Y(t,e,r,n,i,s){e||(e={});var o,a,l=e;if("ref"in l)for(a in l={},e)a=="ref"?o=e[a]:l[a]=e[a];var h={type:t,props:l,key:r,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--J_,__i:-1,__u:0,__source:i,__self:s};if(typeof t=="function"&&(o=t.defaultProps))for(a in o)l[a]===void 0&&(l[a]=o[a]);return gt.vnode&>.vnode(h),h}var ci=class extends ae{componentDidMount(){this.setState(()=>({text:this.props.element.text})),ze(this.onChange.bind(this))}componentWillReceiveProps(t){this.props.element=t.element,this.onChange()}render(){let t=this.getCompiledStyles(),e=this.state.text;return e||(t.display="none",e=""),Y("div",{style:t,onClick:this.customOnClick.bind(this),className:"lc-text",children:Y("span",{style:this.getSpanStyle(),dangerouslySetInnerHTML:{__html:e}})})}customOnClick(){this.props.onClick&&this.props.onClick("title")}onChange(){if(this.props.element.text==null)return;let t=this.props.triggerContext.triggerData,e={bundle:t.discountData.value,customer:t.customerData,cart:t.getCartMagicVariables()},r=je.render(JSON.stringify(this.props.element),e),n=new Oe(JSON.parse(r));if(!this.matchWhenCondition(n.when)){this.setState(()=>({text:""}));return}this.setState(()=>({text:n.text}))}getTypoStyles(){let t={},e=this.mediaStyle.typo??new Ve;return t.letterSpacing=e.letterSpacing,t.fontSize=e.fs+"px",t.lineHeight=e.lh,t.fontFamily=e.fam.name||"inherit",t.textAlign=e.alignment,t.fontWeight=e.fw,t.textDecoration=e.td??"none",this.stylesConverter.getColourStyles(e.tc,"color",t),t}getComponentStyles(){return D({},this.getTypoStyles())}getSpanStyle(){return{overflow:"hidden",display:"-webkit-box",webkitBoxOrient:"vertical",webkitLineClamp:2,color:"inherit",fontSize:"inherit",fontWeight:"inherit",fontFamily:"inherit"}}},vp=class extends ci{render(){return Y("div",{style:this.getCompiledStyles(),className:"lc-button",onClick:t=>this.onClick(t,{item:this.props.item}),children:Y("span",{style:this.getSpanStyle(),dangerouslySetInnerHTML:{__html:this.state.text}})})}getComponentStyles(){return wt(D({},super.getComponentStyles()),{cursor:"pointer"})}},Q_=class extends br{render(){if(this.props.element.show[this.props.label.toLowerCase()])return this.props.element.lblPos==="end"?Y("div",{style:D(D({},this.getElementStyle()),this.props.styles),children:[Y("span",{children:this.props.time}),Y("span",{style:this.getTimeLabelStyle(),children:this.props.label})]}):Y("div",{style:D(D({},this.getElementStyle()),this.props.styles),children:[Y("span",{style:this.getTimeLabelStyle(),children:this.props.label}),Y("span",{children:this.props.time})]})}getDesign(){}getTimeLabelStyle(){return{fontSize:"0.5em",alignContent:"center"}}getElementStyle(){let t={display:"flex",flexDirection:"column",placeContent:"center center",textAlign:"center"};return this.props.element.horizontal&&(t.gridTemplateColumns="repeat(2, minmax(0, 1fr))"),t}},X_=class extends ci{labels={Days:"00",Hours:"00",Minutes:"00",Seconds:"00"};componentWillMount(){super.componentWillMount(),this.setState(()=>D({},this.labels)),this.processAndStartTimer()}render(){return Y("div",{style:this.getLabelsParentStyle(),children:Object.keys(this.labels).map(t=>Y(Q_,{styles:this.getCompiledStyles(),label:t,time:this.state[t],element:this.props.element}))})}getLabelsParentStyle(){return{display:"grid",justifyContent:"center",gridTemplateColumns:"repeat(4, auto)",gap:this.stylesConverter.getSizePx(this.props.element.gap)}}getDisplayStyles(){return{display:"grid",placeContent:"center center"}}getComponentStyles(){return D(D({},super.getComponentStyles()),this.getDisplayStyles())}processAndStartTimer(){this.props.element.timer.start(this.props.element.timerType,t=>{this.labels.Days=String(t.days).padStart(2,"0"),this.labels.Hours=String(t.hours).padStart(2,"0"),this.labels.Minutes=String(t.minutes).padStart(2,"0"),this.labels.Seconds=String(t.seconds).padStart(2,"0"),this.setState(()=>D({},this.labels))})}},Z_=dt(ta()),tE=class extends ae{componentDidMount(){ze(()=>{this.setState(()=>({checked:this.props.item.selected.value}))})}render(){return Y("div",{style:this.getCompiledStyles(),className:"lc-checkbox",children:Y("input",{type:"checkbox",checked:this.state.checked,onChange:this.onChange.bind(this),style:{appearance:"auto"}})})}onChange(t){let{checked:e}=t.target;this.props.item.selected.value=e}getTypoStyles(){let t={},e=this.mediaStyle.typo??new Ve;return t.textAlign=e.alignment,t.justifyContent=e.alignment,t}getComponentStyles(){return wt(D({},this.getTypoStyles()),{display:"flex"})}},eE=dt(lr()),ic=class extends ae{constructor(t,e){super(t,e)}render(){let t=this.props.element[this.deviceTypeKey],e=t?.src||this.props.element.src||this.props.element.lg?.src;return Y("img",{onClick:this.customOnClick.bind(this),className:"lc-image",alt:t?.name||"Image",onMouseEnter:this.handleMouseEnter.bind(this),onMouseLeave:this.handleMouseLeave.bind(this),src:e,style:this.getCompiledStyles()})}customOnClick(t){this.props.element.clc?.at===eE.ClickActionType.ADD_TO_CART&&this.props.triggerContext.triggerData.items[0]&&this.onClick(t,{item:this.props.triggerContext.triggerData.items[0]}),this.props.onClick&&this.props.onClick("image")}getComponentStyles(){let t=this.mediaStyle.lout;if(!t||t.pos!=="absolute")return{};let e={zIndex:t.zIndex,cursor:this.props.element.clc?.at?"pointer":"auto"};return this.mediaStyle.size?.w&&(e.width=this.mediaStyle.size.w),this.mediaStyle.size?.h&&(e.height=this.mediaStyle.size.h),e}handleMouseEnter(t){let e=this.props.element[this.deviceTypeKey]?.secondarySrc;e&&(t.currentTarget.src=e)}handleMouseLeave(t){t.currentTarget.src=this.props.element[this.deviceTypeKey]?.src}},sc=class extends ae{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return Y("div",{style:this.getCompiledStyles(),class:"lc-flexbox",children:Y(oc,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})})}getComponentStyles(){let t=this.mediaStyle.flex??new Ih,e={display:"flex",gap:t.gap+"px",flexWrap:t.wrap,flexDirection:t.dir,justifyContent:t.jc,alignItems:t.ai};return t.wrap==="nowrap"&&t.scroll&&(t.dir==="column"?e["overflow-y"]="auto":e["overflow-x"]="auto"),e}},rE=class extends sc{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return Y("div",{style:this.getCompiledStyles(),class:"lc-flexbox",children:Y(wp,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext,item:this.props.item,noLinks:this.props.noLinks})})}},nE=class extends ae{render(){return Y("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(){ze(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:!1}))})}getTypoStyles(){let t={},e=this.mediaStyle.typo??new Ve;return t.letterSpacing=e.letterSpacing,t.fontSize=e.fs+"px",t.lineHeight=e.lh,t.fontFamily="inherit",t.textAlign=e.alignment,t.fontWeight=e.fw,this.stylesConverter.getColourStyles(e.tc,"color",t),t.boxShadow="none",t}getComponentStyles(){let t={};return this.props.selectedVariant.sellingPlans?.length||(t.visibility="hidden"),D(D({},t),this.getTypoStyles())}createSelectItems(){let t=[],e=this.props.selectedVariant;if(!e.sellingPlans?.length)return[];this.props.triggerContext.triggerData.skipSubscribedItems?e.selectedSellingPlan.value||(e.sellingPlans[0].isSelected=!0,e.changeSellingPlan(e.sellingPlans[0])):t.push(Y("option",{value:"",selected:!e.selectedSellingPlan,children:"One time purchase"}));for(let r of e.sellingPlans??[])t.push(Y("option",{value:r.mID,selected:r.isSelected,children:r.name}));return t}onChange(t){let e=t.target.value;e?this.props.selectedVariant.selectedSellingPlan.value=this.props.selectedVariant.sellingPlans.find(r=>r.mID===e):this.props.selectedVariant.selectedSellingPlan.value=void 0}},iE=dt(du()),sE=class extends ae{colorRegex=new RegExp('fill="#[a-zA-Z0-9]+"');constructor(){super(),je.escape=iE.MustacheUtils.escapeHtml}render(){let t=this.getCompiledStyles(),e=this.getRating();return e||(t.display="none",e=""),Y("div",{style:t,className:"lc-star-rating",dangerouslySetInnerHTML:{__html:e}})}getRating(){let t=this.props.element.fullStar,e=this.props.element.halfStart,r={size:this.props.element.iconSize,color:this.props.element.c.hex};t=je.render(t,{svg:r}),e=je.render(e,{svg:r});let n=this.props.review;if(!n?.rating)return"";let i="";if(this.props.element.showSingleStar)i=t;else{let s=5,o=`${n.rating}`.split(".");for(let a=0;a<+o[0];a++)i+=t,s--;o[1]&&(i+=e,s--);for(let a=0;a<s;a++)i+=t.replace(this.colorRegex,'fill="#f1f1f1')}return i}getComponentStyles(){return{display:"flex",alignItems:"center"}}},oE=class extends ae{render(){return Y("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(){ze(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:!1}))})}getTypoStyles(){let t={},e=this.mediaStyle.typo??new Ve;return t.letterSpacing=e.letterSpacing,t.fontSize=e.fs+"px",t.lineHeight=e.lh,t.fontFamily="inherit",t.textAlign=e.alignment,t.fontWeight=e.fw,this.stylesConverter.getColourStyles(e.tc,"color",t),t.boxShadow="none",t}getComponentStyles(){let t={};return this.props.item.vars?.length===1&&this.props.item.vars[0].name==="Default Title"&&(t.visibility="hidden"),D(D({},t),this.getTypoStyles())}createSelectItems(){let t=[];for(let e of this.props.item.vars)t.push(Y("option",{value:e.mID,disabled:!e.isAvailable,children:e.name}));return t}onChange(t){let e=t.target.value;this.props.item.selectedOrFirstVariant.value=this.props.item.vars.find(r=>r.mID===e)}},wp=class extends ae{constructor(t,e){super(t,e),this.setState(()=>({decoration:"unset"}))}renderElement(t){if(!(t.hide||!this.matchWhenCondition(t.when))){if(t.t===4){let e=t;return Y(rE,{element:e,triggerContext:this.props.triggerContext,elements:e.elems,item:this.props.item,noLinks:this.props.noLinks})}if(t.t===6)return this.props.triggerContext.triggerData.isBundle()?Y(tE,{element:t,item:this.props.item,triggerContext:this.props.triggerContext}):void 0;if(t.t===13){let e=t,r=this.props.item,n=r.variantImage??r.imageURL,i=r.variantSecondaryImage??r.secondaryImageURL;e.lg=e.sm={src:n,name:r.name,secondarySrc:i};let s=Y(ic,{element:e,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?s:Y("a",{href:this.props.item.selectedOrFirstVariant.value.link,style:{display:"block"},children:s})}if(t.t===14)return this.renderProductTitle(t);if(t.t===15){let e=t;return this.props.triggerContext.triggerData.isCartEmbed()&&this.props.item.vars?.length===1&&this.props.item.vars[0].name==="Default Title"?void 0:Y(oE,{element:e,item:this.props.item,triggerContext:this.props.triggerContext})}return t.t===16?Y(nE,{element:t,selectedVariant:this.props.item.selectedOrFirstVariant.value,item:this.props.item,triggerContext:this.props.triggerContext}):t.t===19?Y(sE,{element:t,triggerContext:this.props.triggerContext,review:this.props.item.reviews}):t.t===18||t.t===3?Y(vp,{element:t,item:this.props.item,triggerContext:this.props.triggerContext}):Y(oc,{elements:[t],element:this.props.element,triggerContext:this.props.triggerContext})}}render(){return this.props.elements.map(t=>this.renderElement(t))}getComponentStyles(){return{}}renderProductTitle(t){let e=Y(ci,{element:t,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?e:Y("a",{href:this.props.item.selectedOrFirstVariant.value.link,style:{display:"block",textDecoration:this.state.decoration},onMouseEnter:this.onMouseEnter.bind(this),onMouseLeave:this.onMouseLeave.bind(this),children:e})}customOnClick(t){this.sendTriggerClicked([this.props.item.toEmbed()],{from:t})}onMouseEnter(){this.setState(()=>({decoration:"underline"}))}onMouseLeave(){this.setState(()=>({decoration:"unset"}))}},bp=class extends ae{productElement;constructor(t,e){super(t,e),this.setState(()=>({decoration:"unset"}))}render(){let t=JSON.stringify(this.props.element),e=je.render(t,this.getProductData());if(this.productElement=new La(JSON.parse(e)),!(this.productElement.hide||!this.matchWhenCondition(this.productElement.when)))return Y("div",{style:D({},this.getCompiledStyles()),class:"lc-single-product",children:Y(wp,{element:this.productElement,elements:this.productElement.elems,triggerContext:this.props.triggerContext,item:this.props.item,noLinks:this.productElement.noLinks})})}getComponentStyles(){return{flexShrink:0}}getProductData(){if(!this.props.item)return{};let t=this.props.item,e=t.selectedOrFirstVariant.value,r=t.getTemplateVariables();r.product.quantity=this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(this.props.item.quantity):this.props.item.quantity;let n=this.props.triggerContext.triggerData.discount.type===Z_.DiscountType.BXGY;return!e.hasEffectivePrice()&&n&&(r.product.effective_price=Ne(e.effectivePrice.value),r.product.price=""),r.variant.quantity=this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(e.quantity):e.quantity,{product:r.product,variant:r.variant,svg:{color:()=>"{{svg.color}}",size:()=>"{{svg.size}}"}}}};function _p(t,e){if(!t)return;let r=new window.CooeeSDK.Swiper(t,{loop:!0,slidesPerView:e.maxInRow,spaceBetween:e.gap+"px",pagination:{type:e.pagination.type,el:t.querySelector(".swiper-pagination"),clickable:!0,renderBullet:(n,i)=>`
|
|
64
64
|
<span class="${i}"
|
|
65
65
|
style="background-color: ${e.pagination.color?.rgba};"></span>
|
|
66
66
|
`,renderProgressbar:n=>`
|
|
67
67
|
<span class="${n}"
|
|
68
68
|
style="background-color: ${e.pagination.color?.rgba};">
|
|
69
69
|
</span>
|
|
70
|
-
`},navigation:{nextEl:t.querySelector(".swiper-button-next"),prevEl:t.querySelector(".swiper-button-prev")},autoplay:e.autoplay?.enabled?{delay:e.autoplay?.delay,disableOnInteraction:!1}:!1,autoHeight:!0});return t.style.setProperty("--swiper-navigation-size",`${e.navigation.size}px`),r}function Ep(t,e,r){let n={color:t.navigation.color?.rgba};return t.pagination.enabled&&(n.transform="translateY(-25%)"),Y("div",{class:"swiper-container",ref:e,children:[Y("div",{class:"swiper-wrapper",children:r()}),t.navigation.enabled&&Y("div",{class:"swiper-button-next",style:n,children:Y("span",{})}),t.navigation.enabled&&Y("div",{class:"swiper-button-prev",style:n,children:Y("span",{})}),t.pagination.enabled&&Y("div",{className:"swiper-pagination",style:{bottom:0,top:"unset",position:"relative",color:t.pagination.color?.rgba}})]})}var sE=class extends ae{swiperRef=null;swiperInstance=null;configuration;gap;constructor(t,e){super(t,e),this.configuration=this.renderer.isMobile()?this.props.element.conf.sm:this.props.element.conf.lg,this.gap=(this.configuration.gap??15)+"px"}componentDidMount(){this.props.element.conf[this.deviceTypeKey].disp===2&&ve.loadSwiperScript().then(()=>{this.swiperInstance=_p(this.swiperRef,this.props.element.conf[this.deviceTypeKey])})}componentWillUnmount(){this.swiperInstance&&this.swiperInstance.destroy()}render(){let t=this.props.triggerContext.triggerData.items;t.splice(this.configuration.maxItems??10);let e;if(this.configuration.disp===2){let r=i=>{this.swiperRef=i},n=()=>t?.map(i=>Y("div",{class:"swiper-slide",children:this.getProductFragment(i)}));e=Y("div",{style:wt(D({},this.getCompiledStyles()),{display:"block"}),class:"lc-product-swiper-list",children:Ep(this.configuration,r,n)})}else e=Y("div",{style:this.getCompiledStyles(),class:"lc-product-list",children:t?.map((r,n)=>this.getProductFragment(r,n!==t.length-1))});return e}getComponentStyles(){let t=[0,2].includes(this.configuration.disp),e={display:t?"flex":"grid",justifyContent:"safe "+(this.mediaStyle.flex?.jc??"center"),gap:this.gap,flexDirection:this.mediaStyle.flex?.dir??"row"};if(e.flexDirection==="row"){if(t)e.maxWidth="100%",e.overflowY="auto";else if(this.configuration.disp===1){let r=this.props.triggerContext.triggerData,n=r.items.length,i;r.isBundle()?i=this.props.element.prod.symbol?.hide!==!0?n*2-1:n:i=this.props.element.conf[this.deviceTypeKey].maxInRow,e.gridTemplateColumns=`repeat(${i}, auto)`}}return e}getProductFragment(t,e=!1){return Y(cn,{children:[Y(bp,{element:this.props.element.prod,item:t,triggerContext:this.props.triggerContext}),this.props.triggerContext.triggerData.isBundle()&&e&&this.props.element.prod.symbol&&!this.props.element.prod.symbol.hide&&Y("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:Y(ci,{element:this.props.element.prod.symbol,triggerContext:this.props.triggerContext})})]},t.mID)}},oE=class extends ae{swiperRef=null;swiperInstance=null;constructor(t,e){super(t,e)}componentDidMount(){ve.loadSwiperScript().then(()=>{this.swiperInstance=_p(this.swiperRef,this.props.element.conf)})}componentWillUnmount(){this.swiperInstance&&this.swiperInstance.destroy()}render(){let t=this.props.element,e=n=>{this.swiperRef=n},r=()=>t.values?.map(n=>Y("div",{class:"swiper-slide",onClick:i=>this.onClick(i,{clickAction:this.getClickAction(n)}),children:this.renderElement(n)}));return Ep(t.conf,e,r)}getComponentStyles(){return{}}renderElement(t){let e=this.valueAddedSlide(this.props.element.slide,t);switch(e?.t){case 1:return Y(nc,{element:e,triggerContext:this.props.triggerContext});case 4:return Y(ic,{elements:e.elems,element:e,triggerContext:this.props.triggerContext});default:x.warn("Unknown slide type for carousal")}}valueAddedSlide(t,e){let r=JSON.stringify(t),n=je.render(r,{form:e});return rn.getParsedElement(JSON.parse(n))}getClickAction(t){let e=D({},this.props.element.clc),r=JSON.stringify(e),n=je.render(r,{form:t});return JSON.parse(n)}},sc=class extends ae{constructor(t,e){super(t,e),this.setState(()=>({decoration:"unset"})),ze(()=>{this.setState(()=>({showButton:!this.props.triggerContext.triggerData.isBundle()||!!this.props.triggerContext.selectedItems.length}))})}renderElement(t){if(!t.hide){if(t.t===4){let e=t;return Y(ic,{element:e,triggerContext:this.props.triggerContext,elements:e.elems})}if(t.t===61)return Y(J_,{element:t,triggerContext:this.props.triggerContext});if(t.t===3)return this.state.showButton?Y(vp,{element:t,triggerContext:this.props.triggerContext}):void 0;if(t.t===2)return Y(ci,{element:t,triggerContext:this.props.triggerContext});if(t.t===1)return Y(nc,{element:t,triggerContext:this.props.triggerContext});if(t.t===11)return Y(sE,{element:t,triggerContext:this.props.triggerContext});if(t.t===12)return Y(bp,{element:t,item:this.props.triggerContext.triggerData.items[0],triggerContext:this.props.triggerContext});if(t.t===62)return Y(oE,{element:t,triggerContext:this.props.triggerContext})}}render(){return this.props.elements.map(t=>this.renderElement(t))}getComponentStyles(){return{}}},aE=class extends ae{clickAction;isClickable;constructor(t,e){super(t,e),this.clickAction=this.props.element.clc,this.isClickable=this.clickAction?.at===4&&this.clickAction.gu?.u}componentDidMount(){ze(()=>{let t=this.props.triggerContext.triggerData,e=this.props.triggerContext.selectedItems;t.calculateDiscountData(e,this.props.triggerContext.shouldGiveFBTDiscount)})}render(){return Y(cn,{children:[Y("div",{style:this.getCompiledStyles(),class:"lc-container",onClick:t=>{this.onClick(t,{clickAction:this.clickAction})},children:Y(sc,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})}),this.props.triggerContext.triggerData.id==="preview"&&Y("div",{class:"letscooee-preview-badge",children:["#",this.props.triggerContext.triggerData.shortID," preview"]})]})}getComponentStyles(){let t={position:"relative",overflow:"hidden",display:"block"};return this.isClickable&&(t.cursor="pointer"),t}async onClick(t,e){if(this.isClickable)return super.onClick(t,e)}},or=class Hr{constructor(e){this.engagementTrigger=e,this.triggerContext=new np(new Date,this.engagementTrigger)}static renderedEngagements=[];static engagementIDsWithTrackedDisplay=new Set;static DEBOUNCE_TIME=1e3;rootContainer;widgetElement;widget;triggerContext;observers=[];runtimeData=Pt.get();widgetAPIService=lt.get(Jn);eventAPIService=lt.get(ec);sentryService=lt.get(Kt);scrollSubscription;variation;isExclusionWithBVariation;renderSilently(){this.render().catch(e=>this.sentryService.captureException(e,D({},this.engagementTrigger.sentryContext())))}destroy(){x.log(`${this.engagementTrigger} will be destroyed`),this.scrollSubscription?.unsubscribe(),this.observers.forEach(e=>{e?.disconnect&&e.disconnect()}),this.rootContainer?.remove(),Hr.engagementIDsWithTrackedDisplay.delete(this.engagementTrigger.shortID)}async render(){if(this.engagementTrigger.hasMultiplePlacement){let e=await this.getVariation();this.handleVariationResponse(e)}if(this.rootContainer=await this.getWidgetContainer(!0),!this.rootContainer){x.warn(`${this.engagementTrigger} no section found to render the widget`);return}this.afterRootContainerCreated(),this.widget=this.engagementTrigger.widget,await this.getVariationIfRequired(),!this.shouldStopRendering()&&(await this.startRendering(),this.attachScroll(),await this.checkAndSendEvent(),this.triggerContext.renderer=this)}isSameTrigger(e){return this.engagementTrigger.shortID===e.shortID}update(e){G_.default.log(`${this.engagementTrigger} will be updated`),this.updateItems(e.items,this.engagementTrigger.items)}afterRootContainerCreated(){}shouldStopRendering(){return!this.widget&&!this.isExclusionWithBVariation}async getVariationIfRequired(){if(this.engagementTrigger.isSingleContent()||this.engagementTrigger.widget){x.log(`${this.engagementTrigger} already has required data to render widget`);return}let e=await this.observeWidgetContainerInViewport();this.handleVariationResponse(e)}handleVariationResponse(e){e&&(x.log(`${this.engagementTrigger} visitor has been assigned to variation ${e.variation}`),e.items?.length&&(this.engagementTrigger.items=e.items.map(r=>new Fe(r)),this.engagementTrigger.nonMutableItems=e.items.map(r=>new Fe(r))),e.bundleFrom&&(this.engagementTrigger.bundleFrom=new Fe(e.bundleFrom)),e.discount&&(this.engagementTrigger.discount=e.discount),e.placement&&(this.triggerContext.triggerData.placement=e.placement),e.props&&W_.JSUtils.hasKeys(e.props)&&(this.engagementTrigger.props=D(D({},this.engagementTrigger.props),e.props)),this.triggerContext.triggerData.widget=this.widget=new Ah(e.widget),this.triggerContext.triggerData.contentID=e.contentID,this.triggerContext.triggerData.variation=this.variation=e.variation,this.triggerContext.triggerData.placement=e.placement,this.triggerContext.triggerData.manipulation=e.manipulation,this.triggerContext.triggerData.content=e.content,this.isExclusionWithBVariation=this.engagementTrigger.isExclusionTesting()&&this.variation==="b",this.isExclusionWithBVariation&&(this.rootContainer.style.height="0.5px"))}addToRendered(){Hr.renderedEngagements.push(this)}async getVariation(){x.log(`${this.engagementTrigger} get variation`);let e={engagementID:this.engagementTrigger.engagementID,isPreview:this.engagementTrigger.id==="preview"};try{return await this.widgetAPIService.getVariation(e)}catch(r){x.error(`${this.engagementTrigger} unable to get the variation`,r);return}}async observeWidgetContainerInViewport(){if(!this.rootContainer){x.warn(`${this.engagementTrigger} No root container found to watch for viewport`);return}let e=window.innerHeight*.3,r={root:null,rootMargin:`-${e}px 0px ${e}px 0px`,threshold:0};return this.isInViewport()?this.getVariation():new Promise(n=>{let i=new IntersectionObserver((s,o)=>{s.forEach(async a=>{if(a.isIntersecting){x.log(`${this.engagementTrigger} root container is near the viewport. Fetching variation`);let l=await this.getVariation();n(l),o.unobserve(this.rootContainer)}})},r);i.observe(this.rootContainer),this.observers.push(i)})}attachScroll(){this.scrollSubscription=es(window,"scroll").pipe(oi(Hr.DEBOUNCE_TIME)).subscribe(()=>{this.checkAndSendEvent()})}async checkAndSendEvent(){let e=this.engagementTrigger.shortID;if(Hr.engagementIDsWithTrackedDisplay.has(e)||!this.isInViewport())return;let r={};this.triggerContext.triggerData.items?.length&&(r.promotedMIDs=this.engagementTrigger.items?.map(s=>s.mID));let n=this.isExclusionWithBVariation?q.EVENT_CAMPAIGN_HOLDOUT:q.EVENT_TRIGGER_DISPLAYED,i=new jt(n,r,this.engagementTrigger);i.name===q.EVENT_CAMPAIGN_HOLDOUT&&(i.trigger.holdout=!0),this.eventAPIService.sendSilently(i),Hr.engagementIDsWithTrackedDisplay.add(e),this.scrollSubscription.unsubscribe()}generateParentElementID(){return`letscooee-${this.engagementTrigger.shortID}`}createAngularWidget(e){let r=this.widgetElement=document.createElement(e);return r.className="cooee-root",r.cart=Ot.getCurrent(),r.triggerContext=this.triggerContext,r.engagementTrigger=this.engagementTrigger,r.setAttribute("engagement",this.engagementTrigger.shortID),r.addEventListener("cooeeEvent",n=>{let i=n.detail;this.eventAPIService.sendSilently(i)}),r.addEventListener("cooeeCTA",n=>{new rc(this.triggerContext).execute(n.detail)}),this.rootContainer.appendChild(r),this.addToRendered(),r}isInViewport(){let e=this.rootContainer?.getBoundingClientRect();if(!e)return!1;let r=window.innerHeight||document.documentElement.clientHeight,n=(Math.min(e.bottom,r)-Math.max(e.top,0))*e.width,i=e.width*e.height,s=n/i*100;return this.engagementTrigger.isAnySplit()?s>0:s>=30}async getWidgetContainer(e){if(this.rootContainer?.isConnected)return this.rootContainer;let r=await this.createParentElementWithPlacement(e);if(r)return r;let n=`.letscooee[data-engagement-id="${this.triggerContext.triggerData.shortID}"]`;return document.querySelector(n)}async createParentElementWithPlacement(e){let r=this.engagementTrigger.placement;if(!r?.selector)return x.warn(`${this.engagementTrigger} does not have a selector`),null;let n=r.selector,i;if(n.includes(q.SHADOW_SPLITTER)){let l=n.split(q.SHADOW_SPLITTER),h=se.get().website.commonCSS;i=(await qi(l[0].trim()))?.shadowRoot,n=l[1].trim(),i&&(ve.injectRawCSS(h,i),ve.injectStylesheet(ke.styleURL,i))}x.debug(`${this.engagementTrigger} attempt to render ${r.position}-${n}`);let s=await qi(n,10,i??document);if(!s)return x.warn(`${this.engagementTrigger} no placement found with ${n}`),null;let o=this.generateParentElementID(),a=this.getParentElement(o);if(!e)return a;switch(r.position){case Ai.EngagementPlacementPosition.BEFORE:{s.parentElement?.insertBefore(a,s);break}case Ai.EngagementPlacementPosition.INSIDE_FIRST:{s.insertBefore(a,s.firstChild);break}case Ai.EngagementPlacementPosition.INSIDE_LAST:{s.appendChild(a);break}case Ai.EngagementPlacementPosition.AFTER:default:s.parentElement?.insertBefore(a,s.nextSibling)}return a}async startRendering(){let e;try{e=await dp.refreshItems(this.engagementTrigger)}catch(r){x.error(`${this.engagementTrigger} error refreshing the items`,r);return}if(!this.engagementTrigger.isCollectionPromoted()&&!e?.length&&this.engagementTrigger.isProductPromoted()){x.warn(`${this.engagementTrigger} is of ${this.engagementTrigger.objective} but no product found`);return}this.engagementTrigger.items=e,this.renderContainer()}getParentElement(e,r=document){let n=r.getElementById(e);if(n)return n;let i=this.engagementTrigger.objective.toLowerCase().replaceAll("_","-"),s=this.engagementTrigger.shortID;return n=document.createElement("div"),n.id=e,n.className=`letscooee letscooee-engagement engagement-${s} ${i}`,n.dataset.engagementId=s,this.engagementTrigger.id==="preview"&&(n.className+=" letscooee-preview"),n.style.display="block",n.style.minHeight="0.5px",n.style.minWidth="0.5px",n}renderContainer(){if(!this.widget)return;let e=this.rootContainer;if(this.triggerContext.triggerData.hasSwiperElement()){let r=this.rootContainer?.shadowRoot||this.rootContainer?.attachShadow({mode:"open"}),n=se.get().website.commonCSS;ve.injectRawCSS(n,r),ve.injectStylesheet(ke.styleURL,r),ve.injectSwiperCSS(r),e=r}$d(Su(aE,{element:this.widget.cont,triggerContext:this.triggerContext,elements:this.widget.elems}),e),this.addToRendered()}updateItems(e,r){let n=this.getItemDiff(e,r),i=this.getItemDiff(r,e);r.push(...n);for(let s of i)V_.ArrayUtils.remove(r,s)}getItemDiff(e,r){return e.filter(n=>!r.some(i=>i.selectedOrFirstVariant.value.mID===n.selectedOrFirstVariant.value.mID))}},Fn=class Sp extends or{static renderedEngagements=[];constructor(e){super(e)}addToRendered(){Sp.renderedEngagements.push(this)}observeWidgetContainerInViewport(){return this.getVariation()}generateParentElementID(){let e=super.generateParentElementID();return this.engagementTrigger.isSubscriptionUpsell()&&(e+=`-${this.engagementTrigger.items[0].selectedOrFirstVariant.value.mID}`),e}async checkAndSendEvent(){if(!Ee.get().isOpen()&&this.runtimeData.pageName!=="cart"){x.log("Do not send display event as neither the cart drawer nor the cart page is open.");return}return super.checkAndSendEvent()}},cE=class Ip{constructor(e,r){this.engagementTrigger=e,this.element=r,this.cartItems=Ot.getCurrent().items}cartItems;static renderCartUpsell(e){let r=e.placement;if(!r?.selector){x.warn(`No placement available for ${e.objective}`,e.shortID);return}let n=Array.from(document.querySelectorAll(r.selector));if(!n?.length){x.warn(`No placement found for ${e.objective}`,e.shortID);return}for(let i of n)new Ip(e,i).render()}render(){let e=this.findCartItemFromHTMLElement();if(!e||this.engagementTrigger.skipSubscribedItems&&e.selling_plan_allocation)return;let r=this.engagementTrigger.items.find(g=>g.mID===e.product_id.toString());if(!r)return;let n=r.vars.find(g=>g.mID===e.id.toString());if(!n)return;let i=new cs(n),s=e.selling_plan_allocation?.selling_plan;if(s)for(let g of i.sellingPlans??[])g.mID===s.id.toString()&&(g.isSelected=!0,i.changeSellingPlan(g));let o=new Fe(r);o.vars=[i],o.selectedOrFirstVariant.value=i;let a=`lc-cart-item-${this.engagementTrigger.shortID}-${r.mID}`;this.element.classList.add(a);let l=new Ar(this.engagementTrigger);l.placement.selector=`.${a}`,l.items=[o];let h=new Fn(l);h.renderSilently(),this.watchForCartItemDeletion(h,a)}watchForCartItemDeletion(e,r){let n=new MutationObserver(i=>{i.forEach(s=>{s.removedNodes.forEach(o=>{o===this.element&&(x.debug(`${r} has been removed`),e.destroy(),n.disconnect())})})});n.observe(this.element.parentElement,{childList:!0,subtree:!0})}findCartItemFromHTMLElement(){let e=this.element.innerHTML;return this.cartItems.find(r=>{if(!(e.includes(r.url)||e.includes(r.variant_id))&&(!e.includes(r.product_title)||r.variant_title&&!e.includes(r.variant_title)))return!1;let n=r.selling_plan_allocation?.selling_plan?.name;return!(n&&!e.includes(n))})}},lE=dt(lr()),uE=class extends Fn{ctaExecutor=new tc;constructor(t){super(t)}update(t){super.update(t),this.engagementTrigger.progressBarConfig.update(t.progressBarConfig),this.checkMilestone().catch(e=>{Kt.getInstance().captureError("Failed to apply milestones",e)}),this.widgetElement.update()}shouldStopRendering(){return!1}renderContainer(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget("cooee-progressbar")}async checkMilestone(){let t=await Ot.getCurrent().getNormalisedCart(),e=this.engagementTrigger.progressBarConfig,r=[],n=[...e.milestones];for(let s of n)if(s.rewardType===lE.MilestoneRewardType.FREE_AUTO_GIFT){let o=s.items[0],a=t.amount>=s.minValue,l=t.items.find(h=>h.vID===o.vID||h.mID===o.mID&&h.properties[q.CAMPAIGN_ATTRIBUTE]===this.engagementTrigger.shortID);if(!a&&l&&e.removeIneligibleItem)x.debug(`Removing free gift ${l.vID} from cart`),await this.removeFreeGifts(l);else if(a&&!l){x.debug(`Adding free gift ${o.vID} to cart`);let h=await this.addFreeGift(o);h&&r.push(h)}}let i=e.coupons;if(i?.length)try{await $n.applyWithStorefront(i.map(s=>s.couponCode)),Ee.get().refreshUI(r[0],!1)}catch(s){this.sentryService.captureError("Failed to apply coupons on cart",s,D({},this.engagementTrigger.sentryContext()))}}async removeFreeGifts(t){await this.ctaExecutor.updateLineItem(t,{quantity:0})}async addFreeGift(t){return this.ctaExecutor.addToCart([t],this.engagementTrigger)}},hE=class extends or{constructor(t){super(t)}shouldStopRendering(){return!1}renderContainer(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget("cooee-shoppable-videos")}},pE=class extends or{constructor(t){super(t)}shouldStopRendering(){return!1}renderContainer(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget("cooee-sticky-atc")}},dE=dt(Qn()),fE=class extends or{constructor(t){super(t)}shouldStopRendering(){return!1}renderContainer(){let t=this.getParentElement(`inner-letscooee-${this.engagementTrigger.shortID}`);this.rootContainer.appendChild(t),document.addEventListener(q.ADD_BUNDLE_CTA_INBOUND_EVENT,this.inboundCTAListener.bind(this),!1)}async inboundCTAListener(t){let e=this.engagementTrigger,r=`Engagement(id: ${e.engagementID}, shortID: ${e.shortID})`,n=t.detail;if(!dE.JSUtils.hasKeys(n)){x.error(`No detail received for ${r}`);return}x.log("Detail received for BYOB",n);let i=n.campaignID??n.campaignId??n.campaign_id;if(i!==e.shortID&&i!==e.engagementID){x.warn(`Current ${r} is not BYOB. Received: ${i}`);return}let s=n.items;if(!s?.length)return;let o=s.map(a=>new pn({mID:a.product_id,vID:a.variant_id,quantity:a.quantity||1}));await new rc(this.triggerContext).execute({embeddedItems:o,clickAction:{at:108,applyDiscount:!0}})}},so=class{runtimeData=Pt.get();processCartWidgetResponse(t){this.runtimeData.isCartDirty=!1,this.runtimeData.cartEngagements=t;let e=[...Fn.renderedEngagements];Fn.renderedEngagements.length=0;for(let r of t)x.log(`\u{1F4E3} ${r} received as cart embed`),!this.findAndUpdateCurrent(r,e)&&(x.log(`${r} is new`),r.isProgressBar()?new uE(r).renderSilently():r.isSubscriptionUpsell()?cE.renderCartUpsell(r):new Fn(r).renderSilently());this.removeOldWidgets(e)}processPageWidgetResponse(t){let e=[...or.renderedEngagements];or.renderedEngagements.length=0;for(let r of t)x.log(`\u{1F4E3} ${r} received as page embed`),!this.findAndUpdateCurrent(r,e)&&(x.log(`${r} is new`),r.isShoppableVideo()?new hE(r).renderSilently():r.isBYOB()?new fE(r).renderSilently():r.isStickyATC()?new pE(r).renderSilently():new or(r).renderSilently());this.removeOldWidgets(e)}findAndUpdateCurrent(t,e){let r=e.findIndex(n=>n.isSameTrigger(t));return r<0||t.isSubscriptionUpsell()?!1:(e[r].update(t),e[r].renderSilently(),e.splice(r,1),!0)}removeOldWidgets(t){for(let e of t)e.destroy()}},Cp=class{runtimeData=Pt.get();httpService=lt.get(Lr);sessionManager=lt.get(ge);constructor(){}async getWidgetProps(){let t={};t.engagementIDs=this.addAvailableEngagementShortIDs(),t.locale=this.runtimeData.locale,await this.addSessionContext(t),t.currentItem=this.runtimeData.getCurrentItem();try{t.cart=await Ot.getCurrent().getNormalisedCart()}catch(i){x.error("Error fetching Shopify cart before sending widget call",i)}let e=new URLSearchParams(location.search),r=e.get("cooee-preview");r?t.previewIDs=r.trim().split(",").filter(i=>Number.isInteger(+i)):this.runtimeData.previewIDs?.length&&(t.previewIDs=this.runtimeData.previewIDs);let n=e.get("cooee-variant");return n?t.previewVariant=n:this.runtimeData.previewVariant&&(t.previewVariant=this.runtimeData.previewVariant),t}async addSessionContext(t){let e=await this.sessionManager.checkSessionAndGetContext();t.sessionID=e[0],t.sessionNumber=e[1],t.landingPage=e[2],t.page=ws.parseFromCurrent()}addAvailableEngagementShortIDs(){let t=document.querySelectorAll(".letscooee-engagement"),e=[];return t.forEach(r=>{let n=r.dataset.engagementId;n&&+n&&e.push(n)}),e}},Jn=class Tp extends Cp{static INSTANCE;loadWidgetsSubject=new cr;constructor(){super(),this.loadWidgetsSubject.pipe(oi(300)).subscribe(()=>{this.loadCartWidgets().catch(e=>x.error("Unable to initiate cart widgets",e)),this.loadPageWidgets().catch(e=>x.error("Unable to initiate page widgets",e))}),Xa.get().subscriber(q.CART_UPDATE_BROADCAST).subscribe(()=>this.loadWidgetsSubject.next())}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Tp),this.INSTANCE}loadOrRenderWidgetsAfterCartChange(){this.runtimeData.isCartDirty?this.loadWidgetsSilently():this.renderCachedCartWidgets()}loadPageWidgetsSilently(){ge.replaySubject.subscribe(async()=>{this.loadPageWidgets().catch(e=>x.error("Unable to initiate load page widgets",e))})}loadCartWidgetsSilently(){ge.replaySubject.subscribe(async()=>{this.loadCartWidgets().catch(e=>x.error("Unable to initiate cart widgets",e))})}loadWidgetsSilently(){ge.replaySubject.subscribe(async()=>{this.loadWidgetsSubject.next()})}async loadPageWidgets(){let e=await this.getWidgetProps();x.log("Load widgets",e),this.httpService.post("/v1/engagement/page-widgets",e).then(async r=>{let n=r.widgets.map(i=>new Ar(i));new so().processPageWidgetResponse(n)}).catch(r=>{x.error("Error sending widget getter",r)})}async loadCartWidgets(){let e=await this.getWidgetProps();x.log("Load cart widgets",e),this.httpService.post("/v1/engagement/cart-widgets",e).then(async r=>{let n=r.widgets.map(i=>new Ar(i));new so().processCartWidgetResponse(n)}).catch(r=>{x.error("Error sending widget getter",r)})}async getVariation(e){let r=await this.getWidgetProps();return this.httpService.post("/v1/engagement/get-variant",D(D({},e),r))}renderCachedCartWidgets(){new so().processCartWidgetResponse(this.runtimeData.cartEngagements)}},gE=class{eventAPIService;modifications=[];constructor(){this.eventAPIService=lt.get(oc)}execute(t){for(let e of t)e.experimentConfig&&(this.executeExperiment(e),this.trackExperimentRan(e));if(document.querySelector("#lc-hide-body")?.remove(),!document.body){lt.get(Kt).captureMessage("No body element found","error");return}this.setupMutationObserver()}async executeExperiment(t){let e=t.experimentConfig?.modifications;if(!e?.length){x.log("Nothing to experiment",t.toString());return}for(let r of e){if(!r.cssSelector){x.debug("No CSS Selector available",t?.toString());continue}this.modifications.push(r);let n=Array.from(document.querySelectorAll(r.cssSelector));this.executeSingleModification(r,n)}}executeSingleModification(t,e){if(e?.length)for(let r of e)Object.assign(r.style,t.style),t.type==="TEXT"&&t.text&&(r.innerHTML=t.text)}trackExperimentRan(t){if(t.id==="preview"){x.warn("Skipping experiment attribution as its preview",t.toString());return}this.eventAPIService.trackExperiment({name:q.EVENT_EXPERIMENT_START,experiment:new $a(t)}).catch(e=>{x.error("Fail to track experiment",e)})}setupMutationObserver(){new MutationObserver(t=>{t.forEach(e=>{e.addedNodes.forEach(r=>{r instanceof HTMLElement&&this.modifications.forEach(n=>{r.matches&&r.matches(n.cssSelector)?(x.debug("Re-applying experiment",n.toString()),this.executeSingleModification(n,[r])):r.querySelectorAll&&(x.debug("Re-applying experiment",n.toString()),this.executeSingleModification(n,Array.from(r.querySelectorAll(n.cssSelector))))})})})}).observe(document.body,{childList:!0,subtree:!0})}},oc=class xp extends Cp{static INSTANCE;constructor(){super()}static getInstance(){return this.INSTANCE||(this.INSTANCE=new xp),this.INSTANCE}loadExperimentSilently(){Ut.get(at.SDK_TOKEN).then(e=>{e?this.loadExperiments().catch(r=>x.error("Unable to initiate experiment",r)):ge.replaySubject.subscribe(async()=>{this.loadExperiments().catch(r=>x.error("Unable to initiate experiment",r))})})}async loadExperiments(){if(!this.runtimeData.activeExperiment)return;let e=await this.getWidgetProps();x.log("Load experiments",e),this.httpService.post("/v1/engagement/experiments",e).then(async r=>{let n=r.experiments.map(i=>new Ar(i));new gE().execute(n)}).catch(r=>{x.error("Error sending experiment getter",r)})}async trackExperiment(e){await this.addSessionContext(e),await this.httpService.post("/v1/event/experiment",e)}},mE=class{runtimeData=Pt.get();widgetAPIService=lt.get(Jn);experimentAPIService=lt.get(oc);meddle(){let t=St.globalRef;t.account=t.account??[],t.profile=t.profile??[],t.events=t.events??[],t.screen=t.screen??[],t.page=t.page??[],this.meddlePage(),this.meddleAccount(),this.meddleEvents(),this.meddleProfile(),this.meddleScreen(),this.exposeMethods()}exposeMethods(){let t=St.globalRef;t.loadPageWidgets=()=>{this.widgetAPIService.loadPageWidgetsSilently()},t.loadCartWidgets=()=>{this.widgetAPIService.loadCartWidgetsSilently()},t.loadExperiments=()=>{this.experimentAPIService.loadExperimentSilently()},t.previewWidget=St.previewWidget.bind(St),t.previewPopup=St.previewPopup.bind(St)}overwritePush(t,e){Pn(t,"push",e)}meddleAccount(){this.overwritePush(St.globalRef.account,(...t)=>{this.processAccount(t[0])}),St.globalRef.account.forEach(this.processAccount.bind(this))}meddleEvents(){this.overwritePush(St.globalRef.events,(...t)=>{this.processEvent(t[0])}),St.globalRef.events.forEach(this.processEvent.bind(this))}meddleProfile(){this.overwritePush(St.globalRef.profile,(...t)=>{this.processProfile(t[0])}),St.globalRef.profile.forEach(this.processProfile.bind(this))}meddleScreen(){this.overwritePush(St.globalRef.screen,(...t)=>{this.processPageName(t[0])}),St.globalRef.screen.forEach(this.processPageName.bind(this))}processAccount(t){t&&(t.appID&&St.authenticate(t),t.flags&&zo.setFlags(t.flags))}processEvent(t){t&&(q.JS_LOAD_WHITELIST_EVENTS.includes(t[0])?St.sendEvent(t[0],t[1],D({occurred:this.runtimeData.jsLoadTime},t[2])):St.sendEvent(t[0],t[1],t[2]))}processProfile(t){t&&St.updateProfile(t)}processPageName(t){t&&St.setPageName(t)}meddlePage(){this.overwritePush(St.globalRef.page,(...t)=>{this.processPage(t[0])}),St.globalRef.page.forEach(this.processPage.bind(this))}processPage(t){t.currentItem&&this.runtimeData.setCurrentItem(t.currentItem),t.currency&&(this.runtimeData.currencyCode=t.currency),t.shopCurrency&&(this.runtimeData.shopCurrencyCode=t.shopCurrency),t.moneyFormat&&(this.runtimeData.moneyFormat=t.moneyFormat),t.jsLoad&&(this.runtimeData.jsLoadTime=t.jsLoad),t.locale&&(this.runtimeData.locale=t.locale),t.pageName&&St.setPageName(t.pageName),t.activeExperiment&&(this.runtimeData.activeExperiment=t.activeExperiment)}},oo=class{static SESSION_STORAGE=window.sessionStorage;static SESSION_STORAGE_KEY_PREFIX=q.COOEE.concat("-");static getString(t,e){return this.getItem(t)||e}static setString(t,e){this.setItem(t,e)}static remove(t){this.removeItem(t)}static getItem(t){return this.SESSION_STORAGE.getItem(this.SESSION_STORAGE_KEY_PREFIX.concat(t))}static setItem(t,e){this.SESSION_STORAGE.setItem(this.SESSION_STORAGE_KEY_PREFIX.concat(t),e)}static removeItem(t){this.SESSION_STORAGE.removeItem(this.SESSION_STORAGE_KEY_PREFIX.concat(t))}},ao=class Mi{static INSTANCE;static DEBOUNCE_TIME=1e3;static THRESHOLD=10;safeHttpService=lt.get($t);lastPercent=0;_lastScreenOrScroll=new Date;constructor(){}set lastScreenOrScroll(e){this._lastScreenOrScroll=e}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Mi),this.INSTANCE}resetScrollID(e){oo.remove(q.SESSION_STORAGE_SCROLL_ID),this.lastScreenOrScroll=e??new Date}listen(){if(window.scrollY){let e=this.getPercentScrolledY();this.shouldSendScroll(e)&&this.sendScroll(e)}Ca(()=>{this.observeWindowScroll()})}observeWindowScroll(){es(window,"scroll").pipe(oi(Mi.DEBOUNCE_TIME),Ja(()=>{let e=this.getPercentScrolledY();if(e>100){x.warn("Received scroll percent is more than 100",e);return}if(this.shouldSendScroll(e))return e})).subscribe(e=>{this.sendScroll(e)})}shouldSendScroll(e){return Math.abs(this.lastPercent-e)>=Mi.THRESHOLD||this.lastPercent!==e&&e===100}sendScroll(e){if(e==null)return;let r={percent:e,timeMS:new Date().getTime()-this._lastScreenOrScroll.getTime()};this.lastPercent=e;let n=oo.getString(q.SESSION_STORAGE_SCROLL_ID,""),i=new jt(q.EVENT_SCROLL,r,null,n);this.safeHttpService.sendEvent(i),oo.setString(q.SESSION_STORAGE_SCROLL_ID,i.id.toHexString()),this._lastScreenOrScroll=new Date(i.occurred)}getPercentScrolledY(){let e=window.document.body.scrollHeight,r=window.innerHeight;return Math.ceil((window.scrollY+r)/e*100)}},yE=class Dp{static ACTIVE_DURATION="aDur";static INACTIVE_DURATION="iaDur";apiService=lt.get($t);runtimeData=Pt.get();listen(){document.onvisibilitychange=()=>{document.visibilityState==="visible"?this.onVisible():document.visibilityState==="hidden"&&this.onHidden()}}async onVisible(){}async onHidden(){let e=await this.runtimeData.setInactive();if(e===0){x.info("Not sending background event as user was inactive on website");return}x.info(`Sending background event with ${e} seconds`);let r={};r[Dp.ACTIVE_DURATION]=e,this.apiService.sendEvent(new jt(q.EVENT_APP_BACKGROUND,r))}},vE=class{compareCartItemSubject=new cr;constructor(){this.compareCartItemSubject.pipe(oi(100)).subscribe(this.compareCartItems.bind(this))}listen(){this.compareCartItemSubject.next(),this.overwriteXMLHttpRequest(),this.overwriteFetchMethod()}overwriteXMLHttpRequest(){let t=this,e=window.XMLHttpRequest.prototype.send;window.XMLHttpRequest.prototype.send=function(){return this.addEventListener("load",function(){t.performEvent(this._url).catch(r=>x.error("Unable to process cart change in XMLHttpRequest",r))}),e.apply(this,arguments)},x.debug("Securely overwritten window.XMLHttpRequest.send method")}overwriteFetchMethod(){let t=this,e=window.fetch;window.fetch=function(r){return e.apply(window,arguments).then(n=>(t.performEvent(r.toString()).catch(i=>x.error("Unable to process cart change in fetch",i)),n))},x.debug("Securely overwritten window.fetch method")}async performEvent(t){this.isCartManipulationURL(t)&&(Pt.get().isCartDirty=!0,this.compareCartItemSubject.next())}isCartManipulationURL(t){return/\/cart\/(add|change|update|clear)/.test(t)}sendChangesAsEvents(t,e){let r=t?.items,n=e.items,i=[],s=[];if(x.debug(`Comparing cart change with old count ${r?.length} to new count ${n.length}`),n?.forEach(o=>{let a=r?.find(l=>l.vID===o.vID);if(a){if(a.quantity!==o.quantity){let l=a.quantity<o.quantity,h=Math.abs(a.quantity-o.quantity),g=wt(D({},o),{quantity:h});l?i.push(g):s.push(g)}r&&bv(r,a)}else i.push(o)}),r)for(let o of r)s.push(o);x.debug(`Cart delta: added: ${i.length}, removed: ${s.length}`),i.length&&this.sendEvent(q.EVENT_ADD_TO_CART,{items:i}),s.length&&t.token===e.token&&this.sendEvent(q.EVENT_REMOVE_FROM_CART,{items:s}),(s.length||i.length)&&Xa.get().broadcast(q.CART_UPDATE_BROADCAST,{itemsAdded:i,itemsRemoved:s})}sendEvent(t,e){let r=new jt(t,e);lt.get($t).sendEvent(r)}async compareCartItems(){let t=await Ut.get(at.CURRENT_CART,{}),e=await Ot.getCurrent().getNormalisedCart(!0);this.sendChangesAsEvents(t,e)}},wE=class{listen(){return this.overwriteFetchMethod(),this}overwriteFetchMethod(){let t=this,e=window.fetch;window.fetch=async function(r,n){try{await t.modifyRequest(r,n)}catch(i){Kt.getInstance().captureError("Failed to modify graphql request",i,{body:JSON.stringify(n?.body)})}return e(r,n)},x.debug("Securely overwritten window.fetch method for graphql query")}async modifyRequest(t,e){let r=typeof t=="string"?t:t instanceof Request?t.url:"";if(!(r.includes("graphql.json")&&e?.method==="POST")||!e.body)return;let n;if(typeof e.body=="string")try{n=JSON.parse(e.body)}catch{return}else n=e.body;x.debug("Intercepted fetch request of:",r),n?.query.includes("cartCreate")&&(e.body=await this.updatedBody(n),this.sendBuyNowEvent())}async updatedBody(t){let e=t.variables.input.attributes??[],r=await dh();return t.variables.input.attributes=[...e,...r],JSON.stringify(t)}sendBuyNowEvent(){let t=Pt.get().getCurrentItem();if(!t)return;let e=new jt(q.EVENT_BUY_NOW_CLICKED,{items:[t]});$t.getInstance().sendEvent(e)}},Np=class{constructor(t,e){this.selectors=t,this.eventName=e,this.selectorString=t.join(",")}static INSTANCE;elements;selectorString;clickListenerCallback=t=>{let e=t.currentTarget,r=new jt(this.eventName,{class:e.className||void 0,tagName:e.tagName||void 0,id:e.id||void 0});$t.getInstance().sendEvent(r),this.removeClickListener(this.clickListenerCallback)};listenSilently(){this.listen().catch(t=>x.error(t))}async listen(){this.elements=await ph(this.selectorString),this.elements.forEach(t=>{t.addEventListener("click",this.clickListenerCallback)})}removeClickListener(t){this.elements?.forEach(e=>{e.removeEventListener("click",t)})}},bE=class Jo extends Np{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(Jo.selectors,q.EVENT_ITEM_THUMBNAIL_CLICKED)}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Jo),this.INSTANCE}},_E=class Qo extends Np{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(Qo.selectors,q.EVENT_REVIEW_CLICKED)}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Qo),this.INSTANCE}},EE=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(){Ca(()=>{x.debug("Execution order:","document ready"),this.useLocationHash()})}useLocationHash(){let t=window.location.hash?.substring(1);if(t)if(t.includes(q.HASH_INITIATE_CHECKOUT)){document.dispatchEvent(new Event(q.THIRD_PARTY_CHECKOUT_EVENT));let e=document.querySelector(this.selector);if(!e){x.debug("No clickable cart checkout button found");return}x.debug("Clickable cart checkout button found",e),e.click()}else t.includes(q.HASH_OPEN_CART_DRAWER)&&Ee.get().open()}},SE=class{trackSilently(){this.track().catch(t=>Kt.getInstance().captureException(t))}async track(){let t=window.Shopify?.checkout,e=window.Shopify?.Checkout;if(!t&&!e)return;let r={};this.processSmallCheckout(t,r),this.processBigCheckout(e,r);let n=this.getTokenFromCurrentURLPath();if(n&&(r.urlToken=n),!Object.keys(r).length){x.warn("No processable data found in",t,e);return}r.referrer=document.referrer,r.url=location.href;let i=await lt.get(ge).checkSessionAndGetContext();r.sessionID=i[0],this.trackOrder(r)}processSmallCheckout(t,e){t&&(t.order_id&&(e.orderID=t.order_id.toString()),t.token&&(e.checkoutToken=t.token.toString()),t.customer_id&&(e.customerID=t.customer_id.toString()))}processBigCheckout(t,e){t&&(t.token&&!e.checkoutToken&&(e.checkoutToken=t.token.toString()),t.cartToken&&(e.cartToken=t.cartToken.toString()))}trackOrder(t){x.info("Found order to be send",t),$t.getInstance().trackOrder(t)}getTokenFromCurrentURLPath(){let t=new RegExp("[A-Fa-f0-9]{28,32}");return location.pathname?.split("/").find(e=>e.length&&t.test(e))}},uu=class{static attachCheckoutListener(){window.gokwikSdk&&window.gokwikSdk.on("checkout_initiated",async()=>{let t=await Ot.getCurrent().getNormalisedCart(),e={via:"GoKwik",items:t.items,cartToken:t.token,amount:{value:t.amount,currency:t.currency}},r=new jt(q.EVENT_CHECKOUT_STARTED,e);$t.getInstance().sendEvent(r)})}},IE=class{async migrate(){}};je.escape=Pd.MustacheUtils.escapeHtml;var St=class{static globalRef;static authenticated;static async initForMerchantWebsiteOnly(){window.cooeeSDKPreview||(this.initGlobalReference(),await new IE().migrate(),this.autoAuthenticate(),new mE().meddle(),lt.get(oc).loadExperimentSilently(),new yE().listen(),new SE().trackSilently(),new vE().listen(),new wE().listen(),new EE().listen(),lt.get(ao).listen(),lt.get(_E).listenSilently(),lt.get(bE).listenSilently(),lt.get(Jn).loadPageWidgetsSilently(),this.attachGoKwikListeners(),this.storePreviewParams(),this.setupPreviewListeners(),Jr.watch())}static async initForAll(){this.injectWidgetAssets()}static initGlobalReference(){window.CooeeSDK||Pn(window,"CooeeSDK",{}),this.globalRef=window.CooeeSDK,Pn(this.globalRef,"config",new se),Pn(this.globalRef,"runtimeData",new Pt),Pn(this.globalRef,"uaParser",new We),x.debug("Global reference initialised")}static injectWidgetAssets(){ve.injectScriptURL(ke.widgetURL,"cooee-widget-sdk"),ve.injectStylesheet(ke.styleURL)}static autoAuthenticate(){let t=ff();t&&this.authenticate({shopifyShop:t})}static authenticate(t){if(this.authenticated)return;let e=t.appID?.trim(),r=t.shopifyShop;if((bl(e)||e.length!==24)&&bl(r)){x.warn("Cooee App ID or Shop name is not configured");return}this.authenticated=!0,lt.get(ge).init(t)}static sendEvent(t,e,r){let n=new jt(t,e,r?.triggerData);r?.occurred&&(n.occurred=r.occurred),lt.get($t).sendEvent(n)}static updateProfile(t){for(let e in t)if(e.toLowerCase().startsWith("ce "))throw new Error("User property name cannot start with 'CE '");lt.get($t).updateProfile(t)}static setPageName(t){if(!t)return;let e=Pt.get(),r=e.pageName;if(t===r)return;if(e.pageName=t,t==="cart"&<.get(Jn).loadOrRenderWidgetsAfterCartChange(),q.BLACKLISTED_PAGE_NAMES.some(s=>t.includes(s))){lt.get(ao).resetScrollID();return}let n={};r&&(n.ps=r);let i=new jt(q.EVENT_SCREEN_VIEW,n);i.occurred=e.jsLoadTime,lt.get($t).sendEvent(i),lt.get(ao).resetScrollID(i.occurred)}static previewPopup(t,e){new pp(e).render(t)}static previewWidget(t){new or(new Ar(t)).render()}static setupPreviewListeners(){if(window.opener){try{window.opener.postMessage({action:"COOEE_READY_FOR_PREVIEW"},"*")}catch(t){x.error(t)}window.addEventListener("message",t=>{if(x.debug("Received event",t),!t.origin.includes("letscooee.com")&&!t.origin.includes("localhost"))return;let e=t.data;typeof e=="object"&&(e.action==="POPUP_PREVIEW"?(this.previewPopup(e.engagementTrigger),t.source?.postMessage({action:"PREVIEW_SUCCESSFUL"},t.origin)):e.action==="WIDGET_PREVIEW"&&(this.previewWidget(e.engagementTrigger),t.source?.postMessage({action:"PREVIEW_SUCCESSFUL"},t.origin)))})}}static attachGoKwikListeners(){let t=Pt.get();window.addEventListener("kp-modal:opened",()=>{t.isGoKwikPopupOpen=!0}),window.addEventListener("user-loggedin",e=>{let{token:r}=e.detail;r&&this.updateProfile({goKwikToken:r})}),window.gokwikSdk?uu.attachCheckoutListener():window.addEventListener("gokwikLoaded",uu.attachCheckoutListener)}static storePreviewParams(){let t=Pt.get(),e=new URLSearchParams(location.search),r=e.get("cooee-preview");r&&(t.previewIDs=r.trim().split(",").filter(i=>Number.isInteger(+i)));let n=e.get("cooee-variant");n&&(t.previewVariant=n)}};Od();kd();x.debug("Execution order:","top");window.cooeeShopifyScriptLoaded||(window.cooeeShopifyScriptLoaded=!0,(async()=>(x.debug("Execution order:","IIFE start"),await St.initForMerchantWebsiteOnly(),await St.initForAll(),x.debug("Execution order:","IIFE end")))());x.debug("Execution order:","bottom");})();
|
|
70
|
+
`},navigation:{nextEl:t.querySelector(".swiper-button-next"),prevEl:t.querySelector(".swiper-button-prev")},autoplay:e.autoplay?.enabled?{delay:e.autoplay?.delay,disableOnInteraction:!1}:!1,autoHeight:!0});return t.style.setProperty("--swiper-navigation-size",`${e.navigation.size}px`),r}function Ep(t,e,r){let n={color:t.navigation.color?.rgba};return t.pagination.enabled&&(n.transform="translateY(-25%)"),Y("div",{class:"swiper-container",ref:e,children:[Y("div",{class:"swiper-wrapper",children:r()}),t.navigation.enabled&&Y("div",{class:"swiper-button-next",style:n,children:Y("span",{})}),t.navigation.enabled&&Y("div",{class:"swiper-button-prev",style:n,children:Y("span",{})}),t.pagination.enabled&&Y("div",{className:"swiper-pagination",style:{bottom:0,top:"unset",position:"relative",color:t.pagination.color?.rgba}})]})}var aE=class extends ae{swiperRef=null;swiperInstance=null;configuration;gap;constructor(t,e){super(t,e),this.configuration=this.renderer.isMobile()?this.props.element.conf.sm:this.props.element.conf.lg,this.gap=(this.configuration.gap??15)+"px"}componentDidMount(){this.props.element.conf[this.deviceTypeKey].disp===2&&ye.loadSwiperScript().then(()=>{this.swiperInstance=_p(this.swiperRef,this.props.element.conf[this.deviceTypeKey])})}componentWillUnmount(){this.swiperInstance&&this.swiperInstance.destroy()}render(){let t=this.props.triggerContext.triggerData.items;t.splice(this.configuration.maxItems??10);let e;if(this.configuration.disp===2){let r=i=>{this.swiperRef=i},n=()=>t?.map(i=>Y("div",{class:"swiper-slide",children:this.getProductFragment(i)}));e=Y("div",{style:wt(D({},this.getCompiledStyles()),{display:"block"}),class:"lc-product-swiper-list",children:Ep(this.configuration,r,n)})}else e=Y("div",{style:this.getCompiledStyles(),class:"lc-product-list",children:t?.map((r,n)=>this.getProductFragment(r,n!==t.length-1))});return e}getComponentStyles(){let t=[0,2].includes(this.configuration.disp),e={display:t?"flex":"grid",justifyContent:"safe "+(this.mediaStyle.flex?.jc??"center"),gap:this.gap,flexDirection:this.mediaStyle.flex?.dir??"row"};if(e.flexDirection==="row"){if(t)e.maxWidth="100%",e.overflowY="auto";else if(this.configuration.disp===1){let r=this.props.triggerContext.triggerData,n=r.items.length,i;r.isBundle()?i=this.props.element.prod.symbol?.hide!==!0?n*2-1:n:i=this.props.element.conf[this.deviceTypeKey].maxInRow,e.gridTemplateColumns=`repeat(${i}, auto)`}}return e}getProductFragment(t,e=!1){return Y(cn,{children:[Y(bp,{element:this.props.element.prod,item:t,triggerContext:this.props.triggerContext}),this.props.triggerContext.triggerData.isBundle()&&e&&this.props.element.prod.symbol&&!this.props.element.prod.symbol.hide&&Y("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:Y(ci,{element:this.props.element.prod.symbol,triggerContext:this.props.triggerContext})})]},t.mID)}},cE=class extends ae{swiperRef=null;swiperInstance=null;constructor(t,e){super(t,e)}componentDidMount(){ye.loadSwiperScript().then(()=>{this.swiperInstance=_p(this.swiperRef,this.props.element.conf)})}componentWillUnmount(){this.swiperInstance&&this.swiperInstance.destroy()}render(){let t=this.props.element,e=n=>{this.swiperRef=n},r=()=>t.values?.map(n=>Y("div",{class:"swiper-slide",onClick:i=>this.onClick(i,{clickAction:this.getClickAction(n)}),children:this.renderElement(n)}));return Ep(t.conf,e,r)}getComponentStyles(){return{}}renderElement(t){let e=this.valueAddedSlide(this.props.element.slide,t);switch(e?.t){case 1:return Y(ic,{element:e,triggerContext:this.props.triggerContext});case 4:return Y(sc,{elements:e.elems,element:e,triggerContext:this.props.triggerContext});default:x.warn("Unknown slide type for carousal")}}valueAddedSlide(t,e){let r=JSON.stringify(t),n=je.render(r,{form:e});return rn.getParsedElement(JSON.parse(n))}getClickAction(t){let e=D({},this.props.element.clc),r=JSON.stringify(e),n=je.render(r,{form:t});return JSON.parse(n)}},oc=class extends ae{constructor(t,e){super(t,e),this.setState(()=>({decoration:"unset"})),ze(()=>{this.setState(()=>({showButton:!this.props.triggerContext.triggerData.isBundle()||!!this.props.triggerContext.selectedItems.length}))})}renderElement(t){if(!t.hide){if(t.t===4){let e=t;return Y(sc,{element:e,triggerContext:this.props.triggerContext,elements:e.elems})}if(t.t===61)return Y(X_,{element:t,triggerContext:this.props.triggerContext});if(t.t===3)return this.state.showButton?Y(vp,{element:t,triggerContext:this.props.triggerContext}):void 0;if(t.t===2)return Y(ci,{element:t,triggerContext:this.props.triggerContext});if(t.t===1)return Y(ic,{element:t,triggerContext:this.props.triggerContext});if(t.t===11)return Y(aE,{element:t,triggerContext:this.props.triggerContext});if(t.t===12)return Y(bp,{element:t,item:this.props.triggerContext.triggerData.items[0],triggerContext:this.props.triggerContext});if(t.t===62)return Y(cE,{element:t,triggerContext:this.props.triggerContext})}}render(){return this.props.elements.map(t=>this.renderElement(t))}getComponentStyles(){return{}}},lE=class extends ae{clickAction;isClickable;constructor(t,e){super(t,e),this.clickAction=this.props.element.clc,this.isClickable=this.clickAction?.at===4&&this.clickAction.gu?.u}componentDidMount(){ze(()=>{let t=this.props.triggerContext.triggerData,e=this.props.triggerContext.selectedItems;t.calculateDiscountData(e,this.props.triggerContext.shouldGiveFBTDiscount)})}render(){return Y(cn,{children:[Y("div",{style:this.getCompiledStyles(),class:"lc-container",onClick:t=>{this.onClick(t,{clickAction:this.clickAction})},children:Y(oc,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})}),this.props.triggerContext.triggerData.id==="preview"&&Y("div",{class:"letscooee-preview-badge",children:["#",this.props.triggerContext.triggerData.shortID," preview"]})]})}getComponentStyles(){let t={position:"relative",overflow:"hidden",display:"block"};return this.isClickable&&(t.cursor="pointer"),t}async onClick(t,e){if(this.isClickable)return super.onClick(t,e)}},or=class Hr{constructor(e){this.engagementTrigger=e,this.triggerContext=new np(new Date,this.engagementTrigger)}static renderedEngagements=[];static engagementIDsWithTrackedDisplay=new Set;static DEBOUNCE_TIME=1e3;rootContainer;widgetElement;widget;triggerContext;observers=[];runtimeData=kt.get();widgetAPIService=lt.get(Jn);eventAPIService=lt.get(rc);sentryService=lt.get(Jt);scrollSubscription;variation;isExclusionWithBVariation;renderSilently(){this.render().catch(e=>this.sentryService.captureException(e,D({},this.engagementTrigger.sentryContext())))}destroy(){x.log(`${this.engagementTrigger} will be destroyed`),this.scrollSubscription?.unsubscribe(),this.observers.forEach(e=>{e?.disconnect&&e.disconnect()}),this.rootContainer?.remove(),Hr.engagementIDsWithTrackedDisplay.delete(this.engagementTrigger.shortID)}async render(){if(this.engagementTrigger.hasMultiplePlacement){let e=await this.getVariation();this.handleVariationResponse(e)}if(this.rootContainer=await this.getWidgetContainer(!0),!this.rootContainer){x.warn(`${this.engagementTrigger} no section found to render the widget`);return}this.afterRootContainerCreated(),this.widget=this.engagementTrigger.widget,await this.getVariationIfRequired(),!this.shouldStopRendering()&&(await this.startRendering(),this.attachScroll(),await this.checkAndSendEvent(),this.triggerContext.renderer=this)}isSameTrigger(e){return this.engagementTrigger.shortID===e.shortID}update(e){z_.default.log(`${this.engagementTrigger} will be updated`),this.updateItems(e.items,this.engagementTrigger.items)}afterRootContainerCreated(){}shouldStopRendering(){return!this.widget&&!this.isExclusionWithBVariation}async getVariationIfRequired(){if(this.engagementTrigger.isSingleContent()||this.engagementTrigger.widget){x.log(`${this.engagementTrigger} already has required data to render widget`);return}let e=await this.observeWidgetContainerInViewport();this.handleVariationResponse(e)}handleVariationResponse(e){e&&(x.log(`${this.engagementTrigger} visitor has been assigned to variation ${e.variation}`),e.items?.length&&(this.engagementTrigger.items=e.items.map(r=>new Fe(r)),this.engagementTrigger.nonMutableItems=e.items.map(r=>new Fe(r))),e.bundleFrom&&(this.engagementTrigger.bundleFrom=new Fe(e.bundleFrom)),e.discount&&(this.engagementTrigger.discount=e.discount),e.placement&&(this.triggerContext.triggerData.placement=e.placement),e.props&&q_.JSUtils.hasKeys(e.props)&&(this.engagementTrigger.props=D(D({},this.engagementTrigger.props),e.props)),this.triggerContext.triggerData.widget=this.widget=new Ah(e.widget),this.triggerContext.triggerData.contentID=e.contentID,this.triggerContext.triggerData.variation=this.variation=e.variation,this.triggerContext.triggerData.placement=e.placement,this.triggerContext.triggerData.manipulation=e.manipulation,this.triggerContext.triggerData.content=e.content,this.isExclusionWithBVariation=this.engagementTrigger.isExclusionTesting()&&this.variation==="b",this.isExclusionWithBVariation&&(this.rootContainer.style.height="0.5px"))}addToRendered(){Hr.renderedEngagements.push(this)}async getVariation(){x.log(`${this.engagementTrigger} get variation`);let e={engagementID:this.engagementTrigger.engagementID,isPreview:this.engagementTrigger.id==="preview"};try{return await this.widgetAPIService.getVariation(e)}catch(r){x.error(`${this.engagementTrigger} unable to get the variation`,r);return}}async observeWidgetContainerInViewport(){if(!this.rootContainer){x.warn(`${this.engagementTrigger} No root container found to watch for viewport`);return}let e=window.innerHeight*.3,r={root:null,rootMargin:`-${e}px 0px ${e}px 0px`,threshold:0};return this.isInViewport()?this.getVariation():new Promise(n=>{let i=new IntersectionObserver((s,o)=>{s.forEach(async a=>{if(a.isIntersecting){x.log(`${this.engagementTrigger} root container is near the viewport. Fetching variation`);let l=await this.getVariation();n(l),o.unobserve(this.rootContainer)}})},r);i.observe(this.rootContainer),this.observers.push(i)})}attachScroll(){this.scrollSubscription=es(window,"scroll").pipe(oi(Hr.DEBOUNCE_TIME)).subscribe(()=>{this.checkAndSendEvent()})}async checkAndSendEvent(){let e=this.engagementTrigger.shortID;if(Hr.engagementIDsWithTrackedDisplay.has(e)||!this.isInViewport())return;let r={};this.triggerContext.triggerData.items?.length&&(r.promotedMIDs=this.engagementTrigger.items?.map(s=>s.mID));let n=this.isExclusionWithBVariation?q.EVENT_CAMPAIGN_HOLDOUT:q.EVENT_TRIGGER_DISPLAYED,i=new jt(n,r,this.engagementTrigger);i.name===q.EVENT_CAMPAIGN_HOLDOUT&&(i.trigger.holdout=!0),this.eventAPIService.sendSilently(i),Hr.engagementIDsWithTrackedDisplay.add(e),this.scrollSubscription.unsubscribe()}generateParentElementID(){return`letscooee-${this.engagementTrigger.shortID}`}createAngularWidget(e){let r=this.widgetElement=document.createElement(e);return r.className="cooee-root",r.cart=Ot.getCurrent(),r.triggerContext=this.triggerContext,r.engagementTrigger=this.engagementTrigger,r.setAttribute("engagement",this.engagementTrigger.shortID),r.addEventListener("cooeeEvent",n=>{let i=n.detail;this.eventAPIService.sendSilently(i)}),r.addEventListener("cooeeCTA",n=>{new nc(this.triggerContext).execute(n.detail)}),this.rootContainer.appendChild(r),this.addToRendered(),r}isInViewport(){let e=this.rootContainer?.getBoundingClientRect();if(!e)return!1;let r=window.innerHeight||document.documentElement.clientHeight,n=(Math.min(e.bottom,r)-Math.max(e.top,0))*e.width,i=e.width*e.height,s=n/i*100;return this.engagementTrigger.isAnySplit()?s>0:s>=30}async getWidgetContainer(e){if(this.rootContainer?.isConnected)return this.rootContainer;let r=await this.createParentElementWithPlacement(e);if(r)return r;let n=`.letscooee[data-engagement-id="${this.triggerContext.triggerData.shortID}"]`;return document.querySelector(n)}async createParentElementWithPlacement(e){let r=this.engagementTrigger.placement;if(!r?.selector)return x.warn(`${this.engagementTrigger} does not have a selector`),null;let n=r.selector,i;if(n.includes(q.SHADOW_SPLITTER)){let l=n.split(q.SHADOW_SPLITTER),h=se.get().website.commonCSS;i=(await qi(l[0].trim()))?.shadowRoot,n=l[1].trim(),i&&(ye.injectRawCSS(h,i),ye.injectStylesheet(Pe.styleURL,i))}x.debug(`${this.engagementTrigger} attempt to render ${r.position}-${n}`);let s=await qi(n,10,i??document);if(!s)return x.warn(`${this.engagementTrigger} no placement found with ${n}`),null;let o=this.generateParentElementID(),a=this.getParentElement(o);if(!e)return a;switch(r.position){case Ai.EngagementPlacementPosition.BEFORE:{s.parentElement?.insertBefore(a,s);break}case Ai.EngagementPlacementPosition.INSIDE_FIRST:{s.insertBefore(a,s.firstChild);break}case Ai.EngagementPlacementPosition.INSIDE_LAST:{s.appendChild(a);break}case Ai.EngagementPlacementPosition.AFTER:default:s.parentElement?.insertBefore(a,s.nextSibling)}return a}async startRendering(){let e;try{e=await dp.refreshItems(this.engagementTrigger)}catch(r){x.error(`${this.engagementTrigger} error refreshing the items`,r);return}if(!this.engagementTrigger.isCollectionPromoted()&&!e?.length&&this.engagementTrigger.isProductPromoted()){x.warn(`${this.engagementTrigger} is of ${this.engagementTrigger.objective} but no product found`);return}this.engagementTrigger.items=e,this.renderContainer()}getParentElement(e,r=document){let n=r.getElementById(e);if(n)return n;let i=this.engagementTrigger.objective.toLowerCase().replaceAll("_","-"),s=this.engagementTrigger.shortID;return n=document.createElement("div"),n.id=e,n.className=`letscooee letscooee-engagement engagement-${s} ${i}`,n.dataset.engagementId=s,this.engagementTrigger.id==="preview"&&(n.className+=" letscooee-preview"),n.style.display="block",n.style.minHeight="0.5px",n.style.minWidth="0.5px",n}renderContainer(){if(!this.widget)return;let e=this.rootContainer;if(this.triggerContext.triggerData.hasSwiperElement()){let r=this.rootContainer?.shadowRoot||this.rootContainer?.attachShadow({mode:"open"}),n=se.get().website.commonCSS;ye.injectRawCSS(n,r),ye.injectStylesheet(Pe.styleURL,r),ye.injectSwiperCSS(r),e=r}$d(Iu(lE,{element:this.widget.cont,triggerContext:this.triggerContext,elements:this.widget.elems}),e),this.addToRendered()}updateItems(e,r){let n=this.getItemDiff(e,r),i=this.getItemDiff(r,e);r.push(...n);for(let s of i)G_.ArrayUtils.remove(r,s)}getItemDiff(e,r){return e.filter(n=>!r.some(i=>i.selectedOrFirstVariant.value.mID===n.selectedOrFirstVariant.value.mID))}},Fn=class Sp extends or{static renderedEngagements=[];constructor(e){super(e)}addToRendered(){Sp.renderedEngagements.push(this)}observeWidgetContainerInViewport(){return this.getVariation()}generateParentElementID(){let e=super.generateParentElementID();return this.engagementTrigger.isSubscriptionUpsell()&&(e+=`-${this.engagementTrigger.items[0].selectedOrFirstVariant.value.mID}`),e}async checkAndSendEvent(){if(!Ee.get().isOpen()&&this.runtimeData.pageName!=="cart"){x.log("Do not send display event as neither the cart drawer nor the cart page is open.");return}return super.checkAndSendEvent()}},uE=class Ip{constructor(e,r){this.engagementTrigger=e,this.element=r,this.cartItems=Ot.getCurrent().items}cartItems;static renderCartUpsell(e){let r=e.placement;if(!r?.selector){x.warn(`No placement available for ${e.objective}`,e.shortID);return}let n=Array.from(document.querySelectorAll(r.selector));if(!n?.length){x.warn(`No placement found for ${e.objective}`,e.shortID);return}for(let i of n)new Ip(e,i).render()}render(){let e=this.findCartItemFromHTMLElement();if(!e||this.engagementTrigger.skipSubscribedItems&&e.selling_plan_allocation)return;let r=this.engagementTrigger.items.find(g=>g.mID===e.product_id.toString());if(!r)return;let n=r.vars.find(g=>g.mID===e.id.toString());if(!n)return;let i=new cs(n),s=e.selling_plan_allocation?.selling_plan;if(s)for(let g of i.sellingPlans??[])g.mID===s.id.toString()&&(g.isSelected=!0,i.changeSellingPlan(g));let o=new Fe(r);o.vars=[i],o.selectedOrFirstVariant.value=i;let a=`lc-cart-item-${this.engagementTrigger.shortID}-${r.mID}`;this.element.classList.add(a);let l=new Ar(this.engagementTrigger);l.placement.selector=`.${a}`,l.items=[o];let h=new Fn(l);h.renderSilently(),this.watchForCartItemDeletion(h,a)}watchForCartItemDeletion(e,r){let n=new MutationObserver(i=>{i.forEach(s=>{s.removedNodes.forEach(o=>{o===this.element&&(x.debug(`${r} has been removed`),e.destroy(),n.disconnect())})})});n.observe(this.element.parentElement,{childList:!0,subtree:!0})}findCartItemFromHTMLElement(){let e=this.element.innerHTML;return this.cartItems.find(r=>{if(!(e.includes(r.url)||e.includes(r.variant_id))&&(!e.includes(r.product_title)||r.variant_title&&!e.includes(r.variant_title)))return!1;let n=r.selling_plan_allocation?.selling_plan?.name;return!(n&&!e.includes(n))})}},hE=dt(lr()),pE=class extends Fn{ctaExecutor=new ec;constructor(t){super(t)}update(t){super.update(t),this.engagementTrigger.progressBarConfig.update(t.progressBarConfig),this.checkMilestone().catch(e=>{Jt.getInstance().captureError("Failed to apply milestones",e)}),this.widgetElement.update()}shouldStopRendering(){return!1}renderContainer(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget("cooee-progressbar")}async checkMilestone(){let t=await Ot.getCurrent().getNormalisedCart(),e=this.engagementTrigger.progressBarConfig,r=[],n=[...e.milestones];for(let s of n)if(s.rewardType===hE.MilestoneRewardType.FREE_AUTO_GIFT){let o=s.items[0],a=t.amount>=s.minValue,l=t.items.find(h=>h.vID===o.vID||h.mID===o.mID&&h.properties[q.CAMPAIGN_ATTRIBUTE]===this.engagementTrigger.shortID);if(!a&&l&&e.removeIneligibleItem)x.debug(`Removing free gift ${l.vID} from cart`),await this.removeFreeGifts(l);else if(a&&!l){x.debug(`Adding free gift ${o.vID} to cart`);let h=await this.addFreeGift(o);h&&r.push(h)}}let i=e.coupons;if(i?.length)try{await $n.applyWithStorefront(i.map(s=>s.couponCode)),Ee.get().refreshUI(r[0],!1)}catch(s){this.sentryService.captureError("Failed to apply coupons on cart",s,D({},this.engagementTrigger.sentryContext()))}}async removeFreeGifts(t){await this.ctaExecutor.updateLineItem(t,{quantity:0})}async addFreeGift(t){return this.ctaExecutor.addToCart([t],this.engagementTrigger)}},dE=class extends or{constructor(t){super(t)}shouldStopRendering(){return!1}renderContainer(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget("cooee-shoppable-videos")}},fE=class extends or{constructor(t){super(t)}shouldStopRendering(){return!1}renderContainer(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget("cooee-sticky-atc")}},gE=dt(Qn()),mE=class extends or{constructor(t){super(t)}shouldStopRendering(){return!1}renderContainer(){let t=this.getParentElement(`inner-letscooee-${this.engagementTrigger.shortID}`);this.rootContainer.appendChild(t),document.addEventListener(q.ADD_BUNDLE_CTA_INBOUND_EVENT,this.inboundCTAListener.bind(this),!1)}async inboundCTAListener(t){let e=this.engagementTrigger,r=`Engagement(id: ${e.engagementID}, shortID: ${e.shortID})`,n=t.detail;if(!gE.JSUtils.hasKeys(n)){x.error(`No detail received for ${r}`);return}x.log("Detail received for BYOB",n);let i=n.campaignID??n.campaignId??n.campaign_id;if(i!==e.shortID&&i!==e.engagementID){x.warn(`Current ${r} is not BYOB. Received: ${i}`);return}let s=n.items;if(!s?.length)return;let o=s.map(a=>new pn({mID:a.product_id,vID:a.variant_id,quantity:a.quantity||1}));await new nc(this.triggerContext).execute({embeddedItems:o,clickAction:{at:108,applyDiscount:!0}})}},so=class{runtimeData=kt.get();processCartWidgetResponse(t){this.runtimeData.isCartDirty=!1,this.runtimeData.cartEngagements=t;let e=[...Fn.renderedEngagements];Fn.renderedEngagements.length=0;for(let r of t)x.log(`\u{1F4E3} ${r} received as cart embed`),!this.findAndUpdateCurrent(r,e)&&(x.log(`${r} is new`),r.isProgressBar()?new pE(r).renderSilently():r.isSubscriptionUpsell()?uE.renderCartUpsell(r):new Fn(r).renderSilently());this.removeOldWidgets(e)}processPageWidgetResponse(t){let e=[...or.renderedEngagements];or.renderedEngagements.length=0;for(let r of t)x.log(`\u{1F4E3} ${r} received as page embed`),!this.findAndUpdateCurrent(r,e)&&(x.log(`${r} is new`),r.isShoppableVideo()?new dE(r).renderSilently():r.isBYOB()?new mE(r).renderSilently():r.isStickyATC()?new fE(r).renderSilently():new or(r).renderSilently());this.removeOldWidgets(e)}findAndUpdateCurrent(t,e){let r=e.findIndex(n=>n.isSameTrigger(t));return r<0||t.isSubscriptionUpsell()?!1:(e[r].update(t),e[r].renderSilently(),e.splice(r,1),!0)}removeOldWidgets(t){for(let e of t)e.destroy()}},Cp=class{runtimeData=kt.get();httpService=lt.get(Lr);sessionManager=lt.get(we);constructor(){}async getWidgetProps(){let t={};t.engagementIDs=this.addAvailableEngagementShortIDs(),t.locale=this.runtimeData.locale,await this.addSessionContext(t),t.currentItem=this.runtimeData.getCurrentItem();try{t.cart=await Ot.getCurrent().getNormalisedCart()}catch(i){x.error("Error fetching Shopify cart before sending widget call",i)}let e=new URLSearchParams(location.search),r=e.get("cooee-preview");r?t.previewIDs=r.trim().split(",").filter(i=>Number.isInteger(+i)):this.runtimeData.previewIDs?.length&&(t.previewIDs=this.runtimeData.previewIDs);let n=e.get("cooee-variant");return n?t.previewVariant=n:this.runtimeData.previewVariant&&(t.previewVariant=this.runtimeData.previewVariant),t}async addSessionContext(t){let e=await this.sessionManager.checkSessionAndGetContext();t.sessionID=e[0],t.sessionNumber=e[1],t.landingPage=e[2],t.page=ws.parseFromCurrent()}addAvailableEngagementShortIDs(){let t=document.querySelectorAll(".letscooee-engagement"),e=[];return t.forEach(r=>{let n=r.dataset.engagementId;n&&+n&&e.push(n)}),e}},Jn=class Tp extends Cp{static INSTANCE;loadWidgetsSubject=new cr;constructor(){super(),this.loadWidgetsSubject.pipe(oi(300)).subscribe(()=>{this.loadCartWidgets().catch(e=>x.error("Unable to initiate cart widgets",e)),this.loadPageWidgets().catch(e=>x.error("Unable to initiate page widgets",e))}),tc.get().subscriber(q.CART_UPDATE_BROADCAST).subscribe(()=>this.loadWidgetsSubject.next())}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Tp),this.INSTANCE}loadOrRenderWidgetsAfterCartChange(){this.runtimeData.isCartDirty?this.loadWidgetsSilently():this.renderCachedCartWidgets()}loadPageWidgetsSilently(){we.replaySubject.subscribe(async()=>{this.loadPageWidgets().catch(e=>x.error("Unable to initiate load page widgets",e))})}loadCartWidgetsSilently(){we.replaySubject.subscribe(async()=>{this.loadCartWidgets().catch(e=>x.error("Unable to initiate cart widgets",e))})}loadWidgetsSilently(){we.replaySubject.subscribe(async()=>{this.loadWidgetsSubject.next()})}async loadPageWidgets(){let e=await this.getWidgetProps();x.log("Load widgets",e),this.httpService.post("/v1/engagement/page-widgets",e).then(async r=>{let n=r.widgets.map(i=>new Ar(i));new so().processPageWidgetResponse(n)}).catch(r=>{x.error("Error sending widget getter",r)})}async loadCartWidgets(){let e=await this.getWidgetProps();x.log("Load cart widgets",e),this.httpService.post("/v1/engagement/cart-widgets",e).then(async r=>{let n=r.widgets.map(i=>new Ar(i));new so().processCartWidgetResponse(n)}).catch(r=>{x.error("Error sending widget getter",r)})}async getVariation(e){let r=await this.getWidgetProps();return this.httpService.post("/v1/engagement/get-variant",D(D({},e),r))}renderCachedCartWidgets(){new so().processCartWidgetResponse(this.runtimeData.cartEngagements)}},yE=class{eventAPIService;modifications=[];constructor(){this.eventAPIService=lt.get(ac)}execute(t){for(let e of t)e.experimentConfig&&(this.executeExperiment(e),this.trackExperimentRan(e));if(document.querySelector("#lc-hide-body")?.remove(),!document.body){lt.get(Jt).captureMessage("No body element found","error");return}this.setupMutationObserver()}async executeExperiment(t){let e=t.experimentConfig?.modifications;if(!e?.length){x.log("Nothing to experiment",t.toString());return}for(let r of e){if(!r.cssSelector){x.debug("No CSS Selector available",t?.toString());continue}this.modifications.push(r);let n=Array.from(document.querySelectorAll(r.cssSelector));this.executeSingleModification(r,n)}}executeSingleModification(t,e){if(e?.length)for(let r of e)Object.assign(r.style,t.style),t.type==="TEXT"&&t.text&&(r.innerHTML=t.text)}trackExperimentRan(t){if(t.id==="preview"){x.warn("Skipping experiment attribution as its preview",t.toString());return}this.eventAPIService.trackExperiment({name:q.EVENT_EXPERIMENT_START,experiment:new Fa(t)}).catch(e=>{x.error("Fail to track experiment",e)})}setupMutationObserver(){new MutationObserver(t=>{t.forEach(e=>{e.addedNodes.forEach(r=>{r instanceof HTMLElement&&this.modifications.forEach(n=>{r.matches&&r.matches(n.cssSelector)?(x.debug("Re-applying experiment",n.toString()),this.executeSingleModification(n,[r])):r.querySelectorAll&&(x.debug("Re-applying experiment",n.toString()),this.executeSingleModification(n,Array.from(r.querySelectorAll(n.cssSelector))))})})})}).observe(document.body,{childList:!0,subtree:!0})}},ac=class xp extends Cp{static INSTANCE;constructor(){super()}static getInstance(){return this.INSTANCE||(this.INSTANCE=new xp),this.INSTANCE}loadExperimentSilently(){Ut.get(at.SDK_TOKEN).then(e=>{e?this.loadExperiments().catch(r=>x.error("Unable to initiate experiment",r)):we.replaySubject.subscribe(async()=>{this.loadExperiments().catch(r=>x.error("Unable to initiate experiment",r))})})}async loadExperiments(){if(!this.runtimeData.activeExperiment)return;let e=await this.getWidgetProps();x.log("Load experiments",e),this.httpService.post("/v1/engagement/experiments",e).then(async r=>{let n=r.experiments.map(i=>new Ar(i));new yE().execute(n)}).catch(r=>{x.error("Error sending experiment getter",r)})}async trackExperiment(e){await this.addSessionContext(e),await this.httpService.post("/v1/event/experiment",e)}},vE=class{runtimeData=kt.get();widgetAPIService=lt.get(Jn);experimentAPIService=lt.get(ac);meddle(){let t=St.globalRef;t.account=t.account??[],t.profile=t.profile??[],t.events=t.events??[],t.screen=t.screen??[],t.page=t.page??[],this.meddlePage(),this.meddleAccount(),this.meddleEvents(),this.meddleProfile(),this.meddleScreen(),this.exposeMethods()}exposeMethods(){let t=St.globalRef;t.loadPageWidgets=()=>{this.widgetAPIService.loadPageWidgetsSilently()},t.loadCartWidgets=()=>{this.widgetAPIService.loadCartWidgetsSilently()},t.loadExperiments=()=>{this.experimentAPIService.loadExperimentSilently()},t.previewWidget=St.previewWidget.bind(St),t.previewPopup=St.previewPopup.bind(St)}overwritePush(t,e){kn(t,"push",e)}meddleAccount(){this.overwritePush(St.globalRef.account,(...t)=>{this.processAccount(t[0])}),St.globalRef.account.forEach(this.processAccount.bind(this))}meddleEvents(){this.overwritePush(St.globalRef.events,(...t)=>{this.processEvent(t[0])}),St.globalRef.events.forEach(this.processEvent.bind(this))}meddleProfile(){this.overwritePush(St.globalRef.profile,(...t)=>{this.processProfile(t[0])}),St.globalRef.profile.forEach(this.processProfile.bind(this))}meddleScreen(){this.overwritePush(St.globalRef.screen,(...t)=>{this.processPageName(t[0])}),St.globalRef.screen.forEach(this.processPageName.bind(this))}processAccount(t){t&&(t.appID&&St.authenticate(t),t.flags&&Yo.setFlags(t.flags))}processEvent(t){t&&(q.JS_LOAD_WHITELIST_EVENTS.includes(t[0])?St.sendEvent(t[0],t[1],D({occurred:this.runtimeData.jsLoadTime},t[2])):St.sendEvent(t[0],t[1],t[2]))}processProfile(t){t&&St.updateProfile(t)}processPageName(t){t&&St.setPageName(t)}meddlePage(){this.overwritePush(St.globalRef.page,(...t)=>{this.processPage(t[0])}),St.globalRef.page.forEach(this.processPage.bind(this))}processPage(t){t.currentItem&&this.runtimeData.setCurrentItem(t.currentItem),t.currency&&(this.runtimeData.currencyCode=t.currency),t.shopCurrency&&(this.runtimeData.shopCurrencyCode=t.shopCurrency),t.moneyFormat&&(this.runtimeData.moneyFormat=t.moneyFormat),t.jsLoad&&(this.runtimeData.jsLoadTime=t.jsLoad),t.locale&&(this.runtimeData.locale=t.locale),t.pageName&&St.setPageName(t.pageName),t.activeExperiment&&(this.runtimeData.activeExperiment=t.activeExperiment)}},oo=class{static SESSION_STORAGE=window.sessionStorage;static SESSION_STORAGE_KEY_PREFIX=q.COOEE.concat("-");static getString(t,e){return this.getItem(t)||e}static setString(t,e){this.setItem(t,e)}static remove(t){this.removeItem(t)}static getItem(t){return this.SESSION_STORAGE.getItem(this.SESSION_STORAGE_KEY_PREFIX.concat(t))}static setItem(t,e){this.SESSION_STORAGE.setItem(this.SESSION_STORAGE_KEY_PREFIX.concat(t),e)}static removeItem(t){this.SESSION_STORAGE.removeItem(this.SESSION_STORAGE_KEY_PREFIX.concat(t))}},ao=class Mi{static INSTANCE;static DEBOUNCE_TIME=1e3;static THRESHOLD=10;safeHttpService=lt.get(Wt);lastPercent=0;_lastScreenOrScroll=new Date;constructor(){}set lastScreenOrScroll(e){this._lastScreenOrScroll=e}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Mi),this.INSTANCE}resetScrollID(e){oo.remove(q.SESSION_STORAGE_SCROLL_ID),this.lastScreenOrScroll=e??new Date}listen(){if(window.scrollY){let e=this.getPercentScrolledY();this.shouldSendScroll(e)&&this.sendScroll(e)}Ta(()=>{this.observeWindowScroll()})}observeWindowScroll(){es(window,"scroll").pipe(oi(Mi.DEBOUNCE_TIME),Qa(()=>{let e=this.getPercentScrolledY();if(e>100){x.warn("Received scroll percent is more than 100",e);return}if(this.shouldSendScroll(e))return e})).subscribe(e=>{this.sendScroll(e)})}shouldSendScroll(e){return Math.abs(this.lastPercent-e)>=Mi.THRESHOLD||this.lastPercent!==e&&e===100}sendScroll(e){if(e==null)return;let r={percent:e,timeMS:new Date().getTime()-this._lastScreenOrScroll.getTime()};this.lastPercent=e;let n=oo.getString(q.SESSION_STORAGE_SCROLL_ID,""),i=new jt(q.EVENT_SCROLL,r,null,n);this.safeHttpService.sendEvent(i),oo.setString(q.SESSION_STORAGE_SCROLL_ID,i.id.toHexString()),this._lastScreenOrScroll=new Date(i.occurred)}getPercentScrolledY(){let e=window.document.body.scrollHeight,r=window.innerHeight;return Math.ceil((window.scrollY+r)/e*100)}},wE=class Dp{static ACTIVE_DURATION="aDur";static INACTIVE_DURATION="iaDur";apiService=lt.get(Wt);runtimeData=kt.get();listen(){document.onvisibilitychange=()=>{document.visibilityState==="visible"?this.onVisible():document.visibilityState==="hidden"&&this.onHidden()}}async onVisible(){}async onHidden(){let e=await this.runtimeData.setInactive();if(e===0){x.info("Not sending background event as user was inactive on website");return}x.info(`Sending background event with ${e} seconds`);let r={};r[Dp.ACTIVE_DURATION]=e,this.apiService.sendEvent(new jt(q.EVENT_APP_BACKGROUND,r))}},bE=class{compareCartItemSubject=new cr;constructor(){this.compareCartItemSubject.pipe(oi(100)).subscribe(this.compareCartItems.bind(this))}listen(){this.compareCartItemSubject.next(),this.overwriteXMLHttpRequest(),this.overwriteFetchMethod()}overwriteXMLHttpRequest(){let t=this,e=window.XMLHttpRequest.prototype.send;window.XMLHttpRequest.prototype.send=function(){return this.addEventListener("load",function(){t.performEvent(this._url).catch(r=>x.error("Unable to process cart change in XMLHttpRequest",r))}),e.apply(this,arguments)},x.debug("Securely overwritten window.XMLHttpRequest.send method")}overwriteFetchMethod(){let t=this,e=window.fetch;window.fetch=function(r){return e.apply(window,arguments).then(n=>(t.performEvent(r.toString()).catch(i=>x.error("Unable to process cart change in fetch",i)),n))},x.debug("Securely overwritten window.fetch method")}async performEvent(t){this.isCartManipulationURL(t)&&(kt.get().isCartDirty=!0,this.compareCartItemSubject.next())}isCartManipulationURL(t){return/\/cart\/(add|change|update|clear)/.test(t)}sendChangesAsEvents(t,e){let r=t?.items,n=e.items,i=[],s=[];if(x.debug(`Comparing cart change with old count ${r?.length} to new count ${n.length}`),n?.forEach(o=>{let a=r?.find(l=>l.vID===o.vID);if(a){if(a.quantity!==o.quantity){let l=a.quantity<o.quantity,h=Math.abs(a.quantity-o.quantity),g=wt(D({},o),{quantity:h});l?i.push(g):s.push(g)}r&&Ev(r,a)}else i.push(o)}),r)for(let o of r)s.push(o);x.debug(`Cart delta: added: ${i.length}, removed: ${s.length}`),i.length&&this.sendEvent(q.EVENT_ADD_TO_CART,{items:i}),s.length&&t.token===e.token&&this.sendEvent(q.EVENT_REMOVE_FROM_CART,{items:s}),(s.length||i.length)&&tc.get().broadcast(q.CART_UPDATE_BROADCAST,{itemsAdded:i,itemsRemoved:s})}sendEvent(t,e){let r=new jt(t,e);lt.get(Wt).sendEvent(r)}async compareCartItems(){let t=await Ut.get(at.CURRENT_CART,{}),e=await Ot.getCurrent().getNormalisedCart(!0);this.sendChangesAsEvents(t,e)}},_E=class{listen(){return this.overwriteFetchMethod(),this}overwriteFetchMethod(){let t=this,e=window.fetch;window.fetch=async function(r,n){try{await t.modifyRequest(r,n)}catch(i){Jt.getInstance().captureError("Failed to modify graphql request",i,{body:JSON.stringify(n?.body)})}return e(r,n)},x.debug("Securely overwritten window.fetch method for graphql query")}async modifyRequest(t,e){let r=typeof t=="string"?t:t instanceof Request?t.url:"";if(!(r.includes("graphql.json")&&e?.method==="POST")||!e.body)return;let n;if(typeof e.body=="string")try{n=JSON.parse(e.body)}catch{return}else n=e.body;x.debug("Intercepted fetch request of:",r),n?.query.includes("cartCreate")&&(e.body=await this.updatedBody(n),this.sendBuyNowEvent())}async updatedBody(t){let e=t.variables.input.attributes??[],r=await dh();return t.variables.input.attributes=[...e,...r],JSON.stringify(t)}sendBuyNowEvent(){let t=kt.get().getCurrentItem();if(!t)return;let e=new jt(q.EVENT_BUY_NOW_CLICKED,{items:[t]});Wt.getInstance().sendEvent(e)}},Np=class{constructor(t,e){this.selectors=t,this.eventName=e,this.selectorString=t.join(",")}static INSTANCE;elements;selectorString;clickListenerCallback=t=>{let e=t.currentTarget,r=new jt(this.eventName,{class:e.className||void 0,tagName:e.tagName||void 0,id:e.id||void 0});Wt.getInstance().sendEvent(r),this.removeClickListener(this.clickListenerCallback)};listenSilently(){this.listen().catch(t=>x.error(t))}async listen(){this.elements=await ph(this.selectorString),this.elements.forEach(t=>{t.addEventListener("click",this.clickListenerCallback)})}removeClickListener(t){this.elements?.forEach(e=>{e.removeEventListener("click",t)})}},EE=class Qo extends Np{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(Qo.selectors,q.EVENT_ITEM_THUMBNAIL_CLICKED)}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Qo),this.INSTANCE}},SE=class Xo extends Np{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(Xo.selectors,q.EVENT_REVIEW_CLICKED)}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Xo),this.INSTANCE}},IE=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(){Ta(()=>{x.debug("Execution order:","document ready"),this.useLocationHash()})}useLocationHash(){let t=window.location.hash?.substring(1);if(t)if(t.includes(q.HASH_INITIATE_CHECKOUT)){document.dispatchEvent(new Event(q.THIRD_PARTY_CHECKOUT_EVENT));let e=document.querySelector(this.selector);if(!e){x.debug("No clickable cart checkout button found");return}x.debug("Clickable cart checkout button found",e),e.click()}else t.includes(q.HASH_OPEN_CART_DRAWER)&&Ee.get().open()}},hu=class{static attachCheckoutListener(){window.gokwikSdk&&window.gokwikSdk.on("checkout_initiated",async()=>{let t=await Ot.getCurrent().getNormalisedCart(),e={via:"GoKwik",items:t.items,cartToken:t.token,amount:{value:t.amount,currency:t.currency}},r=new jt(q.EVENT_CHECKOUT_STARTED,e);Wt.getInstance().sendEvent(r)})}},CE=class{async migrate(){}};je.escape=kd.MustacheUtils.escapeHtml;var St=class{static globalRef;static authenticated;static async initForMerchantWebsiteOnly(){window.cooeeSDKPreview||(this.initGlobalReference(),await new CE().migrate(),this.autoAuthenticate(),new vE().meddle(),lt.get(ac).loadExperimentSilently(),new wE().listen(),new bE().listen(),new _E().listen(),new IE().listen(),lt.get(ao).listen(),lt.get(SE).listenSilently(),lt.get(EE).listenSilently(),lt.get(Jn).loadPageWidgetsSilently(),this.attachGoKwikListeners(),this.storePreviewParams(),this.setupPreviewListeners(),Jr.watch())}static async initForAll(){this.injectWidgetAssets()}static initGlobalReference(){window.CooeeSDK||kn(window,"CooeeSDK",{}),this.globalRef=window.CooeeSDK,kn(this.globalRef,"config",new se),kn(this.globalRef,"runtimeData",new kt),kn(this.globalRef,"uaParser",new We),x.debug("Global reference initialised")}static injectWidgetAssets(){ye.injectScriptURL(Pe.widgetURL,"cooee-widget-sdk"),ye.injectStylesheet(Pe.styleURL)}static autoAuthenticate(){let t=ff();t&&this.authenticate({shopifyShop:t})}static authenticate(t){if(this.authenticated)return;let e=t.appID?.trim(),r=t.shopifyShop;if((_l(e)||e.length!==24)&&_l(r)){x.warn("Cooee App ID or Shop name is not configured");return}this.authenticated=!0,lt.get(we).init(t)}static sendEvent(t,e,r){let n=new jt(t,e,r?.triggerData);r?.occurred&&(n.occurred=r.occurred),lt.get(Wt).sendEvent(n)}static updateProfile(t){for(let e in t)if(e.toLowerCase().startsWith("ce "))throw new Error("User property name cannot start with 'CE '");lt.get(Wt).updateProfile(t)}static setPageName(t){if(!t)return;let e=kt.get(),r=e.pageName;if(t===r)return;if(e.pageName=t,t==="cart"&<.get(Jn).loadOrRenderWidgetsAfterCartChange(),q.BLACKLISTED_PAGE_NAMES.some(s=>t.includes(s))){lt.get(ao).resetScrollID();return}let n={};r&&(n.ps=r);let i=new jt(q.EVENT_SCREEN_VIEW,n);i.occurred=e.jsLoadTime,lt.get(Wt).sendEvent(i),lt.get(ao).resetScrollID(i.occurred)}static previewPopup(t,e){new pp(e).render(t)}static previewWidget(t){new or(new Ar(t)).render()}static setupPreviewListeners(){if(window.opener){try{window.opener.postMessage({action:"COOEE_READY_FOR_PREVIEW"},"*")}catch(t){x.error(t)}window.addEventListener("message",t=>{if(x.debug("Received event",t),!t.origin.includes("letscooee.com")&&!t.origin.includes("localhost"))return;let e=t.data;typeof e=="object"&&(e.action==="POPUP_PREVIEW"?(this.previewPopup(e.engagementTrigger),t.source?.postMessage({action:"PREVIEW_SUCCESSFUL"},t.origin)):e.action==="WIDGET_PREVIEW"&&(this.previewWidget(e.engagementTrigger),t.source?.postMessage({action:"PREVIEW_SUCCESSFUL"},t.origin)))})}}static attachGoKwikListeners(){let t=kt.get();window.addEventListener("kp-modal:opened",()=>{t.isGoKwikPopupOpen=!0}),window.addEventListener("user-loggedin",e=>{let{token:r}=e.detail;r&&this.updateProfile({goKwikToken:r})}),window.gokwikSdk?hu.attachCheckoutListener():window.addEventListener("gokwikLoaded",hu.attachCheckoutListener)}static storePreviewParams(){let t=kt.get(),e=new URLSearchParams(location.search),r=e.get("cooee-preview");r&&(t.previewIDs=r.trim().split(",").filter(i=>Number.isInteger(+i)));let n=e.get("cooee-variant");n&&(t.previewVariant=n)}};Od();Pd();x.debug("Execution order:","top");window.cooeeShopifyScriptLoaded||(window.cooeeShopifyScriptLoaded=!0,(async()=>(x.debug("Execution order:","IIFE start"),await St.initForMerchantWebsiteOnly(),await St.initForAll(),x.debug("Execution order:","IIFE end")))());x.debug("Execution order:","bottom");})();
|