@ordergroove/offers 2.40.4 → 2.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/dist/bundle-report.html +6 -6
- package/dist/offers.js +28 -28
- package/dist/offers.js.map +3 -3
- package/package.json +2 -2
- package/src/components/UpsellButton.js +13 -5
- package/src/components/__tests__/UpsellButton.spec.js +11 -0
package/dist/offers.js
CHANGED
|
@@ -8,10 +8,10 @@ else {
|
|
|
8
8
|
window.og['offers'] = factory();
|
|
9
9
|
}
|
|
10
10
|
})(()=>{
|
|
11
|
-
var lib=(()=>{var Da=Object.create;var dt=Object.defineProperty;var Fa=Object.getOwnPropertyDescriptor;var Ua=Object.getOwnPropertyNames;var La=Object.getPrototypeOf,Ma=Object.prototype.hasOwnProperty;var n=(t,e)=>dt(t,"name",{value:e,configurable:!0});var K=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),An=(t,e)=>{for(var r in e)dt(t,r,{get:e[r],enumerable:!0})},Nn=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Ua(e))!Ma.call(t,i)&&i!==r&&dt(t,i,{get:()=>e[i],enumerable:!(o=Fa(e,i))||o.enumerable});return t};var se=(t,e,r)=>(r=t!=null?Da(La(t)):{},Nn(e||!t||!t.__esModule?dt(r,"default",{value:t,enumerable:!0}):r,t)),$a=t=>Nn(dt({},"__esModule",{value:!0}),t);var Ht=K((jt,Mn)=>{(function(t,e){typeof jt=="object"&&typeof Mn<"u"?e(jt):typeof define=="function"&&define.amd?define(["exports"],e):(t=t||self,e(t.throttleDebounce={}))})(jt,function(t){"use strict";function e(o,i,s,a){var c,p=!1,l=0;function d(){c&&clearTimeout(c)}n(d,"clearExistingTimeout");function u(){d(),p=!0}n(u,"cancel"),typeof i!="boolean"&&(a=s,s=i,i=void 0);function h(){for(var _=arguments.length,S=new Array(_),m=0;m<_;m++)S[m]=arguments[m];var b=this,O=Date.now()-l;if(p)return;function E(){l=Date.now(),s.apply(b,S)}n(E,"exec");function w(){c=void 0}n(w,"clear"),a&&!c&&E(),d(),a===void 0&&O>o?E():i!==!0&&(c=setTimeout(a?w:E,a===void 0?o-O:o))}return n(h,"wrapper"),h.cancel=u,h}n(e,"throttle");function r(o,i,s){return s===void 0?e(o,i,!1):e(o,s,i!==!1)}n(r,"debounce"),t.debounce=r,t.throttle=e,Object.defineProperty(t,"__esModule",{value:!0})})});var _t=K((Hu,ii)=>{var Qa="Expected a function",Xn="__lodash_hash_undefined__",Za="[object Function]",Xa="[object GeneratorFunction]",ec=/[\\^$.*+?()[\]{}|]/g,tc=/^\[object .+?Constructor\]$/,rc=typeof window=="object"&&window&&window.Object===Object&&window,oc=typeof self=="object"&&self&&self.Object===Object&&self,ei=rc||oc||Function("return this")();function nc(t,e){return t?.[e]}n(nc,"getValue");function ic(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}n(ic,"isHostObject");var sc=Array.prototype,ac=Function.prototype,ti=Object.prototype,co=ei["__core-js_shared__"],Zn=function(){var t=/[^.]+$/.exec(co&&co.keys&&co.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),ri=ac.toString,po=ti.hasOwnProperty,cc=ti.toString,pc=RegExp("^"+ri.call(po).replace(ec,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),lc=sc.splice,uc=oi(ei,"Map"),bt=oi(Object,"create");function Pe(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}n(Pe,"Hash");function dc(){this.__data__=bt?bt(null):{}}n(dc,"hashClear");function fc(t){return this.has(t)&&delete this.__data__[t]}n(fc,"hashDelete");function hc(t){var e=this.__data__;if(bt){var r=e[t];return r===Xn?void 0:r}return po.call(e,t)?e[t]:void 0}n(hc,"hashGet");function mc(t){var e=this.__data__;return bt?e[t]!==void 0:po.call(e,t)}n(mc,"hashHas");function gc(t,e){var r=this.__data__;return r[t]=bt&&e===void 0?Xn:e,this}n(gc,"hashSet");Pe.prototype.clear=dc;Pe.prototype.delete=fc;Pe.prototype.get=hc;Pe.prototype.has=mc;Pe.prototype.set=gc;function Be(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}n(Be,"ListCache");function yc(){this.__data__=[]}n(yc,"listCacheClear");function bc(t){var e=this.__data__,r=sr(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():lc.call(e,r,1),!0}n(bc,"listCacheDelete");function _c(t){var e=this.__data__,r=sr(e,t);return r<0?void 0:e[r][1]}n(_c,"listCacheGet");function Sc(t){return sr(this.__data__,t)>-1}n(Sc,"listCacheHas");function Ec(t,e){var r=this.__data__,o=sr(r,t);return o<0?r.push([t,e]):r[o][1]=e,this}n(Ec,"listCacheSet");Be.prototype.clear=yc;Be.prototype.delete=bc;Be.prototype.get=_c;Be.prototype.has=Sc;Be.prototype.set=Ec;function we(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}n(we,"MapCache");function xc(){this.__data__={hash:new Pe,map:new(uc||Be),string:new Pe}}n(xc,"mapCacheClear");function vc(t){return ar(this,t).delete(t)}n(vc,"mapCacheDelete");function Oc(t){return ar(this,t).get(t)}n(Oc,"mapCacheGet");function Tc(t){return ar(this,t).has(t)}n(Tc,"mapCacheHas");function Pc(t,e){return ar(this,t).set(t,e),this}n(Pc,"mapCacheSet");we.prototype.clear=xc;we.prototype.delete=vc;we.prototype.get=Oc;we.prototype.has=Tc;we.prototype.set=Pc;function sr(t,e){for(var r=t.length;r--;)if(Nc(t[r][0],e))return r;return-1}n(sr,"assocIndexOf");function wc(t){if(!ni(t)||Rc(t))return!1;var e=Ic(t)||ic(t)?pc:tc;return e.test(Ac(t))}n(wc,"baseIsNative");function ar(t,e){var r=t.__data__;return Cc(e)?r[typeof e=="string"?"string":"hash"]:r.map}n(ar,"getMapData");function oi(t,e){var r=nc(t,e);return wc(r)?r:void 0}n(oi,"getNative");function Cc(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}n(Cc,"isKeyable");function Rc(t){return!!Zn&&Zn in t}n(Rc,"isMasked");function Ac(t){if(t!=null){try{return ri.call(t)}catch{}try{return t+""}catch{}}return""}n(Ac,"toSource");function lo(t,e){if(typeof t!="function"||e&&typeof e!="function")throw new TypeError(Qa);var r=n(function(){var o=arguments,i=e?e.apply(this,o):o[0],s=r.cache;if(s.has(i))return s.get(i);var a=t.apply(this,o);return r.cache=s.set(i,a),a},"memoized");return r.cache=new(lo.Cache||we),r}n(lo,"memoize");lo.Cache=we;function Nc(t,e){return t===e||t!==t&&e!==e}n(Nc,"eq");function Ic(t){var e=ni(t)?cc.call(t):"";return e==Za||e==Xa}n(Ic,"isFunction");function ni(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}n(ni,"isObject");ii.exports=lo});var zi=K((Ed,Oo)=>{function ap(t,e){var r,o,i,s,a,c,p,l,d,u;for(r=t.length&3,o=t.length-r,i=e,a=3432918353,p=461845907,u=0;u<o;)d=t.charCodeAt(u)&255|(t.charCodeAt(++u)&255)<<8|(t.charCodeAt(++u)&255)<<16|(t.charCodeAt(++u)&255)<<24,++u,d=(d&65535)*a+(((d>>>16)*a&65535)<<16)&4294967295,d=d<<15|d>>>17,d=(d&65535)*p+(((d>>>16)*p&65535)<<16)&4294967295,i^=d,i=i<<13|i>>>19,s=(i&65535)*5+(((i>>>16)*5&65535)<<16)&4294967295,i=(s&65535)+27492+(((s>>>16)+58964&65535)<<16);switch(d=0,r){case 3:d^=(t.charCodeAt(u+2)&255)<<16;case 2:d^=(t.charCodeAt(u+1)&255)<<8;case 1:d^=t.charCodeAt(u)&255,d=(d&65535)*a+(((d>>>16)*a&65535)<<16)&4294967295,d=d<<15|d>>>17,d=(d&65535)*p+(((d>>>16)*p&65535)<<16)&4294967295,i^=d}return i^=t.length,i^=i>>>16,i=(i&65535)*2246822507+(((i>>>16)*2246822507&65535)<<16)&4294967295,i^=i>>>13,i=(i&65535)*3266489909+(((i>>>16)*3266489909&65535)<<16)&4294967295,i^=i>>>16,i>>>0}n(ap,"murmurhash3_32_gc");typeof Oo<"u"&&(Oo.exports=ap)});var Yi=K((xd,To)=>{function cp(t,e){for(var r=t.length,o=e^r,i=0,s;r>=4;)s=t.charCodeAt(i)&255|(t.charCodeAt(++i)&255)<<8|(t.charCodeAt(++i)&255)<<16|(t.charCodeAt(++i)&255)<<24,s=(s&65535)*1540483477+(((s>>>16)*1540483477&65535)<<16),s^=s>>>24,s=(s&65535)*1540483477+(((s>>>16)*1540483477&65535)<<16),o=(o&65535)*1540483477+(((o>>>16)*1540483477&65535)<<16)^s,r-=4,++i;switch(r){case 3:o^=(t.charCodeAt(i+2)&255)<<16;case 2:o^=(t.charCodeAt(i+1)&255)<<8;case 1:o^=t.charCodeAt(i)&255,o=(o&65535)*1540483477+(((o>>>16)*1540483477&65535)<<16)}return o^=o>>>13,o=(o&65535)*1540483477+(((o>>>16)*1540483477&65535)<<16),o^=o>>>15,o>>>0}n(cp,"murmurhash2_32_gc");typeof To!==void 0&&(To.exports=cp)});var Ji=K((vd,yr)=>{var Wi=zi(),pp=Yi();yr.exports=Wi;yr.exports.murmur3=Wi;yr.exports.murmur2=pp});var wr=K((Wf,ys)=>{var Cp={PAR_OPEN:"(".charCodeAt(0),PAR_CLOSE:")".charCodeAt(0),OP_NOT:"!".charCodeAt(0),BINARY_AND:"&".charCodeAt(0),BINARY_OR:"|".charCodeAt(0),LITERAL:"LITERAL",END:"END",LEAF:"LEAF",ATOMIC:"ATOMIC"};ys.exports=Cp});var _s=K((Jf,bs)=>{var Ie=wr(),Rp=n(t=>{let e="",r=[];for(let o of t){let i=o.charCodeAt(0);switch(i){case Ie.PAR_OPEN:case Ie.PAR_CLOSE:case Ie.OP_NOT:case Ie.BINARY_AND:case Ie.BINARY_OR:e&&(r.push({type:Ie.LITERAL,value:e}),e=""),r.push({type:i,value:o});break;default:e+=o}}return e&&r.push({type:Ie.LITERAL,value:e}),r},"Tokenizer");bs.exports=Rp});var Es=K((Kf,Ss)=>{var Se=wr(),Ap=n(t=>{let e=[],r=[];return t.forEach(i=>{switch(i.type){case Se.LITERAL:e.unshift(i);break;case Se.BINARY_AND:case Se.BINARY_OR:case Se.OP_NOT:case Se.PAR_OPEN:r.push(i);break;case Se.PAR_CLOSE:for(;r.length&&r[r.length-1].type!==Se.PAR_OPEN;)e.unshift(r.pop());r.pop(),r.length&&r[r.length-1].type===Se.OP_NOT&&e.unshift(r.pop());break;default:break}}),r.length&&[...r.reverse(),...e]||e},"PolishNotation"),Np=n(function*(t){for(let e=0;e<t.length-1;e++)yield t[e];return t[t.length-1]},"PolishGenerator");Ss.exports={PolishNotation:Ap,PolishGenerator:Np}});var vs=K((Qf,xs)=>{var U=wr(),j=class{constructor(e,r,o,i){this.op=e,this.left=r,this.right=o,this.literal=i}isLeaf(){return this.op===U.LEAF}isAtomic(){return this.isLeaf()||this.op===U.OP_NOT&&this.left.isLeaf()}getLiteralValue(){return this.literal}static CreateAnd(e,r){return new j(U.BINARY_AND,e,r)}static CreateNot(e){return new j(U.OP_NOT,e)}static CreateOr(e,r){return new j(U.BINARY_OR,e,r)}static CreateLiteral(e){return new j(U.LEAF,null,null,e)}};n(j,"ExpNode");var st=n(t=>{let e=t.next().value;switch(e.type){case U.LITERAL:return j.CreateLiteral(e.value);case U.OP_NOT:return j.CreateNot(st(t));case U.BINARY_AND:{let r=st(t),o=st(t);return j.CreateAnd(r,o)}case U.BINARY_OR:{let r=st(t),o=st(t);return j.CreateOr(r,o)}}return null},"make"),at=n((t,e)=>{if(t.isLeaf())return e(t.getLiteralValue());if(t.op===U.OP_NOT)return!at(t.left,e);if(t.op===U.BINARY_OR)return at(t.left,e)||at(t.right,e);if(t.op===U.BINARY_AND)return at(t.left,e)&&at(t.right,e)},"nodeEvaluator");xs.exports={make:st,nodeEvaluator:at}});var ws=K((Zf,Ps)=>{var Ip=_s(),Os=Es(),Ts=vs(),kp=n((t,e)=>{let r=Ip(t),o=Os.PolishNotation(r),i=Os.PolishGenerator(o),s=Ts.make(i);return Ts.nodeEvaluator(s,e)},"parse");Ps.exports={parse:kp}});var qu={};An(qu,{addOptinChangedCallback:()=>du,addTemplate:()=>fu,autoInit:()=>Iu,clear:()=>hu,config:()=>mu,default:()=>ku,disableOptinChangedCallbacks:()=>gu,getOptins:()=>yu,getProductsForPurchasePost:()=>bu,initialize:()=>_u,isReady:()=>uu,offers:()=>v,platform:()=>D,previewMode:()=>Su,register:()=>Eu,resolveSettings:()=>xu,setAuthUrl:()=>vu,setEnvironment:()=>Ou,setLocale:()=>Tu,setMerchantId:()=>Pu,setPublicPath:()=>wu,setTemplates:()=>Cu,setupCart:()=>Ru,setupProduct:()=>Au,setupProducts:()=>Nu,store:()=>ka});function to(t){var e,r=t.Symbol;return typeof r=="function"?r.observable?e=r.observable:(e=r("observable"),r.observable=e):e="@@observable",e}n(to,"symbolObservablePonyfill");var De;typeof self<"u"?De=self:typeof window<"u"||typeof window<"u"?De=window:typeof module<"u"?De=module:De=Function("return this")();var Va=to(De),ro=Va;var oo=n(function(){return Math.random().toString(36).substring(7).split("").join(".")},"randomString"),ft={INIT:"@@redux/INIT"+oo(),REPLACE:"@@redux/REPLACE"+oo(),PROBE_UNKNOWN_ACTION:n(function(){return"@@redux/PROBE_UNKNOWN_ACTION"+oo()},"PROBE_UNKNOWN_ACTION")};function ja(t){if(typeof t!="object"||t===null)return!1;for(var e=t;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}n(ja,"isPlainObject");function no(t,e,r){var o;if(typeof e=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error("It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function.");if(typeof e=="function"&&typeof r>"u"&&(r=e,e=void 0),typeof r<"u"){if(typeof r!="function")throw new Error("Expected the enhancer to be a function.");return r(no)(t,e)}if(typeof t!="function")throw new Error("Expected the reducer to be a function.");var i=t,s=e,a=[],c=a,p=!1;function l(){c===a&&(c=a.slice())}n(l,"ensureCanMutateNextListeners");function d(){if(p)throw new Error("You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return s}n(d,"getState");function u(m){if(typeof m!="function")throw new Error("Expected the listener to be a function.");if(p)throw new Error("You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api-reference/store#subscribelistener for more details.");var b=!0;return l(),c.push(m),n(function(){if(!!b){if(p)throw new Error("You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api-reference/store#subscribelistener for more details.");b=!1,l();var E=c.indexOf(m);c.splice(E,1),a=null}},"unsubscribe")}n(u,"subscribe");function h(m){if(!ja(m))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(typeof m.type>"u")throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(p)throw new Error("Reducers may not dispatch actions.");try{p=!0,s=i(s,m)}finally{p=!1}for(var b=a=c,O=0;O<b.length;O++){var E=b[O];E()}return m}n(h,"dispatch");function _(m){if(typeof m!="function")throw new Error("Expected the nextReducer to be a function.");i=m,h({type:ft.REPLACE})}n(_,"replaceReducer");function S(){var m,b=u;return m={subscribe:n(function(E){if(typeof E!="object"||E===null)throw new TypeError("Expected the observer to be an object.");function w(){E.next&&E.next(d())}n(w,"observeState"),w();var C=b(w);return{unsubscribe:C}},"subscribe")},m[ro]=function(){return this},m}return n(S,"observable"),h({type:ft.INIT}),o={dispatch:h,subscribe:u,getState:d,replaceReducer:_},o[ro]=S,o}n(no,"createStore");function Ha(t,e){var r=e&&e.type,o=r&&'action "'+String(r)+'"'||"an action";return"Given "+o+', reducer "'+t+'" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.'}n(Ha,"getUndefinedStateErrorMessage");function Ga(t){Object.keys(t).forEach(function(e){var r=t[e],o=r(void 0,{type:ft.INIT});if(typeof o>"u")throw new Error('Reducer "'+e+`" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`);if(typeof r(void 0,{type:ft.PROBE_UNKNOWN_ACTION()})>"u")throw new Error('Reducer "'+e+'" returned undefined when probed with a random type. '+("Don't try to handle "+ft.INIT+' or other actions in "redux/*" ')+"namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.")})}n(Ga,"assertReducerShape");function Vt(t){for(var e=Object.keys(t),r={},o=0;o<e.length;o++){var i=e[o];typeof t[i]=="function"&&(r[i]=t[i])}var s=Object.keys(r),a,c;try{Ga(r)}catch(p){c=p}return n(function(l,d){if(l===void 0&&(l={}),c)throw c;if(!1)var u;for(var h=!1,_={},S=0;S<s.length;S++){var m=s[S],b=r[m],O=l[m],E=b(O,d);if(typeof E>"u"){var w=Ha(m,d);throw new Error(w)}_[m]=E,h=h||E!==O}return h=h||s.length!==Object.keys(l).length,h?_:l},"combination")}n(Vt,"combineReducers");function In(t,e){return function(){return e(t.apply(this,arguments))}}n(In,"bindActionCreator");function qn(t,e){if(typeof t=="function")return In(t,e);if(typeof t!="object"||t===null)throw new Error("bindActionCreators expected an object or a function, instead received "+(t===null?"null":typeof t)+'. Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?');var r={};for(var o in t){var i=t[o];typeof i=="function"&&(r[o]=In(i,e))}return r}n(qn,"bindActionCreators");function Ba(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}n(Ba,"_defineProperty");function kn(t,e){var r=Object.keys(t);return Object.getOwnPropertySymbols&&r.push.apply(r,Object.getOwnPropertySymbols(t)),e&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),r}n(kn,"ownKeys");function za(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?kn(r,!0).forEach(function(o){Ba(t,o,r[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):kn(r).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(r,o))})}return t}n(za,"_objectSpread2");function io(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return e.length===0?function(o){return o}:e.length===1?e[0]:e.reduce(function(o,i){return function(){return o(i.apply(void 0,arguments))}})}n(io,"compose");function Dn(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return function(o){return function(){var i=o.apply(void 0,arguments),s=n(function(){throw new Error("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},"dispatch"),a={getState:i.getState,dispatch:n(function(){return s.apply(void 0,arguments)},"dispatch")},c=e.map(function(p){return p(a)});return s=io.apply(void 0,c)(i.dispatch),za({},i,{dispatch:s})}}}n(Dn,"applyMiddleware");function Fn(t){var e=n(function(o){var i=o.dispatch,s=o.getState;return function(a){return function(c){return typeof c=="function"?c(i,s,t):a(c)}}},"middleware");return e}n(Fn,"createThunkMiddleware");var Un=Fn();Un.withExtraArgument=Fn;var Ln=Un;var qi=se(Ht());var $n=/^og_auth=/,Ya=n((t=$n)=>(document.cookie.split(/;\s*/).find(e=>e.match(t))||"").replace($n,""),"c"),Gt=n(t=>{if(typeof t=="object")return t;let e=String(t||"").split("|");return e.length===3?{sig_field:e[0],ts:parseInt(e[1],10),sig:e[2]}:null},"r"),Wa=n(t=>new Promise((e,r)=>{let o=document.createElement("iframe");o.style.setProperty("display","none","important"),document.body.appendChild(o),o.onload=e,o.onerror=r,o.src=t}),"p"),Ja=n(t=>(t.headers.get("content-type")||"").indexOf("application/json")!==-1,"d");function Vn(){return typeof window.og_auth<"u"?Gt(window.og_auth):null}n(Vn,"a");async function Ka(t=100){return new Promise(e=>{setTimeout(()=>e(Vn()),t)})}n(Ka,"f");async function jn(t,e=Ya,r=Wa){let o;if(o=Gt(Vn())||Gt(e()),o)return o;if(t&&typeof t=="string"){let i=await fetch(t);i.status>=200&&i.status<300&&(o=e()||await(Ja(i)?i.json():Promise.resolve(r(t)).then(e)))}else o||(o=await Ka());if(o=Gt(o),o)return o;throw new Error("Unauthorized")}n(jn,"u");var R="OPTIN_PRODUCT",I="OPTOUT_PRODUCT",k="PRODUCT_CHANGE_FREQUENCY",ae="PRODUCT_CHANGE_PREPAID_SHIPMENTS",Fe="SET_MERCHANT_ID",q="REQUEST_OFFER",P="RECEIVE_OFFER",ht="PRODUCT_HAS_CHANGED",Ue="CREATED_SESSION_ID",Bt="SET_AUTH_URL",Hn="REQUEST_AUTH",zt="AUTHORIZE",xe="UNAUTHORIZED",Gn="REQUEST_ORDERS",Yt="RECEIVE_ORDERS",mt="CART_PRODUCT_KEY_HAS_CHANGED",Wt="RECEIVE_ORDER_ITEMS",Bn="FETCH_RESPONSE_ERROR",Le="SET_ENVIRONMENT_LOCAL",Me="SET_ENVIRONMENT_STAGING",$e="SET_ENVIRONMENT_DEV",Ve="SET_ENVIRONMENT_PROD",Jt="READY",zn="CONCLUDE_UPSELL",Yn="REQUEST_CREATE_IU_ORDER",Kt="CREATE_ONE_TIME",Wn="REQUEST_CONVERT_ONE_TIME",Qt="CONVERT_ONE_TIME";var je="CHECKOUT",Jn="RECEIVE_FETCH",Zt="SET_LOCALE",He="SET_CONFIG",ue="SET_PREVIEW_STANDARD_OFFER",gt="SET_PREVIEW_UPSELL_OFFER",so="SET_PREVIEW_PREPAID_OFFER",Xt="ADD_TEMPLATE",er="SET_TEMPLATES",ve="LOCAL_STORAGE_CHANGE",de="LOCAL_STORAGE_CLEAR",tr="SET_FIRST_ORDER_PLACE_DATE",rr="SET_PRODUCT_TO_SUBSCRIBE",z="RECEIVE_PRODUCT_PLANS",Q="SETUP_PRODUCT",fe="SETUP_CART",ce="RECEIVE_MERCHANT_SETTINGS",ao="SET_EXPERIMENT_VARIANT",Ge="pdp",Kn="local",or="dev",Oe="staging",Te="prod",nr="static.ordergroove.com",ir="staging.static.ordergroove.com",Qn="og-cart-updated";var cr=se(_t());var uo=n((...t)=>JSON.stringify(t),"memoizeKey"),St=n(t=>(...e)=>fetch(...t(...e)).then(r=>r.json()),"withFetchJson"),Et=n(t=>(e,...r)=>{if(!e)throw Error("host required");let[o,i={}]=t(...r);return[`${e.replace(/\/+$/,"")}${o}`,i]},"withHost"),pr=n(t=>(e,...r)=>{if(!e)throw Error("auth required");let[o,i={}]=t(...r);return[o,{...i,headers:{Authorization:JSON.stringify(e),...i.headers}}]},"withAuth"),si=n(t=>(...e)=>{let[r,o={}]=t(...e);return[r,{method:"POST",...o,body:JSON.stringify(o.body),headers:{"Content-type":"application/json",...o.headers}}]},"withJsonBody"),ai=n((t=[])=>(Array.isArray(t)?t:Object.entries(t)).map(([e,r])=>[e,encodeURIComponent(r)].join("=")).join("&"),"toQuery"),kc=n(t=>JSON.stringify([].concat(t).map(e=>typeof e=="object"?e.id:e).filter(e=>e)),"toProductId"),qc=(0,cr.default)(St(Et((t,e,r,o="pdp",i={})=>{if(!t)throw Error("merchantId required");if(!e)throw Error("sessionId required");if(!r)throw Error("product required");let s=[["session_id",e],["page_type",1],["p",kc(r)],["module_view",JSON.stringify(["regular"])],...Object.entries(i)];return[`/offer/${t}/${o}?${ai(s)}`]})),uo),Dc=(0,cr.default)(St(Et(pr((t=1,e="place")=>[`/orders/?${ai([["status",t],["ordering",e],["exclude_prepaid_orders","true"]])}`]))),uo),Fc=(0,cr.default)(St(Et(pr(t=>{if(!t)throw Error("orderId required");return[`/items/?order=${t}`]}))),uo),Uc=St(Et(pr(si((t,e,r,o)=>{if(!t)throw Error("product required");if(!e)throw Error("order required");if(!r)throw Error("quantity required");if(r<=0)throw Error("quantity must be greater or equal than one");if(!o)throw Error("offer required");return["/items/iu/",{body:{product:t,order:e,quantity:r,offer:o}}]})))),xt=n(t=>{if(typeof t=="object")return{...t};let[e,r]=(t||"").split(/_/).map(o=>parseInt(o,10));return e&&r&&{every:e,every_period:r}},"parseFrequency"),fo=n(t=>t.match(/^\d+_\d$/),"isFrequencyValid"),Lc=n((t,e)=>String.prototype.localeCompare.call(t&&t.split("_").reverse().join("_"),e&&e.split("_").reverse().join("_")),"compareFrequencies"),ci=n(t=>[...new Set(t&&t.split(/\s+/))].filter(fo).sort(Lc),"parseFrequenciesList");var vt=n(t=>{if(typeof t=="object"){let{every:e,period:r,every_period:o}=t;return`${e}_${r||o}`}return typeof t=="string"?t:""},"stringifyFrequency"),Mc=St(Et(pr(si((t,e,r,o)=>{if(!t)throw Error("item required");if(!e)throw Error("frequency required");let i=xt(e);if(!i)throw Error("invalid frequency");return["/subscriptions/create_from_item/",{body:{item:t.public_id,offer:r,session_id:o,...i}}]})))),ze={fetchOffer:qc,fetchOrders:Dc,fetchItems:Fc,createOneTime:Uc,convertOneTimeToSubscription:Mc},pi=ze;var ho=Ot(),D={shopify:typeof window.Shopify!="undefined",shopify_selling_plans:typeof(ho==null?void 0:ho.dataset.shopifySellingPlans)!="undefined"};function $c(t,e){return t===e}n($c,"defaultEqualityCheck");function Vc(t,e,r){if(e===null||r===null||e.length!==r.length)return!1;for(var o=e.length,i=0;i<o;i++)if(!t(e[i],r[i]))return!1;return!0}n(Vc,"areArgumentsShallowlyEqual");function jc(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:$c,r=null,o=null;return function(){return Vc(e,r,arguments)||(o=t.apply(null,arguments)),r=arguments,o}}n(jc,"defaultMemoize");function Hc(t){var e=Array.isArray(t[0])?t[0]:t;if(!e.every(function(o){return typeof o=="function"})){var r=e.map(function(o){return typeof o}).join(", ");throw new Error("Selector creators expect all input-selectors to be functions, "+("instead received the following types: ["+r+"]"))}return e}n(Hc,"getDependencies");function Gc(t){for(var e=arguments.length,r=Array(e>1?e-1:0),o=1;o<e;o++)r[o-1]=arguments[o];return function(){for(var i=arguments.length,s=Array(i),a=0;a<i;a++)s[a]=arguments[a];var c=0,p=s.pop(),l=Hc(s),d=t.apply(void 0,[function(){return c++,p.apply(null,arguments)}].concat(r)),u=t(function(){for(var h=[],_=l.length,S=0;S<_;S++)h.push(l[S].apply(null,arguments));return d.apply(null,h)});return u.resultFunc=p,u.dependencies=l,u.recomputations=function(){return c},u.resetRecomputations=function(){return c=0},u}}n(Gc,"createSelectorCreator");var Z=Gc(jc);var Y=se(_t());Y.default.Cache=Map;function Bc(t,e){if(t===e)return!0;if(t===null||e===null||t.length!==e.length)return!1;for(let r=0;r<t.length;++r)if(t[r]!==e[r])return!1;return!0}n(Bc,"arraysEqual");function zc(t,e,r){let o=vt(r);return D.shopify_selling_plans?re(t,e,o):o}n(zc,"resolveFrequency");var A=n((t,e)=>!!(t===e||typeof t=="object"&&typeof e=="object"&&t&&e&&t.id===e.id&&(!(Array.isArray(t.components)&&Array.isArray(e.components))||Bc((t.components||[]).sort(),(e.components||[]).sort()))),"isSameProduct"),Tt=n(t=>t.optedin||[],"optedinSelector"),li=n(t=>t.optedout||[],"optedoutSelector"),mo=n(t=>t.autoshipByDefault||{},"autoshipSelector"),Yc=n(t=>t.defaultFrequencies||{},"defaultFrequenciesSelector"),Wc=n(t=>{var e;return((e=t==null?void 0:t.config)==null?void 0:e.frequencies)||[]},"sellingPlansSelector"),Jc=n(t=>{var e;return((e=t==null?void 0:t.config)==null?void 0:e.frequenciesEveryPeriod)||[]},"frequenciesEveryPeriodSelector"),Kc=n(t=>{var e;return((e=t==null?void 0:t.config)==null?void 0:e.prepaidSellingPlans)||[]},"prepaidSellingPlansSelector"),Qc=n(t=>(t==null?void 0:t.prepaidShipmentsSelected)||{},"prepaidShipmentsSelectedSelector"),X=(0,Y.default)(t=>Z(Tt,li,mo,(e,r,o)=>{let i=e.find(s=>A(t,s));return i||(r.find(s=>A(t,s))?!1:t&&o[t.id]?{id:t.id}:!1)}),t=>JSON.stringify(t)),lr=(0,Y.default)(t=>Z(Tt,e=>{let r=e.find(o=>A(t,o));return r||!1}),t=>JSON.stringify(t)),ui=(0,Y.default)(t=>Z(Tt,e=>e.some(r=>A(t,r)&&r.prepaidShipments)),t=>JSON.stringify(t)),ee=(0,Y.default)(t=>Z(Qc,e=>e[t.id]||null),t=>JSON.stringify(t)),ur=(0,Y.default)(t=>Z(li,e=>e.find(r=>A(t,r))));var te=(0,Y.default)(t=>Z(X(t),e=>e&&e.frequency||null)),L=(0,Y.default)(t=>Z(X(t),e=>e&&e.prepaidShipments||null)),M=(0,Y.default)(t=>Z(Kc,e=>{var o;return(((o=e[T(t)])==null?void 0:o.map(({numberShipments:i})=>i))||[]).sort((i,s)=>i-s)})),Ye=(0,Y.default)(t=>Z(Yc,Wc,Jc,(e,r,o)=>e[T(t)]&&zc(r,o,e[T(t)])||null)),go=n(t=>t.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase(),"kebabCase"),$=n((t,e,r,o)=>({[r]:t.config&&t.config[r]||e&&e.hasAttribute&&e.hasAttribute(go(r))&&e[r]||e.offer&&typeof(e.offer[r]!=="undefined")&&e.offer[r]||o}),"configSelector"),We=n(t=>({templates:t.templates||[]}),"templatesSelector");function dr(t){document.readyState==="loading"?window.addEventListener("DOMContentLoaded",t):t()}n(dr,"onReady");function Ot(){return document.querySelector([`script[src^="https://${nr}"]`,`script[src^="https://${ir}"]`,`script[src^="http://${nr}"]`,`script[src^="http://${ir}"]`].join(","))}n(Ot,"getMainJs");function yo(){let t=Ot();if(!t)return[];let e=new URL(t.src),r=e.host.startsWith(Oe)?Oe:Te,o=e.pathname.split("/")[1];return!r&&!o?[]:[o,r,t]}n(yo,"resolveEnvAndMerchant");var T=n(t=>{var r;if(!t)return"";let e=`${t.id||t}`;return(r=D)!=null&&r.shopify_selling_plans&&(e=e.split(":")[0]),e},"safeProductId"),di=n((t,e)=>{var r;if(D.shopify_selling_plans){let o=(r=e.frequencies)==null?void 0:r.indexOf(t);if(o>=0&&e.frequenciesEveryPeriod[o])return e.frequenciesEveryPeriod[o]}return t},"safeOgFrequency"),Pt=n((t,e)=>{var o,i,s;if(!`${t}`.includes("_"))return t;let r=(o=e.frequenciesEveryPeriod)==null?void 0:o.indexOf(t);return r>=0&&e.frequenciesEveryPeriod[r]?e.frequencies[r]:((i=e.frequencies)==null?void 0:i.length)>0&&((s=e.frequenciesEveryPeriod)==null?void 0:s.length)>0?(console.warn(`Unable to find selling plan match for frequency ${t}; falling back to first selling plan`),e.frequencies[0]):t},"frequencyToSellingPlan");function fi(t){if(t.isReady())return;console.info("OG offers are auto initializing");let[e,r]=yo();if(!r&&!e)return;let o=document.createElement("script");o.onload=()=>console.info("OG pull initialization chunk for merchant",e,r),o.onerror=()=>t.initialize(e,r),o.src=`${window.location.protocol}//${r===Te?nr:ir}/${e}/main.js?initOnly=true`,document.head.appendChild(o)}n(fi,"autoInitializeOffers");var hi=n(t=>{document.cookie=`${t}=; expires=Thu, 01 Jan 1970 00:00:01 GMT;`},"clearCookie");function mi(t){let e=document.cookie.match(`(^|;) ?${t}=([^;]*)(;|$)`);return e?e[2]:null}n(mi,"getCookieValue");var Je=n(t=>!!(t&&(t==null?void 0:t.includes("_"))),"isOgFrequency"),he=n((t=[])=>(t==null?void 0:t[0])||null,"getFirstSellingPlan"),fr=n((t=[],e=[])=>{var r;return!!(((r=D)==null?void 0:r.shopify_selling_plans)&&t.length&&e.length)},"hasShopifySellingPlans"),re=n((t,e,r)=>{if(t.length!==e.length)return null;let o=e.findIndex(i=>i===r);return o>=0?t[o]:null},"mapFrequencyToSellingPlan");function bo(t,e,r){let o=t.querySelector(`[name="${e}"]`);if(o&&!r){o.remove();return}!o&&r&&(o=document.createElement("input"),o.type="hidden",o.name=e,t.appendChild(o)),o&&(o.value=r)}n(bo,"getOrCreateHidden");function Ke(t,e){let[[r],o]=t.reduce((i,s)=>i[A(e,s)?0:1].push(s)&&i,[[],[]]);return[r||{},o||[]]}n(Ke,"getMatchingProductIfExists");var W=n((t,e,r)=>({type:R,payload:{product:t,frequency:e,offer:r}}),"optinProduct"),Qe=n((t,e)=>({type:I,payload:{product:t,offer:e}}),"optoutProduct"),gi=n((t,e)=>({type:ht,payload:{newProduct:t,product:e}}),"productHasChangedComponents"),mr=n((t,e,r)=>({type:k,payload:{product:t,frequency:e,offer:r}}),"productChangeFrequency"),ge=n((t,e,r)=>({type:ae,payload:{product:t,prepaidShipments:e,offer:r}}),"productChangePrepaidShipments");var yi=n(t=>({type:zn,payload:{product:t}}),"concludeUpsell"),bi=n(t=>({type:Fe,payload:t}),"setMerchantId"),_o=n(t=>({type:Ue,payload:`${t}.${Math.floor(Math.random()*999999)}.${Math.round(new Date().getTime()/1e3)}`}),"createSessionId"),Zc=n(t=>({type:Hn,payload:t}),"requestAuth"),wt=n((t,e,r,o)=>({type:zt,payload:{public_id:t,sig_field:e,ts:r,sig:o}}),"authorize"),me=n(t=>({type:xe,payload:t}),"unauthorized"),_i=n(t=>({type:Bt,payload:t}),"setAuthUrl"),Ct=n(t=>({type:Jn,payload:t}),"fetchDone"),Si=n((t=jn)=>n(function(r,o){if(window.og&&window.og.previewMode)return r(me({message:"Offers are running in preview mode"}));let{merchantId:i,authUrl:s}=o(),a=Zc(s);return r(a),t(s).then(({sig_field:c,ts:p,sig:l})=>r(wt(i,c,p,l)),c=>r(me(c))).finally(()=>r(Ct(a)))},"fetchAuthThunk"),"fetchAuth"),Xc=n((t,e)=>({type:Gn,payload:{status:t,ordering:e}}),"requestOrders"),So=n(t=>({type:Yt,payload:t}),"receiveOrders"),Eo=n(t=>({type:Wt,payload:t}),"receiveItems"),gr=n((t=1,e="place")=>n(function(o,i){let{environment:{legoUrl:s},auth:a}=i();if(!a)return o(me("No auth set."));let c=Xc(t,e);return o(c),ze.fetchOrders(s,a,t,e).then(p=>{if(p.results){o(So(p));let l=(p.results[0]||{}).public_id;if(l)return ze.fetchItems(s,a,l).then(d=>o(Eo(d)))}return o(me(p.detail)),null},p=>o(me(p))).finally(()=>o(Ct(c)))},"fetchOrdersThunk"),"fetchOrders"),Ei=n(t=>{switch(t){case Kn:return{type:Le,payload:t};case or:return{type:$e,payload:t};case Oe:return{type:Me,payload:t};case Te:return{type:Ve,payload:t};default:throw new Error(`${t} is not a supported environment`)}},"setEnvironment"),xi=n(()=>(t,e)=>{let{merchantId:r,sessionId:o}=e();return(!o||r&&!o.startsWith(r))&&t(_o(r)),o},"requestSessionId"),ye=n((t,e)=>({type:P,payload:{...t,offer:e}}),"receiveOffer"),hr=n(t=>({type:Bn,payload:t}),"fetchResponseError"),xo=n((t,e=Ge,r)=>({type:q,payload:{product:t,module:e,offer:r}}),"requestOffer"),vi=xo,Oi=n(()=>({type:je}),"checkout"),ep=n((t,e,r,o)=>({type:Yn,payload:{product:t,order:e,quantity:r,offerId:o}}),"requestCreateOneTime"),tp=n(t=>({type:Kt,payload:t}),"receiveCreateOneTime"),rp=n((t,e)=>({type:Wn,payload:{item:t,frequency:e}}),"requestConvertOneTimeToSubscription"),op=n((t,e)=>({type:Qt,payload:{response:t,product:e}}),"receiveConvertOneTime"),Ti=n((t,e,r,o=!1,i=null)=>n(function(a,c){let{auth:p,config:l,environment:{legoUrl:d},previewUpsellOffer:u,offerId:h,sessionId:_}=c();if(!p)return a(me("No auth set."));let S=di(i,l),m=ep(t,e,r,h);return a(m),(u?Promise.resolve({legoUrl:d,product:t,order:e,quantity:r,offer:h}):ze.createOneTime(d,p,t.id,e,r,h)).then(b=>(a(tp(b)),o?(a(rp(b,S)),(u?Promise.resolve({item:b,frequency:S}):ze.convertOneTimeToSubscription(d,p,b,S,h,_)).then(O=>a(op(O,t)),O=>a(hr(O)))):b),b=>a(hr(b))).finally(()=>a(Ct(m)))},"createIuThunk"),"createIu"),Pi=n(t=>({type:Zt,payload:t}),"setLocale"),wi=n(t=>({type:He,payload:t}),"setConfig"),Ci=n((t,e,r)=>({type:Xt,payload:{selector:t,markup:e,config:r}}),"addTemplate"),Ri=n(t=>({type:er,payload:t}),"setTemplates"),Ai=n((t,e)=>({type:tr,payload:{product:t,firstOrderPlaceDate:e}}),"setFirstOrderPlaceDate"),Ni=n((t,e)=>({type:rr,payload:{product:t,productToSubscribe:e}}),"setProductToSubscribe"),Ii=n(t=>({type:ce,payload:t}),"receiveMerchantSettings");var Rt="OG_STATE",Di=n(t=>{try{return t===null?void 0:JSON.parse(t)}catch{return}},"safeParseState"),vo=n(()=>window.og&&window.og.previewMode,"isPreviewMode"),Fi=n(()=>vo()?{}:Di(localStorage.getItem(Rt)),"loadState"),np=n(t=>!t||!t.sessionId?!1:JSON.stringify({sessionId:t.sessionId,optedin:t.optedin,optedout:t.optedout,productOffer:t.productOffer,firstOrderPlaceDate:t.firstOrderPlaceDate,productToSubscribe:t.productToSubscribe}),"serializeState"),Ui=n(t=>{if(vo())return;t&&t.sessionId&&(document.cookie="og_session_id="+encodeURIComponent(t.sessionId)+"; path=/; expires=Fri, 31 Dec 9999 23:59:59 GMT; SameSite=Lax");let e=np(t);e&&localStorage.getItem(Rt)!==e&&localStorage.setItem(Rt,e)},"saveState"),Li=n(t=>(0,qi.throttle)(500,e=>{if(vo())return;let{key:r,newValue:o}=e;r===Rt&&o===null?(t.dispatch({type:de}),setTimeout(()=>t.dispatch(xi()),0)):r===Rt&&t.dispatch({type:ve,newValue:Di(o)})}),"listenLocalStorageChanges");var $i=se(Ht());var ip=n((t,e,r=document)=>r.dispatchEvent(new CustomEvent(t,{detail:e})),"dispatchEvent"),Mi=n(t=>({payload:{product:{id:e,components:r}={}}={}}={})=>setTimeout(()=>ip("optin-changed",{productId:e,components:r,optedIn:t}),0),"dispatchOptinChangedEvent"),sp=[{expressions:[({type:t}={})=>t===R,({type:t}={})=>t===k],fn:Mi(!0)},{expressions:[({type:t}={})=>t===I],fn:Mi(!1)}],Vi=n(t=>e=>r=>{let o=t.getState();sp.forEach(i=>{i.expressions.some(s=>s(r,o))&&i.fn(r)}),e(r)},"dispatchMiddleware"),ji=n(t=>e=>r=>{var i;let o;switch(r.type){case P:case I:case R:case k:o=new CustomEvent(`og-${r.type.toLowerCase().replace(/_/g,"-")}`,{bubbles:!0,cancelable:!0,detail:r.payload}),(((i=r.payload)==null?void 0:i.offer)||document).dispatchEvent(o);break;default:}o!=null&&o.defaultPrevented||e(r)},"offerEvents"),Hi=n(t=>e=>r=>{e(r);let o=(0,$i.throttle)(500,()=>{Ui({...t.getState()})});r.type!==ve&&o()},"localStorageMiddleware");var At=n(()=>{let t,e;return[new Promise((r,o)=>{t=r,e=o}),t,e]},"waitFor");function Gi(t){let[e,r]=At(),[o,i]=At(),[s,a]=At();o.then(p=>{let{sessionId:l}=t.getState();!l||p&&!l.startsWith(p)?t.dispatch(_o(p)):a(l)});let c=Promise.all([o,e,s]);return c.then(()=>{var p;t.dispatch({type:Jt,payload:{}}),window.addEventListener("storage",Li(t)),(p=t.getState().auth)!=null&&p.ts||t.dispatch(Si())}),p=>async l=>{Le===l.type||$e===l.type||Me===l.type||Ve===l.type?r(l.payload):Fe===l.type?i(l.payload):Ue===l.type?a(l.payload):await c,p(l)}}n(Gi,"waitUntilOffersReady");function Bi(t){return e=>r=>{if(r.type===q){let{merchantId:o,sessionId:i,environment:{apiUrl:s}}=t.getState(),a=T(r.payload.product);a&&pi.fetchOffer(s,o,i,a,r.payload.module||Ge,r.payload.searchParams).then(c=>t.dispatch(ye(c,r.payload.offer)),c=>t.dispatch(hr(c))).finally(()=>t.dispatch(Ct(r)))}return e(r)}}n(Bi,"offerRequestMiddleware");var Ki=se(Ji());function lp(t,e){e.map(a=>a.weight).reduce((a,c)=>a+c,0)!==100&&console.error("OG: Sum of weights for variants must be 100. Defaulting to last variant.");let i=Ki.default.murmur3(t,0)%100,s=0;for(let a=0;a<e.length;a++){let c=e[a],p=s+c.weight;if(c.weight>0&&i<p)return a;s=p}return e.length-1}n(lp,"getVariantIx");function br(t={},e){var r;switch(e.type){case ce:return{...t,...e.payload.experiments};case ao:return{...t,currentVariant:e.payload.index,offerProfileId:(r=e.payload.parameters)==null?void 0:r.offer_profile_public_id};default:return t}}n(br,"experimentsReducer");function up(t,e){let r=t==null?void 0:t.public_id;if(!r)return null;let o=t.variants,i=lp(`${r}|${e}`,o);return{...o[i],index:i}}n(up,"getAssignedExperimentVariant");function Qi(t){let[e,r]=At(),o,i;return s=>async a=>{if(a.type===Jt)r();else if(a.type===ce){await e,i=a.payload.experiments;let{sessionId:c}=t.getState();o=up(i,c),o&&t.dispatch({type:ao,payload:o})}else a.type===q&&(await e,o&&(a.payload.searchParams={...a.payload.searchParams,variant:o.public_id}));return s(a)}}n(Qi,"experimentsMiddleware");function Zi(t,...e){if(window.og&&window.og.store)return window.og.store;let r=window.og&&window.og.previewMode,o=typeof window=="object"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({name:"Ordergroove Offers"}):io,i=[Gi,Ln,Qi,Bi,Vi,ji],s={};if(!r)try{s=Fi(),i.push(Hi)}catch{}let a=o(Dn(...i,...e.filter(p=>p))),c=no(t,s,a);return window.og=window.og||{},window.og.store=c,c}n(Zi,"makeStore");var dp=Object.defineProperty,_r=n((t,e)=>dp(t,"name",{value:e,configurable:!0}),"i"),fp=_r(t=>e=>t.indexOf(e.origin)>=0,"createIsMessageAllowed"),es=["https://rc3.ordergroove.com","https://rc3.stg.ordergroove.com","https://rc3-beta.stg.ordergroove.com","http://localhost:3000","http://localhost:3010","http://0.0.0.0:3010",window.location.origin],Xi=_r(t=>(e,r)=>{es.forEach(o=>t.postMessage({ogType:e,...r},o))},"createBroadcastMessage");function Po(t=window.opener,e=window.og){let r=_r(o=>{let i=fp(es),s=Xi(o.source),a=o.data.options||{};if(i(o)&&o.data.ogType==="READY"){let c="//static.ordergroove.com/@ordergroove/offers-live-editor/0.6.7/dist/";c.startsWith("//")&&(c=window.location.protocol+c),c.endsWith("/")||(c+="/"),import(`${c}client.js`).then(({initializeClient:p})=>{p({isMessageAllowed:i,broadcastMessage:s,options:a,og:e}),window.removeEventListener("message",r)})}},"handleReady");t&&t!==window&&(window.addEventListener("message",r),Xi(t)("READY"))}n(Po,"h");_r(Po,"offersLiveEditor");var Sr=null,hp=n(t=>({dispatch:t}),"defaultMapDispatchToProps"),ts=n(t=>{if(!Sr)throw new Error("Missing redux store.");return Sr},"resolveStore"),mp=n((t,e)=>r=>{let{getState:o,dispatch:i}=ts(r),s=t?t(o(),r):{},a=e(i,r);Object.assign(r,s,a)},"createRecalcProps"),g=n((t,e=hp)=>r=>{let i=mp(t,typeof e=="function"?e:s=>qn(e,s));return class extends r{get store(){return Sr}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this._storeUnsubscribe=ts(this).subscribe(()=>i(this)),i(this)}attributeChangedCallback(s,a,c){super.attributeChangedCallback&&super.attributeChangedCallback(s,a,c),this._storeUnsubscribe&&a!==c&&i(this)}disconnectedCallback(){this._storeUnsubscribe(),super.disconnectedCallback&&super.disconnectedCallback()}}},"connect"),rs=n(t=>{Sr=t},"setStore");var wo=n((t={},e=[])=>(t.optedin||[]).map(r=>{let o={product:r.id,subscription_info:{components:r.components||[]},tracking_override:{offer:((t.productOffer||{})[r.id]||[])[0],...t.sessionId&&{session_id:t.sessionId},...xt(r.frequency)}};return t.firstOrderPlaceDate&&t.firstOrderPlaceDate[r.id]&&(o.subscription_info.first_order_place_date=t.firstOrderPlaceDate[r.id]),t.productToSubscribe&&t.productToSubscribe[r.id]&&(o.tracking_override.product=t.productToSubscribe[r.id]),o}).filter(r=>r.tracking_override.offer).filter(r=>e.length?e.includes(r.product):r),"getProductsForPurchasePost"),Ze=n((t={})=>{let e={};return Object.entries(t).forEach(([r,o])=>{Object.entries(o).forEach(([i,s])=>{let a={};s&&!Array.isArray(s)?a=s:a={frequency:i,prepaidShipments:null,regularPrice:s[0],subscriptionPrice:s[2],discountRate:s[1]},e[r]?e[r].push(a):e[r]=[a]})}),e},"getObjectStructuredProductPlans");var Co=typeof window<"u"&&window.customElements!=null&&window.customElements.polyfillWrapFlushCallback!==void 0;var Ce=n((t,e,r=null)=>{for(;e!==r;){let o=e.nextSibling;t.removeChild(e),e=o}},"removeNodes");var V=`{{lit-${String(Math.random()).slice(2)}}}`,Ro=`<!--${V}-->`,os=new RegExp(`${V}|${Ro}`),Xe="$lit$",be=class{constructor(e,r){this.parts=[],this.element=r;let o=[],i=[],s=document.createTreeWalker(r.content,133,null,!1),a=0,c=-1,p=0,{strings:l,values:{length:d}}=e;for(;p<d;){let u=s.nextNode();if(u===null){s.currentNode=i.pop();continue}if(c++,u.nodeType===1){if(u.hasAttributes()){let h=u.attributes,{length:_}=h,S=0;for(let m=0;m<_;m++)ns(h[m].name,Xe)&&S++;for(;S-- >0;){let m=l[p],b=Er.exec(m)[2],O=b.toLowerCase()+Xe,E=u.getAttribute(O);u.removeAttribute(O);let w=E.split(os);this.parts.push({type:"attribute",index:c,name:b,strings:w}),p+=w.length-1}}u.tagName==="TEMPLATE"&&(i.push(u),s.currentNode=u.content)}else if(u.nodeType===3){let h=u.data;if(h.indexOf(V)>=0){let _=u.parentNode,S=h.split(os),m=S.length-1;for(let b=0;b<m;b++){let O,E=S[b];if(E==="")O=oe();else{let w=Er.exec(E);w!==null&&ns(w[2],Xe)&&(E=E.slice(0,w.index)+w[1]+w[2].slice(0,-Xe.length)+w[3]),O=document.createTextNode(E)}_.insertBefore(O,u),this.parts.push({type:"node",index:++c})}S[m]===""?(_.insertBefore(oe(),u),o.push(u)):u.data=S[m],p+=m}}else if(u.nodeType===8)if(u.data===V){let h=u.parentNode;(u.previousSibling===null||c===a)&&(c++,h.insertBefore(oe(),u)),a=c,this.parts.push({type:"node",index:c}),u.nextSibling===null?u.data="":(o.push(u),c--),p++}else{let h=-1;for(;(h=u.data.indexOf(V,h+1))!==-1;)this.parts.push({type:"node",index:-1}),p++}}for(let u of o)u.parentNode.removeChild(u)}};n(be,"Template");var ns=n((t,e)=>{let r=t.length-e.length;return r>=0&&t.slice(r)===e},"endsWith"),Nt=n(t=>t.index!==-1,"isTemplatePartActive"),oe=n(()=>document.createComment(""),"createMarker"),Er=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;var Ao=133;function No(t,e){let{element:{content:r},parts:o}=t,i=document.createTreeWalker(r,Ao,null,!1),s=It(o),a=o[s],c=-1,p=0,l=[],d=null;for(;i.nextNode();){c++;let u=i.currentNode;for(u.previousSibling===d&&(d=null),e.has(u)&&(l.push(u),d===null&&(d=u)),d!==null&&p++;a!==void 0&&a.index===c;)a.index=d!==null?-1:a.index-p,s=It(o,s),a=o[s]}l.forEach(u=>u.parentNode.removeChild(u))}n(No,"removeNodesFromTemplate");var yp=n(t=>{let e=t.nodeType===11?0:1,r=document.createTreeWalker(t,Ao,null,!1);for(;r.nextNode();)e++;return e},"countNodes"),It=n((t,e=-1)=>{for(let r=e+1;r<t.length;r++){let o=t[r];if(Nt(o))return r}return-1},"nextActiveIndexInTemplateParts");function is(t,e,r=null){let{element:{content:o},parts:i}=t;if(r==null){o.appendChild(e);return}let s=document.createTreeWalker(o,Ao,null,!1),a=It(i),c=0,p=-1;for(;s.nextNode();)for(p++,s.currentNode===r&&(c=yp(e),r.parentNode.insertBefore(e,r));a!==-1&&i[a].index===p;){if(c>0){for(;a!==-1;)i[a].index+=c,a=It(i,a);return}a=It(i,a)}}n(is,"insertNodeIntoTemplate");var bp=new WeakMap;var Re=n(t=>typeof t=="function"&&bp.has(t),"isDirective");var F={},xr={};var pe=class{constructor(e,r,o){this.__parts=[],this.template=e,this.processor=r,this.options=o}update(e){let r=0;for(let o of this.__parts)o!==void 0&&o.setValue(e[r]),r++;for(let o of this.__parts)o!==void 0&&o.commit()}_clone(){let e=Co?this.template.element.content.cloneNode(!0):document.importNode(this.template.element.content,!0),r=[],o=this.template.parts,i=document.createTreeWalker(e,133,null,!1),s=0,a=0,c,p=i.nextNode();for(;s<o.length;){if(c=o[s],!Nt(c)){this.__parts.push(void 0),s++;continue}for(;a<c.index;)a++,p.nodeName==="TEMPLATE"&&(r.push(p),i.currentNode=p.content),(p=i.nextNode())===null&&(i.currentNode=r.pop(),p=i.nextNode());if(c.type==="node"){let l=this.processor.handleTextExpression(this.options);l.insertAfterNode(p.previousSibling),this.__parts.push(l)}else this.__parts.push(...this.processor.handleAttributeExpressions(p,c.name,c.strings,this.options));s++}return Co&&(document.adoptNode(e),customElements.upgrade(e)),e}};n(pe,"TemplateInstance");var ss=window.trustedTypes&&trustedTypes.createPolicy("lit-html",{createHTML:t=>t}),Sp=` ${V} `,ne=class{constructor(e,r,o,i){this.strings=e,this.values=r,this.type=o,this.processor=i}getHTML(){let e=this.strings.length-1,r="",o=!1;for(let i=0;i<e;i++){let s=this.strings[i],a=s.lastIndexOf("<!--");o=(a>-1||o)&&s.indexOf("-->",a+1)===-1;let c=Er.exec(s);c===null?r+=s+(o?Sp:Ro):r+=s.substr(0,c.index)+c[1]+c[2]+Xe+c[3]+V}return r+=this.strings[e],r}getTemplateElement(){let e=document.createElement("template"),r=this.getHTML();return ss!==void 0&&(r=ss.createHTML(r)),e.innerHTML=r,e}};n(ne,"TemplateResult");var Or=n(t=>t===null||!(typeof t=="object"||typeof t=="function"),"isPrimitive"),vr=n(t=>Array.isArray(t)||!!(t&&t[Symbol.iterator]),"isIterable"),Ae=class{constructor(e,r,o){this.dirty=!0,this.element=e,this.name=r,this.strings=o,this.parts=[];for(let i=0;i<o.length-1;i++)this.parts[i]=this._createPart()}_createPart(){return new et(this)}_getValue(){let e=this.strings,r=e.length-1,o=this.parts;if(r===1&&e[0]===""&&e[1]===""){let s=o[0].value;if(typeof s=="symbol")return String(s);if(typeof s=="string"||!vr(s))return s}let i="";for(let s=0;s<r;s++){i+=e[s];let a=o[s];if(a!==void 0){let c=a.value;if(Or(c)||!vr(c))i+=typeof c=="string"?c:String(c);else for(let p of c)i+=typeof p=="string"?p:String(p)}}return i+=e[r],i}commit(){this.dirty&&(this.dirty=!1,this.element.setAttribute(this.name,this._getValue()))}};n(Ae,"AttributeCommitter");var et=class{constructor(e){this.value=void 0,this.committer=e}setValue(e){e!==F&&(!Or(e)||e!==this.value)&&(this.value=e,Re(e)||(this.committer.dirty=!0))}commit(){for(;Re(this.value);){let e=this.value;this.value=F,e(this)}this.value!==F&&this.committer.commit()}};n(et,"AttributePart");var ie=class{constructor(e){this.value=void 0,this.__pendingValue=void 0,this.options=e}appendInto(e){this.startNode=e.appendChild(oe()),this.endNode=e.appendChild(oe())}insertAfterNode(e){this.startNode=e,this.endNode=e.nextSibling}appendIntoPart(e){e.__insert(this.startNode=oe()),e.__insert(this.endNode=oe())}insertAfterPart(e){e.__insert(this.startNode=oe()),this.endNode=e.endNode,e.endNode=this.startNode}setValue(e){this.__pendingValue=e}commit(){if(this.startNode.parentNode===null)return;for(;Re(this.__pendingValue);){let r=this.__pendingValue;this.__pendingValue=F,r(this)}let e=this.__pendingValue;e!==F&&(Or(e)?e!==this.value&&this.__commitText(e):e instanceof ne?this.__commitTemplateResult(e):e instanceof Node?this.__commitNode(e):vr(e)?this.__commitIterable(e):e===xr?(this.value=xr,this.clear()):this.__commitText(e))}__insert(e){this.endNode.parentNode.insertBefore(e,this.endNode)}__commitNode(e){this.value!==e&&(this.clear(),this.__insert(e),this.value=e)}__commitText(e){let r=this.startNode.nextSibling;e=e??"";let o=typeof e=="string"?e:String(e);r===this.endNode.previousSibling&&r.nodeType===3?r.data=o:this.__commitNode(document.createTextNode(o)),this.value=e}__commitTemplateResult(e){let r=this.options.templateFactory(e);if(this.value instanceof pe&&this.value.template===r)this.value.update(e.values);else{let o=new pe(r,e.processor,this.options),i=o._clone();o.update(e.values),this.__commitNode(i),this.value=o}}__commitIterable(e){Array.isArray(this.value)||(this.value=[],this.clear());let r=this.value,o=0,i;for(let s of e)i=r[o],i===void 0&&(i=new ie(this.options),r.push(i),o===0?i.appendIntoPart(this):i.insertAfterPart(r[o-1])),i.setValue(s),i.commit(),o++;o<r.length&&(r.length=o,this.clear(i&&i.endNode))}clear(e=this.startNode){Ce(this.startNode.parentNode,e.nextSibling,this.endNode)}};n(ie,"NodePart");var tt=class{constructor(e,r,o){if(this.value=void 0,this.__pendingValue=void 0,o.length!==2||o[0]!==""||o[1]!=="")throw new Error("Boolean attributes can only contain a single expression");this.element=e,this.name=r,this.strings=o}setValue(e){this.__pendingValue=e}commit(){for(;Re(this.__pendingValue);){let r=this.__pendingValue;this.__pendingValue=F,r(this)}if(this.__pendingValue===F)return;let e=!!this.__pendingValue;this.value!==e&&(e?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=e),this.__pendingValue=F}};n(tt,"BooleanAttributePart");var rt=class extends Ae{constructor(e,r,o){super(e,r,o),this.single=o.length===2&&o[0]===""&&o[1]===""}_createPart(){return new kt(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}};n(rt,"PropertyCommitter");var kt=class extends et{};n(kt,"PropertyPart");var as=!1;(()=>{try{let t={get capture(){return as=!0,!1}};window.addEventListener("test",t,t),window.removeEventListener("test",t,t)}catch{}})();var ot=class{constructor(e,r,o){this.value=void 0,this.__pendingValue=void 0,this.element=e,this.eventName=r,this.eventContext=o,this.__boundHandleEvent=i=>this.handleEvent(i)}setValue(e){this.__pendingValue=e}commit(){for(;Re(this.__pendingValue);){let s=this.__pendingValue;this.__pendingValue=F,s(this)}if(this.__pendingValue===F)return;let e=this.__pendingValue,r=this.value,o=e==null||r!=null&&(e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive),i=e!=null&&(r==null||o);o&&this.element.removeEventListener(this.eventName,this.__boundHandleEvent,this.__options),i&&(this.__options=Ep(e),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=e,this.__pendingValue=F}handleEvent(e){typeof this.value=="function"?this.value.call(this.eventContext||this.element,e):this.value.handleEvent(e)}};n(ot,"EventPart");var Ep=n(t=>t&&(as?{capture:t.capture,passive:t.passive,once:t.once}:t.capture),"getOptions");function Io(t){let e=Ne.get(t.type);e===void 0&&(e={stringsArray:new WeakMap,keyString:new Map},Ne.set(t.type,e));let r=e.stringsArray.get(t.strings);if(r!==void 0)return r;let o=t.strings.join(V);return r=e.keyString.get(o),r===void 0&&(r=new be(t,t.getTemplateElement()),e.keyString.set(o,r)),e.stringsArray.set(t.strings,r),r}n(Io,"templateFactory");var Ne=new Map;var _e=new WeakMap,ko=n((t,e,r)=>{let o=_e.get(e);o===void 0&&(Ce(e,e.firstChild),_e.set(e,o=new ie(Object.assign({templateFactory:Io},r))),o.appendInto(e)),o.setValue(t),o.commit()},"render");var qt=class{handleAttributeExpressions(e,r,o,i){let s=r[0];return s==="."?new rt(e,r.slice(1),o).parts:s==="@"?[new ot(e,r.slice(1),i.eventContext)]:s==="?"?[new tt(e,r.slice(1),o)]:new Ae(e,r,o).parts}handleTextExpression(e){return new ie(e)}};n(qt,"DefaultTemplateProcessor");var qo=new qt;typeof window<"u"&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.3.0");var f=n((t,...e)=>new ne(t,e,"html",qo),"html");var ps=n((t,e)=>`${t}--${e}`,"getTemplateCacheKey"),Tr=!0;typeof window.ShadyCSS>"u"?Tr=!1:typeof window.ShadyCSS.prepareTemplateDom>"u"&&(console.warn("Incompatible ShadyCSS version detected. Please update to at least @webcomponents/webcomponentsjs@2.0.2 and @webcomponents/shadycss@1.3.1."),Tr=!1);var vp=n(t=>e=>{let r=ps(e.type,t),o=Ne.get(r);o===void 0&&(o={stringsArray:new WeakMap,keyString:new Map},Ne.set(r,o));let i=o.stringsArray.get(e.strings);if(i!==void 0)return i;let s=e.strings.join(V);if(i=o.keyString.get(s),i===void 0){let a=e.getTemplateElement();Tr&&window.ShadyCSS.prepareTemplateDom(a,t),i=new be(e,a),o.keyString.set(s,i)}return o.stringsArray.set(e.strings,i),i},"shadyTemplateFactory"),Op=["html","svg"],Tp=n(t=>{Op.forEach(e=>{let r=Ne.get(ps(e,t));r!==void 0&&r.keyString.forEach(o=>{let{element:{content:i}}=o,s=new Set;Array.from(i.querySelectorAll("style")).forEach(a=>{s.add(a)}),No(o,s)})})},"removeStylesFromLitTemplates"),ls=new Set,Pp=n((t,e,r)=>{ls.add(t);let o=r?r.element:document.createElement("template"),i=e.querySelectorAll("style"),{length:s}=i;if(s===0){window.ShadyCSS.prepareTemplateStyles(o,t);return}let a=document.createElement("style");for(let l=0;l<s;l++){let d=i[l];d.parentNode.removeChild(d),a.textContent+=d.textContent}Tp(t);let c=o.content;r?is(r,a,c.firstChild):c.insertBefore(a,c.firstChild),window.ShadyCSS.prepareTemplateStyles(o,t);let p=c.querySelector("style");if(window.ShadyCSS.nativeShadow&&p!==null)e.insertBefore(p.cloneNode(!0),e.firstChild);else if(r){c.insertBefore(a,c.firstChild);let l=new Set;l.add(a),No(r,l)}},"prepareTemplateStyles"),us=n((t,e,r)=>{if(!r||typeof r!="object"||!r.scopeName)throw new Error("The `scopeName` option is required.");let o=r.scopeName,i=_e.has(e),s=Tr&&e.nodeType===11&&!!e.host,a=s&&!ls.has(o),c=a?document.createDocumentFragment():e;if(ko(t,c,Object.assign({templateFactory:vp(o)},r)),a){let p=_e.get(c);_e.delete(c);let l=p.value instanceof pe?p.value.template:void 0;Pp(o,c,l),Ce(e,e.firstChild),e.appendChild(c),_e.set(e,p)}!i&&s&&window.ShadyCSS.styleElement(e.host)},"render");var ds;window.JSCompiler_renameProperty=(t,e)=>t;var $o={toAttribute(t,e){switch(e){case Boolean:return t?"":null;case Object:case Array:return t==null?t:JSON.stringify(t)}return t},fromAttribute(t,e){switch(e){case Boolean:return t!==null;case Number:return t===null?null:Number(t);case Object:case Array:return JSON.parse(t)}return t}},fs=n((t,e)=>e!==t&&(e===e||t===t),"notEqual"),Do={attribute:!0,type:String,converter:$o,reflect:!1,hasChanged:fs},Fo=1,Uo=1<<2,Lo=1<<3,Mo=1<<4,Vo="finalized",nt=class extends HTMLElement{constructor(){super(),this.initialize()}static get observedAttributes(){this.finalize();let e=[];return this._classProperties.forEach((r,o)=>{let i=this._attributeNameForProperty(o,r);i!==void 0&&(this._attributeToPropertyMap.set(i,o),e.push(i))}),e}static _ensureClassProperties(){if(!this.hasOwnProperty(JSCompiler_renameProperty("_classProperties",this))){this._classProperties=new Map;let e=Object.getPrototypeOf(this)._classProperties;e!==void 0&&e.forEach((r,o)=>this._classProperties.set(o,r))}}static createProperty(e,r=Do){if(this._ensureClassProperties(),this._classProperties.set(e,r),r.noAccessor||this.prototype.hasOwnProperty(e))return;let o=typeof e=="symbol"?Symbol():`__${e}`,i=this.getPropertyDescriptor(e,o,r);i!==void 0&&Object.defineProperty(this.prototype,e,i)}static getPropertyDescriptor(e,r,o){return{get(){return this[r]},set(i){let s=this[e];this[r]=i,this.requestUpdateInternal(e,s,o)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this._classProperties&&this._classProperties.get(e)||Do}static finalize(){let e=Object.getPrototypeOf(this);if(e.hasOwnProperty(Vo)||e.finalize(),this[Vo]=!0,this._ensureClassProperties(),this._attributeToPropertyMap=new Map,this.hasOwnProperty(JSCompiler_renameProperty("properties",this))){let r=this.properties,o=[...Object.getOwnPropertyNames(r),...typeof Object.getOwnPropertySymbols=="function"?Object.getOwnPropertySymbols(r):[]];for(let i of o)this.createProperty(i,r[i])}}static _attributeNameForProperty(e,r){let o=r.attribute;return o===!1?void 0:typeof o=="string"?o:typeof e=="string"?e.toLowerCase():void 0}static _valueHasChanged(e,r,o=fs){return o(e,r)}static _propertyValueFromAttribute(e,r){let o=r.type,i=r.converter||$o,s=typeof i=="function"?i:i.fromAttribute;return s?s(e,o):e}static _propertyValueToAttribute(e,r){if(r.reflect===void 0)return;let o=r.type,i=r.converter;return(i&&i.toAttribute||$o.toAttribute)(e,o)}initialize(){this._updateState=0,this._updatePromise=new Promise(e=>this._enableUpdatingResolver=e),this._changedProperties=new Map,this._saveInstanceProperties(),this.requestUpdateInternal()}_saveInstanceProperties(){this.constructor._classProperties.forEach((e,r)=>{if(this.hasOwnProperty(r)){let o=this[r];delete this[r],this._instanceProperties||(this._instanceProperties=new Map),this._instanceProperties.set(r,o)}})}_applyInstanceProperties(){this._instanceProperties.forEach((e,r)=>this[r]=e),this._instanceProperties=void 0}connectedCallback(){this.enableUpdating()}enableUpdating(){this._enableUpdatingResolver!==void 0&&(this._enableUpdatingResolver(),this._enableUpdatingResolver=void 0)}disconnectedCallback(){}attributeChangedCallback(e,r,o){r!==o&&this._attributeToProperty(e,o)}_propertyToAttribute(e,r,o=Do){let i=this.constructor,s=i._attributeNameForProperty(e,o);if(s!==void 0){let a=i._propertyValueToAttribute(r,o);if(a===void 0)return;this._updateState=this._updateState|Lo,a==null?this.removeAttribute(s):this.setAttribute(s,a),this._updateState=this._updateState&~Lo}}_attributeToProperty(e,r){if(this._updateState&Lo)return;let o=this.constructor,i=o._attributeToPropertyMap.get(e);if(i!==void 0){let s=o.getPropertyOptions(i);this._updateState=this._updateState|Mo,this[i]=o._propertyValueFromAttribute(r,s),this._updateState=this._updateState&~Mo}}requestUpdateInternal(e,r,o){let i=!0;if(e!==void 0){let s=this.constructor;o=o||s.getPropertyOptions(e),s._valueHasChanged(this[e],r,o.hasChanged)?(this._changedProperties.has(e)||this._changedProperties.set(e,r),o.reflect===!0&&!(this._updateState&Mo)&&(this._reflectingProperties===void 0&&(this._reflectingProperties=new Map),this._reflectingProperties.set(e,o))):i=!1}!this._hasRequestedUpdate&&i&&(this._updatePromise=this._enqueueUpdate())}requestUpdate(e,r){return this.requestUpdateInternal(e,r),this.updateComplete}async _enqueueUpdate(){this._updateState=this._updateState|Uo;try{await this._updatePromise}catch{}let e=this.performUpdate();return e!=null&&await e,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return this._updateState&Uo}get hasUpdated(){return this._updateState&Fo}performUpdate(){if(!this._hasRequestedUpdate)return;this._instanceProperties&&this._applyInstanceProperties();let e=!1,r=this._changedProperties;try{e=this.shouldUpdate(r),e?this.update(r):this._markUpdated()}catch(o){throw e=!1,this._markUpdated(),o}e&&(this._updateState&Fo||(this._updateState=this._updateState|Fo,this.firstUpdated(r)),this.updated(r))}_markUpdated(){this._changedProperties=new Map,this._updateState=this._updateState&~Uo}get updateComplete(){return this._getUpdateComplete()}_getUpdateComplete(){return this._updatePromise}shouldUpdate(e){return!0}update(e){this._reflectingProperties!==void 0&&this._reflectingProperties.size>0&&(this._reflectingProperties.forEach((r,o)=>this._propertyToAttribute(o,this[o],r)),this._reflectingProperties=void 0),this._markUpdated()}updated(e){}firstUpdated(e){}};n(nt,"UpdatingElement");ds=Vo;nt[ds]=!0;var hs=Element.prototype,Uf=hs.msMatchesSelector||hs.webkitMatchesSelector;var Pr=window.ShadowRoot&&(window.ShadyCSS===void 0||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,jo=Symbol(),it=class{constructor(e,r){if(r!==jo)throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e}get styleSheet(){return this._styleSheet===void 0&&(Pr?(this._styleSheet=new CSSStyleSheet,this._styleSheet.replaceSync(this.cssText)):this._styleSheet=null),this._styleSheet}toString(){return this.cssText}};n(it,"CSSResult");var ms=n(t=>new it(String(t),jo),"unsafeCSS"),wp=n(t=>{if(t instanceof it)return t.cssText;if(typeof t=="number")return t;throw new Error(`Value passed to 'css' function must be a 'css' function result: ${t}. Use 'unsafeCSS' to pass non-literal values, but
|
|
12
|
-
take care to ensure page security.`)},"textFromCSSResult"),y=n((t,...e)=>{let r=e.reduce((o,i,s)=>o+wp(i)+t[s+1],t[0]);return new it(r,
|
|
11
|
+
var lib=(()=>{var Da=Object.create;var dt=Object.defineProperty;var Fa=Object.getOwnPropertyDescriptor;var Ua=Object.getOwnPropertyNames;var La=Object.getPrototypeOf,Ma=Object.prototype.hasOwnProperty;var n=(t,e)=>dt(t,"name",{value:e,configurable:!0});var K=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),In=(t,e)=>{for(var r in e)dt(t,r,{get:e[r],enumerable:!0})},kn=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Ua(e))!Ma.call(t,i)&&i!==r&&dt(t,i,{get:()=>e[i],enumerable:!(o=Fa(e,i))||o.enumerable});return t};var se=(t,e,r)=>(r=t!=null?Da(La(t)):{},kn(e||!t||!t.__esModule?dt(r,"default",{value:t,enumerable:!0}):r,t)),$a=t=>kn(dt({},"__esModule",{value:!0}),t);var Ht=K((jt,Vn)=>{(function(t,e){typeof jt=="object"&&typeof Vn<"u"?e(jt):typeof define=="function"&&define.amd?define(["exports"],e):(t=t||self,e(t.throttleDebounce={}))})(jt,function(t){"use strict";function e(o,i,s,a){var c,p=!1,l=0;function d(){c&&clearTimeout(c)}n(d,"clearExistingTimeout");function u(){d(),p=!0}n(u,"cancel"),typeof i!="boolean"&&(a=s,s=i,i=void 0);function h(){for(var _=arguments.length,S=new Array(_),m=0;m<_;m++)S[m]=arguments[m];var b=this,O=Date.now()-l;if(p)return;function E(){l=Date.now(),s.apply(b,S)}n(E,"exec");function w(){c=void 0}n(w,"clear"),a&&!c&&E(),d(),a===void 0&&O>o?E():i!==!0&&(c=setTimeout(a?w:E,a===void 0?o-O:o))}return n(h,"wrapper"),h.cancel=u,h}n(e,"throttle");function r(o,i,s){return s===void 0?e(o,i,!1):e(o,s,i!==!1)}n(r,"debounce"),t.debounce=r,t.throttle=e,Object.defineProperty(t,"__esModule",{value:!0})})});var _t=K((Hu,ai)=>{var Qa="Expected a function",ti="__lodash_hash_undefined__",Za="[object Function]",Xa="[object GeneratorFunction]",ec=/[\\^$.*+?()[\]{}|]/g,tc=/^\[object .+?Constructor\]$/,rc=typeof window=="object"&&window&&window.Object===Object&&window,oc=typeof self=="object"&&self&&self.Object===Object&&self,ri=rc||oc||Function("return this")();function nc(t,e){return t?.[e]}n(nc,"getValue");function ic(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}n(ic,"isHostObject");var sc=Array.prototype,ac=Function.prototype,oi=Object.prototype,lo=ri["__core-js_shared__"],ei=function(){var t=/[^.]+$/.exec(lo&&lo.keys&&lo.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),ni=ac.toString,uo=oi.hasOwnProperty,cc=oi.toString,pc=RegExp("^"+ni.call(uo).replace(ec,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),lc=sc.splice,uc=ii(ri,"Map"),bt=ii(Object,"create");function Pe(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}n(Pe,"Hash");function dc(){this.__data__=bt?bt(null):{}}n(dc,"hashClear");function fc(t){return this.has(t)&&delete this.__data__[t]}n(fc,"hashDelete");function hc(t){var e=this.__data__;if(bt){var r=e[t];return r===ti?void 0:r}return uo.call(e,t)?e[t]:void 0}n(hc,"hashGet");function mc(t){var e=this.__data__;return bt?e[t]!==void 0:uo.call(e,t)}n(mc,"hashHas");function gc(t,e){var r=this.__data__;return r[t]=bt&&e===void 0?ti:e,this}n(gc,"hashSet");Pe.prototype.clear=dc;Pe.prototype.delete=fc;Pe.prototype.get=hc;Pe.prototype.has=mc;Pe.prototype.set=gc;function Be(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}n(Be,"ListCache");function yc(){this.__data__=[]}n(yc,"listCacheClear");function bc(t){var e=this.__data__,r=sr(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():lc.call(e,r,1),!0}n(bc,"listCacheDelete");function _c(t){var e=this.__data__,r=sr(e,t);return r<0?void 0:e[r][1]}n(_c,"listCacheGet");function Sc(t){return sr(this.__data__,t)>-1}n(Sc,"listCacheHas");function Ec(t,e){var r=this.__data__,o=sr(r,t);return o<0?r.push([t,e]):r[o][1]=e,this}n(Ec,"listCacheSet");Be.prototype.clear=yc;Be.prototype.delete=bc;Be.prototype.get=_c;Be.prototype.has=Sc;Be.prototype.set=Ec;function we(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}n(we,"MapCache");function xc(){this.__data__={hash:new Pe,map:new(uc||Be),string:new Pe}}n(xc,"mapCacheClear");function vc(t){return ar(this,t).delete(t)}n(vc,"mapCacheDelete");function Oc(t){return ar(this,t).get(t)}n(Oc,"mapCacheGet");function Tc(t){return ar(this,t).has(t)}n(Tc,"mapCacheHas");function Pc(t,e){return ar(this,t).set(t,e),this}n(Pc,"mapCacheSet");we.prototype.clear=xc;we.prototype.delete=vc;we.prototype.get=Oc;we.prototype.has=Tc;we.prototype.set=Pc;function sr(t,e){for(var r=t.length;r--;)if(Nc(t[r][0],e))return r;return-1}n(sr,"assocIndexOf");function wc(t){if(!si(t)||Rc(t))return!1;var e=Ic(t)||ic(t)?pc:tc;return e.test(Ac(t))}n(wc,"baseIsNative");function ar(t,e){var r=t.__data__;return Cc(e)?r[typeof e=="string"?"string":"hash"]:r.map}n(ar,"getMapData");function ii(t,e){var r=nc(t,e);return wc(r)?r:void 0}n(ii,"getNative");function Cc(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}n(Cc,"isKeyable");function Rc(t){return!!ei&&ei in t}n(Rc,"isMasked");function Ac(t){if(t!=null){try{return ni.call(t)}catch{}try{return t+""}catch{}}return""}n(Ac,"toSource");function fo(t,e){if(typeof t!="function"||e&&typeof e!="function")throw new TypeError(Qa);var r=n(function(){var o=arguments,i=e?e.apply(this,o):o[0],s=r.cache;if(s.has(i))return s.get(i);var a=t.apply(this,o);return r.cache=s.set(i,a),a},"memoized");return r.cache=new(fo.Cache||we),r}n(fo,"memoize");fo.Cache=we;function Nc(t,e){return t===e||t!==t&&e!==e}n(Nc,"eq");function Ic(t){var e=si(t)?cc.call(t):"";return e==Za||e==Xa}n(Ic,"isFunction");function si(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}n(si,"isObject");ai.exports=fo});var zi=K((Ed,Po)=>{function ap(t,e){var r,o,i,s,a,c,p,l,d,u;for(r=t.length&3,o=t.length-r,i=e,a=3432918353,p=461845907,u=0;u<o;)d=t.charCodeAt(u)&255|(t.charCodeAt(++u)&255)<<8|(t.charCodeAt(++u)&255)<<16|(t.charCodeAt(++u)&255)<<24,++u,d=(d&65535)*a+(((d>>>16)*a&65535)<<16)&4294967295,d=d<<15|d>>>17,d=(d&65535)*p+(((d>>>16)*p&65535)<<16)&4294967295,i^=d,i=i<<13|i>>>19,s=(i&65535)*5+(((i>>>16)*5&65535)<<16)&4294967295,i=(s&65535)+27492+(((s>>>16)+58964&65535)<<16);switch(d=0,r){case 3:d^=(t.charCodeAt(u+2)&255)<<16;case 2:d^=(t.charCodeAt(u+1)&255)<<8;case 1:d^=t.charCodeAt(u)&255,d=(d&65535)*a+(((d>>>16)*a&65535)<<16)&4294967295,d=d<<15|d>>>17,d=(d&65535)*p+(((d>>>16)*p&65535)<<16)&4294967295,i^=d}return i^=t.length,i^=i>>>16,i=(i&65535)*2246822507+(((i>>>16)*2246822507&65535)<<16)&4294967295,i^=i>>>13,i=(i&65535)*3266489909+(((i>>>16)*3266489909&65535)<<16)&4294967295,i^=i>>>16,i>>>0}n(ap,"murmurhash3_32_gc");typeof Po<"u"&&(Po.exports=ap)});var Yi=K((xd,wo)=>{function cp(t,e){for(var r=t.length,o=e^r,i=0,s;r>=4;)s=t.charCodeAt(i)&255|(t.charCodeAt(++i)&255)<<8|(t.charCodeAt(++i)&255)<<16|(t.charCodeAt(++i)&255)<<24,s=(s&65535)*1540483477+(((s>>>16)*1540483477&65535)<<16),s^=s>>>24,s=(s&65535)*1540483477+(((s>>>16)*1540483477&65535)<<16),o=(o&65535)*1540483477+(((o>>>16)*1540483477&65535)<<16)^s,r-=4,++i;switch(r){case 3:o^=(t.charCodeAt(i+2)&255)<<16;case 2:o^=(t.charCodeAt(i+1)&255)<<8;case 1:o^=t.charCodeAt(i)&255,o=(o&65535)*1540483477+(((o>>>16)*1540483477&65535)<<16)}return o^=o>>>13,o=(o&65535)*1540483477+(((o>>>16)*1540483477&65535)<<16),o^=o>>>15,o>>>0}n(cp,"murmurhash2_32_gc");typeof wo!==void 0&&(wo.exports=cp)});var Ji=K((vd,_r)=>{var Wi=zi(),pp=Yi();_r.exports=Wi;_r.exports.murmur3=Wi;_r.exports.murmur2=pp});var Rr=K((Wf,ys)=>{var Cp={PAR_OPEN:"(".charCodeAt(0),PAR_CLOSE:")".charCodeAt(0),OP_NOT:"!".charCodeAt(0),BINARY_AND:"&".charCodeAt(0),BINARY_OR:"|".charCodeAt(0),LITERAL:"LITERAL",END:"END",LEAF:"LEAF",ATOMIC:"ATOMIC"};ys.exports=Cp});var _s=K((Jf,bs)=>{var Ie=Rr(),Rp=n(t=>{let e="",r=[];for(let o of t){let i=o.charCodeAt(0);switch(i){case Ie.PAR_OPEN:case Ie.PAR_CLOSE:case Ie.OP_NOT:case Ie.BINARY_AND:case Ie.BINARY_OR:e&&(r.push({type:Ie.LITERAL,value:e}),e=""),r.push({type:i,value:o});break;default:e+=o}}return e&&r.push({type:Ie.LITERAL,value:e}),r},"Tokenizer");bs.exports=Rp});var Es=K((Kf,Ss)=>{var Se=Rr(),Ap=n(t=>{let e=[],r=[];return t.forEach(i=>{switch(i.type){case Se.LITERAL:e.unshift(i);break;case Se.BINARY_AND:case Se.BINARY_OR:case Se.OP_NOT:case Se.PAR_OPEN:r.push(i);break;case Se.PAR_CLOSE:for(;r.length&&r[r.length-1].type!==Se.PAR_OPEN;)e.unshift(r.pop());r.pop(),r.length&&r[r.length-1].type===Se.OP_NOT&&e.unshift(r.pop());break;default:break}}),r.length&&[...r.reverse(),...e]||e},"PolishNotation"),Np=n(function*(t){for(let e=0;e<t.length-1;e++)yield t[e];return t[t.length-1]},"PolishGenerator");Ss.exports={PolishNotation:Ap,PolishGenerator:Np}});var vs=K((Qf,xs)=>{var U=Rr(),j=class{constructor(e,r,o,i){this.op=e,this.left=r,this.right=o,this.literal=i}isLeaf(){return this.op===U.LEAF}isAtomic(){return this.isLeaf()||this.op===U.OP_NOT&&this.left.isLeaf()}getLiteralValue(){return this.literal}static CreateAnd(e,r){return new j(U.BINARY_AND,e,r)}static CreateNot(e){return new j(U.OP_NOT,e)}static CreateOr(e,r){return new j(U.BINARY_OR,e,r)}static CreateLiteral(e){return new j(U.LEAF,null,null,e)}};n(j,"ExpNode");var st=n(t=>{let e=t.next().value;switch(e.type){case U.LITERAL:return j.CreateLiteral(e.value);case U.OP_NOT:return j.CreateNot(st(t));case U.BINARY_AND:{let r=st(t),o=st(t);return j.CreateAnd(r,o)}case U.BINARY_OR:{let r=st(t),o=st(t);return j.CreateOr(r,o)}}return null},"make"),at=n((t,e)=>{if(t.isLeaf())return e(t.getLiteralValue());if(t.op===U.OP_NOT)return!at(t.left,e);if(t.op===U.BINARY_OR)return at(t.left,e)||at(t.right,e);if(t.op===U.BINARY_AND)return at(t.left,e)&&at(t.right,e)},"nodeEvaluator");xs.exports={make:st,nodeEvaluator:at}});var ws=K((Zf,Ps)=>{var Ip=_s(),Os=Es(),Ts=vs(),kp=n((t,e)=>{let r=Ip(t),o=Os.PolishNotation(r),i=Os.PolishGenerator(o),s=Ts.make(i);return Ts.nodeEvaluator(s,e)},"parse");Ps.exports={parse:kp}});var qu={};In(qu,{addOptinChangedCallback:()=>du,addTemplate:()=>fu,autoInit:()=>Iu,clear:()=>hu,config:()=>mu,default:()=>ku,disableOptinChangedCallbacks:()=>gu,getOptins:()=>yu,getProductsForPurchasePost:()=>bu,initialize:()=>_u,isReady:()=>uu,offers:()=>v,platform:()=>D,previewMode:()=>Su,register:()=>Eu,resolveSettings:()=>xu,setAuthUrl:()=>vu,setEnvironment:()=>Ou,setLocale:()=>Tu,setMerchantId:()=>Pu,setPublicPath:()=>wu,setTemplates:()=>Cu,setupCart:()=>Ru,setupProduct:()=>Au,setupProducts:()=>Nu,store:()=>ka});function oo(t){var e,r=t.Symbol;return typeof r=="function"?r.observable?e=r.observable:(e=r("observable"),r.observable=e):e="@@observable",e}n(oo,"symbolObservablePonyfill");var De;typeof self<"u"?De=self:typeof window<"u"||typeof window<"u"?De=window:typeof module<"u"?De=module:De=Function("return this")();var Va=oo(De),no=Va;var io=n(function(){return Math.random().toString(36).substring(7).split("").join(".")},"randomString"),ft={INIT:"@@redux/INIT"+io(),REPLACE:"@@redux/REPLACE"+io(),PROBE_UNKNOWN_ACTION:n(function(){return"@@redux/PROBE_UNKNOWN_ACTION"+io()},"PROBE_UNKNOWN_ACTION")};function ja(t){if(typeof t!="object"||t===null)return!1;for(var e=t;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}n(ja,"isPlainObject");function so(t,e,r){var o;if(typeof e=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error("It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function.");if(typeof e=="function"&&typeof r>"u"&&(r=e,e=void 0),typeof r<"u"){if(typeof r!="function")throw new Error("Expected the enhancer to be a function.");return r(so)(t,e)}if(typeof t!="function")throw new Error("Expected the reducer to be a function.");var i=t,s=e,a=[],c=a,p=!1;function l(){c===a&&(c=a.slice())}n(l,"ensureCanMutateNextListeners");function d(){if(p)throw new Error("You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return s}n(d,"getState");function u(m){if(typeof m!="function")throw new Error("Expected the listener to be a function.");if(p)throw new Error("You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api-reference/store#subscribelistener for more details.");var b=!0;return l(),c.push(m),n(function(){if(!!b){if(p)throw new Error("You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api-reference/store#subscribelistener for more details.");b=!1,l();var E=c.indexOf(m);c.splice(E,1),a=null}},"unsubscribe")}n(u,"subscribe");function h(m){if(!ja(m))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(typeof m.type>"u")throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(p)throw new Error("Reducers may not dispatch actions.");try{p=!0,s=i(s,m)}finally{p=!1}for(var b=a=c,O=0;O<b.length;O++){var E=b[O];E()}return m}n(h,"dispatch");function _(m){if(typeof m!="function")throw new Error("Expected the nextReducer to be a function.");i=m,h({type:ft.REPLACE})}n(_,"replaceReducer");function S(){var m,b=u;return m={subscribe:n(function(E){if(typeof E!="object"||E===null)throw new TypeError("Expected the observer to be an object.");function w(){E.next&&E.next(d())}n(w,"observeState"),w();var C=b(w);return{unsubscribe:C}},"subscribe")},m[no]=function(){return this},m}return n(S,"observable"),h({type:ft.INIT}),o={dispatch:h,subscribe:u,getState:d,replaceReducer:_},o[no]=S,o}n(so,"createStore");function Ha(t,e){var r=e&&e.type,o=r&&'action "'+String(r)+'"'||"an action";return"Given "+o+', reducer "'+t+'" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.'}n(Ha,"getUndefinedStateErrorMessage");function Ga(t){Object.keys(t).forEach(function(e){var r=t[e],o=r(void 0,{type:ft.INIT});if(typeof o>"u")throw new Error('Reducer "'+e+`" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`);if(typeof r(void 0,{type:ft.PROBE_UNKNOWN_ACTION()})>"u")throw new Error('Reducer "'+e+'" returned undefined when probed with a random type. '+("Don't try to handle "+ft.INIT+' or other actions in "redux/*" ')+"namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.")})}n(Ga,"assertReducerShape");function Vt(t){for(var e=Object.keys(t),r={},o=0;o<e.length;o++){var i=e[o];typeof t[i]=="function"&&(r[i]=t[i])}var s=Object.keys(r),a,c;try{Ga(r)}catch(p){c=p}return n(function(l,d){if(l===void 0&&(l={}),c)throw c;if(!1)var u;for(var h=!1,_={},S=0;S<s.length;S++){var m=s[S],b=r[m],O=l[m],E=b(O,d);if(typeof E>"u"){var w=Ha(m,d);throw new Error(w)}_[m]=E,h=h||E!==O}return h=h||s.length!==Object.keys(l).length,h?_:l},"combination")}n(Vt,"combineReducers");function qn(t,e){return function(){return e(t.apply(this,arguments))}}n(qn,"bindActionCreator");function Fn(t,e){if(typeof t=="function")return qn(t,e);if(typeof t!="object"||t===null)throw new Error("bindActionCreators expected an object or a function, instead received "+(t===null?"null":typeof t)+'. Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?');var r={};for(var o in t){var i=t[o];typeof i=="function"&&(r[o]=qn(i,e))}return r}n(Fn,"bindActionCreators");function Ba(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}n(Ba,"_defineProperty");function Dn(t,e){var r=Object.keys(t);return Object.getOwnPropertySymbols&&r.push.apply(r,Object.getOwnPropertySymbols(t)),e&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),r}n(Dn,"ownKeys");function za(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Dn(r,!0).forEach(function(o){Ba(t,o,r[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Dn(r).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(r,o))})}return t}n(za,"_objectSpread2");function ao(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return e.length===0?function(o){return o}:e.length===1?e[0]:e.reduce(function(o,i){return function(){return o(i.apply(void 0,arguments))}})}n(ao,"compose");function Un(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return function(o){return function(){var i=o.apply(void 0,arguments),s=n(function(){throw new Error("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},"dispatch"),a={getState:i.getState,dispatch:n(function(){return s.apply(void 0,arguments)},"dispatch")},c=e.map(function(p){return p(a)});return s=ao.apply(void 0,c)(i.dispatch),za({},i,{dispatch:s})}}}n(Un,"applyMiddleware");function Ln(t){var e=n(function(o){var i=o.dispatch,s=o.getState;return function(a){return function(c){return typeof c=="function"?c(i,s,t):a(c)}}},"middleware");return e}n(Ln,"createThunkMiddleware");var Mn=Ln();Mn.withExtraArgument=Ln;var $n=Mn;var qi=se(Ht());var jn=/^og_auth=/,Ya=n((t=jn)=>(document.cookie.split(/;\s*/).find(e=>e.match(t))||"").replace(jn,""),"c"),Gt=n(t=>{if(typeof t=="object")return t;let e=String(t||"").split("|");return e.length===3?{sig_field:e[0],ts:parseInt(e[1],10),sig:e[2]}:null},"r"),Wa=n(t=>new Promise((e,r)=>{let o=document.createElement("iframe");o.style.setProperty("display","none","important"),document.body.appendChild(o),o.onload=e,o.onerror=r,o.src=t}),"p"),Ja=n(t=>(t.headers.get("content-type")||"").indexOf("application/json")!==-1,"d");function Hn(){return typeof window.og_auth<"u"?Gt(window.og_auth):null}n(Hn,"a");async function Ka(t=100){return new Promise(e=>{setTimeout(()=>e(Hn()),t)})}n(Ka,"f");async function Gn(t,e=Ya,r=Wa){let o;if(o=Gt(Hn())||Gt(e()),o)return o;if(t&&typeof t=="string"){let i=await fetch(t);i.status>=200&&i.status<300&&(o=e()||await(Ja(i)?i.json():Promise.resolve(r(t)).then(e)))}else o||(o=await Ka());if(o=Gt(o),o)return o;throw new Error("Unauthorized")}n(Gn,"u");var R="OPTIN_PRODUCT",I="OPTOUT_PRODUCT",k="PRODUCT_CHANGE_FREQUENCY",ae="PRODUCT_CHANGE_PREPAID_SHIPMENTS",Fe="SET_MERCHANT_ID",q="REQUEST_OFFER",P="RECEIVE_OFFER",ht="PRODUCT_HAS_CHANGED",Ue="CREATED_SESSION_ID",Bt="SET_AUTH_URL",Bn="REQUEST_AUTH",zt="AUTHORIZE",xe="UNAUTHORIZED",zn="REQUEST_ORDERS",Yt="RECEIVE_ORDERS",mt="CART_PRODUCT_KEY_HAS_CHANGED",Wt="RECEIVE_ORDER_ITEMS",Yn="FETCH_RESPONSE_ERROR",Le="SET_ENVIRONMENT_LOCAL",Me="SET_ENVIRONMENT_STAGING",$e="SET_ENVIRONMENT_DEV",Ve="SET_ENVIRONMENT_PROD",Jt="READY",Wn="CONCLUDE_UPSELL",Jn="REQUEST_CREATE_IU_ORDER",Kt="CREATE_ONE_TIME",Kn="REQUEST_CONVERT_ONE_TIME",Qt="CONVERT_ONE_TIME";var je="CHECKOUT",Qn="RECEIVE_FETCH",Zt="SET_LOCALE",He="SET_CONFIG",ue="SET_PREVIEW_STANDARD_OFFER",gt="SET_PREVIEW_UPSELL_OFFER",co="SET_PREVIEW_PREPAID_OFFER",Xt="ADD_TEMPLATE",er="SET_TEMPLATES",ve="LOCAL_STORAGE_CHANGE",de="LOCAL_STORAGE_CLEAR",tr="SET_FIRST_ORDER_PLACE_DATE",rr="SET_PRODUCT_TO_SUBSCRIBE",z="RECEIVE_PRODUCT_PLANS",Q="SETUP_PRODUCT",fe="SETUP_CART",ce="RECEIVE_MERCHANT_SETTINGS",po="SET_EXPERIMENT_VARIANT",Ge="pdp",Zn="local",or="dev",Oe="staging",Te="prod",nr="static.ordergroove.com",ir="staging.static.ordergroove.com",Xn="og-cart-updated";var cr=se(_t());var ho=n((...t)=>JSON.stringify(t),"memoizeKey"),St=n(t=>(...e)=>fetch(...t(...e)).then(r=>r.json()),"withFetchJson"),Et=n(t=>(e,...r)=>{if(!e)throw Error("host required");let[o,i={}]=t(...r);return[`${e.replace(/\/+$/,"")}${o}`,i]},"withHost"),pr=n(t=>(e,...r)=>{if(!e)throw Error("auth required");let[o,i={}]=t(...r);return[o,{...i,headers:{Authorization:JSON.stringify(e),...i.headers}}]},"withAuth"),ci=n(t=>(...e)=>{let[r,o={}]=t(...e);return[r,{method:"POST",...o,body:JSON.stringify(o.body),headers:{"Content-type":"application/json",...o.headers}}]},"withJsonBody"),pi=n((t=[])=>(Array.isArray(t)?t:Object.entries(t)).map(([e,r])=>[e,encodeURIComponent(r)].join("=")).join("&"),"toQuery"),kc=n(t=>JSON.stringify([].concat(t).map(e=>typeof e=="object"?e.id:e).filter(e=>e)),"toProductId"),qc=(0,cr.default)(St(Et((t,e,r,o="pdp",i={})=>{if(!t)throw Error("merchantId required");if(!e)throw Error("sessionId required");if(!r)throw Error("product required");let s=[["session_id",e],["page_type",1],["p",kc(r)],["module_view",JSON.stringify(["regular"])],...Object.entries(i)];return[`/offer/${t}/${o}?${pi(s)}`]})),ho),Dc=(0,cr.default)(St(Et(pr((t=1,e="place")=>[`/orders/?${pi([["status",t],["ordering",e],["exclude_prepaid_orders","true"]])}`]))),ho),Fc=(0,cr.default)(St(Et(pr(t=>{if(!t)throw Error("orderId required");return[`/items/?order=${t}`]}))),ho),Uc=St(Et(pr(ci((t,e,r,o)=>{if(!t)throw Error("product required");if(!e)throw Error("order required");if(!r)throw Error("quantity required");if(r<=0)throw Error("quantity must be greater or equal than one");if(!o)throw Error("offer required");return["/items/iu/",{body:{product:t,order:e,quantity:r,offer:o}}]})))),xt=n(t=>{if(typeof t=="object")return{...t};let[e,r]=(t||"").split(/_/).map(o=>parseInt(o,10));return e&&r&&{every:e,every_period:r}},"parseFrequency"),mo=n(t=>t.match(/^\d+_\d$/),"isFrequencyValid"),Lc=n((t,e)=>String.prototype.localeCompare.call(t&&t.split("_").reverse().join("_"),e&&e.split("_").reverse().join("_")),"compareFrequencies"),li=n(t=>[...new Set(t&&t.split(/\s+/))].filter(mo).sort(Lc),"parseFrequenciesList");var vt=n(t=>{if(typeof t=="object"){let{every:e,period:r,every_period:o}=t;return`${e}_${r||o}`}return typeof t=="string"?t:""},"stringifyFrequency"),Mc=St(Et(pr(ci((t,e,r,o)=>{if(!t)throw Error("item required");if(!e)throw Error("frequency required");let i=xt(e);if(!i)throw Error("invalid frequency");return["/subscriptions/create_from_item/",{body:{item:t.public_id,offer:r,session_id:o,...i}}]})))),ze={fetchOffer:qc,fetchOrders:Dc,fetchItems:Fc,createOneTime:Uc,convertOneTimeToSubscription:Mc},ui=ze;var go=Ot(),D={shopify:typeof window.Shopify!="undefined",shopify_selling_plans:typeof(go==null?void 0:go.dataset.shopifySellingPlans)!="undefined"};function $c(t,e){return t===e}n($c,"defaultEqualityCheck");function Vc(t,e,r){if(e===null||r===null||e.length!==r.length)return!1;for(var o=e.length,i=0;i<o;i++)if(!t(e[i],r[i]))return!1;return!0}n(Vc,"areArgumentsShallowlyEqual");function jc(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:$c,r=null,o=null;return function(){return Vc(e,r,arguments)||(o=t.apply(null,arguments)),r=arguments,o}}n(jc,"defaultMemoize");function Hc(t){var e=Array.isArray(t[0])?t[0]:t;if(!e.every(function(o){return typeof o=="function"})){var r=e.map(function(o){return typeof o}).join(", ");throw new Error("Selector creators expect all input-selectors to be functions, "+("instead received the following types: ["+r+"]"))}return e}n(Hc,"getDependencies");function Gc(t){for(var e=arguments.length,r=Array(e>1?e-1:0),o=1;o<e;o++)r[o-1]=arguments[o];return function(){for(var i=arguments.length,s=Array(i),a=0;a<i;a++)s[a]=arguments[a];var c=0,p=s.pop(),l=Hc(s),d=t.apply(void 0,[function(){return c++,p.apply(null,arguments)}].concat(r)),u=t(function(){for(var h=[],_=l.length,S=0;S<_;S++)h.push(l[S].apply(null,arguments));return d.apply(null,h)});return u.resultFunc=p,u.dependencies=l,u.recomputations=function(){return c},u.resetRecomputations=function(){return c=0},u}}n(Gc,"createSelectorCreator");var Z=Gc(jc);var Y=se(_t());Y.default.Cache=Map;function Bc(t,e){if(t===e)return!0;if(t===null||e===null||t.length!==e.length)return!1;for(let r=0;r<t.length;++r)if(t[r]!==e[r])return!1;return!0}n(Bc,"arraysEqual");function zc(t,e,r){let o=vt(r);return D.shopify_selling_plans?re(t,e,o):o}n(zc,"resolveFrequency");var A=n((t,e)=>!!(t===e||typeof t=="object"&&typeof e=="object"&&t&&e&&t.id===e.id&&(!(Array.isArray(t.components)&&Array.isArray(e.components))||Bc((t.components||[]).sort(),(e.components||[]).sort()))),"isSameProduct"),Tt=n(t=>t.optedin||[],"optedinSelector"),di=n(t=>t.optedout||[],"optedoutSelector"),yo=n(t=>t.autoshipByDefault||{},"autoshipSelector"),Yc=n(t=>t.defaultFrequencies||{},"defaultFrequenciesSelector"),Wc=n(t=>{var e;return((e=t==null?void 0:t.config)==null?void 0:e.frequencies)||[]},"sellingPlansSelector"),Jc=n(t=>{var e;return((e=t==null?void 0:t.config)==null?void 0:e.frequenciesEveryPeriod)||[]},"frequenciesEveryPeriodSelector"),Kc=n(t=>{var e;return((e=t==null?void 0:t.config)==null?void 0:e.prepaidSellingPlans)||[]},"prepaidSellingPlansSelector"),Qc=n(t=>(t==null?void 0:t.prepaidShipmentsSelected)||{},"prepaidShipmentsSelectedSelector"),X=(0,Y.default)(t=>Z(Tt,di,yo,(e,r,o)=>{let i=e.find(s=>A(t,s));return i||(r.find(s=>A(t,s))?!1:t&&o[t.id]?{id:t.id}:!1)}),t=>JSON.stringify(t)),lr=(0,Y.default)(t=>Z(Tt,e=>{let r=e.find(o=>A(t,o));return r||!1}),t=>JSON.stringify(t)),fi=(0,Y.default)(t=>Z(Tt,e=>e.some(r=>A(t,r)&&r.prepaidShipments)),t=>JSON.stringify(t)),ee=(0,Y.default)(t=>Z(Qc,e=>e[t.id]||null),t=>JSON.stringify(t)),ur=(0,Y.default)(t=>Z(di,e=>e.find(r=>A(t,r))));var te=(0,Y.default)(t=>Z(X(t),e=>e&&e.frequency||null)),L=(0,Y.default)(t=>Z(X(t),e=>e&&e.prepaidShipments||null)),M=(0,Y.default)(t=>Z(Kc,e=>{var o;return(((o=e[T(t)])==null?void 0:o.map(({numberShipments:i})=>i))||[]).sort((i,s)=>i-s)})),Ye=(0,Y.default)(t=>Z(Yc,Wc,Jc,(e,r,o)=>e[T(t)]&&zc(r,o,e[T(t)])||null)),bo=n(t=>t.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase(),"kebabCase"),$=n((t,e,r,o)=>({[r]:t.config&&t.config[r]||e&&e.hasAttribute&&e.hasAttribute(bo(r))&&e[r]||e.offer&&typeof(e.offer[r]!=="undefined")&&e.offer[r]||o}),"configSelector"),We=n(t=>({templates:t.templates||[]}),"templatesSelector");function dr(t){document.readyState==="loading"?window.addEventListener("DOMContentLoaded",t):t()}n(dr,"onReady");function Ot(){return document.querySelector([`script[src^="https://${nr}"]`,`script[src^="https://${ir}"]`,`script[src^="http://${nr}"]`,`script[src^="http://${ir}"]`].join(","))}n(Ot,"getMainJs");function _o(){let t=Ot();if(!t)return[];let e=new URL(t.src),r=e.host.startsWith(Oe)?Oe:Te,o=e.pathname.split("/")[1];return!r&&!o?[]:[o,r,t]}n(_o,"resolveEnvAndMerchant");var T=n(t=>{var r;if(!t)return"";let e=`${t.id||t}`;return(r=D)!=null&&r.shopify_selling_plans&&(e=e.split(":")[0]),e},"safeProductId"),hi=n((t,e)=>{var r;if(D.shopify_selling_plans){let o=(r=e.frequencies)==null?void 0:r.indexOf(t);if(o>=0&&e.frequenciesEveryPeriod[o])return e.frequenciesEveryPeriod[o]}return t},"safeOgFrequency"),Pt=n((t,e)=>{var o,i,s;if(!`${t}`.includes("_"))return t;let r=(o=e.frequenciesEveryPeriod)==null?void 0:o.indexOf(t);return r>=0&&e.frequenciesEveryPeriod[r]?e.frequencies[r]:((i=e.frequencies)==null?void 0:i.length)>0&&((s=e.frequenciesEveryPeriod)==null?void 0:s.length)>0?(console.warn(`Unable to find selling plan match for frequency ${t}; falling back to first selling plan`),e.frequencies[0]):t},"frequencyToSellingPlan");function mi(t){if(t.isReady())return;console.info("OG offers are auto initializing");let[e,r]=_o();if(!r&&!e)return;let o=document.createElement("script");o.onload=()=>console.info("OG pull initialization chunk for merchant",e,r),o.onerror=()=>t.initialize(e,r),o.src=`${window.location.protocol}//${r===Te?nr:ir}/${e}/main.js?initOnly=true`,document.head.appendChild(o)}n(mi,"autoInitializeOffers");var gi=n(t=>{document.cookie=`${t}=; expires=Thu, 01 Jan 1970 00:00:01 GMT;`},"clearCookie");function yi(t){let e=document.cookie.match(`(^|;) ?${t}=([^;]*)(;|$)`);return e?e[2]:null}n(yi,"getCookieValue");var Je=n(t=>!!(t&&(t==null?void 0:t.includes("_"))),"isOgFrequency"),he=n((t=[])=>(t==null?void 0:t[0])||null,"getFirstSellingPlan"),fr=n((t=[],e=[])=>{var r;return!!(((r=D)==null?void 0:r.shopify_selling_plans)&&t.length&&e.length)},"hasShopifySellingPlans"),re=n((t,e,r)=>{if(t.length!==e.length)return null;let o=e.findIndex(i=>i===r);return o>=0?t[o]:null},"mapFrequencyToSellingPlan");function So(t,e,r){let o=t.querySelector(`[name="${e}"]`);if(o&&!r){o.remove();return}!o&&r&&(o=document.createElement("input"),o.type="hidden",o.name=e,t.appendChild(o)),o&&(o.value=r)}n(So,"getOrCreateHidden");function Ke(t,e){let[[r],o]=t.reduce((i,s)=>i[A(e,s)?0:1].push(s)&&i,[[],[]]);return[r||{},o||[]]}n(Ke,"getMatchingProductIfExists");var W=n((t,e,r)=>({type:R,payload:{product:t,frequency:e,offer:r}}),"optinProduct"),Qe=n((t,e)=>({type:I,payload:{product:t,offer:e}}),"optoutProduct"),bi=n((t,e)=>({type:ht,payload:{newProduct:t,product:e}}),"productHasChangedComponents"),mr=n((t,e,r)=>({type:k,payload:{product:t,frequency:e,offer:r}}),"productChangeFrequency"),ge=n((t,e,r)=>({type:ae,payload:{product:t,prepaidShipments:e,offer:r}}),"productChangePrepaidShipments");var gr=n(t=>({type:Wn,payload:{product:t}}),"concludeUpsell"),_i=n(t=>({type:Fe,payload:t}),"setMerchantId"),Eo=n(t=>({type:Ue,payload:`${t}.${Math.floor(Math.random()*999999)}.${Math.round(new Date().getTime()/1e3)}`}),"createSessionId"),Zc=n(t=>({type:Bn,payload:t}),"requestAuth"),wt=n((t,e,r,o)=>({type:zt,payload:{public_id:t,sig_field:e,ts:r,sig:o}}),"authorize"),me=n(t=>({type:xe,payload:t}),"unauthorized"),Si=n(t=>({type:Bt,payload:t}),"setAuthUrl"),Ct=n(t=>({type:Qn,payload:t}),"fetchDone"),Ei=n((t=Gn)=>n(function(r,o){if(window.og&&window.og.previewMode)return r(me({message:"Offers are running in preview mode"}));let{merchantId:i,authUrl:s}=o(),a=Zc(s);return r(a),t(s).then(({sig_field:c,ts:p,sig:l})=>r(wt(i,c,p,l)),c=>r(me(c))).finally(()=>r(Ct(a)))},"fetchAuthThunk"),"fetchAuth"),Xc=n((t,e)=>({type:zn,payload:{status:t,ordering:e}}),"requestOrders"),xo=n(t=>({type:Yt,payload:t}),"receiveOrders"),vo=n(t=>({type:Wt,payload:t}),"receiveItems"),yr=n((t=1,e="place")=>n(function(o,i){let{environment:{legoUrl:s},auth:a}=i();if(!a)return o(me("No auth set."));let c=Xc(t,e);return o(c),ze.fetchOrders(s,a,t,e).then(p=>{if(p.results){o(xo(p));let l=(p.results[0]||{}).public_id;if(l)return ze.fetchItems(s,a,l).then(d=>o(vo(d)))}return o(me(p.detail)),null},p=>o(me(p))).finally(()=>o(Ct(c)))},"fetchOrdersThunk"),"fetchOrders"),xi=n(t=>{switch(t){case Zn:return{type:Le,payload:t};case or:return{type:$e,payload:t};case Oe:return{type:Me,payload:t};case Te:return{type:Ve,payload:t};default:throw new Error(`${t} is not a supported environment`)}},"setEnvironment"),vi=n(()=>(t,e)=>{let{merchantId:r,sessionId:o}=e();return(!o||r&&!o.startsWith(r))&&t(Eo(r)),o},"requestSessionId"),ye=n((t,e)=>({type:P,payload:{...t,offer:e}}),"receiveOffer"),hr=n(t=>({type:Yn,payload:t}),"fetchResponseError"),Oo=n((t,e=Ge,r)=>({type:q,payload:{product:t,module:e,offer:r}}),"requestOffer"),Oi=Oo,Ti=n(()=>({type:je}),"checkout"),ep=n((t,e,r,o)=>({type:Jn,payload:{product:t,order:e,quantity:r,offerId:o}}),"requestCreateOneTime"),tp=n(t=>({type:Kt,payload:t}),"receiveCreateOneTime"),rp=n((t,e)=>({type:Kn,payload:{item:t,frequency:e}}),"requestConvertOneTimeToSubscription"),op=n((t,e)=>({type:Qt,payload:{response:t,product:e}}),"receiveConvertOneTime"),br=n((t,e,r,o=!1,i=null)=>n(function(a,c){let{auth:p,config:l,environment:{legoUrl:d},previewUpsellOffer:u,offerId:h,sessionId:_}=c();if(!p)return a(me("No auth set."));let S=hi(i,l),m=ep(t,e,r,h);return a(m),(u?Promise.resolve({legoUrl:d,product:t,order:e,quantity:r,offer:h}):ze.createOneTime(d,p,t.id,e,r,h)).then(b=>(a(tp(b)),o?(a(rp(b,S)),(u?Promise.resolve({item:b,frequency:S}):ze.convertOneTimeToSubscription(d,p,b,S,h,_)).then(O=>a(op(O,t)),O=>a(hr(O)))):b),b=>a(hr(b))).finally(()=>a(Ct(m)))},"createIuThunk"),"createIu"),Pi=n(t=>({type:Zt,payload:t}),"setLocale"),wi=n(t=>({type:He,payload:t}),"setConfig"),Ci=n((t,e,r)=>({type:Xt,payload:{selector:t,markup:e,config:r}}),"addTemplate"),Ri=n(t=>({type:er,payload:t}),"setTemplates"),Ai=n((t,e)=>({type:tr,payload:{product:t,firstOrderPlaceDate:e}}),"setFirstOrderPlaceDate"),Ni=n((t,e)=>({type:rr,payload:{product:t,productToSubscribe:e}}),"setProductToSubscribe"),Ii=n(t=>({type:ce,payload:t}),"receiveMerchantSettings");var Rt="OG_STATE",Di=n(t=>{try{return t===null?void 0:JSON.parse(t)}catch{return}},"safeParseState"),To=n(()=>window.og&&window.og.previewMode,"isPreviewMode"),Fi=n(()=>To()?{}:Di(localStorage.getItem(Rt)),"loadState"),np=n(t=>!t||!t.sessionId?!1:JSON.stringify({sessionId:t.sessionId,optedin:t.optedin,optedout:t.optedout,productOffer:t.productOffer,firstOrderPlaceDate:t.firstOrderPlaceDate,productToSubscribe:t.productToSubscribe}),"serializeState"),Ui=n(t=>{if(To())return;t&&t.sessionId&&(document.cookie="og_session_id="+encodeURIComponent(t.sessionId)+"; path=/; expires=Fri, 31 Dec 9999 23:59:59 GMT; SameSite=Lax");let e=np(t);e&&localStorage.getItem(Rt)!==e&&localStorage.setItem(Rt,e)},"saveState"),Li=n(t=>(0,qi.throttle)(500,e=>{if(To())return;let{key:r,newValue:o}=e;r===Rt&&o===null?(t.dispatch({type:de}),setTimeout(()=>t.dispatch(vi()),0)):r===Rt&&t.dispatch({type:ve,newValue:Di(o)})}),"listenLocalStorageChanges");var $i=se(Ht());var ip=n((t,e,r=document)=>r.dispatchEvent(new CustomEvent(t,{detail:e})),"dispatchEvent"),Mi=n(t=>({payload:{product:{id:e,components:r}={}}={}}={})=>setTimeout(()=>ip("optin-changed",{productId:e,components:r,optedIn:t}),0),"dispatchOptinChangedEvent"),sp=[{expressions:[({type:t}={})=>t===R,({type:t}={})=>t===k],fn:Mi(!0)},{expressions:[({type:t}={})=>t===I],fn:Mi(!1)}],Vi=n(t=>e=>r=>{let o=t.getState();sp.forEach(i=>{i.expressions.some(s=>s(r,o))&&i.fn(r)}),e(r)},"dispatchMiddleware"),ji=n(t=>e=>r=>{var i;let o;switch(r.type){case P:case I:case R:case k:o=new CustomEvent(`og-${r.type.toLowerCase().replace(/_/g,"-")}`,{bubbles:!0,cancelable:!0,detail:r.payload}),(((i=r.payload)==null?void 0:i.offer)||document).dispatchEvent(o);break;default:}o!=null&&o.defaultPrevented||e(r)},"offerEvents"),Hi=n(t=>e=>r=>{e(r);let o=(0,$i.throttle)(500,()=>{Ui({...t.getState()})});r.type!==ve&&o()},"localStorageMiddleware");var At=n(()=>{let t,e;return[new Promise((r,o)=>{t=r,e=o}),t,e]},"waitFor");function Gi(t){let[e,r]=At(),[o,i]=At(),[s,a]=At();o.then(p=>{let{sessionId:l}=t.getState();!l||p&&!l.startsWith(p)?t.dispatch(Eo(p)):a(l)});let c=Promise.all([o,e,s]);return c.then(()=>{var p;t.dispatch({type:Jt,payload:{}}),window.addEventListener("storage",Li(t)),(p=t.getState().auth)!=null&&p.ts||t.dispatch(Ei())}),p=>async l=>{Le===l.type||$e===l.type||Me===l.type||Ve===l.type?r(l.payload):Fe===l.type?i(l.payload):Ue===l.type?a(l.payload):await c,p(l)}}n(Gi,"waitUntilOffersReady");function Bi(t){return e=>r=>{if(r.type===q){let{merchantId:o,sessionId:i,environment:{apiUrl:s}}=t.getState(),a=T(r.payload.product);a&&ui.fetchOffer(s,o,i,a,r.payload.module||Ge,r.payload.searchParams).then(c=>t.dispatch(ye(c,r.payload.offer)),c=>t.dispatch(hr(c))).finally(()=>t.dispatch(Ct(r)))}return e(r)}}n(Bi,"offerRequestMiddleware");var Ki=se(Ji());function lp(t,e){e.map(a=>a.weight).reduce((a,c)=>a+c,0)!==100&&console.error("OG: Sum of weights for variants must be 100. Defaulting to last variant.");let i=Ki.default.murmur3(t,0)%100,s=0;for(let a=0;a<e.length;a++){let c=e[a],p=s+c.weight;if(c.weight>0&&i<p)return a;s=p}return e.length-1}n(lp,"getVariantIx");function Sr(t={},e){var r;switch(e.type){case ce:return{...t,...e.payload.experiments};case po:return{...t,currentVariant:e.payload.index,offerProfileId:(r=e.payload.parameters)==null?void 0:r.offer_profile_public_id};default:return t}}n(Sr,"experimentsReducer");function up(t,e){let r=t==null?void 0:t.public_id;if(!r)return null;let o=t.variants,i=lp(`${r}|${e}`,o);return{...o[i],index:i}}n(up,"getAssignedExperimentVariant");function Qi(t){let[e,r]=At(),o,i;return s=>async a=>{if(a.type===Jt)r();else if(a.type===ce){await e,i=a.payload.experiments;let{sessionId:c}=t.getState();o=up(i,c),o&&t.dispatch({type:po,payload:o})}else a.type===q&&(await e,o&&(a.payload.searchParams={...a.payload.searchParams,variant:o.public_id}));return s(a)}}n(Qi,"experimentsMiddleware");function Zi(t,...e){if(window.og&&window.og.store)return window.og.store;let r=window.og&&window.og.previewMode,o=typeof window=="object"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({name:"Ordergroove Offers"}):ao,i=[Gi,$n,Qi,Bi,Vi,ji],s={};if(!r)try{s=Fi(),i.push(Hi)}catch{}let a=o(Un(...i,...e.filter(p=>p))),c=so(t,s,a);return window.og=window.og||{},window.og.store=c,c}n(Zi,"makeStore");var dp=Object.defineProperty,Er=n((t,e)=>dp(t,"name",{value:e,configurable:!0}),"i"),fp=Er(t=>e=>t.indexOf(e.origin)>=0,"createIsMessageAllowed"),es=["https://rc3.ordergroove.com","https://rc3.stg.ordergroove.com","https://rc3-beta.stg.ordergroove.com","http://localhost:3000","http://localhost:3010","http://0.0.0.0:3010",window.location.origin],Xi=Er(t=>(e,r)=>{es.forEach(o=>t.postMessage({ogType:e,...r},o))},"createBroadcastMessage");function Co(t=window.opener,e=window.og){let r=Er(o=>{let i=fp(es),s=Xi(o.source),a=o.data.options||{};if(i(o)&&o.data.ogType==="READY"){let c="//static.ordergroove.com/@ordergroove/offers-live-editor/0.6.7/dist/";c.startsWith("//")&&(c=window.location.protocol+c),c.endsWith("/")||(c+="/"),import(`${c}client.js`).then(({initializeClient:p})=>{p({isMessageAllowed:i,broadcastMessage:s,options:a,og:e}),window.removeEventListener("message",r)})}},"handleReady");t&&t!==window&&(window.addEventListener("message",r),Xi(t)("READY"))}n(Co,"h");Er(Co,"offersLiveEditor");var xr=null,hp=n(t=>({dispatch:t}),"defaultMapDispatchToProps"),ts=n(t=>{if(!xr)throw new Error("Missing redux store.");return xr},"resolveStore"),mp=n((t,e)=>r=>{let{getState:o,dispatch:i}=ts(r),s=t?t(o(),r):{},a=e(i,r);Object.assign(r,s,a)},"createRecalcProps"),g=n((t,e=hp)=>r=>{let i=mp(t,typeof e=="function"?e:s=>Fn(e,s));return class extends r{get store(){return xr}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this._storeUnsubscribe=ts(this).subscribe(()=>i(this)),i(this)}attributeChangedCallback(s,a,c){super.attributeChangedCallback&&super.attributeChangedCallback(s,a,c),this._storeUnsubscribe&&a!==c&&i(this)}disconnectedCallback(){this._storeUnsubscribe(),super.disconnectedCallback&&super.disconnectedCallback()}}},"connect"),rs=n(t=>{xr=t},"setStore");var Ro=n((t={},e=[])=>(t.optedin||[]).map(r=>{let o={product:r.id,subscription_info:{components:r.components||[]},tracking_override:{offer:((t.productOffer||{})[r.id]||[])[0],...t.sessionId&&{session_id:t.sessionId},...xt(r.frequency)}};return t.firstOrderPlaceDate&&t.firstOrderPlaceDate[r.id]&&(o.subscription_info.first_order_place_date=t.firstOrderPlaceDate[r.id]),t.productToSubscribe&&t.productToSubscribe[r.id]&&(o.tracking_override.product=t.productToSubscribe[r.id]),o}).filter(r=>r.tracking_override.offer).filter(r=>e.length?e.includes(r.product):r),"getProductsForPurchasePost"),Ze=n((t={})=>{let e={};return Object.entries(t).forEach(([r,o])=>{Object.entries(o).forEach(([i,s])=>{let a={};s&&!Array.isArray(s)?a=s:a={frequency:i,prepaidShipments:null,regularPrice:s[0],subscriptionPrice:s[2],discountRate:s[1]},e[r]?e[r].push(a):e[r]=[a]})}),e},"getObjectStructuredProductPlans");var Ao=typeof window<"u"&&window.customElements!=null&&window.customElements.polyfillWrapFlushCallback!==void 0;var Ce=n((t,e,r=null)=>{for(;e!==r;){let o=e.nextSibling;t.removeChild(e),e=o}},"removeNodes");var V=`{{lit-${String(Math.random()).slice(2)}}}`,No=`<!--${V}-->`,os=new RegExp(`${V}|${No}`),Xe="$lit$",be=class{constructor(e,r){this.parts=[],this.element=r;let o=[],i=[],s=document.createTreeWalker(r.content,133,null,!1),a=0,c=-1,p=0,{strings:l,values:{length:d}}=e;for(;p<d;){let u=s.nextNode();if(u===null){s.currentNode=i.pop();continue}if(c++,u.nodeType===1){if(u.hasAttributes()){let h=u.attributes,{length:_}=h,S=0;for(let m=0;m<_;m++)ns(h[m].name,Xe)&&S++;for(;S-- >0;){let m=l[p],b=vr.exec(m)[2],O=b.toLowerCase()+Xe,E=u.getAttribute(O);u.removeAttribute(O);let w=E.split(os);this.parts.push({type:"attribute",index:c,name:b,strings:w}),p+=w.length-1}}u.tagName==="TEMPLATE"&&(i.push(u),s.currentNode=u.content)}else if(u.nodeType===3){let h=u.data;if(h.indexOf(V)>=0){let _=u.parentNode,S=h.split(os),m=S.length-1;for(let b=0;b<m;b++){let O,E=S[b];if(E==="")O=oe();else{let w=vr.exec(E);w!==null&&ns(w[2],Xe)&&(E=E.slice(0,w.index)+w[1]+w[2].slice(0,-Xe.length)+w[3]),O=document.createTextNode(E)}_.insertBefore(O,u),this.parts.push({type:"node",index:++c})}S[m]===""?(_.insertBefore(oe(),u),o.push(u)):u.data=S[m],p+=m}}else if(u.nodeType===8)if(u.data===V){let h=u.parentNode;(u.previousSibling===null||c===a)&&(c++,h.insertBefore(oe(),u)),a=c,this.parts.push({type:"node",index:c}),u.nextSibling===null?u.data="":(o.push(u),c--),p++}else{let h=-1;for(;(h=u.data.indexOf(V,h+1))!==-1;)this.parts.push({type:"node",index:-1}),p++}}for(let u of o)u.parentNode.removeChild(u)}};n(be,"Template");var ns=n((t,e)=>{let r=t.length-e.length;return r>=0&&t.slice(r)===e},"endsWith"),Nt=n(t=>t.index!==-1,"isTemplatePartActive"),oe=n(()=>document.createComment(""),"createMarker"),vr=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;var Io=133;function ko(t,e){let{element:{content:r},parts:o}=t,i=document.createTreeWalker(r,Io,null,!1),s=It(o),a=o[s],c=-1,p=0,l=[],d=null;for(;i.nextNode();){c++;let u=i.currentNode;for(u.previousSibling===d&&(d=null),e.has(u)&&(l.push(u),d===null&&(d=u)),d!==null&&p++;a!==void 0&&a.index===c;)a.index=d!==null?-1:a.index-p,s=It(o,s),a=o[s]}l.forEach(u=>u.parentNode.removeChild(u))}n(ko,"removeNodesFromTemplate");var yp=n(t=>{let e=t.nodeType===11?0:1,r=document.createTreeWalker(t,Io,null,!1);for(;r.nextNode();)e++;return e},"countNodes"),It=n((t,e=-1)=>{for(let r=e+1;r<t.length;r++){let o=t[r];if(Nt(o))return r}return-1},"nextActiveIndexInTemplateParts");function is(t,e,r=null){let{element:{content:o},parts:i}=t;if(r==null){o.appendChild(e);return}let s=document.createTreeWalker(o,Io,null,!1),a=It(i),c=0,p=-1;for(;s.nextNode();)for(p++,s.currentNode===r&&(c=yp(e),r.parentNode.insertBefore(e,r));a!==-1&&i[a].index===p;){if(c>0){for(;a!==-1;)i[a].index+=c,a=It(i,a);return}a=It(i,a)}}n(is,"insertNodeIntoTemplate");var bp=new WeakMap;var Re=n(t=>typeof t=="function"&&bp.has(t),"isDirective");var F={},Or={};var pe=class{constructor(e,r,o){this.__parts=[],this.template=e,this.processor=r,this.options=o}update(e){let r=0;for(let o of this.__parts)o!==void 0&&o.setValue(e[r]),r++;for(let o of this.__parts)o!==void 0&&o.commit()}_clone(){let e=Ao?this.template.element.content.cloneNode(!0):document.importNode(this.template.element.content,!0),r=[],o=this.template.parts,i=document.createTreeWalker(e,133,null,!1),s=0,a=0,c,p=i.nextNode();for(;s<o.length;){if(c=o[s],!Nt(c)){this.__parts.push(void 0),s++;continue}for(;a<c.index;)a++,p.nodeName==="TEMPLATE"&&(r.push(p),i.currentNode=p.content),(p=i.nextNode())===null&&(i.currentNode=r.pop(),p=i.nextNode());if(c.type==="node"){let l=this.processor.handleTextExpression(this.options);l.insertAfterNode(p.previousSibling),this.__parts.push(l)}else this.__parts.push(...this.processor.handleAttributeExpressions(p,c.name,c.strings,this.options));s++}return Ao&&(document.adoptNode(e),customElements.upgrade(e)),e}};n(pe,"TemplateInstance");var ss=window.trustedTypes&&trustedTypes.createPolicy("lit-html",{createHTML:t=>t}),Sp=` ${V} `,ne=class{constructor(e,r,o,i){this.strings=e,this.values=r,this.type=o,this.processor=i}getHTML(){let e=this.strings.length-1,r="",o=!1;for(let i=0;i<e;i++){let s=this.strings[i],a=s.lastIndexOf("<!--");o=(a>-1||o)&&s.indexOf("-->",a+1)===-1;let c=vr.exec(s);c===null?r+=s+(o?Sp:No):r+=s.substr(0,c.index)+c[1]+c[2]+Xe+c[3]+V}return r+=this.strings[e],r}getTemplateElement(){let e=document.createElement("template"),r=this.getHTML();return ss!==void 0&&(r=ss.createHTML(r)),e.innerHTML=r,e}};n(ne,"TemplateResult");var Pr=n(t=>t===null||!(typeof t=="object"||typeof t=="function"),"isPrimitive"),Tr=n(t=>Array.isArray(t)||!!(t&&t[Symbol.iterator]),"isIterable"),Ae=class{constructor(e,r,o){this.dirty=!0,this.element=e,this.name=r,this.strings=o,this.parts=[];for(let i=0;i<o.length-1;i++)this.parts[i]=this._createPart()}_createPart(){return new et(this)}_getValue(){let e=this.strings,r=e.length-1,o=this.parts;if(r===1&&e[0]===""&&e[1]===""){let s=o[0].value;if(typeof s=="symbol")return String(s);if(typeof s=="string"||!Tr(s))return s}let i="";for(let s=0;s<r;s++){i+=e[s];let a=o[s];if(a!==void 0){let c=a.value;if(Pr(c)||!Tr(c))i+=typeof c=="string"?c:String(c);else for(let p of c)i+=typeof p=="string"?p:String(p)}}return i+=e[r],i}commit(){this.dirty&&(this.dirty=!1,this.element.setAttribute(this.name,this._getValue()))}};n(Ae,"AttributeCommitter");var et=class{constructor(e){this.value=void 0,this.committer=e}setValue(e){e!==F&&(!Pr(e)||e!==this.value)&&(this.value=e,Re(e)||(this.committer.dirty=!0))}commit(){for(;Re(this.value);){let e=this.value;this.value=F,e(this)}this.value!==F&&this.committer.commit()}};n(et,"AttributePart");var ie=class{constructor(e){this.value=void 0,this.__pendingValue=void 0,this.options=e}appendInto(e){this.startNode=e.appendChild(oe()),this.endNode=e.appendChild(oe())}insertAfterNode(e){this.startNode=e,this.endNode=e.nextSibling}appendIntoPart(e){e.__insert(this.startNode=oe()),e.__insert(this.endNode=oe())}insertAfterPart(e){e.__insert(this.startNode=oe()),this.endNode=e.endNode,e.endNode=this.startNode}setValue(e){this.__pendingValue=e}commit(){if(this.startNode.parentNode===null)return;for(;Re(this.__pendingValue);){let r=this.__pendingValue;this.__pendingValue=F,r(this)}let e=this.__pendingValue;e!==F&&(Pr(e)?e!==this.value&&this.__commitText(e):e instanceof ne?this.__commitTemplateResult(e):e instanceof Node?this.__commitNode(e):Tr(e)?this.__commitIterable(e):e===Or?(this.value=Or,this.clear()):this.__commitText(e))}__insert(e){this.endNode.parentNode.insertBefore(e,this.endNode)}__commitNode(e){this.value!==e&&(this.clear(),this.__insert(e),this.value=e)}__commitText(e){let r=this.startNode.nextSibling;e=e??"";let o=typeof e=="string"?e:String(e);r===this.endNode.previousSibling&&r.nodeType===3?r.data=o:this.__commitNode(document.createTextNode(o)),this.value=e}__commitTemplateResult(e){let r=this.options.templateFactory(e);if(this.value instanceof pe&&this.value.template===r)this.value.update(e.values);else{let o=new pe(r,e.processor,this.options),i=o._clone();o.update(e.values),this.__commitNode(i),this.value=o}}__commitIterable(e){Array.isArray(this.value)||(this.value=[],this.clear());let r=this.value,o=0,i;for(let s of e)i=r[o],i===void 0&&(i=new ie(this.options),r.push(i),o===0?i.appendIntoPart(this):i.insertAfterPart(r[o-1])),i.setValue(s),i.commit(),o++;o<r.length&&(r.length=o,this.clear(i&&i.endNode))}clear(e=this.startNode){Ce(this.startNode.parentNode,e.nextSibling,this.endNode)}};n(ie,"NodePart");var tt=class{constructor(e,r,o){if(this.value=void 0,this.__pendingValue=void 0,o.length!==2||o[0]!==""||o[1]!=="")throw new Error("Boolean attributes can only contain a single expression");this.element=e,this.name=r,this.strings=o}setValue(e){this.__pendingValue=e}commit(){for(;Re(this.__pendingValue);){let r=this.__pendingValue;this.__pendingValue=F,r(this)}if(this.__pendingValue===F)return;let e=!!this.__pendingValue;this.value!==e&&(e?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=e),this.__pendingValue=F}};n(tt,"BooleanAttributePart");var rt=class extends Ae{constructor(e,r,o){super(e,r,o),this.single=o.length===2&&o[0]===""&&o[1]===""}_createPart(){return new kt(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}};n(rt,"PropertyCommitter");var kt=class extends et{};n(kt,"PropertyPart");var as=!1;(()=>{try{let t={get capture(){return as=!0,!1}};window.addEventListener("test",t,t),window.removeEventListener("test",t,t)}catch{}})();var ot=class{constructor(e,r,o){this.value=void 0,this.__pendingValue=void 0,this.element=e,this.eventName=r,this.eventContext=o,this.__boundHandleEvent=i=>this.handleEvent(i)}setValue(e){this.__pendingValue=e}commit(){for(;Re(this.__pendingValue);){let s=this.__pendingValue;this.__pendingValue=F,s(this)}if(this.__pendingValue===F)return;let e=this.__pendingValue,r=this.value,o=e==null||r!=null&&(e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive),i=e!=null&&(r==null||o);o&&this.element.removeEventListener(this.eventName,this.__boundHandleEvent,this.__options),i&&(this.__options=Ep(e),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=e,this.__pendingValue=F}handleEvent(e){typeof this.value=="function"?this.value.call(this.eventContext||this.element,e):this.value.handleEvent(e)}};n(ot,"EventPart");var Ep=n(t=>t&&(as?{capture:t.capture,passive:t.passive,once:t.once}:t.capture),"getOptions");function qo(t){let e=Ne.get(t.type);e===void 0&&(e={stringsArray:new WeakMap,keyString:new Map},Ne.set(t.type,e));let r=e.stringsArray.get(t.strings);if(r!==void 0)return r;let o=t.strings.join(V);return r=e.keyString.get(o),r===void 0&&(r=new be(t,t.getTemplateElement()),e.keyString.set(o,r)),e.stringsArray.set(t.strings,r),r}n(qo,"templateFactory");var Ne=new Map;var _e=new WeakMap,Do=n((t,e,r)=>{let o=_e.get(e);o===void 0&&(Ce(e,e.firstChild),_e.set(e,o=new ie(Object.assign({templateFactory:qo},r))),o.appendInto(e)),o.setValue(t),o.commit()},"render");var qt=class{handleAttributeExpressions(e,r,o,i){let s=r[0];return s==="."?new rt(e,r.slice(1),o).parts:s==="@"?[new ot(e,r.slice(1),i.eventContext)]:s==="?"?[new tt(e,r.slice(1),o)]:new Ae(e,r,o).parts}handleTextExpression(e){return new ie(e)}};n(qt,"DefaultTemplateProcessor");var Fo=new qt;typeof window<"u"&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.3.0");var f=n((t,...e)=>new ne(t,e,"html",Fo),"html");var ps=n((t,e)=>`${t}--${e}`,"getTemplateCacheKey"),wr=!0;typeof window.ShadyCSS>"u"?wr=!1:typeof window.ShadyCSS.prepareTemplateDom>"u"&&(console.warn("Incompatible ShadyCSS version detected. Please update to at least @webcomponents/webcomponentsjs@2.0.2 and @webcomponents/shadycss@1.3.1."),wr=!1);var vp=n(t=>e=>{let r=ps(e.type,t),o=Ne.get(r);o===void 0&&(o={stringsArray:new WeakMap,keyString:new Map},Ne.set(r,o));let i=o.stringsArray.get(e.strings);if(i!==void 0)return i;let s=e.strings.join(V);if(i=o.keyString.get(s),i===void 0){let a=e.getTemplateElement();wr&&window.ShadyCSS.prepareTemplateDom(a,t),i=new be(e,a),o.keyString.set(s,i)}return o.stringsArray.set(e.strings,i),i},"shadyTemplateFactory"),Op=["html","svg"],Tp=n(t=>{Op.forEach(e=>{let r=Ne.get(ps(e,t));r!==void 0&&r.keyString.forEach(o=>{let{element:{content:i}}=o,s=new Set;Array.from(i.querySelectorAll("style")).forEach(a=>{s.add(a)}),ko(o,s)})})},"removeStylesFromLitTemplates"),ls=new Set,Pp=n((t,e,r)=>{ls.add(t);let o=r?r.element:document.createElement("template"),i=e.querySelectorAll("style"),{length:s}=i;if(s===0){window.ShadyCSS.prepareTemplateStyles(o,t);return}let a=document.createElement("style");for(let l=0;l<s;l++){let d=i[l];d.parentNode.removeChild(d),a.textContent+=d.textContent}Tp(t);let c=o.content;r?is(r,a,c.firstChild):c.insertBefore(a,c.firstChild),window.ShadyCSS.prepareTemplateStyles(o,t);let p=c.querySelector("style");if(window.ShadyCSS.nativeShadow&&p!==null)e.insertBefore(p.cloneNode(!0),e.firstChild);else if(r){c.insertBefore(a,c.firstChild);let l=new Set;l.add(a),ko(r,l)}},"prepareTemplateStyles"),us=n((t,e,r)=>{if(!r||typeof r!="object"||!r.scopeName)throw new Error("The `scopeName` option is required.");let o=r.scopeName,i=_e.has(e),s=wr&&e.nodeType===11&&!!e.host,a=s&&!ls.has(o),c=a?document.createDocumentFragment():e;if(Do(t,c,Object.assign({templateFactory:vp(o)},r)),a){let p=_e.get(c);_e.delete(c);let l=p.value instanceof pe?p.value.template:void 0;Pp(o,c,l),Ce(e,e.firstChild),e.appendChild(c),_e.set(e,p)}!i&&s&&window.ShadyCSS.styleElement(e.host)},"render");var ds;window.JSCompiler_renameProperty=(t,e)=>t;var jo={toAttribute(t,e){switch(e){case Boolean:return t?"":null;case Object:case Array:return t==null?t:JSON.stringify(t)}return t},fromAttribute(t,e){switch(e){case Boolean:return t!==null;case Number:return t===null?null:Number(t);case Object:case Array:return JSON.parse(t)}return t}},fs=n((t,e)=>e!==t&&(e===e||t===t),"notEqual"),Uo={attribute:!0,type:String,converter:jo,reflect:!1,hasChanged:fs},Lo=1,Mo=1<<2,$o=1<<3,Vo=1<<4,Ho="finalized",nt=class extends HTMLElement{constructor(){super(),this.initialize()}static get observedAttributes(){this.finalize();let e=[];return this._classProperties.forEach((r,o)=>{let i=this._attributeNameForProperty(o,r);i!==void 0&&(this._attributeToPropertyMap.set(i,o),e.push(i))}),e}static _ensureClassProperties(){if(!this.hasOwnProperty(JSCompiler_renameProperty("_classProperties",this))){this._classProperties=new Map;let e=Object.getPrototypeOf(this)._classProperties;e!==void 0&&e.forEach((r,o)=>this._classProperties.set(o,r))}}static createProperty(e,r=Uo){if(this._ensureClassProperties(),this._classProperties.set(e,r),r.noAccessor||this.prototype.hasOwnProperty(e))return;let o=typeof e=="symbol"?Symbol():`__${e}`,i=this.getPropertyDescriptor(e,o,r);i!==void 0&&Object.defineProperty(this.prototype,e,i)}static getPropertyDescriptor(e,r,o){return{get(){return this[r]},set(i){let s=this[e];this[r]=i,this.requestUpdateInternal(e,s,o)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this._classProperties&&this._classProperties.get(e)||Uo}static finalize(){let e=Object.getPrototypeOf(this);if(e.hasOwnProperty(Ho)||e.finalize(),this[Ho]=!0,this._ensureClassProperties(),this._attributeToPropertyMap=new Map,this.hasOwnProperty(JSCompiler_renameProperty("properties",this))){let r=this.properties,o=[...Object.getOwnPropertyNames(r),...typeof Object.getOwnPropertySymbols=="function"?Object.getOwnPropertySymbols(r):[]];for(let i of o)this.createProperty(i,r[i])}}static _attributeNameForProperty(e,r){let o=r.attribute;return o===!1?void 0:typeof o=="string"?o:typeof e=="string"?e.toLowerCase():void 0}static _valueHasChanged(e,r,o=fs){return o(e,r)}static _propertyValueFromAttribute(e,r){let o=r.type,i=r.converter||jo,s=typeof i=="function"?i:i.fromAttribute;return s?s(e,o):e}static _propertyValueToAttribute(e,r){if(r.reflect===void 0)return;let o=r.type,i=r.converter;return(i&&i.toAttribute||jo.toAttribute)(e,o)}initialize(){this._updateState=0,this._updatePromise=new Promise(e=>this._enableUpdatingResolver=e),this._changedProperties=new Map,this._saveInstanceProperties(),this.requestUpdateInternal()}_saveInstanceProperties(){this.constructor._classProperties.forEach((e,r)=>{if(this.hasOwnProperty(r)){let o=this[r];delete this[r],this._instanceProperties||(this._instanceProperties=new Map),this._instanceProperties.set(r,o)}})}_applyInstanceProperties(){this._instanceProperties.forEach((e,r)=>this[r]=e),this._instanceProperties=void 0}connectedCallback(){this.enableUpdating()}enableUpdating(){this._enableUpdatingResolver!==void 0&&(this._enableUpdatingResolver(),this._enableUpdatingResolver=void 0)}disconnectedCallback(){}attributeChangedCallback(e,r,o){r!==o&&this._attributeToProperty(e,o)}_propertyToAttribute(e,r,o=Uo){let i=this.constructor,s=i._attributeNameForProperty(e,o);if(s!==void 0){let a=i._propertyValueToAttribute(r,o);if(a===void 0)return;this._updateState=this._updateState|$o,a==null?this.removeAttribute(s):this.setAttribute(s,a),this._updateState=this._updateState&~$o}}_attributeToProperty(e,r){if(this._updateState&$o)return;let o=this.constructor,i=o._attributeToPropertyMap.get(e);if(i!==void 0){let s=o.getPropertyOptions(i);this._updateState=this._updateState|Vo,this[i]=o._propertyValueFromAttribute(r,s),this._updateState=this._updateState&~Vo}}requestUpdateInternal(e,r,o){let i=!0;if(e!==void 0){let s=this.constructor;o=o||s.getPropertyOptions(e),s._valueHasChanged(this[e],r,o.hasChanged)?(this._changedProperties.has(e)||this._changedProperties.set(e,r),o.reflect===!0&&!(this._updateState&Vo)&&(this._reflectingProperties===void 0&&(this._reflectingProperties=new Map),this._reflectingProperties.set(e,o))):i=!1}!this._hasRequestedUpdate&&i&&(this._updatePromise=this._enqueueUpdate())}requestUpdate(e,r){return this.requestUpdateInternal(e,r),this.updateComplete}async _enqueueUpdate(){this._updateState=this._updateState|Mo;try{await this._updatePromise}catch{}let e=this.performUpdate();return e!=null&&await e,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return this._updateState&Mo}get hasUpdated(){return this._updateState&Lo}performUpdate(){if(!this._hasRequestedUpdate)return;this._instanceProperties&&this._applyInstanceProperties();let e=!1,r=this._changedProperties;try{e=this.shouldUpdate(r),e?this.update(r):this._markUpdated()}catch(o){throw e=!1,this._markUpdated(),o}e&&(this._updateState&Lo||(this._updateState=this._updateState|Lo,this.firstUpdated(r)),this.updated(r))}_markUpdated(){this._changedProperties=new Map,this._updateState=this._updateState&~Mo}get updateComplete(){return this._getUpdateComplete()}_getUpdateComplete(){return this._updatePromise}shouldUpdate(e){return!0}update(e){this._reflectingProperties!==void 0&&this._reflectingProperties.size>0&&(this._reflectingProperties.forEach((r,o)=>this._propertyToAttribute(o,this[o],r)),this._reflectingProperties=void 0),this._markUpdated()}updated(e){}firstUpdated(e){}};n(nt,"UpdatingElement");ds=Ho;nt[ds]=!0;var hs=Element.prototype,Uf=hs.msMatchesSelector||hs.webkitMatchesSelector;var Cr=window.ShadowRoot&&(window.ShadyCSS===void 0||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Go=Symbol(),it=class{constructor(e,r){if(r!==Go)throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e}get styleSheet(){return this._styleSheet===void 0&&(Cr?(this._styleSheet=new CSSStyleSheet,this._styleSheet.replaceSync(this.cssText)):this._styleSheet=null),this._styleSheet}toString(){return this.cssText}};n(it,"CSSResult");var ms=n(t=>new it(String(t),Go),"unsafeCSS"),wp=n(t=>{if(t instanceof it)return t.cssText;if(typeof t=="number")return t;throw new Error(`Value passed to 'css' function must be a 'css' function result: ${t}. Use 'unsafeCSS' to pass non-literal values, but
|
|
12
|
+
take care to ensure page security.`)},"textFromCSSResult"),y=n((t,...e)=>{let r=e.reduce((o,i,s)=>o+wp(i)+t[s+1],t[0]);return new it(r,Go)},"css");(window.litElementVersions||(window.litElementVersions=[])).push("2.4.0");var gs={},x=class extends nt{static getStyles(){return this.styles}static _getUniqueStyles(){if(this.hasOwnProperty(JSCompiler_renameProperty("_styles",this)))return;let e=this.getStyles();if(Array.isArray(e)){let r=n((s,a)=>s.reduceRight((c,p)=>Array.isArray(p)?r(p,c):(c.add(p),c),a),"addStyles"),o=r(e,new Set),i=[];o.forEach(s=>i.unshift(s)),this._styles=i}else this._styles=e===void 0?[]:[e];this._styles=this._styles.map(r=>{if(r instanceof CSSStyleSheet&&!Cr){let o=Array.prototype.slice.call(r.cssRules).reduce((i,s)=>i+s.cssText,"");return ms(o)}return r})}initialize(){super.initialize(),this.constructor._getUniqueStyles(),this.renderRoot=this.createRenderRoot(),window.ShadowRoot&&this.renderRoot instanceof window.ShadowRoot&&this.adoptStyles()}createRenderRoot(){return this.attachShadow({mode:"open"})}adoptStyles(){let e=this.constructor._styles;e.length!==0&&(window.ShadyCSS!==void 0&&!window.ShadyCSS.nativeShadow?window.ShadyCSS.ScopingShim.prepareAdoptedCssText(e.map(r=>r.cssText),this.localName):Cr?this.renderRoot.adoptedStyleSheets=e.map(r=>r instanceof CSSStyleSheet?r:r.styleSheet):this._needsShimAdoptedStyleSheets=!0)}connectedCallback(){super.connectedCallback(),this.hasUpdated&&window.ShadyCSS!==void 0&&window.ShadyCSS.styleElement(this)}update(e){let r=this.render();super.update(e),r!==gs&&this.constructor.render(r,this.renderRoot,{scopeName:this.localName,eventContext:this}),this._needsShimAdoptedStyleSheets&&(this._needsShimAdoptedStyleSheets=!1,this.constructor._styles.forEach(o=>{let i=document.createElement("style");i.textContent=o.cssText,this.renderRoot.appendChild(i)}))}render(){return gs}};n(x,"LitElement");x.finalized=!0;x.render=us;var qs=se(ws());var qp=n(t=>{let e=String(t||"").trim().match(/(\d+)\s*([dwm])/);return e?`${e[1]}_${{d:1,w:2,m:3}[e[2]]}`:t},"sanitizeFrequencyString"),Cs=n(t=>t.hasAttribute("product")&&{id:t.getAttribute("product"),...t.hasAttribute("product-components")&&{components:JSON.parse(t.getAttribute("product-components"))}},"buildProduct");var Dt=n(t=>{let e=Cs(t);if(!e){let r=t.offer;r&&(e=Cs(r))}return e},"resolveProduct"),Dp=n(t=>{let e=t;for(;e;){if(e.tagName==="OG-OFFER")return e;e=e.nodeType===11?e.host:e.parentNode}},"resolveOffer"),Bo=n(t=>class extends t{get offer(){return Dp(this)}connectedCallback(){super.connectedCallback(),this.offersChangeTemplate=this.offersChangeTemplate.bind(this),this.offer&&this.offer.addEventListener("template-changed",this.offersChangeTemplate)}disconnectedCallback(){super.disconnectedCallback(),this.offer&&this.offer.removeEventListener("template-changed",this.offersChangeTemplate)}offersChangeTemplate(){this._enqueueUpdate()}},"withOfferTemplate"),N=n(t=>class extends Bo(t){get product(){return Dt(this)}},"withProduct"),Ar=n(t=>class extends t{get childOptions(){let e=[],r=null;return this.querySelectorAll("option").forEach(o=>{let i=qp(o.value),s=o.innerText.trim();e.push({value:i,text:s}),!r&&o.selected&&(r=i)}),{options:e,isSelected:r}}},"withChildOptions");var Nr={};In(Nr,{autoshipByDefault:()=>Fp,eligibilityGroups:()=>Yo,eligible:()=>Rs,hasPrepaidOptions:()=>Vp,hasUpcomingOrder:()=>Is,hasUpsellGroup:()=>Ns,inStock:()=>zo,optedout:()=>Mp,prepaidEligible:()=>Up,prepaidSubscribed:()=>$p,regularEligible:()=>Hp,subscribed:()=>Lp,subscriptionEligible:()=>As,upcomingOrderContainsProduct:()=>jp,upsellEligible:()=>ks});var zo=n((t,e)=>(t.inStock||{})[(e.product||{}).id],"inStock"),Rs=n((t,e)=>(t.autoshipEligible||{})[(e.product||{}).id]||!1,"eligible"),Fp=n((t,e)=>(t.autoshipByDefault||{})[(e.product||{}).id]||!1,"autoshipByDefault"),As=n((t,e)=>(t.offerId&&t.offerId!=="0"||!1)&&Rs(t,e)&&zo(t,e),"subscriptionEligible"),Yo=n((t,e)=>{let r=T((e.product||{}).id);return(t.eligibilityGroups||{})[r]||null},"eligibilityGroups"),Ns=n((t,e)=>{let r=Yo(t,e);return r===null||!!r.find(o=>o==="upsell"||o==="impulse_upsell")},"hasUpsellGroup"),Up=n((t,e)=>{let r=Yo(t,e);return(r==null?void 0:r.some(o=>o==="prepaid"))||!1},"prepaidEligible"),Lp=n((t,e)=>lr(e.product)(t),"subscribed"),Mp=n((t,e)=>ur(e.product)(t),"optedout"),$p=n((t,e)=>fi(e.product)(t),"prepaidSubscribed"),Vp=n((t,e)=>M(e.product.id)(t).length>0,"hasPrepaidOptions"),Is=n(t=>!!(t.nextUpcomingOrder&&t.nextUpcomingOrder.public_id),"hasUpcomingOrder"),jp=n((t,e)=>(t.nextUpcomingOrder&&t.nextUpcomingOrder.products||[]).includes((e.product||{}).id),"upcomingOrderContainsProduct"),ks=n((t,e)=>{var r;return!((r=e.offer)!=null&&r.isCart)&&t.offerId&&t.offerId!=="0"&&t.auth&&zo(t,e)&&Is(t)&&Ns(t,e)},"upsellEligible"),Hp=n((t,e)=>As(t,e)&&!ks(t,e),"regularEligible");var Gp=n(t=>t.replace(/(\r\n|\n|\r|\s)+/gm,""),"removeWhitespace"),Ir=class extends N(x){static get properties(){return{...super.properties,state:{type:Object,attribute:!1},test:{type:String}}}render(){if(!this.test)return f``;let e=Gp(this.test);return e=e.replace(/(![a-zA-Z]+)/g,"($1)"),qs.default.parse(e,o=>Nr[o]&&Nr[o](this.state,this))?f`
|
|
13
13
|
<slot></slot>
|
|
14
|
-
`:f``}shouldUpdate(e){return e.size&&(this.product&&this.product.id in this.state.autoshipEligible&&this.product.id in this.state.inStock||!this.product.id)}};n(
|
|
14
|
+
`:f``}shouldUpdate(e){return e.size&&(this.product&&this.product.id in this.state.autoshipEligible&&this.product.id in this.state.inStock||!this.product.id)}};n(Ir,"When");var Bp=n(t=>({state:t}),"mapStateToProps"),Ds=g(Bp)(Ir);var Fs={type:Object,converter:{toAttribute(t){return t==null?t:JSON.stringify(t)},fromAttribute(t){return t&&t.match(/[{[]/)?JSON.parse(t):{id:t}}}},Ee={type:String,attribute:"default-frequency",converter:{fromAttribute(t){return t&&mo(t)?t:null}}},kr={type:Boolean,attribute:!0,reflect:!0},ct={type:Object,attribute:!1};var zp=n(t=>class extends t{getOption(e,r=e){let o=bo(e);if(this.hasAttribute(o)){let i=this.getAttribute(o);return i.toString().toLowerCase()==="true"?!0:i.toString().toLowerCase()==="false"?!1:i}if(this.template&&this.template.config&&typeof this.template.config[r]!="undefined")return this.template.config[r];if(this.config&&typeof this.config[r]!="undefined")return this.config[r]}applyTemplate(e){this.template=e;let r=typeof e.markup=="undefined"?this.constructor.initialTemplate:e.markup;r&&this._templateMarkup!==r&&(this._templateMarkup=r,this.innerHTML=r)}refreshTemplate(){if(this._templates&&this._templates.length){let e=this._templates.find(({selector:r})=>{try{return this.matches(r)}catch{return!1}});this.applyTemplate(e||{})}}set templates(e){this._templates=e,this.refreshTemplate()}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this.constructor.initialTemplate&&!this.innerHTML.trim()&&(this.innerHTML=this.constructor.initialTemplate)}},"withTemplate"),H=zp(x);var G=class extends N(H){static get properties(){return{subscribed:kr,frequencyMatch:{type:Boolean,reflect:!0,attribute:"frequency-match"},productDefaultFrequency:{type:String},defaultFrequency:{type:String},frequencies:{type:Array}}}static get styles(){return y`
|
|
15
15
|
:host {
|
|
16
16
|
cursor: default;
|
|
17
17
|
display: inline-block;
|
|
@@ -99,7 +99,7 @@ var lib=(()=>{var Da=Object.create;var dt=Object.defineProperty;var Fa=Object.ge
|
|
|
99
99
|
</slot>
|
|
100
100
|
</label>
|
|
101
101
|
</slot>
|
|
102
|
-
`}};n(pt,"OptinButton");var Ls=g(J,{optinProduct:W})(pt);var
|
|
102
|
+
`}};n(pt,"OptinButton");var Ls=g(J,{optinProduct:W})(pt);var qr=class extends G{static get properties(){return{...super.properties,label:{type:String}}}handleClick(e){this.optoutProduct(this.product,this.offer),e.preventDefault()}render(){return f`
|
|
103
103
|
<slot name="default">
|
|
104
104
|
<button
|
|
105
105
|
aria-labelledby="ogOfferOptOutLabel"
|
|
@@ -113,13 +113,13 @@ var lib=(()=>{var Da=Object.create;var dt=Object.defineProperty;var Fa=Object.ge
|
|
|
113
113
|
</slot>
|
|
114
114
|
</label>
|
|
115
115
|
</slot>
|
|
116
|
-
`}};n(
|
|
116
|
+
`}};n(qr,"OptoutButton");var Ms=g(J,{optoutProduct:Qe})(qr);var ke=n((t,e)=>{let{every:r,every_period:o}=xt(t);return r&&o?f`
|
|
117
117
|
${r}
|
|
118
118
|
<og-text key="frequencyPeriods" variant="${o}" pluralize="${r}"></og-text>
|
|
119
119
|
${e&&e===t?f`
|
|
120
120
|
<og-text key="defaultFrequencyCopy"></og-text>
|
|
121
121
|
`:""}
|
|
122
|
-
`:t},"frequencyText"),lt=class extends N(H){static get properties(){return{...super.properties,disabled:{type:Boolean},subscribed:
|
|
122
|
+
`:t},"frequencyText"),lt=class extends N(H){static get properties(){return{...super.properties,disabled:{type:Boolean},subscribed:kr,frequency:{type:String},defaultFrequency:Ee,productDefaultFrequency:{type:String},config:{type:Object},frequencies:{converter:{fromAttribute:li}}}}static get styles(){return y`
|
|
123
123
|
:host[hidden] {
|
|
124
124
|
display: none;
|
|
125
125
|
}
|
|
@@ -138,7 +138,7 @@ var lib=(()=>{var Da=Object.create;var dt=Object.defineProperty;var Fa=Object.ge
|
|
|
138
138
|
<slot name="frequency-mismatch"></slot>
|
|
139
139
|
`||""}
|
|
140
140
|
</span>
|
|
141
|
-
`}};n(lt,"FrequencyStatus");var Ft=n((t,e)=>{var r,o;return{subscribed:X(e.product)(t),frequency:te(e.product)(t),productDefaultFrequency:Ye((e.product||{}).id)(t),configDefaultFrequency:(r=t.config)==null?void 0:r.defaultFrequency,frequenciesText:(o=t.config)==null?void 0:o.frequenciesText,config:t.config,...$(t,e,"frequencies"),...$(t,e,"defaultFrequency"),...We(t,e)}},"mapStateToProps"),$s=g(Ft)(lt);var
|
|
141
|
+
`}};n(lt,"FrequencyStatus");var Ft=n((t,e)=>{var r,o;return{subscribed:X(e.product)(t),frequency:te(e.product)(t),productDefaultFrequency:Ye((e.product||{}).id)(t),configDefaultFrequency:(r=t.config)==null?void 0:r.defaultFrequency,frequenciesText:(o=t.config)==null?void 0:o.frequenciesText,config:t.config,...$(t,e,"frequencies"),...$(t,e,"defaultFrequency"),...We(t,e)}},"mapStateToProps"),$s=g(Ft)(lt);var Dr=class extends Ar(G){static get properties(){return{...super.properties,frequencies:{type:Array,attribute:!1},frequency:{type:String},defaultFrequency:Ee}}static get styles(){return y`
|
|
142
142
|
:host {
|
|
143
143
|
display: inline-block;
|
|
144
144
|
cursor: pointer;
|
|
@@ -154,18 +154,18 @@ var lib=(()=>{var Da=Object.create;var dt=Object.defineProperty;var Fa=Object.ge
|
|
|
154
154
|
.selected="${this.currentFrequency}"
|
|
155
155
|
.onChange="${({target:{value:i}})=>this.onOptinChange(i)}"
|
|
156
156
|
></og-select>
|
|
157
|
-
`}};n(
|
|
157
|
+
`}};n(Dr,"OptinSelect");var Vs=g((t,e)=>({...J(t,e),...Ft(t,e),...$(t,e,"frequencies")}),{productChangeFrequency:mr,optoutProduct:Qe})(Dr);var Fr=class extends N(H){static get styles(){return y`
|
|
158
158
|
:host[hidden] {
|
|
159
159
|
display: none;
|
|
160
160
|
}
|
|
161
161
|
:host {
|
|
162
162
|
display: inline-block;
|
|
163
163
|
}
|
|
164
|
-
`}static get properties(){return{...super.properties,upcomingOrderDate:{type:String,attribute:!1},auth:ct,isPreview:{type:Boolean,attribute:!1},target:{type:String}}}constructor(){super(),this.fetchOrders=()=>0,this.addEventListener("click",this.handleClick.bind(this))}updated(e){e.has("auth")&&this.auth&&!this.upcomingOrderDate&&!this.isPreview&&this.fetchOrders()}handleClick(){let e;if(!this.target&&this.offer)e=this.offer.querySelector("og-upsell-modal"),e||(e=this.offer.shadowRoot.querySelector("og-upsell-modal"));else if(this.target)e=document.querySelector(this.target);else throw Error("You must specify a target attribute or place this element as child of og-offer");e&&e.setAttribute("show",!0)}render(){return f`
|
|
164
|
+
`}static get properties(){return{...super.properties,upcomingOrderDate:{type:String,attribute:!1},auth:ct,isPreview:{type:Boolean,attribute:!1},target:{type:String},skipModal:{type:Boolean,attribute:"skip-modal"}}}constructor(){super(),this.fetchOrders=()=>0,this.createIu=()=>0,this.concludeUpsell=()=>0,this.addEventListener("click",this.handleClick.bind(this))}updated(e){e.has("auth")&&this.auth&&!this.upcomingOrderDate&&!this.isPreview&&this.fetchOrders()}handleClick(){let e;if(this.skipModal)this.createIu(this.product,this.nextUpcomingOrder.public_id,1,!1,null),this.concludeUpsell(this.product);else if(!this.target&&this.offer)e=this.offer.querySelector("og-upsell-modal"),e||(e=this.offer.shadowRoot.querySelector("og-upsell-modal"));else if(this.target)e=document.querySelector(this.target);else throw Error("You must specify a target attribute or place this element as child of og-offer");e&&e.setAttribute("show",!0)}render(){return f`
|
|
165
165
|
<slot>
|
|
166
166
|
<og-next-upcoming-order></og-next-upcoming-order>
|
|
167
167
|
</slot>
|
|
168
|
-
`}};n(
|
|
168
|
+
`}};n(Fr,"UpsellButton");var Yp=n(t=>({isPreview:t.previewUpsellOffer,nextUpcomingOrder:t.previewUpsellOffer?{public_id:"preview-order-id"}:t.nextUpcomingOrder}),"mapStateToProps"),js=g(Yp,{fetchOrders:yr,createIu:br,concludeUpsell:gr})(Fr);var Ur=class extends N(H){static get properties(){return{...super.properties,defaultFrequency:Ee,auth:ct,subscribed:{type:Boolean,attribute:!1},frequency:{type:String,attribute:!1},nextUpcomingOrder:{type:Object,attribute:!1},show:{type:Boolean,attribute:"show"},offerId:{type:String}}}constructor(){super(),this.createIu=()=>0,this.concludeUpsell=()=>0}render(){return f`
|
|
169
169
|
<og-modal ?show=${this.show} @close=${()=>this.close()} @confirm=${()=>this.confirm()}>
|
|
170
170
|
<div slot="content">
|
|
171
171
|
<slot>
|
|
@@ -203,7 +203,7 @@ var lib=(()=>{var Da=Object.create;var dt=Object.defineProperty;var Fa=Object.ge
|
|
|
203
203
|
</slot>
|
|
204
204
|
</span>
|
|
205
205
|
</og-modal>
|
|
206
|
-
`}set defaultFrequency(e){this._defaultFrequency=e}get defaultFrequency(){let e=this.querySelector("og-select-frequency");return e?e.defaultFrequency:this._defaultFrequency}confirm(){this.createIu(this.product,this.nextUpcomingOrder.public_id,1,this.subscribed,this.frequency||this.defaultFrequency),this.close()}close(){this.concludeUpsell(),this.removeAttribute("show")}};n(
|
|
206
|
+
`}set defaultFrequency(e){this._defaultFrequency=e}get defaultFrequency(){let e=this.querySelector("og-select-frequency");return e?e.defaultFrequency:this._defaultFrequency}confirm(){this.createIu(this.product,this.nextUpcomingOrder.public_id,1,this.subscribed,this.frequency||this.defaultFrequency),this.close()}close(){this.concludeUpsell(),this.removeAttribute("show")}};n(Ur,"UpsellModal");var Wp=n((t,e)=>({auth:t.auth,offerId:t.offerId,subscribed:X(e.product)(t),frequency:te(e.product)(t),...$(t,e,"defaultFrequency"),nextUpcomingOrder:t.previewUpsellOffer?{public_id:"preview-order-id"}:t.nextUpcomingOrder,isPreview:t.previewUpsellOffer}),"mapStateToProps"),Hs=g(Wp,{concludeUpsell:gr,createIu:br})(Ur);var Lr=class extends G{static get properties(){return{...super.properties,frequency:{type:String}}}static get styles(){return y`
|
|
207
207
|
:host {
|
|
208
208
|
cursor: default;
|
|
209
209
|
display: inline-block;
|
|
@@ -244,13 +244,13 @@ var lib=(()=>{var Da=Object.create;var dt=Object.defineProperty;var Fa=Object.ge
|
|
|
244
244
|
</slot>
|
|
245
245
|
</label>
|
|
246
246
|
</slot>
|
|
247
|
-
`}};n(
|
|
247
|
+
`}};n(Lr,"OptinToggle");var Gs=g(J,{optoutProduct:Qe,optinProduct:W})(Lr);var Jp=n((t,e)=>`${t}${parseInt(e,10)>1?"s":""}`,"pluralize"),Mr=class extends Bo(x){static get properties(){return{pluralize:{type:Number},variant:{type:Number},i18n:{type:Object,attribute:!1},locale:{type:Object,attribute:!1},key:{type:String}}}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this._textOverride=this.innerText.trim()}getText(){return this._textOverride?this._textOverride:this.getPluralizedText(this.getVariantText(this.key))}getVariantText(e){let r={...this.i18n,...this.offer&&this.offer.locale},o=typeof r[e]!="undefined"?r[e]:"";return typeof this.variant=="undefined"?o:o[this.variant]}getPluralizedText(e){return typeof this.pluralize=="undefined"?e:e&&Jp(e,this.pluralize)}render(){return f`
|
|
248
248
|
${this.getText()}
|
|
249
|
-
`}};n(
|
|
250
|
-
${this.label} ${i?
|
|
249
|
+
`}};n(Mr,"Text");var Kp=n(t=>({i18n:t.locale||{}}),"mapStateToProps"),Bs=g(Kp)(Mr);var qe=class{constructor(e){this.value=e,this.className="DiscountAmount"}toString(){return`${this.value}`}};n(qe,"DiscountAmount");var ut=class extends qe{constructor(e){super(e),this.className="DiscountPercent"}toString(){return`${super.toString()}%`}};n(ut,"DiscountPercent");var $r=class extends ut{constructor(e){super(e),this.className="ShippingDiscountPercent"}toString(){return this.value===100?"free shipping":super.toString()}};n($r,"ShippingDiscountPercent");var Wo="Discount Percent",Jo="Discount Amount",zs="total_price",Ys="shipping_total",Ws="sub_total",Ko=n(({field:t,object:e,type:r,value:o})=>{let s=[[new ut(o),{field:zs,object:"item",type:Wo}],[new qe(o),{field:zs,object:"item",type:Jo}],[new $r(o),{field:Ys,object:"order",type:Wo}],[new qe(o),{field:Ys,object:"order",type:Jo}],[new ut(o),{field:Ws,object:"order",type:Wo}],[new qe(o),{field:Ws,object:"order",type:Jo}]].find(([,a])=>a.field===t&&a.object===e&&a.type===r);return s&&s[0]},"discountBuilder");function Qp(t){return!(Ko(t).className!==this.incentiveClass||this.incentiveValue&&this.incentiveValue.toString()!==t.value.toString())}n(Qp,"filterIncentives");var Vr=class extends N(x){static get properties(){return{...super.properties,incentives:{type:Object,attribute:!1},from:{type:String},label:{type:String},initial:{type:Boolean,default:!1},value:{type:Number}}}createRenderRoot(){return this}render(){let e=this.from,r=this.value,o=this.initial?"initial":"ongoing",i=(this.incentives[o]||[]).find(Qp.bind({incentiveClass:e,incentiveValue:r}));return f`
|
|
250
|
+
${this.label} ${i?Ko(i):this.renderFallback()}
|
|
251
251
|
`}renderFallback(){return f`
|
|
252
|
-
${
|
|
253
|
-
`}};n(
|
|
252
|
+
${Ko({field:"sub_total",object:"order",type:"Discount Percent",value:this.value})}
|
|
253
|
+
`}};n(Vr,"IncentiveText");var Zp=n((t,e)=>{var r;return{incentives:(t.incentives||{})[e&&(e==null?void 0:e.product)&&T((r=e==null?void 0:e.product)==null?void 0:r.id)]||{}}},"mapStateToProps"),Js=g(Zp)(Vr);var jr=class extends Ar(lt){static get properties(){return{...super.properties,defaultText:{type:String,attribute:"default-text"}}}static get styles(){return y`
|
|
254
254
|
:host {
|
|
255
255
|
display: inline-block;
|
|
256
256
|
cursor: pointer;
|
|
@@ -270,9 +270,9 @@ var lib=(()=>{var Da=Object.create;var dt=Object.defineProperty;var Fa=Object.ge
|
|
|
270
270
|
.selected="${this.currentFrequency}"
|
|
271
271
|
.onChange="${({target:{value:i}})=>{this.productChangeFrequency(this.product,i,this.offer)}}"
|
|
272
272
|
></og-select>
|
|
273
|
-
`}};n(
|
|
273
|
+
`}};n(jr,"SelectFrequency");var Ks=g(Ft,{productChangeFrequency:mr})(jr);var Xp={day:{day:"2-digit"},"day-numeric":{day:"numeric"},"day-short":{weekday:"short"},"day-long":{weekday:"long"},month:{month:"2-digit"},"month-numeric":{month:"numeric"},"month-short":{month:"short"},"month-long":{month:"long"},year:{year:"2-digit"},"year-numeric":{year:"numeric"}};var Qs=n((t,e)=>t instanceof Date?(e||"").toString().replace(/\{\{([-\w]+)\}\}/g,r=>{let o=r.replace(/[{}]/g,""),i=Xp[o];if(typeof i=="undefined")return o;let a=new Intl.DateTimeFormat("en-us",i).formatToParts(t),[{value:c}]=a;return c}):t,"formatDate");var Hr=class extends x{static get properties(){return{value:{type:String,reflect:!0},format:{type:String}}}createRenderRoot(){return this}render(){return f`
|
|
274
274
|
${Qs(this.value,this.format||"{{month-long}} {{day}}, {{year-numeric}}")}
|
|
275
|
-
`}};n(
|
|
275
|
+
`}};n(Hr,"FormattedDate");var el=n(t=>({value:t.previewUpsellOffer?new Date:t.nextUpcomingOrder.place}),"mapStateToProps"),Zs=g(el)(Hr);var ta=se(_t());var Xs=n((t,e,r)=>n(async function(i){await i({type:ue,payload:{isPreview:t,productId:e}}),await i({type:xe}),await i(ye({in_stock:{[e]:!0},eligibility_groups:{[e]:["subscription","upsell"]},result:"success",autoship:{[e]:!0},autoship_by_default:{[e]:!1},modifiers:{},module_view:{regular:"096135e6650111e9a444bc764e106cf4"},incentives_display:{"47c01e9aacbe40389b5c7325d79091aa":{field:"sub_total",object:"order",type:"Discount Percent",value:5},e6534b9d877f41e586c37b7d8abc3a58:{field:"total_price",object:"item",type:"Discount Percent",value:10},f35e842710b24929922db4a529eecd40:{field:"total_price",object:"item",type:"Discount Percent",value:10},"5be321d7c17f4e18a757212b9a20bfcc":{field:"total_price",object:"item",type:"Discount Percent",value:1}},incentives:{[e]:{initial:["5be321d7c17f4e18a757212b9a20bfcc"],ongoing:["e6534b9d877f41e586c37b7d8abc3a58","47c01e9aacbe40389b5c7325d79091aa","f35e842710b24929922db4a529eecd40"]}}},r))},"setPreviewStandardOfferThunk"),"setPreviewStandardOffer"),tl=n((t,e)=>(Object.entries(e).forEach(([r,o])=>{if(Object.prototype.hasOwnProperty.call(t,r)){let i=t[r].concat(o),s=[...new Set(i.map(a=>JSON.stringify(a)))];t[r]=s.map(a=>JSON.parse(a))}else t[r]=o}),t),"mergeProductPlansToState"),rl=n((t,e,r)=>n(async function(i,s){await i({type:gt,payload:{isPreview:t,productId:e}});let{merchantId:a}=s();t?(await i(ye({in_stock:{[e]:!0},module_view:{regular:"096135e6650111e9a444bc764e106cf4"},default_frequencies:{[e]:{every:1,every_period:3}},eligibility_groups:{[e]:["subscription","upsell"]},result:"success",autoship:{[e]:!0},autoship_by_default:{[e]:!1},modifiers:{}},r)),await i(xo({count:1,next:null,previous:null,results:[{merchant:"0e5de2bedc5e11e3a2e4bc764e106cf4",customer:"TestCust",payment:"e98e789aba0111e9b90fbc764e107990",shipping_address:"b3a5816ae59611e78937bc764e1043b0",public_id:"23322d4a83eb11ea9a1ebc764e101db1",sub_total:"206.98",tax_total:"0.00",shipping_total:"10.00",discount_total:"0.00",total:"216.98",created:"2020-04-21 11:14:11",place:"2020-06-24 00:00:00",cancelled:null,tries:0,generic_error_count:0,status:1,type:1,order_merchant_id:null,rejected_message:null,extra_data:null,locked:!1,oos_free_shipping:!1}]})),await i(wt(a,"sig_field","ts","sig"))):await i(me())},"setPreviewUpsellOfferThunk"),"setPreviewUpsellOffer"),ol=n((t,e,r)=>n(async function(i,s){let a=s().productPlans;await i({type:co,payload:{isPreview:t,productId:e}}),await i({type:xe}),await i(ye({in_stock:{[e]:!0},eligibility_groups:{[e]:["subscription","upsell","prepaid"]},result:"success",autoship:{[e]:!0},autoship_by_default:{[e]:!1},modifiers:{},module_view:{regular:"096135e6650111e9a444bc764e106cf4"},incentives_display:{"47c01e9aacbe40389b5c7325d79091aa":{field:"sub_total",object:"order",type:"Discount Percent",value:5},e6534b9d877f41e586c37b7d8abc3a58:{field:"total_price",object:"item",type:"Discount Percent",value:10},f35e842710b24929922db4a529eecd40:{field:"total_price",object:"item",type:"Discount Percent",value:10},"5be321d7c17f4e18a757212b9a20bfcc":{field:"total_price",object:"item",type:"Discount Percent",value:1}},incentives:{[e]:{initial:["5be321d7c17f4e18a757212b9a20bfcc"],ongoing:["e6534b9d877f41e586c37b7d8abc3a58","47c01e9aacbe40389b5c7325d79091aa","f35e842710b24929922db4a529eecd40"]}}},r)),await i({type:z,payload:tl(a,Ze({[e]:[{frequency:"1_3",regularPrice:"$15.00",subscriptionPrice:"$12.00",discountRate:"25%",prepaidShipments:3,regularPrepaidPrice:"$36.00",prepaidSavingsPerShipment:"$3.00",prepaidSavingsTotal:"$9.00",prepaidExtraSavingsPercentage:"10%"},{frequency:"1_3",regularPrice:"$15.00",subscriptionPrice:"$12.00",discountRate:"20%",prepaidShipments:6,regularPrepaidPrice:"$72.00",prepaidSavingsPerShipment:"$3.00",prepaidSavingsTotal:"$18.00",prepaidExtraSavingsPercentage:"10%"},{frequency:"1_3",regularPrice:"$15.00",subscriptionPrice:"$12.00",discountRate:"20%",prepaidShipments:12,regularPrepaidPrice:"$144.00",prepaidSavingsPerShipment:"$3.00",prepaidSavingsTotal:"$36.00",prepaidExtraSavingsPercentage:"10%"}]}))}),await i({type:He,payload:{prepaidSellingPlans:{[e]:[{numberShipments:3,sellingPlan:"1_3"},{numberShipments:6,sellingPlan:"1_3"},{numberShipments:12,sellingPlan:"1_3"}]}}})},"setPreviewPrepaidThunk"),"setPreviewPrepaid"),ea=n((t,e,r)=>async function(o,i){switch(await o({type:de}),await o({type:ue,payload:{isPreview:!1,productId:r.product.id}}),await o({type:gt,payload:{isPreview:!1,productId:r.product.id}}),t){case"regular":o(Xs(!0,r.product.id,r));break;case"upsell":o(rl(!0,r.product.id,r));break;case"subscribed":o(Xs(!0,r.product.id,r)),o(W(r.product,"2_2"));break;case"prepaid":o(ol(!0,r.product.id,r)),o(W(r.product,"1_3"));break;default:}},"setPreview");var nl=n((...t)=>JSON.stringify(t),"memoizeKey"),ra=n(t=>{let e=!1;return(...r)=>{e||(console.warn(t(...r)),e=!0)}},"logOnce"),il=ra((t,e)=>`Hiding Ordergroove offer since the store currency ${t} does not match your configured currency ${e} and you are not set up for multicurrency. Contact your Ordergroove representative for next steps.`),sl=ra(()=>"Hiding Ordergroove offer since cart offers does not currently support product-specific frequency lists."),al=(0,ta.default)((t,e)=>Object.assign({components:e},t),nl),Gr=class extends H{static get properties(){return{...super.properties,config:{type:Object,attribute:!1},product:Fs,productComponents:{type:Array,attribute:"product-components"},offerId:{type:String,attribute:!1},auth:ct,preview:{type:String,attribute:"preview",reflect:"true"},location:{type:String},autoshipByDefault:{type:Boolean,attribute:"autoship-by-default"},productDefaultFrequency:{type:String,attribute:!1},locale:{type:Object,attribute:!0},firstOrderPlaceDate:{type:String,attribute:"first-order-place-date"},productToSubscribe:{type:String,attribute:"product-to-subscribe"},subscribed:{type:Boolean,reflect:!0},frequency:{type:String,reflect:!0},productFrequency:{type:String},isCart:{type:Boolean,attribute:"cart"},optedin:{type:Object},variationId:{type:String}}}firstUpdated(){let e=Array.from(this.getAttributeNames()).find(r=>r.startsWith("preview-"));e==="preview-standard-offer"?this.preview="regular":e==="preview-upsell-offer"?this.preview="upsell":e==="preview-subscribed-offer"?this.preview="subscribed":e==="preview-prepaid-offer"&&(this.preview="prepaid")}static get styles(){return y`
|
|
276
276
|
:host[hidden] {
|
|
277
277
|
display: none;
|
|
278
278
|
}
|
|
@@ -425,7 +425,7 @@ var lib=(()=>{var Da=Object.create;var dt=Object.defineProperty;var Fa=Object.ge
|
|
|
425
425
|
|
|
426
426
|
`}constructor(){super(),this.module="pdp",this.product={},this.productComponents=[],this.fetchOffer=()=>0,this.fetchOrders=()=>0,this.productHasChangedComponents=()=>0,this.setFirstOrderPlaceDate=()=>0,this.setProductToSubscribe=()=>0,this.productChangeFrequency=()=>0}applyTemplate(e){super.applyTemplate(e);let{id:r,locale:o}=e;this.variationId=r,this.locale=o;let i=new CustomEvent("template-changed");this.dispatchEvent(i)}updated(e){if(e.has("preview")&&this.setPreview(this.preview,e.get("preview"),this),this.frequency=this.defaultFrequency,e.has("product")&&!this.isPreview&&dr(()=>this.fetchOffer(this.product.id,Ge,this)),e.has("firstOrderPlaceDate")&&this.product.id&&!this.isPreview&&this.setFirstOrderPlaceDate(this.product.id,this.firstOrderPlaceDate),e.has("productToSubscribe")&&this.product.id&&!this.isPreview&&this.setProductToSubscribe(this.product.id,this.productToSubscribe),e.has("auth")&&this.auth&&!this.isPreview&&this.fetchOrders(),e.has("productComponents")){let r=al(this.product,this.productComponents),o=Object.assign({},this.product,{components:e.get("productComponents")});A(r,o)||this.productHasChangedComponents(r,o)}(e.has("offerId")||e.has("autoshipByDefault")||e.has("location")||e.has("product"))&&this.offerId&&this.autoshipByDefault&&(this.location==="cart"||this.isCart)&&this.product.id&&this.optinProduct&&!(this.optedin||[]).find(r=>A(r,this.product))&&this.optinProduct({...this.product,...this.productComponents.length&&{components:this.productComponents}},this.defaultFrequency,this)}get isPreview(){return this.preview||window.og.previewMode}get shouldEnableOffer(){var e;return this.config&&this.config.storeCurrency&&this.config.merchantSettings&&!(this.config.merchantSettings.multicurrency_enabled||this.config.storeCurrency===this.config.merchantSettings.currency_code)?(il(this.config.storeCurrency,this.config.merchantSettings.currency_code),!1):this.isCart&&((e=this.config)==null?void 0:e.hasProductSpecificFrequencies)?(sl(),!1):!0}render(){return this.shouldEnableOffer?f`
|
|
427
427
|
<slot></slot>
|
|
428
|
-
`:null}get defaultFrequency(){let e=this.productFrequency||this.productDefaultFrequency;if(e)return e;let r=this.querySelector("og-select-frequency");return r&&r.currentFrequency?r.currentFrequency:this.getOption("defaultFrequency")}};n(
|
|
428
|
+
`:null}get defaultFrequency(){let e=this.productFrequency||this.productDefaultFrequency;if(e)return e;let r=this.querySelector("og-select-frequency");return r&&r.currentFrequency?r.currentFrequency:this.getOption("defaultFrequency")}};n(Gr,"Offer");var cl=n((t,e)=>({config:t.config,auth:t.auth,offerId:((t.productOffer||{})[(e.product||{}).id]||[])[0],productFrequency:te(e.product)(t),productDefaultFrequency:Ye((e.product||{}).id)(t),...$(t,e,"autoshipByDefault",yo(t)[(e.product||{}).id]),...ur(e.product)(t)&&{autoshipByDefault:!1},optedin:Tt(t),subscribed:X(e.product)(t),...We(t)}),"mapStateToProps"),oa=g(cl,{fetchOffer:Oi,fetchOrders:yr,productHasChangedComponents:bi,optinProduct:W,setFirstOrderPlaceDate:Ai,setProductToSubscribe:Ni,setPreview:ea})(Gr);var Ut=class extends x{constructor(){super(),this.showCancelButton=!0,this.showConfirmButton=!0}static get properties(){return{title:{type:String,attribute:!1},content:{type:String,attribute:!1},confirmText:{type:String,attribute:!1},cancelText:{type:String,attribute:!1},showCancelButton:{type:Boolean},showConfirmButton:{type:Boolean},show:{type:Boolean,attribute:"show"}}}static get styles(){return y`
|
|
429
429
|
:host[hidden] {
|
|
430
430
|
display: none;
|
|
431
431
|
}
|
|
@@ -794,7 +794,7 @@ var lib=(()=>{var Da=Object.create;var dt=Object.defineProperty;var Fa=Object.ge
|
|
|
794
794
|
<slot name="content">${this.content}</slot>
|
|
795
795
|
</div>
|
|
796
796
|
</span>
|
|
797
|
-
`}};n(Mt,"Tooltip");var B=class extends N(x){static get properties(){return{options:{type:Array},shipmentsOptedIn:{type:Number},prepaidShipmentsSelected:{type:Number},defaultPrepaidShipments:{type:Number,attribute:"default-prepaid-shipments"}}}get prepaidOptedIn(){return this.shipmentsOptedIn>1}get selectedNumberOfShipments(){return this.prepaidShipmentsSelected||this.shipmentsOptedIn||this.getDefaultPrepaidShipments()}getDefaultPrepaidShipments(){return this.options.includes(this.defaultPrepaidShipments)?this.defaultPrepaidShipments:this.options[1]||this.options[0]}handleSelect({target:{value:e}}){let r=+e;this.productChangePrepaidShipments(this.product,r,this.offer)}render(){return f``}};n(B,"PrepaidStatus");var pl=n((t,e)=>({options:M(e.product.id)(t),shipmentsOptedIn:L(e.product)(t),prepaidShipmentsSelected:ee(e.product)(t)}),"mapStateToProps"),ug=g(pl,{productChangePrepaidShipments:ge})(B);var
|
|
797
|
+
`}};n(Mt,"Tooltip");var B=class extends N(x){static get properties(){return{options:{type:Array},shipmentsOptedIn:{type:Number},prepaidShipmentsSelected:{type:Number},defaultPrepaidShipments:{type:Number,attribute:"default-prepaid-shipments"}}}get prepaidOptedIn(){return this.shipmentsOptedIn>1}get selectedNumberOfShipments(){return this.prepaidShipmentsSelected||this.shipmentsOptedIn||this.getDefaultPrepaidShipments()}getDefaultPrepaidShipments(){return this.options.includes(this.defaultPrepaidShipments)?this.defaultPrepaidShipments:this.options[1]||this.options[0]}handleSelect({target:{value:e}}){let r=+e;this.productChangePrepaidShipments(this.product,r,this.offer)}render(){return f``}};n(B,"PrepaidStatus");var pl=n((t,e)=>({options:M(e.product.id)(t),shipmentsOptedIn:L(e.product)(t),prepaidShipmentsSelected:ee(e.product)(t)}),"mapStateToProps"),ug=g(pl,{productChangePrepaidShipments:ge})(B);var Br=class extends B{constructor(){super(),this.options=[],this.text="shipments"}static get properties(){return{...super.properties,text:{type:String}}}static get styles(){return y`
|
|
798
798
|
og-select {
|
|
799
799
|
display: inline-block;
|
|
800
800
|
cursor: pointer;
|
|
@@ -828,7 +828,7 @@ var lib=(()=>{var Da=Object.create;var dt=Object.defineProperty;var Fa=Object.ge
|
|
|
828
828
|
<slot name="append"></slot>
|
|
829
829
|
</label>
|
|
830
830
|
</div>
|
|
831
|
-
`}};n(
|
|
831
|
+
`}};n(Br,"PrepaidToggle");var ll=n((t,e)=>({options:M(e.product.id)(t),shipmentsOptedIn:L(e.product)(t),prepaidShipmentsSelected:ee(e.product)(t)}),"mapStateToProps"),na=g(ll,{productChangePrepaidShipments:ge})(Br);var zr=class extends B{static get properties(){return{...super.properties,productPlans:{type:Object},prepaidShipmentsSelected:{type:Number},totalPrice:{type:Boolean,reflect:!0,attribute:"total-price"},perDeliveryPrice:{type:Boolean,reflect:!0,attribute:"per-delivery-price"},totalSavings:{type:Boolean,reflect:!0,attribute:"total-savings"},perDeliverySavings:{type:Boolean,reflect:!0,attribute:"per-delivery-savings"},percentageSavings:{type:Boolean,reflect:!0,attribute:"percentage-savings"},extraPercentageSavings:{type:Boolean,reflect:!0,attribute:"extra-percentage-savings"},numberOfShipments:{type:Boolean,reflect:!0,attribute:"number-of-shipments"}}}static get styles(){return y`
|
|
832
832
|
:host {
|
|
833
833
|
display: inline-block;
|
|
834
834
|
text-indent: initial;
|
|
@@ -839,7 +839,7 @@ var lib=(()=>{var Da=Object.create;var dt=Object.defineProperty;var Fa=Object.ge
|
|
|
839
839
|
<slot name="append"></slot>
|
|
840
840
|
`:f`
|
|
841
841
|
<slot name="fallback"></slot>
|
|
842
|
-
`}};n(
|
|
842
|
+
`}};n(zr,"PrepaidData");var ul=n((t,e)=>({options:M(e.product.id)(t),shipmentsOptedIn:L(e.product)(t),prepaidShipmentsSelected:ee(e.product)(t),productPlans:t.productPlans}),"mapStateToProps"),ia=g(ul)(zr);var Yr=class extends B{constructor(){super(),this.addEventListener("click",this.handleClick.bind(this))}static get styles(){return y`
|
|
843
843
|
:host {
|
|
844
844
|
cursor: pointer;
|
|
845
845
|
display: inline-block;
|
|
@@ -893,7 +893,7 @@ var lib=(()=>{var Da=Object.create;var dt=Object.defineProperty;var Fa=Object.ge
|
|
|
893
893
|
<slot name="label"><og-text key="prepaidOptInLabel"></og-text></slot>
|
|
894
894
|
</label>
|
|
895
895
|
</slot>
|
|
896
|
-
`}};n(
|
|
896
|
+
`}};n(Yr,"PrepaidButton");var dl=n((t,e)=>({options:M(e.product.id)(t),shipmentsOptedIn:L(e.product)(t),prepaidShipmentsSelected:ee(e.product)(t)}),"mapStateToProps"),sa=g(dl,{productChangePrepaidShipments:ge})(Yr);var Wr=class extends B{constructor(){super(),this.options=[],this.text="shipments"}static get properties(){return{...super.properties,text:{type:String}}}static get styles(){return y`
|
|
897
897
|
og-select {
|
|
898
898
|
display: inline-block;
|
|
899
899
|
cursor: pointer;
|
|
@@ -914,7 +914,7 @@ var lib=(()=>{var Da=Object.create;var dt=Object.defineProperty;var Fa=Object.ge
|
|
|
914
914
|
<span>${e[0].text}</span>
|
|
915
915
|
`}
|
|
916
916
|
<slot name="append"></slot>
|
|
917
|
-
`}};n(
|
|
917
|
+
`}};n(Wr,"PrepaidSelect");var fl=n((t,e)=>({options:M(e.product.id)(t),shipmentsOptedIn:L(e.product)(t),prepaidShipmentsSelected:ee(e.product)(t)}),"mapStateToProps"),aa=g(fl,{productChangePrepaidShipments:ge})(Wr);var Jr=class extends pt{static get properties(){return{...super.properties,prepaidShipmentsOptedIn:{type:Number}}}get isActive(){return this.prepaidShipmentsOptedIn>0?!1:this.subscribed}handleClick(e){if(!this.isActive){let r=this.frequencies&&this.frequencies.length>0?this.frequencies[0]:this.optinFrequency;this.optinProduct(Dt(this),r,this.offer)}e.preventDefault()}render(){return f`
|
|
918
918
|
<slot name="default">
|
|
919
919
|
<button id="action-trigger" class="btn radio ${this.isActive?" active":""}"></button>
|
|
920
920
|
<label for="action-trigger">
|
|
@@ -923,7 +923,7 @@ var lib=(()=>{var Da=Object.create;var dt=Object.defineProperty;var Fa=Object.ge
|
|
|
923
923
|
</slot>
|
|
924
924
|
</label>
|
|
925
925
|
</slot>
|
|
926
|
-
`}};n(
|
|
926
|
+
`}};n(Jr,"SubscriptionButton");var ca=g(J,{optinProduct:W})(Jr);var $t=class extends x{static get styles(){return y`
|
|
927
927
|
:host {
|
|
928
928
|
position: fixed;
|
|
929
929
|
top: 5em;
|
|
@@ -1002,14 +1002,14 @@ var lib=(()=>{var Da=Object.create;var dt=Object.defineProperty;var Fa=Object.ge
|
|
|
1002
1002
|
<br />
|
|
1003
1003
|
<button @click=${this.toggleUpsellNextOrder(r)}>upsell product is in next order</button>
|
|
1004
1004
|
<br />
|
|
1005
|
-
`)}toggleUpsellPreview(e){return r=>{r.preventDefault();let o=document.querySelectorAll("og-offer")[e];o.getAttribute("preview-upsell-offer")?o.removeAttribute("preview-upsell-offer"):o.setAttribute("preview-upsell-offer",!0),this.runTests()}}toggleProductFlags(e,{inStock:r=!0,autoship:o=!0,groups:i=["subscription","upsell"]}){return s=>{s.preventDefault();let a=document.querySelectorAll("og-offer")[e],c=a.product.id;a.store.dispatch(ye({in_stock:{[c]:r},eligibility_groups:{[c]:i},result:"success",autoship:{[c]:o},module_view:{regular:"58a01e9aacbe40389b5c7325d79091bb"},modifiers:{},incentives_display:{"47c01e9aacbe40389b5c7325d79091aa":{field:"sub_total",object:"order",type:"Discount Percent",value:5},e6534b9d877f41e586c37b7d8abc3a58:{field:"total_price",object:"item",type:"Discount Percent",value:5},f35e842710b24929922db4a529eecd40:{field:"total_price",object:"item",type:"Discount Percent",value:10},"5be321d7c17f4e18a757212b9a20bfcc":{field:"total_price",object:"item",type:"Discount Percent",value:1}},incentives:{[c]:{initial:["5be321d7c17f4e18a757212b9a20bfcc"],ongoing:["e6534b9d877f41e586c37b7d8abc3a58","47c01e9aacbe40389b5c7325d79091aa","f35e842710b24929922db4a529eecd40"]}}})),this.runTests()}}toggleUpsellNextOrder(e){return r=>{let o=document.querySelectorAll("og-offer")[e],i=o.product.id;r.preventDefault(),o.store.dispatch(
|
|
1005
|
+
`)}toggleUpsellPreview(e){return r=>{r.preventDefault();let o=document.querySelectorAll("og-offer")[e];o.getAttribute("preview-upsell-offer")?o.removeAttribute("preview-upsell-offer"):o.setAttribute("preview-upsell-offer",!0),this.runTests()}}toggleProductFlags(e,{inStock:r=!0,autoship:o=!0,groups:i=["subscription","upsell"]}){return s=>{s.preventDefault();let a=document.querySelectorAll("og-offer")[e],c=a.product.id;a.store.dispatch(ye({in_stock:{[c]:r},eligibility_groups:{[c]:i},result:"success",autoship:{[c]:o},module_view:{regular:"58a01e9aacbe40389b5c7325d79091bb"},modifiers:{},incentives_display:{"47c01e9aacbe40389b5c7325d79091aa":{field:"sub_total",object:"order",type:"Discount Percent",value:5},e6534b9d877f41e586c37b7d8abc3a58:{field:"total_price",object:"item",type:"Discount Percent",value:5},f35e842710b24929922db4a529eecd40:{field:"total_price",object:"item",type:"Discount Percent",value:10},"5be321d7c17f4e18a757212b9a20bfcc":{field:"total_price",object:"item",type:"Discount Percent",value:1}},incentives:{[c]:{initial:["5be321d7c17f4e18a757212b9a20bfcc"],ongoing:["e6534b9d877f41e586c37b7d8abc3a58","47c01e9aacbe40389b5c7325d79091aa","f35e842710b24929922db4a529eecd40"]}}})),this.runTests()}}toggleUpsellNextOrder(e){return r=>{let o=document.querySelectorAll("og-offer")[e],i=o.product.id;r.preventDefault(),o.store.dispatch(vo({count:1,next:null,previous:null,results:[{order:"24d50352579511ea806cbc764e100cfd",offer:null,subscription:"8a076b7a0ea011e7a5bcbc764e105eda",product:i,components:[],quantity:1,public_id:"24d6901e579511ea806cbc764e100cfd",product_attribute:null,price:"14.99",extra_cost:"0.00",total_price:"13.49",one_time:!1,frozen:!1,first_placed:null}]})),this.runTests()}}render(){return f`
|
|
1006
1006
|
<div>
|
|
1007
1007
|
${this.testsRan?this.resultsCodeBlock():f`
|
|
1008
1008
|
<div>Click the button to run tests</div>
|
|
1009
1009
|
`}
|
|
1010
1010
|
<button ?disabled=${this.disabled} @click="${this.runTests.bind(this)}" class="primary">Run Test</button>
|
|
1011
1011
|
</div>
|
|
1012
|
-
`}};n($t,"TestWizard");function
|
|
1012
|
+
`}};n($t,"TestWizard");function Qo(){let t="og-test-wizard";customElements.get(t)||customElements.define(t,$t);let e=document.createElement(t);document.body.appendChild(e)}n(Qo,"default");var Zo=[79,71,68,69,86],pa=n(()=>{if(window.OG_OFFERS_TEST_MODE_ENABLE)return;window.OG_OFFERS_TEST_MODE_ENABLE=!0;let t=0;document.addEventListener("keyup",async function(e){if(e.which===Zo[t]){let o=Zo[t];setTimeout(function(){t<=o&&(t=0)},5e3),t+=1,t>=Zo.length&&Qo()}else t=0},!1)},"enable");var Kr=n((t=[],e)=>{switch(e.type){case de:return[];case ve:return e.newValue?e.newValue.optedin:t;case R:case k:{let[{prepaidShipments:r,...o},i]=Ke(t,e.payload.product);return i.concat({...o,...e.payload.product,frequency:e.payload.frequency})}case ae:{let{payload:r}=e,[{prepaidShipments:o,...i},s]=Ke(t,r.product),a={...i,...r.product};return r.prepaidShipments&&(a.prepaidShipments=r.prepaidShipments),s.concat(a)}case I:return t.filter(r=>!A(e.payload.product,r));case ht:return t.map(r=>A(e.payload.product,r)?{...r,...e.payload.newProduct}:r);case Qt:return t.filter(r=>!A(e.payload.product,r));case je:return[];default:return t}},"optedin"),Xo=n((t=[],e)=>{switch(e.type){case de:return[];case ve:return e.newValue?e.newValue.optedout:t;case R:case k:return t.filter(r=>!A(e.payload.product,r));case I:{let[r,o]=Ke(t,e.payload.product);return o.concat({...r,...e.payload.product,frequency:e.payload.frequency})}case ht:return t.map(r=>A(e.payload.product,r)?{...r,...e.payload.newProduct}:r);case je:return[];default:return t}},"optedout"),en=n((t={},{type:e,payload:r})=>{switch(e){case Yt:return r&&r.count>0?{...t,...r.results[0]&&{...r.results[0],place:new Date(Date.parse(r.results[0].place.replace(/-/gi,"/")))}}:t;case Wt:return{...t,products:(r.results||[]).map(o=>o.product)};case Kt:return{...t,...r,public_id:r.order,...r.product&&{products:(t.products||[]).concat(r.product)}};default:return t}},"nextUpcomingOrder"),ml=n((t={},e)=>{switch(e.type){case P:return{...t,...e.payload.autoship};default:return t}},"autoshipEligible"),gl=n((t={},e)=>{switch(e.type){case q:return{...t};case P:return{...t,...e.payload.in_stock};default:return t}},"inStock"),tn=n((t={},e)=>{switch(e.type){case P:return{...t,...e.payload.eligibility_groups};default:return t}},"eligibilityGroups"),la=n((t,e)=>t.map(r=>({...e[r],id:[r][0]})),"mapIncentive"),rn=n((t={},e)=>{switch(e.type){case P:return{...t,...[...new Set(Object.keys(e.payload.incentives||{}))].reduce((r,o)=>({...r,[o]:Object.entries(e.payload.incentives).filter(([i])=>i===o).reduce((i,[,{initial:s,ongoing:a}])=>({...i,initial:[...i.initial||[],...la(s,e.payload.incentives_display)],ongoing:[...i.ongoing||[],...la(a,e.payload.incentives_display)]}),{})}),{})};default:return t}},"incentives"),yl=n((t={},e)=>{switch(e.type){case R:case k:return{...t,[T(e.payload.product)]:e.payload.frequency};case I:return{...t,[T(e.payload.product)]:void 0};default:return t}},"frequency"),on=n((t=!1,e)=>{switch(e.type){case zt:return{...e.payload};case xe:return!1;default:return t}},"auth"),nn=n((t="",e)=>{switch(e.type){case Fe:return e.payload;default:return t}},"merchantId"),sn=n((t=null,e)=>{switch(e.type){case Bt:return e.payload;default:return t}},"authUrl"),bl=n((t={},e)=>{switch(e.type){case P:return{...t,offerId:(e.payload.module_view||{}).regular,...e.payload.modifiers};default:return t}},"offer"),an=n((t="",e)=>{switch(e.type){case P:return(e.payload.module_view||{}).regular||"";default:return t}},"offerId"),cn=n((t=null,e)=>{switch(e.type){case de:return null;case Ue:return e.payload;default:return t}},"sessionId"),_l=n((t={},e)=>{switch(e.type){case P:return{...t,...Object.entries(e.payload.autoship).map(([r])=>({[r]:Object.keys(e.payload.modifiers)})).reduce((r,o)=>({...r,...o}),{})};case je:return{};default:return t}},"productOffer"),pn=n((t={},e)=>{switch(e.type){case tr:return{...t,[T(e.payload.product)]:e.payload.firstOrderPlaceDate};default:return t}},"firstOrderPlaceDate"),ln=n((t={},e)=>{switch(e.type){case rr:return{...t,[T(e.payload.product)]:e.payload.productToSubscribe};default:return t}},"productToSubscribe"),un=n((t={},e)=>{switch(e.type){case Le:return{...t,name:"local",apiUrl:"http://py3web.ordergroove.localhost",legoUrl:"http://py3lego.ordergroove.localhost"};case Me:return{...t,name:Oe,apiUrl:"https://staging.offers.ordergroove.com",legoUrl:"https://staging.restapi.ordergroove.com"};case $e:return{...t,name:or,apiUrl:"https://dev.offers.ordergroove.com",legoUrl:"https://dev.restapi.ordergroove.com"};case Ve:return{...t,name:Te,apiUrl:"https://offers.ordergroove.com",legoUrl:"https://restapi.ordergroove.com"};default:return t}},"environment"),dn=n((t={offerOptInLabel:"Subscribe to save",offerIncentiveText:"Save {{ogIncentive DiscountPercent}} when you subscribe",offerOptOutLabel:"Deliver one-time only",offerEveryLabel:"Delivery Every",offerTooltipTrigger:"[?]",offerTooltipContent:"Seems this is a great subscription offering. Many fun details about this program exist.",optinButtonLabel:"\u2022",optoutButtonLabel:"\u2022",optinStatusOptedInLabel:"You're opted in!",optinStatusOptedOutLabel:"You're not opted in.",optinToggleLabel:"\u2022",upsellButtonLabel:"Add item to order on ",upsellButtonPrefix:"",upsellModalContent:"Some upsell modal content",upsellModalOptInLabel:"Subscribe",upsellModalOptOutLabel:"Purchase one time",upsellModalTitle:"Impulse Upsell",upsellModalConfirmLabel:"Ok",upsellModalCancelLabel:"Cancel",defaultFrequencyCopy:"(Most Popular)",frequencyPeriods:{1:"day",2:"week",3:"month"},prepaidOptInLabel:"Prepaid Subscription",prepaidShipmentsLabel:"Number of prepaid shipments"},e)=>{switch(e.type){case Zt:return{...t,...e.payload};default:return t}},"locale"),Sl=n((t={offerType:"radio"},e)=>{switch(e.type){case He:return{...t,...e.payload,defaultFrequency:e.payload.defaultFrequency?vt(e.payload.defaultFrequency):t.defaultFrequency,frequenciesEveryPeriod:[],frequencies:e.payload.frequencies?e.payload.frequencies.map(vt):t.frequencies};case ce:return{...t,merchantSettings:{...e.payload}};default:return t}},"config"),fn=n((t=!1,e)=>{switch(e.type){case ue:return e.payload.isPreview;default:return t}},"previewStandardOffer"),hn=n((t=!1,e)=>{switch(e.type){case gt:return e.payload.isPreview;default:return t}},"previewUpsellOffer");var mn=n((t=[],e)=>{switch(e.type){case P:return{...t,...e.payload.autoship_by_default};default:return t}},"autoshipByDefault"),gn=n((t=[],e)=>{switch(e.type){case P:return{...t,...e.payload.default_frequencies};default:return t}},"defaultFrequencies"),yn=n((t=[],e)=>{switch(e.type){case er:return[...e.payload||[]];case Xt:return[e.payload,...t];default:return t}},"templates"),El=n((t={},e)=>{switch(e.type){case z:return Ze(e.payload);default:return t}},"productPlans"),bn=n((t={},e)=>{switch(e.type){case mt:{let{[e.payload.oldCartProductKey]:r,...o}=t;return{...o,[e.payload.newCartProductKey]:r}}case ae:return e.payload.prepaidShipments?{...t,[e.payload.product.id]:e.payload.prepaidShipments}:t;default:return t}},"prepaidShipmentsSelected"),Qr=Vt({optedin:Kr,optedout:Xo,nextUpcomingOrder:en,autoshipEligible:ml,inStock:gl,eligibilityGroups:tn,incentives:rn,frequency:yl,auth:on,merchantId:nn,authUrl:sn,offer:bl,offerId:an,experiments:Sr,sessionId:cn,productOffer:_l,firstOrderPlaceDate:pn,productToSubscribe:ln,environment:un,locale:dn,config:Sl,previewStandardOffer:fn,previewUpsellOffer:hn,autoshipByDefault:mn,defaultFrequencies:gn,templates:yn,productPlans:El,prepaidShipmentsSelected:bn});var Zr=class extends N(H){static get properties(){return{...super.properties,regular:{type:Boolean,reflect:!0},subscription:{type:Boolean,reflect:!0},discount:{type:Boolean,reflect:!0},payAsYouGo:{type:Boolean,reflect:!0,attribute:"pay-as-you-go"},frequency:{type:Object},productPlans:{type:Object}}}static get styles(){return y`
|
|
1013
1013
|
:host::before {
|
|
1014
1014
|
clip-path: inset(100%);
|
|
1015
1015
|
clip: rect(1px, 1px, 1px, 1px);
|
|
@@ -1033,6 +1033,6 @@ var lib=(()=>{var Da=Object.create;var dt=Object.defineProperty;var Fa=Object.ge
|
|
|
1033
1033
|
<slot name="append"></slot>
|
|
1034
1034
|
`:f`
|
|
1035
1035
|
<slot name="fallback"></slot>
|
|
1036
|
-
`}};n(Kr,"Price");var xl=n((t,e)=>{var r;return{productPlans:t.productPlans,configDefaultFrequency:(r=t.config)==null?void 0:r.defaultFrequency,frequency:te(e.product)(t)}},"mapStateToProps"),ua=g(xl)(Kr);function yn(t){pa(),rs(t);try{customElements.define("og-when",Ds),customElements.define("og-text",Bs),customElements.define("og-incentive-text",Js),customElements.define("og-offer",oa),customElements.define("og-select-frequency",Ks),customElements.define("og-optout-button",Ms),customElements.define("og-optin-toggle",Gs),customElements.define("og-optin-status",Us),customElements.define("og-optin-button",Ls),customElements.define("og-optin-select",Vs),customElements.define("og-upsell-button",js),customElements.define("og-frequency-status",$s),customElements.define("og-modal",Ut),customElements.define("og-select",Lt),customElements.define("og-tooltip",Mt),customElements.define("og-upsell-modal",Hs),customElements.define("og-next-upcoming-order",Zs),customElements.define("og-price",ua),customElements.define("og-prepaid-toggle",na),customElements.define("og-prepaid-data",ia),customElements.define("og-prepaid-button",sa),customElements.define("og-prepaid-select",aa),customElements.define("og-subscription-button",ca)}catch{console.info("OG WebComponents already registered, skipping.")}let e=!1,r={store:t,isReady:()=>e,setEnvironment(o){return t.dispatch(Ei(o)),this},setMerchantId(o){return t.dispatch(bi(o)),this},setAuthUrl(o){return t.dispatch(_i(o)),this},receiveMerchantSettings(o){return t.dispatch(Ii(o)),this},getProductsForPurchasePost(o=[]){return wo(t.getState(),o)},getOptins(o=[]){return wo(t.getState(),o)},clear(){t.dispatch(Oi())},addOptinChangedCallback(o){typeof o=="function"&&document.addEventListener("optin-changed",i=>o(i.detail))},disableOptinChangedCallbacks(){document.addEventListener("optin-changed",o=>o.stopPropagation(),!0)},register(){},previewMode(o){return window.og=window.og||{},o===!1?delete window.og:window.og.previewMode=!0,this},config(o){return t.dispatch(wi(o)),this},setLocale(o){return t.dispatch(Pi(o)),this},addTemplate(o,i,s){return t.dispatch(Ci(o,i,s)),this},setTemplates(o){return t.dispatch(Ri(o)),this},setPublicPath(o){return this},resolveSettings(o,i,s,a=t){if(o&&i&&s){let c=[];s.product?c.push(s.product):s.cart&&Array.isArray(s.cart.products)&&(c=c.concat(s.cart.products));let p=a.getState(),{sessionId:l}=p;l&&c.forEach(d=>a.dispatch(xo(d))),s.product_discounts&&typeof s.product_discounts=="object"&&a.dispatch({type:z,payload:s.product_discounts})}},initialize(o,i,s,a){var p;e?console.warn("og.offers has been initialized already. Skipping."):r.resolveSettings(o,i,window.og_settings,t);let c=t.getState();return o&&o!==c.merchantId&&r.setMerchantId(o),i&&i!==((p=c.environment)==null?void 0:p.name)&&r.setEnvironment(i),a&&r.receiveMerchantSettings(a),s&&r.setAuthUrl(s),e=!0,this}};return window.OG=window.OG||{},Object.assign(window.OG,r),Object.assign(r.initialize,r),Po(window.opener,r),r}n(yn,"makeApi");var le=n((t,e)=>t===null?"":new Intl.NumberFormat(navigator.language,{style:"currency",currency:e}).format(t/100),"money"),Qr=n(t=>`${t}%`,"percentage");var Zr=n(t=>{var e,r;return Array.isArray((e=t.selling_plan)==null?void 0:e.options)&&((r=t.selling_plan)==null?void 0:r.options.some(o=>(o==null?void 0:o.name)==="Shipment amount"))},"isPrepaidAllocation"),Xr=n(t=>{if(t&&t.length>1){let e=t.find(r=>(r==null?void 0:r.name)==="Shipment amount").value.split(" ");return e.length>0?+e[0]:null}return null},"getPrepaidShipmentsNumberFromOptions"),vl=n(t=>{var e,r;return(t.selling_plan_id||((r=(e=t.selling_plan)==null?void 0:e.id)!=null?r:"")).toString()},"getAllocationFrequency"),Ol=n((t,e)=>le(t.compare_at_price,e),"getAllocationRegularPrice"),Tl=n((t,e)=>{var r;if(Zr(t)){let o=Xr((r=t.selling_plan)==null?void 0:r.options),i=Math.round(t.price/o);return le(i,e)}return le(t.price,e)},"getAllocationSubscriptionPrice"),da=n((t,e)=>Math.round((t.compare_at_price-e)*100/t.compare_at_price),"getPrepaidPercentage"),Pl=n((t,e)=>{var o,i,s;if(Zr(t)){let a=Xr((o=t.selling_plan)==null?void 0:o.options),c=t.price/a,p=da(t,c);return Qr(p)}let r="";return((i=t.price_adjustments[0])==null?void 0:i.value_type)==="percentage"?r=Qr(t.price_adjustments[0].value):(s=t.price_adjustments[0])!=null&&s.value?r=le(t.price_adjustments[0].value,e):t.compare_at_price&&(r=le(t.compare_at_price-t.price,e)),r},"getAllocationDiscountRate"),wl=n(t=>{var e;return Zr(t)?Xr((e=t.selling_plan)==null?void 0:e.options):null},"getAllocationNumberOfShipments"),Cl=n((t,e,r,o)=>{var d,u;let i=Xr((d=t.selling_plan)==null?void 0:d.options),s=t.price/i,a=t.compare_at_price-s,c=da(t,s),p=(u=r==null?void 0:r.price_adjustments)==null?void 0:u[0],l=p&&p.value_type==="percentage"?p.value:null;return e.regularPrepaidPrice=le(t.price,o),e.prepaidSavingsPerShipment=le(Math.round(a),o),e.prepaidSavingsTotal=le(Math.round(a*i),o),l&&c&&(e.prepaidExtraSavingsPercentage=Qr(c-l)),e},"addPrepaidPriceAndSavings"),bn="Subscribe and Save",Rl=n((t,e,r)=>{t.selling_plan||(t.selling_plan=e.find(i=>i.id===t.selling_plan_id));let o={frequency:vl(t),regularPrice:Ol(t,r),subscriptionPrice:Tl(t,r),discountRate:Pl(t,r),prepaidShipments:wl(t)};if(Zr(t)){let i=e.find(s=>s.group_name===bn&&s.options.length===1);return Cl(t,o,i,r)}return o},"mapSellingPlanToDiscount"),_n=n((t,e,r=[],o)=>[...t,Rl(e,r,o)],"sellingPlanAllocationsReducer"),fa=n(t=>t.selling_plan_groups.reduce((e,r)=>[...e,...r.selling_plans.map(o=>({...o,group_name:r.name}))],[]),"getSellingPlans");var ma=n((t,e,r)=>{let o=Object.keys(t).filter(i=>i.startsWith(e.toString()));return o.length?{...t,...o.reduce((i,s)=>({...i,[s]:r}),{})}:t},"overrideLineKey"),ha=n((t,e,r)=>{if(!r)return null;if(!Je(r))return r;if(fr(t,e)){let o=re(t,e,r);return o||he(t)}return r},"getDefaultSellingPlan"),Al=n((t,e)=>t.map(r=>{var o,i,s,a,c,p,l;return Je(r==null?void 0:r.frequency)?{...r,frequency:fr((o=e==null?void 0:e.config)==null?void 0:o.frequencies,(i=e==null?void 0:e.config)==null?void 0:i.frequenciesEveryPeriod)?re((s=e==null?void 0:e.config)==null?void 0:s.frequencies,(a=e==null?void 0:e.config)==null?void 0:a.frequenciesEveryPeriod,r.frequency)||re((c=e==null?void 0:e.config)==null?void 0:c.frequencies,(p=e==null?void 0:e.config)==null?void 0:p.frequenciesEveryPeriod,e==null?void 0:e.defaultFrequency)||he((l=e==null?void 0:e.config)==null?void 0:l.frequencies):r.frequency}:r}),"mapExistingOptinsFromOfferResponse"),Nl=n(({autoship:t={},autoship_by_default:e={},default_frequencies:r={},in_stock:o={}},i,s)=>Object.keys(t).reduce((a,c)=>{if(!i.some(p=>p.id===c)){if(!(t[c]&&e[c]&&o[c]))return a;let{config:{frequencies:p,frequenciesEveryPeriod:l}={},defaultFrequency:d}=s||{},u=r[c],h;return r[c]&&fr(p,l)?h=re(p,l,`${u.every}_${u.every_period}`)||ha(p,l,d)||he(p):r[c]?h=`${u.every}_${u.every_period}`:h=ha(p,l,d)||"_",a.concat({id:c,frequency:h})}return a},[]),"reduceNewOptinsFromOfferResponse"),ga=n(t=>(t==null?void 0:t.selling_plan_groups.find(Sn))||kl(t),"getOGSellingPlanGroup"),Il=n(t=>((t==null?void 0:t.selling_plan_groups)||[]).filter(r=>ya(r)||Sn(r)),"getOGSellingPlanGroups"),kl=n(t=>t==null?void 0:t.selling_plan_groups.find(ya),"getDefaultSubscriptionSellingPlanGroup"),ya=n(t=>t.name===bn,"isDefaultSellingPlanGroup"),Sn=n(t=>t.name.startsWith("og_psfl"),"isProductSpecificFrequencySellingPlanGroup"),ql=n((t,e)=>({...ma(t,e.id,e.available),[e.id]:e.available}),"productOrVariantInStockReducer"),ba=n((t,[e])=>({...t,[e]:!0}),"productTrue"),_a=n((t,e)=>{let r=T(e.key);return{...t,[e.key]:t[r]||null}},"reduceProductCartLine"),Dl=n((t={},e)=>{var r;if(z===e.type)return Object.entries(e.payload).reduce(ba,t);if(fe===e.type){let{payload:o}=e;return o.items.reduce(_a,t)}if(Q===e.type){let{payload:{product:o}}=e,i=Il(o),s=new Set((r=i.flatMap(a=>a.selling_plans.map(c=>c.id)))!=null?r:[]);return[o,...(o==null?void 0:o.variants)||[]].reduce((a,c)=>{var d,u;let l=((u=(d=c==null?void 0:c.selling_plan_allocations)==null?void 0:d.filter(h=>s.has(h.selling_plan_id)))!=null?u:[]).length>0;return{...ma(a,c.id,l),[c.id]:l}},t)}return ue===e.type?e.payload.isPreview!==!0?t:{...t,[e.payload.productId]:!0}:t},"autoshipEligible");function Fl(t){let e=["day","week","month"].findIndex(o=>t.toLowerCase().includes(o))+1,r=(t.match(/(\d+)/)||["",1])[1];return r&&e?`${r}_${e}`:null}n(Fl,"textToFreq");function Sa(t){var e;return(e=t==null?void 0:t.selling_plans)==null?void 0:e.map(({options:r})=>r||[]).flat().map(({value:r})=>Fl(r))}n(Sa,"sellingPlansToEveryPeriod");function Ea(t){var e;return(e=t==null?void 0:t.selling_plans)==null?void 0:e.map(({id:r})=>`${r}`)}n(Ea,"sellingPlansToFrequencies");function xa(t){var r;let e=(r=t==null?void 0:t.options.find(({name:o})=>o==="Shipment amount"))==null?void 0:r.value.split(" ")[0];return e?Number(e):void 0}n(xa,"getPrepaidShipments");function Ul(t){return t.reduce((e,r)=>{let o=r.name.split("-")[1],i=r.selling_plans.map(s=>({numberShipments:xa(s),sellingPlan:String(s.id)}));return{...e,[o]:i}},{})}n(Ul,"getPrepaidSellingPlans");var Ll=n((t={frequencies:[],offerType:"radio",frequenciesEveryPeriod:[]},e)=>{var r,o,i;if(z===e.type){let s=[...new Set(Object.values(e.payload).map(Object.keys).flat())];return{...t,frequencies:s}}if(Q===e.type){let{payload:{product:s,currency:a}}=e,c={},p=ga(s),l=Ea(p);if(l!=null&&l.length){let u=Sa(p),h=((o=(r=p.options)==null?void 0:r[0])==null?void 0:o.values)||l,_=t.defaultFrequency;_&&Je(_)&&(_=re(l,u,_)||he(l)||_),c={frequencies:l,frequenciesEveryPeriod:u,frequenciesText:h,..._?{defaultFrequency:_}:{},hasProductSpecificFrequencies:t.hasProductSpecificFrequencies||Sn(p)}}let d=s==null?void 0:s.selling_plan_groups.filter(u=>/^Prepaid-.*/.test(u.name));return d.length&&(c={...c,prepaidSellingPlans:{...t.prepaidSellingPlans,...Ul(d)}}),{...t,...c,storeCurrency:a}}if(P===e.type){let{payload:{offer:s}}=e,{defaultFrequency:a,config:{frequencies:c,frequenciesEveryPeriod:p,prepaidSellingPlans:l={}}={},product:d}=s||{};return(i=l[d==null?void 0:d.id])!=null&&i.some(({sellingPlan:u})=>u===a)?{...t,defaultFrequency:he(c)||a}:Je(a)?{...t,defaultFrequency:re(c,p,a)||he(c)||a}:{...t,defaultFrequency:a}}return ce===e.type?{...t,merchantSettings:{...e.payload}}:t},"config"),Ml=n((t={},e)=>{var r;if(z===e.type)return Object.entries(e.payload).reduce(ba,t);if(fe===e.type)return e.payload.items.reduce(_a,t);if(Q===e.type){let{payload:{product:o}}=e;return[o,...(r=o==null?void 0:o.variants)!=null?r:[]].reduce(ql,t)||t}return q===e.type&&e.payload.product===null?{...t}:ue===e.type?e.payload.isPreview!==!0?t:{...t,[e.payload.productId]:!0}:t},"inStock"),$l=n((t={},e)=>t,"offer");function Vl({prepaidShipments:t,offer:e,product:r}){var o;if(t){let i=T(r.id),s=(o=e==null?void 0:e.config.prepaidSellingPlans[i])==null?void 0:o.find(a=>a.numberShipments===t);return s?s.sellingPlan:null}return e==null?void 0:e.config.frequencies[0]}n(Vl,"getFrequencyForPrepaidShipments");function jl(t){let e=xa(t.selling_plan_allocation.selling_plan),r={id:t.key,frequency:`${t.selling_plan_allocation.selling_plan.id}`};return e&&(r.prepaidShipments=e),r}n(jl,"getOptedInItem");var Hl=n((t=[],e)=>{if(fe===e.type){let r=e.payload;return t.filter(o=>!o.id.includes(":")).concat(r.items.reduce((o,i)=>i.selling_plan_allocation?[...o,jl(i)]:o,[]))}if(P===e.type){let{offer:r={},...o}=e.payload,i=Al(t,r),s=Nl(o,i,r);return[...i,...s]}if(Q===e.type){let{product:r}=e.payload,o=ga(r);if(!o)return t;let i=Ea(o),s=Sa(o);return t.map(a=>Je(a.frequency)?{...a,frequency:re(i,s,a.frequency)||he(i)}:a)}if(ae===e.type){let{payload:r}=e,o=Wr(t,e),[i,s]=Ke(o,r.product);return s.concat({...i,...r.product,frequency:Vl(r)})}return Wr(t,e)},"optedin"),Gl=n((t={},e)=>t,"productOffer"),Bl=n((t={},e)=>{var r;if(Q===e.type){let{payload:{product:o,currency:i}}=e,s=fa(o);return[o,...(r=o==null?void 0:o.variants)!=null?r:[]].reduce((a,c)=>{var p;return{...a,[c.id]:(p=c.selling_plan_allocations)==null?void 0:p.reduce((l,d)=>_n(l,d,s,i),[])}},t)||t}if(fe===e.type){let o=e.payload;return o.items.reduce((i,s)=>s.selling_plan_allocation?{...i,[s.key]:_n([],s.selling_plan_allocation,[],o.currency)}:i,t)||t}return z===e.type?Ze(e.payload):t},"productPlans"),zl=Vt({auth:tn,authUrl:on,autoshipByDefault:fn,autoshipEligible:Dl,config:Ll,defaultFrequencies:hn,eligibilityGroups:Xo,environment:pn,firstOrderPlaceDate:an,incentives:en,inStock:Ml,locale:ln,merchantId:rn,nextUpcomingOrder:Zo,offer:$l,offerId:nn,experiments:br,optedin:Hl,optedout:Qo,previewStandardOffer:un,previewUpsellOffer:dn,productOffer:Gl,productPlans:Bl,productToSubscribe:cn,sessionId:sn,templates:mn,prepaidShipmentsSelected:gn});function En(t,e){return window.og&&window.og.previewMode?Jr(t,e):zl(t,e)}n(En,"shopifyReducer");var Pa=se(_t()),wa=se(Ht());function va(t,e,r){let o=`[name="id"][value="${t}"]`,i=`form[action="/cart/add"] option[value="${t}"]`;if(!e)return;let s=document.querySelectorAll(o);s.length||(s=document.querySelectorAll(i)),[...s].forEach(a=>{let c=a.form,p=c==null?void 0:c.querySelector(`[name="${e}"]`);p||(p=document.createElement("input"),p.type="hidden",p.name=`attributes[${e}]`,c==null||c.appendChild(p)),p.value=r})}n(va,"updateTrackingInputs");function xn(){return`og__${Math.ceil(new Date().getTime()/1e3)}`}n(xn,"getTrackingKey");function Yl(t,e){var d,u,h,_;if(!((d=t.payload.offer)==null?void 0:d.autoshipByDefault))return;let o=(u=t.payload.offer)==null?void 0:u.product.id,i=xn(),s=((h=t.payload.offer)==null?void 0:h.location)||"",a=((_=t.payload.offer)==null?void 0:_.variationId)||"",c=eo(o,e),l=[o,R.toLowerCase(),s,c,a].join(",");va(o,i,l)}n(Yl,"addDefaultToSubTracking");function vn(t){return e=>r=>{switch(e(r),r.type){case R:case I:case k:{let o=r.payload.offer,i=On(r);o&&!o.isCart&&va(o.product.id,i[0],i[1]);break}case P:Yl(r,t);break;default:}}}n(vn,"shopifyTrackingMiddleware");var Oa,Ta,Tn=((Ta=(Oa=window.Shopify)==null?void 0:Oa.routes)==null?void 0:Ta.root)||"/",Wl="/cart",Jl=`${Tn}cart.js`,Kl=`${Tn}cart/change.js`,Ql=`${Tn}products/`,Zl='[id^="shopify-section-"][id$=__cart-items], [id^="shopify-section-"][id$="__cart-footer"],#cart-live-region-text,#cart-icon-bubble',Xl=n(t=>(0,wa.debounce)(100,!1,function(e){let{id:r}=Object.fromEntries([...new FormData(e).entries()]);r?t.setAttribute("product",r):t.removeAttribute("product")}),"makeSyncProductId");async function eu(){var r,o;let t=(o=(r=window.Shopify)==null?void 0:r.currency)==null?void 0:o.active;return t||(await Pn()).currency}n(eu,"getCurrency");async function tu(t,e){let r=ru(e);if(r)try{let[i,s]=await Promise.all([Ca(r),eu()]),a={product:i,offer:e,currency:s};t.dispatch({type:Q,payload:a})}catch(i){console.warn("OG: Unable to fetch product details for PDP",i)}let o=e.closest("form");if(!o){let i=e.parentElement;for(;i&&(o=i.querySelector('form[action$="/cart/add"]'),!(o||i.tagName.toLowerCase()==="body"));)i=i.parentElement}if(o){let i=Xl(e);o.addEventListener("change",()=>i(o)),new MutationObserver(()=>i(o)).observe(o,{subtree:!0,childList:!0})}else console.info("no /cart/add form found for og-offer",e)}n(tu,"setupPdp");async function Pn(){return(await fetch(Jl)).json()}n(Pn,"getCart");function ru(t){return[()=>t==null?void 0:t.dataset.shopifyProductHandle,()=>{var e,r;return(((r=(e=document.querySelector('[href$=".oembed"]'))==null?void 0:e.getAttribute("href"))==null?void 0:r.match(/\/([^/]+)\.oembed$/))||[])[1]},()=>{var e,r;return(document.querySelector('meta[property="og:type"][content="product"]')&&((r=(e=document.querySelector('meta[property="og:url"][content]'))==null?void 0:e.getAttribute("content"))==null?void 0:r.match(/\/([^/]+)$/))||[])[1]},()=>{var e;return(e=[...document.querySelectorAll("[type$=json]")].map(r=>JSON.parse(r.textContent||"{}")).find(r=>r.handle&&r.price))==null?void 0:e.handle}].reduce((e,r)=>e||r(),"")}n(ru,"guessProductHandle");var Ca=(0,Pa.default)(async function(t){return(await fetch(`${Ql}${t}.js`)).json()});async function ou(t,e){let r=await Pn(),{items:o}=r,i=r;t.dispatch({type:fe,payload:i});let s=Number(e.product.id);s<=o.length&&e.setAttribute("product",o[s-1].key),(await Promise.all(Array.from(new Set(o.map(({handle:c})=>c))).map(Ca))).forEach(c=>{let p={product:c,offer:e,currency:r.currency};t.dispatch({type:Q,payload:p})})}n(ou,"setupCart");async function nu(t,e){var s,a;let r=t.payload.offer,o=t.payload.frequency||eo(t.payload.product.id,e),i=On(t);if(!!(r!=null&&r.isCart))try{r.style.pointerEvents="none",r.style.opacity=".7";let c=Array.from(document.querySelectorAll(Zl)),p=t.payload.product.id,l=await Pn(),d=(s=l==null?void 0:l.items)==null?void 0:s.findIndex(C=>C.key===p),u=l.items[d],h=u.quantity,_=T(p),S=await fetch(Kl,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:p,quantity:h,attributes:Object.fromEntries([i]),properties:u.properties,selling_plan:o||null,sections:c.map(C=>C.id.replace(/^shopify-section-/,""))})});if(S.status!==200)throw new Error("Cart not updated");let m=await S.json(),b=l.items.length===m.items.length?m.items[d].key:(a=m.items.find(C=>C.quantity===h&&C.product_id===_&&(!o&&!C.selling_plan_allocation||(C==null?void 0:C.selling_plan_allocation.selling_plan.id)===o)))==null?void 0:a.key;b&&(e.dispatch({type:mt,payload:{oldCartProductKey:p,newCartProductKey:b}}),r.setAttribute("product",b));let O=m;e.dispatch({type:fe,payload:O});let E=new CustomEvent(Qn,{bubbles:!0,cancelable:!0});if(r.dispatchEvent(E),E.defaultPrevented)return;let w=m.sections;Object.values(w).length?c.forEach(C=>{let Cn=C.id.replace(/^shopify-section-/,"");if(!(Cn in w))return;let qa=w[Cn],Rn=new DOMParser().parseFromString(qa.toString()||"","text/html").getElementById(C.id);Rn&&(C.innerHTML=Rn.innerHTML)}):window.location.pathname.startsWith(Wl)&&window.location.reload()}catch(c){console.log("OG Error updating cart",c)}finally{r.style.pointerEvents="auto",r.style.opacity="1"}}n(nu,"synchronizeCartOptin");function On(t){var a,c;let e=t.payload.product.id;if(!e)return[];let r=xn(),o=((a=t.payload.offer)==null?void 0:a.location)||"",i=((c=t.payload.offer)==null?void 0:c.variationId)||"",s=[e,t.type.toLowerCase(),o];switch(t.type){case q:case I:s.push(""),s.push(i);break;case R:case k:s.push(t.payload.frequency),s.push(i);break;default:return[]}return[r,s.join(",")]}n(On,"getTrackingEvent");function eo(t,e){var i;return(i=lr({id:t})(e.getState()))==null?void 0:i.frequency}n(eo,"getSubscribedFrequency");function iu(t,e){e!=null&&e.isCart||!(e!=null&&e.shouldEnableOffer)||[...document.querySelectorAll('form[action$="/cart/add"] [name=id]')].forEach(r=>{let o=r.value,i=eo(o,t);bo(r.form,"selling_plan",i),bo(r.form,"attributes[og__session]",t.getState().sessionId)})}n(iu,"synchronizeSellingPlan");function wn(t){return e=>r=>{var o;switch(r.type){case R:case I:case k:break;case q:(o=r.payload.offer)!=null&&o.isCart?ou(t,r.payload.offer):tu(t,r.payload.offer);break;default:}switch(e(r),r.type){case R:case I:case k:case ae:nu(r,t);case q:case P:case Q:iu(t,r.payload.offer);break;default:}}}n(wn,"shopifyMiddleware");var su="/apps/subscriptions/auth/",Ra="og_auth_begin",au="og_auth_end",cu=n(t=>{let[e,r,o,i]=atob(t).split("|");return{id:e,signature:o,timestamp:r,email:i}},"parseIntegrationTempAuth");async function Aa({store:t}){var i;let[e]=yo(),r=Ot(),o=r!=null&&r.dataset.customer?cu(r.dataset.customer):(i=window.ogShopifyConfig)==null?void 0:i.customer;if(o){let s=await lu(o);if(s){let[a,c,p]=s.split("|");t.dispatch(wt(e,a,Number(c),p))}}else hi("og_auth")}n(Aa,"authorizeShopifyCustomer");async function pu(t){try{let r=await(await fetch(`${su}?customer=${t.id}&customer_signature=${t.signature}&customer_timestamp=${t.timestamp}`)).text(),o=r.lastIndexOf(Ra);if(o<0)throw"Invalid response from OG auth endpoint";return JSON.parse(r.substring(o+Ra.length,r.lastIndexOf(au)))}catch(e){console.error(e)}}n(pu,"fetchOGSignature");async function lu(t){let e=mi("og_auth");if(e)return e;let{customerId:r,timestamp:o,signature:i}=await pu(t);if(!r)return"";let s=new Date,a=btoa(i);s.setTime(s.getTime()+2*60*60*1e3);let c=`${r}|${o}|${a};expires=${s.toUTCString()}`;return document.cookie=`og_auth=${c};secure;path=/`,c}n(lu,"getOrCreateAuthCookie");var Na,ka=Zi(...(Na=D)!=null&&Na.shopify_selling_plans?[En,wn]:[Jr],D.shopify&&vn),v=yn(ka),uu=v.isReady,du=v.addOptinChangedCallback,fu=v.addTemplate,hu=v.clear,mu=v.config,gu=v.disableOptinChangedCallbacks,yu=v.getOptins,bu=v.getProductsForPurchasePost,_u=v.initialize,Su=v.previewMode,Eu=v.register,xu=v.resolveSettings,vu=v.setAuthUrl,Ou=v.setEnvironment,Tu=v.setLocale,Pu=v.setMerchantId,wu=v.setPublicPath,Cu=v.setTemplates,Ru=v.setupCart,Au=v.setupProduct,Nu=v.setupProducts,Iu=n(()=>fi(v),"autoInit");var ku=v.initialize,Ia;(Ia=D)!=null&&Ia.shopify_selling_plans&&dr(()=>Aa(v));return $a(qu);})();
|
|
1036
|
+
`}};n(Zr,"Price");var xl=n((t,e)=>{var r;return{productPlans:t.productPlans,configDefaultFrequency:(r=t.config)==null?void 0:r.defaultFrequency,frequency:te(e.product)(t)}},"mapStateToProps"),ua=g(xl)(Zr);function _n(t){pa(),rs(t);try{customElements.define("og-when",Ds),customElements.define("og-text",Bs),customElements.define("og-incentive-text",Js),customElements.define("og-offer",oa),customElements.define("og-select-frequency",Ks),customElements.define("og-optout-button",Ms),customElements.define("og-optin-toggle",Gs),customElements.define("og-optin-status",Us),customElements.define("og-optin-button",Ls),customElements.define("og-optin-select",Vs),customElements.define("og-upsell-button",js),customElements.define("og-frequency-status",$s),customElements.define("og-modal",Ut),customElements.define("og-select",Lt),customElements.define("og-tooltip",Mt),customElements.define("og-upsell-modal",Hs),customElements.define("og-next-upcoming-order",Zs),customElements.define("og-price",ua),customElements.define("og-prepaid-toggle",na),customElements.define("og-prepaid-data",ia),customElements.define("og-prepaid-button",sa),customElements.define("og-prepaid-select",aa),customElements.define("og-subscription-button",ca)}catch{console.info("OG WebComponents already registered, skipping.")}let e=!1,r={store:t,isReady:()=>e,setEnvironment(o){return t.dispatch(xi(o)),this},setMerchantId(o){return t.dispatch(_i(o)),this},setAuthUrl(o){return t.dispatch(Si(o)),this},receiveMerchantSettings(o){return t.dispatch(Ii(o)),this},getProductsForPurchasePost(o=[]){return Ro(t.getState(),o)},getOptins(o=[]){return Ro(t.getState(),o)},clear(){t.dispatch(Ti())},addOptinChangedCallback(o){typeof o=="function"&&document.addEventListener("optin-changed",i=>o(i.detail))},disableOptinChangedCallbacks(){document.addEventListener("optin-changed",o=>o.stopPropagation(),!0)},register(){},previewMode(o){return window.og=window.og||{},o===!1?delete window.og:window.og.previewMode=!0,this},config(o){return t.dispatch(wi(o)),this},setLocale(o){return t.dispatch(Pi(o)),this},addTemplate(o,i,s){return t.dispatch(Ci(o,i,s)),this},setTemplates(o){return t.dispatch(Ri(o)),this},setPublicPath(o){return this},resolveSettings(o,i,s,a=t){if(o&&i&&s){let c=[];s.product?c.push(s.product):s.cart&&Array.isArray(s.cart.products)&&(c=c.concat(s.cart.products));let p=a.getState(),{sessionId:l}=p;l&&c.forEach(d=>a.dispatch(Oo(d))),s.product_discounts&&typeof s.product_discounts=="object"&&a.dispatch({type:z,payload:s.product_discounts})}},initialize(o,i,s,a){var p;e?console.warn("og.offers has been initialized already. Skipping."):r.resolveSettings(o,i,window.og_settings,t);let c=t.getState();return o&&o!==c.merchantId&&r.setMerchantId(o),i&&i!==((p=c.environment)==null?void 0:p.name)&&r.setEnvironment(i),a&&r.receiveMerchantSettings(a),s&&r.setAuthUrl(s),e=!0,this}};return window.OG=window.OG||{},Object.assign(window.OG,r),Object.assign(r.initialize,r),Co(window.opener,r),r}n(_n,"makeApi");var le=n((t,e)=>t===null?"":new Intl.NumberFormat(navigator.language,{style:"currency",currency:e}).format(t/100),"money"),Xr=n(t=>`${t}%`,"percentage");var eo=n(t=>{var e,r;return Array.isArray((e=t.selling_plan)==null?void 0:e.options)&&((r=t.selling_plan)==null?void 0:r.options.some(o=>(o==null?void 0:o.name)==="Shipment amount"))},"isPrepaidAllocation"),to=n(t=>{if(t&&t.length>1){let e=t.find(r=>(r==null?void 0:r.name)==="Shipment amount").value.split(" ");return e.length>0?+e[0]:null}return null},"getPrepaidShipmentsNumberFromOptions"),vl=n(t=>{var e,r;return(t.selling_plan_id||((r=(e=t.selling_plan)==null?void 0:e.id)!=null?r:"")).toString()},"getAllocationFrequency"),Ol=n((t,e)=>le(t.compare_at_price,e),"getAllocationRegularPrice"),Tl=n((t,e)=>{var r;if(eo(t)){let o=to((r=t.selling_plan)==null?void 0:r.options),i=Math.round(t.price/o);return le(i,e)}return le(t.price,e)},"getAllocationSubscriptionPrice"),da=n((t,e)=>Math.round((t.compare_at_price-e)*100/t.compare_at_price),"getPrepaidPercentage"),Pl=n((t,e)=>{var o,i,s;if(eo(t)){let a=to((o=t.selling_plan)==null?void 0:o.options),c=t.price/a,p=da(t,c);return Xr(p)}let r="";return((i=t.price_adjustments[0])==null?void 0:i.value_type)==="percentage"?r=Xr(t.price_adjustments[0].value):(s=t.price_adjustments[0])!=null&&s.value?r=le(t.price_adjustments[0].value,e):t.compare_at_price&&(r=le(t.compare_at_price-t.price,e)),r},"getAllocationDiscountRate"),wl=n(t=>{var e;return eo(t)?to((e=t.selling_plan)==null?void 0:e.options):null},"getAllocationNumberOfShipments"),Cl=n((t,e,r,o)=>{var d,u;let i=to((d=t.selling_plan)==null?void 0:d.options),s=t.price/i,a=t.compare_at_price-s,c=da(t,s),p=(u=r==null?void 0:r.price_adjustments)==null?void 0:u[0],l=p&&p.value_type==="percentage"?p.value:null;return e.regularPrepaidPrice=le(t.price,o),e.prepaidSavingsPerShipment=le(Math.round(a),o),e.prepaidSavingsTotal=le(Math.round(a*i),o),l&&c&&(e.prepaidExtraSavingsPercentage=Xr(c-l)),e},"addPrepaidPriceAndSavings"),Sn="Subscribe and Save",Rl=n((t,e,r)=>{t.selling_plan||(t.selling_plan=e.find(i=>i.id===t.selling_plan_id));let o={frequency:vl(t),regularPrice:Ol(t,r),subscriptionPrice:Tl(t,r),discountRate:Pl(t,r),prepaidShipments:wl(t)};if(eo(t)){let i=e.find(s=>s.group_name===Sn&&s.options.length===1);return Cl(t,o,i,r)}return o},"mapSellingPlanToDiscount"),En=n((t,e,r=[],o)=>[...t,Rl(e,r,o)],"sellingPlanAllocationsReducer"),fa=n(t=>t.selling_plan_groups.reduce((e,r)=>[...e,...r.selling_plans.map(o=>({...o,group_name:r.name}))],[]),"getSellingPlans");var ma=n((t,e,r)=>{let o=Object.keys(t).filter(i=>i.startsWith(e.toString()));return o.length?{...t,...o.reduce((i,s)=>({...i,[s]:r}),{})}:t},"overrideLineKey"),ha=n((t,e,r)=>{if(!r)return null;if(!Je(r))return r;if(fr(t,e)){let o=re(t,e,r);return o||he(t)}return r},"getDefaultSellingPlan"),Al=n((t,e)=>t.map(r=>{var o,i,s,a,c,p,l;return Je(r==null?void 0:r.frequency)?{...r,frequency:fr((o=e==null?void 0:e.config)==null?void 0:o.frequencies,(i=e==null?void 0:e.config)==null?void 0:i.frequenciesEveryPeriod)?re((s=e==null?void 0:e.config)==null?void 0:s.frequencies,(a=e==null?void 0:e.config)==null?void 0:a.frequenciesEveryPeriod,r.frequency)||re((c=e==null?void 0:e.config)==null?void 0:c.frequencies,(p=e==null?void 0:e.config)==null?void 0:p.frequenciesEveryPeriod,e==null?void 0:e.defaultFrequency)||he((l=e==null?void 0:e.config)==null?void 0:l.frequencies):r.frequency}:r}),"mapExistingOptinsFromOfferResponse"),Nl=n(({autoship:t={},autoship_by_default:e={},default_frequencies:r={},in_stock:o={}},i,s)=>Object.keys(t).reduce((a,c)=>{if(!i.some(p=>p.id===c)){if(!(t[c]&&e[c]&&o[c]))return a;let{config:{frequencies:p,frequenciesEveryPeriod:l}={},defaultFrequency:d}=s||{},u=r[c],h;return r[c]&&fr(p,l)?h=re(p,l,`${u.every}_${u.every_period}`)||ha(p,l,d)||he(p):r[c]?h=`${u.every}_${u.every_period}`:h=ha(p,l,d)||"_",a.concat({id:c,frequency:h})}return a},[]),"reduceNewOptinsFromOfferResponse"),ga=n(t=>(t==null?void 0:t.selling_plan_groups.find(xn))||kl(t),"getOGSellingPlanGroup"),Il=n(t=>((t==null?void 0:t.selling_plan_groups)||[]).filter(r=>ya(r)||xn(r)),"getOGSellingPlanGroups"),kl=n(t=>t==null?void 0:t.selling_plan_groups.find(ya),"getDefaultSubscriptionSellingPlanGroup"),ya=n(t=>t.name===Sn,"isDefaultSellingPlanGroup"),xn=n(t=>t.name.startsWith("og_psfl"),"isProductSpecificFrequencySellingPlanGroup"),ql=n((t,e)=>({...ma(t,e.id,e.available),[e.id]:e.available}),"productOrVariantInStockReducer"),ba=n((t,[e])=>({...t,[e]:!0}),"productTrue"),_a=n((t,e)=>{let r=T(e.key);return{...t,[e.key]:t[r]||null}},"reduceProductCartLine"),Dl=n((t={},e)=>{var r;if(z===e.type)return Object.entries(e.payload).reduce(ba,t);if(fe===e.type){let{payload:o}=e;return o.items.reduce(_a,t)}if(Q===e.type){let{payload:{product:o}}=e,i=Il(o),s=new Set((r=i.flatMap(a=>a.selling_plans.map(c=>c.id)))!=null?r:[]);return[o,...(o==null?void 0:o.variants)||[]].reduce((a,c)=>{var d,u;let l=((u=(d=c==null?void 0:c.selling_plan_allocations)==null?void 0:d.filter(h=>s.has(h.selling_plan_id)))!=null?u:[]).length>0;return{...ma(a,c.id,l),[c.id]:l}},t)}return ue===e.type?e.payload.isPreview!==!0?t:{...t,[e.payload.productId]:!0}:t},"autoshipEligible");function Fl(t){let e=["day","week","month"].findIndex(o=>t.toLowerCase().includes(o))+1,r=(t.match(/(\d+)/)||["",1])[1];return r&&e?`${r}_${e}`:null}n(Fl,"textToFreq");function Sa(t){var e;return(e=t==null?void 0:t.selling_plans)==null?void 0:e.map(({options:r})=>r||[]).flat().map(({value:r})=>Fl(r))}n(Sa,"sellingPlansToEveryPeriod");function Ea(t){var e;return(e=t==null?void 0:t.selling_plans)==null?void 0:e.map(({id:r})=>`${r}`)}n(Ea,"sellingPlansToFrequencies");function xa(t){var r;let e=(r=t==null?void 0:t.options.find(({name:o})=>o==="Shipment amount"))==null?void 0:r.value.split(" ")[0];return e?Number(e):void 0}n(xa,"getPrepaidShipments");function Ul(t){return t.reduce((e,r)=>{let o=r.name.split("-")[1],i=r.selling_plans.map(s=>({numberShipments:xa(s),sellingPlan:String(s.id)}));return{...e,[o]:i}},{})}n(Ul,"getPrepaidSellingPlans");var Ll=n((t={frequencies:[],offerType:"radio",frequenciesEveryPeriod:[]},e)=>{var r,o,i;if(z===e.type){let s=[...new Set(Object.values(e.payload).map(Object.keys).flat())];return{...t,frequencies:s}}if(Q===e.type){let{payload:{product:s,currency:a}}=e,c={},p=ga(s),l=Ea(p);if(l!=null&&l.length){let u=Sa(p),h=((o=(r=p.options)==null?void 0:r[0])==null?void 0:o.values)||l,_=t.defaultFrequency;_&&Je(_)&&(_=re(l,u,_)||he(l)||_),c={frequencies:l,frequenciesEveryPeriod:u,frequenciesText:h,..._?{defaultFrequency:_}:{},hasProductSpecificFrequencies:t.hasProductSpecificFrequencies||xn(p)}}let d=s==null?void 0:s.selling_plan_groups.filter(u=>/^Prepaid-.*/.test(u.name));return d.length&&(c={...c,prepaidSellingPlans:{...t.prepaidSellingPlans,...Ul(d)}}),{...t,...c,storeCurrency:a}}if(P===e.type){let{payload:{offer:s}}=e,{defaultFrequency:a,config:{frequencies:c,frequenciesEveryPeriod:p,prepaidSellingPlans:l={}}={},product:d}=s||{};return(i=l[d==null?void 0:d.id])!=null&&i.some(({sellingPlan:u})=>u===a)?{...t,defaultFrequency:he(c)||a}:Je(a)?{...t,defaultFrequency:re(c,p,a)||he(c)||a}:{...t,defaultFrequency:a}}return ce===e.type?{...t,merchantSettings:{...e.payload}}:t},"config"),Ml=n((t={},e)=>{var r;if(z===e.type)return Object.entries(e.payload).reduce(ba,t);if(fe===e.type)return e.payload.items.reduce(_a,t);if(Q===e.type){let{payload:{product:o}}=e;return[o,...(r=o==null?void 0:o.variants)!=null?r:[]].reduce(ql,t)||t}return q===e.type&&e.payload.product===null?{...t}:ue===e.type?e.payload.isPreview!==!0?t:{...t,[e.payload.productId]:!0}:t},"inStock"),$l=n((t={},e)=>t,"offer");function Vl({prepaidShipments:t,offer:e,product:r}){var o;if(t){let i=T(r.id),s=(o=e==null?void 0:e.config.prepaidSellingPlans[i])==null?void 0:o.find(a=>a.numberShipments===t);return s?s.sellingPlan:null}return e==null?void 0:e.config.frequencies[0]}n(Vl,"getFrequencyForPrepaidShipments");function jl(t){let e=xa(t.selling_plan_allocation.selling_plan),r={id:t.key,frequency:`${t.selling_plan_allocation.selling_plan.id}`};return e&&(r.prepaidShipments=e),r}n(jl,"getOptedInItem");var Hl=n((t=[],e)=>{if(fe===e.type){let r=e.payload;return t.filter(o=>!o.id.includes(":")).concat(r.items.reduce((o,i)=>i.selling_plan_allocation?[...o,jl(i)]:o,[]))}if(P===e.type){let{offer:r={},...o}=e.payload,i=Al(t,r),s=Nl(o,i,r);return[...i,...s]}if(Q===e.type){let{product:r}=e.payload,o=ga(r);if(!o)return t;let i=Ea(o),s=Sa(o);return t.map(a=>Je(a.frequency)?{...a,frequency:re(i,s,a.frequency)||he(i)}:a)}if(ae===e.type){let{payload:r}=e,o=Kr(t,e),[i,s]=Ke(o,r.product);return s.concat({...i,...r.product,frequency:Vl(r)})}return Kr(t,e)},"optedin"),Gl=n((t={},e)=>t,"productOffer"),Bl=n((t={},e)=>{var r;if(Q===e.type){let{payload:{product:o,currency:i}}=e,s=fa(o);return[o,...(r=o==null?void 0:o.variants)!=null?r:[]].reduce((a,c)=>{var p;return{...a,[c.id]:(p=c.selling_plan_allocations)==null?void 0:p.reduce((l,d)=>En(l,d,s,i),[])}},t)||t}if(fe===e.type){let o=e.payload;return o.items.reduce((i,s)=>s.selling_plan_allocation?{...i,[s.key]:En([],s.selling_plan_allocation,[],o.currency)}:i,t)||t}return z===e.type?Ze(e.payload):t},"productPlans"),zl=Vt({auth:on,authUrl:sn,autoshipByDefault:mn,autoshipEligible:Dl,config:Ll,defaultFrequencies:gn,eligibilityGroups:tn,environment:un,firstOrderPlaceDate:pn,incentives:rn,inStock:Ml,locale:dn,merchantId:nn,nextUpcomingOrder:en,offer:$l,offerId:an,experiments:Sr,optedin:Hl,optedout:Xo,previewStandardOffer:fn,previewUpsellOffer:hn,productOffer:Gl,productPlans:Bl,productToSubscribe:ln,sessionId:cn,templates:yn,prepaidShipmentsSelected:bn});function vn(t,e){return window.og&&window.og.previewMode?Qr(t,e):zl(t,e)}n(vn,"shopifyReducer");var Pa=se(_t()),wa=se(Ht());function va(t,e,r){let o=`[name="id"][value="${t}"]`,i=`form[action="/cart/add"] option[value="${t}"]`;if(!e)return;let s=document.querySelectorAll(o);s.length||(s=document.querySelectorAll(i)),[...s].forEach(a=>{let c=a.form,p=c==null?void 0:c.querySelector(`[name="${e}"]`);p||(p=document.createElement("input"),p.type="hidden",p.name=`attributes[${e}]`,c==null||c.appendChild(p)),p.value=r})}n(va,"updateTrackingInputs");function On(){return`og__${Math.ceil(new Date().getTime()/1e3)}`}n(On,"getTrackingKey");function Yl(t,e){var d,u,h,_;if(!((d=t.payload.offer)==null?void 0:d.autoshipByDefault))return;let o=(u=t.payload.offer)==null?void 0:u.product.id,i=On(),s=((h=t.payload.offer)==null?void 0:h.location)||"",a=((_=t.payload.offer)==null?void 0:_.variationId)||"",c=ro(o,e),l=[o,R.toLowerCase(),s,c,a].join(",");va(o,i,l)}n(Yl,"addDefaultToSubTracking");function Tn(t){return e=>r=>{switch(e(r),r.type){case R:case I:case k:{let o=r.payload.offer,i=Pn(r);o&&!o.isCart&&va(o.product.id,i[0],i[1]);break}case P:Yl(r,t);break;default:}}}n(Tn,"shopifyTrackingMiddleware");var Oa,Ta,wn=((Ta=(Oa=window.Shopify)==null?void 0:Oa.routes)==null?void 0:Ta.root)||"/",Wl="/cart",Jl=`${wn}cart.js`,Kl=`${wn}cart/change.js`,Ql=`${wn}products/`,Zl='[id^="shopify-section-"][id$=__cart-items], [id^="shopify-section-"][id$="__cart-footer"],#cart-live-region-text,#cart-icon-bubble',Xl=n(t=>(0,wa.debounce)(100,!1,function(e){let{id:r}=Object.fromEntries([...new FormData(e).entries()]);r?t.setAttribute("product",r):t.removeAttribute("product")}),"makeSyncProductId");async function eu(){var r,o;let t=(o=(r=window.Shopify)==null?void 0:r.currency)==null?void 0:o.active;return t||(await Cn()).currency}n(eu,"getCurrency");async function tu(t,e){let r=ru(e);if(r)try{let[i,s]=await Promise.all([Ca(r),eu()]),a={product:i,offer:e,currency:s};t.dispatch({type:Q,payload:a})}catch(i){console.warn("OG: Unable to fetch product details for PDP",i)}let o=e.closest("form");if(!o){let i=e.parentElement;for(;i&&(o=i.querySelector('form[action$="/cart/add"]'),!(o||i.tagName.toLowerCase()==="body"));)i=i.parentElement}if(o){let i=Xl(e);o.addEventListener("change",()=>i(o)),new MutationObserver(()=>i(o)).observe(o,{subtree:!0,childList:!0})}else console.info("no /cart/add form found for og-offer",e)}n(tu,"setupPdp");async function Cn(){return(await fetch(Jl)).json()}n(Cn,"getCart");function ru(t){return[()=>t==null?void 0:t.dataset.shopifyProductHandle,()=>{var e,r;return(((r=(e=document.querySelector('[href$=".oembed"]'))==null?void 0:e.getAttribute("href"))==null?void 0:r.match(/\/([^/]+)\.oembed$/))||[])[1]},()=>{var e,r;return(document.querySelector('meta[property="og:type"][content="product"]')&&((r=(e=document.querySelector('meta[property="og:url"][content]'))==null?void 0:e.getAttribute("content"))==null?void 0:r.match(/\/([^/]+)$/))||[])[1]},()=>{var e;return(e=[...document.querySelectorAll("[type$=json]")].map(r=>JSON.parse(r.textContent||"{}")).find(r=>r.handle&&r.price))==null?void 0:e.handle}].reduce((e,r)=>e||r(),"")}n(ru,"guessProductHandle");var Ca=(0,Pa.default)(async function(t){return(await fetch(`${Ql}${t}.js`)).json()});async function ou(t,e){let r=await Cn(),{items:o}=r,i=r;t.dispatch({type:fe,payload:i});let s=Number(e.product.id);s<=o.length&&e.setAttribute("product",o[s-1].key),(await Promise.all(Array.from(new Set(o.map(({handle:c})=>c))).map(Ca))).forEach(c=>{let p={product:c,offer:e,currency:r.currency};t.dispatch({type:Q,payload:p})})}n(ou,"setupCart");async function nu(t,e){var s,a;let r=t.payload.offer,o=t.payload.frequency||ro(t.payload.product.id,e),i=Pn(t);if(!!(r!=null&&r.isCart))try{r.style.pointerEvents="none",r.style.opacity=".7";let c=Array.from(document.querySelectorAll(Zl)),p=t.payload.product.id,l=await Cn(),d=(s=l==null?void 0:l.items)==null?void 0:s.findIndex(C=>C.key===p),u=l.items[d],h=u.quantity,_=T(p),S=await fetch(Kl,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:p,quantity:h,attributes:Object.fromEntries([i]),properties:u.properties,selling_plan:o||null,sections:c.map(C=>C.id.replace(/^shopify-section-/,""))})});if(S.status!==200)throw new Error("Cart not updated");let m=await S.json(),b=l.items.length===m.items.length?m.items[d].key:(a=m.items.find(C=>C.quantity===h&&C.product_id===_&&(!o&&!C.selling_plan_allocation||(C==null?void 0:C.selling_plan_allocation.selling_plan.id)===o)))==null?void 0:a.key;b&&(e.dispatch({type:mt,payload:{oldCartProductKey:p,newCartProductKey:b}}),r.setAttribute("product",b));let O=m;e.dispatch({type:fe,payload:O});let E=new CustomEvent(Xn,{bubbles:!0,cancelable:!0});if(r.dispatchEvent(E),E.defaultPrevented)return;let w=m.sections;Object.values(w).length?c.forEach(C=>{let An=C.id.replace(/^shopify-section-/,"");if(!(An in w))return;let qa=w[An],Nn=new DOMParser().parseFromString(qa.toString()||"","text/html").getElementById(C.id);Nn&&(C.innerHTML=Nn.innerHTML)}):window.location.pathname.startsWith(Wl)&&window.location.reload()}catch(c){console.log("OG Error updating cart",c)}finally{r.style.pointerEvents="auto",r.style.opacity="1"}}n(nu,"synchronizeCartOptin");function Pn(t){var a,c;let e=t.payload.product.id;if(!e)return[];let r=On(),o=((a=t.payload.offer)==null?void 0:a.location)||"",i=((c=t.payload.offer)==null?void 0:c.variationId)||"",s=[e,t.type.toLowerCase(),o];switch(t.type){case q:case I:s.push(""),s.push(i);break;case R:case k:s.push(t.payload.frequency),s.push(i);break;default:return[]}return[r,s.join(",")]}n(Pn,"getTrackingEvent");function ro(t,e){var i;return(i=lr({id:t})(e.getState()))==null?void 0:i.frequency}n(ro,"getSubscribedFrequency");function iu(t,e){e!=null&&e.isCart||!(e!=null&&e.shouldEnableOffer)||[...document.querySelectorAll('form[action$="/cart/add"] [name=id]')].forEach(r=>{let o=r.value,i=ro(o,t);So(r.form,"selling_plan",i),So(r.form,"attributes[og__session]",t.getState().sessionId)})}n(iu,"synchronizeSellingPlan");function Rn(t){return e=>r=>{var o;switch(r.type){case R:case I:case k:break;case q:(o=r.payload.offer)!=null&&o.isCart?ou(t,r.payload.offer):tu(t,r.payload.offer);break;default:}switch(e(r),r.type){case R:case I:case k:case ae:nu(r,t);case q:case P:case Q:iu(t,r.payload.offer);break;default:}}}n(Rn,"shopifyMiddleware");var su="/apps/subscriptions/auth/",Ra="og_auth_begin",au="og_auth_end",cu=n(t=>{let[e,r,o,i]=atob(t).split("|");return{id:e,signature:o,timestamp:r,email:i}},"parseIntegrationTempAuth");async function Aa({store:t}){var i;let[e]=_o(),r=Ot(),o=r!=null&&r.dataset.customer?cu(r.dataset.customer):(i=window.ogShopifyConfig)==null?void 0:i.customer;if(o){let s=await lu(o);if(s){let[a,c,p]=s.split("|");t.dispatch(wt(e,a,Number(c),p))}}else gi("og_auth")}n(Aa,"authorizeShopifyCustomer");async function pu(t){try{let r=await(await fetch(`${su}?customer=${t.id}&customer_signature=${t.signature}&customer_timestamp=${t.timestamp}`)).text(),o=r.lastIndexOf(Ra);if(o<0)throw"Invalid response from OG auth endpoint";return JSON.parse(r.substring(o+Ra.length,r.lastIndexOf(au)))}catch(e){console.error(e)}}n(pu,"fetchOGSignature");async function lu(t){let e=yi("og_auth");if(e)return e;let{customerId:r,timestamp:o,signature:i}=await pu(t);if(!r)return"";let s=new Date,a=btoa(i);s.setTime(s.getTime()+2*60*60*1e3);let c=`${r}|${o}|${a};expires=${s.toUTCString()}`;return document.cookie=`og_auth=${c};secure;path=/`,c}n(lu,"getOrCreateAuthCookie");var Na,ka=Zi(...(Na=D)!=null&&Na.shopify_selling_plans?[vn,Rn]:[Qr],D.shopify&&Tn),v=_n(ka),uu=v.isReady,du=v.addOptinChangedCallback,fu=v.addTemplate,hu=v.clear,mu=v.config,gu=v.disableOptinChangedCallbacks,yu=v.getOptins,bu=v.getProductsForPurchasePost,_u=v.initialize,Su=v.previewMode,Eu=v.register,xu=v.resolveSettings,vu=v.setAuthUrl,Ou=v.setEnvironment,Tu=v.setLocale,Pu=v.setMerchantId,wu=v.setPublicPath,Cu=v.setTemplates,Ru=v.setupCart,Au=v.setupProduct,Nu=v.setupProducts,Iu=n(()=>mi(v),"autoInit");var ku=v.initialize,Ia;(Ia=D)!=null&&Ia.shopify_selling_plans&&dr(()=>Aa(v));return $a(qu);})();
|
|
1037
1037
|
; return lib; });
|
|
1038
1038
|
//# sourceMappingURL=offers.js.map
|