@ordergroove/offers 2.24.2-alpha-PR-571-9.1 → 2.24.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/offers.js CHANGED
@@ -8,10 +8,10 @@ else {
8
8
  window.og['offers'] = factory();
9
9
  }
10
10
  })(()=>{
11
- var lib=(()=>{var Pa=Object.create;var Ye=Object.defineProperty;var Ra=Object.getOwnPropertyDescriptor;var Aa=Object.getOwnPropertyNames;var Na=Object.getPrototypeOf,ka=Object.prototype.hasOwnProperty;var Io=t=>Ye(t,"__esModule",{value:!0}),n=(t,e)=>Ye(t,"name",{value:e,configurable:!0}),qa=(t=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(t,{get:(e,r)=>(typeof require!="undefined"?require:e)[r]}):t)(function(t){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+t+'" is not supported')});var u=(t,e)=>()=>(t&&(e=t(t=0)),e);var K=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),b=(t,e)=>{Io(t);for(var r in e)Ye(t,r,{get:e[r],enumerable:!0})},Ia=(t,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Aa(e))!ka.call(t,o)&&o!=="default"&&Ye(t,o,{get:()=>e[o],enumerable:!(r=Ra(e,o))||r.enumerable});return t},de=t=>Ia(Io(Ye(t!=null?Pa(Na(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var Do={};b(Do,{default:()=>Da,offersLiveEditor:()=>Pr});function Cr(t){let e=Fa(Uo),r=Fo(t.source);e(t)&&t.data.ogType==="READY"&&import("//static.ordergroove.com/@ordergroove/offers-live-editor/0.4.0/dist/client.js").then(({initializeClient:o})=>{o(e,r),window.removeEventListener("message",Cr)})}function Pr(t=window.opener){t&&t!==window&&(window.addEventListener("message",Cr),Fo(t)("READY"))}var Ua,bt,Fa,Uo,Fo,Da,Lo=u(()=>{Ua=Object.defineProperty,bt=n((t,e)=>Ua(t,"name",{value:e,configurable:!0}),"s"),Fa=bt(t=>e=>t.indexOf(e.origin)>=0,"createIsMessageAllowed"),Uo=["https://rc3.ordergroove.com","https://rc3.stg.ordergroove.com","http://localhost:3000",window.location.origin],Fo=bt(t=>(e,r)=>{Uo.forEach(o=>t.postMessage({ogType:e,...r},o))},"createBroadcastMessage");n(Cr,"d");bt(Cr,"handleReady");n(Pr,"l");bt(Pr,"offersLiveEditor");Da=Pr});function Rr(t){var e,r=t.Symbol;return typeof r=="function"?r.observable?e=r.observable:(e=r("observable"),r.observable=e):e="@@observable",e}var jo=u(()=>{n(Rr,"symbolObservablePonyfill")});var Ce,La,Ar,Mo=u(()=>{jo();typeof self!="undefined"?Ce=self:typeof window!="undefined"||typeof window!="undefined"?Ce=window:typeof module!="undefined"?Ce=module:Ce=Function("return this")();La=Rr(Ce),Ar=La});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}function kr(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=="undefined"&&(r=e,e=void 0),typeof r!="undefined"){if(typeof r!="function")throw new Error("Expected the enhancer to be a function.");return r(kr)(t,e)}if(typeof t!="function")throw new Error("Expected the reducer to be a function.");var s=t,i=e,a=[],c=a,l=!1;function f(){c===a&&(c=a.slice())}n(f,"ensureCanMutateNextListeners");function y(){if(l)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 i}n(y,"getState");function d(h){if(typeof h!="function")throw new Error("Expected the listener to be a function.");if(l)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 O=!0;return f(),c.push(h),n(function(){if(!!O){if(l)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.");O=!1,f();var x=c.indexOf(h);c.splice(x,1),a=null}},"unsubscribe")}n(d,"subscribe");function g(h){if(!ja(h))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(typeof h.type=="undefined")throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(l)throw new Error("Reducers may not dispatch actions.");try{l=!0,i=s(i,h)}finally{l=!1}for(var O=a=c,C=0;C<O.length;C++){var x=O[C];x()}return h}n(g,"dispatch");function S(h){if(typeof h!="function")throw new Error("Expected the nextReducer to be a function.");s=h,g({type:Qe.REPLACE})}n(S,"replaceReducer");function _(){var h,O=d;return h={subscribe:n(function(x){if(typeof x!="object"||x===null)throw new TypeError("Expected the observer to be an object.");function P(){x.next&&x.next(y())}n(P,"observeState"),P();var Ca=O(P);return{unsubscribe:Ca}},"subscribe")},h[Ar]=function(){return this},h}return n(_,"observable"),g({type:Qe.INIT}),o={dispatch:g,subscribe:d,getState:y,replaceReducer:S},o[Ar]=_,o}function Ma(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.'}function Va(t){Object.keys(t).forEach(function(e){var r=t[e],o=r(void 0,{type:Qe.INIT});if(typeof o=="undefined")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:Qe.PROBE_UNKNOWN_ACTION()})=="undefined")throw new Error('Reducer "'+e+'" returned undefined when probed with a random type. '+("Don't try to handle "+Qe.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.")})}function Vo(t){for(var e=Object.keys(t),r={},o=0;o<e.length;o++){var s=e[o];typeof t[s]=="function"&&(r[s]=t[s])}var i=Object.keys(r),a,c;try{Va(r)}catch(l){c=l}return n(function(f,y){if(f===void 0&&(f={}),c)throw c;if(!1)var d;for(var g=!1,S={},_=0;_<i.length;_++){var h=i[_],O=r[h],C=f[h],x=O(C,y);if(typeof x=="undefined"){var P=Ma(h,y);throw new Error(P)}S[h]=x,g=g||x!==C}return g=g||i.length!==Object.keys(f).length,g?S:f},"combination")}function $o(t,e){return function(){return e(t.apply(this,arguments))}}function Bo(t,e){if(typeof t=="function")return $o(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 s=t[o];typeof s=="function"&&(r[o]=$o(s,e))}return r}function $a(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ho(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}function Ba(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Ho(r,!0).forEach(function(o){$a(t,o,r[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Ho(r).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(r,o))})}return t}function qr(){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,s){return function(){return o(s.apply(void 0,arguments))}})}function zo(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return function(o){return function(){var s=o.apply(void 0,arguments),i=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:s.getState,dispatch:n(function(){return i.apply(void 0,arguments)},"dispatch")},c=e.map(function(l){return l(a)});return i=qr.apply(void 0,c)(s.dispatch),Ba({},s,{dispatch:i})}}}var Nr,Qe,_t=u(()=>{Mo();Nr=n(function(){return Math.random().toString(36).substring(7).split("").join(".")},"randomString"),Qe={INIT:"@@redux/INIT"+Nr(),REPLACE:"@@redux/REPLACE"+Nr(),PROBE_UNKNOWN_ACTION:n(function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Nr()},"PROBE_UNKNOWN_ACTION")};n(ja,"isPlainObject");n(kr,"createStore");n(Ma,"getUndefinedStateErrorMessage");n(Va,"assertReducerShape");n(Vo,"combineReducers");n($o,"bindActionCreator");n(Bo,"bindActionCreators");n($a,"_defineProperty");n(Ho,"ownKeys");n(Ba,"_objectSpread2");n(qr,"compose");n(zo,"applyMiddleware")});var Wo={};b(Wo,{connect:()=>m,createRecalcProps:()=>Go,default:()=>Wa,resolveStore:()=>Ir,setStore:()=>za,unsetStore:()=>Ga});var Je,Ha,Ir,Go,m,za,Ga,Wa,R=u(()=>{_t();Je=null,Ha=n(t=>({dispatch:t}),"defaultMapDispatchToProps"),Ir=n(t=>{if(!Je)throw new Error("Missing redux store.");return Je},"resolveStore"),Go=n((t,e)=>r=>{let{getState:o,dispatch:s}=Ir(r),i=t?t(o(),r):{},a=e(s,r);Object.assign(r,i,a)},"createRecalcProps"),m=n((t,e=Ha)=>r=>{let s=Go(t,typeof e=="function"?e:i=>Bo(e,i));return class extends r{get store(){return Je}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this._storeUnsubscribe=Ir(this).subscribe(()=>s(this)),s(this)}attributeChangedCallback(i,a,c){super.attributeChangedCallback&&super.attributeChangedCallback(i,a,c),this._storeUnsubscribe&&a!==c&&s(this)}disconnectedCallback(){this._storeUnsubscribe(),super.disconnectedCallback&&super.disconnectedCallback()}}},"connect"),za=n(t=>{Je=t},"setStore"),Ga=n(()=>{Je=void 0},"unsetStore"),Wa=m});function Yo(t){var e=n(function(o){var s=o.dispatch,i=o.getState;return function(a){return function(c){return typeof c=="function"?c(s,i,t):a(c)}}},"middleware");return e}var Qo,Jo,Ko=u(()=>{n(Yo,"createThunkMiddleware");Qo=Yo();Qo.withExtraArgument=Yo;Jo=Qo});var Z,X,ee,xt,Zo,U,Ke,Et,St,Xo,vt,Pe,en,wt,Tt,tn,Ot,Ct,Pt,rn,on,Rt,nn,At,Re,sn,Nt,kt,Ze,Xe,qt,It,fe,te,Ut,Ft,Ae=u(()=>{Z="OPTIN_PRODUCT",X="OPTOUT_PRODUCT",ee="PRODUCT_CHANGE_FREQUENCY",xt="SET_MERCHANT_ID",Zo="REQUEST_OFFER",U="RECEIVE_OFFER",Ke="PRODUCT_HAS_CHANGED",Et="CREATED_SESSION_ID",St="SET_AUTH_URL",Xo="REQUEST_AUTH",vt="AUTHORIZE",Pe="UNAUTHORIZED",en="REQUEST_ORDERS",wt="RECEIVE_ORDERS",Tt="RECEIVE_ORDER_ITEMS",tn="FETCH_RESPONSE_ERROR",Ot="SET_ENVIRONMENT_STAGING",Ct="SET_ENVIRONMENT_DEV",Pt="SET_ENVIRONMENT_PROD",rn="CONCLUDE_UPSELL",on="REQUEST_CREATE_IU_ORDER",Rt="CREATE_ONE_TIME",nn="REQUEST_CONVERT_ONE_TIME",At="CONVERT_ONE_TIME",Re="CHECKOUT",sn="RECEIVE_FETCH",Nt="SET_LOCALE",kt="SET_CONFIG",Ze="SET_PREVIEW_STANDARD_OFFER",Xe="SET_PREVIEW_UPSELL_OFFER",qt="ADD_TEMPLATE",It="SET_TEMPLATES",fe="LOCAL_STORAGE_CHANGE",te="LOCAL_STORAGE_CLEAR",Ut="SET_FIRST_ORDER_PLACE_DATE",Ft="SET_PRODUCT_TO_SUBSCRIBE"});function Ya(t,e){return t===e}function Qa(t,e,r){if(e===null||r===null||e.length!==r.length)return!1;for(var o=e.length,s=0;s<o;s++)if(!t(e[s],r[s]))return!1;return!0}function Ja(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ya,r=null,o=null;return function(){return Qa(e,r,arguments)||(o=t.apply(null,arguments)),r=arguments,o}}function Ka(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}function Za(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 s=arguments.length,i=Array(s),a=0;a<s;a++)i[a]=arguments[a];var c=0,l=i.pop(),f=Ka(i),y=t.apply(void 0,[function(){return c++,l.apply(null,arguments)}].concat(r)),d=t(function(){for(var g=[],S=f.length,_=0;_<S;_++)g.push(f[_].apply(null,arguments));return y.apply(null,g)});return d.resultFunc=l,d.dependencies=f,d.recomputations=function(){return c},d.resetRecomputations=function(){return c=0},d}}var Ne,an=u(()=>{n(Ya,"defaultEqualityCheck");n(Qa,"areArgumentsShallowlyEqual");n(Ja,"defaultMemoize");n(Ka,"getDependencies");n(Za,"createSelectorCreator");Ne=Za(Ja)});var jt=K((Lu,mn)=>{var Xa="Expected a function",cn="__lodash_hash_undefined__",ec="[object Function]",tc="[object GeneratorFunction]",rc=/[\\^$.*+?()[\]{}|]/g,oc=/^\[object .+?Constructor\]$/,nc=typeof window=="object"&&window&&window.Object===Object&&window,sc=typeof self=="object"&&self&&self.Object===Object&&self,ln=nc||sc||Function("return this")();function ic(t,e){return t==null?void 0:t[e]}n(ic,"getValue");function ac(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}n(ac,"isHostObject");var cc=Array.prototype,lc=Function.prototype,un=Object.prototype,Ur=ln["__core-js_shared__"],pn=function(){var t=/[^.]+$/.exec(Ur&&Ur.keys&&Ur.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),dn=lc.toString,Fr=un.hasOwnProperty,uc=un.toString,pc=RegExp("^"+dn.call(Fr).replace(rc,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),dc=cc.splice,fc=fn(ln,"Map"),et=fn(Object,"create");function he(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(he,"Hash");function hc(){this.__data__=et?et(null):{}}n(hc,"hashClear");function mc(t){return this.has(t)&&delete this.__data__[t]}n(mc,"hashDelete");function gc(t){var e=this.__data__;if(et){var r=e[t];return r===cn?void 0:r}return Fr.call(e,t)?e[t]:void 0}n(gc,"hashGet");function yc(t){var e=this.__data__;return et?e[t]!==void 0:Fr.call(e,t)}n(yc,"hashHas");function bc(t,e){var r=this.__data__;return r[t]=et&&e===void 0?cn:e,this}n(bc,"hashSet");he.prototype.clear=hc;he.prototype.delete=mc;he.prototype.get=gc;he.prototype.has=yc;he.prototype.set=bc;function ke(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(ke,"ListCache");function _c(){this.__data__=[]}n(_c,"listCacheClear");function xc(t){var e=this.__data__,r=Dt(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():dc.call(e,r,1),!0}n(xc,"listCacheDelete");function Ec(t){var e=this.__data__,r=Dt(e,t);return r<0?void 0:e[r][1]}n(Ec,"listCacheGet");function Sc(t){return Dt(this.__data__,t)>-1}n(Sc,"listCacheHas");function vc(t,e){var r=this.__data__,o=Dt(r,t);return o<0?r.push([t,e]):r[o][1]=e,this}n(vc,"listCacheSet");ke.prototype.clear=_c;ke.prototype.delete=xc;ke.prototype.get=Ec;ke.prototype.has=Sc;ke.prototype.set=vc;function me(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(me,"MapCache");function wc(){this.__data__={hash:new he,map:new(fc||ke),string:new he}}n(wc,"mapCacheClear");function Tc(t){return Lt(this,t).delete(t)}n(Tc,"mapCacheDelete");function Oc(t){return Lt(this,t).get(t)}n(Oc,"mapCacheGet");function Cc(t){return Lt(this,t).has(t)}n(Cc,"mapCacheHas");function Pc(t,e){return Lt(this,t).set(t,e),this}n(Pc,"mapCacheSet");me.prototype.clear=wc;me.prototype.delete=Tc;me.prototype.get=Oc;me.prototype.has=Cc;me.prototype.set=Pc;function Dt(t,e){for(var r=t.length;r--;)if(qc(t[r][0],e))return r;return-1}n(Dt,"assocIndexOf");function Rc(t){if(!hn(t)||Nc(t))return!1;var e=Ic(t)||ac(t)?pc:oc;return e.test(kc(t))}n(Rc,"baseIsNative");function Lt(t,e){var r=t.__data__;return Ac(e)?r[typeof e=="string"?"string":"hash"]:r.map}n(Lt,"getMapData");function fn(t,e){var r=ic(t,e);return Rc(r)?r:void 0}n(fn,"getNative");function Ac(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}n(Ac,"isKeyable");function Nc(t){return!!pn&&pn in t}n(Nc,"isMasked");function kc(t){if(t!=null){try{return dn.call(t)}catch{}try{return t+""}catch{}}return""}n(kc,"toSource");function Dr(t,e){if(typeof t!="function"||e&&typeof e!="function")throw new TypeError(Xa);var r=n(function(){var o=arguments,s=e?e.apply(this,o):o[0],i=r.cache;if(i.has(s))return i.get(s);var a=t.apply(this,o);return r.cache=i.set(s,a),a},"memoized");return r.cache=new(Dr.Cache||me),r}n(Dr,"memoize");Dr.Cache=me;function qc(t,e){return t===e||t!==t&&e!==e}n(qc,"eq");function Ic(t){var e=hn(t)?uc.call(t):"";return e==ec||e==tc}n(Ic,"isFunction");function hn(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}n(hn,"isObject");mn.exports=Dr});var vn={};b(vn,{api:()=>re,compareFrequencies:()=>En,convertOneTimeToSubscription:()=>Sn,createOneTime:()=>xn,default:()=>Fc,fetchItems:()=>_n,fetchOffer:()=>yn,fetchOrders:()=>bn,isFrequencyValid:()=>Vt,parseFrequenciesList:()=>Vr,parseFrequency:()=>Ue,stringifyFrequencies:()=>Uc,stringifyFrequency:()=>Fe,toProductId:()=>gn,toQuery:()=>Mr,withAuth:()=>tt,withFetchJson:()=>qe,withHost:()=>Ie,withJsonBody:()=>jr});var Mt,Lr,qe,Ie,tt,jr,Mr,gn,yn,bn,_n,xn,Ue,Vt,En,Vr,Uc,Fe,Sn,re,Fc,oe=u(()=>{Mt=de(jt()),Lr=n((...t)=>JSON.stringify(t),"memoizeKey"),qe=n(t=>(...e)=>fetch(...t(...e)).then(r=>r.json()),"withFetchJson"),Ie=n(t=>(e,...r)=>{if(!e)throw Error("host required");let[o,s={}]=t(...r);return[`${e.replace(/\/+$/,"")}${o}`,s]},"withHost"),tt=n(t=>(e,...r)=>{if(!e)throw Error("auth required");let[o,s={}]=t(...r);return[o,{...s,headers:{Authorization:JSON.stringify(e),...s.headers}}]},"withAuth"),jr=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"),Mr=n((t=[])=>(Array.isArray(t)?t:Object.entries(t)).map(([e,r])=>[e,encodeURIComponent(r)].join("=")).join("&"),"toQuery"),gn=n(t=>JSON.stringify([].concat(t).map(e=>typeof e=="object"?e.id:e).filter(e=>e)),"toProductId"),yn=(0,Mt.default)(qe(Ie((t,e,r,o="pdp")=>{if(!t)throw Error("merchantId required");if(!e)throw Error("sessionId required");if(!r)throw Error("product required");let s=Mr([["session_id",e],["page_type",1],["p",gn(r)],["module_view",JSON.stringify(["regular"])]]);return[`/offer/${t}/${o}?${s}`]})),Lr),bn=(0,Mt.default)(qe(Ie(tt((t=1,e="place")=>[`/orders/?${Mr([["status",t],["ordering",e]])}`]))),Lr),_n=(0,Mt.default)(qe(Ie(tt(t=>{if(!t)throw Error("orderId required");return[`/items/?order=${t}`]}))),Lr),xn=qe(Ie(tt(jr((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}}]})))),Ue=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"),Vt=n(t=>t.match(/^\d+_\d$/),"isFrequencyValid"),En=n((t,e)=>String.prototype.localeCompare.call(t&&t.split("_").reverse().join("_"),e&&e.split("_").reverse().join("_")),"compareFrequencies"),Vr=n(t=>[...new Set(t&&t.split(/\s+/))].filter(Vt).sort(En),"parseFrequenciesList"),Uc=n(t=>t==null?t:t.join(" "),"stringifyFrequencies"),Fe=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"),Sn=qe(Ie(tt(jr((t,e,r)=>{if(!t)throw Error("item required");if(!e)throw Error("frequency required");let o=Ue(e);if(!o)throw Error("invalid frequency");return["/subscriptions/create_from_item/",{body:{item:t.public_id,offer:r,...o}}]})))),re={fetchOffer:yn,fetchOrders:bn,fetchItems:_n,createOneTime:xn,convertOneTimeToSubscription:Sn},Fc=re});function Dc(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}var ge,N,$t,wn,$r,Lc,z,Tn,On,ne,Bt,Br,G,De,W=u(()=>{an();ge=de(jt());oe();ge.default.Cache=Map;n(Dc,"arraysEqual");N=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))||Dc((t.components||[]).sort(),(e.components||[]).sort()))),"isSameProduct"),$t=n(t=>t.optedin||[],"optedinSelector"),wn=n(t=>t.optedout||[],"optedoutSelector"),$r=n(t=>t.autoshipByDefault||{},"autoshipSelector"),Lc=n(t=>t.defaultFrequencies||{},"defaultFrequenciesSelector"),z=(0,ge.default)(t=>Ne($t,wn,$r,(e,r,o)=>{let s=e.find(i=>N(t,i));return s||(r.find(i=>N(t,i))?!1:t&&o[t.id]?{id:t.id}:!1)}),t=>JSON.stringify(t)),Tn=(0,ge.default)(t=>Ne($t,e=>{let r=e.find(o=>N(t,o));return r||!1}),t=>JSON.stringify(t)),On=(0,ge.default)(t=>Ne(wn,e=>e.find(r=>N(t,r)))),ne=(0,ge.default)(t=>Ne(z(t),e=>e&&e.frequency||null)),Bt=(0,ge.default)(t=>Ne(Lc,e=>e[t]&&Fe(e[t])||null)),Br=n(t=>t.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase(),"kebabCase"),G=n((t,e,r,o)=>({[r]:e&&e.hasAttribute&&e.hasAttribute(Br(r))&&e[r]||e.offer&&typeof(e.offer[r]!=="undefined")&&e.offer[r]||t.config&&t.config[r]||o}),"configSelector"),De=n(t=>({templates:t.templates||[]}),"templatesSelector")});var Zn={};b(Zn,{auth:()=>Un,authUrl:()=>Dn,autoshipByDefault:()=>Qn,autoshipEligible:()=>An,config:()=>Gn,default:()=>Hr,defaultFrequencies:()=>Jn,eligibilityGroups:()=>kn,environment:()=>Hn,firstOrderPlaceDate:()=>$n,frequency:()=>jc,inStock:()=>Nn,incentives:()=>In,locale:()=>zn,merchantId:()=>Fn,nextUpcomingOrder:()=>Rn,offer:()=>Ln,offerId:()=>jn,optedin:()=>Cn,optedout:()=>Pn,previewStandardOffer:()=>Wn,previewUpsellOffer:()=>Yn,productOffer:()=>Vn,productToSubscribe:()=>Bn,sessionId:()=>Mn,templates:()=>Kn});var Cn,Pn,Rn,An,Nn,kn,qn,In,jc,Un,Fn,Dn,Ln,jn,Mn,Vn,$n,Bn,Hn,zn,Gn,Wn,Yn,Qn,Jn,Kn,Hr,zr=u(()=>{_t();Ae();W();oe();Cn=n((t=[],e)=>{switch(e.type){case te:return[];case fe:return e.newValue?e.newValue.optedin:t;case Z:case ee:let[[r],o]=t.reduce((s,i)=>s[N(e.payload.product,i)?0:1].push(i)&&s,[[],[]]);return(o||[]).concat({...r,...e.payload.product,frequency:e.payload.frequency});case X:return t.filter(s=>!N(e.payload.product,s));case Ke:return t.map(s=>N(e.payload.product,s)?{...s,...e.payload.newProduct}:s);case At:return t.filter(s=>!N(e.payload.product,s));case Re:return[];default:return t}},"optedin"),Pn=n((t=[],e)=>{switch(e.type){case te:return[];case fe:return e.newValue?e.newValue.optedout:t;case Z:case ee:return t.filter(s=>!N(e.payload.product,s));case X:let[[r],o]=t.reduce((s,i)=>s[N(e.payload.product,i)?0:1].push(i)&&s,[[],[]]);return(o||[]).concat({...r,...e.payload.product,frequency:e.payload.frequency});case Ke:return t.map(s=>N(e.payload.product,s)?{...s,...e.payload.newProduct}:s);case Re:return[];default:return t}},"optedout"),Rn=n((t={},{type:e,payload:r})=>{switch(e){case wt: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 Tt:return{...t,products:(r.results||[]).map(o=>o.product)};case Rt:return{...t,...r,public_id:r.order,...r.product&&{products:(t.products||[]).concat(r.product)}};default:return t}},"nextUpcomingOrder"),An=n((t={},e)=>{switch(e.type){case U:return{...t,...e.payload.autoship};default:return t}},"autoshipEligible"),Nn=n((t={},e)=>{switch(e.type){case U:return{...t,...e.payload.in_stock};default:return t}},"inStock"),kn=n((t={},e)=>{switch(e.type){case U:return{...t,...e.payload.eligibility_groups};default:return t}},"eligibilityGroups"),qn=n((t,e)=>t.map(r=>({...e[r],id:[r][0]})),"mapIncentive"),In=n((t={},e)=>{switch(e.type){case U:return{...t,...[...new Set(Object.keys(e.payload.incentives||{}))].reduce((r,o)=>({...r,[o]:Object.entries(e.payload.incentives).filter(([s])=>s===o).reduce((s,[,{initial:i,ongoing:a}])=>({...s,initial:[...s.initial||[],...qn(i,e.payload.incentives_display)],ongoing:[...s.ongoing||[],...qn(a,e.payload.incentives_display)]}),{})}),{})};default:return t}},"incentives"),jc=n((t={},e)=>{switch(e.type){case Z:case ee:return{...t,[e.payload.product]:e.payload.frequency};case X:return{...t,[e.payload.product]:void 0};default:return t}},"frequency"),Un=n((t=!1,e)=>{switch(e.type){case vt:return{...e.payload};case Pe:return!1;default:return t}},"auth"),Fn=n((t="",e)=>{switch(e.type){case xt:return e.payload;default:return t}},"merchantId"),Dn=n((t=null,e)=>{switch(e.type){case St:return e.payload;default:return t}},"authUrl"),Ln=n((t={},e)=>{switch(e.type){case U:return{...t,offerId:(e.payload.module_view||{}).regular,...e.payload.modifiers};default:return t}},"offer"),jn=n((t="",e)=>{switch(e.type){case U:return(e.payload.module_view||{}).regular||"";default:return t}},"offerId"),Mn=n((t=null,e)=>{switch(e.type){case te:return null;case Et:return e.payload;default:return t}},"sessionId"),Vn=n((t={},e)=>{switch(e.type){case U:return{...t,...Object.entries(e.payload.autoship).map(([r])=>({[r]:Object.keys(e.payload.modifiers)})).reduce((r,o)=>({...r,...o}))};case Re:return{};default:return t}},"productOffer"),$n=n((t={},e)=>{switch(e.type){case Ut:return{...t,[e.payload.product]:e.payload.firstOrderPlaceDate};default:return t}},"firstOrderPlaceDate"),Bn=n((t={},e)=>{switch(e.type){case Ft:return{...t,[e.payload.product]:e.payload.productToSubscribe};default:return t}},"productToSubscribe"),Hn=n((t={},e)=>{switch(e.type){case Ot:return{...t,name:"staging",apiUrl:"https://staging.om.ordergroove.com",legoUrl:"https://staging.restapi.ordergroove.com"};case Ct:return{...t,name:"dev",apiUrl:"https://dev.om.ordergroove.com",legoUrl:"https://dev.restapi.ordergroove.com"};case Pt:return{...t,name:"prod",apiUrl:"https://om.ordergroove.com",legoUrl:"https://restapi.ordergroove.com"};default:return t}},"environment"),zn=n((t={offerOptInLabel:"Subscribe and 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"}},e)=>{switch(e.type){case Nt:return{...t,...e.payload};default:return t}},"locale"),Gn=n((t={frequencies:["1_2","1_2","1_3"],offerType:"radio"},e)=>{switch(e.type){case kt:return{...t,...e.payload,defaultFrequency:e.payload.defaultFrequency?Fe(e.payload.defaultFrequency):t.defaultFrequency,frequencies:e.payload.frequencies?e.payload.frequencies.map(Fe):t.frequencies};default:return t}},"config"),Wn=n((t=!1,e)=>{switch(e.type){case Ze:return e.payload;default:return t}},"previewStandardOffer"),Yn=n((t=!1,e)=>{switch(e.type){case Xe:return e.payload;default:return t}},"previewUpsellOffer"),Qn=n((t=[],e)=>{switch(e.type){case U:return{...t,...e.payload.autoship_by_default};default:return t}},"autoshipByDefault"),Jn=n((t=[],e)=>{switch(e.type){case U:return{...t,...e.payload.default_frequencies};default:return t}},"defaultFrequencies"),Kn=n((t=[],e)=>{switch(e.type){case It:return[...e.payload||[]];case qt:return[e.payload,...t];default:return t}},"templates"),Hr=Vo({environment:Hn,optedin:Cn,optedout:Pn,merchantId:Fn,offer:Ln,offerId:jn,productOffer:Vn,sessionId:Mn,inStock:Nn,eligibilityGroups:kn,autoshipByDefault:Qn,autoshipEligible:An,incentives:In,nextUpcomingOrder:Rn,auth:Un,authUrl:Dn,locale:zn,config:Gn,previewStandardOffer:Wn,previewUpsellOffer:Yn,templates:Kn,defaultFrequencies:Jn,firstOrderPlaceDate:$n,productToSubscribe:Bn})});var Gr=K((Ht,Xn)=>{(function(t,e){typeof Ht=="object"&&typeof Xn!="undefined"?e(Ht):typeof define=="function"&&define.amd?define(["exports"],e):(t=t||self,e(t.throttleDebounce={}))})(Ht,function(t){"use strict";function e(o,s,i,a){var c,l=!1,f=0;function y(){c&&clearTimeout(c)}n(y,"clearExistingTimeout");function d(){y(),l=!0}n(d,"cancel"),typeof s!="boolean"&&(a=i,i=s,s=void 0);function g(){for(var S=arguments.length,_=new Array(S),h=0;h<S;h++)_[h]=arguments[h];var O=this,C=Date.now()-f;if(l)return;function x(){f=Date.now(),i.apply(O,_)}n(x,"exec");function P(){c=void 0}n(P,"clear"),a&&!c&&x(),y(),a===void 0&&C>o?x():s!==!0&&(c=setTimeout(a?P:x,a===void 0?o-C:o))}return n(g,"wrapper"),g.cancel=d,g}n(e,"throttle");function r(o,s,i){return i===void 0?e(o,s,!1):e(o,i,s!==!1)}n(r,"debounce"),t.debounce=r,t.throttle=e,Object.defineProperty(t,"__esModule",{value:!0})})});var es,Mc,Vc,$c,Bc,ts,rs=u(()=>{es=/^og_auth=/,Mc=n((t=es)=>(document.cookie.split(/;\s*/).find(e=>e.match(t))||"").replace(es,""),"s"),Vc=n(t=>{if(typeof t=="object")return t;let e=(t||"").split("|");return e.length===3?{sig_field:e[0],ts:parseInt(e[1],10),sig:e[2]}:null},"i"),$c=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"),Bc=n(t=>(t.headers.get("content-type")||"").indexOf("application/json")!==-1,"c"),ts=n((t,e=Mc,r=$c)=>Promise.resolve(e()||t&&typeof t=="string"&&fetch(t).then(o=>o.status>=200&&o.status<300?e()||(Bc(o)?o.json():Promise.resolve(r(t)).then(e)):null)).then(Vc).then(o=>o===null?Promise.reject(new Error("Unauthorized")):o),"l")});var ps={};b(ps,{addTemplate:()=>Kc,authorize:()=>zt,checkout:()=>Yc,concludeUpsell:()=>Yr,createIu:()=>Kr,createSessionId:()=>os,fetchAuth:()=>Gc,fetchDone:()=>ot,fetchOffer:()=>Jr,fetchOrders:()=>nt,fetchResponseError:()=>Yt,optinProduct:()=>Y,optoutProduct:()=>ye,productChangeFrequency:()=>rt,productHasChangedComponents:()=>Wr,receiveConvertOneTime:()=>us,receiveCreateOneTime:()=>cs,receiveItems:()=>Wt,receiveOffer:()=>be,receiveOrders:()=>Gt,requestAuth:()=>ns,requestConvertOneTimeToSubscription:()=>ls,requestCreateOneTime:()=>as,requestOffer:()=>is,requestOrders:()=>ss,requestSessionId:()=>Qr,setAuthUrl:()=>zc,setConfig:()=>Jc,setEnvironment:()=>Wc,setFirstOrderPlaceDate:()=>Zr,setLocale:()=>Qc,setMerchantId:()=>Hc,setProductToSubscribe:()=>Xr,setTemplates:()=>Zc,unauthorized:()=>se});var Y,ye,Wr,rt,Yr,Hc,os,ns,zt,se,zc,ot,Gc,ss,Gt,Wt,nt,Wc,Qr,be,Yt,is,Jr,Yc,as,cs,ls,us,Kr,Qc,Jc,Kc,Zc,Zr,Xr,k=u(()=>{rs();Ae();oe();Y=n((t,e)=>({type:Z,payload:{product:t,frequency:e}}),"optinProduct"),ye=n(t=>({type:X,payload:{product:t}}),"optoutProduct"),Wr=n((t,e)=>({type:Ke,payload:{newProduct:t,product:e}}),"productHasChangedComponents"),rt=n((t,e)=>({type:ee,payload:{product:t,frequency:e}}),"productChangeFrequency"),Yr=n(t=>({type:rn,payload:{product:t}}),"concludeUpsell"),Hc=n(t=>({type:xt,payload:t}),"setMerchantId"),os=n(t=>({type:Et,payload:`${t}.${Math.floor(Math.random()*999999)}.${Math.round(new Date().getTime()/1e3)}`}),"createSessionId"),ns=n(t=>({type:Xo,payload:t}),"requestAuth"),zt=n((t,e,r,o)=>({type:vt,payload:{public_id:t,sig_field:e,ts:r,sig:o}}),"authorize"),se=n(t=>({type:Pe,payload:t}),"unauthorized"),zc=n(t=>({type:St,payload:t}),"setAuthUrl"),ot=n(t=>({type:sn,payload:t}),"fetchDone"),Gc=n((t=ts)=>n(function(r,o){if(window.og&&window.og.previewMode)return r(se({message:"Offers are running in preview mode"}));let{merchantId:s,authUrl:i}=o(),a=ns(i);return r(a),t(i).then(({sig_field:c,ts:l,sig:f})=>r(zt(s,c,l,f)),c=>r(se(c))).finally(()=>r(ot(a)))},"fetchAuthThunk"),"fetchAuth"),ss=n((t,e)=>({type:en,payload:{status:t,ordering:e}}),"requestOrders"),Gt=n(t=>({type:wt,payload:t}),"receiveOrders"),Wt=n(t=>({type:Tt,payload:t}),"receiveItems"),nt=n((t=1,e="place")=>n(function(o,s){let{environment:{legoUrl:i},auth:a}=s();if(!a)return o(se("No auth set."));let c=ss(t,e);return o(c),re.fetchOrders(i,a,t,e).then(l=>{o(Gt(l));let f=(l.results[0]||{}).public_id;return f?re.fetchItems(i,a,f).then(y=>o(Wt(y))):null},l=>o(se(l))).finally(()=>o(ot(c)))},"fetchOrdersThunk"),"fetchOrders"),Wc=n(t=>{switch(t){case"dev":return{type:Ct,payload:t};case"staging":return{type:Ot,payload:t};case"prod":return{type:Pt,payload:t};default:throw new Error(`${t} is not a supported environment`)}},"setEnvironment"),Qr=n(()=>(t,e)=>{let{merchantId:r,sessionId:o}=e();return(!o||r&&!o.startsWith(r))&&t(os(r)),o},"requestSessionId"),be=n(t=>({type:U,payload:t}),"receiveOffer"),Yt=n(t=>({type:tn,payload:t}),"fetchResponseError"),is=n((t,e="pdp")=>({type:Zo,payload:{product:t,module:e}}),"requestOffer"),Jr=n((t,e="pdp")=>n(function(o,s){let{merchantId:i,sessionId:a,environment:{apiUrl:c}}=s(),l=is(t,e);return o(l),re.fetchOffer(c,i,a,t,e).then(f=>o(be(f)),f=>o(Yt(f))).finally(()=>o(ot(l)))},"fetchOfferThunk"),"fetchOffer"),Yc=n(()=>({type:Re}),"checkout"),as=n((t,e,r,o)=>({type:on,payload:{product:t,order:e,quantity:r,offerId:o}}),"requestCreateOneTime"),cs=n(t=>({type:Rt,payload:t}),"receiveCreateOneTime"),ls=n((t,e)=>({type:nn,payload:{item:t,frequency:e}}),"requestConvertOneTimeToSubscription"),us=n((t,e)=>({type:At,payload:{response:t,product:e}}),"receiveConvertOneTime"),Kr=n((t,e,r,o=!1,s=null)=>n(function(a,c){let{auth:l,environment:{legoUrl:f},previewUpsellOffer:y,offerId:d}=c();if(!l)return a(se("No auth set."));let g=as(t,e,r,d);return a(g),(y?Promise.resolve({legoUrl:f,product:t,order:e,quantity:r,offer:d}):re.createOneTime(f,l,t.id,e,r,d)).then(S=>(a(cs(S)),o?(a(ls(S,s)),(y?Promise.resolve({item:S,frequency:s}):re.convertOneTimeToSubscription(f,l,S,s,d)).then(_=>a(us(_,t)),_=>a(Yt(_)))):S),S=>a(Yt(S))).finally(()=>a(ot(g)))},"createIuThunk"),"createIu"),Qc=n(t=>({type:Nt,payload:t}),"setLocale"),Jc=n(t=>({type:kt,payload:t}),"setConfig"),Kc=n((t,e,r)=>({type:qt,payload:{selector:t,markup:e,config:r}}),"addTemplate"),Zc=n(t=>({type:It,payload:t}),"setTemplates"),Zr=n((t,e)=>({type:Ut,payload:{product:t,firstOrderPlaceDate:e}}),"setFirstOrderPlaceDate"),Xr=n((t,e)=>({type:Ft,payload:{product:t,productToSubscribe:e}}),"setProductToSubscribe")});var hs={};b(hs,{STORE_ROOT:()=>_e,clearState:()=>el,listenLocalStorageChanges:()=>Xc,loadState:()=>ro,safeParseState:()=>eo,saveState:()=>oo,serializeState:()=>fs});var ds,_e,eo,to,ro,fs,oo,Xc,el,Qt=u(()=>{ds=de(Gr());k();Ae();_e="OG_STATE",eo=n(t=>{try{return t===null?void 0:JSON.parse(t)}catch{return}},"safeParseState"),to=n(()=>window.og&&window.og.previewMode,"isPreviewMode"),ro=n(()=>to()?{}:eo(localStorage.getItem(_e)),"loadState"),fs=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"),oo=n(t=>{if(to())return;let e=fs(t);e&&localStorage.getItem(_e)!==e&&localStorage.setItem(_e,e)},"saveState"),Xc=n(t=>(0,ds.throttle)(500,e=>{if(to())return;let{key:r,newValue:o}=e;r===_e&&o===null?(t.dispatch({type:te}),setTimeout(()=>t.dispatch(Qr()),0)):r===_e&&t.dispatch({type:fe,newValue:eo(o)})}),"listenLocalStorageChanges"),el=n(()=>localStorage.removeItem(_e),"clearState")});var ms,tl,gs,rl,ys,bs,_s=u(()=>{ms=de(Gr());Ae();W();Qt();tl=n((t,e,r=document)=>r.dispatchEvent(new CustomEvent(t,{detail:e})),"dispatchEvent"),gs=n(t=>({payload:{product:{id:e,components:r}={}}={}}={})=>setTimeout(()=>tl("optin-changed",{productId:e,components:r,optedIn:t}),0),"dispatchOptinChangedEvent"),rl=[{expressions:[({type:t}={})=>t===Z,({type:t}={})=>t===ee],fn:gs(!0)},{expressions:[({type:t}={})=>t===X],fn:gs(!1)}],ys=n(t=>e=>r=>{let o=t.getState();rl.forEach(s=>{s.expressions.some(i=>i(r,o))&&s.fn(r)}),e(r)},"dispatchMiddleware"),bs=n(t=>e=>r=>{e(r);let o=(0,ms.throttle)(500,()=>{oo({...t.getState()})});r.type!==fe&&o()},"localStorageMiddleware")});var Es={};b(Es,{default:()=>ol,getStore:()=>xs});function xs(){if(window.og&&window.og.store)return window.og.store;let t=window.og&&window.og.previewMode,e=typeof window=="object"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({}):qr,r=[Jo,ys];t||r.push(bs);let o=e(zo(...r)),s=kr(Hr,t?{}:ro(),o);return window.og=window.og||{},window.og.store=s,s}var ol,Ss=u(()=>{_t();Ko();zr();Qt();_s();n(xs,"getStore");ol=xs});var ws={};b(ws,{default:()=>nl,getProductsForPurchasePost:()=>vs});var vs,nl,Ts=u(()=>{oe();vs=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],...Ue(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"),nl={getProductsForPurchasePost:vs}});var no,xe,Ee=u(()=>{no=typeof window!="undefined"&&window.customElements!=null&&window.customElements.polyfillWrapFlushCallback!==void 0,xe=n((t,e,r=null)=>{for(;e!==r;){let o=e.nextSibling;t.removeChild(e),e=o}},"removeNodes")});var F,so,Os,Le,Se,Cs,st,$,Jt,ie=u(()=>{F=`{{lit-${String(Math.random()).slice(2)}}}`,so=`<!--${F}-->`,Os=new RegExp(`${F}|${so}`),Le="$lit$",Se=class{constructor(e,r){this.parts=[],this.element=r;let o=[],s=[],i=document.createTreeWalker(r.content,133,null,!1),a=0,c=-1,l=0,{strings:f,values:{length:y}}=e;for(;l<y;){let d=i.nextNode();if(d===null){i.currentNode=s.pop();continue}if(c++,d.nodeType===1){if(d.hasAttributes()){let g=d.attributes,{length:S}=g,_=0;for(let h=0;h<S;h++)Cs(g[h].name,Le)&&_++;for(;_-- >0;){let h=f[l],O=Jt.exec(h)[2],C=O.toLowerCase()+Le,x=d.getAttribute(C);d.removeAttribute(C);let P=x.split(Os);this.parts.push({type:"attribute",index:c,name:O,strings:P}),l+=P.length-1}}d.tagName==="TEMPLATE"&&(s.push(d),i.currentNode=d.content)}else if(d.nodeType===3){let g=d.data;if(g.indexOf(F)>=0){let S=d.parentNode,_=g.split(Os),h=_.length-1;for(let O=0;O<h;O++){let C,x=_[O];if(x==="")C=$();else{let P=Jt.exec(x);P!==null&&Cs(P[2],Le)&&(x=x.slice(0,P.index)+P[1]+P[2].slice(0,-Le.length)+P[3]),C=document.createTextNode(x)}S.insertBefore(C,d),this.parts.push({type:"node",index:++c})}_[h]===""?(S.insertBefore($(),d),o.push(d)):d.data=_[h],l+=h}}else if(d.nodeType===8)if(d.data===F){let g=d.parentNode;(d.previousSibling===null||c===a)&&(c++,g.insertBefore($(),d)),a=c,this.parts.push({type:"node",index:c}),d.nextSibling===null?d.data="":(o.push(d),c--),l++}else{let g=-1;for(;(g=d.data.indexOf(F,g+1))!==-1;)this.parts.push({type:"node",index:-1}),l++}}for(let d of o)d.parentNode.removeChild(d)}};n(Se,"Template");Cs=n((t,e)=>{let r=t.length-e.length;return r>=0&&t.slice(r)===e},"endsWith"),st=n(t=>t.index!==-1,"isTemplatePartActive"),$=n(()=>document.createComment(""),"createMarker"),Jt=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/});function ao(t,e){let{element:{content:r},parts:o}=t,s=document.createTreeWalker(r,io,null,!1),i=it(o),a=o[i],c=-1,l=0,f=[],y=null;for(;s.nextNode();){c++;let d=s.currentNode;for(d.previousSibling===y&&(y=null),e.has(d)&&(f.push(d),y===null&&(y=d)),y!==null&&l++;a!==void 0&&a.index===c;)a.index=y!==null?-1:a.index-l,i=it(o,i),a=o[i]}f.forEach(d=>d.parentNode.removeChild(d))}function Ps(t,e,r=null){let{element:{content:o},parts:s}=t;if(r==null){o.appendChild(e);return}let i=document.createTreeWalker(o,io,null,!1),a=it(s),c=0,l=-1;for(;i.nextNode();)for(l++,i.currentNode===r&&(c=sl(e),r.parentNode.insertBefore(e,r));a!==-1&&s[a].index===l;){if(c>0){for(;a!==-1;)s[a].index+=c,a=it(s,a);return}a=it(s,a)}}var io,sl,it,Rs=u(()=>{ie();io=133;n(ao,"removeNodesFromTemplate");sl=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(st(o))return r}return-1},"nextActiveIndexInTemplateParts");n(Ps,"insertNodeIntoTemplate")});var il,ve,co=u(()=>{il=new WeakMap,ve=n(t=>typeof t=="function"&&il.has(t),"isDirective")});var q,Kt,lo=u(()=>{q={},Kt={}});var ae,Zt=u(()=>{Ee();ie();ae=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=no?this.template.element.content.cloneNode(!0):document.importNode(this.template.element.content,!0),r=[],o=this.template.parts,s=document.createTreeWalker(e,133,null,!1),i=0,a=0,c,l=s.nextNode();for(;i<o.length;){if(c=o[i],!st(c)){this.__parts.push(void 0),i++;continue}for(;a<c.index;)a++,l.nodeName==="TEMPLATE"&&(r.push(l),s.currentNode=l.content),(l=s.nextNode())===null&&(s.currentNode=r.pop(),l=s.nextNode());if(c.type==="node"){let f=this.processor.handleTextExpression(this.options);f.insertAfterNode(l.previousSibling),this.__parts.push(f)}else this.__parts.push(...this.processor.handleAttributeExpressions(l,c.name,c.strings,this.options));i++}return no&&(document.adoptNode(e),customElements.upgrade(e)),e}};n(ae,"TemplateInstance")});var As,cl,Q,Xt=u(()=>{Ee();ie();As=window.trustedTypes&&trustedTypes.createPolicy("lit-html",{createHTML:t=>t}),cl=` ${F} `,Q=class{constructor(e,r,o,s){this.strings=e,this.values=r,this.type=o,this.processor=s}getHTML(){let e=this.strings.length-1,r="",o=!1;for(let s=0;s<e;s++){let i=this.strings[s],a=i.lastIndexOf("<!--");o=(a>-1||o)&&i.indexOf("-->",a+1)===-1;let c=Jt.exec(i);c===null?r+=i+(o?cl:so):r+=i.substr(0,c.index)+c[1]+c[2]+Le+c[3]+F}return r+=this.strings[e],r}getTemplateElement(){let e=document.createElement("template"),r=this.getHTML();return As!==void 0&&(r=As.createHTML(r)),e.innerHTML=r,e}};n(Q,"TemplateResult")});var er,tr,je,at,J,ct,lt,rr,Ns,ut,ll,or=u(()=>{co();Ee();lo();Zt();Xt();ie();er=n(t=>t===null||!(typeof t=="object"||typeof t=="function"),"isPrimitive"),tr=n(t=>Array.isArray(t)||!!(t&&t[Symbol.iterator]),"isIterable"),je=class{constructor(e,r,o){this.dirty=!0,this.element=e,this.name=r,this.strings=o,this.parts=[];for(let s=0;s<o.length-1;s++)this.parts[s]=this._createPart()}_createPart(){return new at(this)}_getValue(){let e=this.strings,r=e.length-1,o=this.parts;if(r===1&&e[0]===""&&e[1]===""){let i=o[0].value;if(typeof i=="symbol")return String(i);if(typeof i=="string"||!tr(i))return i}let s="";for(let i=0;i<r;i++){s+=e[i];let a=o[i];if(a!==void 0){let c=a.value;if(er(c)||!tr(c))s+=typeof c=="string"?c:String(c);else for(let l of c)s+=typeof l=="string"?l:String(l)}}return s+=e[r],s}commit(){this.dirty&&(this.dirty=!1,this.element.setAttribute(this.name,this._getValue()))}};n(je,"AttributeCommitter");at=class{constructor(e){this.value=void 0,this.committer=e}setValue(e){e!==q&&(!er(e)||e!==this.value)&&(this.value=e,ve(e)||(this.committer.dirty=!0))}commit(){for(;ve(this.value);){let e=this.value;this.value=q,e(this)}this.value!==q&&this.committer.commit()}};n(at,"AttributePart");J=class{constructor(e){this.value=void 0,this.__pendingValue=void 0,this.options=e}appendInto(e){this.startNode=e.appendChild($()),this.endNode=e.appendChild($())}insertAfterNode(e){this.startNode=e,this.endNode=e.nextSibling}appendIntoPart(e){e.__insert(this.startNode=$()),e.__insert(this.endNode=$())}insertAfterPart(e){e.__insert(this.startNode=$()),this.endNode=e.endNode,e.endNode=this.startNode}setValue(e){this.__pendingValue=e}commit(){if(this.startNode.parentNode===null)return;for(;ve(this.__pendingValue);){let r=this.__pendingValue;this.__pendingValue=q,r(this)}let e=this.__pendingValue;e!==q&&(er(e)?e!==this.value&&this.__commitText(e):e instanceof Q?this.__commitTemplateResult(e):e instanceof Node?this.__commitNode(e):tr(e)?this.__commitIterable(e):e===Kt?(this.value=Kt,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 ae&&this.value.template===r)this.value.update(e.values);else{let o=new ae(r,e.processor,this.options),s=o._clone();o.update(e.values),this.__commitNode(s),this.value=o}}__commitIterable(e){Array.isArray(this.value)||(this.value=[],this.clear());let r=this.value,o=0,s;for(let i of e)s=r[o],s===void 0&&(s=new J(this.options),r.push(s),o===0?s.appendIntoPart(this):s.insertAfterPart(r[o-1])),s.setValue(i),s.commit(),o++;o<r.length&&(r.length=o,this.clear(s&&s.endNode))}clear(e=this.startNode){xe(this.startNode.parentNode,e.nextSibling,this.endNode)}};n(J,"NodePart");ct=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(;ve(this.__pendingValue);){let r=this.__pendingValue;this.__pendingValue=q,r(this)}if(this.__pendingValue===q)return;let e=!!this.__pendingValue;this.value!==e&&(e?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=e),this.__pendingValue=q}};n(ct,"BooleanAttributePart");lt=class extends je{constructor(e,r,o){super(e,r,o);this.single=o.length===2&&o[0]===""&&o[1]===""}_createPart(){return new rr(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}};n(lt,"PropertyCommitter");rr=class extends at{};n(rr,"PropertyPart");Ns=!1;(()=>{try{let t={get capture(){return Ns=!0,!1}};window.addEventListener("test",t,t),window.removeEventListener("test",t,t)}catch{}})();ut=class{constructor(e,r,o){this.value=void 0,this.__pendingValue=void 0,this.element=e,this.eventName=r,this.eventContext=o,this.__boundHandleEvent=s=>this.handleEvent(s)}setValue(e){this.__pendingValue=e}commit(){for(;ve(this.__pendingValue);){let i=this.__pendingValue;this.__pendingValue=q,i(this)}if(this.__pendingValue===q)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),s=e!=null&&(r==null||o);o&&this.element.removeEventListener(this.eventName,this.__boundHandleEvent,this.__options),s&&(this.__options=ll(e),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=e,this.__pendingValue=q}handleEvent(e){typeof this.value=="function"?this.value.call(this.eventContext||this.element,e):this.value.handleEvent(e)}};n(ut,"EventPart");ll=n(t=>t&&(Ns?{capture:t.capture,passive:t.passive,once:t.once}:t.capture),"getOptions")});function uo(t){let e=we.get(t.type);e===void 0&&(e={stringsArray:new WeakMap,keyString:new Map},we.set(t.type,e));let r=e.stringsArray.get(t.strings);if(r!==void 0)return r;let o=t.strings.join(F);return r=e.keyString.get(o),r===void 0&&(r=new Se(t,t.getTemplateElement()),e.keyString.set(o,r)),e.stringsArray.set(t.strings,r),r}var we,nr=u(()=>{ie();n(uo,"templateFactory");we=new Map});var ce,po,fo=u(()=>{Ee();or();nr();ce=new WeakMap,po=n((t,e,r)=>{let o=ce.get(e);o===void 0&&(xe(e,e.firstChild),ce.set(e,o=new J(Object.assign({templateFactory:uo},r))),o.appendInto(e)),o.setValue(t),o.commit()},"render")});var sr,ho,mo=u(()=>{or();sr=class{handleAttributeExpressions(e,r,o,s){let i=r[0];return i==="."?new lt(e,r.slice(1),o).parts:i==="@"?[new ut(e,r.slice(1),s.eventContext)]:i==="?"?[new ct(e,r.slice(1),o)]:new je(e,r,o).parts}handleTextExpression(e){return new J(e)}};n(sr,"DefaultTemplateProcessor");ho=new sr});var p,go=u(()=>{mo();Xt();mo();co();Ee();lo();or();fo();nr();Zt();Xt();ie();typeof window!="undefined"&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.3.0");p=n((t,...e)=>new Q(t,e,"html",ho),"html")});var qs,ir,pl,dl,fl,Is,hl,Us,Fs=u(()=>{Ee();Rs();fo();nr();Zt();ie();go();qs=n((t,e)=>`${t}--${e}`,"getTemplateCacheKey"),ir=!0;typeof window.ShadyCSS=="undefined"?ir=!1:typeof window.ShadyCSS.prepareTemplateDom=="undefined"&&(console.warn("Incompatible ShadyCSS version detected. Please update to at least @webcomponents/webcomponentsjs@2.0.2 and @webcomponents/shadycss@1.3.1."),ir=!1);pl=n(t=>e=>{let r=qs(e.type,t),o=we.get(r);o===void 0&&(o={stringsArray:new WeakMap,keyString:new Map},we.set(r,o));let s=o.stringsArray.get(e.strings);if(s!==void 0)return s;let i=e.strings.join(F);if(s=o.keyString.get(i),s===void 0){let a=e.getTemplateElement();ir&&window.ShadyCSS.prepareTemplateDom(a,t),s=new Se(e,a),o.keyString.set(i,s)}return o.stringsArray.set(e.strings,s),s},"shadyTemplateFactory"),dl=["html","svg"],fl=n(t=>{dl.forEach(e=>{let r=we.get(qs(e,t));r!==void 0&&r.keyString.forEach(o=>{let{element:{content:s}}=o,i=new Set;Array.from(s.querySelectorAll("style")).forEach(a=>{i.add(a)}),ao(o,i)})})},"removeStylesFromLitTemplates"),Is=new Set,hl=n((t,e,r)=>{Is.add(t);let o=r?r.element:document.createElement("template"),s=e.querySelectorAll("style"),{length:i}=s;if(i===0){window.ShadyCSS.prepareTemplateStyles(o,t);return}let a=document.createElement("style");for(let f=0;f<i;f++){let y=s[f];y.parentNode.removeChild(y),a.textContent+=y.textContent}fl(t);let c=o.content;r?Ps(r,a,c.firstChild):c.insertBefore(a,c.firstChild),window.ShadyCSS.prepareTemplateStyles(o,t);let l=c.querySelector("style");if(window.ShadyCSS.nativeShadow&&l!==null)e.insertBefore(l.cloneNode(!0),e.firstChild);else if(r){c.insertBefore(a,c.firstChild);let f=new Set;f.add(a),ao(r,f)}},"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,s=ce.has(e),i=ir&&e.nodeType===11&&!!e.host,a=i&&!Is.has(o),c=a?document.createDocumentFragment():e;if(po(t,c,Object.assign({templateFactory:pl(o)},r)),a){let l=ce.get(c);ce.delete(c);let f=l.value instanceof ae?l.value.template:void 0;hl(o,c,f),xe(e,e.firstChild),e.appendChild(c),ce.set(e,l)}!s&&i&&window.ShadyCSS.styleElement(e.host)},"render")});var Ds,yo,Ls,bo,_o,xo,Eo,So,vo,pt,wo=u(()=>{window.JSCompiler_renameProperty=(t,e)=>t;yo={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}},Ls=n((t,e)=>e!==t&&(e===e||t===t),"notEqual"),bo={attribute:!0,type:String,converter:yo,reflect:!1,hasChanged:Ls},_o=1,xo=1<<2,Eo=1<<3,So=1<<4,vo="finalized",pt=class extends HTMLElement{constructor(){super();this.initialize()}static get observedAttributes(){this.finalize();let e=[];return this._classProperties.forEach((r,o)=>{let s=this._attributeNameForProperty(o,r);s!==void 0&&(this._attributeToPropertyMap.set(s,o),e.push(s))}),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=bo){if(this._ensureClassProperties(),this._classProperties.set(e,r),r.noAccessor||this.prototype.hasOwnProperty(e))return;let o=typeof e=="symbol"?Symbol():`__${e}`,s=this.getPropertyDescriptor(e,o,r);s!==void 0&&Object.defineProperty(this.prototype,e,s)}static getPropertyDescriptor(e,r,o){return{get(){return this[r]},set(s){let i=this[e];this[r]=s,this.requestUpdateInternal(e,i,o)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this._classProperties&&this._classProperties.get(e)||bo}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 s of o)this.createProperty(s,r[s])}}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=Ls){return o(e,r)}static _propertyValueFromAttribute(e,r){let o=r.type,s=r.converter||yo,i=typeof s=="function"?s:s.fromAttribute;return i?i(e,o):e}static _propertyValueToAttribute(e,r){if(r.reflect===void 0)return;let o=r.type,s=r.converter;return(s&&s.toAttribute||yo.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=bo){let s=this.constructor,i=s._attributeNameForProperty(e,o);if(i!==void 0){let a=s._propertyValueToAttribute(r,o);if(a===void 0)return;this._updateState=this._updateState|Eo,a==null?this.removeAttribute(i):this.setAttribute(i,a),this._updateState=this._updateState&~Eo}}_attributeToProperty(e,r){if(this._updateState&Eo)return;let o=this.constructor,s=o._attributeToPropertyMap.get(e);if(s!==void 0){let i=o.getPropertyOptions(s);this._updateState=this._updateState|So,this[s]=o._propertyValueFromAttribute(r,i),this._updateState=this._updateState&~So}}requestUpdateInternal(e,r,o){let s=!0;if(e!==void 0){let i=this.constructor;o=o||i.getPropertyOptions(e),i._valueHasChanged(this[e],r,o.hasChanged)?(this._changedProperties.has(e)||this._changedProperties.set(e,r),o.reflect===!0&&!(this._updateState&So)&&(this._reflectingProperties===void 0&&(this._reflectingProperties=new Map),this._reflectingProperties.set(e,o))):s=!1}!this._hasRequestedUpdate&&s&&(this._updatePromise=this._enqueueUpdate())}requestUpdate(e,r){return this.requestUpdateInternal(e,r),this.updateComplete}async _enqueueUpdate(){this._updateState=this._updateState|xo;try{await this._updatePromise}catch{}let e=this.performUpdate();return e!=null&&await e,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return this._updateState&xo}get hasUpdated(){return this._updateState&_o}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&_o||(this._updateState=this._updateState|_o,this.firstUpdated(r)),this.updated(r))}_markUpdated(){this._changedProperties=new Map,this._updateState=this._updateState&~xo}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(pt,"UpdatingElement");Ds=vo;pt[Ds]=!0});var js,id,Ms=u(()=>{js=Element.prototype,id=js.msMatchesSelector||js.webkitMatchesSelector});var ar,To,dt,Vs,ml,T,Oo=u(()=>{ar=window.ShadowRoot&&(window.ShadyCSS===void 0||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,To=Symbol(),dt=class{constructor(e,r){if(r!==To)throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e}get styleSheet(){return this._styleSheet===void 0&&(ar?(this._styleSheet=new CSSStyleSheet,this._styleSheet.replaceSync(this.cssText)):this._styleSheet=null),this._styleSheet}toString(){return this.cssText}};n(dt,"CSSResult");Vs=n(t=>new dt(String(t),To),"unsafeCSS"),ml=n(t=>{if(t instanceof dt)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"),T=n((t,...e)=>{let r=e.reduce((o,s,i)=>o+ml(s)+t[i+1],t[0]);return new dt(r,To)},"css")});var $s,E,v=u(()=>{Fs();wo();wo();Ms();go();Oo();Oo();(window.litElementVersions||(window.litElementVersions=[])).push("2.4.0");$s={},E=class extends pt{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((i,a)=>i.reduceRight((c,l)=>Array.isArray(l)?r(l,c):(c.add(l),c),a),"addStyles"),o=r(e,new Set),s=[];o.forEach(i=>s.unshift(i)),this._styles=s}else this._styles=e===void 0?[]:[e];this._styles=this._styles.map(r=>{if(r instanceof CSSStyleSheet&&!ar){let o=Array.prototype.slice.call(r.cssRules).reduce((s,i)=>s+i.cssText,"");return Vs(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):ar?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!==$s&&this.constructor.render(r,this.renderRoot,{scopeName:this.localName,eventContext:this}),this._needsShimAdoptedStyleSheets&&(this._needsShimAdoptedStyleSheets=!1,this.constructor._styles.forEach(o=>{let s=document.createElement("style");s.textContent=o.cssText,this.renderRoot.appendChild(s)}))}render(){return $s}};n(E,"LitElement");E.finalized=!0;E.render=Us});var cr=K((yd,Bs)=>{var gl={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"};Bs.exports=gl});var zs=K((bd,Hs)=>{var Te=cr(),yl=n(t=>{let e="",r=[];for(let o of t){let s=o.charCodeAt(0);switch(s){case Te.PAR_OPEN:case Te.PAR_CLOSE:case Te.OP_NOT:case Te.BINARY_AND:case Te.BINARY_OR:e&&(r.push({type:Te.LITERAL,value:e}),e=""),r.push({type:s,value:o});break;default:e+=o}}return e&&r.push({type:Te.LITERAL,value:e}),r},"Tokenizer");Hs.exports=yl});var Ws=K((_d,Gs)=>{var le=cr(),bl=n(t=>{let e=[],r=[];return t.forEach(s=>{switch(s.type){case le.LITERAL:e.unshift(s);break;case le.BINARY_AND:case le.BINARY_OR:case le.OP_NOT:case le.PAR_OPEN:r.push(s);break;case le.PAR_CLOSE:for(;r.length&&r[r.length-1].type!==le.PAR_OPEN;)e.unshift(r.pop());r.pop(),r.length&&r[r.length-1].type===le.OP_NOT&&e.unshift(r.pop());break;default:break}}),r.length&&[...r.reverse(),...e]||e},"PolishNotation"),_l=n(function*(t){for(let e=0;e<t.length-1;e++)yield t[e];return t[t.length-1]},"PolishGenerator");Gs.exports={PolishNotation:bl,PolishGenerator:_l}});var Qs=K((xd,Ys)=>{var I=cr(),j=class{constructor(e,r,o,s){this.op=e,this.left=r,this.right=o,this.literal=s}isLeaf(){return this.op===I.LEAF}isAtomic(){return this.isLeaf()||this.op===I.OP_NOT&&this.left.isLeaf()}getLiteralValue(){return this.literal}static CreateAnd(e,r){return new j(I.BINARY_AND,e,r)}static CreateNot(e){return new j(I.OP_NOT,e)}static CreateOr(e,r){return new j(I.BINARY_OR,e,r)}static CreateLiteral(e){return new j(I.LEAF,null,null,e)}};n(j,"ExpNode");var Me=n(t=>{let e=t.next().value;switch(e.type){case I.LITERAL:return j.CreateLiteral(e.value);case I.OP_NOT:return j.CreateNot(Me(t));case I.BINARY_AND:{let r=Me(t),o=Me(t);return j.CreateAnd(r,o)}case I.BINARY_OR:{let r=Me(t),o=Me(t);return j.CreateOr(r,o)}}return null},"make"),Ve=n((t,e)=>{if(t.isLeaf())return e(t.getLiteralValue());if(t.op===I.OP_NOT)return!Ve(t.left,e);if(t.op===I.BINARY_OR)return Ve(t.left,e)||Ve(t.right,e);if(t.op===I.BINARY_AND)return Ve(t.left,e)&&Ve(t.right,e)},"nodeEvaluator");Ys.exports={make:Me,nodeEvaluator:Ve}});var Xs=K((Ed,Zs)=>{var xl=zs(),Js=Ws(),Ks=Qs(),El=n((t,e)=>{let r=xl(t),o=Js.PolishNotation(r),s=Js.PolishGenerator(o),i=Ks.make(s);return Ks.nodeEvaluator(i,e)},"parse");Zs.exports={parse:El}});var Sl,ei,Co,vl,Po,D,lr,M=u(()=>{v();Sl=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"),ei=n(t=>t.hasAttribute("product")&&{id:t.getAttribute("product"),...t.hasAttribute("product-components")&&{components:JSON.parse(t.getAttribute("product-components"))}},"buildProduct"),Co=n(t=>{let e=ei(t);if(!e){let r=t.offer;r&&(e=ei(r))}return e},"resolveProduct"),vl=n(t=>{let e=t;for(;e;){if(e.tagName==="OG-OFFER")return e;e=e.nodeType===11?e.host:e.parentNode}},"resolveOffer"),Po=n(t=>class extends t{get offer(){return vl(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"),D=n(t=>class extends Po(t){get product(){return Co(this)}},"withProduct"),lr=n(t=>class extends t{get childOptions(){return this._childOptions||{options:[]}}connectedCallback(){let e=[],r=null;this.querySelectorAll("option").forEach(o=>{let s=Sl(o.value),i=o.innerText.trim();e.push({value:s,text:i}),!r&&o.selected&&(r=s)}),this._childOptions={options:e,isSelected:r},super.connectedCallback&&super.connectedCallback()}},"withChildOptions")});var ur={};b(ur,{eligibilityGroups:()=>oi,eligible:()=>ti,hasUpcomingOrder:()=>si,hasUpsellGroup:()=>ni,inStock:()=>Ro,regularEligible:()=>Ol,subscribed:()=>wl,subscriptionEligible:()=>ri,upcomingOrderContainsProduct:()=>Tl,upsellEligible:()=>ii});var Ro,ti,ri,oi,ni,wl,si,Tl,ii,Ol,ai=u(()=>{W();Ro=n((t,e)=>(t.inStock||{})[(e.product||{}).id],"inStock"),ti=n((t,e)=>(t.autoshipEligible||{})[(e.product||{}).id]||!1,"eligible"),ri=n((t,e)=>(t.offerId&&t.offerId!=="0"||!1)&&ti(t,e)&&Ro(t,e),"subscriptionEligible"),oi=n((t,e)=>(t.eligibilityGroups||{})[(e.product||{}).id]||null,"eligibilityGroups"),ni=n((t,e)=>{let r=oi(t,e);return r===null||!!r.find(o=>o==="upsell"||o==="impulse_upsell")},"hasUpsellGroup"),wl=n((t,e)=>Tn(e.product)(t),"subscribed"),si=n(t=>!!(t.nextUpcomingOrder&&t.nextUpcomingOrder.public_id),"hasUpcomingOrder"),Tl=n((t,e)=>(t.nextUpcomingOrder&&t.nextUpcomingOrder.products||[]).includes((e.product||{}).id),"upcomingOrderContainsProduct"),ii=n((t,e)=>t.offerId&&t.offerId!=="0"&&t.auth&&Ro(t,e)&&si(t)&&ni(t,e),"upsellEligible"),Ol=n((t,e)=>ri(t,e)&&!ii(t,e),"regularEligible")});var di={};b(di,{ConnectedWhen:()=>pi,When:()=>pr,default:()=>Cl,mapStateToProps:()=>ui,removeWhitespace:()=>li});var ci,li,pr,ui,pi,Cl,fi=u(()=>{v();ci=de(Xs());R();M();ai();li=n(t=>t.replace(/(\r\n|\n|\r|\s)+/gm,""),"removeWhitespace"),pr=class extends D(E){static get properties(){return{...super.properties,state:{type:Object,attribute:!1},test:{type:String}}}render(){return this.test&&ci.default.parse(li(this.test),r=>ur[r]&&ur[r](this.state,this))?p`
11
+ var lib=(()=>{var La=Object.create;var Re=Object.defineProperty,ja=Object.defineProperties,Ma=Object.getOwnPropertyDescriptor,Va=Object.getOwnPropertyDescriptors,$a=Object.getOwnPropertyNames,Lo=Object.getOwnPropertySymbols,Ba=Object.getPrototypeOf,jo=Object.prototype.hasOwnProperty,Ha=Object.prototype.propertyIsEnumerable;var Mo=(t,e,r)=>e in t?Re(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,l=(t,e)=>{for(var r in e||(e={}))jo.call(e,r)&&Mo(t,r,e[r]);if(Lo)for(var r of Lo(e))Ha.call(e,r)&&Mo(t,r,e[r]);return t},m=(t,e)=>ja(t,Va(e)),Vo=t=>Re(t,"__esModule",{value:!0}),n=(t,e)=>Re(t,"name",{value:e,configurable:!0}),he=(t=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(t,{get:(e,r)=>(typeof require!="undefined"?require:e)[r]}):t)(function(t){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+t+'" is not supported')});var p=(t,e)=>()=>(t&&(e=t(t=0)),e);var X=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),E=(t,e)=>{Vo(t);for(var r in e)Re(t,r,{get:e[r],enumerable:!0})},za=(t,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of $a(e))!jo.call(t,o)&&o!=="default"&&Re(t,o,{get:()=>e[o],enumerable:!(r=Ma(e,o))||r.enumerable});return t},Ae=t=>za(Vo(Re(t!=null?La(Ba(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var Wo={};E(Wo,{default:()=>oc,offersLiveEditor:()=>kr});function Nr(t){let e=rc(zo),r=Go(t.source);e(t)&&t.data.ogType==="READY"&&Promise.resolve().then(()=>tc(Xa("//static.ordergroove.com/@ordergroove/offers-live-editor/0.4.0/dist/client.js"))).then(({initializeClient:o})=>{o(e,r),window.removeEventListener("message",Nr)})}function kr(t=window.opener){t&&t!==window&&(window.addEventListener("message",Nr),Go(t)("READY"))}var Ga,Ze,Wa,Ya,$o,Qa,Bo,Ja,Ho,Ka,Za,St,Xa,ec,tc,rc,zo,Go,oc,Yo=p(()=>{Ga=Object.create,Ze=Object.defineProperty,Wa=Object.getOwnPropertyDescriptor,Ya=Object.getOwnPropertyNames,$o=Object.getOwnPropertySymbols,Qa=Object.getPrototypeOf,Bo=Object.prototype.hasOwnProperty,Ja=Object.prototype.propertyIsEnumerable,Ho=n((t,e,r)=>e in t?Ze(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,"d"),Ka=n((t,e)=>{for(var r in e||(e={}))Bo.call(e,r)&&Ho(t,r,e[r]);if($o)for(var r of $o(e))Ja.call(e,r)&&Ho(t,r,e[r]);return t},"c"),Za=n(t=>Ze(t,"__esModule",{value:!0}),"E"),St=n((t,e)=>Ze(t,"name",{value:e,configurable:!0}),"r"),Xa=(t=>typeof he!="undefined"?he:typeof Proxy!="undefined"?new Proxy(t,{get:(e,r)=>(typeof he!="undefined"?he:e)[r]}):t)(function(t){if(typeof he!="undefined")return he.apply(this,arguments);throw new Error('Dynamic require of "'+t+'" is not supported')}),ec=n((t,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Ya(e))!Bo.call(t,o)&&o!=="default"&&Ze(t,o,{get:()=>e[o],enumerable:!(r=Wa(e,o))||r.enumerable});return t},"x"),tc=n(t=>ec(Za(Ze(t!=null?Ga(Qa(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t),"v"),rc=St(t=>e=>t.indexOf(e.origin)>=0,"createIsMessageAllowed"),zo=["https://rc3.ordergroove.com","https://rc3.stg.ordergroove.com","http://localhost:3000",window.location.origin],Go=St(t=>(e,r)=>{zo.forEach(o=>t.postMessage(Ka({ogType:e},r),o))},"createBroadcastMessage");n(Nr,"f");St(Nr,"handleReady");n(kr,"I");St(kr,"offersLiveEditor");oc=kr});function qr(t){var e,r=t.Symbol;return typeof r=="function"?r.observable?e=r.observable:(e=r("observable"),r.observable=e):e="@@observable",e}var Qo=p(()=>{n(qr,"symbolObservablePonyfill")});var Ne,nc,Ir,Jo=p(()=>{Qo();typeof self!="undefined"?Ne=self:typeof window!="undefined"||typeof window!="undefined"?Ne=window:typeof module!="undefined"?Ne=module:Ne=Function("return this")();nc=qr(Ne),Ir=nc});function sc(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}function Fr(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=="undefined"&&(r=e,e=void 0),typeof r!="undefined"){if(typeof r!="function")throw new Error("Expected the enhancer to be a function.");return r(Fr)(t,e)}if(typeof t!="function")throw new Error("Expected the reducer to be a function.");var s=t,i=e,a=[],c=a,u=!1;function h(){c===a&&(c=a.slice())}n(h,"ensureCanMutateNextListeners");function _(){if(u)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 i}n(_,"getState");function f(g){if(typeof g!="function")throw new Error("Expected the listener to be a function.");if(u)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 P=!0;return h(),c.push(g),n(function(){if(!!P){if(u)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.");P=!1,h();var S=c.indexOf(g);c.splice(S,1),a=null}},"unsubscribe")}n(f,"subscribe");function b(g){if(!sc(g))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(typeof g.type=="undefined")throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(u)throw new Error("Reducers may not dispatch actions.");try{u=!0,i=s(i,g)}finally{u=!1}for(var P=a=c,R=0;R<P.length;R++){var S=P[R];S()}return g}n(b,"dispatch");function w(g){if(typeof g!="function")throw new Error("Expected the nextReducer to be a function.");s=g,b({type:Xe.REPLACE})}n(w,"replaceReducer");function x(){var g,P=f;return g={subscribe:n(function(S){if(typeof S!="object"||S===null)throw new TypeError("Expected the observer to be an object.");function A(){S.next&&S.next(_())}n(A,"observeState"),A();var Da=P(A);return{unsubscribe:Da}},"subscribe")},g[Ir]=function(){return this},g}return n(x,"observable"),b({type:Xe.INIT}),o={dispatch:b,subscribe:f,getState:_,replaceReducer:w},o[Ir]=x,o}function ic(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.'}function ac(t){Object.keys(t).forEach(function(e){var r=t[e],o=r(void 0,{type:Xe.INIT});if(typeof o=="undefined")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:Xe.PROBE_UNKNOWN_ACTION()})=="undefined")throw new Error('Reducer "'+e+'" returned undefined when probed with a random type. '+("Don't try to handle "+Xe.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.")})}function Ko(t){for(var e=Object.keys(t),r={},o=0;o<e.length;o++){var s=e[o];typeof t[s]=="function"&&(r[s]=t[s])}var i=Object.keys(r),a,c;try{ac(r)}catch(u){c=u}return n(function(h,_){if(h===void 0&&(h={}),c)throw c;if(!1)var f;for(var b=!1,w={},x=0;x<i.length;x++){var g=i[x],P=r[g],R=h[g],S=P(R,_);if(typeof S=="undefined"){var A=ic(g,_);throw new Error(A)}w[g]=S,b=b||S!==R}return b=b||i.length!==Object.keys(h).length,b?w:h},"combination")}function Zo(t,e){return function(){return e(t.apply(this,arguments))}}function Xo(t,e){if(typeof t=="function")return Zo(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 s=t[o];typeof s=="function"&&(r[o]=Zo(s,e))}return r}function cc(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function en(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}function lc(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?en(r,!0).forEach(function(o){cc(t,o,r[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):en(r).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(r,o))})}return t}function Dr(){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,s){return function(){return o(s.apply(void 0,arguments))}})}function tn(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return function(o){return function(){var s=o.apply(void 0,arguments),i=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:s.getState,dispatch:n(function(){return i.apply(void 0,arguments)},"dispatch")},c=e.map(function(u){return u(a)});return i=Dr.apply(void 0,c)(s.dispatch),lc({},s,{dispatch:i})}}}var Ur,Xe,vt=p(()=>{Jo();Ur=n(function(){return Math.random().toString(36).substring(7).split("").join(".")},"randomString"),Xe={INIT:"@@redux/INIT"+Ur(),REPLACE:"@@redux/REPLACE"+Ur(),PROBE_UNKNOWN_ACTION:n(function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Ur()},"PROBE_UNKNOWN_ACTION")};n(sc,"isPlainObject");n(Fr,"createStore");n(ic,"getUndefinedStateErrorMessage");n(ac,"assertReducerShape");n(Ko,"combineReducers");n(Zo,"bindActionCreator");n(Xo,"bindActionCreators");n(cc,"_defineProperty");n(en,"ownKeys");n(lc,"_objectSpread2");n(Dr,"compose");n(tn,"applyMiddleware")});var on={};E(on,{connect:()=>y,createRecalcProps:()=>rn,default:()=>fc,resolveStore:()=>Lr,setStore:()=>pc,unsetStore:()=>dc});var et,uc,Lr,rn,y,pc,dc,fc,N=p(()=>{vt();et=null,uc=n(t=>({dispatch:t}),"defaultMapDispatchToProps"),Lr=n(t=>{if(!et)throw new Error("Missing redux store.");return et},"resolveStore"),rn=n((t,e)=>r=>{let{getState:o,dispatch:s}=Lr(r),i=t?t(o(),r):{},a=e(s,r);Object.assign(r,i,a)},"createRecalcProps"),y=n((t,e=uc)=>r=>{let s=rn(t,typeof e=="function"?e:i=>Xo(e,i));return class extends r{get store(){return et}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this._storeUnsubscribe=Lr(this).subscribe(()=>s(this)),s(this)}attributeChangedCallback(i,a,c){super.attributeChangedCallback&&super.attributeChangedCallback(i,a,c),this._storeUnsubscribe&&a!==c&&s(this)}disconnectedCallback(){this._storeUnsubscribe(),super.disconnectedCallback&&super.disconnectedCallback()}}},"connect"),pc=n(t=>{et=t},"setStore"),dc=n(()=>{et=void 0},"unsetStore"),fc=y});function nn(t){var e=n(function(o){var s=o.dispatch,i=o.getState;return function(a){return function(c){return typeof c=="function"?c(s,i,t):a(c)}}},"middleware");return e}var sn,an,cn=p(()=>{n(nn,"createThunkMiddleware");sn=nn();sn.withExtraArgument=nn;an=sn});var ee,te,re,wt,ln,D,tt,Ot,Tt,un,Ct,ke,pn,Pt,Rt,dn,At,Nt,kt,fn,hn,qt,mn,It,qe,gn,Ut,Ft,rt,ot,Dt,Lt,me,oe,jt,Mt,Ie=p(()=>{ee="OPTIN_PRODUCT",te="OPTOUT_PRODUCT",re="PRODUCT_CHANGE_FREQUENCY",wt="SET_MERCHANT_ID",ln="REQUEST_OFFER",D="RECEIVE_OFFER",tt="PRODUCT_HAS_CHANGED",Ot="CREATED_SESSION_ID",Tt="SET_AUTH_URL",un="REQUEST_AUTH",Ct="AUTHORIZE",ke="UNAUTHORIZED",pn="REQUEST_ORDERS",Pt="RECEIVE_ORDERS",Rt="RECEIVE_ORDER_ITEMS",dn="FETCH_RESPONSE_ERROR",At="SET_ENVIRONMENT_STAGING",Nt="SET_ENVIRONMENT_DEV",kt="SET_ENVIRONMENT_PROD",fn="CONCLUDE_UPSELL",hn="REQUEST_CREATE_IU_ORDER",qt="CREATE_ONE_TIME",mn="REQUEST_CONVERT_ONE_TIME",It="CONVERT_ONE_TIME",qe="CHECKOUT",gn="RECEIVE_FETCH",Ut="SET_LOCALE",Ft="SET_CONFIG",rt="SET_PREVIEW_STANDARD_OFFER",ot="SET_PREVIEW_UPSELL_OFFER",Dt="ADD_TEMPLATE",Lt="SET_TEMPLATES",me="LOCAL_STORAGE_CHANGE",oe="LOCAL_STORAGE_CLEAR",jt="SET_FIRST_ORDER_PLACE_DATE",Mt="SET_PRODUCT_TO_SUBSCRIBE"});function hc(t,e){return t===e}function mc(t,e,r){if(e===null||r===null||e.length!==r.length)return!1;for(var o=e.length,s=0;s<o;s++)if(!t(e[s],r[s]))return!1;return!0}function gc(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:hc,r=null,o=null;return function(){return mc(e,r,arguments)||(o=t.apply(null,arguments)),r=arguments,o}}function yc(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}function bc(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 s=arguments.length,i=Array(s),a=0;a<s;a++)i[a]=arguments[a];var c=0,u=i.pop(),h=yc(i),_=t.apply(void 0,[function(){return c++,u.apply(null,arguments)}].concat(r)),f=t(function(){for(var b=[],w=h.length,x=0;x<w;x++)b.push(h[x].apply(null,arguments));return _.apply(null,b)});return f.resultFunc=u,f.dependencies=h,f.recomputations=function(){return c},f.resetRecomputations=function(){return c=0},f}}var Ue,yn=p(()=>{n(hc,"defaultEqualityCheck");n(mc,"areArgumentsShallowlyEqual");n(gc,"defaultMemoize");n(yc,"getDependencies");n(bc,"createSelectorCreator");Ue=bc(gc)});var Bt=X((np,On)=>{var _c="Expected a function",bn="__lodash_hash_undefined__",Ec="[object Function]",xc="[object GeneratorFunction]",Sc=/[\\^$.*+?()[\]{}|]/g,vc=/^\[object .+?Constructor\]$/,wc=typeof window=="object"&&window&&window.Object===Object&&window,Oc=typeof self=="object"&&self&&self.Object===Object&&self,_n=wc||Oc||Function("return this")();function Tc(t,e){return t==null?void 0:t[e]}n(Tc,"getValue");function Cc(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch(r){}return e}n(Cc,"isHostObject");var Pc=Array.prototype,Rc=Function.prototype,En=Object.prototype,jr=_n["__core-js_shared__"],xn=function(){var t=/[^.]+$/.exec(jr&&jr.keys&&jr.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),Sn=Rc.toString,Mr=En.hasOwnProperty,Ac=En.toString,Nc=RegExp("^"+Sn.call(Mr).replace(Sc,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),kc=Pc.splice,qc=vn(_n,"Map"),nt=vn(Object,"create");function ge(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(ge,"Hash");function Ic(){this.__data__=nt?nt(null):{}}n(Ic,"hashClear");function Uc(t){return this.has(t)&&delete this.__data__[t]}n(Uc,"hashDelete");function Fc(t){var e=this.__data__;if(nt){var r=e[t];return r===bn?void 0:r}return Mr.call(e,t)?e[t]:void 0}n(Fc,"hashGet");function Dc(t){var e=this.__data__;return nt?e[t]!==void 0:Mr.call(e,t)}n(Dc,"hashHas");function Lc(t,e){var r=this.__data__;return r[t]=nt&&e===void 0?bn:e,this}n(Lc,"hashSet");ge.prototype.clear=Ic;ge.prototype.delete=Uc;ge.prototype.get=Fc;ge.prototype.has=Dc;ge.prototype.set=Lc;function Fe(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(Fe,"ListCache");function jc(){this.__data__=[]}n(jc,"listCacheClear");function Mc(t){var e=this.__data__,r=Vt(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():kc.call(e,r,1),!0}n(Mc,"listCacheDelete");function Vc(t){var e=this.__data__,r=Vt(e,t);return r<0?void 0:e[r][1]}n(Vc,"listCacheGet");function $c(t){return Vt(this.__data__,t)>-1}n($c,"listCacheHas");function Bc(t,e){var r=this.__data__,o=Vt(r,t);return o<0?r.push([t,e]):r[o][1]=e,this}n(Bc,"listCacheSet");Fe.prototype.clear=jc;Fe.prototype.delete=Mc;Fe.prototype.get=Vc;Fe.prototype.has=$c;Fe.prototype.set=Bc;function ye(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(ye,"MapCache");function Hc(){this.__data__={hash:new ge,map:new(qc||Fe),string:new ge}}n(Hc,"mapCacheClear");function zc(t){return $t(this,t).delete(t)}n(zc,"mapCacheDelete");function Gc(t){return $t(this,t).get(t)}n(Gc,"mapCacheGet");function Wc(t){return $t(this,t).has(t)}n(Wc,"mapCacheHas");function Yc(t,e){return $t(this,t).set(t,e),this}n(Yc,"mapCacheSet");ye.prototype.clear=Hc;ye.prototype.delete=zc;ye.prototype.get=Gc;ye.prototype.has=Wc;ye.prototype.set=Yc;function Vt(t,e){for(var r=t.length;r--;)if(Xc(t[r][0],e))return r;return-1}n(Vt,"assocIndexOf");function Qc(t){if(!wn(t)||Kc(t))return!1;var e=el(t)||Cc(t)?Nc:vc;return e.test(Zc(t))}n(Qc,"baseIsNative");function $t(t,e){var r=t.__data__;return Jc(e)?r[typeof e=="string"?"string":"hash"]:r.map}n($t,"getMapData");function vn(t,e){var r=Tc(t,e);return Qc(r)?r:void 0}n(vn,"getNative");function Jc(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}n(Jc,"isKeyable");function Kc(t){return!!xn&&xn in t}n(Kc,"isMasked");function Zc(t){if(t!=null){try{return Sn.call(t)}catch(e){}try{return t+""}catch(e){}}return""}n(Zc,"toSource");function Vr(t,e){if(typeof t!="function"||e&&typeof e!="function")throw new TypeError(_c);var r=n(function(){var o=arguments,s=e?e.apply(this,o):o[0],i=r.cache;if(i.has(s))return i.get(s);var a=t.apply(this,o);return r.cache=i.set(s,a),a},"memoized");return r.cache=new(Vr.Cache||ye),r}n(Vr,"memoize");Vr.Cache=ye;function Xc(t,e){return t===e||t!==t&&e!==e}n(Xc,"eq");function el(t){var e=wn(t)?Ac.call(t):"";return e==Ec||e==xc}n(el,"isFunction");function wn(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}n(wn,"isObject");On.exports=Vr});var qn={};E(qn,{api:()=>ne,compareFrequencies:()=>Nn,convertOneTimeToSubscription:()=>kn,createOneTime:()=>An,default:()=>rl,fetchItems:()=>Rn,fetchOffer:()=>Cn,fetchOrders:()=>Pn,isFrequencyValid:()=>zt,parseFrequenciesList:()=>zr,parseFrequency:()=>je,stringifyFrequencies:()=>tl,stringifyFrequency:()=>Me,toProductId:()=>Tn,toQuery:()=>Hr,withAuth:()=>st,withFetchJson:()=>De,withHost:()=>Le,withJsonBody:()=>Br});var Ht,$r,De,Le,st,Br,Hr,Tn,Cn,Pn,Rn,An,je,zt,Nn,zr,tl,Me,kn,ne,rl,se=p(()=>{Ht=Ae(Bt()),$r=n((...t)=>JSON.stringify(t),"memoizeKey"),De=n(t=>(...e)=>fetch(...t(...e)).then(r=>r.json()),"withFetchJson"),Le=n(t=>(e,...r)=>{if(!e)throw Error("host required");let[o,s={}]=t(...r);return[`${e.replace(/\/+$/,"")}${o}`,s]},"withHost"),st=n(t=>(e,...r)=>{if(!e)throw Error("auth required");let[o,s={}]=t(...r);return[o,m(l({},s),{headers:l({Authorization:JSON.stringify(e)},s.headers)})]},"withAuth"),Br=n(t=>(...e)=>{let[r,o={}]=t(...e);return[r,m(l({method:"POST"},o),{body:JSON.stringify(o.body),headers:l({"Content-type":"application/json"},o.headers)})]},"withJsonBody"),Hr=n((t=[])=>(Array.isArray(t)?t:Object.entries(t)).map(([e,r])=>[e,encodeURIComponent(r)].join("=")).join("&"),"toQuery"),Tn=n(t=>JSON.stringify([].concat(t).map(e=>typeof e=="object"?e.id:e).filter(e=>e)),"toProductId"),Cn=(0,Ht.default)(De(Le((t,e,r,o="pdp")=>{if(!t)throw Error("merchantId required");if(!e)throw Error("sessionId required");if(!r)throw Error("product required");let s=Hr([["session_id",e],["page_type",1],["p",Tn(r)],["module_view",JSON.stringify(["regular"])]]);return[`/offer/${t}/${o}?${s}`]})),$r),Pn=(0,Ht.default)(De(Le(st((t=1,e="place")=>[`/orders/?${Hr([["status",t],["ordering",e]])}`]))),$r),Rn=(0,Ht.default)(De(Le(st(t=>{if(!t)throw Error("orderId required");return[`/items/?order=${t}`]}))),$r),An=De(Le(st(Br((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}}]})))),je=n(t=>{if(typeof t=="object")return l({},t);let[e,r]=(t||"").split(/_/).map(o=>parseInt(o,10));return e&&r&&{every:e,every_period:r}},"parseFrequency"),zt=n(t=>t.match(/^\d+_\d$/),"isFrequencyValid"),Nn=n((t,e)=>String.prototype.localeCompare.call(t&&t.split("_").reverse().join("_"),e&&e.split("_").reverse().join("_")),"compareFrequencies"),zr=n(t=>[...new Set(t&&t.split(/\s+/))].filter(zt).sort(Nn),"parseFrequenciesList"),tl=n(t=>t==null?t:t.join(" "),"stringifyFrequencies"),Me=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"),kn=De(Le(st(Br((t,e,r)=>{if(!t)throw Error("item required");if(!e)throw Error("frequency required");let o=je(e);if(!o)throw Error("invalid frequency");return["/subscriptions/create_from_item/",{body:l({item:t.public_id,offer:r},o)}]})))),ne={fetchOffer:Cn,fetchOrders:Pn,fetchItems:Rn,createOneTime:An,convertOneTimeToSubscription:kn},rl=ne});function ol(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}var be,q,Gt,In,Gr,nl,W,Un,Fn,ie,Wt,Wr,Y,Ve,Q=p(()=>{yn();be=Ae(Bt());se();be.default.Cache=Map;n(ol,"arraysEqual");q=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))||ol((t.components||[]).sort(),(e.components||[]).sort()))),"isSameProduct"),Gt=n(t=>t.optedin||[],"optedinSelector"),In=n(t=>t.optedout||[],"optedoutSelector"),Gr=n(t=>t.autoshipByDefault||{},"autoshipSelector"),nl=n(t=>t.defaultFrequencies||{},"defaultFrequenciesSelector"),W=(0,be.default)(t=>Ue(Gt,In,Gr,(e,r,o)=>{let s=e.find(i=>q(t,i));return s||(r.find(i=>q(t,i))?!1:t&&o[t.id]?{id:t.id}:!1)}),t=>JSON.stringify(t)),Un=(0,be.default)(t=>Ue(Gt,e=>{let r=e.find(o=>q(t,o));return r||!1}),t=>JSON.stringify(t)),Fn=(0,be.default)(t=>Ue(In,e=>e.find(r=>q(t,r)))),ie=(0,be.default)(t=>Ue(W(t),e=>e&&e.frequency||null)),Wt=(0,be.default)(t=>Ue(nl,e=>e[t]&&Me(e[t])||null)),Wr=n(t=>t.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase(),"kebabCase"),Y=n((t,e,r,o)=>({[r]:e&&e.hasAttribute&&e.hasAttribute(Wr(r))&&e[r]||e.offer&&typeof(e.offer[r]!=="undefined")&&e.offer[r]||t.config&&t.config[r]||o}),"configSelector"),Ve=n(t=>({templates:t.templates||[]}),"templatesSelector")});var cs={};E(cs,{auth:()=>zn,authUrl:()=>Wn,autoshipByDefault:()=>ss,autoshipEligible:()=>Mn,config:()=>rs,default:()=>Yr,defaultFrequencies:()=>is,eligibilityGroups:()=>$n,environment:()=>es,firstOrderPlaceDate:()=>Zn,frequency:()=>sl,inStock:()=>Vn,incentives:()=>Hn,locale:()=>ts,merchantId:()=>Gn,nextUpcomingOrder:()=>jn,offer:()=>Yn,offerId:()=>Qn,optedin:()=>Dn,optedout:()=>Ln,previewStandardOffer:()=>os,previewUpsellOffer:()=>ns,productOffer:()=>Kn,productToSubscribe:()=>Xn,sessionId:()=>Jn,templates:()=>as});var Dn,Ln,jn,Mn,Vn,$n,Bn,Hn,sl,zn,Gn,Wn,Yn,Qn,Jn,Kn,Zn,Xn,es,ts,rs,os,ns,ss,is,as,Yr,Qr=p(()=>{vt();Ie();Q();se();Dn=n((t=[],e)=>{switch(e.type){case oe:return[];case me:return e.newValue?e.newValue.optedin:t;case ee:case re:let[[r],o]=t.reduce((s,i)=>s[q(e.payload.product,i)?0:1].push(i)&&s,[[],[]]);return(o||[]).concat(m(l(l({},r),e.payload.product),{frequency:e.payload.frequency}));case te:return t.filter(s=>!q(e.payload.product,s));case tt:return t.map(s=>q(e.payload.product,s)?l(l({},s),e.payload.newProduct):s);case It:return t.filter(s=>!q(e.payload.product,s));case qe:return[];default:return t}},"optedin"),Ln=n((t=[],e)=>{switch(e.type){case oe:return[];case me:return e.newValue?e.newValue.optedout:t;case ee:case re:return t.filter(s=>!q(e.payload.product,s));case te:let[[r],o]=t.reduce((s,i)=>s[q(e.payload.product,i)?0:1].push(i)&&s,[[],[]]);return(o||[]).concat(m(l(l({},r),e.payload.product),{frequency:e.payload.frequency}));case tt:return t.map(s=>q(e.payload.product,s)?l(l({},s),e.payload.newProduct):s);case qe:return[];default:return t}},"optedout"),jn=n((t={},{type:e,payload:r})=>{switch(e){case Pt:return r&&r.count>0?l(l({},t),r.results[0]&&m(l({},r.results[0]),{place:new Date(Date.parse(r.results[0].place.replace(/-/gi,"/")))})):t;case Rt:return m(l({},t),{products:(r.results||[]).map(o=>o.product)});case qt:return l(m(l(l({},t),r),{public_id:r.order}),r.product&&{products:(t.products||[]).concat(r.product)});default:return t}},"nextUpcomingOrder"),Mn=n((t={},e)=>{switch(e.type){case D:return l(l({},t),e.payload.autoship);default:return t}},"autoshipEligible"),Vn=n((t={},e)=>{switch(e.type){case D:return l(l({},t),e.payload.in_stock);default:return t}},"inStock"),$n=n((t={},e)=>{switch(e.type){case D:return l(l({},t),e.payload.eligibility_groups);default:return t}},"eligibilityGroups"),Bn=n((t,e)=>t.map(r=>m(l({},e[r]),{id:[r][0]})),"mapIncentive"),Hn=n((t={},e)=>{switch(e.type){case D:return l(l({},t),[...new Set(Object.keys(e.payload.incentives||{}))].reduce((r,o)=>m(l({},r),{[o]:Object.entries(e.payload.incentives).filter(([s])=>s===o).reduce((s,[,{initial:i,ongoing:a}])=>m(l({},s),{initial:[...s.initial||[],...Bn(i,e.payload.incentives_display)],ongoing:[...s.ongoing||[],...Bn(a,e.payload.incentives_display)]}),{})}),{}));default:return t}},"incentives"),sl=n((t={},e)=>{switch(e.type){case ee:case re:return m(l({},t),{[e.payload.product]:e.payload.frequency});case te:return m(l({},t),{[e.payload.product]:void 0});default:return t}},"frequency"),zn=n((t=!1,e)=>{switch(e.type){case Ct:return l({},e.payload);case ke:return!1;default:return t}},"auth"),Gn=n((t="",e)=>{switch(e.type){case wt:return e.payload;default:return t}},"merchantId"),Wn=n((t=null,e)=>{switch(e.type){case Tt:return e.payload;default:return t}},"authUrl"),Yn=n((t={},e)=>{switch(e.type){case D:return l(m(l({},t),{offerId:(e.payload.module_view||{}).regular}),e.payload.modifiers);default:return t}},"offer"),Qn=n((t="",e)=>{switch(e.type){case D:return(e.payload.module_view||{}).regular||"";default:return t}},"offerId"),Jn=n((t=null,e)=>{switch(e.type){case oe:return null;case Ot:return e.payload;default:return t}},"sessionId"),Kn=n((t={},e)=>{switch(e.type){case D:return l(l({},t),Object.entries(e.payload.autoship).map(([r])=>({[r]:Object.keys(e.payload.modifiers)})).reduce((r,o)=>l(l({},r),o)));case qe:return{};default:return t}},"productOffer"),Zn=n((t={},e)=>{switch(e.type){case jt:return m(l({},t),{[e.payload.product]:e.payload.firstOrderPlaceDate});default:return t}},"firstOrderPlaceDate"),Xn=n((t={},e)=>{switch(e.type){case Mt:return m(l({},t),{[e.payload.product]:e.payload.productToSubscribe});default:return t}},"productToSubscribe"),es=n((t={},e)=>{switch(e.type){case At:return m(l({},t),{name:"staging",apiUrl:"https://staging.om.ordergroove.com",legoUrl:"https://staging.restapi.ordergroove.com"});case Nt:return m(l({},t),{name:"dev",apiUrl:"https://dev.om.ordergroove.com",legoUrl:"https://dev.restapi.ordergroove.com"});case kt:return m(l({},t),{name:"prod",apiUrl:"https://om.ordergroove.com",legoUrl:"https://restapi.ordergroove.com"});default:return t}},"environment"),ts=n((t={offerOptInLabel:"Subscribe",offerOptOutLabel:"Purchase one time",offerEveryLabel:"Every",offerTooltipTrigger:"Hover for additional info",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:"(Recommended)",frequencyPeriods:{"1":"day","2":"week","3":"month"}},e)=>{switch(e.type){case Ut:return l(l({},t),e.payload);default:return t}},"locale"),rs=n((t={frequencies:["1_2","1_2","1_3"],offerType:"radio"},e)=>{switch(e.type){case Ft:return m(l(l({},t),e.payload),{defaultFrequency:e.payload.defaultFrequency?Me(e.payload.defaultFrequency):t.defaultFrequency,frequencies:e.payload.frequencies?e.payload.frequencies.map(Me):t.frequencies});default:return t}},"config"),os=n((t=!1,e)=>{switch(e.type){case rt:return e.payload;default:return t}},"previewStandardOffer"),ns=n((t=!1,e)=>{switch(e.type){case ot:return e.payload;default:return t}},"previewUpsellOffer"),ss=n((t=[],e)=>{switch(e.type){case D:return l(l({},t),e.payload.autoship_by_default);default:return t}},"autoshipByDefault"),is=n((t=[],e)=>{switch(e.type){case D:return l(l({},t),e.payload.default_frequencies);default:return t}},"defaultFrequencies"),as=n((t=[],e)=>{switch(e.type){case Lt:return[...e.payload||[]];case Dt:return[e.payload,...t];default:return t}},"templates"),Yr=Ko({environment:es,optedin:Dn,optedout:Ln,merchantId:Gn,offer:Yn,offerId:Qn,productOffer:Kn,sessionId:Jn,inStock:Vn,eligibilityGroups:$n,autoshipByDefault:ss,autoshipEligible:Mn,incentives:Hn,nextUpcomingOrder:jn,auth:zn,authUrl:Wn,locale:ts,config:rs,previewStandardOffer:os,previewUpsellOffer:ns,templates:as,defaultFrequencies:is,firstOrderPlaceDate:Zn,productToSubscribe:Xn})});var Jr=X((Yt,ls)=>{(function(t,e){typeof Yt=="object"&&typeof ls!="undefined"?e(Yt):typeof define=="function"&&define.amd?define(["exports"],e):(t=t||self,e(t.throttleDebounce={}))})(Yt,function(t){"use strict";function e(o,s,i,a){var c,u=!1,h=0;function _(){c&&clearTimeout(c)}n(_,"clearExistingTimeout");function f(){_(),u=!0}n(f,"cancel"),typeof s!="boolean"&&(a=i,i=s,s=void 0);function b(){for(var w=arguments.length,x=new Array(w),g=0;g<w;g++)x[g]=arguments[g];var P=this,R=Date.now()-h;if(u)return;function S(){h=Date.now(),i.apply(P,x)}n(S,"exec");function A(){c=void 0}n(A,"clear"),a&&!c&&S(),_(),a===void 0&&R>o?S():s!==!0&&(c=setTimeout(a?A:S,a===void 0?o-R:o))}return n(b,"wrapper"),b.cancel=f,b}n(e,"throttle");function r(o,s,i){return i===void 0?e(o,s,!1):e(o,i,s!==!1)}n(r,"debounce"),t.debounce=r,t.throttle=e,Object.defineProperty(t,"__esModule",{value:!0})})});var us,il,al,cl,ll,ps,ds=p(()=>{us=/^og_auth=/,il=n((t=us)=>(document.cookie.split(/;\s*/).find(e=>e.match(t))||"").replace(us,""),"s"),al=n(t=>{if(typeof t=="object")return t;let e=(t||"").split("|");return e.length===3?{sig_field:e[0],ts:parseInt(e[1],10),sig:e[2]}:null},"i"),cl=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"),ll=n(t=>(t.headers.get("content-type")||"").indexOf("application/json")!==-1,"c"),ps=n((t,e=il,r=cl)=>Promise.resolve(e()||t&&typeof t=="string"&&fetch(t).then(o=>o.status>=200&&o.status<300?e()||(ll(o)?o.json():Promise.resolve(r(t)).then(e)):null)).then(al).then(o=>o===null?Promise.reject(new Error("Unauthorized")):o),"l")});var xs={};E(xs,{addTemplate:()=>yl,authorize:()=>Qt,checkout:()=>hl,concludeUpsell:()=>Zr,createIu:()=>to,createSessionId:()=>fs,fetchAuth:()=>dl,fetchDone:()=>at,fetchOffer:()=>eo,fetchOrders:()=>ct,fetchResponseError:()=>Zt,optinProduct:()=>J,optoutProduct:()=>_e,productChangeFrequency:()=>it,productHasChangedComponents:()=>Kr,receiveConvertOneTime:()=>Es,receiveCreateOneTime:()=>bs,receiveItems:()=>Kt,receiveOffer:()=>Ee,receiveOrders:()=>Jt,requestAuth:()=>hs,requestConvertOneTimeToSubscription:()=>_s,requestCreateOneTime:()=>ys,requestOffer:()=>gs,requestOrders:()=>ms,requestSessionId:()=>Xr,setAuthUrl:()=>pl,setConfig:()=>gl,setEnvironment:()=>fl,setFirstOrderPlaceDate:()=>ro,setLocale:()=>ml,setMerchantId:()=>ul,setProductToSubscribe:()=>oo,setTemplates:()=>bl,unauthorized:()=>ae});var J,_e,Kr,it,Zr,ul,fs,hs,Qt,ae,pl,at,dl,ms,Jt,Kt,ct,fl,Xr,Ee,Zt,gs,eo,hl,ys,bs,_s,Es,to,ml,gl,yl,bl,ro,oo,I=p(()=>{ds();Ie();se();J=n((t,e)=>({type:ee,payload:{product:t,frequency:e}}),"optinProduct"),_e=n(t=>({type:te,payload:{product:t}}),"optoutProduct"),Kr=n((t,e)=>({type:tt,payload:{newProduct:t,product:e}}),"productHasChangedComponents"),it=n((t,e)=>({type:re,payload:{product:t,frequency:e}}),"productChangeFrequency"),Zr=n(t=>({type:fn,payload:{product:t}}),"concludeUpsell"),ul=n(t=>({type:wt,payload:t}),"setMerchantId"),fs=n(t=>({type:Ot,payload:`${t}.${Math.floor(Math.random()*999999)}.${Math.round(new Date().getTime()/1e3)}`}),"createSessionId"),hs=n(t=>({type:un,payload:t}),"requestAuth"),Qt=n((t,e,r,o)=>({type:Ct,payload:{public_id:t,sig_field:e,ts:r,sig:o}}),"authorize"),ae=n(t=>({type:ke,payload:t}),"unauthorized"),pl=n(t=>({type:Tt,payload:t}),"setAuthUrl"),at=n(t=>({type:gn,payload:t}),"fetchDone"),dl=n((t=ps)=>n(function(r,o){if(window.og&&window.og.previewMode)return r(ae({message:"Offers are running in preview mode"}));let{merchantId:s,authUrl:i}=o(),a=hs(i);return r(a),t(i).then(({sig_field:c,ts:u,sig:h})=>r(Qt(s,c,u,h)),c=>r(ae(c))).finally(()=>r(at(a)))},"fetchAuthThunk"),"fetchAuth"),ms=n((t,e)=>({type:pn,payload:{status:t,ordering:e}}),"requestOrders"),Jt=n(t=>({type:Pt,payload:t}),"receiveOrders"),Kt=n(t=>({type:Rt,payload:t}),"receiveItems"),ct=n((t=1,e="place")=>n(function(o,s){let{environment:{legoUrl:i},auth:a}=s();if(!a)return o(ae("No auth set."));let c=ms(t,e);return o(c),ne.fetchOrders(i,a,t,e).then(u=>{o(Jt(u));let h=(u.results[0]||{}).public_id;return h?ne.fetchItems(i,a,h).then(_=>o(Kt(_))):null},u=>o(ae(u))).finally(()=>o(at(c)))},"fetchOrdersThunk"),"fetchOrders"),fl=n(t=>{switch(t){case"dev":return{type:Nt,payload:t};case"staging":return{type:At,payload:t};case"prod":return{type:kt,payload:t};default:throw new Error(`${t} is not a supported environment`)}},"setEnvironment"),Xr=n(()=>(t,e)=>{let{merchantId:r,sessionId:o}=e();return(!o||r&&!o.startsWith(r))&&t(fs(r)),o},"requestSessionId"),Ee=n(t=>({type:D,payload:t}),"receiveOffer"),Zt=n(t=>({type:dn,payload:t}),"fetchResponseError"),gs=n((t,e="pdp")=>({type:ln,payload:{product:t,module:e}}),"requestOffer"),eo=n((t,e="pdp")=>n(function(o,s){let{merchantId:i,sessionId:a,environment:{apiUrl:c}}=s(),u=gs(t,e);return o(u),ne.fetchOffer(c,i,a,t,e).then(h=>o(Ee(h)),h=>o(Zt(h))).finally(()=>o(at(u)))},"fetchOfferThunk"),"fetchOffer"),hl=n(()=>({type:qe}),"checkout"),ys=n((t,e,r,o)=>({type:hn,payload:{product:t,order:e,quantity:r,offerId:o}}),"requestCreateOneTime"),bs=n(t=>({type:qt,payload:t}),"receiveCreateOneTime"),_s=n((t,e)=>({type:mn,payload:{item:t,frequency:e}}),"requestConvertOneTimeToSubscription"),Es=n((t,e)=>({type:It,payload:{response:t,product:e}}),"receiveConvertOneTime"),to=n((t,e,r,o=!1,s=null)=>n(function(a,c){let{auth:u,environment:{legoUrl:h},previewUpsellOffer:_,offerId:f}=c();if(!u)return a(ae("No auth set."));let b=ys(t,e,r,f);return a(b),(_?Promise.resolve({legoUrl:h,product:t,order:e,quantity:r,offer:f}):ne.createOneTime(h,u,t.id,e,r,f)).then(w=>(a(bs(w)),o?(a(_s(w,s)),(_?Promise.resolve({item:w,frequency:s}):ne.convertOneTimeToSubscription(h,u,w,s,f)).then(x=>a(Es(x,t)),x=>a(Zt(x)))):w),w=>a(Zt(w))).finally(()=>a(at(b)))},"createIuThunk"),"createIu"),ml=n(t=>({type:Ut,payload:t}),"setLocale"),gl=n(t=>({type:Ft,payload:t}),"setConfig"),yl=n((t,e,r)=>({type:Dt,payload:{selector:t,markup:e,config:r}}),"addTemplate"),bl=n(t=>({type:Lt,payload:t}),"setTemplates"),ro=n((t,e)=>({type:jt,payload:{product:t,firstOrderPlaceDate:e}}),"setFirstOrderPlaceDate"),oo=n((t,e)=>({type:Mt,payload:{product:t,productToSubscribe:e}}),"setProductToSubscribe")});var ws={};E(ws,{STORE_ROOT:()=>xe,clearState:()=>El,listenLocalStorageChanges:()=>_l,loadState:()=>io,safeParseState:()=>no,saveState:()=>ao,serializeState:()=>vs});var Ss,xe,no,so,io,vs,ao,_l,El,Xt=p(()=>{Ss=Ae(Jr());I();Ie();xe="OG_STATE",no=n(t=>{try{return t===null?void 0:JSON.parse(t)}catch(e){return}},"safeParseState"),so=n(()=>window.og&&window.og.previewMode,"isPreviewMode"),io=n(()=>so()?{}:no(localStorage.getItem(xe)),"loadState"),vs=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"),ao=n(t=>{if(so())return;let e=vs(t);e&&localStorage.getItem(xe)!==e&&localStorage.setItem(xe,e)},"saveState"),_l=n(t=>(0,Ss.throttle)(500,e=>{if(so())return;let{key:r,newValue:o}=e;r===xe&&o===null?(t.dispatch({type:oe}),setTimeout(()=>t.dispatch(Xr()),0)):r===xe&&t.dispatch({type:me,newValue:no(o)})}),"listenLocalStorageChanges"),El=n(()=>localStorage.removeItem(xe),"clearState")});var Os,xl,Ts,Sl,Cs,Ps,Rs=p(()=>{Os=Ae(Jr());Ie();Q();Xt();xl=n((t,e,r=document)=>r.dispatchEvent(new CustomEvent(t,{detail:e})),"dispatchEvent"),Ts=n(t=>({payload:{product:{id:e,components:r}={}}={}}={})=>setTimeout(()=>xl("optin-changed",{productId:e,components:r,optedIn:t}),0),"dispatchOptinChangedEvent"),Sl=[{expressions:[({type:t}={})=>t===ee,({type:t}={})=>t===re],fn:Ts(!0)},{expressions:[({type:t}={})=>t===te],fn:Ts(!1)}],Cs=n(t=>e=>r=>{let o=t.getState();Sl.forEach(s=>{s.expressions.some(i=>i(r,o))&&s.fn(r)}),e(r)},"dispatchMiddleware"),Ps=n(t=>e=>r=>{e(r);let o=(0,Os.throttle)(500,()=>{ao(l({},t.getState()))});r.type!==me&&o()},"localStorageMiddleware")});var Ns={};E(Ns,{default:()=>vl,getStore:()=>As});function As(){if(window.og&&window.og.store)return window.og.store;let t=window.og&&window.og.previewMode,e=typeof window=="object"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({}):Dr,r=[an,Cs];t||r.push(Ps);let o=e(tn(...r)),s=Fr(Yr,t?{}:io(),o);return window.og=window.og||{},window.og.store=s,s}var vl,ks=p(()=>{vt();cn();Qr();Xt();Rs();n(As,"getStore");vl=As});var Is={};E(Is,{default:()=>wl,getProductsForPurchasePost:()=>qs});var qs,wl,Us=p(()=>{se();qs=n((t={},e=[])=>(t.optedin||[]).map(r=>{let o={product:r.id,subscription_info:{components:r.components||[]},tracking_override:l({offer:((t.productOffer||{})[r.id]||[])[0]},je(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"),wl={getProductsForPurchasePost:qs}});var co,Se,ve=p(()=>{co=typeof window!="undefined"&&window.customElements!=null&&window.customElements.polyfillWrapFlushCallback!==void 0,Se=n((t,e,r=null)=>{for(;e!==r;){let o=e.nextSibling;t.removeChild(e),e=o}},"removeNodes")});var L,lo,Fs,$e,we,Ds,lt,H,er,ce=p(()=>{L=`{{lit-${String(Math.random()).slice(2)}}}`,lo=`<!--${L}-->`,Fs=new RegExp(`${L}|${lo}`),$e="$lit$",we=class{constructor(e,r){this.parts=[],this.element=r;let o=[],s=[],i=document.createTreeWalker(r.content,133,null,!1),a=0,c=-1,u=0,{strings:h,values:{length:_}}=e;for(;u<_;){let f=i.nextNode();if(f===null){i.currentNode=s.pop();continue}if(c++,f.nodeType===1){if(f.hasAttributes()){let b=f.attributes,{length:w}=b,x=0;for(let g=0;g<w;g++)Ds(b[g].name,$e)&&x++;for(;x-- >0;){let g=h[u],P=er.exec(g)[2],R=P.toLowerCase()+$e,S=f.getAttribute(R);f.removeAttribute(R);let A=S.split(Fs);this.parts.push({type:"attribute",index:c,name:P,strings:A}),u+=A.length-1}}f.tagName==="TEMPLATE"&&(s.push(f),i.currentNode=f.content)}else if(f.nodeType===3){let b=f.data;if(b.indexOf(L)>=0){let w=f.parentNode,x=b.split(Fs),g=x.length-1;for(let P=0;P<g;P++){let R,S=x[P];if(S==="")R=H();else{let A=er.exec(S);A!==null&&Ds(A[2],$e)&&(S=S.slice(0,A.index)+A[1]+A[2].slice(0,-$e.length)+A[3]),R=document.createTextNode(S)}w.insertBefore(R,f),this.parts.push({type:"node",index:++c})}x[g]===""?(w.insertBefore(H(),f),o.push(f)):f.data=x[g],u+=g}}else if(f.nodeType===8)if(f.data===L){let b=f.parentNode;(f.previousSibling===null||c===a)&&(c++,b.insertBefore(H(),f)),a=c,this.parts.push({type:"node",index:c}),f.nextSibling===null?f.data="":(o.push(f),c--),u++}else{let b=-1;for(;(b=f.data.indexOf(L,b+1))!==-1;)this.parts.push({type:"node",index:-1}),u++}}for(let f of o)f.parentNode.removeChild(f)}};n(we,"Template");Ds=n((t,e)=>{let r=t.length-e.length;return r>=0&&t.slice(r)===e},"endsWith"),lt=n(t=>t.index!==-1,"isTemplatePartActive"),H=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"'`<>=]*|"[^"]*|'[^']*))$/});function po(t,e){let{element:{content:r},parts:o}=t,s=document.createTreeWalker(r,uo,null,!1),i=ut(o),a=o[i],c=-1,u=0,h=[],_=null;for(;s.nextNode();){c++;let f=s.currentNode;for(f.previousSibling===_&&(_=null),e.has(f)&&(h.push(f),_===null&&(_=f)),_!==null&&u++;a!==void 0&&a.index===c;)a.index=_!==null?-1:a.index-u,i=ut(o,i),a=o[i]}h.forEach(f=>f.parentNode.removeChild(f))}function Ls(t,e,r=null){let{element:{content:o},parts:s}=t;if(r==null){o.appendChild(e);return}let i=document.createTreeWalker(o,uo,null,!1),a=ut(s),c=0,u=-1;for(;i.nextNode();)for(u++,i.currentNode===r&&(c=Ol(e),r.parentNode.insertBefore(e,r));a!==-1&&s[a].index===u;){if(c>0){for(;a!==-1;)s[a].index+=c,a=ut(s,a);return}a=ut(s,a)}}var uo,Ol,ut,js=p(()=>{ce();uo=133;n(po,"removeNodesFromTemplate");Ol=n(t=>{let e=t.nodeType===11?0:1,r=document.createTreeWalker(t,uo,null,!1);for(;r.nextNode();)e++;return e},"countNodes"),ut=n((t,e=-1)=>{for(let r=e+1;r<t.length;r++){let o=t[r];if(lt(o))return r}return-1},"nextActiveIndexInTemplateParts");n(Ls,"insertNodeIntoTemplate")});var Tl,Oe,fo=p(()=>{Tl=new WeakMap,Oe=n(t=>typeof t=="function"&&Tl.has(t),"isDirective")});var U,tr,ho=p(()=>{U={},tr={}});var le,rr=p(()=>{ve();ce();le=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,s=document.createTreeWalker(e,133,null,!1),i=0,a=0,c,u=s.nextNode();for(;i<o.length;){if(c=o[i],!lt(c)){this.__parts.push(void 0),i++;continue}for(;a<c.index;)a++,u.nodeName==="TEMPLATE"&&(r.push(u),s.currentNode=u.content),(u=s.nextNode())===null&&(s.currentNode=r.pop(),u=s.nextNode());if(c.type==="node"){let h=this.processor.handleTextExpression(this.options);h.insertAfterNode(u.previousSibling),this.__parts.push(h)}else this.__parts.push(...this.processor.handleAttributeExpressions(u,c.name,c.strings,this.options));i++}return co&&(document.adoptNode(e),customElements.upgrade(e)),e}};n(le,"TemplateInstance")});var Ms,Pl,K,or=p(()=>{ve();ce();Ms=window.trustedTypes&&trustedTypes.createPolicy("lit-html",{createHTML:t=>t}),Pl=` ${L} `,K=class{constructor(e,r,o,s){this.strings=e,this.values=r,this.type=o,this.processor=s}getHTML(){let e=this.strings.length-1,r="",o=!1;for(let s=0;s<e;s++){let i=this.strings[s],a=i.lastIndexOf("<!--");o=(a>-1||o)&&i.indexOf("-->",a+1)===-1;let c=er.exec(i);c===null?r+=i+(o?Pl:lo):r+=i.substr(0,c.index)+c[1]+c[2]+$e+c[3]+L}return r+=this.strings[e],r}getTemplateElement(){let e=document.createElement("template"),r=this.getHTML();return Ms!==void 0&&(r=Ms.createHTML(r)),e.innerHTML=r,e}};n(K,"TemplateResult")});var nr,sr,Be,pt,Z,dt,ft,ir,Vs,ht,Rl,ar=p(()=>{fo();ve();ho();rr();or();ce();nr=n(t=>t===null||!(typeof t=="object"||typeof t=="function"),"isPrimitive"),sr=n(t=>Array.isArray(t)||!!(t&&t[Symbol.iterator]),"isIterable"),Be=class{constructor(e,r,o){this.dirty=!0,this.element=e,this.name=r,this.strings=o,this.parts=[];for(let s=0;s<o.length-1;s++)this.parts[s]=this._createPart()}_createPart(){return new pt(this)}_getValue(){let e=this.strings,r=e.length-1,o=this.parts;if(r===1&&e[0]===""&&e[1]===""){let i=o[0].value;if(typeof i=="symbol")return String(i);if(typeof i=="string"||!sr(i))return i}let s="";for(let i=0;i<r;i++){s+=e[i];let a=o[i];if(a!==void 0){let c=a.value;if(nr(c)||!sr(c))s+=typeof c=="string"?c:String(c);else for(let u of c)s+=typeof u=="string"?u:String(u)}}return s+=e[r],s}commit(){this.dirty&&(this.dirty=!1,this.element.setAttribute(this.name,this._getValue()))}};n(Be,"AttributeCommitter");pt=class{constructor(e){this.value=void 0,this.committer=e}setValue(e){e!==U&&(!nr(e)||e!==this.value)&&(this.value=e,Oe(e)||(this.committer.dirty=!0))}commit(){for(;Oe(this.value);){let e=this.value;this.value=U,e(this)}this.value!==U&&this.committer.commit()}};n(pt,"AttributePart");Z=class{constructor(e){this.value=void 0,this.__pendingValue=void 0,this.options=e}appendInto(e){this.startNode=e.appendChild(H()),this.endNode=e.appendChild(H())}insertAfterNode(e){this.startNode=e,this.endNode=e.nextSibling}appendIntoPart(e){e.__insert(this.startNode=H()),e.__insert(this.endNode=H())}insertAfterPart(e){e.__insert(this.startNode=H()),this.endNode=e.endNode,e.endNode=this.startNode}setValue(e){this.__pendingValue=e}commit(){if(this.startNode.parentNode===null)return;for(;Oe(this.__pendingValue);){let r=this.__pendingValue;this.__pendingValue=U,r(this)}let e=this.__pendingValue;e!==U&&(nr(e)?e!==this.value&&this.__commitText(e):e instanceof K?this.__commitTemplateResult(e):e instanceof Node?this.__commitNode(e):sr(e)?this.__commitIterable(e):e===tr?(this.value=tr,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==null?"":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 le&&this.value.template===r)this.value.update(e.values);else{let o=new le(r,e.processor,this.options),s=o._clone();o.update(e.values),this.__commitNode(s),this.value=o}}__commitIterable(e){Array.isArray(this.value)||(this.value=[],this.clear());let r=this.value,o=0,s;for(let i of e)s=r[o],s===void 0&&(s=new Z(this.options),r.push(s),o===0?s.appendIntoPart(this):s.insertAfterPart(r[o-1])),s.setValue(i),s.commit(),o++;o<r.length&&(r.length=o,this.clear(s&&s.endNode))}clear(e=this.startNode){Se(this.startNode.parentNode,e.nextSibling,this.endNode)}};n(Z,"NodePart");dt=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(;Oe(this.__pendingValue);){let r=this.__pendingValue;this.__pendingValue=U,r(this)}if(this.__pendingValue===U)return;let e=!!this.__pendingValue;this.value!==e&&(e?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=e),this.__pendingValue=U}};n(dt,"BooleanAttributePart");ft=class extends Be{constructor(e,r,o){super(e,r,o);this.single=o.length===2&&o[0]===""&&o[1]===""}_createPart(){return new ir(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}};n(ft,"PropertyCommitter");ir=class extends pt{};n(ir,"PropertyPart");Vs=!1;(()=>{try{let t={get capture(){return Vs=!0,!1}};window.addEventListener("test",t,t),window.removeEventListener("test",t,t)}catch(t){}})();ht=class{constructor(e,r,o){this.value=void 0,this.__pendingValue=void 0,this.element=e,this.eventName=r,this.eventContext=o,this.__boundHandleEvent=s=>this.handleEvent(s)}setValue(e){this.__pendingValue=e}commit(){for(;Oe(this.__pendingValue);){let i=this.__pendingValue;this.__pendingValue=U,i(this)}if(this.__pendingValue===U)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),s=e!=null&&(r==null||o);o&&this.element.removeEventListener(this.eventName,this.__boundHandleEvent,this.__options),s&&(this.__options=Rl(e),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=e,this.__pendingValue=U}handleEvent(e){typeof this.value=="function"?this.value.call(this.eventContext||this.element,e):this.value.handleEvent(e)}};n(ht,"EventPart");Rl=n(t=>t&&(Vs?{capture:t.capture,passive:t.passive,once:t.once}:t.capture),"getOptions")});function mo(t){let e=Te.get(t.type);e===void 0&&(e={stringsArray:new WeakMap,keyString:new Map},Te.set(t.type,e));let r=e.stringsArray.get(t.strings);if(r!==void 0)return r;let o=t.strings.join(L);return r=e.keyString.get(o),r===void 0&&(r=new we(t,t.getTemplateElement()),e.keyString.set(o,r)),e.stringsArray.set(t.strings,r),r}var Te,cr=p(()=>{ce();n(mo,"templateFactory");Te=new Map});var ue,go,yo=p(()=>{ve();ar();cr();ue=new WeakMap,go=n((t,e,r)=>{let o=ue.get(e);o===void 0&&(Se(e,e.firstChild),ue.set(e,o=new Z(Object.assign({templateFactory:mo},r))),o.appendInto(e)),o.setValue(t),o.commit()},"render")});var lr,bo,_o=p(()=>{ar();lr=class{handleAttributeExpressions(e,r,o,s){let i=r[0];return i==="."?new ft(e,r.slice(1),o).parts:i==="@"?[new ht(e,r.slice(1),s.eventContext)]:i==="?"?[new dt(e,r.slice(1),o)]:new Be(e,r,o).parts}handleTextExpression(e){return new Z(e)}};n(lr,"DefaultTemplateProcessor");bo=new lr});var d,Eo=p(()=>{_o();or();_o();fo();ve();ho();ar();yo();cr();rr();or();ce();typeof window!="undefined"&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.3.0");d=n((t,...e)=>new K(t,e,"html",bo),"html")});var Bs,ur,Nl,kl,ql,Hs,Il,zs,Gs=p(()=>{ve();js();yo();cr();rr();ce();Eo();Bs=n((t,e)=>`${t}--${e}`,"getTemplateCacheKey"),ur=!0;typeof window.ShadyCSS=="undefined"?ur=!1:typeof window.ShadyCSS.prepareTemplateDom=="undefined"&&(console.warn("Incompatible ShadyCSS version detected. Please update to at least @webcomponents/webcomponentsjs@2.0.2 and @webcomponents/shadycss@1.3.1."),ur=!1);Nl=n(t=>e=>{let r=Bs(e.type,t),o=Te.get(r);o===void 0&&(o={stringsArray:new WeakMap,keyString:new Map},Te.set(r,o));let s=o.stringsArray.get(e.strings);if(s!==void 0)return s;let i=e.strings.join(L);if(s=o.keyString.get(i),s===void 0){let a=e.getTemplateElement();ur&&window.ShadyCSS.prepareTemplateDom(a,t),s=new we(e,a),o.keyString.set(i,s)}return o.stringsArray.set(e.strings,s),s},"shadyTemplateFactory"),kl=["html","svg"],ql=n(t=>{kl.forEach(e=>{let r=Te.get(Bs(e,t));r!==void 0&&r.keyString.forEach(o=>{let{element:{content:s}}=o,i=new Set;Array.from(s.querySelectorAll("style")).forEach(a=>{i.add(a)}),po(o,i)})})},"removeStylesFromLitTemplates"),Hs=new Set,Il=n((t,e,r)=>{Hs.add(t);let o=r?r.element:document.createElement("template"),s=e.querySelectorAll("style"),{length:i}=s;if(i===0){window.ShadyCSS.prepareTemplateStyles(o,t);return}let a=document.createElement("style");for(let h=0;h<i;h++){let _=s[h];_.parentNode.removeChild(_),a.textContent+=_.textContent}ql(t);let c=o.content;r?Ls(r,a,c.firstChild):c.insertBefore(a,c.firstChild),window.ShadyCSS.prepareTemplateStyles(o,t);let u=c.querySelector("style");if(window.ShadyCSS.nativeShadow&&u!==null)e.insertBefore(u.cloneNode(!0),e.firstChild);else if(r){c.insertBefore(a,c.firstChild);let h=new Set;h.add(a),po(r,h)}},"prepareTemplateStyles"),zs=n((t,e,r)=>{if(!r||typeof r!="object"||!r.scopeName)throw new Error("The `scopeName` option is required.");let o=r.scopeName,s=ue.has(e),i=ur&&e.nodeType===11&&!!e.host,a=i&&!Hs.has(o),c=a?document.createDocumentFragment():e;if(go(t,c,Object.assign({templateFactory:Nl(o)},r)),a){let u=ue.get(c);ue.delete(c);let h=u.value instanceof le?u.value.template:void 0;Il(o,c,h),Se(e,e.firstChild),e.appendChild(c),ue.set(e,u)}!s&&i&&window.ShadyCSS.styleElement(e.host)},"render")});var Ws,xo,Ys,So,vo,wo,Oo,To,Co,mt,Po=p(()=>{window.JSCompiler_renameProperty=(t,e)=>t;xo={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}},Ys=n((t,e)=>e!==t&&(e===e||t===t),"notEqual"),So={attribute:!0,type:String,converter:xo,reflect:!1,hasChanged:Ys},vo=1,wo=1<<2,Oo=1<<3,To=1<<4,Co="finalized",mt=class extends HTMLElement{constructor(){super();this.initialize()}static get observedAttributes(){this.finalize();let e=[];return this._classProperties.forEach((r,o)=>{let s=this._attributeNameForProperty(o,r);s!==void 0&&(this._attributeToPropertyMap.set(s,o),e.push(s))}),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=So){if(this._ensureClassProperties(),this._classProperties.set(e,r),r.noAccessor||this.prototype.hasOwnProperty(e))return;let o=typeof e=="symbol"?Symbol():`__${e}`,s=this.getPropertyDescriptor(e,o,r);s!==void 0&&Object.defineProperty(this.prototype,e,s)}static getPropertyDescriptor(e,r,o){return{get(){return this[r]},set(s){let i=this[e];this[r]=s,this.requestUpdateInternal(e,i,o)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this._classProperties&&this._classProperties.get(e)||So}static finalize(){let e=Object.getPrototypeOf(this);if(e.hasOwnProperty(Co)||e.finalize(),this[Co]=!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 s of o)this.createProperty(s,r[s])}}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=Ys){return o(e,r)}static _propertyValueFromAttribute(e,r){let o=r.type,s=r.converter||xo,i=typeof s=="function"?s:s.fromAttribute;return i?i(e,o):e}static _propertyValueToAttribute(e,r){if(r.reflect===void 0)return;let o=r.type,s=r.converter;return(s&&s.toAttribute||xo.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=So){let s=this.constructor,i=s._attributeNameForProperty(e,o);if(i!==void 0){let a=s._propertyValueToAttribute(r,o);if(a===void 0)return;this._updateState=this._updateState|Oo,a==null?this.removeAttribute(i):this.setAttribute(i,a),this._updateState=this._updateState&~Oo}}_attributeToProperty(e,r){if(this._updateState&Oo)return;let o=this.constructor,s=o._attributeToPropertyMap.get(e);if(s!==void 0){let i=o.getPropertyOptions(s);this._updateState=this._updateState|To,this[s]=o._propertyValueFromAttribute(r,i),this._updateState=this._updateState&~To}}requestUpdateInternal(e,r,o){let s=!0;if(e!==void 0){let i=this.constructor;o=o||i.getPropertyOptions(e),i._valueHasChanged(this[e],r,o.hasChanged)?(this._changedProperties.has(e)||this._changedProperties.set(e,r),o.reflect===!0&&!(this._updateState&To)&&(this._reflectingProperties===void 0&&(this._reflectingProperties=new Map),this._reflectingProperties.set(e,o))):s=!1}!this._hasRequestedUpdate&&s&&(this._updatePromise=this._enqueueUpdate())}requestUpdate(e,r){return this.requestUpdateInternal(e,r),this.updateComplete}async _enqueueUpdate(){this._updateState=this._updateState|wo;try{await this._updatePromise}catch(r){}let e=this.performUpdate();return e!=null&&await e,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return this._updateState&wo}get hasUpdated(){return this._updateState&vo}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&vo||(this._updateState=this._updateState|vo,this.firstUpdated(r)),this.updated(r))}_markUpdated(){this._changedProperties=new Map,this._updateState=this._updateState&~wo}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(mt,"UpdatingElement");Ws=Co;mt[Ws]=!0});var Qs,Td,Js=p(()=>{Qs=Element.prototype,Td=Qs.msMatchesSelector||Qs.webkitMatchesSelector});var pr,Ro,gt,Ks,Ul,C,Ao=p(()=>{pr=window.ShadowRoot&&(window.ShadyCSS===void 0||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ro=Symbol(),gt=class{constructor(e,r){if(r!==Ro)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(gt,"CSSResult");Ks=n(t=>new gt(String(t),Ro),"unsafeCSS"),Ul=n(t=>{if(t instanceof gt)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"),C=n((t,...e)=>{let r=e.reduce((o,s,i)=>o+Ul(s)+t[i+1],t[0]);return new gt(r,Ro)},"css")});var Zs,v,O=p(()=>{Gs();Po();Po();Js();Eo();Ao();Ao();(window.litElementVersions||(window.litElementVersions=[])).push("2.4.0");Zs={},v=class extends mt{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((i,a)=>i.reduceRight((c,u)=>Array.isArray(u)?r(u,c):(c.add(u),c),a),"addStyles"),o=r(e,new Set),s=[];o.forEach(i=>s.unshift(i)),this._styles=s}else this._styles=e===void 0?[]:[e];this._styles=this._styles.map(r=>{if(r instanceof CSSStyleSheet&&!pr){let o=Array.prototype.slice.call(r.cssRules).reduce((s,i)=>s+i.cssText,"");return Ks(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):pr?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!==Zs&&this.constructor.render(r,this.renderRoot,{scopeName:this.localName,eventContext:this}),this._needsShimAdoptedStyleSheets&&(this._needsShimAdoptedStyleSheets=!1,this.constructor._styles.forEach(o=>{let s=document.createElement("style");s.textContent=o.cssText,this.renderRoot.appendChild(s)}))}render(){return Zs}};n(v,"LitElement");v.finalized=!0;v.render=zs});var dr=X((Dd,Xs)=>{var Fl={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"};Xs.exports=Fl});var ti=X((Ld,ei)=>{var Ce=dr(),Dl=n(t=>{let e="",r=[];for(let o of t){let s=o.charCodeAt(0);switch(s){case Ce.PAR_OPEN:case Ce.PAR_CLOSE:case Ce.OP_NOT:case Ce.BINARY_AND:case Ce.BINARY_OR:e&&(r.push({type:Ce.LITERAL,value:e}),e=""),r.push({type:s,value:o});break;default:e+=o}}return e&&r.push({type:Ce.LITERAL,value:e}),r},"Tokenizer");ei.exports=Dl});var oi=X((jd,ri)=>{var pe=dr(),Ll=n(t=>{let e=[],r=[];return t.forEach(s=>{switch(s.type){case pe.LITERAL:e.unshift(s);break;case pe.BINARY_AND:case pe.BINARY_OR:case pe.OP_NOT:case pe.PAR_OPEN:r.push(s);break;case pe.PAR_CLOSE:for(;r.length&&r[r.length-1].type!==pe.PAR_OPEN;)e.unshift(r.pop());r.pop(),r.length&&r[r.length-1].type===pe.OP_NOT&&e.unshift(r.pop());break;default:break}}),r.length&&[...r.reverse(),...e]||e},"PolishNotation"),jl=n(function*(t){for(let e=0;e<t.length-1;e++)yield t[e];return t[t.length-1]},"PolishGenerator");ri.exports={PolishNotation:Ll,PolishGenerator:jl}});var si=X((Md,ni)=>{var F=dr(),V=class{constructor(e,r,o,s){this.op=e,this.left=r,this.right=o,this.literal=s}isLeaf(){return this.op===F.LEAF}isAtomic(){return this.isLeaf()||this.op===F.OP_NOT&&this.left.isLeaf()}getLiteralValue(){return this.literal}static CreateAnd(e,r){return new V(F.BINARY_AND,e,r)}static CreateNot(e){return new V(F.OP_NOT,e)}static CreateOr(e,r){return new V(F.BINARY_OR,e,r)}static CreateLiteral(e){return new V(F.LEAF,null,null,e)}};n(V,"ExpNode");var He=n(t=>{let e=t.next().value;switch(e.type){case F.LITERAL:return V.CreateLiteral(e.value);case F.OP_NOT:return V.CreateNot(He(t));case F.BINARY_AND:{let r=He(t),o=He(t);return V.CreateAnd(r,o)}case F.BINARY_OR:{let r=He(t),o=He(t);return V.CreateOr(r,o)}}return null},"make"),ze=n((t,e)=>{if(t.isLeaf())return e(t.getLiteralValue());if(t.op===F.OP_NOT)return!ze(t.left,e);if(t.op===F.BINARY_OR)return ze(t.left,e)||ze(t.right,e);if(t.op===F.BINARY_AND)return ze(t.left,e)&&ze(t.right,e)},"nodeEvaluator");ni.exports={make:He,nodeEvaluator:ze}});var li=X((Vd,ci)=>{var Ml=ti(),ii=oi(),ai=si(),Vl=n((t,e)=>{let r=Ml(t),o=ii.PolishNotation(r),s=ii.PolishGenerator(o),i=ai.make(s);return ai.nodeEvaluator(i,e)},"parse");ci.exports={parse:Vl}});var $l,ui,No,Bl,ko,j,fr,$=p(()=>{O();$l=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"),ui=n(t=>t.hasAttribute("product")&&l({id:t.getAttribute("product")},t.hasAttribute("product-components")&&{components:JSON.parse(t.getAttribute("product-components"))}),"buildProduct"),No=n(t=>{let e=ui(t);if(!e){let r=t.offer;r&&(e=ui(r))}return e},"resolveProduct"),Bl=n(t=>{let e=t;for(;e;){if(e.tagName==="OG-OFFER")return e;e=e.nodeType===11?e.host:e.parentNode}},"resolveOffer"),ko=n(t=>class extends t{get offer(){return Bl(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"),j=n(t=>class extends ko(t){get product(){return No(this)}},"withProduct"),fr=n(t=>class extends t{get childOptions(){return this._childOptions||{options:[]}}connectedCallback(){let e=[],r=null;this.querySelectorAll("option").forEach(o=>{let s=$l(o.value),i=o.innerText.trim();e.push({value:s,text:i}),!r&&o.selected&&(r=s)}),this._childOptions={options:e,isSelected:r},super.connectedCallback&&super.connectedCallback()}},"withChildOptions")});var hr={};E(hr,{eligibilityGroups:()=>fi,eligible:()=>pi,hasUpcomingOrder:()=>mi,hasUpsellGroup:()=>hi,inStock:()=>qo,regularEligible:()=>Gl,subscribed:()=>Hl,subscriptionEligible:()=>di,upcomingOrderContainsProduct:()=>zl,upsellEligible:()=>gi});var qo,pi,di,fi,hi,Hl,mi,zl,gi,Gl,yi=p(()=>{Q();qo=n((t,e)=>(t.inStock||{})[(e.product||{}).id],"inStock"),pi=n((t,e)=>(t.autoshipEligible||{})[(e.product||{}).id]||!1,"eligible"),di=n((t,e)=>(t.offerId&&t.offerId!=="0"||!1)&&pi(t,e)&&qo(t,e),"subscriptionEligible"),fi=n((t,e)=>(t.eligibilityGroups||{})[(e.product||{}).id]||null,"eligibilityGroups"),hi=n((t,e)=>{let r=fi(t,e);return r===null||!!r.find(o=>o==="upsell"||o==="impulse_upsell")},"hasUpsellGroup"),Hl=n((t,e)=>Un(e.product)(t),"subscribed"),mi=n(t=>!!(t.nextUpcomingOrder&&t.nextUpcomingOrder.public_id),"hasUpcomingOrder"),zl=n((t,e)=>(t.nextUpcomingOrder&&t.nextUpcomingOrder.products||[]).includes((e.product||{}).id),"upcomingOrderContainsProduct"),gi=n((t,e)=>t.offerId&&t.offerId!=="0"&&t.auth&&qo(t,e)&&mi(t)&&hi(t,e),"upsellEligible"),Gl=n((t,e)=>di(t,e)&&!gi(t,e),"regularEligible")});var Si={};E(Si,{ConnectedWhen:()=>xi,When:()=>mr,default:()=>Wl,mapStateToProps:()=>Ei,removeWhitespace:()=>_i});var bi,_i,mr,Ei,xi,Wl,vi=p(()=>{O();bi=Ae(li());N();$();yi();_i=n(t=>t.replace(/(\r\n|\n|\r|\s)+/gm,""),"removeWhitespace"),mr=class extends j(v){static get properties(){return m(l({},super.properties),{state:{type:Object,attribute:!1},test:{type:String}})}render(){return this.test&&bi.default.parse(_i(this.test),r=>hr[r]&&hr[r](this.state,this))?d`
13
13
  <slot></slot>
14
- `:p``}shouldUpdate(e){return e.size&&this.product&&this.product.id in this.state.autoshipEligible&&this.product.id in this.state.inStock}};n(pr,"When");ui=n(t=>({state:t}),"mapStateToProps"),pi=m(ui)(pr),Cl=pi});var hi,ue,dr,$e,pe=u(()=>{oe();hi={type:Object,converter:{toAttribute(t){return t==null?t:JSON.stringify(t)},fromAttribute(t){return t&&t.match(/[{[]/)?JSON.parse(t):{id:t}}}},ue={type:String,attribute:"default-frequency",converter:{fromAttribute(t){return t&&Vt(t)?t:null}}},dr={type:Boolean,attribute:!0,reflect:!0},$e={type:Object,attribute:!1}});var Pl,B,Be=u(()=>{v();W();Pl=n(t=>class extends t{getOption(e,r=e){let o=Br(e);if(this.hasAttribute(o)){let s=this.getAttribute(o);return s.toString().toLowerCase()==="true"?!0:s.toString().toLowerCase()==="false"?!1:s}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"),B=Pl(E)});var gi={};b(gi,{ConnectedOptinStatus:()=>mi,OptinStatus:()=>L,default:()=>Rl,mapStateToProps:()=>H});var L,H,mi,Rl,He=u(()=>{v();W();R();pe();M();Be();L=class extends D(B){static get properties(){return{subscribed:dr,frequencyMatch:{type:Boolean,reflect:!0,attribute:"frequency-match"}}}static get styles(){return T`
14
+ `:d``}shouldUpdate(e){return e.size&&this.product&&this.product.id in this.state.autoshipEligible&&this.product.id in this.state.inStock}};n(mr,"When");Ei=n(t=>({state:t}),"mapStateToProps"),xi=y(Ei)(mr),Wl=xi});var wi,de,gr,Ge,fe=p(()=>{se();wi={type:Object,converter:{toAttribute(t){return t==null?t:JSON.stringify(t)},fromAttribute(t){return t&&t.match(/[{[]/)?JSON.parse(t):{id:t}}}},de={type:String,attribute:"default-frequency",converter:{fromAttribute(t){return t&&zt(t)?t:null}}},gr={type:Boolean,attribute:!0,reflect:!0},Ge={type:Object,attribute:!1}});var Yl,z,We=p(()=>{O();Q();Yl=n(t=>class extends t{getOption(e,r=e){let o=Wr(e);if(this.hasAttribute(o)){let s=this.getAttribute(o);return s.toString().toLowerCase()==="true"?!0:s.toString().toLowerCase()==="false"?!1:s}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(o){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"),z=Yl(v)});var Ti={};E(Ti,{ConnectedOptinStatus:()=>Oi,OptinStatus:()=>M,default:()=>Ql,mapStateToProps:()=>G});var M,G,Oi,Ql,Ye=p(()=>{O();Q();N();fe();$();We();M=class extends j(z){static get properties(){return{subscribed:gr,frequencyMatch:{type:Boolean,reflect:!0,attribute:"frequency-match"}}}static get styles(){return C`
15
15
  :host {
16
16
  cursor: default;
17
17
  display: inline-block;
@@ -23,9 +23,9 @@ var lib=(()=>{var Pa=Object.create;var Ye=Object.defineProperty;var Ra=Object.ge
23
23
 
24
24
  .btn {
25
25
  position: relative;
26
- width: var(--og-radio-width, 1.4em);
27
- height: var(--og-radio-height, 1.4em);
28
- margin: var(--og-radio-margin, 0);
26
+ width: 1.4em;
27
+ height: 1.4em;
28
+ margin: 0;
29
29
  padding: 0;
30
30
  border: 1px solid var(--og-primary-color, black);
31
31
  background: #fff;
@@ -64,18 +64,18 @@ var lib=(()=>{var Pa=Object.create;var Ye=Object.defineProperty;var Ra=Object.ge
64
64
  text-align: center;
65
65
  overflow: visible;
66
66
  }
67
- `}constructor(){super();this.addEventListener("click",this.handleClick.bind(this))}updated(e){e.has("subscribed")&&(this.frequencyMatch=this.frequency===this.defaultFrequency)}handleClick(){}render(){return this.subscribed&&!this.defaultFrequency?p`
67
+ `}constructor(){super();this.addEventListener("click",this.handleClick.bind(this))}updated(e){e.has("subscribed")&&(this.frequencyMatch=this.frequency===this.defaultFrequency)}handleClick(){}render(){return this.subscribed&&!this.defaultFrequency?d`
68
68
  <slot name="subscribed"></slot>
69
69
  <slot name="frequency-mismatch"></slot>
70
- `:this.subscribed&&this.defaultFrequency===this.frequency?p`
70
+ `:this.subscribed&&this.defaultFrequency===this.frequency?d`
71
71
  <slot name="subscribed"></slot>
72
72
  <slot name="frequency-match"></slot>
73
- `:this.subscribed&&this.defaultFrequency!==this.frequency?p`
73
+ `:this.subscribed&&this.defaultFrequency!==this.frequency?d`
74
74
  <slot name="subscribed"></slot>
75
75
  <slot name="frequency-mismatch"></slot>
76
- `:p`
76
+ `:d`
77
77
  <slot name="not-subscribed"></slot>
78
- `}};n(L,"OptinStatus");H=n((t,e={})=>({subscribed:z(e.product)(t),frequency:ne(e.product)(t),...G(t,e,"defaultFrequency"),...De(t,e)}),"mapStateToProps"),mi=m(H)(L),Rl=mi});var bi={};b(bi,{ConnectedOptinButton:()=>yi,OptinButton:()=>fr,default:()=>Al});var fr,yi,Al,_i=u(()=>{v();k();He();R();pe();M();fr=class extends L{static get properties(){return{...super.properties,frequency:{type:String,reflect:!0},defaultFrequency:ue,optinButtonLabel:{type:String}}}handleClick(e){this.optinProduct(Co(this),this.defaultFrequency),e.preventDefault()}render(){return p`
78
+ `}};n(M,"OptinStatus");G=n((t,e={})=>l(l({subscribed:W(e.product)(t),frequency:ie(e.product)(t)},Y(t,e,"defaultFrequency")),Ve(t,e)),"mapStateToProps"),Oi=y(G)(M),Ql=Oi});var Pi={};E(Pi,{ConnectedOptinButton:()=>Ci,OptinButton:()=>yr,default:()=>Jl});var yr,Ci,Jl,Ri=p(()=>{O();I();Ye();N();fe();$();yr=class extends M{static get properties(){return m(l({},super.properties),{frequency:{type:String,reflect:!0},defaultFrequency:de,optinButtonLabel:{type:String}})}handleClick(e){this.optinProduct(No(this),this.defaultFrequency),e.preventDefault()}render(){return d`
79
79
  <slot name="default">
80
80
  <button id="action-trigger" class="btn radio ${this.subscribed?"active":""}"></button>
81
81
  <label for="action-trigger">
@@ -84,7 +84,7 @@ var lib=(()=>{var Pa=Object.create;var Ye=Object.defineProperty;var Ra=Object.ge
84
84
  </slot>
85
85
  </label>
86
86
  </slot>
87
- `}};n(fr,"OptinButton");yi=m(H,{optinProduct:Y})(fr),Al=yi});var Ei={};b(Ei,{ConnectedOptoutButton:()=>xi,OptoutButton:()=>hr,default:()=>Nl});var hr,xi,Nl,Si=u(()=>{v();k();He();R();hr=class extends L{static get properties(){return{...super.properties,label:{type:String}}}handleClick(e){this.optoutProduct(this.product),e.preventDefault()}render(){return p`
87
+ `}};n(yr,"OptinButton");Ci=y(G,{optinProduct:J})(yr),Jl=Ci});var Ni={};E(Ni,{ConnectedOptoutButton:()=>Ai,OptoutButton:()=>br,default:()=>Kl});var br,Ai,Kl,ki=p(()=>{O();I();Ye();N();br=class extends M{static get properties(){return m(l({},super.properties),{label:{type:String}})}handleClick(e){this.optoutProduct(this.product),e.preventDefault()}render(){return d`
88
88
  <slot name="default">
89
89
  <button id="action-trigger" class="btn radio ${this.subscribed?"":"active"}"></button>
90
90
  <label for="action-trigger">
@@ -93,32 +93,32 @@ var lib=(()=>{var Pa=Object.create;var Ye=Object.defineProperty;var Ra=Object.ge
93
93
  </slot>
94
94
  </label>
95
95
  </slot>
96
- `}};n(hr,"OptoutButton");xi=m(H,{optoutProduct:ye})(hr),Nl=xi});var wi={};b(wi,{ConnectedFrequencyStatus:()=>vi,FrequencyStatus:()=>Ge,default:()=>kl,frequencyText:()=>ze,mapStateToProps:()=>We});var ze,Ge,We,vi,kl,mr=u(()=>{v();W();R();pe();oe();M();Be();ze=n((t,e)=>{let{every:r,every_period:o}=Ue(t);return p`
96
+ `}};n(br,"OptoutButton");Ai=y(G,{optoutProduct:_e})(br),Kl=Ai});var Ii={};E(Ii,{ConnectedFrequencyStatus:()=>qi,FrequencyStatus:()=>Je,default:()=>Zl,frequencyText:()=>Qe,mapStateToProps:()=>Ke});var Qe,Je,Ke,qi,Zl,_r=p(()=>{O();Q();N();fe();se();$();We();Qe=n((t,e)=>{let{every:r,every_period:o}=je(t);return d`
97
97
  ${r}
98
98
  <og-text key="frequencyPeriods" variant="${o}" pluralize="${r}"></og-text>
99
- ${e&&e===t?p`
99
+ ${e&&e===t?d`
100
100
  <og-text key="defaultFrequencyCopy"></og-text>
101
101
  `:""}
102
- `},"frequencyText"),Ge=class extends D(B){static get properties(){return{...super.properties,disabled:{type:Boolean},subscribed:dr,frequency:{type:String},defaultFrequency:ue,productDefaultFrequency:{type:String},frequencies:{converter:{fromAttribute:Vr}}}}static get styles(){return T`
102
+ `},"frequencyText"),Je=class extends j(z){static get properties(){return m(l({},super.properties),{disabled:{type:Boolean},subscribed:gr,frequency:{type:String},defaultFrequency:de,productDefaultFrequency:{type:String},frequencies:{converter:{fromAttribute:zr}}})}static get styles(){return C`
103
103
  :host[hidden] {
104
104
  display: none;
105
105
  }
106
106
  :host {
107
107
  display: inline-block;
108
108
  }
109
- `}constructor(){super();this.frequencies=[]}render(){let e=this.frequency||this.defaultFrequency;return p`
109
+ `}constructor(){super();this.frequencies=[]}render(){let e=this.frequency||this.defaultFrequency;return d`
110
110
  <span>
111
- ${this.subscribed&&p`
112
- <slot name="subscribed">${ze(e)} </slot>
111
+ ${this.subscribed&&d`
112
+ <slot name="subscribed">${Qe(e)} </slot>
113
113
  `||""}
114
- ${!this.subscribed&&p`
114
+ ${!this.subscribed&&d`
115
115
  <slot name="not-subscribed"></slot>
116
116
  `||""}
117
- ${this.subscribed&&this.defaultFrequency&&this.defaultFrequency!==this.frequency&&p`
117
+ ${this.subscribed&&this.defaultFrequency&&this.defaultFrequency!==this.frequency&&d`
118
118
  <slot name="frequency-mismatch"></slot>
119
119
  `||""}
120
120
  </span>
121
- `}};n(Ge,"FrequencyStatus");We=n((t,e)=>({subscribed:z(e.product)(t),frequency:ne(e.product)(t),productDefaultFrequency:Bt((e.product||{}).id)(t),...G(t,e,"frequencies",[]),...G(t,e,"defaultFrequency"),...De(t,e)}),"mapStateToProps"),vi=m(We)(Ge),kl=vi});var Oi={};b(Oi,{ConnectedOptinSelect:()=>Ti,OptinSelect:()=>gr,default:()=>ql});var gr,Ti,ql,Ci=u(()=>{v();k();M();He();mr();R();pe();gr=class extends lr(L){static get properties(){return{...super.properties,frequencies:{type:Array,attribute:!1},frequency:{type:String},defaultFrequency:ue}}static get styles(){return T`
121
+ `}};n(Je,"FrequencyStatus");Ke=n((t,e)=>l(l(l({subscribed:W(e.product)(t),frequency:ie(e.product)(t),productDefaultFrequency:Wt((e.product||{}).id)(t)},Y(t,e,"frequencies",[])),Y(t,e,"defaultFrequency")),Ve(t,e)),"mapStateToProps"),qi=y(Ke)(Je),Zl=qi});var Fi={};E(Fi,{ConnectedOptinSelect:()=>Ui,OptinSelect:()=>Er,default:()=>Xl});var Er,Ui,Xl,Di=p(()=>{O();I();$();Ye();_r();N();fe();Er=class extends fr(M){static get properties(){return m(l({},super.properties),{frequencies:{type:Array,attribute:!1},frequency:{type:String},defaultFrequency:de})}static get styles(){return C`
122
122
  :host {
123
123
  display: inline-block;
124
124
  cursor: pointer;
@@ -128,26 +128,26 @@ var lib=(()=>{var Pa=Object.create;var Ye=Object.defineProperty;var Ra=Object.ge
128
128
  border-width: var(--og-select-border-width, 1px);
129
129
  box-shadow: 0 1px 0 1px rgba(0, 0, 0, 0.04);
130
130
  }
131
- `}get isSelected(){return this.subscribed?this.frequency:"optedOut"}onOptinChange(e){e==="optedOut"?this.optoutProduct(this.product):this.productChangeFrequency(this.product,e)}render(){let{options:e,isSelected:r}=this.childOptions,o=e;return e.length||(o=[{value:"optedOut",text:p`
131
+ `}get isSelected(){return this.subscribed?this.frequency:"optedOut"}onOptinChange(e){e==="optedOut"?this.optoutProduct(this.product):this.productChangeFrequency(this.product,e)}render(){let{options:e,isSelected:r}=this.childOptions,o=e;return e.length||(o=[{value:"optedOut",text:d`
132
132
  <og-text key="offerOptOutLabel"></og-text>
133
- `},...(this.frequencies||[]).map(s=>({value:s,text:ze(s,this.defaultFrequency)}))]),p`
133
+ `},...(this.frequencies||[]).map(s=>({value:s,text:Qe(s,this.defaultFrequency)}))]),d`
134
134
  <og-select
135
135
  .options="${o}"
136
136
  .selected="${r}"
137
137
  .onChange="${({target:{value:s}})=>this.onOptinChange(s)}"
138
138
  ></og-select>
139
- `}};n(gr,"OptinSelect");Ti=m((t,e)=>({...H(t,e),...We(t,e)}),{productChangeFrequency:rt,optoutProduct:ye})(gr),ql=Ti});var Ri={};b(Ri,{ConnectedUpsellButton:()=>Il,UpsellButton:()=>ft,default:()=>Ul,mapStateToProps:()=>Pi});var ft,Pi,Il,Ul,Ai=u(()=>{v();k();R();pe();M();Be();ft=class extends D(B){static get styles(){return T`
139
+ `}};n(Er,"OptinSelect");Ui=y((t,e)=>l(l({},G(t,e)),Ke(t,e)),{productChangeFrequency:it,optoutProduct:_e})(Er),Xl=Ui});var ji={};E(ji,{ConnectedUpsellButton:()=>eu,UpsellButton:()=>yt,default:()=>tu,mapStateToProps:()=>Li});var yt,Li,eu,tu,Mi=p(()=>{O();I();N();fe();$();We();yt=class extends j(z){static get styles(){return C`
140
140
  :host[hidden] {
141
141
  display: none;
142
142
  }
143
143
  :host {
144
144
  display: inline-block;
145
145
  }
146
- `}static get properties(){return{...super.properties,upcomingOrderDate:{type:String,attribute:!1},auth:$e,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 p`
146
+ `}static get properties(){return m(l({},super.properties),{upcomingOrderDate:{type:String,attribute:!1},auth:Ge,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 d`
147
147
  <slot>
148
148
  <og-next-upcoming-order></og-next-upcoming-order>
149
149
  </slot>
150
- `}};n(ft,"UpsellButton");Pi=n(t=>({isPreview:t.previewUpsellOffer}),"mapStateToProps"),Il=m(Pi,{fetchOrders:nt})(ft),Ul=ft});var ki={};b(ki,{ConnectedUpsellModal:()=>Fl,UpsellModal:()=>ht,default:()=>Dl,mapStateToProps:()=>Ni});var ht,Ni,Fl,Dl,qi=u(()=>{v();k();R();pe();W();M();Be();ht=class extends D(B){static get properties(){return{...super.properties,defaultFrequency:ue,auth:$e,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 p`
150
+ `}};n(yt,"UpsellButton");Li=n(t=>({isPreview:t.previewUpsellOffer}),"mapStateToProps"),eu=y(Li,{fetchOrders:ct})(yt),tu=yt});var $i={};E($i,{ConnectedUpsellModal:()=>ru,UpsellModal:()=>bt,default:()=>ou,mapStateToProps:()=>Vi});var bt,Vi,ru,ou,Bi=p(()=>{O();I();N();fe();Q();$();We();bt=class extends j(z){static get properties(){return m(l({},super.properties),{defaultFrequency:de,auth:Ge,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 d`
151
151
  <og-modal ?show=${this.show} @close=${()=>this.close()} @confirm=${()=>this.confirm()}>
152
152
  <div slot="content">
153
153
  <slot>
@@ -185,7 +185,7 @@ var lib=(()=>{var Pa=Object.create;var Ye=Object.defineProperty;var Ra=Object.ge
185
185
  </slot>
186
186
  </span>
187
187
  </og-modal>
188
- `}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(ht,"UpsellModal");Ni=n((t,e)=>({auth:t.auth,offerId:t.offerId,subscribed:z(e.product)(t),frequency:ne(e.product)(t),...G(t,e,"defaultFrequency"),nextUpcomingOrder:t.previewUpsellOffer?{public_id:"preview-order-id"}:t.nextUpcomingOrder,isPreview:t.previewUpsellOffer}),"mapStateToProps"),Fl=m(Ni,{concludeUpsell:Yr,createIu:Kr})(ht),Dl=ht});var Ui={};b(Ui,{ConnectedOptinToggle:()=>Ii,OptinToggle:()=>yr,default:()=>Ll});var yr,Ii,Ll,Fi=u(()=>{v();k();He();R();yr=class extends L{static get properties(){return{...super.properties,frequency:{type:String}}}handleClick(e){this.subscribed?this.optoutProduct(this.product):this.optinProduct(this.product,this.frequency||this.defaultFrequency),e.preventDefault()}render(){return p`
188
+ `}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(bt,"UpsellModal");Vi=n((t,e)=>m(l({auth:t.auth,offerId:t.offerId,subscribed:W(e.product)(t),frequency:ie(e.product)(t)},Y(t,e,"defaultFrequency")),{nextUpcomingOrder:t.previewUpsellOffer?{public_id:"preview-order-id"}:t.nextUpcomingOrder,isPreview:t.previewUpsellOffer}),"mapStateToProps"),ru=y(Vi,{concludeUpsell:Zr,createIu:to})(bt),ou=bt});var zi={};E(zi,{ConnectedOptinToggle:()=>Hi,OptinToggle:()=>xr,default:()=>nu});var xr,Hi,nu,Gi=p(()=>{O();I();Ye();N();xr=class extends M{static get properties(){return m(l({},super.properties),{frequency:{type:String}})}handleClick(e){this.subscribed?this.optoutProduct(this.product):this.optinProduct(this.product,this.frequency||this.defaultFrequency),e.preventDefault()}render(){return d`
189
189
  <slot name="default">
190
190
  <button id="action-trigger" class="btn checkbox ${this.subscribed?"active":""}"></button>
191
191
  <label for="action-trigger">
@@ -194,13 +194,13 @@ var lib=(()=>{var Pa=Object.create;var Ye=Object.defineProperty;var Ra=Object.ge
194
194
  ></slot>
195
195
  </label>
196
196
  </slot>
197
- `}};n(yr,"OptinToggle");Ii=m(H,{optoutProduct:ye,optinProduct:Y})(yr),Ll=Ii});var Mi={};b(Mi,{ConnectedText:()=>ji,Text:()=>br,default:()=>jl,mapStateToProps:()=>Li,pluralize:()=>Di});var Di,br,Li,ji,jl,Vi=u(()=>{v();R();M();Di=n((t,e)=>`${t}${parseInt(e,10)>1?"s":""}`,"pluralize"),br=class extends Po(E){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&&Di(e,this.pluralize)}render(){return p`
197
+ `}};n(xr,"OptinToggle");Hi=y(G,{optoutProduct:_e,optinProduct:J})(xr),nu=Hi});var Ji={};E(Ji,{ConnectedText:()=>Qi,Text:()=>Sr,default:()=>su,mapStateToProps:()=>Yi,pluralize:()=>Wi});var Wi,Sr,Yi,Qi,su,Ki=p(()=>{O();N();$();Wi=n((t,e)=>`${t}${parseInt(e,10)>1?"s":""}`,"pluralize"),Sr=class extends ko(v){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=l(l({},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&&Wi(e,this.pluralize)}render(){return d`
198
198
  ${this.getText()}
199
- `}};n(br,"Text");Li=n(t=>({i18n:t.locale||{}}),"mapStateToProps"),ji=m(Li)(br),jl=ji});var Yi={};b(Yi,{ConnectedIncentiveText:()=>Wi,DiscountAmount:()=>Oe,IncentiveText:()=>_r,default:()=>$l,filterIncentives:()=>zi,getTransformedDiscounts:()=>Ml,mapStateToProps:()=>Gi,replaceText:()=>Vl});function zi(t){return!(gt(t).className!==this.incentiveClass||this.incentiveValue&&this.incentiveValue.toString()!==t.value.toString())}function Vl(t,e){return t.replace(this.textToReplace,gt(e))}var Oe,mt,Ao,No,ko,$i,Bi,Hi,gt,Ml,_r,Gi,Wi,$l,Qi=u(()=>{v();R();M();Oe=class{constructor(e){this.value=e,this.className="DiscountAmount"}toString(){return`${this.value}`}};n(Oe,"DiscountAmount");mt=class extends Oe{constructor(e){super(e);this.className="DiscountPercent"}toString(){return`${super.toString()}%`}};n(mt,"DiscountPercent");Ao=class extends mt{constructor(e){super(e);this.className="ShippingDiscountPercent"}toString(){return this.value===100?"free shipping":super.toString()}};n(Ao,"ShippingDiscountPercent");No="Discount Percent",ko="Discount Amount",$i="total_price",Bi="shipping_total",Hi="sub_total",gt=n(({field:t,object:e,type:r,value:o})=>{let i=[[new mt(o),{field:$i,object:"item",type:No}],[new Oe(o),{field:$i,object:"item",type:ko}],[new Ao(o),{field:Bi,object:"order",type:No}],[new Oe(o),{field:Bi,object:"order",type:ko}],[new mt(o),{field:Hi,object:"order",type:No}],[new Oe(o),{field:Hi,object:"order",type:ko}]].find(([,a])=>a.field===t&&a.object===e&&a.type===r);return i&&i[0]},"discountBuilder"),Ml=n(t=>t.map(e=>gt(e)).filter(e=>e!==void 0),"getTransformedDiscounts");n(zi,"filterIncentives");n(Vl,"replaceText");_r=class extends D(E){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",s=(this.incentives[o]||[]).find(zi.bind({incentiveClass:e,incentiveValue:r}));return p`
200
- ${this.label} ${s?gt(s):this.renderFallback()}
201
- `}renderFallback(){let e=this.from,r=this.value,o=this.initial?"initial":"ongoing";return p`
202
- ${gt({field:"sub_total",object:"order",type:"Discount Percent",value:this.value})}
203
- `}};n(_r,"IncentiveText");Gi=n((t,e)=>({incentives:(t.incentives||{})[e&&e.product&&e.product.id]||{}}),"mapStateToProps"),Wi=m(Gi)(_r),$l=Wi});var Ki={};b(Ki,{ConnectedSelectFrequency:()=>Ji,SelectFrequency:()=>xr,default:()=>Hl,frequencyEquals:()=>Bl});var Bl,xr,Ji,Hl,Zi=u(()=>{v();k();M();mr();R();Bl=n((t,e)=>t===null||e===null?!1:t.every===e.every&&t.period===e.period,"frequencyEquals"),xr=class extends lr(Ge){static get properties(){return{...super.properties,defaultText:{type:String,attribute:"default-text"}}}static get styles(){return T`
199
+ `}};n(Sr,"Text");Yi=n(t=>({i18n:t.locale||{}}),"mapStateToProps"),Qi=y(Yi)(Sr),su=Qi});var na={};E(na,{ConnectedIncentiveText:()=>oa,DiscountAmount:()=>Pe,IncentiveText:()=>vr,default:()=>cu,filterIncentives:()=>ta,getTransformedDiscounts:()=>iu,mapStateToProps:()=>ra,replaceText:()=>au});function ta(t){return!(Et(t).className!==this.incentiveClass||this.incentiveValue&&this.incentiveValue.toString()!==t.value.toString())}function au(t,e){return t.replace(this.textToReplace,Et(e))}var Pe,_t,Io,Uo,Fo,Zi,Xi,ea,Et,iu,vr,ra,oa,cu,sa=p(()=>{O();N();$();Pe=class{constructor(e){this.value=e,this.className="DiscountAmount"}toString(){return`${this.value}`}};n(Pe,"DiscountAmount");_t=class extends Pe{constructor(e){super(e);this.className="DiscountPercent"}toString(){return`${super.toString()}%`}};n(_t,"DiscountPercent");Io=class extends _t{constructor(e){super(e);this.className="ShippingDiscountPercent"}toString(){return this.value===100?"free shipping":super.toString()}};n(Io,"ShippingDiscountPercent");Uo="Discount Percent",Fo="Discount Amount",Zi="total_price",Xi="shipping_total",ea="sub_total",Et=n(({field:t,object:e,type:r,value:o})=>{let i=[[new _t(o),{field:Zi,object:"item",type:Uo}],[new Pe(o),{field:Zi,object:"item",type:Fo}],[new Io(o),{field:Xi,object:"order",type:Uo}],[new Pe(o),{field:Xi,object:"order",type:Fo}],[new _t(o),{field:ea,object:"order",type:Uo}],[new Pe(o),{field:ea,object:"order",type:Fo}]].find(([,a])=>a.field===t&&a.object===e&&a.type===r);return i&&i[0]},"discountBuilder"),iu=n(t=>t.map(e=>Et(e)).filter(e=>e!==void 0),"getTransformedDiscounts");n(ta,"filterIncentives");n(au,"replaceText");vr=class extends j(v){static get properties(){return m(l({},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",s=(this.incentives[o]||[]).find(ta.bind({incentiveClass:e,incentiveValue:r}));return d`
200
+ ${this.label} ${s?Et(s):this.renderFallback()}
201
+ `}renderFallback(){let e=this.from,r=this.value,o=this.initial?"initial":"ongoing";return d`
202
+ ${Et({field:"sub_total",object:"order",type:"Discount Percent",value:this.value})}
203
+ `}};n(vr,"IncentiveText");ra=n((t,e)=>({incentives:(t.incentives||{})[e&&e.product&&e.product.id]||{}}),"mapStateToProps"),oa=y(ra)(vr),cu=oa});var aa={};E(aa,{ConnectedSelectFrequency:()=>ia,SelectFrequency:()=>wr,default:()=>uu,frequencyEquals:()=>lu});var lu,wr,ia,uu,ca=p(()=>{O();I();$();_r();N();lu=n((t,e)=>t===null||e===null?!1:t.every===e.every&&t.period===e.period,"frequencyEquals"),wr=class extends fr(Je){static get properties(){return m(l({},super.properties),{defaultText:{type:String,attribute:"default-text"}})}static get styles(){return C`
204
204
  :host {
205
205
  display: inline-block;
206
206
  cursor: pointer;
@@ -211,15 +211,15 @@ var lib=(()=>{var Pa=Object.create;var Ye=Object.defineProperty;var Ra=Object.ge
211
211
  box-shadow: 0 1px 0 1px rgba(0, 0, 0, 0.04);
212
212
  z-index: 1;
213
213
  }
214
- `}set defaultFrequency(e){this._defaultFrequency=e}get defaultFrequency(){let{options:e,isSelected:r}=this.childOptions;return this.productDefaultFrequency?this.productDefaultFrequency:r||(e.length?e[0].value:this._defaultFrequency)}get currentFrequency(){return this.frequency||this.defaultFrequency}productChangeFrequency(e,r){this.frequency=r}render(){let{options:e}=this.childOptions;e.length||(e=(this.frequencies||[]).map(o=>({value:o,text:ze(o,this.defaultFrequency)})));let r=this.defaultFrequency;return e=e.map(({text:o,value:s})=>({text:s===r?`${o} ${(this.defaultText||"").trim()}`.trim():o,value:s})),p`
214
+ `}set defaultFrequency(e){this._defaultFrequency=e}get defaultFrequency(){let{options:e,isSelected:r}=this.childOptions;return this.productDefaultFrequency?this.productDefaultFrequency:r||(e.length?e[0].value:this._defaultFrequency)}get currentFrequency(){return this.frequency||this.defaultFrequency}productChangeFrequency(e,r){this.frequency=r}render(){let{options:e}=this.childOptions;e.length||(e=(this.frequencies||[]).map(o=>({value:o,text:Qe(o,this.defaultFrequency)})));let r=this.defaultFrequency;return e=e.map(({text:o,value:s})=>({text:s===r?`${o} ${(this.defaultText||"").trim()}`.trim():o,value:s})),d`
215
215
  <og-select
216
216
  .options="${e}"
217
217
  .selected="${this.currentFrequency}"
218
218
  .onChange="${({target:{value:o}})=>{this.productChangeFrequency(this.product,o)}}"
219
219
  ></og-select>
220
- `}};n(xr,"SelectFrequency");Ji=m(We,{productChangeFrequency:rt})(xr),Hl=Ji});var zl,Xi,ea=u(()=>{zl={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"}},Xi=n((t,e)=>t instanceof Date?(e||"").toString().replace(/\{\{([-\w]+)\}\}/g,r=>{let o=r.replace(/[{}]/g,""),s=zl[o];if(typeof s=="undefined")return o;let a=new Intl.DateTimeFormat("en-us",s).formatToParts(t),[{value:c}]=a;return c}):t,"formatDate")});var ra={};b(ra,{ConnectedNextUpcomingOrder:()=>Gl,FormattedDate:()=>yt,default:()=>Wl,mapStateToProps:()=>ta});var yt,ta,Gl,Wl,oa=u(()=>{v();R();ea();yt=class extends E{static get properties(){return{value:{type:String,reflect:!0},format:{type:String}}}createRenderRoot(){return this}render(){return p`
221
- ${Xi(this.value,this.format||"{{month-long}} {{day}}, {{year-numeric}}")}
222
- `}};n(yt,"FormattedDate");ta=n(t=>({value:t.previewUpsellOffer?new Date:t.nextUpcomingOrder.place}),"mapStateToProps"),Gl=m(ta)(yt),Wl=yt});var na,Yl,sa,ia=u(()=>{k();Ae();na=n((t,e)=>n(async function(o){await o({type:Ze,payload:t}),await o({type:Pe}),await o(be({in_stock:{[e]:!0},eligibility_groups:{[e]:["subscription","upsell"]},result:"success",autoship:{[e]:!0},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"]}}}))},"setPreviewStandardOfferThunk"),"setPreviewStandardOffer"),Yl=n((t,e)=>n(async function(o,s){await o({type:Xe,payload:t});let{merchantId:i}=s();t?(await o(be({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},modifiers:{}})),await o(Gt({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 o(zt(i,"sig_field","ts","sig"))):await o(se())},"setPreviewUpsellOfferThunk"),"setPreviewUpsellOffer"),sa=n((t,e,r)=>async function(o,s){switch(await o({type:te}),await o({type:Ze,payload:!1}),await o({type:Xe,payload:!1}),t){case"regular":o(na(!0,r.product.id));break;case"upsell":o(Yl(!0,r.product.id));break;case"subscribed":o(na(!0,r.product.id)),o(Y(r.product,"2_2"));break;default:}},"setPreview")});var pa={};b(pa,{ConnectedOffer:()=>ua,Offer:()=>Er,default:()=>Jl,mapStateToProps:()=>la,productAndComponents:()=>ca});var aa,Ql,ca,Er,la,ua,Jl,da=u(()=>{v();aa=de(jt());R();ia();k();W();pe();Be();Ql=n((...t)=>JSON.stringify(t),"memoizeKey"),ca=(0,aa.default)((t,e)=>Object.assign({components:e},t),Ql),Er=class extends B{static get properties(){return{...super.properties,config:{type:Object,attribute:!1},product:hi,productComponents:{type:Array,attribute:"product-components"},offerId:{type:String,attribute:!1},auth:$e,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}}}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")}static get styles(){return T`
220
+ `}};n(wr,"SelectFrequency");ia=y(Ke,{productChangeFrequency:it})(wr),uu=ia});var pu,la,ua=p(()=>{pu={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"}},la=n((t,e)=>t instanceof Date?(e||"").toString().replace(/\{\{([-\w]+)\}\}/g,r=>{let o=r.replace(/[{}]/g,""),s=pu[o];if(typeof s=="undefined")return o;let a=new Intl.DateTimeFormat("en-us",s).formatToParts(t),[{value:c}]=a;return c}):t,"formatDate")});var da={};E(da,{ConnectedNextUpcomingOrder:()=>du,FormattedDate:()=>xt,default:()=>fu,mapStateToProps:()=>pa});var xt,pa,du,fu,fa=p(()=>{O();N();ua();xt=class extends v{static get properties(){return{value:{type:String,reflect:!0},format:{type:String}}}createRenderRoot(){return this}render(){return d`
221
+ ${la(this.value,this.format||"{{month-long}} {{day}}, {{year-numeric}}")}
222
+ `}};n(xt,"FormattedDate");pa=n(t=>({value:t.previewUpsellOffer?new Date:t.nextUpcomingOrder.place}),"mapStateToProps"),du=y(pa)(xt),fu=xt});var ha,hu,ma,ga=p(()=>{I();Ie();ha=n((t,e)=>n(async function(o){await o({type:rt,payload:t}),await o({type:ke}),await o(Ee({in_stock:{[e]:!0},eligibility_groups:{[e]:["subscription","upsell"]},result:"success",autoship:{[e]:!0},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"]}}}))},"setPreviewStandardOfferThunk"),"setPreviewStandardOffer"),hu=n((t,e)=>n(async function(o,s){await o({type:ot,payload:t});let{merchantId:i}=s();t?(await o(Ee({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},modifiers:{}})),await o(Jt({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 o(Qt(i,"sig_field","ts","sig"))):await o(ae())},"setPreviewUpsellOfferThunk"),"setPreviewUpsellOffer"),ma=n((t,e,r)=>async function(o,s){switch(await o({type:oe}),await o({type:rt,payload:!1}),await o({type:ot,payload:!1}),t){case"regular":o(ha(!0,r.product.id));break;case"upsell":o(hu(!0,r.product.id));break;case"subscribed":o(ha(!0,r.product.id)),o(J(r.product,"2_2"));break;default:}},"setPreview")});var xa={};E(xa,{ConnectedOffer:()=>Ea,Offer:()=>Or,default:()=>gu,mapStateToProps:()=>_a,productAndComponents:()=>ba});var ya,mu,ba,Or,_a,Ea,gu,Sa=p(()=>{O();ya=Ae(Bt());N();ga();I();Q();fe();We();mu=n((...t)=>JSON.stringify(t),"memoizeKey"),ba=(0,ya.default)((t,e)=>Object.assign({components:e},t),mu),Or=class extends z{static get properties(){return m(l({},super.properties),{config:{type:Object,attribute:!1},product:wi,productComponents:{type:Array,attribute:"product-components"},offerId:{type:String,attribute:!1},auth:Ge,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}})}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")}static get styles(){return C`
223
223
  :host[hidden] {
224
224
  display: none;
225
225
  }
@@ -296,7 +296,7 @@ var lib=(()=>{var Pa=Object.create;var Ye=Object.defineProperty;var Ra=Object.ge
296
296
  <og-optin-button>
297
297
  <og-text key="offerOptInLabel"></og-text>
298
298
  </og-optin-button>
299
- <og-tooltip placement="bottom">
299
+ <og-tooltip placement="top-right">
300
300
  <div slot="trigger">
301
301
  <og-text key="offerTooltipTrigger"></og-text>
302
302
  </div>
@@ -305,7 +305,7 @@ var lib=(()=>{var Pa=Object.create;var Ye=Object.defineProperty;var Ra=Object.ge
305
305
  </div>
306
306
  </og-tooltip>
307
307
  </div>
308
- <div style="margin-left: 2.2em">
308
+ <div style="margin-left: 1.5em">
309
309
  <og-text key="offerEveryLabel"></og-text>
310
310
  <og-select-frequency>
311
311
  <option value="3_1" selected>3 Days</option>
@@ -358,9 +358,9 @@ var lib=(()=>{var Pa=Object.create;var Ye=Object.defineProperty;var Ra=Object.ge
358
358
  The product is in your next upcomming order
359
359
  </og-when>
360
360
  </og-when>
361
- `}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{locale:r}=e;this.locale=r;let o=new CustomEvent("template-changed");this.dispatchEvent(o)}updated(e){if(e.has("preview")&&this.setPreview(this.preview,e.get("preview"),this),this.frequency=this.defaultFrequency,e.has("product")&&this.product.id&&!this.isPreview&&this.fetchOffer(this.product.id),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=ca(this.product,this.productComponents),o=Object.assign({},this.product,{components:e.get("productComponents")});N(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.product.id&&this.optinProduct&&!(this.optedin||[]).find(r=>N(r,this.product))&&this.optinProduct({...this.product,...this.productComponents.length&&{components:this.productComponents}},this.defaultFrequency)}get isPreview(){return this.preview}render(){return p`
361
+ `}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{locale:r}=e;this.locale=r;let o=new CustomEvent("template-changed");this.dispatchEvent(o)}updated(e){if(e.has("preview")&&this.setPreview(this.preview,e.get("preview"),this),this.frequency=this.defaultFrequency,e.has("product")&&this.product.id&&!this.isPreview&&this.fetchOffer(this.product.id),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=ba(this.product,this.productComponents),o=Object.assign({},this.product,{components:e.get("productComponents")});q(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.product.id&&this.optinProduct&&!(this.optedin||[]).find(r=>q(r,this.product))&&this.optinProduct(l(l({},this.product),this.productComponents.length&&{components:this.productComponents}),this.defaultFrequency)}get isPreview(){return this.preview}render(){return d`
362
362
  <slot></slot>
363
- `}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(Er,"Offer");la=n((t,e)=>({config:t.config,auth:t.auth,offerId:((t.productOffer||{})[(e.product||{}).id]||[])[0],productFrequency:ne(e.product)(t),productDefaultFrequency:Bt((e.product||{}).id)(t),...G(t,e,"autoshipByDefault",$r(t)[(e.product||{}).id]),...On(e.product)(t)&&{autoshipByDefault:!1},optedin:$t(t),subscribed:z(e.product)(t),...De(t)}),"mapStateToProps"),ua=m(la,{fetchOffer:Jr,fetchOrders:nt,productHasChangedComponents:Wr,optinProduct:Y,setFirstOrderPlaceDate:Zr,setProductToSubscribe:Xr,setPreview:sa})(Er),Jl=ua});var fa={};b(fa,{Modal:()=>Sr,default:()=>Kl});var Sr,Kl,ha=u(()=>{v();Sr=class extends E{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 T`
363
+ `}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(Or,"Offer");_a=n((t,e)=>l(m(l(l({config:t.config,auth:t.auth,offerId:((t.productOffer||{})[(e.product||{}).id]||[])[0],productFrequency:ie(e.product)(t),productDefaultFrequency:Wt((e.product||{}).id)(t)},Y(t,e,"autoshipByDefault",Gr(t)[(e.product||{}).id])),Fn(e.product)(t)&&{autoshipByDefault:!1}),{optedin:Gt(t),subscribed:W(e.product)(t)}),Ve(t)),"mapStateToProps"),Ea=y(_a,{fetchOffer:eo,fetchOrders:ct,productHasChangedComponents:Kr,optinProduct:J,setFirstOrderPlaceDate:ro,setProductToSubscribe:oo,setPreview:ma})(Or),gu=Ea});var va={};E(va,{Modal:()=>Tr,default:()=>yu});var Tr,yu,wa=p(()=>{O();Tr=class extends v{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 C`
364
364
  :host[hidden] {
365
365
  display: none;
366
366
  }
@@ -472,7 +472,7 @@ var lib=(()=>{var Pa=Object.create;var Ye=Object.defineProperty;var Ra=Object.ge
472
472
  .btn {
473
473
  cursor: pointer;
474
474
  }
475
- `}close(){this.removeAttribute("show"),this.dispatchEvent(new CustomEvent("close"))}confirm(){this.removeAttribute("show"),this.dispatchEvent(new CustomEvent("confirm"))}get confirmButton(){return this.showConfirmButton?p`
475
+ `}close(){this.removeAttribute("show"),this.dispatchEvent(new CustomEvent("close"))}confirm(){this.removeAttribute("show"),this.dispatchEvent(new CustomEvent("confirm"))}get confirmButton(){return this.showConfirmButton?d`
476
476
  <span @click="${()=>this.confirm()}">
477
477
  <slot name="confirm" class="btn">
478
478
  <button class="og-modal__btn og-modal__btn-primary og-modal__confirm" @click="${()=>this.confirm()}">
@@ -480,7 +480,7 @@ var lib=(()=>{var Pa=Object.create;var Ye=Object.defineProperty;var Ra=Object.ge
480
480
  </button>
481
481
  </slot>
482
482
  </span>
483
- `:p``}get cancelButton(){return this.showCancelButton?p`
483
+ `:d``}get cancelButton(){return this.showCancelButton?d`
484
484
  <span @click="${()=>this.close()}" class="btn">
485
485
  <slot name="cancel">
486
486
  <button class="og-modal__btn og-modal__cancel" @click="${()=>this.close()}">
@@ -488,7 +488,7 @@ var lib=(()=>{var Pa=Object.create;var Ye=Object.defineProperty;var Ra=Object.ge
488
488
  </button>
489
489
  </slot>
490
490
  </span>
491
- `:p``}render(){return this.show?p`
491
+ `:d``}render(){return this.show?d`
492
492
  <div class="og-modal is-open" aria-hidden="true">
493
493
  <div class="og-modal__overlay" tabindex="-1">
494
494
  <div class="og-modal__container" role="dialog" aria-modal="true">
@@ -507,7 +507,7 @@ var lib=(()=>{var Pa=Object.create;var Ye=Object.defineProperty;var Ra=Object.ge
507
507
  </div>
508
508
  </div>
509
509
  </div>
510
- `:p``}};n(Sr,"Modal");Kl=Sr});var ma={};b(ma,{Select:()=>vr,default:()=>Zl});var vr,Zl,ga=u(()=>{v();vr=class extends E{static get styles(){return T`
510
+ `:d``}};n(Tr,"Modal");yu=Tr});var Oa={};E(Oa,{Select:()=>Cr,default:()=>bu});var Cr,bu,Ta=p(()=>{O();Cr=class extends v{static get styles(){return C`
511
511
  :host {
512
512
  display: inline-block;
513
513
  color: inherit;
@@ -559,16 +559,16 @@ var lib=(()=>{var Pa=Object.create;var Ye=Object.defineProperty;var Ra=Object.ge
559
559
  color: inherit;
560
560
  fill: white;
561
561
  pointer-events: none;
562
- right: 0.3em;
562
+ right: 0.4em;
563
563
  top: 50%;
564
564
  z-index: 1;
565
565
  font-size: 1em;
566
566
  line-height: 0.2em;
567
567
  transform: scaleY(0.5);
568
568
  }
569
- `}static get properties(){return{options:{type:Array},selected:{type:String}}}render(){return p`
569
+ `}static get properties(){return{options:{type:Array},selected:{type:String}}}render(){return d`
570
570
  <select @change="${this.onChange}" .value="${this.selected}">
571
- ${this.options.map(e=>p`
571
+ ${this.options.map(e=>d`
572
572
  <option value="${e.value}" ?selected=${this.selected===e.value}>${e.text}</option>
573
573
  `)}
574
574
  </select>
@@ -577,7 +577,7 @@ var lib=(()=>{var Pa=Object.create;var Ye=Object.defineProperty;var Ra=Object.ge
577
577
  <path d="M10.5 15l7.5 7.5 7.5-7.5z" />
578
578
  <path d="M0 0h36v36h-36z" fill="none" />
579
579
  </svg> -->
580
- `}};n(vr,"Select");Zl=vr});var ya={};b(ya,{Tooltip:()=>wr,default:()=>Xl});var wr,Xl,ba=u(()=>{v();wr=class extends E{static get properties(){return{placement:{type:String,default:"bottom"}}}static get styles(){return T`
580
+ `}};n(Cr,"Select");bu=Cr});var Ca={};E(Ca,{Tooltip:()=>Pr,default:()=>_u});var Pr,_u,Pa=p(()=>{O();Pr=class extends v{static get properties(){return{placement:{type:String,default:"top"}}}static get styles(){return C`
581
581
  :host[hidden] {
582
582
  display: none;
583
583
  }
@@ -602,14 +602,12 @@ var lib=(()=>{var Pa=Object.create;var Ye=Object.defineProperty;var Ra=Object.ge
602
602
  display: block;
603
603
  width: 200px;
604
604
  opacity: 0;
605
- padding: var(--og-tooltip-padding, 0.5em);
606
- text-align: var(--og-tooltip-text-align, left);
605
+ padding: 0.5em;
607
606
  pointer-events: none;
608
607
  position: absolute;
609
608
  transform: translateY(10px);
610
609
  transition: transform 0.25s ease-out;
611
610
  z-index: 99999;
612
- border-radius: var(--og-tooltip-border-radius, 0);
613
611
  }
614
612
 
615
613
  .content:after {
@@ -726,20 +724,20 @@ var lib=(()=>{var Pa=Object.create;var Ye=Object.defineProperty;var Ra=Object.ge
726
724
  pointer-events: auto;
727
725
  transform: translateY(0px);
728
726
  }
729
- `}connectedCallback(){super.connectedCallback(),this.showTooltip=this.showTooltip.bind(this),this.addEventListener("mouseenter",this.showTooltip)}showTooltip(){let r=this.shadowRoot.querySelector(".trigger").getBoundingClientRect(),o=this.shadowRoot.querySelector(".content"),s=o.getBoundingClientRect();!this.placement||this.placement==="top"||this.placement==="bottom"?o.style.left=`${(-1*s.width+r.width)/2}px`:(this.placement==="left"||this.placement==="right")&&(o.style.top=`${(-1*s.height+r.height)/2}px`)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("mouseenter",this.showTooltip),this.removeEventListener("mouseout",this.hideTooltip)}render(){return p`
727
+ `}connectedCallback(){super.connectedCallback(),this.showTooltip=this.showTooltip.bind(this),this.addEventListener("mouseenter",this.showTooltip)}showTooltip(){let r=this.shadowRoot.querySelector(".trigger").getBoundingClientRect(),o=this.shadowRoot.querySelector(".content"),s=o.getBoundingClientRect();!this.placement||this.placement==="top"||this.placement==="bottom"?o.style.left=`${(-1*s.width+r.width)/2}px`:(this.placement==="left"||this.placement==="right")&&(o.style.top=`${(-1*s.height+r.height)/2}px`)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("mouseenter",this.showTooltip),this.removeEventListener("mouseout",this.hideTooltip)}render(){return d`
730
728
  <span class="tooltip">
731
729
  <span class="trigger">
732
730
  <slot name="trigger">
733
731
  ${this.trigger}
734
732
  </slot>
735
733
  </span>
736
- <div class="content ${this.placement||"bottom"}">
734
+ <div class="content ${this.placement||"top"}">
737
735
  <slot name="content">
738
736
  ${this.content}
739
737
  </slot>
740
738
  </div>
741
739
  </span>
742
- `}};n(wr,"Tooltip");Xl=wr});var _a={};b(_a,{TestWizard:()=>Tr,default:()=>eu});var Tr,eu,xa=u(()=>{v();k();Tr=class extends E{static get styles(){return T`
740
+ `}};n(Pr,"Tooltip");_u=Pr});var Ra={};E(Ra,{TestWizard:()=>Rr,default:()=>Eu});var Rr,Eu,Aa=p(()=>{O();I();Rr=class extends v{static get styles(){return C`
743
741
  :host {
744
742
  position: fixed;
745
743
  top: 5em;
@@ -797,11 +795,11 @@ var lib=(()=>{var Pa=Object.create;var Ye=Object.defineProperty;var Ra=Object.ge
797
795
  a {
798
796
  color: white;
799
797
  }
800
- `}runTests(){this.results=[],this.disabled=!0,this.requestUpdate(),document.querySelectorAll("og-offer").forEach(r=>{let o=r.store.getState(),s=r.getAttribute("product"),i=r.getAttribute("location"),a={messages:this.getOfferAttributeMessages(s,i).concat(this.getOfferRequestMessages(s,o)),product:s};this.results.push(a)}),this.testsRan=!0,this.disabled=!1,this.requestUpdate()}getOfferAttributeMessages(e,r){let o=[];return e||o.push({name:"Offer element found but missing product attribute",type:"error"}),r||o.push({name:"Offer element found but missing location attribute",type:"warning"}),e&&r&&o.push({name:"Offer element found and properly tagged",type:"success"}),o}getOfferRequestMessages(e,r){let o=r.inStock[e],s=r.autoshipEligible[e],i=[];return e&&o===!1&&i.push({name:"This product is marked as out of stock in the OG database",type:"warning"}),e&&s===!1&&i.push({name:"This product is not eligible for autoship",type:"warning"}),e&&o===null&&s===null&&i.push({name:"This product does not exist in our database",type:"error"}),i}resultsCodeBlock(){return this.results.length===0?p`
798
+ `}runTests(){this.results=[],this.disabled=!0,this.requestUpdate(),document.querySelectorAll("og-offer").forEach(r=>{let o=r.store.getState(),s=r.getAttribute("product"),i=r.getAttribute("location"),a={messages:this.getOfferAttributeMessages(s,i).concat(this.getOfferRequestMessages(s,o)),product:s};this.results.push(a)}),this.testsRan=!0,this.disabled=!1,this.requestUpdate()}getOfferAttributeMessages(e,r){let o=[];return e||o.push({name:"Offer element found but missing product attribute",type:"error"}),r||o.push({name:"Offer element found but missing location attribute",type:"warning"}),e&&r&&o.push({name:"Offer element found and properly tagged",type:"success"}),o}getOfferRequestMessages(e,r){let o=r.inStock[e],s=r.autoshipEligible[e],i=[];return e&&o===!1&&i.push({name:"This product is marked as out of stock in the OG database",type:"warning"}),e&&s===!1&&i.push({name:"This product is not eligible for autoship",type:"warning"}),e&&o===null&&s===null&&i.push({name:"This product does not exist in our database",type:"error"}),i}resultsCodeBlock(){return this.results.length===0?d`
801
799
  <div class="message error">No offer element found on the page</div>
802
- `:this.results.map((e,r)=>p`
800
+ `:this.results.map((e,r)=>d`
803
801
  <div>For offer tag with product = "${e.product}"</div>
804
- ${e.messages.map(o=>p`
802
+ ${e.messages.map(o=>d`
805
803
  <div class="message ${o.type}">
806
804
  ${o.name}
807
805
  </div>
@@ -830,13 +828,13 @@ var lib=(()=>{var Pa=Object.create;var Ye=Object.defineProperty;var Ra=Object.ge
830
828
  upsell product is in next order
831
829
  </button>
832
830
  <br />
833
- `)}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:s=["subscription","upsell"]}){return i=>{i.preventDefault();let a=document.querySelectorAll("og-offer")[e],c=a.product.id;a.store.dispatch(be({in_stock:{[c]:r},eligibility_groups:{[c]:s},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],s=o.product.id;r.preventDefault(),o.store.dispatch(Wt({count:1,next:null,previous:null,results:[{order:"24d50352579511ea806cbc764e100cfd",offer:null,subscription:"8a076b7a0ea011e7a5bcbc764e105eda",product:s,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 p`
831
+ `)}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:s=["subscription","upsell"]}){return i=>{i.preventDefault();let a=document.querySelectorAll("og-offer")[e],c=a.product.id;a.store.dispatch(Ee({in_stock:{[c]:r},eligibility_groups:{[c]:s},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],s=o.product.id;r.preventDefault(),o.store.dispatch(Kt({count:1,next:null,previous:null,results:[{order:"24d50352579511ea806cbc764e100cfd",offer:null,subscription:"8a076b7a0ea011e7a5bcbc764e105eda",product:s,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 d`
834
832
  <div>
835
- ${this.testsRan?this.resultsCodeBlock():p`
833
+ ${this.testsRan?this.resultsCodeBlock():d`
836
834
  <div>Click the button to run tests</div>
837
835
  `}
838
836
  <button ?disabled=${this.disabled} @click="${this.runTests.bind(this)}" class="primary">Run Test</button>
839
837
  </div>
840
- `}};n(Tr,"TestWizard");eu=Tr});function qo(){let t="og-test-wizard";customElements.get(t)||customElements.define(t,tu);let e=document.createElement(t);document.body.appendChild(e)}var tu,Ea=u(()=>{({TestWizard:tu}=(xa(),_a));n(qo,"default")});var va={};b(va,{default:()=>ru,enable:()=>Sa,keys:()=>Or});var Or,Sa,ru,wa=u(()=>{Ea();Or=[79,71,68,69,86],Sa=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===Or[t]){let o=Or[t];setTimeout(function(){t<=o&&(t=0)},5e3),t+=1,t>=Or.length&&qo()}else t=0},!1)},"enable"),ru=Sa});var Cu=K((ih,Oa)=>{var{offersLiveEditor:ou}=(Lo(),Do),{setStore:nu}=(R(),Wo),{getStore:su}=(Ss(),Es),{listenLocalStorageChanges:iu}=(Qt(),hs),Ta=(Ts(),ws),V=(k(),ps),{ConnectedWhen:au}=(fi(),di),{ConnectedOptinButton:cu}=(_i(),bi),{ConnectedOptoutButton:lu}=(Si(),Ei),{ConnectedOptinSelect:uu}=(Ci(),Oi),{ConnectedUpsellButton:pu}=(Ai(),Ri),{ConnectedUpsellModal:du}=(qi(),ki),{ConnectedOptinToggle:fu}=(Fi(),Ui),{ConnectedOptinStatus:hu}=(He(),gi),{ConnectedText:mu}=(Vi(),Mi),{ConnectedIncentiveText:gu}=(Qi(),Yi),{ConnectedSelectFrequency:yu}=(Zi(),Ki),{ConnectedNextUpcomingOrder:bu}=(oa(),ra),{ConnectedOffer:_u}=(da(),pa),{Modal:xu}=(ha(),fa),{Select:Eu}=(ga(),ma),{Tooltip:Su}=(ba(),ya),{ConnectedFrequencyStatus:vu}=(mr(),wi),wu=(wa(),va),{default:Tu}=(oe(),vn),{environment:Ou}=(zr(),Zn);wu.enable();var A,w={setEnvironment(t){return A.dispatch(V.setEnvironment(t)),w},setMerchantId(t){return A.dispatch(V.setMerchantId(t)),w},setAuthUrl(t){return A.dispatch(V.setAuthUrl(t)),w},getProductsForPurchasePost(t=[]){return Ta.getProductsForPurchasePost(A.getState(),t)},getOptins(t=[]){return Ta.getProductsForPurchasePost(A.getState(),t)},clear(){A.dispatch(V.checkout())},addOptinChangedCallback(t){typeof t=="function"&&document.addEventListener("optin-changed",e=>t(e.detail))},disableOptinChangedCallbacks(){document.addEventListener("optin-changed",t=>t.stopPropagation(),!0)},register(){try{customElements.define("og-when",au),customElements.define("og-text",mu),customElements.define("og-incentive-text",gu),customElements.define("og-offer",_u),customElements.define("og-select-frequency",yu),customElements.define("og-optout-button",lu),customElements.define("og-optin-toggle",fu),customElements.define("og-optin-status",hu),customElements.define("og-optin-button",cu),customElements.define("og-optin-select",uu),customElements.define("og-upsell-button",pu),customElements.define("og-frequency-status",vu),customElements.define("og-modal",xu),customElements.define("og-select",Eu),customElements.define("og-tooltip",Su),customElements.define("og-upsell-modal",du),customElements.define("og-next-upcoming-order",bu)}catch(t){console.log("this?",t)}w.register=()=>0},previewMode(t){return window.og=window.og||{},t===!1?delete window.og:window.og.previewMode=!0,this},initialize(t,e,r){if(w.isReady)return console.warn("og.offers has been initialized already. Skipping."),w;A=su();let o=window.og_settings;if(t&&e&&o){let s=[];o.product?s.push(o.product):o.cart&&Array.isArray(o.cart.products)&&(s=s.concat(o.cart.products));let{apiUrl:i}=Ou({},V.setEnvironment(e)),{sessionId:a}=A.getState();a&&s.forEach(c=>Tu.fetchOffer(i,t,a,`${c}`,"pdp"))}return nu(A),t&&w.setMerchantId(t),e&&w.setEnvironment(e),r&&w.setAuthUrl(r),window.addEventListener("storage",iu(A)),t&&e&&(A.dispatch(V.requestSessionId()),A.dispatch(V.fetchAuth()),w.register()),w.isReady=!0,w},config(t){return A.dispatch(V.setConfig(t)),w},setLocale(t){return A.dispatch(V.setLocale(t)),w},addTemplate(t,e,r){return A.dispatch(V.addTemplate(t,e,r)),w},setTemplates(t){return A.dispatch(V.setTemplates(t)),w},setPublicPath(t){return w}};window.OG=window.OG||{};Object.assign(window.OG,w);Object.assign(w.initialize,w);ou();Oa.exports=w.initialize});return Cu();})();
838
+ `}};n(Rr,"TestWizard");Eu=Rr});function Do(){let t="og-test-wizard";customElements.get(t)||customElements.define(t,xu);let e=document.createElement(t);document.body.appendChild(e)}var xu,Na=p(()=>{({TestWizard:xu}=(Aa(),Ra));n(Do,"default")});var qa={};E(qa,{default:()=>Su,enable:()=>ka,keys:()=>Ar});var Ar,ka,Su,Ia=p(()=>{Na();Ar=[79,71,68,69,86],ka=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===Ar[t]){let o=Ar[t];setTimeout(function(){t<=o&&(t=0)},5e3),t+=1,t>=Ar.length&&Do()}else t=0},!1)},"enable"),Su=ka});var Wu=X((Th,Fa)=>{var{offersLiveEditor:vu}=(Yo(),Wo),{setStore:wu}=(N(),on),{getStore:Ou}=(ks(),Ns),{listenLocalStorageChanges:Tu}=(Xt(),ws),Ua=(Us(),Is),B=(I(),xs),{ConnectedWhen:Cu}=(vi(),Si),{ConnectedOptinButton:Pu}=(Ri(),Pi),{ConnectedOptoutButton:Ru}=(ki(),Ni),{ConnectedOptinSelect:Au}=(Di(),Fi),{ConnectedUpsellButton:Nu}=(Mi(),ji),{ConnectedUpsellModal:ku}=(Bi(),$i),{ConnectedOptinToggle:qu}=(Gi(),zi),{ConnectedOptinStatus:Iu}=(Ye(),Ti),{ConnectedText:Uu}=(Ki(),Ji),{ConnectedIncentiveText:Fu}=(sa(),na),{ConnectedSelectFrequency:Du}=(ca(),aa),{ConnectedNextUpcomingOrder:Lu}=(fa(),da),{ConnectedOffer:ju}=(Sa(),xa),{Modal:Mu}=(wa(),va),{Select:Vu}=(Ta(),Oa),{Tooltip:$u}=(Pa(),Ca),{ConnectedFrequencyStatus:Bu}=(_r(),Ii),Hu=(Ia(),qa),{default:zu}=(se(),qn),{environment:Gu}=(Qr(),cs);Hu.enable();var k,T={setEnvironment(t){return k.dispatch(B.setEnvironment(t)),T},setMerchantId(t){return k.dispatch(B.setMerchantId(t)),T},setAuthUrl(t){return k.dispatch(B.setAuthUrl(t)),T},getProductsForPurchasePost(t=[]){return Ua.getProductsForPurchasePost(k.getState(),t)},getOptins(t=[]){return Ua.getProductsForPurchasePost(k.getState(),t)},clear(){k.dispatch(B.checkout())},addOptinChangedCallback(t){typeof t=="function"&&document.addEventListener("optin-changed",e=>t(e.detail))},disableOptinChangedCallbacks(){document.addEventListener("optin-changed",t=>t.stopPropagation(),!0)},register(){try{customElements.define("og-when",Cu),customElements.define("og-text",Uu),customElements.define("og-incentive-text",Fu),customElements.define("og-offer",ju),customElements.define("og-select-frequency",Du),customElements.define("og-optout-button",Ru),customElements.define("og-optin-toggle",qu),customElements.define("og-optin-status",Iu),customElements.define("og-optin-button",Pu),customElements.define("og-optin-select",Au),customElements.define("og-upsell-button",Nu),customElements.define("og-frequency-status",Bu),customElements.define("og-modal",Mu),customElements.define("og-select",Vu),customElements.define("og-tooltip",$u),customElements.define("og-upsell-modal",ku),customElements.define("og-next-upcoming-order",Lu)}catch(t){console.log("this?",t)}T.register=()=>0},previewMode(t){return window.og=window.og||{},t===!1?delete window.og:window.og.previewMode=!0,this},initialize(t,e,r){if(T.isReady)return console.warn("og.offers has been initialized already. Skipping."),T;k=Ou();let o=window.og_settings;if(t&&e&&o){let s=[];o.product?s.push(o.product):o.cart&&Array.isArray(o.cart.products)&&(s=s.concat(o.cart.products));let{apiUrl:i}=Gu({},B.setEnvironment(e)),{sessionId:a}=k.getState();a&&s.forEach(c=>zu.fetchOffer(i,t,a,`${c}`,"pdp"))}return wu(k),t&&T.setMerchantId(t),e&&T.setEnvironment(e),r&&T.setAuthUrl(r),window.addEventListener("storage",Tu(k)),t&&e&&(k.dispatch(B.requestSessionId()),k.dispatch(B.fetchAuth()),T.register()),T.isReady=!0,T},config(t){return k.dispatch(B.setConfig(t)),T},setLocale(t){return k.dispatch(B.setLocale(t)),T},addTemplate(t,e,r){return k.dispatch(B.addTemplate(t,e,r)),T},setTemplates(t){return k.dispatch(B.setTemplates(t)),T},setPublicPath(t){return T}};window.OG=window.OG||{};Object.assign(window.OG,T);Object.assign(T.initialize,T);vu();Fa.exports=T.initialize});return Wu();})();
841
839
  ; return lib; });
842
840
  //# sourceMappingURL=offers.js.map