(()=>{(function(M){var l={};function e(t){if(l[t])return l[t].exports;var c=l[t]={i:t,l:!1,exports:{}};return M[t].call(c.exports,c,c.exports,e),c.l=!0,c.exports}return e.m=M,e.c=l,e.d=function(t,c,g){e.o(t,c)||Object.defineProperty(t,c,{enumerable:!0,get:g})},e.r=function(t){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,c){if(c&1&&(t=e(t)),c&8||c&4&&typeof t=="object"&&t&&t.__esModule)return t;var g=Object.create(null);if(e.r(g),Object.defineProperty(g,"default",{enumerable:!0,value:t}),c&2&&typeof t!="string")for(var T in t)e.d(g,T,function(v){return t[v]}.bind(null,T));return g},e.n=function(t){var c=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(c,"a",c),c},e.o=function(t,c){return Object.prototype.hasOwnProperty.call(t,c)},e.p="",e(e.s=29)})([function(M,l,e){"use strict";e.d(l,"k",function(){return c}),e.d(l,"d",function(){return g}),e.d(l,"e",function(){return T}),e.d(l,"f",function(){return v}),e.d(l,"o",function(){return I}),e.d(l,"h",function(){return A}),e.d(l,"c",function(){return D}),e.d(l,"g",function(){return U}),e.d(l,"j",function(){return N}),e.d(l,"l",function(){return S}),e.d(l,"p",function(){return P}),e.d(l,"b",function(){return b}),e.d(l,"a",function(){return h}),e.d(l,"n",function(){return s}),e.d(l,"m",function(){return E}),e.d(l,"i",function(){return O});var t=function(o,a,u,f){function r(n){return n instanceof u?n:new u(function(i){i(n)})}return new(u||(u=Promise))(function(n,i){function w(m){try{W(f.next(m))}catch(p){i(p)}}function R(m){try{W(f.throw(m))}catch(p){i(p)}}function W(m){m.done?n(m.value):r(m.value).then(w,R)}W((f=f.apply(o,a||[])).next())})};function c(o){return typeof o=="undefined"}function g(o){return typeof o=="function"}function T(o){return o===null}function v(o){return T(o)||c(o)}const I=(o,a={})=>{if(Number.isFinite(+o))return a;try{return JSON.parse(o)}catch(u){}return a};function A(o){const a=function(){return t(this,void 0,void 0,function*(){})}.constructor;return typeof o=="object"&&!T(o)&&!Array.isArray(o)&&!(o instanceof a)&&o.constructor!=="function"&&Object.prototype.toString.call(o)==="[object Object]"}function D(o,a,u=void 0){if(T(o)||c(o))return u;const r=(a!=null?a:"").replace(/\[([^[\]]*)]/g,".$1.").split(".").filter(n=>n!=="").reduce((n,i)=>n&&n[i],o);return c(r)?u:r}function U(o){return typeof o=="number"&&Number.isFinite(o)}function N(o){return typeof o=="string"}function S(o){return N(o)&&o.length>0}const P=(o,a="",u)=>{const f=a&&a.length>0?a.split("."):[];let r=o;return f.slice(0,f.length-1).forEach(n=>{let i=r[n];(T(i)||c(i))&&(i={}),r[n]=i,r=r[n]}),r[f.pop()]=u,o};function b(o,a=100){let u;return(...f)=>{clearTimeout(u),u=setTimeout(()=>{o(...f)},a)}}const h=o=>{var a,u,f;return(f=(u=(a=o.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g))===null||a===void 0?void 0:a.map(r=>r.toLowerCase()))===null||u===void 0?void 0:u.join("_"))!==null&&f!==void 0?f:o},s=o=>{const a=Object.keys(o),u=[],f=a.reduce((r,n,i)=>(r[i]=n,u.push(o[n]),r),{});return Promise.all(u).then(r=>r.reduce((n,i,w)=>(n[f[w]]=i,n),{}))},E=(o,a)=>{let u;try{u=Object.keys(o)}catch(f){throw new Error("Unable to extract keys from provided object")}return u.reduce((f,r)=>{const n=a(o[r],r),i=Object.assign({},f);return c(n)||(i[r]=n),i},{})},d=o=>typeof o=="object"&&!T(o);function O(o){if(!d(o)||o.toString()!=="[object Object]")return!1;if(Object.getPrototypeOf(o)===null)return!0;let a=o;for(;Object.getPrototypeOf(a)!==null;)a=Object.getPrototypeOf(a);return Object.getPrototypeOf(o)===a}},function(M,l,e){(function(t,c){c(l)})(this,function(t){"use strict";var c,g,T,v,I,A,D,U,N,S,P,b,h,s,E;t.AlignValue=void 0,(c=t.AlignValue||(t.AlignValue={})).LEFT="left",c.RIGHT="right",c.CENTER="center",t.AlignPosition=void 0,(g=t.AlignPosition||(t.AlignPosition={})).NATURAL="natural",g.CANVAS="canvas",t.ShapeKind=void 0,(T=t.ShapeKind||(t.ShapeKind={})).CIRCLE="circle",T.RECTANGLE="rectangle",T.POLYGON="polygon",t.ObjectType=void 0,(v=t.ObjectType||(t.ObjectType={})).TEXT="text",v.SHAPE="shape",v.IMAGE="image",v.GROUP="group",t.SizeUnit=void 0,(I=t.SizeUnit||(t.SizeUnit={})).PX="px",I.PERCENT="%",t.LogicalOp=void 0,(A=t.LogicalOp||(t.LogicalOp={})).AND="and",A.OR="or",t.ComparisonOp=void 0,(D=t.ComparisonOp||(t.ComparisonOp={})).GT="gt",D.LT="lt",D.GE="ge",D.LE="le",D.EQ="eq",D.NE="ne",t.ConditionVariable=void 0,(U=t.ConditionVariable||(t.ConditionVariable={})).H="h",U.W="w",U.AR="ar",t.CartUpdateAction=void 0,(N=t.CartUpdateAction||(t.CartUpdateAction={})).ADD_TO_CART="addToCart",N.INCREMENT_QUANTITY="increaseQuantity",N.DECREMENT_QUANTITY="decreaseQuantity",N.UPDATE_QUANTITY="updateQuantity",N.CHANGE_QUANTITY="changeQuantity",N.CHANGE_CART="changeCart",t.WidgetFeature=void 0,(S=t.WidgetFeature||(t.WidgetFeature={})).AUTOMATED_DISCOUNTS="cart_discounts_inclusion",S.MANUAL_DISCOUNT_ALLOCATIONS="allow_manual_discount_allocations",S.DISABLE_COUPON_CODES="disable_coupon_codes",S.PRODUCT_VARIANTS="product_variants",S.EXCLUDE_OOS="exclude_oos",S.TIMER="timer",S.EMBEDDED_PRICE_DROP="embed-price-drop",S.PRODUCT_SELECTION="product_selection",S.RECOMMENDATION_REMINDER="recommendation_reminder",S.QUIZ_TIMER="quiz-timer",S.FS_FLOATING="fullscreen-floating",S.FLOATING_LAUNCHER="floating-launcher",S.SINGLE_SELECTION_DISCOUNT="single_selection_discount",S.EXCLUDE_DOUBLE_SELECTION_DISCOUNT="exclude_double_selection_discount",S.TIERED_DISCOUNT="tiered_discount",S.NO_DEFAULT_SELECTION="no_default_selection",S.PRODUCT_DISCOUNT="product_discount",S.NEW_USER_VIEW="new_user_view",S.TIMED_VIEW="timed_view",S.MOBILE_BOTTOM_DRAWER="mobile_bottom_drawer",S.USER_SPECIFIC="user-specific",S.COD_HIDDEN="cod_hidden",t.WidgetCategory=void 0,(P=t.WidgetCategory||(t.WidgetCategory={})).CUSTOM_QUIZ="custom_recommendation-quiz",P.QUIZ="quiz",P.PRODUCT_BUNDLE="bundle",P.AB_CART="cart",P.SIDE_CART="side-cart",P.FORM="form",P.PRICE_DROP="price-drop",P.NEW_ARRIVALS="newarrivals",P.BESTSELLER="recommended",P.GENERIC="generic",P.FBT="fbt",P.REWARD_QUIZ="reward-quiz",P.BULK_BUY="bulk-buy",P.SPIN_WHEEL="spin-the-wheel",P.STICKY_CART_BUTTON="sticky-cart-button",P.PLAYBOOK="playbook",P.PRODUCT_INFO="info",t.WidgetType=void 0,(b=t.WidgetType||(t.WidgetType={})).STORE_BANNER="store",b.PRODUCT_BANNER="product",b.WIDGET="widget",t.InsertType=void 0,(h=t.InsertType||(t.InsertType={})).ABOVE="above",h.BELOW="below",h.REPLACE_CHILDREN="replaceChildren",h.LAST_CHILD="lastChild",h.FIRST_CHILD="firstChild",h.PAGE_TOP="pageTop",h.PAGE_BOTTOM="pageBottom",h.PAGE_HOVER_TOP="pageHoverTop",h.PAGE_HOVER_BOTTOM="pageHoverBottom",h.FLOATING="floating",h.SLIDE_IN="slideIn",t.WidgetTimingAction=void 0,(s=t.WidgetTimingAction||(t.WidgetTimingAction={})).CLICK="click",s.SCROLL="scroll",s.DELAY="delay",s.AB_CART="abcart",t.TargetType=void 0,(E=t.TargetType||(t.TargetType={})).PAGES="pages",E.PRODUCTS="products",E.COLLECTIONS="collections";var d,O,o,a,u,f,r,n,i,w;t.BreakpointId=void 0,(d=t.BreakpointId||(t.BreakpointId={})).XS="xs",d.M="m",d.L="l",d.XL="xl",t.FloatingPositionTypes=void 0,(O=t.FloatingPositionTypes||(t.FloatingPositionTypes={})).TOP="top",O.RIGHT="right",O.BOTTOM="bottom",O.LEFT="left",t.AddOn=void 0,(o=t.AddOn||(t.AddOn={})).RECOMMENDED="recommended",o.UPSELL="upsell",o.FBT="fbt",o.BXGY="bxgy",t.WidgetEntityState=void 0,(a=t.WidgetEntityState||(t.WidgetEntityState={})).ENABLED="enabled",a.DISABLED="disabled",a.SYSTEM_DISABLED="system_disabled",a.DELETED="deleted",t.ApplyType=void 0,(u=t.ApplyType||(t.ApplyType={})).MANUAL="manual",u.AUTOMATION="automation",t.PublishAs=void 0,(f=t.PublishAs||(t.PublishAs={})).BADGE="badge",f.FEATURE_CARD="feature-card",f.TRUST_BADGE="trust-badges",f.STORE_BANNER="store-banner",f.PRODUCT_BANNER="product-banner",f.STANDALONE="standalone",f.WIDGET="widget",t.AddonStatus=void 0,(r=t.AddonStatus||(t.AddonStatus={})).ENABLED="enabled",r.DISABLED="disabled",t.DiscountType=void 0,(n=t.DiscountType||(t.DiscountType={})).FIXED="fixed_amount",n.PERCENTAGE="percentage",n.TIERED="tiered",n.BXGY_PRODUCTS="bxgy::products",t.ChannelMethod=void 0,(i=t.ChannelMethod||(t.ChannelMethod={})).INITIALIZE="initialize",i.RESIZE="resize",i.TIMER_EXPIRED="timerExpired",i.CART_UPDATE="onCartUpdate",i.ORDER_CREATED="orderCreated",i.DISCOUNT_UPDATION="discountUpdation",i.FETCH_CART="getCart",i.CLOSE="closeWidget",i.CHANGE_VARIANT="onChangeVariant",i.SELECT_PRODUCT="onProductSelect",i.FORM_SUBMIT="onFormSubmit",i.FORM_RESET="onFormReset",i.UPDATE_WIDGET="update",i.URL_CHANGE="urlchange",i.WINDOW_RESIZED="window-resized",i.TIMER_STATE_UPDATE="timer-state-update",i.SPIN_WHEEL_STATE_UPDATE="spin-wheel-state-update",i.QUIZ_STATE_UPDATE="quiz-state-update",i.IN_VIEW="in-view",i.OUT_OF_VIEW="out-of-view",i.GET_QUERY_PARAMS="get-query-params",i.LINK_DATA_UPDATE="link-data-update",i.GET_STOREFRONT_DATA="get-storefront-data",t.CheckoutType=void 0,(w=t.CheckoutType||(t.CheckoutType={})).SWIFT="swift",w.FASTRR="fastrr",w.GOKWIK="gokwik",w.DEFAULT="default";var R,W,m,p;t.ScriptName=void 0,(R=t.ScriptName||(t.ScriptName={})).ANALYTICS="analytics",R.LOADER="loader",R.LOFOODS="lofoods",R.OVERLAY="overlay",R.PREVIEW="preview",R.REPLACE="replace",R.SIDECART="sidecart",R.THANKYOU="thankyou",R.TRUSTBADGES="trustbadges",R.WIDGETS="widgets",R.QUIZ="quiz",t.FeaturesAPIApp=void 0,(W=t.FeaturesAPIApp||(t.FeaturesAPIApp={})).MODEMAGIC="modemagic",W.QUIZ_MASTER="quizmaster",t.CacheEntryVersion=void 0,(m=t.CacheEntryVersion||(t.CacheEntryVersion={})).ONE="1.0",m.TWO="2.0",t.TBAlign=void 0,(p=t.TBAlign||(t.TBAlign={})).CENTER="center",p.RIGHT="right",p.LEFT="left",t.LauncherPositions={BOTTOM_LEFT:"bottomLeft",BOTTOM_RIGHT:"bottomRight"},t.Platforms={SHOPIFY:"shopify",BIGCOMMERCE:"bigcommerce",UNKNOWN:"--unknown--"}})},function(M,l,e){"use strict";e.d(l,"a",function(){return g}),e.d(l,"b",function(){return T});var t=e(6);const g=["info","debug","error","log","group","groupEnd"].reduce((v,I)=>(v[I]=(...A)=>{t.b||window.console[I](...A)},v),{}),T=(v,I)=>{t.b||g.debug(`%c [Scripts] ${v}`,"background: #222; color: #d97b09",I!=null?I:"")}},,function(M,l,e){"use strict";(function(t){e.d(l,"f",function(){return N}),e.d(l,"i",function(){return E}),e.d(l,"d",function(){return o}),e.d(l,"a",function(){return u}),e.d(l,"b",function(){return f}),e.d(l,"c",function(){return r}),e.d(l,"h",function(){return n}),e.d(l,"g",function(){return w}),e.d(l,"j",function(){return R}),e.d(l,"e",function(){return W});var c=e(2),g=e(0),T=e(6),v=e(5),I;const A=((I=t==null?void 0:{USER_FEATURES_API:"https://app.getmodemagic.com/api/features",APP_URL:"https://app.getmodemagic.com/widgets/view",NODE_ENV:"production"})===null||I===void 0?void 0:I.NODE_ENV)==="test",D=["ase","art","bmp","blp","cd5","cit","cpt","cr2","cut","dds","dib","djvu","egt","exif","gif","gpl","grf","icns","ico","iff","jng","jpeg","jpg","jfif","jp2","jps","lbm","max","miff","mng","msp","nef","nitf","ota","pbm","pc1","pc2","pc3","pcf","pcx","pdn","pgm","PI1","PI2","PI3","pict","pct","pnm","pns","ppm","psb","psd","pdd","psp","px","pxm","pxr","qfx","raw","rle","sct","sgi","rgb","int","bw","tga","tiff","tif","vtf","xbm","xcf","xpm","3dv","amf","ai","awg","cgm","cdr","cmx","dxf","e2d","egt","eps","fs","gbr","odg","svg","stl","vrml","x3d","sxd","v2d","vnd","wmf","emf","art","xar","png","webp","jxr","hdp","wdp","cur","ecw","iff","lbm","liff","nrrd","pam","pcx","pgf","sgi","rgb","rgba","bw","int","inta","sid","ras","sun","tga","heic","heif"],U=new Set(D),N=new RegExp(`((.${D.join("|.")})+)$`,"i"),S=["pico","icon","thumb","small","compact","medium","large","grande","original","master"],P=["center","top","right","bottom","left"],b=["progressive"],h=new RegExp(`((?:_(?:x|X)?)(?:(?:\\d{1,4}(?:x|X)\\d{0,4}|(?:x|X)\\d{1,4})|(?:${S.join("|")})))?(_crop_(?:${P.join("|")}))?(@[23]x)?(.(?:${b.join("|")}))?$`),s=(()=>{let m=[];return p=>{let y=p.replace(/\.([^.]+?)$/,"");m=y.split(".");let C=-1;for(let L=0;L0?C:void 0).join("."),y}})(),E=(()=>{const m={};return p=>{const y=m[p];if(typeof y=="string")return y;let C=p;C=C.replace(/\?v=.*/g,"");const B=s(C).match(h);if(B){const{index:j=0}=B,Q=C.slice(0,j),x=C.slice(j+B[0].length);C=`${Q}${x}`}return m[p]=C,C}})(),d=(()=>{const m={};return p=>{let y=m[p];return typeof y=="string"||(y=s(p),m[p]=y),y}})();function O(m,p){return d(m)===d(p)}function o(m,p){return p.find(y=>O(m,y))||""}function a(m){var p,y;return(y=(p=m.split("/").pop())===null||p===void 0?void 0:p.split("?"))===null||y===void 0?void 0:y[0]}const u=(()=>{const m=new Map([]);return(p,y)=>{var C;if(m.has(p))return m.get(p);const L=E(p),B=L.match(N);if(!p.startsWith("/")&&Array.isArray(B)&&B.length>0){const j=a(L);if(typeof j=="string"){const Q=`${y}/${j}`;m.set(p,Q)}}return(C=m.get(p))!==null&&C!==void 0?C:p}})();function f(m,p="/cdn"){return`${m}${p}`}function r(){const{store:m}=Object(v.a)(),p=window.location.pathname;return p.match(/^\/(?:[a-z]{2})?$/)?"home":p.match(/\/products\/.+?$/)?"product":p.match(/\/pages\/.+?$/)?"page":p.includes("collection")||p.includes("search")?"collection":m==="venustahome"&&p.includes("campaign")?"home":"_not_supported_"}const n=window.modeMagicPreviewSettings||window.modeMagicSettings||{},i=m=>{const p=L=>{const{visibility:B,display:j,opacity:Q}=getComputedStyle(L);return!(document.hidden||B==="hidden"||j==="none"||+Q==0)};let y=m,C=p(y);for(;C&&y.parentElement;)y=y.parentElement,C=p(y);return C},w=(m,{areaCheck:p}={areaCheck:!0})=>{if(!i(m))return!1;const{top:y,left:C,bottom:L,right:B}=m.getBoundingClientRect(),j={x:0,y:0},Q={x:window.innerWidth||document.documentElement.clientWidth,y:window.innerHeight||document.documentElement.clientHeight},x=(H,K)=>{const _=j[H],$=Q[H];return K<_?_:K>$?$:K},V=x("y",L)-x("y",y),F=x("x",B)-x("x",C),G=V*F;return p?G>0:V>0||F>0},R=m=>{let{logs:p}=m!=null?m:{};p||({logs:p}=m==null?void 0:m.constructor);let y=["",""];return p&&(y=[Object.keys(p).reduce((C,L)=>`${C}${L}: ${p[L]}; `,""),"background-color: rgb(76, 136, 255);color:white;","color: rgb(76, 136, 255)"]),T.b||A?m:new Proxy(m,{get(C,L,B){const j=Reflect.get(C,L,B);return typeof j=="function"?function(...Q){var x,V;const F=`%c[${(x=m==null?void 0:m.name)!==null&&x!==void 0?x:(V=m==null?void 0:m.constructor)===null||V===void 0?void 0:V.name}]%c[${L.toString()}]%c: `;c.a.group(F,...y),Q.length>0&&c.a.debug("Called with: ",...Q);const G=j.apply(this,Q);return c.a.debug("Returning",G),c.a.groupEnd(),G}:j}})},W=()=>{const{search:m}=window.location;return Object(g.l)(m)?JSON.parse(`{"${m.slice(1).replace(/&/g,'","').replace(/=/g,'":"')}"}`,(p,y)=>p===""?y:decodeURIComponent(y)):{}}}).call(this,e(16))},function(M,l,e){"use strict";e.d(l,"a",function(){return v});var t=e(1),c=e.n(t),g=e(0),T=e(14);const v=()=>{var I,A,D;const U={cart:null,platform:t.Platforms.UNKNOWN,product:"",store:"",currency:{active_currency_code:"",active_currency_id:1},settings:{store_hash:"",secure_host:"",cdn_url:"",secure_base_url:"",channel_id:1},customer:null,dumps:{},urls:{home:""}};if(typeof window!="undefined"){if(typeof window.__store_context__=="undefined"&&(window.__store_context__={}),Object.assign(window.__store_context__,Object.assign(Object.assign({},U),window.__store_context__)),Object(g.l)(window.__mmStore)&&Object.assign(window.__store_context__,{store:window.__mmStore.split(".")[0]}),Object(g.h)(window.Shopify)){const N=Object(T.a)(),S=window.Shopify.shop.split(".")[0];Object.assign(window.__store_context__,{platform:t.Platforms.SHOPIFY,store:S,dumps:{},currency:{active_currency_code:(A=(I=window.Shopify.currency)===null||I===void 0?void 0:I.active)!==null&&A!==void 0?A:"USD",active_currency_id:1},settings:{secure_base_url:`https://${window.Shopify.shop}`,secure_host:window.Shopify.shop,cdn_url:window.Shopify.cdnHost,store_hash:S,channel_id:1},cart:null,urls:{home:(D=window.Shopify.routes)===null||D===void 0?void 0:D.root},product:N.product})}return window.__store_context__}return U}},function(M,l,e){"use strict";(function(t){e.d(l,"b",function(){return I}),e.d(l,"a",function(){return N});var c,g,T,v;const I=((c=t==null?void 0:{USER_FEATURES_API:"https://app.getmodemagic.com/api/features",APP_URL:"https://app.getmodemagic.com/widgets/view",NODE_ENV:"production"})===null||c===void 0?void 0:c.NODE_ENV)==="production",A=((g=t==null?void 0:{USER_FEATURES_API:"https://app.getmodemagic.com/api/features",APP_URL:"https://app.getmodemagic.com/widgets/view",NODE_ENV:"production"})===null||g===void 0?void 0:g.NODE_ENV)==="test",D=(v=(T=t==null?void 0:{USER_FEATURES_API:"https://app.getmodemagic.com/api/features",APP_URL:"https://app.getmodemagic.com/widgets/view",NODE_ENV:"production"})===null||T===void 0?void 0:T.NODE_ENV)!==null&&v!==void 0?v:"development",N={development:"https://cf-events-passthrough.kubric-blog.workers.dev",staging:"https://cf-events-passthrough.kubric-blog.workers.dev",production:"https://events.getmodemagic.com"}[D]}).call(this,e(16))},function(M,l,e){"use strict";e.d(l,"b",function(){return h}),e.d(l,"c",function(){return s}),e.d(l,"a",function(){return o});var t=e(17),c=e(6);const g="__SECRET_INTERNALS_DO_NOT_USE__";var T=e(4),v=e(2),I=e(9),A=e(0),D=e(12),U=e(19),N=e(5),S=function(a,u){var f={};for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&u.indexOf(r)<0&&(f[r]=a[r]);if(a!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,r=Object.getOwnPropertySymbols(a);n{v.a.debug("MM:Clearing impressions cache"),u.impressionsCache=new Set,u.viewsCache=new Set,u.stats=E}),u.addOrderCompletionListener()}addOrderCompletionListener(){window.addEventListener("message",u=>{const{data:f}=u,{messageType:r,messageData:{actionType:n}={}}=f,i=Object(A.c)(f,"messageAuth.source",null),w=Object(A.c)(f,"messageData.payload.order",null),{id:R,line_items:W=[],cart_token:m="",email:p="",customer:y,customer_locale:C=""}=w!=null?w:{},{id:L=-1}=y!=null?y:{};r==="MODEMAGIC_CONVERSION_EVENT"&&n==="ORDER_CREATE"&&!Object(A.e)(i)&&P.has(i)&&!Object(A.k)(R)&&Object(D.b)({email:p,orderId:R,customerId:L,cartToken:m,customerLocale:C,source:i!=null?i:void 0,lineItems:W})})}flushQueue(){var u,f,r;const n=O.getInstance(),i=n.eventQueue.get(d.FLUSH_QUEUE);if(!Object(A.e)(i)&&!Object(A.k)(i)){const R=new Date().getTime();if(R-i.queued>n.queWaitTime){if(i.counter>=n.maxRetries){n.eventQueue.set(d.ACTIVE_QUEUE,[...(u=n.eventQueue.get(d.ACTIVE_QUEUE))!==null&&u!==void 0?u:[],...i.events]),n.eventQueue.set(d.FLUSH_QUEUE,void 0),n.flushQueue();return}n.eventQueue.set(d.FLUSH_QUEUE,Object.assign(Object.assign({},i),{queued:new Date().getTime(),counter:i.counter+1}))}else{if(n.retryQueTimeout!==-1)return;const W=n.queWaitTime-(R-i.queued)+1e3;n.retryQueTimeout=window.setTimeout(()=>{n.retryQueTimeout=-1,n.flushQueue()},W);return}}else{const R=(f=n.eventQueue.get(d.ACTIVE_QUEUE))!==null&&f!==void 0?f:[];Array.isArray(R)&&R.length>0&&(n.eventQueue.set(d.ACTIVE_QUEUE,[]),n.eventQueue.set(d.FLUSH_QUEUE,{events:R,queued:new Date().getTime(),counter:1}))}const w=(r=n.eventQueue.get(d.FLUSH_QUEUE))===null||r===void 0?void 0:r.events;if(Array.isArray(w)&&w.length>0){const R=JSON.stringify(w);fetch(c.a,{method:"POST",body:R}).then(()=>{n.eventQueue.set(d.FLUSH_QUEUE,void 0)}).catch(()=>{})}}queueEvent(u){var f;const r=O.getInstance(),n=[...(f=r.eventQueue.get(d.ACTIVE_QUEUE))!==null&&f!==void 0?f:[],u];r.eventQueue.set(d.ACTIVE_QUEUE,n),r.queTimeout>0&&(window.clearTimeout(r.queTimeout),r.queTimeout=-1),n.length>=b?r.flushQueue():r.queTimeout=window.setTimeout(()=>{r.flushQueue()},1e3)}raiseEvent(u){const{store:f}=Object(N.a)(),{appName:r=U.a,entity:n,eventType:i,data:w,element:R}=u,W=window.location.href,m=Object(T.e)(),p=w!=null?w:{},{product:y,storyboard:C,template:L,impressionsData:B,widgets:j,playbookId:Q}=p,x=S(p,["product","storyboard","template","impressionsData","widgets","playbookId"]),V=new Date().getTime()/1e3,F=O.getInstance();F.stats[i]+=1,F.log(n,i,w,R),F.queueEvent(Object.assign(Object.assign({app_name:r,store_id:f,product_id:y,storyboard_id:C,widget_ids:j,template_id:L,category:n,action:i,time:V,playbook_id:Q,device_id:Object(I.a)(),full_url:W,query:m},x),B))}log(u,f,r,n){v.a.debug(`MM:${u}:${f}`),n&&v.a.debug("src element: ",n),v.a.debug("data: ",JSON.stringify(r)),v.a.debug("stats: ",JSON.stringify(O.getInstance().stats))}click(u){const{entity:f,element:r,data:n,appName:i}=u;O.getInstance().raiseEvent({appName:i,entity:f,eventType:h.CLICK,data:n,element:r})}impression(u){const{entity:f,element:r,data:n,appName:i}=u,w=O.getInstance();w.impressionsCache.has(r)||(w.raiseEvent({appName:i,entity:f,eventType:h.IMPRESSION,data:n,element:r}),w.impressionsCache.add(r))}view(u){const{entity:f,element:r,data:n,appName:i}=u,w=O.getInstance();w.viewsCache.has(r)||(w.raiseEvent({appName:i,entity:f,eventType:h.VIEW,data:n,element:r}),w.viewsCache.add(r))}hide(u){const{entity:f,element:r,data:n,appName:i}=u;O.getInstance().raiseEvent({appName:i,entity:f,eventType:h.HIDE,data:n,element:r})}conversion(u){const{data:f,appName:r}=u;O.getInstance().raiseEvent({appName:r,entity:s.WIDGET,eventType:h.CONVERSION,data:f})}}const o=O.getInstance()},,function(M,l,e){"use strict";e.d(l,"a",function(){return g});var t=e(0);const c="mm.userDeviceID",g=()=>{const T=window.localStorage.getItem(c);if(Object(t.e)(T)){const v=JSON.stringify(performance.now())+Math.random().toString(36).substring(2,11);return window.localStorage.setItem(c,v),v}return T}},,,function(M,l,e){"use strict";e.d(l,"a",function(){return g}),e.d(l,"b",function(){return T});var t=e(7),c=e(0);const g={swift:!0,shopflo:!0,fastrr:!0};function T(v){const{customerLocale:I,customerId:A,orderId:D,lineItems:U,email:N,cartToken:S,source:P}=v,b=U.reduce((h,{properties:s={}})=>{const E=s.__mmWidget,d=Object(c.o)(E,null);return d!==null&&!Array.isArray(d)&&typeof d=="object"&&h.push(d),h},[]);t.a.conversion({appName:"shopify",data:{widgets:b,meta:{source:P,line_items:U,order:D,cartToken:S,src:window.location.href,customer:{id:A,locale:I,email:N}},impressionsData:{apply_type:"manual"}}})}},,function(M,l,e){"use strict";e.d(l,"a",function(){return t});const t=()=>{const c=document.querySelectorAll("[data-app='mm']");let g={};return c.forEach(T=>{g=Object.assign(Object.assign({},g),T.dataset)}),g}},,function(M,l){var e=M.exports={},t,c;function g(){throw new Error("setTimeout has not been defined")}function T(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?t=setTimeout:t=g}catch(s){t=g}try{typeof clearTimeout=="function"?c=clearTimeout:c=T}catch(s){c=T}})();function v(s){if(t===setTimeout)return setTimeout(s,0);if((t===g||!t)&&setTimeout)return t=setTimeout,setTimeout(s,0);try{return t(s,0)}catch(E){try{return t.call(null,s,0)}catch(d){return t.call(this,s,0)}}}function I(s){if(c===clearTimeout)return clearTimeout(s);if((c===T||!c)&&clearTimeout)return c=clearTimeout,clearTimeout(s);try{return c(s)}catch(E){try{return c.call(null,s)}catch(d){return c.call(this,s)}}}var A=[],D=!1,U,N=-1;function S(){!D||!U||(D=!1,U.length?A=U.concat(A):N=-1,A.length&&P())}function P(){if(!D){var s=v(S);D=!0;for(var E=A.length;E;){for(U=A,A=[];++N1)for(var d=1;d{const[,,I]=v;g.apply(T,v),t.listeners.forEach(A=>typeof I=="string"&&A(I.split("?")[1]||""))}})}static listen(g){t.unlisten(g),t.listeners.push(g)}static unlisten(g){t.listeners=t.listeners.filter(T=>T!==g)}}t.listeners=[]},function(M,l,e){"use strict";e.d(l,"c",function(){return N}),e.d(l,"b",function(){return P}),e.d(l,"a",function(){return b});var t=e(14),c=e(0),g=e(1),T=e.n(g),v=e(5),I=e(9),A=function(h,s,E,d){function O(o){return o instanceof E?o:new E(function(a){a(o)})}return new(E||(E=Promise))(function(o,a){function u(n){try{r(d.next(n))}catch(i){a(i)}}function f(n){try{r(d.throw(n))}catch(i){a(i)}}function r(n){n.done?o(n.value):O(n.value).then(u,f)}r((d=d.apply(h,s||[])).next())})};const D="COD",U=()=>A(void 0,void 0,void 0,function*(){var h,s;let E=null;try{if(window.location.pathname.includes("/products/")){const O=yield fetch(`${window.location.pathname}.json`).then(o=>o.json());E=(s=(h=O==null?void 0:O.product)===null||h===void 0?void 0:h.id)===null||s===void 0?void 0:s.toString()}}catch(d){console.debug(d)}return E!=null?E:null}),N=()=>A(void 0,void 0,void 0,function*(){const h=Object(t.a)();if(!h.product&&Object(c.h)(window.Shopify)){const s=yield U();if(typeof s=="string"){h.product=s;const E=document.createElement("div");E.setAttribute("data-app","mm"),E.setAttribute("data-product",s),document.body.appendChild(E)}}return Promise.resolve()}),S=()=>new Promise(h=>{const s=setInterval(()=>{const E=Object(c.c)(window,"Shopflo.order.tags","").split(",").map(d=>d.trim()).filter(d=>d.length>0);if(E.length>0){const d=new Set(E);clearInterval(s),h(d.has(D)?"true":"false")}},100)}),P=(h=[])=>A(void 0,void 0,void 0,function*(){var s,E;const{store:d,product:O}=Object(v.a)(),o=!Object(c.k)(window.Shopflo),a=typeof((s=window.Shopify)===null||s===void 0?void 0:s.checkout)!="undefined"||o&&new URLSearchParams(window.location.search).get("page")==="thank_you"?"true":"false";let u="false",f=-1;return a==="true"&&(u=yield S(),f=(E=+Object(c.c)(window,"Shopflo.order.total_price","0"))!==null&&E!==void 0?E:-1),{shop:d,path:window.location.pathname,domain:window.location.host,product:O,app:g.FeaturesAPIApp.MODEMAGIC,hash:window.location.hash,device_id:Object(I.a)(),thankyou:a,shopflo_cod:u,cart_value:`${f}`,query:window.encodeURIComponent(window.location.search),features:h}}),b=(h,s)=>{Object.entries(s).forEach(([E,d])=>{d&&(Array.isArray(d)?d.forEach(O=>h.searchParams.set(E,O)):h.searchParams.set(E,d))})}},,,,,,,,function(M,l,e){"use strict";e.r(l),e.d(l,"addFeatureSettings",function(){return U});var t=e(2),c=e(9),g=e(7),T=e(5),v=e(6),I=e(20),A=e(21),D=function(s,E,d,O){function o(a){return a instanceof d?a:new d(function(u){u(a)})}return new(d||(d=Promise))(function(a,u){function f(i){try{n(O.next(i))}catch(w){u(w)}}function r(i){try{n(O.throw(i))}catch(w){u(w)}}function n(i){i.done?a(i.value):o(i.value).then(f,r)}n((O=O.apply(s,E||[])).next())})};function U(s,E,d="modeMagic"){const O=`${d}Settings`;typeof window[O]=="undefined"&&(window[O]={}),typeof E!="undefined"&&(window[O][s]=E)}function N(s){s.forEach(({name:E,src:d,data:O})=>{U(E,O,"modeMagic");const o=document.createElement("script");o.setAttribute("data-mm-script",E),o.setAttribute("type","text/javascript"),o.setAttribute("src",d),o.setAttribute("fetchPriority","high"),document.body.appendChild(o)})}function S(s){try{const d=JSON.parse(s.responseText).data;N(d)}catch(E){t.a.debug(E)}}const P=()=>{const{store:s,product:E}=Object(T.a)(),d=new Date().getTime()/1e3;fetch(v.a,{method:"POST",body:JSON.stringify({device_id:Object(c.a)(),meta:{url:window.location.href},product_id:E!=null?E:"",action:g.b.PAGE_VIEW,time:d,store_id:s,category:"price_drop"})})};function b(){return D(this,void 0,void 0,function*(){let s=!1;const E=yield Object(A.b)();s||(P(),s=!0,window==null||window.addEventListener("popstate",()=>{s&&P()}));const d=new URL("https://app.getmodemagic.com/api/features");Object(A.a)(d,E);const O=new XMLHttpRequest;O.addEventListener("load",S.bind(null,O)),window!=null&&window.MMScriptLoaded||(O.open("GET",d.toString(),!0),O.send(),window.MMScriptLoaded=!0)})}const h=()=>D(void 0,void 0,void 0,function*(){var s;window!=null&&window.MMScriptLoaded||(window.MMScriptLoaded=(s=window==null?void 0:window.MMScriptLoaded)!==null&&s!==void 0?s:!1,yield Object(A.c)(),document.readyState==="loading"?document.addEventListener("DOMContentLoaded",b):yield b())});t.a.debug("[loader] starting initialization"),h(),I.a.init(),I.a.listen(()=>{typeof window!="undefined"&&window.MMScriptLoaded&&typeof window.Shopflo!="undefined"&&new URLSearchParams(window.location.search).get("page")==="thank_you"&&(t.a.debug("[loader] re-initializing as shopflo integration changed query param in thank you page"),window.MMScriptLoaded=!1,h())})}]);})();