/**
 * Minified by jsDelivr using Terser v5.39.0.
 * Original file: /npm/@ordergroove/offers@2.48.6/dist/offers.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
(e=>{"object"==typeof exports&&"object"==typeof module?module.exports=e():(window.og=window.og||{},window.og.offers=e())})((()=>(()=>{var e=Object.create,t=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,n=Object.getPrototypeOf,o=Object.prototype.hasOwnProperty,a=(e,r)=>t(e,"name",{value:r,configurable:!0}),s=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),l=(e,r)=>{for(var i in r)t(e,i,{get:r[i],enumerable:!0})},u=(e,n,a,s)=>{if(n&&"object"==typeof n||"function"==typeof n)for(let l of i(n))!o.call(e,l)&&l!==a&&t(e,l,{get:()=>n[l],enumerable:!(s=r(n,l))||s.enumerable});return e},c=(r,i,o)=>(o=null!=r?e(n(r)):{},u(!i&&r&&r.__esModule?o:t(o,"default",{value:r,enumerable:!0}),r)),d=s(((e,t)=>{var r,i;r=e,i=function(e){"use strict";function t(e,t,r,i){var n,o=!1,s=0;function l(){n&&clearTimeout(n)}function u(){l(),o=!0}function c(){for(var u=arguments.length,c=new Array(u),d=0;d<u;d++)c[d]=arguments[d];var p=this,h=Date.now()-s;function f(){s=Date.now(),r.apply(p,c)}function g(){n=void 0}o||(a(f,"exec"),a(g,"clear"),i&&!n&&f(),l(),void 0===i&&h>e?f():!0!==t&&(n=setTimeout(i?g:f,void 0===i?e-h:e)))}return a(l,"clearExistingTimeout"),a(u,"cancel"),"boolean"!=typeof t&&(i=r,r=t,t=void 0),a(c,"wrapper"),c.cancel=u,c}function r(e,r,i){return void 0===i?t(e,r,!1):t(e,i,!1!==r)}a(t,"throttle"),a(r,"debounce"),e.debounce=r,e.throttle=t,Object.defineProperty(e,"__esModule",{value:!0})},"object"==typeof e&&typeof t<"u"?i(e):"function"==typeof define&&define.amd?define(["exports"],i):i((r=r||self).throttleDebounce={})})),p=s(((e,t)=>{var r="__lodash_hash_undefined__",i=/^\[object .+?Constructor\]$/,n="object"==typeof window&&window&&window.Object===Object&&window,o="object"==typeof self&&self&&self.Object===Object&&self,s=n||o||Function("return this")();function l(e,t){return e?.[t]}function u(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch{}return t}a(l,"getValue"),a(u,"isHostObject");var c,d=Array.prototype,p=Function.prototype,h=Object.prototype,f=s["__core-js_shared__"],g=(c=/[^.]+$/.exec(f&&f.keys&&f.keys.IE_PROTO||""))?"Symbol(src)_1."+c:"",y=p.toString,m=h.hasOwnProperty,b=h.toString,v=RegExp("^"+y.call(m).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),_=d.splice,S=z(s,"Map"),w=z(Object,"create");function P(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}function O(){this.__data__=w?w(null):{}}function x(e){return this.has(e)&&delete this.__data__[e]}function E(e){var t=this.__data__;if(w){var i=t[e];return i===r?void 0:i}return m.call(t,e)?t[e]:void 0}function C(e){var t=this.__data__;return w?void 0!==t[e]:m.call(t,e)}function q(e,t){return this.__data__[e]=w&&void 0===t?r:t,this}function T(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}function k(){this.__data__=[]}function A(e){var t=this.__data__,r=U(t,e);return!(r<0)&&(r==t.length-1?t.pop():_.call(t,r,1),!0)}function I(e){var t=this.__data__,r=U(t,e);return r<0?void 0:t[r][1]}function N(e){return U(this.__data__,e)>-1}function F(e,t){var r=this.__data__,i=U(r,e);return i<0?r.push([e,t]):r[i][1]=t,this}function $(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}function R(){this.__data__={hash:new P,map:new(S||T),string:new P}}function D(e){return V(this,e).delete(e)}function j(e){return V(this,e).get(e)}function L(e){return V(this,e).has(e)}function M(e,t){return V(this,e).set(e,t),this}function U(e,t){for(var r=e.length;r--;)if(Y(e[r][0],t))return r;return-1}function B(e){return!(!Z(e)||H(e))&&(K(e)||u(e)?v:i).test(W(e))}function V(e,t){var r=e.__data__;return G(t)?r["string"==typeof t?"string":"hash"]:r.map}function z(e,t){var r=l(e,t);return B(r)?r:void 0}function G(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}function H(e){return!!g&&g in e}function W(e){if(null!=e){try{return y.call(e)}catch{}try{return e+""}catch{}}return""}function J(e,t){if("function"!=typeof e||t&&"function"!=typeof t)throw new TypeError("Expected a function");var r=a((function(){var i=arguments,n=t?t.apply(this,i):i[0],o=r.cache;if(o.has(n))return o.get(n);var a=e.apply(this,i);return r.cache=o.set(n,a),a}),"memoized");return r.cache=new(J.Cache||$),r}function Y(e,t){return e===t||e!=e&&t!=t}function K(e){var t=Z(e)?b.call(e):"";return"[object Function]"==t||"[object GeneratorFunction]"==t}function Z(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}a(P,"Hash"),a(O,"hashClear"),a(x,"hashDelete"),a(E,"hashGet"),a(C,"hashHas"),a(q,"hashSet"),P.prototype.clear=O,P.prototype.delete=x,P.prototype.get=E,P.prototype.has=C,P.prototype.set=q,a(T,"ListCache"),a(k,"listCacheClear"),a(A,"listCacheDelete"),a(I,"listCacheGet"),a(N,"listCacheHas"),a(F,"listCacheSet"),T.prototype.clear=k,T.prototype.delete=A,T.prototype.get=I,T.prototype.has=N,T.prototype.set=F,a($,"MapCache"),a(R,"mapCacheClear"),a(D,"mapCacheDelete"),a(j,"mapCacheGet"),a(L,"mapCacheHas"),a(M,"mapCacheSet"),$.prototype.clear=R,$.prototype.delete=D,$.prototype.get=j,$.prototype.has=L,$.prototype.set=M,a(U,"assocIndexOf"),a(B,"baseIsNative"),a(V,"getMapData"),a(z,"getNative"),a(G,"isKeyable"),a(H,"isMasked"),a(W,"toSource"),a(J,"memoize"),J.Cache=$,a(Y,"eq"),a(K,"isFunction"),a(Z,"isObject"),t.exports=J})),h=s(((e,t)=>{function r(e,t){var r,i,n,o,a,s,l,u;for(r=3&e.length,i=e.length-r,n=t,a=3432918353,s=461845907,u=0;u<i;)l=255&e.charCodeAt(u)|(255&e.charCodeAt(++u))<<8|(255&e.charCodeAt(++u))<<16|(255&e.charCodeAt(++u))<<24,++u,n=27492+(65535&(o=5*(65535&(n=(n^=l=(65535&(l=(l=(65535&l)*a+(((l>>>16)*a&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295)<<13|n>>>19))+((5*(n>>>16)&65535)<<16)&4294967295))+((58964+(o>>>16)&65535)<<16);switch(l=0,r){case 3:l^=(255&e.charCodeAt(u+2))<<16;case 2:l^=(255&e.charCodeAt(u+1))<<8;case 1:n^=l=(65535&(l=(l=(65535&(l^=255&e.charCodeAt(u)))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295}return n^=e.length,n=2246822507*(65535&(n^=n>>>16))+((2246822507*(n>>>16)&65535)<<16)&4294967295,n=3266489909*(65535&(n^=n>>>13))+((3266489909*(n>>>16)&65535)<<16)&4294967295,(n^=n>>>16)>>>0}a(r,"murmurhash3_32_gc"),typeof t<"u"&&(t.exports=r)})),f=s(((e,t)=>{function r(e,t){for(var r,i=e.length,n=t^i,o=0;i>=4;)r=1540483477*(65535&(r=255&e.charCodeAt(o)|(255&e.charCodeAt(++o))<<8|(255&e.charCodeAt(++o))<<16|(255&e.charCodeAt(++o))<<24))+((1540483477*(r>>>16)&65535)<<16),n=1540483477*(65535&n)+((1540483477*(n>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),i-=4,++o;switch(i){case 3:n^=(255&e.charCodeAt(o+2))<<16;case 2:n^=(255&e.charCodeAt(o+1))<<8;case 1:n=1540483477*(65535&(n^=255&e.charCodeAt(o)))+((1540483477*(n>>>16)&65535)<<16)}return n=1540483477*(65535&(n^=n>>>13))+((1540483477*(n>>>16)&65535)<<16),(n^=n>>>15)>>>0}a(r,"murmurhash2_32_gc"),void 0!==typeof t&&(t.exports=r)})),g=s(((e,t)=>{var r=h(),i=f();t.exports=r,t.exports.murmur3=r,t.exports.murmur2=i})),y=s(((e,t)=>{var r={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"};t.exports=r})),m=s(((e,t)=>{var r=y(),i=a((e=>{let t="",i=[];for(let n of e){let e=n.charCodeAt(0);switch(e){case r.PAR_OPEN:case r.PAR_CLOSE:case r.OP_NOT:case r.BINARY_AND:case r.BINARY_OR:t&&(i.push({type:r.LITERAL,value:t}),t=""),i.push({type:e,value:n});break;default:t+=n}}return t&&i.push({type:r.LITERAL,value:t}),i}),"Tokenizer");t.exports=i})),b=s(((e,t)=>{var r=y(),i=a((e=>{let t=[],i=[];return e.forEach((e=>{switch(e.type){case r.LITERAL:t.unshift(e);break;case r.BINARY_AND:case r.BINARY_OR:case r.OP_NOT:case r.PAR_OPEN:i.push(e);break;case r.PAR_CLOSE:for(;i.length&&i[i.length-1].type!==r.PAR_OPEN;)t.unshift(i.pop());i.pop(),i.length&&i[i.length-1].type===r.OP_NOT&&t.unshift(i.pop())}})),i.length&&[...i.reverse(),...t]||t}),"PolishNotation"),n=a((function*(e){for(let t=0;t<e.length-1;t++)yield e[t];return e[e.length-1]}),"PolishGenerator");t.exports={PolishNotation:i,PolishGenerator:n}})),v=s(((e,t)=>{var r=y(),i=class{constructor(e,t,r,i){this.op=e,this.left=t,this.right=r,this.literal=i}isLeaf(){return this.op===r.LEAF}isAtomic(){return this.isLeaf()||this.op===r.OP_NOT&&this.left.isLeaf()}getLiteralValue(){return this.literal}static CreateAnd(e,t){return new i(r.BINARY_AND,e,t)}static CreateNot(e){return new i(r.OP_NOT,e)}static CreateOr(e,t){return new i(r.BINARY_OR,e,t)}static CreateLiteral(e){return new i(r.LEAF,null,null,e)}};a(i,"ExpNode");var n=a((e=>{let t=e.next().value;switch(t.type){case r.LITERAL:return i.CreateLiteral(t.value);case r.OP_NOT:return i.CreateNot(n(e));case r.BINARY_AND:{let t=n(e),r=n(e);return i.CreateAnd(t,r)}case r.BINARY_OR:{let t=n(e),r=n(e);return i.CreateOr(t,r)}}return null}),"make"),o=a(((e,t)=>e.isLeaf()?t(e.getLiteralValue()):e.op===r.OP_NOT?!o(e.left,t):e.op===r.BINARY_OR?o(e.left,t)||o(e.right,t):e.op===r.BINARY_AND?o(e.left,t)&&o(e.right,t):void 0),"nodeEvaluator");t.exports={make:n,nodeEvaluator:o}})),_=s(((e,t)=>{var r=m(),i=b(),n=v(),o=a(((e,t)=>{let o=r(e),a=i.PolishNotation(o),s=i.PolishGenerator(a),l=n.make(s);return n.nodeEvaluator(l,t)}),"parse");t.exports={parse:o}})),S={};function w(e){var t,r=e.Symbol;return"function"==typeof r?r.observable?t=r.observable:(t=r("observable"),r.observable=t):t="@@observable",t}l(S,{addOptinChangedCallback:()=>pu,addTemplate:()=>hu,autoInit:()=>Iu,clear:()=>fu,config:()=>gu,default:()=>Nu,disableOptinChangedCallbacks:()=>yu,getOptins:()=>mu,getProductsForPurchasePost:()=>bu,initialize:()=>vu,isReady:()=>du,offers:()=>cu,platform:()=>ut,previewMode:()=>_u,register:()=>Su,resolveSettings:()=>wu,setAuthUrl:()=>Pu,setEnvironment:()=>Ou,setLocale:()=>xu,setMerchantId:()=>Eu,setPublicPath:()=>Cu,setTemplates:()=>qu,setupCart:()=>Tu,setupProduct:()=>ku,setupProducts:()=>Au,store:()=>uu}),a(w,"symbolObservablePonyfill");var P=w(typeof self<"u"?self:typeof window<"u"||typeof window<"u"?window:typeof module<"u"?module:Function("return this")()),O=a((function(){return Math.random().toString(36).substring(7).split("").join(".")}),"randomString"),x={INIT:"@@redux/INIT"+O(),REPLACE:"@@redux/REPLACE"+O(),PROBE_UNKNOWN_ACTION:a((function(){return"@@redux/PROBE_UNKNOWN_ACTION"+O()}),"PROBE_UNKNOWN_ACTION")};function E(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function C(e,t,r){var i;if("function"==typeof t&&"function"==typeof r||"function"==typeof r&&"function"==typeof arguments[3])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("function"==typeof t&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if("function"!=typeof r)throw new Error("Expected the enhancer to be a function.");return r(C)(e,t)}if("function"!=typeof e)throw new Error("Expected the reducer to be a function.");var n=e,o=t,s=[],l=s,u=!1;function c(){l===s&&(l=s.slice())}function d(){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 o}function p(e){if("function"!=typeof e)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 t=!0;return c(),l.push(e),a((function(){if(t){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.");t=!1,c();var r=l.indexOf(e);l.splice(r,1),s=null}}),"unsubscribe")}function h(e){if(!E(e))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(typeof e.type>"u")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,o=n(o,e)}finally{u=!1}for(var t=s=l,r=0;r<t.length;r++){(0,t[r])()}return e}function f(e){if("function"!=typeof e)throw new Error("Expected the nextReducer to be a function.");n=e,h({type:x.REPLACE})}function g(){var e,t=p;return(e={subscribe:a((function(e){if("object"!=typeof e||null===e)throw new TypeError("Expected the observer to be an object.");function r(){e.next&&e.next(d())}return a(r,"observeState"),r(),{unsubscribe:t(r)}}),"subscribe")})[P]=function(){return this},e}return a(c,"ensureCanMutateNextListeners"),a(d,"getState"),a(p,"subscribe"),a(h,"dispatch"),a(f,"replaceReducer"),a(g,"observable"),h({type:x.INIT}),(i={dispatch:h,subscribe:p,getState:d,replaceReducer:f})[P]=g,i}function q(e,t){var r=t&&t.type;return"Given "+(r&&'action "'+String(r)+'"'||"an action")+', reducer "'+e+'" 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 T(e){Object.keys(e).forEach((function(t){var r=e[t];if(typeof r(void 0,{type:x.INIT})>"u")throw new Error('Reducer "'+t+"\" 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:x.PROBE_UNKNOWN_ACTION()})>"u")throw new Error('Reducer "'+t+"\" returned undefined when probed with a random type. Don't try to handle "+x.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 k(e){for(var t=Object.keys(e),r={},i=0;i<t.length;i++){var n=t[i];"function"==typeof e[n]&&(r[n]=e[n])}var o,s=Object.keys(r);try{T(r)}catch(e){o=e}return a((function(e,t){if(void 0===e&&(e={}),o)throw o;for(var i=!1,n={},a=0;a<s.length;a++){var l=s[a],u=r[l],c=e[l],d=u(c,t);if(typeof d>"u"){var p=q(l,t);throw new Error(p)}n[l]=d,i=i||d!==c}return(i=i||s.length!==Object.keys(e).length)?n:e}),"combination")}function A(e,t){return function(){return t(e.apply(this,arguments))}}function I(e,t){if("function"==typeof e)return A(e,t);if("object"!=typeof e||null===e)throw new Error("bindActionCreators expected an object or a function, instead received "+(null===e?"null":typeof e)+'. Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?');var r={};for(var i in e){var n=e[i];"function"==typeof n&&(r[i]=A(n,t))}return r}function N(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function F(e,t){var r=Object.keys(e);return Object.getOwnPropertySymbols&&r.push.apply(r,Object.getOwnPropertySymbols(e)),t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r}function $(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?F(r,!0).forEach((function(t){N(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):F(r).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function R(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return 0===t.length?function(e){return e}:1===t.length?t[0]:t.reduce((function(e,t){return function(){return e(t.apply(void 0,arguments))}}))}function D(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(e){return function(){var r=e.apply(void 0,arguments),i=a((function(){throw new Error("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")}),"dispatch"),n={getState:r.getState,dispatch:a((function(){return i.apply(void 0,arguments)}),"dispatch")},o=t.map((function(e){return e(n)}));return $({},r,{dispatch:i=R.apply(void 0,o)(r.dispatch)})}}}function j(e){return a((function(t){var r=t.dispatch,i=t.getState;return function(t){return function(n){return"function"==typeof n?n(r,i,e):t(n)}}}),"middleware")}a(E,"isPlainObject"),a(C,"createStore"),a(q,"getUndefinedStateErrorMessage"),a(T,"assertReducerShape"),a(k,"combineReducers"),a(A,"bindActionCreator"),a(I,"bindActionCreators"),a(N,"_defineProperty"),a(F,"ownKeys"),a($,"_objectSpread2"),a(R,"compose"),a(D,"applyMiddleware"),a(j,"createThunkMiddleware");var L=j();L.withExtraArgument=j;var M=L,U=c(d()),B=/^og_auth=/,V=a(((e=B)=>(document.cookie.split(/;\s*/).find((t=>t.match(e)))||"").replace(B,"")),"c"),z=a((e=>{if("object"==typeof e)return e;let t=String(e||"").split("|");return 3===t.length?{sig_field:t[0],ts:parseInt(t[1],10),sig:t[2]}:null}),"r"),G=a((e=>new Promise(((t,r)=>{let i=document.createElement("iframe");i.style.setProperty("display","none","important"),document.body.appendChild(i),i.onload=t,i.onerror=r,i.src=e}))),"p"),H=a((e=>-1!==(e.headers.get("content-type")||"").indexOf("application/json")),"d");function W(){return typeof window.og_auth<"u"?z(window.og_auth):null}async function J(e=100){return new Promise((t=>{setTimeout((()=>t(W())),e)}))}async function Y(e,t=V,r=G){let i;if(i=z(W())||z(t()),i)return i;if(e&&"string"==typeof e){let n=await fetch(e);n.status>=200&&n.status<300&&(i=t()||await(H(n)?n.json():Promise.resolve(r(e)).then(t)))}else i||(i=await J());if(i=z(i),i)return i;throw new Error("Unauthorized")}a(W,"a"),a(J,"f"),a(Y,"u");var K="OPTIN_PRODUCT",Z="OPTOUT_PRODUCT",Q="PRODUCT_CHANGE_FREQUENCY",X="PRODUCT_CHANGE_PREPAID_SHIPMENTS",ee="SET_MERCHANT_ID",te="REQUEST_OFFER",re="RECEIVE_OFFER",ie="PRODUCT_HAS_CHANGED",ne="CREATED_SESSION_ID",oe="SET_AUTH_URL",ae="AUTHORIZE",se="UNAUTHORIZED",le="RECEIVE_ORDERS",ue="CART_PRODUCT_KEY_HAS_CHANGED",ce="RECEIVE_ORDER_ITEMS",de="SET_ENVIRONMENT_LOCAL",pe="SET_ENVIRONMENT_STAGING",he="SET_ENVIRONMENT_DEV",fe="SET_ENVIRONMENT_PROD",ge="READY",ye="CREATE_ONE_TIME",me="CONVERT_ONE_TIME",be="CHECKOUT",ve="SET_LOCALE",_e="SET_CONFIG",Se="SET_PREVIEW_STANDARD_OFFER",we="SET_PREVIEW_UPSELL_OFFER",Pe="ADD_TEMPLATE",Oe="SET_TEMPLATES",xe="LOCAL_STORAGE_CHANGE",Ee="LOCAL_STORAGE_CLEAR",Ce="SET_FIRST_ORDER_PLACE_DATE",qe="SET_PRODUCT_TO_SUBSCRIBE",Te="RECEIVE_PRODUCT_PLANS",ke="SETUP_PRODUCT",Ae="SETUP_CART",Ie="RECEIVE_MERCHANT_SETTINGS",Ne="SET_EXPERIMENT_VARIANT",Fe="pdp",$e="staging",Re="prod",De="static.ordergroove.com",je="staging.static.ordergroove.com",Le="PSI",Me="PROGRAM_WIDE",Ue="prepaid",Be=c(p()),Ve=a(((...e)=>JSON.stringify(e)),"memoizeKey"),ze=a((e=>(...t)=>fetch(...e(...t)).then((e=>e.json()))),"withFetchJson"),Ge=a((e=>(t,...r)=>{if(!t)throw Error("host required");let[i,n={}]=e(...r);return[`${t.replace(/\/+$/,"")}${i}`,n]}),"withHost"),He=a((e=>(t,...r)=>{if(!t)throw Error("auth required");let[i,n={}]=e(...r);return[i,{...n,headers:{Authorization:JSON.stringify(t),...n.headers}}]}),"withAuth"),We=a((e=>(...t)=>{let[r,i={}]=e(...t);return[r,{method:"POST",...i,body:JSON.stringify(i.body),headers:{"Content-type":"application/json",...i.headers}}]}),"withJsonBody"),Je=a(((e=[])=>(Array.isArray(e)?e:Object.entries(e)).map((([e,t])=>[e,encodeURIComponent(t)].join("="))).join("&")),"toQuery"),Ye=a((e=>JSON.stringify([].concat(e).map((e=>"object"==typeof e?e.id:e)).filter((e=>e)))),"toProductId"),Ke=(0,Be.default)(ze(Ge(((e,t,r,i="pdp",n={})=>{if(!e)throw Error("merchantId required");if(!t)throw Error("sessionId required");if(!r)throw Error("product required");let o=[["session_id",t],["page_type",1],["p",Ye(r)],["module_view",JSON.stringify(["regular"])],...Object.entries(n)];return[`/offer/${e}/${i}?${Je(o)}`]}))),Ve),Ze=(0,Be.default)(ze(Ge(He(((e=1,t="place")=>[`/orders/?${Je([["status",e],["ordering",t],["exclude_prepaid_orders","true"]])}`])))),Ve),Qe=(0,Be.default)(ze(Ge(He((e=>{if(!e)throw Error("orderId required");return[`/items/?order=${e}`]})))),Ve),Xe=ze(Ge(He(We(((e,t,r,i)=>{if(!e)throw Error("product required");if(!t)throw Error("order required");if(!r)throw Error("quantity required");if(r<=0)throw Error("quantity must be greater or equal than one");if(!i)throw Error("offer required");return["/items/iu/",{body:{product:e,order:t,quantity:r,offer:i}}]}))))),et=a((e=>{if("object"==typeof e)return{...e};let[t,r]=(e||"").split(/_/).map((e=>parseInt(e,10)));return t&&r&&{every:t,every_period:r}}),"parseFrequency"),tt=a((e=>e.match(/^\d+_\d$/)),"isFrequencyValid"),rt=a(((e,t)=>String.prototype.localeCompare.call(e&&e.split("_").reverse().join("_"),t&&t.split("_").reverse().join("_"))),"compareFrequencies"),it=a((e=>[...new Set(e&&e.split(/\s+/))].filter(tt).sort(rt)),"parseFrequenciesList"),nt=a((e=>{if("object"==typeof e){let{every:t,period:r,every_period:i}=e;return`${t}_${r||i}`}return"string"==typeof e?e:""}),"stringifyFrequency"),ot=ze(Ge(He(We(((e,t,r,i)=>{if(!e)throw Error("item required");if(!t)throw Error("frequency required");let n=et(t);if(!n)throw Error("invalid frequency");return["/subscriptions/create_from_item/",{body:{item:e.public_id,offer:r,session_id:i,...n}}]}))))),at={fetchOffer:Ke,fetchOrders:Ze,fetchItems:Qe,createOneTime:Xe,convertOneTimeToSubscription:ot},st=at,lt=sr(),ut={shopify:void 0!==window.Shopify,shopify_selling_plans:void 0!==(null==lt?void 0:lt.dataset.shopifySellingPlans)};function ct(e,t){return e===t}function dt(e,t,r){if(null===t||null===r||t.length!==r.length)return!1;for(var i=t.length,n=0;n<i;n++)if(!e(t[n],r[n]))return!1;return!0}function pt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ct,r=null,i=null;return function(){return dt(t,r,arguments)||(i=e.apply(null,arguments)),r=arguments,i}}function ht(e){var t=Array.isArray(e[0])?e[0]:e;if(!t.every((function(e){return"function"==typeof e}))){var r=t.map((function(e){return typeof e})).join(", ");throw new Error("Selector creators expect all input-selectors to be functions, instead received the following types: ["+r+"]")}return t}function ft(e){for(var t=arguments.length,r=Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];return function(){for(var t=arguments.length,i=Array(t),n=0;n<t;n++)i[n]=arguments[n];var o=0,a=i.pop(),s=ht(i),l=e.apply(void 0,[function(){return o++,a.apply(null,arguments)}].concat(r)),u=e((function(){for(var e=[],t=s.length,r=0;r<t;r++)e.push(s[r].apply(null,arguments));return l.apply(null,e)}));return u.resultFunc=a,u.dependencies=s,u.recomputations=function(){return o},u.resetRecomputations=function(){return o=0},u}}a(ct,"defaultEqualityCheck"),a(dt,"areArgumentsShallowlyEqual"),a(pt,"defaultMemoize"),a(ht,"getDependencies"),a(ft,"createSelectorCreator");var gt=ft(pt),yt=c(p()),mt=a(((e,t)=>null===e?"":new Intl.NumberFormat(navigator.language,{style:"currency",currency:t}).format(e/100)),"money"),bt=a((e=>`${e}%`),"percentage"),vt=a(((e=[])=>e.find(wt)||e.find(St)||e.find(Pt)),"getPayAsYouGoSellingPlanGroup"),_t=a(((e=[])=>e.filter((e=>St(e)||wt(e)||Pt(e)))),"getPayAsYouGoSellingPlanGroups"),St=a((e=>"Subscribe and Save"===e.name||"ordergroove-subscribe-and-save"===e.app_id),"isDefaultSellingPlanGroup"),wt=a((e=>e.name.startsWith("og_psfl")||"ordergroove-product-specific-frequency-list"===e.app_id),"isProductSpecificFrequencySellingPlanGroup"),Pt=a((e=>{var t;return null==(t=e.app_id)?void 0:t.startsWith("ordergroove-subscribe-and-save-")}),"isExperimentSellingPlanGroup"),Ot=a((e=>{let t=vt(e.map((e=>e.group)));return e.find((e=>e.group===t))}),"getPayAsYouGoSellingPlan");function xt(e){var t;return null==(t=null==e?void 0:e.selling_plans)?void 0:t.map((({id:e})=>`${e}`))}function Et(e){var t;return null==(t=null==e?void 0:e.selling_plans)?void 0:t.map((({options:e})=>e||[])).flat().map((({value:e})=>Ct(e)))}function Ct(e){let t=["day","week","month"].findIndex((t=>e.toLowerCase().includes(t)))+1,r=(e.match(/(\d+)/)||["",1])[1];return r&&t?`${r}_${t}`:null}function qt(e){var t;let r=null==(t=null==e?void 0:e.options.find((({name:e})=>"Shipment amount"===e)))?void 0:t.value.split(" ")[0];return r?Number(r):void 0}function Tt(e){return e[1]||e[0]}function kt(e,t){if(e===t)return!0;if(null===e||null===t||e.length!==t.length)return!1;for(let r=0;r<e.length;++r)if(e[r]!==t[r])return!1;return!0}function At(e,t,r){let i=nt(r);return ut.shopify_selling_plans?br(e,t,i):i}a(xt,"sellingPlansToFrequencies"),a(Et,"sellingPlansToEveryPeriod"),a(Ct,"textToFreq"),a(qt,"getPrepaidShipments"),a(Tt,"getDefaultPrepaidOption"),yt.default.Cache=Map,a(kt,"arraysEqual"),a(At,"resolveFrequency");var It=a(((e,t)=>!(e!==t&&("object"!=typeof e||"object"!=typeof t||!e||!t||e.id!==t.id||Array.isArray(e.components)&&Array.isArray(t.components)&&!kt((e.components||[]).sort(),(t.components||[]).sort())))),"isSameProduct"),Nt=a((e=>e.optedin||[]),"optedinSelector"),Ft=a((e=>e.optedout||[]),"optedoutSelector"),$t=a((e=>e.autoshipByDefault||{}),"autoshipSelector"),Rt=a((e=>e.defaultFrequencies||{}),"defaultFrequenciesSelector"),Dt=a((e=>{var t;return(null==(t=null==e?void 0:e.config)?void 0:t.prepaidSellingPlans)||[]}),"prepaidSellingPlansSelector"),jt=a((e=>(null==e?void 0:e.prepaidShipmentsSelected)||{}),"prepaidShipmentsSelectedSelector"),Lt=(0,yt.default)((e=>gt(Nt,Ft,$t,((t,r,i)=>t.find((t=>It(e,t)))||!r.find((t=>It(e,t)))&&(!(!e||!i[e.id])&&{id:e.id})))),(e=>JSON.stringify(e))),Mt=(0,yt.default)((e=>gt(Nt,(t=>t.find((t=>It(e,t)))||!1))),(e=>JSON.stringify(e))),Ut=(0,yt.default)((e=>gt(Nt,(t=>t.some((t=>It(e,t)&&t.prepaidShipments))))),(e=>JSON.stringify(e))),Bt=(0,yt.default)((e=>gt(jt,(t=>t[e.id]||null))),(e=>JSON.stringify(e))),Vt=(0,yt.default)((e=>gt(Ft,(t=>t.find((t=>It(e,t))))))),zt=(0,yt.default)((e=>gt(Lt(e),(e=>e&&"frequency"in e&&e.frequency||null))),(e=>JSON.stringify(e))),Gt=(0,yt.default)((e=>gt(Lt(e),(e=>e&&"prepaidShipments"in e&&e.prepaidShipments||null))),(e=>JSON.stringify(e))),Ht=(0,yt.default)((e=>gt(Dt,(t=>{var r;return((null==(r=t[ur(e)])?void 0:r.map((({numberShipments:e})=>e)))||[]).sort(((e,t)=>e-t))})))),Wt=(0,yt.default)((e=>gt(Rt,Kt(e),((t,{frequencies:r=[],frequenciesEveryPeriod:i=[]})=>t[ur(e)]&&At(r,i,t[ur(e)])||null)))),Jt=(0,yt.default)((e=>gt(Kt(e),(e=>e.frequencies)))),Yt=(0,yt.default)((e=>gt(Kt(e),(e=>e.defaultFrequency)))),Kt=(0,yt.default)((e=>gt((e=>{var t;return null==(t=null==e?void 0:e.config)?void 0:t.productFrequencies}),(e=>{var t;return null==(t=null==e?void 0:e.config)?void 0:t.frequencies}),(e=>{var t;return null==(t=null==e?void 0:e.config)?void 0:t.frequenciesEveryPeriod}),(e=>{var t;return null==(t=null==e?void 0:e.config)?void 0:t.frequenciesText}),(e=>{var t;return null==(t=null==e?void 0:e.config)?void 0:t.defaultFrequency}),((t,r,i,n,o)=>t?t[ur(e)]||{}:{frequencies:r,frequenciesEveryPeriod:i,frequenciesText:n,defaultFrequency:o})))),Zt=a(((e,t)=>gt(Dt,Kt(e.id),((r,{frequencies:i})=>{var n;if(t){let i=null==(n=r[ur(e.id)])?void 0:n.find((e=>e.numberShipments===t));return i?i.sellingPlan:null}return i[0]}))),"makeFrequencyForPrepaidShipmentsSelector"),Qt=a((e=>gt(Dt,(t=>t[ur(e)]||[]))),"makePrepaidSellingPlansSelector"),Xt=(0,yt.default)((e=>gt((e=>e.price||{}),(e=>e.incentives||{}),(e=>e.config.storeCurrency),((t,r,i)=>{let n=t[ur(e)];if(null==n||!i)return{};let o=n.value,a=o,s=o,l=r[ur(e)],u=null==l?void 0:l.initial.find(tr),c="";return u&&("Discount Percent"===u.type?(s=Math.round(o*(100-u.value)/100),c=bt(u.value)):"Discount Amount"===u.type&&"USD"===i&&(s=Math.max(0,o-Math.round(100*u.value)))),{regularPrice:mt(a,i),subscriptionPrice:mt(s,i),discountRate:c||mt(a-s,i)}})))),er=[Me,Le];function tr(e){return"item"===e.object&&("Discount Percent"===e.type||"Discount Amount"===e.type)&&e.criteria&&"PREMISE"===e.criteria.node_type&&er.includes(e.criteria.standard)}a(tr,"findRelevantIncentive");var rr=a((e=>e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase()),"kebabCase"),ir=a(((e,t,r)=>e&&e.hasAttribute&&e.hasAttribute(rr(t))&&e[t]||e.offer&&typeof("undefined"!==e.offer[t])&&e.offer[t]||r),"getFallbackValue"),nr=a((e=>({templates:e.templates||[]})),"templatesSelector"),or=a((e=>{let t=Object.values(e.productPlans).flat();return t.length>0&&t.every((e=>!1===e.hasPriceAdjustments||e.prepaidShipments))}),"isShopifyDiscountFunctionInUseSelector");function ar(e){"loading"===document.readyState?window.addEventListener("DOMContentLoaded",e):e()}function sr(){return document.querySelector([`script[src^="https://${De}"]`,`script[src^="https://${je}"]`,`script[src^="http://${De}"]`,`script[src^="http://${je}"]`].join(","))}function lr(){let e=sr();if(!e)return[];let t=new URL(e.src),r=t.host.startsWith($e)?$e:Re,i=t.pathname.split("/")[1];return r||i?[i,r,e]:[]}a(ar,"onReady"),a(sr,"getMainJs"),a(lr,"resolveEnvAndMerchant");var ur=a((e=>{var t;if(!e)return"";let r=`${e.id||e}`;return null!=(t=ut)&&t.shopify_selling_plans&&(r=r.split(":")[0]),r}),"safeProductId"),cr=a(((e,t,r)=>{if(ut.shopify_selling_plans){let i=null==t?void 0:t.indexOf(e);if(i>=0&&r[i])return r[i]}return e}),"safeOgFrequency"),dr=a(((e,t)=>{if(!`${e}`.includes("_"))return e;let{frequencies:r,frequenciesEveryPeriod:i}=t,n=null==i?void 0:i.indexOf(e);return n>=0&&i[n]?r[n]:(null==r?void 0:r.length)>0&&(null==i?void 0:i.length)>0?(console.warn(`Unable to find selling plan match for frequency ${e}; falling back to first selling plan`),r[0]):e}),"frequencyToSellingPlan");function pr(e){if(e.isReady())return;console.info("OG offers are auto initializing");let[t,r]=lr();if(!r&&!t)return;let i=document.createElement("script");i.onload=()=>console.info("OG pull initialization chunk for merchant",t,r),i.onerror=()=>e.initialize(t,r),i.src=`${window.location.protocol}//${r===Re?De:je}/${t}/main.js?initOnly=true`,document.head.appendChild(i)}a(pr,"autoInitializeOffers");var hr=a((e=>{document.cookie=`${e}=; expires=Thu, 01 Jan 1970 00:00:01 GMT;`}),"clearCookie");function fr(e){let t=document.cookie.match(`(^|;) ?${e}=([^;]*)(;|$)`);return t?t[2]:null}a(fr,"getCookieValue");var gr=a((e=>!(!e||!(null==e?void 0:e.includes("_")))),"isOgFrequency"),yr=a(((e=[])=>(null==e?void 0:e[0])||null),"getFirstSellingPlan"),mr=a(((e=[],t=[])=>{var r;return!!((null==(r=ut)?void 0:r.shopify_selling_plans)&&e.length&&t.length)}),"hasShopifySellingPlans"),br=a(((e,t,r)=>{if(e.length!==t.length)return null;let i=t.findIndex((e=>e===r));return i>=0?e[i]:null}),"mapFrequencyToSellingPlan");function vr(e,t,r){let i=e.querySelector(`[name="${t}"]`);!i||r?(!i&&r&&(i=document.createElement("input"),i.type="hidden",i.name=t,e.appendChild(i)),i&&(i.value=r)):i.remove()}function _r(e,t){let[[r],i]=e.reduce(((e,r)=>e[It(t,r)?0:1].push(r)&&e),[[],[]]);return[r||{},i||[]]}a(vr,"getOrCreateHidden"),a(_r,"getMatchingProductIfExists");var Sr=a(((e,t,r)=>({type:K,payload:{product:e,frequency:t,offer:r}})),"optinProduct"),wr=a(((e,t)=>({type:Z,payload:{product:e,offer:t}})),"optoutProduct"),Pr=a(((e,t)=>({type:ie,payload:{newProduct:e,product:t}})),"productHasChangedComponents"),Or=a(((e,t,r)=>({type:Q,payload:{product:e,frequency:t,offer:r}})),"productChangeFrequency"),xr=a(((e,t,r)=>(i,n)=>{let o=Zt(e,t)(n());i({type:X,payload:{product:e,prepaidShipments:t,offer:r,frequency:o}})}),"productChangePrepaidShipments"),Er=a((e=>({type:"CONCLUDE_UPSELL",payload:{product:e}})),"concludeUpsell"),Cr=a((e=>({type:ee,payload:e})),"setMerchantId"),qr=a((e=>({type:ne,payload:`${e}.${Math.floor(999999*Math.random())}.${Math.round((new Date).getTime()/1e3)}`})),"createSessionId"),Tr=a((e=>({type:"REQUEST_AUTH",payload:e})),"requestAuth"),kr=a(((e,t,r,i)=>({type:ae,payload:{public_id:e,sig_field:t,ts:r,sig:i}})),"authorize"),Ar=a((e=>({type:se,payload:e})),"unauthorized"),Ir=a((e=>({type:oe,payload:e})),"setAuthUrl"),Nr=a((e=>({type:"RECEIVE_FETCH",payload:e})),"fetchDone"),Fr=a(((e=Y)=>a((function(t,r){if(window.og&&window.og.previewMode)return t(Ar({message:"Offers are running in preview mode"}));let{merchantId:i,authUrl:n}=r(),o=Tr(n);return t(o),e(n).then((({sig_field:e,ts:r,sig:n})=>t(kr(i,e,r,n))),(e=>t(Ar(e)))).finally((()=>t(Nr(o))))}),"fetchAuthThunk")),"fetchAuth"),$r=a(((e,t)=>({type:"REQUEST_ORDERS",payload:{status:e,ordering:t}})),"requestOrders"),Rr=a((e=>({type:le,payload:e})),"receiveOrders"),Dr=a((e=>({type:ce,payload:e})),"receiveItems"),jr=a(((e=1,t="place")=>a((function(r,i){let{environment:{legoUrl:n},auth:o}=i();if(!o)return r(Ar("No auth set."));let a=$r(e,t);return r(a),at.fetchOrders(n,o,e,t).then((e=>{if(e.results){r(Rr(e));let t=(e.results[0]||{}).public_id;if(t)return at.fetchItems(n,o,t).then((e=>r(Dr(e))))}return r(Ar(e.detail)),null}),(e=>r(Ar(e)))).finally((()=>r(Nr(a))))}),"fetchOrdersThunk")),"fetchOrders"),Lr=a((e=>{switch(e){case"local":return{type:de,payload:e};case"dev":return{type:he,payload:e};case $e:return{type:pe,payload:e};case Re:return{type:fe,payload:e};default:throw new Error(`${e} is not a supported environment`)}}),"setEnvironment"),Mr=a((()=>(e,t)=>{let{merchantId:r,sessionId:i}=t();return(!i||r&&!i.startsWith(r))&&e(qr(r)),i}),"requestSessionId"),Ur=a(((e,t,r)=>(i,n)=>{let o=n(),a=Kt(r)(o),s=Qt(r)(o);i({type:re,payload:{...e,offer:t,frequencyConfig:a,prepaidSellingPlans:s}})}),"receiveOffer"),Br=a((e=>({type:"FETCH_RESPONSE_ERROR",payload:e})),"fetchResponseError"),Vr=a(((e,t=Fe,r)=>({type:te,payload:{product:e,module:t,offer:r}})),"requestOffer"),zr=Vr,Gr=a((()=>({type:be})),"checkout"),Hr=a(((e,t,r,i)=>({type:"REQUEST_CREATE_IU_ORDER",payload:{product:e,order:t,quantity:r,offerId:i}})),"requestCreateOneTime"),Wr=a((e=>({type:ye,payload:e})),"receiveCreateOneTime"),Jr=a(((e,t)=>({type:"REQUEST_CONVERT_ONE_TIME",payload:{item:e,frequency:t}})),"requestConvertOneTimeToSubscription"),Yr=a(((e,t)=>({type:me,payload:{response:e,product:t}})),"receiveConvertOneTime"),Kr=a(((e,t,r,i=!1,n=null)=>a((function(o,a){let s=a(),{auth:l,environment:{legoUrl:u},previewUpsellOffer:c,offerId:d,sessionId:p}=s;if(!l)return o(Ar("No auth set."));let{frequencies:h,frequenciesEveryPeriod:f}=Kt(e.id)(s),g=cr(n,h,f),y=Hr(e,t,r,d);return o(y),(c?Promise.resolve({legoUrl:u,product:e,order:t,quantity:r,offer:d}):at.createOneTime(u,l,e.id,t,r,d)).then((t=>(o(Wr(t)),i?(o(Jr(t,g)),(c?Promise.resolve({item:t,frequency:g}):at.convertOneTimeToSubscription(u,l,t,g,d,p)).then((t=>o(Yr(t,e))),(e=>o(Br(e))))):t)),(e=>o(Br(e)))).finally((()=>o(Nr(y))))}),"createIuThunk")),"createIu"),Zr=a((e=>({type:ve,payload:e})),"setLocale"),Qr=a((e=>({type:_e,payload:e})),"setConfig"),Xr=a(((e,t,r)=>({type:Pe,payload:{selector:e,markup:t,config:r}})),"addTemplate"),ei=a((e=>({type:Oe,payload:e})),"setTemplates"),ti=a(((e,t)=>({type:Ce,payload:{product:e,firstOrderPlaceDate:t}})),"setFirstOrderPlaceDate"),ri=a(((e,t)=>({type:qe,payload:{product:e,productToSubscribe:t}})),"setProductToSubscribe"),ii=a((e=>({type:Ie,payload:e})),"receiveMerchantSettings"),ni="OG_STATE",oi=a((e=>{try{return null===e?void 0:JSON.parse(e)}catch{return}}),"safeParseState"),ai=a((()=>window.og&&window.og.previewMode),"isPreviewMode"),si=a((()=>ai()?{}:oi(localStorage.getItem(ni))),"loadState"),li=a((e=>!(!e||!e.sessionId)&&JSON.stringify({sessionId:e.sessionId,optedin:e.optedin,optedout:e.optedout,productOffer:e.productOffer,firstOrderPlaceDate:e.firstOrderPlaceDate,productToSubscribe:e.productToSubscribe})),"serializeState"),ui=a((e=>{if(ai())return;e&&e.sessionId&&(document.cookie="og_session_id="+encodeURIComponent(e.sessionId)+"; path=/; expires=Fri, 31 Dec 9999 23:59:59 GMT; SameSite=Lax");let t=li(e);t&&localStorage.getItem(ni)!==t&&localStorage.setItem(ni,t)}),"saveState"),ci=a((e=>(0,U.throttle)(500,(t=>{if(ai())return;let{key:r,newValue:i}=t;r===ni&&null===i?(e.dispatch({type:Ee}),setTimeout((()=>e.dispatch(Mr())),0)):r===ni&&e.dispatch({type:xe,newValue:oi(i)})}))),"listenLocalStorageChanges"),di=c(d()),pi=a(((e,t,r=document)=>r.dispatchEvent(new CustomEvent(e,{detail:t}))),"dispatchEvent"),hi=a((e=>({payload:{product:{id:t,components:r}={}}={}}={})=>setTimeout((()=>pi("optin-changed",{productId:t,components:r,optedIn:e})),0)),"dispatchOptinChangedEvent"),fi=[{expressions:[({type:e}={})=>e===K,({type:e}={})=>e===Q],fn:hi(!0)},{expressions:[({type:e}={})=>e===Z],fn:hi(!1)}],gi=a((e=>t=>r=>{let i=e.getState();fi.forEach((e=>{e.expressions.some((e=>e(r,i)))&&e.fn(r)})),t(r)}),"dispatchMiddleware"),yi=a((e=>e=>t=>{var r;let i;switch(t.type){case re:case Z:case K:case Q:i=new CustomEvent(`og-${t.type.toLowerCase().replace(/_/g,"-")}`,{bubbles:!0,cancelable:!0,detail:t.payload}),((null==(r=t.payload)?void 0:r.offer)||document).dispatchEvent(i)}null!=i&&i.defaultPrevented||e(t)}),"offerEvents"),mi=a((e=>t=>r=>{t(r);let i=(0,di.throttle)(500,(()=>{ui({...e.getState()})}));r.type!==xe&&i()}),"localStorageMiddleware"),bi=a((()=>{let e,t;return[new Promise(((r,i)=>{e=r,t=i})),e,t]}),"waitFor");function vi(e){let[t,r]=bi(),[i,n]=bi(),[o,a]=bi();i.then((t=>{let{sessionId:r}=e.getState();!r||t&&!r.startsWith(t)?e.dispatch(qr(t)):a(r)}));let s=Promise.all([i,t,o]);return s.then((()=>{var t;e.dispatch({type:ge,payload:{}}),window.addEventListener("storage",ci(e)),null!=(t=e.getState().auth)&&t.ts||e.dispatch(Fr())})),e=>async t=>{de===t.type||he===t.type||pe===t.type||fe===t.type?r(t.payload):ee===t.type?n(t.payload):ne===t.type?a(t.payload):await s,e(t)}}function _i(e){return t=>r=>{if(r.type===te){let{merchantId:t,sessionId:i,environment:{apiUrl:n}}=e.getState(),o=ur(r.payload.product);o&&st.fetchOffer(n,t,i,o,r.payload.module||Fe,r.payload.searchParams).then((t=>e.dispatch(Ur(t,r.payload.offer,o))),(t=>e.dispatch(Br(t)))).finally((()=>e.dispatch(Nr(r))))}return t(r)}}a(vi,"waitUntilOffersReady"),a(_i,"offerRequestMiddleware");var Si=c(g());function wi(e,t){100!==t.map((e=>e.weight)).reduce(((e,t)=>e+t),0)&&console.error("OG: Sum of weights for variants must be 100. Defaulting to last variant.");let r=Si.default.murmur3(e,0)%100,i=0;for(let e=0;e<t.length;e++){let n=t[e],o=i+n.weight;if(n.weight>0&&r<o)return e;i=o}return t.length-1}function Pi(e={},t){var r;switch(t.type){case Ie:return{...e,...t.payload.experiments};case Ne:return{...e,currentVariant:t.payload.index,offerProfileId:null==(r=t.payload.parameters)?void 0:r.offer_profile_public_id};default:return e}}function Oi(e,t,r){if(!e||0===r.variants.length)return;let i=t.selling_plan_groups.filter(Pt);if(i.length!==r.variants.length)return;let n=i.find((({app_id:t})=>t.endsWith(e.public_id)));return n?{...t,selling_plan_groups:[n],variants:t.variants.map((({selling_plan_allocations:e,...t})=>({...t,selling_plan_allocations:e.filter((({selling_plan_group_id:e})=>e===n.id))})))}:void 0}function xi(e,t){let r=null==e?void 0:e.public_id;if(!r)return null;let i=e.variants,n=wi(`${r}|${t}`,i);return{...i[n],index:n}}function Ei(e){let t,r,[i,n]=bi();return o=>async a=>{if(a.type===ge)n();else if(a.type===Ie){await i,r=a.payload.experiments;let{sessionId:n}=e.getState();t=xi(r,n),t&&e.dispatch({type:Ne,payload:t})}else if(a.type===te)await i,t&&(a.payload.searchParams={...a.payload.searchParams,variant:t.public_id});else if(a.type===ke){await i;let e=Oi(t,a.payload.product,r);if(e)return o({type:ke,payload:{...a.payload,experiments:!0,originalPayload:a.payload,product:e}})}return o(a)}}function Ci(e,...t){if(window.og&&window.og.store)return window.og.store;let r=window.og&&window.og.previewMode,i="object"==typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({name:"Ordergroove Offers"}):R,n=[vi,M,Ei,_i,gi,yi],o={};if(!r)try{o=si(),n.push(mi)}catch{}let a=C(e,o,i(D(...n,...t.filter((e=>e)))));return window.og=window.og||{},window.og.store=a,a}a(wi,"getVariantIx"),a(Pi,"experimentsReducer"),a(Oi,"resolveShopifySetupProductWhenExperiment"),a(xi,"getAssignedExperimentVariant"),a(Ei,"experimentsMiddleware"),a(Ci,"makeStore");var qi=Object.defineProperty,Ti=a(((e,t)=>qi(e,"name",{value:t,configurable:!0})),"i"),ki=Ti((e=>t=>e.indexOf(t.origin)>=0),"createIsMessageAllowed"),Ai=["https://rc3.ordergroove.com","https://rc3.stg.ordergroove.com","https://rc3-beta.stg.ordergroove.com","http://localhost:3000","http://localhost:3010","http://0.0.0.0:3010",window.location.origin],Ii=Ti((e=>(t,r)=>{Ai.forEach((i=>e.postMessage({ogType:t,...r},i)))}),"createBroadcastMessage");function Ni(e=window.opener,t=window.og){let r=Ti((e=>{let i=ki(Ai),n=Ii(e.source),o=e.data.options||{};if(i(e)&&"READY"===e.data.ogType){let e="//static.ordergroove.com/@ordergroove/offers-live-editor/0.6.9/dist/";e.startsWith("//")&&(e=window.location.protocol+e),e.endsWith("/")||(e+="/"),import(`${e}client.js`).then((({initializeClient:e})=>{e({isMessageAllowed:i,broadcastMessage:n,options:o,og:t}),window.removeEventListener("message",r)}))}}),"handleReady");e&&e!==window&&(window.addEventListener("message",r),Ii(e)("READY"))}a(Ni,"h"),Ti(Ni,"offersLiveEditor");var Fi=null,$i=a((e=>({dispatch:e})),"defaultMapDispatchToProps"),Ri=a((e=>{if(!Fi)throw new Error("Missing redux store.");return Fi}),"resolveStore"),Di=a(((e,t)=>r=>{let{getState:i,dispatch:n}=Ri(r),o=e?e(i(),r):{},a=t(n,r);Object.assign(r,o,a)}),"createRecalcProps"),ji=a(((e,t=$i)=>r=>{let i=Di(e,"function"==typeof t?t:e=>I(t,e));return class extends r{get store(){return Fi}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this._storeUnsubscribe=Ri(this).subscribe((()=>i(this))),i(this)}attributeChangedCallback(e,t,r){super.attributeChangedCallback&&super.attributeChangedCallback(e,t,r),this._storeUnsubscribe&&t!==r&&i(this)}disconnectedCallback(){this._storeUnsubscribe(),super.disconnectedCallback&&super.disconnectedCallback()}}}),"connect"),Li=a((e=>{Fi=e}),"setStore"),Mi=a(((e={},t=[])=>(e.optedin||[]).map((t=>{let r={product:t.id,subscription_info:{components:t.components||[]},tracking_override:{offer:((e.productOffer||{})[t.id]||[])[0],...e.sessionId&&{session_id:e.sessionId},...et(t.frequency)}};return e.firstOrderPlaceDate&&e.firstOrderPlaceDate[t.id]&&(r.subscription_info.first_order_place_date=e.firstOrderPlaceDate[t.id]),e.productToSubscribe&&e.productToSubscribe[t.id]&&(r.tracking_override.product=e.productToSubscribe[t.id]),r})).filter((e=>e.tracking_override.offer)).filter((e=>t.length?t.includes(e.product):e))),"getProductsForPurchasePost"),Ui=a(((e={})=>{let t={};return Object.entries(e).forEach((([e,r])=>{Object.entries(r).forEach((([r,i])=>{let n={};n=i&&!Array.isArray(i)?i:{frequency:r,prepaidShipments:null,regularPrice:i[0],subscriptionPrice:i[2],discountRate:i[1]},t[e]?t[e].push(n):t[e]=[n]}))})),t}),"getObjectStructuredProductPlans"),Bi=typeof window<"u"&&null!=window.customElements&&void 0!==window.customElements.polyfillWrapFlushCallback,Vi=a(((e,t,r=null)=>{for(;t!==r;){let r=t.nextSibling;e.removeChild(t),t=r}}),"removeNodes"),zi=`{{lit-${String(Math.random()).slice(2)}}}`,Gi=`\x3c!--${zi}--\x3e`,Hi=new RegExp(`${zi}|${Gi}`),Wi="$lit$",Ji=class{constructor(e,t){this.parts=[],this.element=t;let r=[],i=[],n=document.createTreeWalker(t.content,133,null,!1),o=0,a=-1,s=0,{strings:l,values:{length:u}}=e;for(;s<u;){let e=n.nextNode();if(null!==e){if(a++,1===e.nodeType){if(e.hasAttributes()){let t=e.attributes,{length:r}=t,i=0;for(let e=0;e<r;e++)Yi(t[e].name,Wi)&&i++;for(;i-- >0;){let t=l[s],r=Qi.exec(t)[2],i=r.toLowerCase()+Wi,n=e.getAttribute(i);e.removeAttribute(i);let o=n.split(Hi);this.parts.push({type:"attribute",index:a,name:r,strings:o}),s+=o.length-1}}"TEMPLATE"===e.tagName&&(i.push(e),n.currentNode=e.content)}else if(3===e.nodeType){let t=e.data;if(t.indexOf(zi)>=0){let i=e.parentNode,n=t.split(Hi),o=n.length-1;for(let t=0;t<o;t++){let r,o=n[t];if(""===o)r=Zi();else{let e=Qi.exec(o);null!==e&&Yi(e[2],Wi)&&(o=o.slice(0,e.index)+e[1]+e[2].slice(0,-5)+e[3]),r=document.createTextNode(o)}i.insertBefore(r,e),this.parts.push({type:"node",index:++a})}""===n[o]?(i.insertBefore(Zi(),e),r.push(e)):e.data=n[o],s+=o}}else if(8===e.nodeType)if(e.data===zi){let t=e.parentNode;(null===e.previousSibling||a===o)&&(a++,t.insertBefore(Zi(),e)),o=a,this.parts.push({type:"node",index:a}),null===e.nextSibling?e.data="":(r.push(e),a--),s++}else{let t=-1;for(;-1!==(t=e.data.indexOf(zi,t+1));)this.parts.push({type:"node",index:-1}),s++}}else n.currentNode=i.pop()}for(let e of r)e.parentNode.removeChild(e)}};a(Ji,"Template");var Yi=a(((e,t)=>{let r=e.length-t.length;return r>=0&&e.slice(r)===t}),"endsWith"),Ki=a((e=>-1!==e.index),"isTemplatePartActive"),Zi=a((()=>document.createComment("")),"createMarker"),Qi=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;function Xi(e,t){let{element:{content:r},parts:i}=e,n=document.createTreeWalker(r,133,null,!1),o=tn(i),a=i[o],s=-1,l=0,u=[],c=null;for(;n.nextNode();){s++;let e=n.currentNode;for(e.previousSibling===c&&(c=null),t.has(e)&&(u.push(e),null===c&&(c=e)),null!==c&&l++;void 0!==a&&a.index===s;)a.index=null!==c?-1:a.index-l,o=tn(i,o),a=i[o]}u.forEach((e=>e.parentNode.removeChild(e)))}a(Xi,"removeNodesFromTemplate");var en=a((e=>{let t=11===e.nodeType?0:1,r=document.createTreeWalker(e,133,null,!1);for(;r.nextNode();)t++;return t}),"countNodes"),tn=a(((e,t=-1)=>{for(let r=t+1;r<e.length;r++){let t=e[r];if(Ki(t))return r}return-1}),"nextActiveIndexInTemplateParts");function rn(e,t,r=null){let{element:{content:i},parts:n}=e;if(null==r)return void i.appendChild(t);let o=document.createTreeWalker(i,133,null,!1),a=tn(n),s=0,l=-1;for(;o.nextNode();)for(l++,o.currentNode===r&&(s=en(t),r.parentNode.insertBefore(t,r));-1!==a&&n[a].index===l;){if(s>0){for(;-1!==a;)n[a].index+=s,a=tn(n,a);return}a=tn(n,a)}}a(rn,"insertNodeIntoTemplate");var nn=new WeakMap,on=a((e=>(...t)=>{let r=e(...t);return nn.set(r,!0),r}),"directive"),an=a((e=>"function"==typeof e&&nn.has(e)),"isDirective"),sn={},ln={},un=class{constructor(e,t,r){this.__parts=[],this.template=e,this.processor=t,this.options=r}update(e){let t=0;for(let r of this.__parts)void 0!==r&&r.setValue(e[t]),t++;for(let e of this.__parts)void 0!==e&&e.commit()}_clone(){let e,t=Bi?this.template.element.content.cloneNode(!0):document.importNode(this.template.element.content,!0),r=[],i=this.template.parts,n=document.createTreeWalker(t,133,null,!1),o=0,a=0,s=n.nextNode();for(;o<i.length;)if(e=i[o],Ki(e)){for(;a<e.index;)a++,"TEMPLATE"===s.nodeName&&(r.push(s),n.currentNode=s.content),null===(s=n.nextNode())&&(n.currentNode=r.pop(),s=n.nextNode());if("node"===e.type){let e=this.processor.handleTextExpression(this.options);e.insertAfterNode(s.previousSibling),this.__parts.push(e)}else this.__parts.push(...this.processor.handleAttributeExpressions(s,e.name,e.strings,this.options));o++}else this.__parts.push(void 0),o++;return Bi&&(document.adoptNode(t),customElements.upgrade(t)),t}};a(un,"TemplateInstance");var cn=window.trustedTypes&&trustedTypes.createPolicy("lit-html",{createHTML:e=>e}),dn=` ${zi} `,pn=class{constructor(e,t,r,i){this.strings=e,this.values=t,this.type=r,this.processor=i}getHTML(){let e=this.strings.length-1,t="",r=!1;for(let i=0;i<e;i++){let e=this.strings[i],n=e.lastIndexOf("\x3c!--");r=(n>-1||r)&&-1===e.indexOf("--\x3e",n+1);let o=Qi.exec(e);t+=null===o?e+(r?dn:Gi):e.substr(0,o.index)+o[1]+o[2]+Wi+o[3]+zi}return t+=this.strings[e],t}getTemplateElement(){let e=document.createElement("template"),t=this.getHTML();return void 0!==cn&&(t=cn.createHTML(t)),e.innerHTML=t,e}};a(pn,"TemplateResult");var hn=a((e=>null===e||!("object"==typeof e||"function"==typeof e)),"isPrimitive"),fn=a((e=>Array.isArray(e)||!(!e||!e[Symbol.iterator])),"isIterable"),gn=class{constructor(e,t,r){this.dirty=!0,this.element=e,this.name=t,this.strings=r,this.parts=[];for(let e=0;e<r.length-1;e++)this.parts[e]=this._createPart()}_createPart(){return new yn(this)}_getValue(){let e=this.strings,t=e.length-1,r=this.parts;if(1===t&&""===e[0]&&""===e[1]){let e=r[0].value;if("symbol"==typeof e)return String(e);if("string"==typeof e||!fn(e))return e}let i="";for(let n=0;n<t;n++){i+=e[n];let t=r[n];if(void 0!==t){let e=t.value;if(hn(e)||!fn(e))i+="string"==typeof e?e:String(e);else for(let t of e)i+="string"==typeof t?t:String(t)}}return i+=e[t],i}commit(){this.dirty&&(this.dirty=!1,this.element.setAttribute(this.name,this._getValue()))}};a(gn,"AttributeCommitter");var yn=class{constructor(e){this.value=void 0,this.committer=e}setValue(e){e!==sn&&(!hn(e)||e!==this.value)&&(this.value=e,an(e)||(this.committer.dirty=!0))}commit(){for(;an(this.value);){let e=this.value;this.value=sn,e(this)}this.value!==sn&&this.committer.commit()}};a(yn,"AttributePart");var mn=class{constructor(e){this.value=void 0,this.__pendingValue=void 0,this.options=e}appendInto(e){this.startNode=e.appendChild(Zi()),this.endNode=e.appendChild(Zi())}insertAfterNode(e){this.startNode=e,this.endNode=e.nextSibling}appendIntoPart(e){e.__insert(this.startNode=Zi()),e.__insert(this.endNode=Zi())}insertAfterPart(e){e.__insert(this.startNode=Zi()),this.endNode=e.endNode,e.endNode=this.startNode}setValue(e){this.__pendingValue=e}commit(){if(null===this.startNode.parentNode)return;for(;an(this.__pendingValue);){let e=this.__pendingValue;this.__pendingValue=sn,e(this)}let e=this.__pendingValue;e!==sn&&(hn(e)?e!==this.value&&this.__commitText(e):e instanceof pn?this.__commitTemplateResult(e):e instanceof Node?this.__commitNode(e):fn(e)?this.__commitIterable(e):e===ln?(this.value=ln,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 t=this.startNode.nextSibling,r="string"==typeof(e=e??"")?e:String(e);t===this.endNode.previousSibling&&3===t.nodeType?t.data=r:this.__commitNode(document.createTextNode(r)),this.value=e}__commitTemplateResult(e){let t=this.options.templateFactory(e);if(this.value instanceof un&&this.value.template===t)this.value.update(e.values);else{let r=new un(t,e.processor,this.options),i=r._clone();r.update(e.values),this.__commitNode(i),this.value=r}}__commitIterable(e){Array.isArray(this.value)||(this.value=[],this.clear());let t,r=this.value,i=0;for(let n of e)t=r[i],void 0===t&&(t=new mn(this.options),r.push(t),0===i?t.appendIntoPart(this):t.insertAfterPart(r[i-1])),t.setValue(n),t.commit(),i++;i<r.length&&(r.length=i,this.clear(t&&t.endNode))}clear(e=this.startNode){Vi(this.startNode.parentNode,e.nextSibling,this.endNode)}};a(mn,"NodePart");var bn=class{constructor(e,t,r){if(this.value=void 0,this.__pendingValue=void 0,2!==r.length||""!==r[0]||""!==r[1])throw new Error("Boolean attributes can only contain a single expression");this.element=e,this.name=t,this.strings=r}setValue(e){this.__pendingValue=e}commit(){for(;an(this.__pendingValue);){let e=this.__pendingValue;this.__pendingValue=sn,e(this)}if(this.__pendingValue===sn)return;let e=!!this.__pendingValue;this.value!==e&&(e?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=e),this.__pendingValue=sn}};a(bn,"BooleanAttributePart");var vn=class extends gn{constructor(e,t,r){super(e,t,r),this.single=2===r.length&&""===r[0]&&""===r[1]}_createPart(){return new _n(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}};a(vn,"PropertyCommitter");var _n=class extends yn{};a(_n,"PropertyPart");var Sn=!1;(()=>{try{let e={get capture(){return Sn=!0,!1}};window.addEventListener("test",e,e),window.removeEventListener("test",e,e)}catch{}})();var wn=class{constructor(e,t,r){this.value=void 0,this.__pendingValue=void 0,this.element=e,this.eventName=t,this.eventContext=r,this.__boundHandleEvent=e=>this.handleEvent(e)}setValue(e){this.__pendingValue=e}commit(){for(;an(this.__pendingValue);){let e=this.__pendingValue;this.__pendingValue=sn,e(this)}if(this.__pendingValue===sn)return;let e=this.__pendingValue,t=this.value,r=null==e||null!=t&&(e.capture!==t.capture||e.once!==t.once||e.passive!==t.passive),i=null!=e&&(null==t||r);r&&this.element.removeEventListener(this.eventName,this.__boundHandleEvent,this.__options),i&&(this.__options=Pn(e),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=e,this.__pendingValue=sn}handleEvent(e){"function"==typeof this.value?this.value.call(this.eventContext||this.element,e):this.value.handleEvent(e)}};a(wn,"EventPart");var Pn=a((e=>e&&(Sn?{capture:e.capture,passive:e.passive,once:e.once}:e.capture)),"getOptions");function On(e){let t=xn.get(e.type);void 0===t&&(t={stringsArray:new WeakMap,keyString:new Map},xn.set(e.type,t));let r=t.stringsArray.get(e.strings);if(void 0!==r)return r;let i=e.strings.join(zi);return r=t.keyString.get(i),void 0===r&&(r=new Ji(e,e.getTemplateElement()),t.keyString.set(i,r)),t.stringsArray.set(e.strings,r),r}a(On,"templateFactory");var xn=new Map,En=new WeakMap,Cn=a(((e,t,r)=>{let i=En.get(t);void 0===i&&(Vi(t,t.firstChild),En.set(t,i=new mn(Object.assign({templateFactory:On},r))),i.appendInto(t)),i.setValue(e),i.commit()}),"render"),qn=class{handleAttributeExpressions(e,t,r,i){let n=t[0];return"."===n?new vn(e,t.slice(1),r).parts:"@"===n?[new wn(e,t.slice(1),i.eventContext)]:"?"===n?[new bn(e,t.slice(1),r)]:new gn(e,t,r).parts}handleTextExpression(e){return new mn(e)}};a(qn,"DefaultTemplateProcessor");var Tn=new qn;typeof window<"u"&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.3.0");var kn=a(((e,...t)=>new pn(e,t,"html",Tn)),"html"),An=a(((e,t)=>`${e}--${t}`),"getTemplateCacheKey"),In=!0;typeof window.ShadyCSS>"u"?In=!1:typeof window.ShadyCSS.prepareTemplateDom>"u"&&(console.warn("Incompatible ShadyCSS version detected. Please update to at least @webcomponents/webcomponentsjs@2.0.2 and @webcomponents/shadycss@1.3.1."),In=!1);var Nn=a((e=>t=>{let r=An(t.type,e),i=xn.get(r);void 0===i&&(i={stringsArray:new WeakMap,keyString:new Map},xn.set(r,i));let n=i.stringsArray.get(t.strings);if(void 0!==n)return n;let o=t.strings.join(zi);if(n=i.keyString.get(o),void 0===n){let r=t.getTemplateElement();In&&window.ShadyCSS.prepareTemplateDom(r,e),n=new Ji(t,r),i.keyString.set(o,n)}return i.stringsArray.set(t.strings,n),n}),"shadyTemplateFactory"),Fn=["html","svg"],$n=a((e=>{Fn.forEach((t=>{let r=xn.get(An(t,e));void 0!==r&&r.keyString.forEach((e=>{let{element:{content:t}}=e,r=new Set;Array.from(t.querySelectorAll("style")).forEach((e=>{r.add(e)})),Xi(e,r)}))}))}),"removeStylesFromLitTemplates"),Rn=new Set,Dn=a(((e,t,r)=>{Rn.add(e);let i=r?r.element:document.createElement("template"),n=t.querySelectorAll("style"),{length:o}=n;if(0===o)return void window.ShadyCSS.prepareTemplateStyles(i,e);let a=document.createElement("style");for(let e=0;e<o;e++){let t=n[e];t.parentNode.removeChild(t),a.textContent+=t.textContent}$n(e);let s=i.content;r?rn(r,a,s.firstChild):s.insertBefore(a,s.firstChild),window.ShadyCSS.prepareTemplateStyles(i,e);let l=s.querySelector("style");if(window.ShadyCSS.nativeShadow&&null!==l)t.insertBefore(l.cloneNode(!0),t.firstChild);else if(r){s.insertBefore(a,s.firstChild);let e=new Set;e.add(a),Xi(r,e)}}),"prepareTemplateStyles"),jn=a(((e,t,r)=>{if(!r||"object"!=typeof r||!r.scopeName)throw new Error("The `scopeName` option is required.");let i=r.scopeName,n=En.has(t),o=In&&11===t.nodeType&&!!t.host,a=o&&!Rn.has(i),s=a?document.createDocumentFragment():t;if(Cn(e,s,Object.assign({templateFactory:Nn(i)},r)),a){let e=En.get(s);En.delete(s);let r=e.value instanceof un?e.value.template:void 0;Dn(i,s,r),Vi(t,t.firstChild),t.appendChild(s),En.set(t,e)}!n&&o&&window.ShadyCSS.styleElement(t.host)}),"render");window.JSCompiler_renameProperty=(e,t)=>e;var Ln={toAttribute(e,t){switch(t){case Boolean:return e?"":null;case Object:case Array:return null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){switch(t){case Boolean:return null!==e;case Number:return null===e?null:Number(e);case Object:case Array:return JSON.parse(e)}return e}},Mn=a(((e,t)=>t!==e&&(t==t||e==e)),"notEqual"),Un={attribute:!0,type:String,converter:Ln,reflect:!1,hasChanged:Mn},Bn="finalized",Vn=class extends HTMLElement{constructor(){super(),this.initialize()}static get observedAttributes(){this.finalize();let e=[];return this._classProperties.forEach(((t,r)=>{let i=this._attributeNameForProperty(r,t);void 0!==i&&(this._attributeToPropertyMap.set(i,r),e.push(i))})),e}static _ensureClassProperties(){if(!this.hasOwnProperty(JSCompiler_renameProperty("_classProperties",this))){this._classProperties=new Map;let e=Object.getPrototypeOf(this)._classProperties;void 0!==e&&e.forEach(((e,t)=>this._classProperties.set(t,e)))}}static createProperty(e,t=Un){if(this._ensureClassProperties(),this._classProperties.set(e,t),t.noAccessor||this.prototype.hasOwnProperty(e))return;let r="symbol"==typeof e?Symbol():`__${e}`,i=this.getPropertyDescriptor(e,r,t);void 0!==i&&Object.defineProperty(this.prototype,e,i)}static getPropertyDescriptor(e,t,r){return{get(){return this[t]},set(i){let n=this[e];this[t]=i,this.requestUpdateInternal(e,n,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this._classProperties&&this._classProperties.get(e)||Un}static finalize(){let e=Object.getPrototypeOf(this);if(e.hasOwnProperty(Bn)||e.finalize(),this[Bn]=!0,this._ensureClassProperties(),this._attributeToPropertyMap=new Map,this.hasOwnProperty(JSCompiler_renameProperty("properties",this))){let e=this.properties,t=[...Object.getOwnPropertyNames(e),..."function"==typeof Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e):[]];for(let r of t)this.createProperty(r,e[r])}}static _attributeNameForProperty(e,t){let r=t.attribute;return!1===r?void 0:"string"==typeof r?r:"string"==typeof e?e.toLowerCase():void 0}static _valueHasChanged(e,t,r=Mn){return r(e,t)}static _propertyValueFromAttribute(e,t){let r=t.type,i=t.converter||Ln,n="function"==typeof i?i:i.fromAttribute;return n?n(e,r):e}static _propertyValueToAttribute(e,t){if(void 0===t.reflect)return;let r=t.type,i=t.converter;return(i&&i.toAttribute||Ln.toAttribute)(e,r)}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,t)=>{if(this.hasOwnProperty(t)){let e=this[t];delete this[t],this._instanceProperties||(this._instanceProperties=new Map),this._instanceProperties.set(t,e)}}))}_applyInstanceProperties(){this._instanceProperties.forEach(((e,t)=>this[t]=e)),this._instanceProperties=void 0}connectedCallback(){this.enableUpdating()}enableUpdating(){void 0!==this._enableUpdatingResolver&&(this._enableUpdatingResolver(),this._enableUpdatingResolver=void 0)}disconnectedCallback(){}attributeChangedCallback(e,t,r){t!==r&&this._attributeToProperty(e,r)}_propertyToAttribute(e,t,r=Un){let i=this.constructor,n=i._attributeNameForProperty(e,r);if(void 0!==n){let e=i._propertyValueToAttribute(t,r);if(void 0===e)return;this._updateState=8|this._updateState,null==e?this.removeAttribute(n):this.setAttribute(n,e),this._updateState=-9&this._updateState}}_attributeToProperty(e,t){if(8&this._updateState)return;let r=this.constructor,i=r._attributeToPropertyMap.get(e);if(void 0!==i){let e=r.getPropertyOptions(i);this._updateState=16|this._updateState,this[i]=r._propertyValueFromAttribute(t,e),this._updateState=-17&this._updateState}}requestUpdateInternal(e,t,r){let i=!0;if(void 0!==e){let n=this.constructor;r=r||n.getPropertyOptions(e),n._valueHasChanged(this[e],t,r.hasChanged)?(this._changedProperties.has(e)||this._changedProperties.set(e,t),!0===r.reflect&&!(16&this._updateState)&&(void 0===this._reflectingProperties&&(this._reflectingProperties=new Map),this._reflectingProperties.set(e,r))):i=!1}!this._hasRequestedUpdate&&i&&(this._updatePromise=this._enqueueUpdate())}requestUpdate(e,t){return this.requestUpdateInternal(e,t),this.updateComplete}async _enqueueUpdate(){this._updateState=4|this._updateState;try{await this._updatePromise}catch{}let e=this.performUpdate();return null!=e&&await e,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return 4&this._updateState}get hasUpdated(){return 1&this._updateState}performUpdate(){if(!this._hasRequestedUpdate)return;this._instanceProperties&&this._applyInstanceProperties();let e=!1,t=this._changedProperties;try{e=this.shouldUpdate(t),e?this.update(t):this._markUpdated()}catch(t){throw e=!1,this._markUpdated(),t}e&&(1&this._updateState||(this._updateState=1|this._updateState,this.firstUpdated(t)),this.updated(t))}_markUpdated(){this._changedProperties=new Map,this._updateState=-5&this._updateState}get updateComplete(){return this._getUpdateComplete()}_getUpdateComplete(){return this._updatePromise}shouldUpdate(e){return!0}update(e){void 0!==this._reflectingProperties&&this._reflectingProperties.size>0&&(this._reflectingProperties.forEach(((e,t)=>this._propertyToAttribute(t,this[t],e))),this._reflectingProperties=void 0),this._markUpdated()}updated(e){}firstUpdated(e){}};a(Vn,"UpdatingElement"),Vn[Bn]=!0;var zn=Element.prototype,Gn=(zn.msMatchesSelector||zn.webkitMatchesSelector,window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype),Hn=Symbol(),Wn=class{constructor(e,t){if(t!==Hn)throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e}get styleSheet(){return void 0===this._styleSheet&&(Gn?(this._styleSheet=new CSSStyleSheet,this._styleSheet.replaceSync(this.cssText)):this._styleSheet=null),this._styleSheet}toString(){return this.cssText}};a(Wn,"CSSResult");var Jn=a((e=>new Wn(String(e),Hn)),"unsafeCSS"),Yn=a((e=>{if(e instanceof Wn)return e.cssText;if("number"==typeof e)return e;throw new Error(`Value passed to 'css' function must be a 'css' function result: ${e}. Use 'unsafeCSS' to pass non-literal values, but\n            take care to ensure page security.`)}),"textFromCSSResult"),Kn=a(((e,...t)=>{let r=t.reduce(((t,r,i)=>t+Yn(r)+e[i+1]),e[0]);return new Wn(r,Hn)}),"css");(window.litElementVersions||(window.litElementVersions=[])).push("2.4.0");var Zn={},Qn=class extends Vn{static getStyles(){return this.styles}static _getUniqueStyles(){if(this.hasOwnProperty(JSCompiler_renameProperty("_styles",this)))return;let e=this.getStyles();if(Array.isArray(e)){let t=a(((e,r)=>e.reduceRight(((e,r)=>Array.isArray(r)?t(r,e):(e.add(r),e)),r)),"addStyles"),r=t(e,new Set),i=[];r.forEach((e=>i.unshift(e))),this._styles=i}else this._styles=void 0===e?[]:[e];this._styles=this._styles.map((e=>{if(e instanceof CSSStyleSheet&&!Gn){let t=Array.prototype.slice.call(e.cssRules).reduce(((e,t)=>e+t.cssText),"");return Jn(t)}return e}))}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;0!==e.length&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow?Gn?this.renderRoot.adoptedStyleSheets=e.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet)):this._needsShimAdoptedStyleSheets=!0:window.ShadyCSS.ScopingShim.prepareAdoptedCssText(e.map((e=>e.cssText)),this.localName))}connectedCallback(){super.connectedCallback(),this.hasUpdated&&void 0!==window.ShadyCSS&&window.ShadyCSS.styleElement(this)}update(e){let t=this.render();super.update(e),t!==Zn&&this.constructor.render(t,this.renderRoot,{scopeName:this.localName,eventContext:this}),this._needsShimAdoptedStyleSheets&&(this._needsShimAdoptedStyleSheets=!1,this.constructor._styles.forEach((e=>{let t=document.createElement("style");t.textContent=e.cssText,this.renderRoot.appendChild(t)})))}render(){return Zn}};a(Qn,"LitElement"),Qn.finalized=!0,Qn.render=jn;var Xn=c(_()),eo=a((e=>{let t=String(e||"").trim().match(/(\d+)\s*([dwm])/);return t?`${t[1]}_${{d:1,w:2,m:3}[t[2]]}`:e}),"sanitizeFrequencyString"),to=a((e=>e.hasAttribute("product")&&{id:e.getAttribute("product"),...e.hasAttribute("product-components")&&{components:JSON.parse(e.getAttribute("product-components"))}}),"buildProduct"),ro=a((e=>{let t=to(e);if(!t){let r=e.offer;r&&(t=to(r))}return t}),"resolveProduct"),io=a((e=>{let t=e;for(;t;){if("OG-OFFER"===t.tagName)return t;t=11===t.nodeType?t.host:t.parentNode}}),"resolveOffer"),no=a((e=>class extends e{get offer(){return io(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"),oo=a((e=>class extends(no(e)){get product(){return ro(this)}}),"withProduct"),ao=a((e=>class extends e{get childOptions(){let e=[],t=null;return this.querySelectorAll("option").forEach((r=>{let i=eo(r.value),n=r.innerText.trim();e.push({value:i,text:n}),!t&&r.selected&&(t=i)})),{options:e,isSelected:t}}}),"withChildOptions"),so={};l(so,{autoshipByDefault:()=>co,eligibilityGroups:()=>ho,eligible:()=>uo,hasPrepaidOptions:()=>vo,hasUpcomingOrder:()=>_o,hasUpsellGroup:()=>fo,inStock:()=>lo,optedout:()=>mo,prepaidEligible:()=>go,prepaidSubscribed:()=>bo,regularEligible:()=>Po,subscribed:()=>yo,subscriptionEligible:()=>po,upcomingOrderContainsProduct:()=>So,upsellEligible:()=>wo});var lo=a(((e,t)=>(e.inStock||{})[(t.product||{}).id]),"inStock"),uo=a(((e,t)=>(e.autoshipEligible||{})[(t.product||{}).id]||!1),"eligible"),co=a(((e,t)=>(e.autoshipByDefault||{})[(t.product||{}).id]||!1),"autoshipByDefault"),po=a(((e,t)=>!(!e.offerId||"0"===e.offerId)&&uo(e,t)&&lo(e,t)),"subscriptionEligible"),ho=a(((e,t)=>{let r=ur((t.product||{}).id);return(e.eligibilityGroups||{})[r]||null}),"eligibilityGroups"),fo=a(((e,t)=>{let r=ho(e,t);return null===r||!!r.find((e=>"upsell"===e||"impulse_upsell"===e))}),"hasUpsellGroup"),go=a(((e,t)=>{let r=ho(e,t);return(null==r?void 0:r.some((e=>e===Ue)))||!1}),"prepaidEligible"),yo=a(((e,t)=>Mt(t.product)(e)),"subscribed"),mo=a(((e,t)=>Vt(t.product)(e)),"optedout"),bo=a(((e,t)=>Ut(t.product)(e)),"prepaidSubscribed"),vo=a(((e,t)=>Ht(t.product.id)(e).length>0),"hasPrepaidOptions"),_o=a((e=>!(!e.nextUpcomingOrder||!e.nextUpcomingOrder.public_id)),"hasUpcomingOrder"),So=a(((e,t)=>(e.nextUpcomingOrder&&e.nextUpcomingOrder.products||[]).includes((t.product||{}).id)),"upcomingOrderContainsProduct"),wo=a(((e,t)=>{var r;return!(null!=(r=t.offer)&&r.isCart)&&e.offerId&&"0"!==e.offerId&&e.auth&&lo(e,t)&&_o(e)&&fo(e,t)}),"upsellEligible"),Po=a(((e,t)=>po(e,t)&&!wo(e,t)),"regularEligible"),Oo=a((e=>e.replace(/(\r\n|\n|\r|\s)+/gm,"")),"removeWhitespace"),xo=class extends(oo(Qn)){static get properties(){return{...super.properties,state:{type:Object,attribute:!1},test:{type:String}}}render(){if(!this.test)return kn``;let e=Oo(this.test);return e=e.replace(/(![a-zA-Z]+)/g,"($1)"),Xn.default.parse(e,(e=>so[e]&&so[e](this.state,this)))?kn`
        <slot></slot>
      `:kn``}shouldUpdate(e){return e.size&&(this.product&&this.product.id in this.state.autoshipEligible&&this.product.id in this.state.inStock||!this.product.id)}};a(xo,"When");var Eo=a((e=>({state:e})),"mapStateToProps"),Co=ji(Eo)(xo),qo={type:Object,converter:{toAttribute:e=>null==e?e:JSON.stringify(e),fromAttribute:e=>e&&e.match(/[{[]/)?JSON.parse(e):{id:e}}},To={type:String,attribute:"default-frequency",converter:{fromAttribute:e=>e&&tt(e)?e:null}},ko={type:Boolean,attribute:!0,reflect:!0},Ao={type:Object,attribute:!1},Io=a((e=>class extends e{applyTemplate(e){this.template=e;let t=void 0===e.markup?this.constructor.initialTemplate:e.markup;t&&this._templateMarkup!==t&&(this._templateMarkup=t,this.innerHTML=t)}refreshTemplate(){if(this._templates&&this._templates.length){let e=this._templates.find((({selector:e})=>{try{return this.matches(e)}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"),No=Io(Qn),Fo=class extends(oo(No)){static get properties(){return{subscribed:ko,frequencyMatch:{type:Boolean,reflect:!0,attribute:"frequency-match"},productDefaultFrequency:{type:String},defaultFrequency:{type:String},frequencies:{type:Array}}}static get styles(){return Kn`
      :host {
        cursor: default;
        display: inline-block;
      }

      :host[hidden] {
        display: none;
      }

      .btn {
        position: relative;
        width: var(--og-radio-width, 1.4em);
        height: var(--og-radio-height, 1.4em);
        margin: var(--og-radio-margin, 0);
        padding: 0;
        border: 1px solid var(--og-primary-color, var(--og-border-color, black));
        background: #fff;
        border-radius: 100%;
        vertical-align: middle;
        color: var(--og-primary-color, var(--og-btn-color, black));
      }

      .radio {
        text-indent: -9999px;
        flex-shrink: 0;
      }

      .checkbox {
        border-radius: 3px;
      }

      .radio,
      .checkbox {
        border-color: var(--og-checkbox-border-color, black);
      }

      .checkbox.active::after,
      .radio.active::after {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        box-sizing: border-box;
        background: var(--og-checkbox-border-color, black);
      }

      .radio.active::after {
        content: ' ';
        border-radius: 100%;
        border: 2px solid #fff;
      }

      .checkbox.active::after {
        border: none;
        border-radius: 0;
        background: #fff;
        content: '\\2714';
        line-height: 1;
        text-align: center;
        overflow: visible;
      }
    `}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?kn`
        <slot name="subscribed"></slot>
        <slot name="frequency-mismatch"></slot>
      `:this.subscribed&&this.defaultFrequency===this.frequency?kn`
        <slot name="subscribed"></slot>
        <slot name="frequency-match"></slot>
      `:this.subscribed&&this.defaultFrequency!==this.frequency?kn`
        <slot name="subscribed"></slot>
        <slot name="frequency-mismatch"></slot>
      `:kn`
      <slot name="not-subscribed"></slot>
    `}};a(Fo,"OptinStatus");var $o=a(((e,t={})=>{var r,i;return{subscribed:Lt(t.product)(e),frequency:zt(t.product)(e),productDefaultFrequency:Wt((t.product||{}).id)(e),prepaidShipmentsOptedIn:Gt(t.product)(e),defaultFrequency:Yt(null==(r=t.product)?void 0:r.id)(e)||ir(t,"defaultFrequency"),frequencies:Jt(null==(i=t.product)?void 0:i.id)(e)||ir(t,"frequencies"),...nr(e,t),productFrequencies:Kt(t.product)(e)}}),"mapStateToProps"),Ro=ji($o)(Fo),Do=class extends Fo{static get properties(){return{...super.properties,frequency:{type:String,reflect:!0},defaultFrequency:To,optinButtonLabel:{type:String}}}updated(e){if(e.has("subscribed")||e.has("frequencies")){if(ut.shopify_selling_plans&&this.store){let e=this.getAttribute("default-frequency");e=dr(e,this.productFrequencies),this.sellingPlanFreq=e}this.frequencyMatch=this.frequency===this.optinFrequency}}get optinFrequency(){let e;return e=this.sellingPlanFreq?this.sellingPlanFreq:this.hasAttribute("default-frequency")?this.getAttribute("default-frequency"):this.offer?this.offer.defaultFrequency:this.defaultFrequency,ut.shopify_selling_plans&&this.store&&(e=dr(e,this.productFrequencies)),e}handleClick(e){this.optinProduct(ro(this),this.optinFrequency,this.offer),e.preventDefault()}render(){return kn`
      <slot name="default">
        <button
          aria-labelledby="ogOfferOptInLabel"
          role="radio"
          aria-checked="${!!this.subscribed}"
          class="btn radio ${this.subscribed?"active":""}"
        ></button>
        <label id="ogOfferOptInLabel">
          <slot>
            <slot name="label"><og-text key="offerOptInLabel"></og-text></slot>
          </slot>
        </label>
      </slot>
    `}};a(Do,"OptinButton");var jo=ji($o,{optinProduct:Sr})(Do),Lo=class extends Fo{static get properties(){return{...super.properties,label:{type:String}}}handleClick(e){this.optoutProduct(this.product,this.offer),e.preventDefault()}render(){return kn`
      <slot name="default">
        <button
          aria-labelledby="ogOfferOptOutLabel"
          role="radio"
          aria-checked="${!this.subscribed}"
          class="btn radio ${this.subscribed?"":"active"}"
        ></button>
        <label id="ogOfferOptOutLabel">
          <slot>
            <og-text key="offerOptOutLabel"></og-text>
          </slot>
        </label>
      </slot>
    `}};a(Lo,"OptoutButton");var Mo=ji($o,{optoutProduct:wr})(Lo),Uo=a(((e,t)=>{let{every:r,every_period:i}=et(e);return r&&i?kn`
        ${r}
        <og-text key="frequencyPeriods" variant="${i}" pluralize="${r}"></og-text>
        ${t&&t===e?kn`
              <og-text key="defaultFrequencyCopy"></og-text>
            `:""}
      `:e}),"frequencyText"),Bo=class extends(oo(No)){static get properties(){return{...super.properties,disabled:{type:Boolean},subscribed:ko,frequency:{type:String},defaultFrequency:To,productDefaultFrequency:{type:String},config:{type:Object},frequencies:{converter:{fromAttribute:it}}}}static get styles(){return Kn`
      :host[hidden] {
        display: none;
      }
      :host {
        display: inline-block;
      }
    `}constructor(){super(),this.frequencies=[]}render(){let e=this.frequency||this.defaultFrequency;return kn`
      <span>
        ${this.subscribed&&kn`
            <slot name="subscribed">${Uo(e)}</slot>
          `||""}
        ${!this.subscribed&&kn`
            <slot name="not-subscribed"></slot>
          `||""}
        ${this.subscribed&&this.defaultFrequency&&this.defaultFrequency!==this.frequency&&kn`
            <slot name="frequency-mismatch"></slot>
          `||""}
      </span>
    `}};a(Bo,"FrequencyStatus");var Vo=a(((e,t)=>{var r,i;return{subscribed:Lt(t.product)(e),frequency:zt(t.product)(e),productDefaultFrequency:Wt((t.product||{}).id)(e),frequencies:Jt(null==(r=t.product)?void 0:r.id)(e)||ir(t,"frequencies"),defaultFrequency:Yt(null==(i=t.product)?void 0:i.id)(e)||ir(t,"defaultFrequency"),...nr(e,t),productFrequencies:Kt(t.product)(e)}}),"mapStateToProps"),zo=ji(Vo)(Bo),Go=class extends(ao(Fo)){static get properties(){return{...super.properties,frequencies:{type:Array,attribute:!1},frequency:{type:String},defaultFrequency:To,selectLabel:{type:String,attribute:"select-label"}}}static get styles(){return Kn`
      :host {
        display: inline-block;
        cursor: pointer;
        background-color: var(--og-select-bg-color, #fff);
        border: var(--og-select-border, 1px solid #aaa);
        border-radius: var(--og-select-border-radius, 0.5em);
        border-width: var(--og-select-border-width, 1px);
        box-shadow: 0 1px 0 1px rgba(0, 0, 0, 0.04);
      }
    `}get currentFrequency(){return this.subscribed?this.frequency||this.productDefaultFrequency||this.defaultFrequency:"optedOut"}onOptinChange(e){"optedOut"===e?this.optoutProduct(this.product,this.offer):this.productChangeFrequency(this.product,e,this.offer)}render(){var e;let t,{options:r}=this.childOptions;if(null!=(e=this.frequencies)&&e.length){let{frequenciesText:e}=this.productFrequencies;t=[r.find((e=>"optedOut"===e.value)),...this.frequencies.map(((t,r)=>({value:t,text:e&&r in e?e[r]:Uo(t,this.defaultFrequency)})))]}else t=r;return kn`
      <og-select
        .options="${t}"
        .selected="${this.currentFrequency}"
        .onChange="${({target:{value:e}})=>this.onOptinChange(e)}"
        .ariaLabel="${this.selectLabel}"
      ></og-select>
    `}};a(Go,"OptinSelect");var Ho=ji(((e,t)=>{var r;return{...$o(e,t),...Vo(e,t),frequencies:Jt(null==(r=t.product)?void 0:r.id)(e)||ir(t,"frequencies")}}),{productChangeFrequency:Or,optoutProduct:wr})(Go),Wo=class extends(oo(No)){static get styles(){return Kn`
      :host[hidden] {
        display: none;
      }
      :host {
        display: inline-block;
      }
    `}static get properties(){return{...super.properties,upcomingOrderDate:{type:String,attribute:!1},auth:Ao,isPreview:{type:Boolean,attribute:!1},target:{type:String},skipModal:{type:Boolean,attribute:"skip-modal"}}}constructor(){super(),this.fetchOrders=()=>0,this.createIu=()=>0,this.concludeUpsell=()=>0,this.addEventListener("click",this.handleClick.bind(this))}updated(e){e.has("auth")&&this.auth&&!this.upcomingOrderDate&&!this.isPreview&&this.fetchOrders()}handleClick(){let e;if(this.skipModal)this.createIu(this.product,this.nextUpcomingOrder.public_id,1,!1,null),this.concludeUpsell(this.product);else if(!this.target&&this.offer)e=this.offer.querySelector("og-upsell-modal"),e||(e=this.offer.shadowRoot.querySelector("og-upsell-modal"));else{if(!this.target)throw Error("You must specify a target attribute or place this element as child of og-offer");e=document.querySelector(this.target)}e&&e.setAttribute("show",!0)}render(){return kn`
      <slot>
        <og-next-upcoming-order></og-next-upcoming-order>
      </slot>
    `}};a(Wo,"UpsellButton");var Jo=a((e=>({isPreview:e.previewUpsellOffer,nextUpcomingOrder:e.previewUpsellOffer?{public_id:"preview-order-id"}:e.nextUpcomingOrder})),"mapStateToProps"),Yo=ji(Jo,{fetchOrders:jr,createIu:Kr,concludeUpsell:Er})(Wo),Ko=class extends(oo(No)){static get properties(){return{...super.properties,defaultFrequency:To,auth:Ao,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 kn`
      <og-modal ?show=${this.show} @close=${()=>this.close()} @confirm=${()=>this.confirm()}>
        <div slot="content">
          <slot>
            <slot name="content">
              <og-text key="upsellModalContent"></og-text>
            </slot>
            <slot name="offer">
              <br />

              <og-optout-button>
                <slot name="opt-out-label">
                  <og-text key="upsellModalOptOutLabel" slot="label"></og-text>
                </slot>
              </og-optout-button>
              <br />
              <og-optin-button default-frequency=${this.defaultFrequency}>
                <slot name="opt-in-label">
                  <og-text key="upsellModalOptInLabel" slot="label"></og-text>
                </slot>
              </og-optin-button>
              <br />
              <slot name="every-label">
                <og-text key="offerEveryLabel"></og-text>
              </slot>
              <og-select-frequency default-frequency=${this.defaultFrequency}></og-select-frequency>
            </slot>
          </slot>
        </div>
        <span slot="confirm">
          <slot name="confirm"><og-text key="upsellModalConfirmLabel"></og-text></slot>
        </span>
        <span slot="cancel">
          <slot name="cancel">
            <og-text key="upsellModalCancelLabel"></og-text>
          </slot>
        </span>
      </og-modal>
    `}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")}};a(Ko,"UpsellModal");var Zo=a(((e,t)=>{var r;return{auth:e.auth,offerId:e.offerId,subscribed:Lt(t.product)(e),frequency:zt(t.product)(e),defaultFrequency:Yt(null==(r=t.product)?void 0:r.id)(e)||ir(t,"defaultFrequency"),nextUpcomingOrder:e.previewUpsellOffer?{public_id:"preview-order-id"}:e.nextUpcomingOrder,isPreview:e.previewUpsellOffer}}),"mapStateToProps"),Qo=ji(Zo,{concludeUpsell:Er,createIu:Kr})(Ko),Xo=class extends Fo{static get properties(){return{...super.properties,frequency:{type:String}}}static get styles(){return Kn`
      :host {
        cursor: default;
        display: inline-block;
      }

      .btn {
        position: relative;
        width: var(--og-radio-width, 1.4em);
        height: var(--og-radio-height, 1.4em);
        margin: var(--og-radio-margin, 0);
        padding: 0;
        border: 1px solid var(--og-checkbox-border-color, black);
        background: #fff;
        vertical-align: middle;
        color: var(--og-primary-color, black);
        display: inline-flex;
        justify-content: center;
        align-items: center;
        border-radius: 3px;
      }

      .btn.active {
        background: var(--og-checkbox-border-color, black);
      }

      .btn.active:after {
        content: '✓';
        color: #fff;
        transform: scale(1.6);
        margin-left: 2px;
      }
    `}handleClick(e){this.subscribed?this.optoutProduct(this.product,this.offer):this.optinProduct(this.product,this.frequency||this.productDefaultFrequency||this.defaultFrequency,this.offer),e.preventDefault()}render(){return kn`
      <slot name="default">
        <button id="action-trigger" class="btn checkbox ${this.subscribed?"active":""}"></button>
        <label for="action-trigger">
          <slot>
            <slot name="label"><og-text key="offerOptInLabel"></og-text></slot>
          </slot>
        </label>
      </slot>
    `}};a(Xo,"OptinToggle");var ea=ji($o,{optoutProduct:wr,optinProduct:Sr})(Xo),ta=a(((e,t)=>`${e}${parseInt(t,10)>1?"s":""}`),"pluralize"),ra=class extends(no(Qn)){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 t={...this.i18n,...this.offer&&this.offer.locale},r=void 0!==t[e]?t[e]:"";return void 0===this.variant?r:r[this.variant]}getPluralizedText(e){return void 0===this.pluralize?e:e&&ta(e,this.pluralize)}render(){return kn`
      ${this.getText()}
    `}};a(ra,"Text");var ia=a((e=>({i18n:e.locale||{}})),"mapStateToProps"),na=ji(ia)(ra),oa=class{constructor(e){this.value=e,this.className="DiscountAmount"}toString(){return`${this.value}`}};a(oa,"DiscountAmount");var aa=class extends oa{constructor(e){super(e),this.className="DiscountPercent"}toString(){return`${super.toString()}%`}};a(aa,"DiscountPercent");var sa=class extends aa{constructor(e){super(e),this.className="ShippingDiscountPercent"}toString(){return 100===this.value?"free shipping":super.toString()}};a(sa,"ShippingDiscountPercent");var la="Discount Percent",ua="Discount Amount",ca="total_price",da="shipping_total",pa="sub_total",ha=a((({field:e,object:t,type:r,value:i})=>{let n=[[new aa(i),{field:ca,object:"item",type:la}],[new oa(i),{field:ca,object:"item",type:ua}],[new sa(i),{field:da,object:"order",type:la}],[new oa(i),{field:da,object:"order",type:ua}],[new aa(i),{field:pa,object:"order",type:la}],[new oa(i),{field:pa,object:"order",type:ua}]].find((([,i])=>i.field===e&&i.object===t&&i.type===r));return n&&n[0]}),"discountBuilder");function fa(e,{incentiveValue:t,incentiveClass:r}){return!(ha(e).className!==r||t&&t.toString()!==e.value.toString())}a(fa,"isMatchingIncentive");var ga=[Le,Me],ya=class extends(oo(Qn)){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,t=this.value,r=this.initial?"initial":"ongoing",i=this.incentives[r]||[],n=i.filter((e=>e.criteria&&"PREMISE"===e.criteria.node_type&&!e.threshold_field&&ga.includes(e.criteria.standard))),o=[...n,...i.filter((e=>!n.includes(e)))].find((r=>fa(r,{incentiveClass:e,incentiveValue:t})));return kn`
      ${this.label} ${o?ha(o):this.renderFallback()}
    `}renderFallback(){return kn`
      ${ha({field:"sub_total",object:"order",type:"Discount Percent",value:this.value})}
    `}};a(ya,"IncentiveText");var ma=a(((e,t)=>{var r;return{incentives:(e.incentives||{})[t&&(null==t?void 0:t.product)&&ur(null==(r=null==t?void 0:t.product)?void 0:r.id)]||{}}}),"mapStateToProps"),ba=ji(ma)(ya),va=class extends(ao(Bo)){static get properties(){return{...super.properties,defaultText:{type:String,attribute:"default-text"}}}static get styles(){return Kn`
      :host {
        display: inline-block;
        cursor: pointer;
        background-color: var(--og-select-bg-color, #fff);
        border: var(--og-select-border, 1px solid #aaa);
        border-radius: var(--og-select-border-radius, 0.5em);
        border-width: var(--og-select-border-width, 1px);
        box-shadow: 0 1px 0 1px rgba(0, 0, 0, 0.04);
        z-index: 1;
      }
    `}set defaultFrequency(e){this._defaultFrequency=e}get defaultFrequency(){var e,t,r,i;let n,{options:o,isSelected:a}=this.childOptions;return n=this.productDefaultFrequency?this.productDefaultFrequency:a||(o.length?o[0].value:this._defaultFrequency),(null==(t=null==(e=this.productFrequencies)?void 0:e.frequencies)?void 0:t.length)&&n&&(null==(i=null==(r=this.productFrequencies)?void 0:r.frequenciesEveryPeriod)?void 0:i.length)?dr(n,this.productFrequencies):n}get currentFrequency(){return this.frequency?this.frequency:this.defaultFrequency}productChangeFrequency(e,t){this.frequency=t}render(){var e;let t,r=this.defaultFrequency;return null!=(e=this.frequencies)&&e.length?t=this.frequencies.map(((e,t)=>{let i,{frequenciesEveryPeriod:n,frequenciesText:o}=this.productFrequencies;return i=n&&t in n?Uo(n[t],r):o&&t in o?o[t]:Uo(e,this.defaultFrequency),{value:e,text:i}})):({options:t}=this.childOptions),t.length||(t=(this.frequencies||[]).map((e=>({value:e,text:Uo(e,r)})))),t=t.map((({text:e,value:t})=>({text:t===r?kn`
              ${e} ${this.defaultText||""}
            `:e,value:t}))),kn`
      <og-select
        .ariaLabel="${"Delivery frequency"}"
        .options="${t}"
        .selected="${this.currentFrequency}"
        .onChange="${({target:{value:e}})=>{this.productChangeFrequency(this.product,e,this.offer)}}"
      ></og-select>
    `}};a(va,"SelectFrequency");var _a=ji(Vo,{productChangeFrequency:Or})(va),Sa={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"}},wa=a(((e,t)=>e instanceof Date?(t||"").toString().replace(/\{\{([-\w]+)\}\}/g,(t=>{let r=t.replace(/[{}]/g,""),i=Sa[r];if(void 0===i)return r;let n=new Intl.DateTimeFormat("en-us",i).formatToParts(e),[{value:o}]=n;return o})):e),"formatDate"),Pa=class extends Qn{static get properties(){return{value:{type:String,reflect:!0},format:{type:String}}}createRenderRoot(){return this}render(){return kn`
      ${wa(this.value,this.format||"{{month-long}} {{day}}, {{year-numeric}}")}
    `}};a(Pa,"FormattedDate");var Oa=a((e=>({value:e.previewUpsellOffer?new Date:e.nextUpcomingOrder.place})),"mapStateToProps"),xa=ji(Oa)(Pa),Ea=c(p()),Ca=a(((e,t,r)=>a((async function(i){await i({type:Se,payload:{isPreview:e,productId:t}}),await i({type:se}),await i(Ur({in_stock:{[t]:!0},eligibility_groups:{[t]:["subscription","upsell"]},result:"success",autoship:{[t]:!0},autoship_by_default:{[t]:!1},modifiers:{},module_view:{regular:"096135e6650111e9a444bc764e106cf4"},incentives_display:{"47c01e9aacbe40389b5c7325d79091aa":{field:"sub_total",object:"order",type:"Discount Percent",value:5},e6534b9d877f41e586c37b7d8abc3a58:{field:"total_price",object:"item",type:"Discount Percent",value:10},f35e842710b24929922db4a529eecd40:{field:"total_price",object:"item",type:"Discount Percent",value:10},"5be321d7c17f4e18a757212b9a20bfcc":{field:"total_price",object:"item",type:"Discount Percent",value:1}},incentives:{[t]:{initial:["5be321d7c17f4e18a757212b9a20bfcc"],ongoing:["e6534b9d877f41e586c37b7d8abc3a58","47c01e9aacbe40389b5c7325d79091aa","f35e842710b24929922db4a529eecd40"]}}},r,t))}),"setPreviewStandardOfferThunk")),"setPreviewStandardOffer"),qa=a(((e,t)=>(Object.entries(t).forEach((([t,r])=>{if(Object.prototype.hasOwnProperty.call(e,t)){let i=e[t].concat(r),n=[...new Set(i.map((e=>JSON.stringify(e))))];e[t]=n.map((e=>JSON.parse(e)))}else e[t]=r})),e)),"mergeProductPlansToState"),Ta=a(((e,t,r)=>a((async function(i,n){await i({type:we,payload:{isPreview:e,productId:t}});let{merchantId:o}=n();e?(await i(Ur({in_stock:{[t]:!0},module_view:{regular:"096135e6650111e9a444bc764e106cf4"},default_frequencies:{[t]:{every:1,every_period:3}},eligibility_groups:{[t]:["subscription","upsell"]},result:"success",autoship:{[t]:!0},autoship_by_default:{[t]:!1},modifiers:{}},r,t)),await i(Rr({count:1,next:null,previous:null,results:[{merchant:"0e5de2bedc5e11e3a2e4bc764e106cf4",customer:"TestCust",payment:"e98e789aba0111e9b90fbc764e107990",shipping_address:"b3a5816ae59611e78937bc764e1043b0",public_id:"23322d4a83eb11ea9a1ebc764e101db1",sub_total:"206.98",tax_total:"0.00",shipping_total:"10.00",discount_total:"0.00",total:"216.98",created:"2020-04-21 11:14:11",place:"2020-06-24 00:00:00",cancelled:null,tries:0,generic_error_count:0,status:1,type:1,order_merchant_id:null,rejected_message:null,extra_data:null,locked:!1,oos_free_shipping:!1}]})),await i(kr(o,"sig_field","ts","sig"))):await i(Ar())}),"setPreviewUpsellOfferThunk")),"setPreviewUpsellOffer"),ka=a(((e,t,r)=>a((async function(i,n){let o=n().productPlans;await i({type:"SET_PREVIEW_PREPAID_OFFER",payload:{isPreview:e,productId:t}}),await i({type:se}),await i(Ur({in_stock:{[t]:!0},eligibility_groups:{[t]:["subscription","upsell","prepaid"]},result:"success",autoship:{[t]:!0},autoship_by_default:{[t]:!1},modifiers:{},module_view:{regular:"096135e6650111e9a444bc764e106cf4"},incentives_display:{"47c01e9aacbe40389b5c7325d79091aa":{field:"sub_total",object:"order",type:"Discount Percent",value:5},e6534b9d877f41e586c37b7d8abc3a58:{field:"total_price",object:"item",type:"Discount Percent",value:10},f35e842710b24929922db4a529eecd40:{field:"total_price",object:"item",type:"Discount Percent",value:10},"5be321d7c17f4e18a757212b9a20bfcc":{field:"total_price",object:"item",type:"Discount Percent",value:1}},incentives:{[t]:{initial:["5be321d7c17f4e18a757212b9a20bfcc"],ongoing:["e6534b9d877f41e586c37b7d8abc3a58","47c01e9aacbe40389b5c7325d79091aa","f35e842710b24929922db4a529eecd40"]}}},r,t)),await i({type:Te,payload:qa(o,Ui({[t]:[{frequency:"1_3",regularPrice:"$15.00",subscriptionPrice:"$12.00",discountRate:"25%",prepaidShipments:3,regularPrepaidPrice:"$36.00",prepaidSavingsPerShipment:"$3.00",prepaidSavingsTotal:"$9.00",prepaidExtraSavingsPercentage:"10%"},{frequency:"1_3",regularPrice:"$15.00",subscriptionPrice:"$12.00",discountRate:"20%",prepaidShipments:6,regularPrepaidPrice:"$72.00",prepaidSavingsPerShipment:"$3.00",prepaidSavingsTotal:"$18.00",prepaidExtraSavingsPercentage:"10%"},{frequency:"1_3",regularPrice:"$15.00",subscriptionPrice:"$12.00",discountRate:"20%",prepaidShipments:12,regularPrepaidPrice:"$144.00",prepaidSavingsPerShipment:"$3.00",prepaidSavingsTotal:"$36.00",prepaidExtraSavingsPercentage:"10%"}]}))}),await i({type:_e,payload:{prepaidSellingPlans:{[t]:[{numberShipments:3,sellingPlan:"1_3"},{numberShipments:6,sellingPlan:"1_3"},{numberShipments:12,sellingPlan:"1_3"}]}}})}),"setPreviewPrepaidThunk")),"setPreviewPrepaid"),Aa=a(((e,t,r)=>async function(t,i){switch(await t({type:Ee}),await t({type:Se,payload:{isPreview:!1,productId:r.product.id}}),await t({type:we,payload:{isPreview:!1,productId:r.product.id}}),e){case"regular":t(Ca(!0,r.product.id,r));break;case"upsell":t(Ta(!0,r.product.id,r));break;case"subscribed":t(Ca(!0,r.product.id,r)),t(Sr(r.product,"2_2"));break;case"prepaid":t(ka(!0,r.product.id,r)),t(Sr(r.product,"1_3"))}}),"setPreview"),Ia=a(((...e)=>JSON.stringify(e)),"memoizeKey"),Na=a((e=>{let t=!1;return(...r)=>{t||(console.warn(e(...r)),t=!0)}}),"logOnce"),Fa=Na(((e,t)=>`Hiding Ordergroove offer since the store currency ${e} does not match your configured currency ${t} and you are not set up for multicurrency. Contact your Ordergroove representative for next steps.`)),$a=(Na((()=>"Hiding Ordergroove offer since cart offers does not currently support product-specific frequency lists.")),(0,Ea.default)(((e,t)=>Object.assign({components:t},e)),Ia)),Ra=class extends No{static get properties(){return{...super.properties,config:{type:Object,attribute:!1},product:qo,productComponents:{type:Array,attribute:"product-components"},offerId:{type:String,attribute:!1},auth:Ao,preview:{type:String,attribute:"preview",reflect:"true"},location:{type:String},autoshipByDefault:{type:Boolean,attribute:"autoship-by-default"},productDefaultFrequency:{type:String,attribute:!1},locale:{type:Object,attribute:!0},firstOrderPlaceDate:{type:String,attribute:"first-order-place-date"},productToSubscribe:{type:String,attribute:"product-to-subscribe"},subscribed:{type:Boolean,reflect:!0},frequency:{type:String,reflect:!0},productFrequency:{type:String},isCart:{type:Boolean,attribute:"cart"},optedin:{type:Object},variationId:{type:String},overrideSellingPlanPrice:{type:Boolean,attribute:"dev-override-selling-plan-price"}}}firstUpdated(){try{let e=Array.from(this.getAttributeNames()).find((e=>e.startsWith("preview-")));"preview-standard-offer"===e?this.preview="regular":"preview-upsell-offer"===e?this.preview="upsell":"preview-subscribed-offer"===e?this.preview="subscribed":"preview-prepaid-offer"===e&&(this.preview="prepaid")}catch(e){console.warn("Unable to set preview property",e)}}static get styles(){return Kn`
      :host[hidden] {
        display: none;
      }

      :host {
        display: block;
      }

      :host {
        color: var(--og-global-color, #000);
        font-family: var(--og-global-family, inherit);
        font-size: var(--og-global-size, inherit);
        padding: var(--og-wrapper-padding, 10px 0);
        min-width: var(--og-wrapper-min-width, 0);
      }

      p {
        margin: 0 0 0.3em;
      }

      :host og-upsell-button button {
        font-family: var(--og-upsell-family, inherit);
        font-size: var(--og-upsell-size, inherit);
        background-color: var(--og-upsell-background, inherit);
        color: var(--og-upsell-color, inherit);
      }

      .og-modal__btn {
        font-size: var(--og-modal-button-size, 0.875rem);
        font-family: var(--og-modal-button-family, inherit);
        padding-left: 1rem;
        padding-right: 1rem;
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
        background-color: var(--og-modal-button-background, #e6e6e6);
        color: var(--og-modal-button-color, rgba(0, 0, 0, 0.8));
        border-radius: 0.25rem;
        border-style: none;
        border-width: 0;
        cursor: pointer;
        -webkit-appearance: button;
        text-transform: none;
        overflow: visible;
        line-height: 1.15;
        margin: 0;
        will-change: transform;
        -moz-osx-font-smoothing: grayscale;
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        transition: -webkit-transform 0.25s ease-out;
        transition: transform 0.25s ease-out;
        transition:
          transform 0.25s ease-out,
          -webkit-transform 0.25s ease-out;
      }

      .og-modal__btn:focus,
      .og-modal__btn:hover {
        -webkit-transform: scale(1.05);
        transform: scale(1.05);
      }

      .og-modal__btn-primary {
        background-color: var(--og-confirm-button-background, #00449e);
        color: var(--og-confirm-button-color, #fff);
      }
    `}static get initialTemplate(){return'\n    <og-when test="regularEligible">\n      <div>\n\n        <og-optout-button>\n          <og-text key="offerOptOutLabel"></og-text>\n        </og-optout-button>\n      </div>\n      <div>\n        <og-optin-button>\n          <og-price discount>\n            <span slot="prepend">Subscribe and get</span>\n            <span slot="append">off</span>\n            <og-text key="offerOptInLabel" slot="fallback"></og-text> \n          </og-price>\n          <og-price regular></og-price>\n          <og-price subscription></og-price>\n    \n        </og-optin-button>\n        <og-tooltip placement="bottom">\n          <div slot="trigger">\n            <og-text key="offerTooltipTrigger"></og-text>\n          </div>\n          <div slot="content">\n            <og-text key="offerTooltipContent"></og-text>\n          </div>\n        </og-tooltip>\n      </div>\n      <div style="margin-left: 2.2em">\n        <og-text key="offerEveryLabel"></og-text>\n        <og-select-frequency>\n          <option value="3_1" selected>3 Days</option>\n          <option value="1_2">1 Week</option>\n          <option value="1_3">1 Month</option>\n        </og-select-frequency>\n      </div>\n    </og-when>\n\n    <og-when test="upsellEligible">\n      <og-when test="!upcomingOrderContainsProduct">\n      <div class="og-iu-offer">\n        <og-text key="upsellButtonLabel"></og-text>\n        <og-upsell-button>\n          <button type="button">\n            <og-text key="upsellButtonContent"></og-text>\n            <og-next-upcoming-order></og-next-upcoming-order>\n          </button>\n        </og-upsell-button>\n        <og-upsell-modal>\n          <og-text key="upsellModalContent"></og-text>\n          <br />\n\n          <og-optout-button>\n            <og-text key="upsellModalOptOutLabel"></og-text>\n          </og-optout-button>\n\n          <br />\n\n          <og-optin-button>\n            <og-text key="upsellModalOptInLabel"></og-text>\n          </og-optin-button>\n          <br />\n\n          <og-text key="offerEveryLabel"></og-text>\n          <og-select-frequency>\n            <option value="3_1" selected>3 Days</option>\n            <option value="1_2">1 Week</option>\n            <option value="1_3">1 Month</option>\n          </og-select-frequency>\n\n          <button slot="confirm" class="og-modal__btn og-modal__btn-primary">\n            <og-text key="upsellModalConfirmLabel"></og-text>\n          </button>\n          <button slot="cancel" class="og-modal__btn"><og-text key="upsellModalCancelLabel"></og-text></button>\n        </og-upsell-modal>\n      </div>\n      </og-when>\n      <og-when test="upcomingOrderContainsProduct">\n        The product is in your next upcomming order\n      </og-when>\n    </og-when>\n    \n    '}constructor(){super(),this.module="pdp",this.product={},this.productComponents=[],this.fetchOffer=()=>0,this.fetchOrders=()=>0,this.productHasChangedComponents=()=>0,this.setFirstOrderPlaceDate=()=>0,this.setProductToSubscribe=()=>0,this.productChangeFrequency=()=>0}applyTemplate(e){super.applyTemplate(e);let{id:t,locale:r}=e;this.variationId=t,this.locale=r;let i=new CustomEvent("template-changed");this.dispatchEvent(i)}updated(e){if(e.has("preview")&&this.setPreview(this.preview,e.get("preview"),this),this.frequency=this.defaultFrequency,e.has("product")&&!this.isPreview&&ar((()=>this.fetchOffer(this.product.id,Fe,this))),e.has("firstOrderPlaceDate")&&this.product.id&&!this.isPreview&&this.setFirstOrderPlaceDate(this.product.id,this.firstOrderPlaceDate),e.has("productToSubscribe")&&this.product.id&&!this.isPreview&&this.setProductToSubscribe(this.product.id,this.productToSubscribe),e.has("auth")&&this.auth&&!this.isPreview&&this.fetchOrders(),e.has("productComponents")){let t=$a(this.product,this.productComponents),r=Object.assign({},this.product,{components:e.get("productComponents")});It(t,r)||this.productHasChangedComponents(t,r)}(e.has("offerId")||e.has("autoshipByDefault")||e.has("location")||e.has("product"))&&this.offerId&&this.autoshipByDefault&&("cart"===this.location||this.isCart)&&this.product.id&&this.optinProduct&&!(this.optedin||[]).find((e=>It(e,this.product)))&&this.optinProduct({...this.product,...this.productComponents.length&&{components:this.productComponents}},this.defaultFrequency,this)}get isPreview(){return this.preview||window.og.previewMode}get shouldEnableOffer(){return!(this.config&&this.config.storeCurrency&&this.config.merchantSettings&&!this.config.merchantSettings.multicurrency_enabled&&this.config.storeCurrency!==this.config.merchantSettings.currency_code)||(Fa(this.config.storeCurrency,this.config.merchantSettings.currency_code),!1)}render(){return this.shouldEnableOffer?kn`
          <slot></slot>
        `:null}get defaultFrequency(){let e=this.productFrequency||this.productDefaultFrequency;if(e)return e;let t=this.querySelector("og-select-frequency");return t&&t.currentFrequency?t.currentFrequency:this.getValueFromAttribute("defaultFrequency")||(this.template&&this.template.config&&void 0!==this.template.config.defaultFrequency?this.template.config.defaultFrequency:this.configDefaultFrequency)}getValueFromAttribute(e){let t=rr(e);if(this.hasAttribute(t)){let e=this.getAttribute(t);return"true"===e.toString().toLowerCase()||"false"!==e.toString().toLowerCase()&&e}}};a(Ra,"Offer");var Da=a(((e,t)=>{var r;return{config:e.config,auth:e.auth,offerId:((e.productOffer||{})[(t.product||{}).id]||[])[0],configDefaultFrequency:Yt(null==(r=t.product)?void 0:r.id)(e),productFrequency:zt(t.product)(e),productDefaultFrequency:Wt((t.product||{}).id)(e),autoshipByDefault:e.config&&e.config.autoshipByDefault||ir(t,"autoshipByDefault",$t(e)[(t.product||{}).id]),...Vt(t.product)(e)&&{autoshipByDefault:!1},optedin:Nt(e),subscribed:Lt(t.product)(e),...nr(e)}}),"mapStateToProps"),ja=ji(Da,{fetchOffer:zr,fetchOrders:jr,productHasChangedComponents:Pr,optinProduct:Sr,setFirstOrderPlaceDate:ti,setProductToSubscribe:ri,setPreview:Aa})(Ra),La=class extends Qn{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 Kn`
      :host[hidden] {
        display: none;
      }

      :host {
        display: block;
      }

      .og-modal {
        display: none;
      }

      .og-modal.is-open {
        display: block;
      }

      .og-modal__overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.6);
        display: flex;
        justify-content: center;
        align-items: center;
        z-index: 9999;
      }

      .og-modal__container {
        background-color: var(--og-modal-background-color, #fff);
        padding: var(--og-modal-padding, 30px);
        max-width: 500px;
        max-height: 100vh;
        border-radius: var(--og-modal-border-radius, 4px);
        box-sizing: border-box;
      }

      .og-modal__header {
        display: flex;
        justify-content: space-between;
        align-items: center;
      }

      .og-modal__title {
        margin-top: 0;
        margin-bottom: 0;
        font-weight: 600;
        font-size: 1.25rem;
        line-height: 1.25;
        color: #00449e;
        box-sizing: border-box;
      }

      .og-modal__close {
        background: transparent;
        border: 0;
      }

      .og-modal__close:before {
        content: '✕';
      }

      .og-modal__content {
        margin-top: 2rem;
        margin-bottom: 2rem;
        line-height: 1.5;
      }

      .og-modal__btn {
        font-size: var(--og-modal-button-size, 0.875rem);
        font-family: var(--og-modal-button-family, inherit);
        padding-left: 1rem;
        padding-right: 1rem;
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
        background-color: var(--og-modal-button-background, #e6e6e6);
        color: var(--og-modal-button-color, rgba(0, 0, 0, 0.8));
        border-radius: 0.25rem;
        border-style: none;
        border-width: 0;
        cursor: pointer;
        -webkit-appearance: button;
        text-transform: none;
        overflow: visible;
        line-height: 1.15;
        margin: 0;
        will-change: transform;
        -moz-osx-font-smoothing: grayscale;
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        transition: -webkit-transform 0.25s ease-out;
        transition: transform 0.25s ease-out;
        transition:
          transform 0.25s ease-out,
          -webkit-transform 0.25s ease-out;
      }

      .og-modal__btn:focus,
      .og-modal__btn:hover {
        -webkit-transform: scale(1.05);
        transform: scale(1.05);
      }

      .og-modal__btn-primary {
        background-color: var(--og-confirm-button-background, #00449e);
        color: var(--og-confirm-button-color, #fff);
      }
      .btn {
        cursor: pointer;
      }
    `}close(){this.removeAttribute("show"),this.dispatchEvent(new CustomEvent("close"))}confirm(){this.removeAttribute("show"),this.dispatchEvent(new CustomEvent("confirm"))}get confirmButton(){return this.showConfirmButton?kn`
          <span @click="${()=>this.confirm()}">
            <slot name="confirm" class="btn">
              <button class="og-modal__btn og-modal__btn-primary og-modal__confirm" @click="${()=>this.confirm()}">
                ${this.confirmText}
              </button>
            </slot>
          </span>
        `:kn``}get cancelButton(){return this.showCancelButton?kn`
          <span @click="${()=>this.close()}" class="btn">
            <slot name="cancel">
              <button class="og-modal__btn og-modal__cancel" @click="${()=>this.close()}">${this.cancelText}</button>
            </slot>
          </span>
        `:kn``}render(){return this.show?kn`
      <div class="og-modal is-open" aria-hidden="true">
        <div class="og-modal__overlay" tabindex="-1">
          <div class="og-modal__container" role="dialog" aria-modal="true">
            <header class="og-modal__header">
              <h2 class="og-modal__title">
                <slot name="title">${this.title}</slot>
              </h2>
              <button class="og-modal__close" aria-label="Close" @click="${()=>this.close()}"></button>
            </header>
            <main class="og-modal__content">
              <slot name="content">${this.content}</slot>
            </main>
            <footer class="og-modal__footer">${this.confirmButton} ${this.cancelButton}</footer>
          </div>
        </div>
      </div>
    `:kn``}};a(La,"Modal");var Ma=new WeakMap,Ua=on((e=>t=>{let r=Ma.get(t);if(void 0===e&&t instanceof yn){if(void 0!==r||!Ma.has(t)){let e=t.committer.name;t.committer.element.removeAttribute(e)}}else e!==r&&t.setValue(e);Ma.set(t,e)})),Ba=class extends Qn{static get styles(){return Kn`
      :host {
        display: inline-block;
        color: inherit;
        position: relative;
        height: 100%;
        cursor: inherit;
        font-family: inherit;
        font-weight: inherit;
      }
      select {
        font-weight: inherit;
        display: block;
        height: 100%;
        cursor: inherit;
        color: inherit;
        font-family: inherit;
        font-size: 1em;
        line-height: 1.3;
        padding: var(--og-select-padding, 0.4em 1.8em 0.3em 0.5em);
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        margin: 0;
        border: none;
        -moz-appearance: none;
        -webkit-appearance: none;
        appearance: none;
        background-color: transparent;
      }
      select::-ms-expand {
        display: none;
      }
      select:focus {
        outline: none;
      }
      select option {
        font-weight: inherit;
      }
      span {
        position: absolute;
        // background: white;
        color: inherit;
        fill: white;
        pointer-events: none;
        right: 0.3em;
        top: 50%;
        z-index: 1;
        font-size: 1em;
        line-height: 0.2em;
        transform: scaleY(0.5);
      }
    `}static get properties(){return{options:{type:Array},selected:{type:String},ariaLabel:{type:String}}}render(){return kn`
      <select @change="${a((e=>this.onChange(e)),"handleOnChange")}" aria-label="${Ua(this.ariaLabel)}">
        ${this.options.map((e=>kn`
            <option
              value="${e.value}"
              ?selected=${e.value===this.selected}
              .selected=${e.value===this.selected}
            >
              ${e.text}
            </option>
          `))}
      </select>
      <span>&#9660;</span>
    `}};a(Ba,"Select");var Va="automatic",za="manual",Ga=class extends Qn{constructor(){super(),this.triggerLabel="Show tooltip",this.open=!1,this.activationType=Va}static get properties(){return{placement:{type:String,default:"bottom"},triggerLabel:{type:String,attribute:"trigger-label"},activationType:{type:String,attribute:"activation-type"},open:{type:Boolean,attribute:!1}}}static get styles(){return Kn`
      :host[hidden] {
        display: none;
      }

      :host {
        display: inline-block;
        position: relative;
        z-index: 9;
      }

      /* reset default button styles */
      button.trigger {
        all: unset;
      }

      /* do not reset the button's default focus outline */
      button.trigger:focus {
        outline: revert;
      }

      .trigger {
        display: block;
        cursor: pointer;
      }

      /* for manual activation, hide the content completely from screen readers when the tooltip is closed */
      /* otherwise, interactive elements may receive focus even when they are not visible */
      [data-manual] .content {
        visibility: hidden;
      }

      .content {
        box-sizing: border-box;
        font-family: var(--og-tooltip-family, inherit);
        font-size: var(--og-tooltip-size, inherit);
        color: var(--og-tooltip-color, inherit);
        background-color: var(--og-tooltip-background, #ececec);
        box-shadow: var(--og-tooltip-box-shadow, 2px 2px 6px rgba(0, 0, 0, 0.28));
        display: block;
        opacity: 0;
        padding: var(--og-tooltip-padding, 0.5em);
        text-align: var(--og-tooltip-text-align, left);
        pointer-events: none;
        position: absolute;
        transform: translateY(10px);
        transition: transform 0.25s ease-out;
        z-index: 99999;
        border-radius: var(--og-tooltip-border-radius, 0);
      }

      .content:after {
        content: ' ';
        height: 0;
        position: absolute;
        width: 0;
      }

      .top {
        bottom: 100%;
        margin-bottom: 10px;
      }

      .bottom {
        top: 100%;
        margin-top: 10px;
      }

      .left {
        right: 100%;
        margin-right: 10px;
      }

      .right {
        left: 100%;
        margin-left: 10px;
      }

      .top-left {
        bottom: 100%;
        margin-bottom: 10px;
        right: 100%;
        margin-right: -16px;
      }

      .top-right {
        bottom: 100%;
        margin-bottom: 10px;
        left: 100%;
        margin-left: -16px;
      }

      .bottom-left {
        top: 100%;
        margin-top: 10px;
        right: 100%;
        margin-right: -16px;
      }

      .bottom-right {
        top: 100%;
        margin-top: 10px;
        left: 100%;
        margin-left: -16px;
      }

      .bottom-left:after,
      .bottom-right:after,
      .top-left:after,
      .top-right:after,
      .top:after,
      .bottom:after {
        margin-left: -10px;
        left: 50%;
        border-left: solid transparent 10px;
        border-right: solid transparent 10px;
      }

      .top-left:after,
      .top-right:after,
      .top:after {
        bottom: -10px;
        border-top: solid var(--og-tooltip-background, #ececec) 10px;
      }
      .bottom-left:after,
      .top-left:after {
        left: auto;
        right: 0;
      }

      .bottom-right:after,
      .top-right:after {
        left: 0;
        right: auto;
        margin-left: 0;
      }

      .bottom-left:after,
      .bottom-right:after,
      .bottom:after {
        top: -10px;
        border-bottom: solid var(--og-tooltip-background, #ececec) 10px;
      }

      .left:after,
      .right:after {
        margin-top: -10px;
        top: 50%;
        border-top: solid transparent 10px;
        border-bottom: solid transparent 10px;
      }
      .right:after {
        left: -10px;
        border-right: solid var(--og-tooltip-background, #ececec) 10px;
      }
      .left:after {
        right: -10px;
        border-left: solid var(--og-tooltip-background, #ececec) 10px;
      }

      .tooltip[data-open] .content {
        visibility: visible;
        opacity: 1;
        width: 200px;
        pointer-events: auto;
        transform: translateY(0px);
      }
    `}connectedCallback(){super.connectedCallback(),this.abortController=new AbortController;let e=this.abortController.signal;this.addEventListener("mouseenter",this.handleMouseEnter.bind(this),{signal:e}),this.addEventListener("mouseleave",this.handleMouseLeave.bind(this),{signal:e}),this.addEventListener("focusin",this.handleFocusIn.bind(this),{signal:e}),this.addEventListener("focusout",this.handleFocusOut.bind(this),{signal:e}),this.addEventListener("keydown",this.handleKeyDown.bind(this),{signal:e}),document.addEventListener("click",this.handleDocumentClick.bind(this),{signal:e})}async recalculatePosition(){if(await this.updateComplete,!this.open)return;let e=this.shadowRoot.querySelector(".trigger").getBoundingClientRect(),t=this.shadowRoot.querySelector(".content"),r=t.getBoundingClientRect();this.placement&&"top"!==this.placement&&"bottom"!==this.placement?("left"===this.placement||"right"===this.placement)&&(t.style.top=(-1*r.height+e.height)/2+"px"):t.style.left=(-1*r.width+e.width)/2+"px"}handleMouseEnter(){this.open=!0,this.recalculatePosition()}handleMouseLeave(){this.open=!1}handleFocusIn(){this.activationType===Va&&(this.open=!0,this.recalculatePosition())}handleFocusOut(e){this.activationType===Va&&(this.contains(e.relatedTarget)||(this.open=!1))}handleKeyDown(e){this.activationType===za&&"Escape"===e.key&&this.open&&(this.open=!1,e.stopPropagation())}handleClick(){this.activationType===za&&(this.open=!this.open,this.recalculatePosition())}handleDocumentClick(e){this.activationType!==za||!this.open||this.contains(e.target)||(this.open=!1)}disconnectedCallback(){super.disconnectedCallback(),this.abortController.abort()}render(){let e=this.triggerLabel?this.triggerLabel:void 0;return kn`
      <span class="tooltip" ?data-open="${this.open}" ?data-manual="${this.activationType===za}">
        ${this.activationType===za?kn`
              <button
                class="trigger"
                aria-label="${Ua(e)}"
                aria-expanded="${this.open}"
                aria-controls="tooltip-content"
                @click="${this.handleClick}"
              >
                <slot name="trigger">${this.trigger}</slot>
              </button>
            `:kn`
              <span class="trigger" tabindex="0" aria-label="${Ua(e)}">
                <slot name="trigger">${this.trigger}</slot>
              </span>
            `}
        <div class="content ${this.placement||"bottom"}" role="tooltip" id="tooltip-content">
          <slot name="content">${this.content}</slot>
        </div>
      </span>
    `}};a(Ga,"Tooltip");var Ha=class extends(oo(Qn)){static get properties(){return{options:{type:Array},shipmentsOptedIn:{type:Number},prepaidShipmentsSelected:{type:Number},defaultPrepaidShipments:{type:Number,attribute:"default-prepaid-shipments"}}}get prepaidOptedIn(){return this.shipmentsOptedIn>1}get selectedNumberOfShipments(){return this.prepaidShipmentsSelected||this.shipmentsOptedIn||this.getDefaultPrepaidShipments()}getDefaultPrepaidShipments(){return this.options.includes(this.defaultPrepaidShipments)?this.defaultPrepaidShipments:Tt(this.options)}handleSelect({target:{value:e}}){let t=+e;this.productChangePrepaidShipments(this.product,t,this.offer)}render(){return kn``}};a(Ha,"PrepaidStatus");var Wa=a(((e,t)=>({options:Ht(t.product.id)(e),shipmentsOptedIn:Gt(t.product)(e),prepaidShipmentsSelected:Bt(t.product)(e)})),"mapStateToProps"),Ja=(ji(Wa,{productChangePrepaidShipments:xr})(Ha),class extends Ha{constructor(){super(),this.options=[],this.text="shipments"}static get properties(){return{...super.properties,text:{type:String}}}static get styles(){return Kn`
      og-select {
        display: inline-block;
        cursor: pointer;
        background-color: var(--og-select-bg-color, #fff);
        border: var(--og-select-border, 1px solid #aaa);
        border-width: var(--og-select-border-width, 1px);
        box-shadow: 0 1px 0 1px rgba(0, 0, 0, 0.04);
        z-index: 1;
      }

      input {
        width: 1.2em;
        height: 1.2em;
        accent-color: var(--og-prepaid-checkbox-color, black);
        border-radius: 4px;
      }
    `}handleChange(e){e.target.checked?this.productChangePrepaidShipments(this.product,this.selectedNumberOfShipments,this.offer):this.productChangePrepaidShipments(this.product,null,this.offer)}render(){if(0===this.options.length)return kn``;let e=this.options.map((e=>({value:e,text:`${e} ${this.text}`})));return kn`
      <div>
        <input id="cbx" type="checkbox" .checked=${this.prepaidOptedIn} @change=${this.handleChange} />
        <label for="cbx">
          <slot name="label">Prepay for</slot>
          ${this.options.length>1?kn`
                <og-select
                  .options=${e}
                  .selected=${this.selectedNumberOfShipments}
                  .onChange="${e=>this.handleSelect(e)}"
                ></og-select>
              `:kn`
                <span>${e[0].text}</span>
              `}
          <slot name="append"></slot>
        </label>
      </div>
    `}});a(Ja,"PrepaidToggle");var Ya=a(((e,t)=>({options:Ht(t.product.id)(e),shipmentsOptedIn:Gt(t.product)(e),prepaidShipmentsSelected:Bt(t.product)(e)})),"mapStateToProps"),Ka=ji(Ya,{productChangePrepaidShipments:xr})(Ja),Za=class extends Ha{static get properties(){return{...super.properties,productPlans:{type:Object},prepaidShipmentsSelected:{type:Number},totalPrice:{type:Boolean,reflect:!0,attribute:"total-price"},perDeliveryPrice:{type:Boolean,reflect:!0,attribute:"per-delivery-price"},totalSavings:{type:Boolean,reflect:!0,attribute:"total-savings"},perDeliverySavings:{type:Boolean,reflect:!0,attribute:"per-delivery-savings"},percentageSavings:{type:Boolean,reflect:!0,attribute:"percentage-savings"},extraPercentageSavings:{type:Boolean,reflect:!0,attribute:"extra-percentage-savings"},numberOfShipments:{type:Boolean,reflect:!0,attribute:"number-of-shipments"}}}static get styles(){return Kn`
      :host {
        display: inline-block;
        text-indent: initial;
      }
    `}get value(){let e=ur(this.product),t=this.productPlans[e]||[],r=this.selectedNumberOfShipments,i=t.find((e=>e.prepaidShipments>1&&e.prepaidShipments===r));if(!i&&(i=t.find((e=>e.prepaidShipments>1)),!i))return"";let{discountRate:n,subscriptionPrice:o,prepaidShipments:a,regularPrepaidPrice:s,prepaidSavingsPerShipment:l,prepaidSavingsTotal:u,prepaidExtraSavingsPercentage:c}=i;return this.totalPrice?s:this.perDeliveryPrice?o:this.totalSavings?u:this.perDeliverySavings?l:this.percentageSavings?n:this.extraPercentageSavings?c:this.numberOfShipments?a:""}render(){let e=this.value;return e?kn`
        <slot name="prepend"></slot>
        ${e}
        <slot name="append"></slot>
      `:kn`
      <slot name="fallback"></slot>
    `}};a(Za,"PrepaidData");var Qa=a(((e,t)=>({options:Ht(t.product.id)(e),shipmentsOptedIn:Gt(t.product)(e),prepaidShipmentsSelected:Bt(t.product)(e),productPlans:e.productPlans})),"mapStateToProps"),Xa=ji(Qa)(Za),es=class extends Ha{constructor(){super(),this.addEventListener("click",this.handleClick.bind(this))}static get styles(){return Kn`
      :host {
        cursor: pointer;
        display: inline-block;
      }

      :host[hidden] {
        display: none;
      }

      .btn {
        position: relative;
        width: var(--og-radio-width, 1.4em);
        height: var(--og-radio-height, 1.4em);
        margin: var(--og-radio-margin, 0);
        padding: 0;
        border: 1px solid var(--og-primary-color, var(--og-border-color, black));
        background: #fff;
        border-radius: 100%;
        vertical-align: middle;
        color: var(--og-primary-color, var(--og-btn-color, black));
      }

      .radio {
        text-indent: -9999px;
        flex-shrink: 0;
      }

      .radio {
        border-color: var(--og-checkbox-border-color, black);
      }

      .radio.active::after {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        box-sizing: border-box;
        background: var(--og-checkbox-border-color, black);
      }

      .radio.active::after {
        content: ' ';
        border-radius: 100%;
        border: 2px solid #fff;
      }
    `}handleClick(e){this.prepaidOptedIn||this.productChangePrepaidShipments(this.product,this.selectedNumberOfShipments,this.offer),e.preventDefault()}render(){return kn`
      <slot name="default">
        <button id="action-trigger" class="btn radio ${this.prepaidOptedIn?"active":""}"></button>
        <label for="action-trigger">
          <slot name="label"><og-text key="prepaidOptInLabel"></og-text></slot>
        </label>
      </slot>
    `}};a(es,"PrepaidButton");var ts=a(((e,t)=>({options:Ht(t.product.id)(e),shipmentsOptedIn:Gt(t.product)(e),prepaidShipmentsSelected:Bt(t.product)(e)})),"mapStateToProps"),rs=ji(ts,{productChangePrepaidShipments:xr})(es),is=class extends Ha{constructor(){super(),this.options=[],this.text="shipments"}static get properties(){return{...super.properties,text:{type:String},selectLabel:{type:String,attribute:"select-label"}}}static get styles(){return Kn`
      og-select {
        display: inline-block;
        cursor: pointer;
        background-color: var(--og-select-bg-color, #fff);
        border: var(--og-select-border, 1px solid #aaa);
        border-width: var(--og-select-border-width, 1px);
        box-shadow: 0 1px 0 1px rgba(0, 0, 0, 0.04);
        z-index: 1;
      }
    `}render(){if(0===this.options.length)return kn``;let e=this.options.map((e=>({value:e,text:`${e} ${this.text}`})));return kn`
      ${this.options.length>1?kn`
            <og-select
              .options=${e}
              .selected=${this.selectedNumberOfShipments}
              .onChange="${e=>this.handleSelect(e)}"
              .ariaLabel="${this.selectLabel}"
            ></og-select>
          `:kn`
            <span>${e[0].text}</span>
          `}
      <slot name="append"></slot>
    `}};a(is,"PrepaidSelect");var ns=a(((e,t)=>({options:Ht(t.product.id)(e),shipmentsOptedIn:Gt(t.product)(e),prepaidShipmentsSelected:Bt(t.product)(e)})),"mapStateToProps"),os=ji(ns,{productChangePrepaidShipments:xr})(is),as=class extends Do{static get properties(){return{...super.properties,prepaidShipmentsOptedIn:{type:Number}}}get isActive(){return!(this.prepaidShipmentsOptedIn>0)&&this.subscribed}handleClick(e){if(!this.isActive){let e=this.frequencies&&this.frequencies.length>0?this.frequencies[0]:this.optinFrequency;this.optinProduct(ro(this),e,this.offer)}e.preventDefault()}render(){return kn`
      <slot name="default">
        <button id="action-trigger" class="btn radio ${this.isActive?" active":""}"></button>
        <label for="action-trigger">
          <slot>
            <slot name="label"><og-text key="offerOptInLabel"></og-text></slot>
          </slot>
        </label>
      </slot>
    `}};a(as,"SubscriptionButton");var ss=ji($o,{optinProduct:Sr})(as),ls=class extends Qn{static get styles(){return Kn`
      :host {
        position: fixed;
        top: 5em;
        righit: 5em;
        background-color: rgba(255, 255, 255, 0.7);
        width: 400px;
        padding: 1em;
        border-radius: 5px;
        border: 1px solid #ccc;
        box-shadow: 2px 2px 0 0 #000;
      }

      button {
        margin: 0 0.5em 0.5em;
        background-color: gray;
        color: white;
        border: 0;
        border-radius: 3px;
        cursor: pointer;
        padding: 0.5em;
      }

      button.primary {
        background-color: blue;
        padding: 1em;
        color: white;
        border: 0;
        border-radius: 3px;
      }

      button[disabled] {
        background-color: #777;
      }

      div {
        margin-bottom: 0.5em;
      }

      .message {
        margin-left: 0.5em;
        margin: 1em;
      }

      .success {
        color: green;
      }

      .error {
        color: red;
      }

      .warning {
        color: orange;
      }
      a {
        color: white;
      }
    `}runTests(){this.results=[],this.disabled=!0,this.requestUpdate(),document.querySelectorAll("og-offer").forEach((e=>{let t=e.store.getState(),r=e.getAttribute("product"),i=e.getAttribute("location"),n={messages:this.getOfferAttributeMessages(r,i).concat(this.getOfferRequestMessages(r,t)),product:r};this.results.push(n)})),this.testsRan=!0,this.disabled=!1,this.requestUpdate()}getOfferAttributeMessages(e,t){let r=[];return e||r.push({name:"Offer element found but missing product attribute",type:"error"}),t||r.push({name:"Offer element found but missing location attribute",type:"warning"}),e&&t&&r.push({name:"Offer element found and properly tagged",type:"success"}),r}getOfferRequestMessages(e,t){let r=t.inStock[e],i=t.autoshipEligible[e],n=[];return e&&!1===r&&n.push({name:"This product is marked as out of stock in the OG database",type:"warning"}),e&&!1===i&&n.push({name:"This product is not eligible for autoship",type:"warning"}),e&&null===r&&null===i&&n.push({name:"This product does not exist in our database",type:"error"}),n}resultsCodeBlock(){return 0===this.results.length?kn`
          <div class="message error">No offer element found on the page</div>
        `:this.results.map(((e,t)=>kn`
            <div>For offer tag with product = "${e.product}"</div>
            ${e.messages.map((e=>kn`
                <div class="message ${e.type}">${e.name}</div>
              `))}
            <button @click=${this.toggleProductFlags(t,{})}>Set inStock and eligible</button>
            <br />
            <button @click=${this.toggleProductFlags(t,{inStock:!1})}>Set to not inStock</button>
            <br />
            <button @click=${this.toggleProductFlags(t,{autoship:!1})}>Set to not eligible</button>
            <br />
            <button @click=${this.toggleProductFlags(t,{autoship:!1,inStock:!1})}>
              Set to not eligible and not in stock
            </button>
            <br />
            <button @click=${this.toggleUpsellPreview(t)}>Toggle upsell/regular in this offer</button>
            <br />
            <button @click=${this.toggleUpsellNextOrder(t)}>upsell product is in next order</button>
            <br />
          `))}toggleUpsellPreview(e){return t=>{t.preventDefault();let r=document.querySelectorAll("og-offer")[e];r.getAttribute("preview-upsell-offer")?r.removeAttribute("preview-upsell-offer"):r.setAttribute("preview-upsell-offer",!0),this.runTests()}}toggleProductFlags(e,{inStock:t=!0,autoship:r=!0,groups:i=["subscription","upsell"]}){return n=>{n.preventDefault();let o=document.querySelectorAll("og-offer")[e],a=o.product.id;o.store.dispatch(Ur({in_stock:{[a]:t},eligibility_groups:{[a]:i},result:"success",autoship:{[a]:r},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:{[a]:{initial:["5be321d7c17f4e18a757212b9a20bfcc"],ongoing:["e6534b9d877f41e586c37b7d8abc3a58","47c01e9aacbe40389b5c7325d79091aa","f35e842710b24929922db4a529eecd40"]}}},{},a)),this.runTests()}}toggleUpsellNextOrder(e){return t=>{let r=document.querySelectorAll("og-offer")[e],i=r.product.id;t.preventDefault(),r.store.dispatch(Dr({count:1,next:null,previous:null,results:[{order:"24d50352579511ea806cbc764e100cfd",offer:null,subscription:"8a076b7a0ea011e7a5bcbc764e105eda",product:i,components:[],quantity:1,public_id:"24d6901e579511ea806cbc764e100cfd",product_attribute:null,price:"14.99",extra_cost:"0.00",total_price:"13.49",one_time:!1,frozen:!1,first_placed:null}]})),this.runTests()}}render(){return kn`
      <div>
        ${this.testsRan?this.resultsCodeBlock():kn`
              <div>Click the button to run tests</div>
            `}
        <button ?disabled=${this.disabled} @click="${this.runTests.bind(this)}" class="primary">Run Test</button>
      </div>
    `}};function us(){let e="og-test-wizard";customElements.get(e)||customElements.define(e,ls);let t=document.createElement(e);document.body.appendChild(t)}a(ls,"TestWizard"),a(us,"default");var cs=[79,71,68,69,86],ds=a((()=>{if(window.OG_OFFERS_TEST_MODE_ENABLE)return;window.OG_OFFERS_TEST_MODE_ENABLE=!0;let e=0;document.addEventListener("keyup",(async function(t){if(t.which===cs[e]){let t=cs[e];setTimeout((function(){e<=t&&(e=0)}),5e3),e+=1,e>=cs.length&&us()}else e=0}),!1)}),"enable"),ps=class extends(oo(No)){static get properties(){return{...super.properties,regular:{type:Boolean,reflect:!0},subscription:{type:Boolean,reflect:!0},discount:{type:Boolean,reflect:!0},payAsYouGo:{type:Boolean,reflect:!0,attribute:"pay-as-you-go"},frequency:{type:Object},productPlans:{type:Object},discountedProductPriceFromOffers:{type:Object}}}static get styles(){return Kn`
      :host::before {
        clip-path: inset(100%);
        clip: rect(1px, 1px, 1px, 1px);
        height: 1px;
        overflow: hidden;
        position: absolute;
        white-space: nowrap;
        width: 1px;
      }

      :host([subscription])::before {
        content: 'Discounted subscription price';
      }

      :host([regular])::before {
        content: 'Regular price';
      }
    `}get value(){var e,t;let r=ur(this.product),i=this.frequency||this.configDefaultFrequency||(null==(e=this.offer)?void 0:e.defaultFrequency),n=this.productPlans[r]||[],o=this.payAsYouGo?n.find((e=>null===e.prepaidShipments||void 0===e.prepaidShipments)):n.find((e=>e.frequency===i));if(!o)return"";let{regularPrice:a,discountRate:s,subscriptionPrice:l}=o;return(!1===o.hasPriceAdjustments||(null==(t=this.offer)?void 0:t.overrideSellingPlanPrice))&&!o.prepaidShipments&&({regularPrice:a,discountRate:s,subscriptionPrice:l}=this.discountedProductPriceFromOffers),l!==a||this.payAsYouGo?this.regular?a:this.discount?s:l:""}render(){let e=this.value;return e?kn`
        <slot name="prepend"></slot>
        ${e}
        <slot name="append"></slot>
      `:kn`
      <slot name="fallback"></slot>
    `}};a(ps,"Price");var hs=a(((e,t)=>{var r,i;return{productPlans:e.productPlans,configDefaultFrequency:Yt(null==(r=t.product)?void 0:r.id)(e),frequency:zt(t.product)(e),discountedProductPriceFromOffers:Xt(null==(i=t.product)?void 0:i.id)(e)}}),"mapStateToProps"),fs=ji(hs)(ps);function gs(e){ds(),Li(e);try{customElements.define("og-when",Co),customElements.define("og-text",na),customElements.define("og-incentive-text",ba),customElements.define("og-offer",ja),customElements.define("og-select-frequency",_a),customElements.define("og-optout-button",Mo),customElements.define("og-optin-toggle",ea),customElements.define("og-optin-status",Ro),customElements.define("og-optin-button",jo),customElements.define("og-optin-select",Ho),customElements.define("og-upsell-button",Yo),customElements.define("og-frequency-status",zo),customElements.define("og-modal",La),customElements.define("og-select",Ba),customElements.define("og-tooltip",Ga),customElements.define("og-upsell-modal",Qo),customElements.define("og-next-upcoming-order",xa),customElements.define("og-price",fs),customElements.define("og-prepaid-toggle",Ka),customElements.define("og-prepaid-data",Xa),customElements.define("og-prepaid-button",rs),customElements.define("og-prepaid-select",os),customElements.define("og-subscription-button",ss)}catch{console.info("OG WebComponents already registered, skipping.")}let t=!1,r={store:e,isReady:()=>t,setEnvironment(t){return e.dispatch(Lr(t)),this},setMerchantId(t){return e.dispatch(Cr(t)),this},setAuthUrl(t){return e.dispatch(Ir(t)),this},receiveMerchantSettings(t){return e.dispatch(ii(t)),this},getProductsForPurchasePost:(t=[])=>Mi(e.getState(),t),getOptins:(t=[])=>Mi(e.getState(),t),clear(){e.dispatch(Gr())},addOptinChangedCallback(e){"function"==typeof e&&document.addEventListener("optin-changed",(t=>e(t.detail)))},disableOptinChangedCallbacks(){document.addEventListener("optin-changed",(e=>e.stopPropagation()),!0)},register(){},previewMode(e){return window.og=window.og||{},!1===e?delete window.og:(window.og.previewMode=!0,console.log("OG Offers preview mode enabled")),this},config(t){return e.dispatch(Qr(t)),this},setLocale(t){return e.dispatch(Zr(t)),this},addTemplate(t,r,i){return e.dispatch(Xr(t,r,i)),this},setTemplates(t){return e.dispatch(ei(t)),this},setPublicPath(e){return this},resolveSettings(t,r,i,n=e){if(!ut.shopify_selling_plans&&t&&r&&i){let e=[];i.product?e.push(i.product):i.cart&&Array.isArray(i.cart.products)&&(e=e.concat(i.cart.products));let t=n.getState(),{sessionId:r}=t;r&&e.forEach((e=>n.dispatch(Vr(e)))),i.product_discounts&&"object"==typeof i.product_discounts&&n.dispatch({type:Te,payload:i.product_discounts})}},initialize(i,n,o,a={}){var s;t&&console.warn("og.offers has been initialized already. Skipping.");let l=e.getState();return i&&i!==l.merchantId&&r.setMerchantId(i),n&&n!==(null==(s=l.environment)?void 0:s.name)&&r.setEnvironment(n),r.receiveMerchantSettings(a),o&&r.setAuthUrl(o),t||r.resolveSettings(i,n,window.og_settings,e),t=!0,this}};return window.OG=window.OG||{},Object.assign(window.OG,r),Object.assign(r.initialize,r),Ni(window.opener,r),r}a(gs,"makeApi");var ys=a(((e=[],t)=>{switch(t.type){case Ee:return[];case xe:return t.newValue?t.newValue.optedin:e;case K:case Q:{let[{prepaidShipments:r,...i},n]=_r(e,t.payload.product);return n.concat({...i,...t.payload.product,frequency:t.payload.frequency})}case X:{let{payload:r}=t,[{prepaidShipments:i,...n},o]=_r(e,r.product),a={...n,...r.product};return r.prepaidShipments&&(a.prepaidShipments=r.prepaidShipments),o.concat(a)}case Z:return e.filter((e=>!It(t.payload.product,e)));case ie:return e.map((e=>It(t.payload.product,e)?{...e,...t.payload.newProduct}:e));case me:return e.filter((e=>!It(t.payload.product,e)));case be:return[];default:return e}}),"optedin"),ms=a(((e=[],t)=>{switch(t.type){case Ee:return[];case xe:return t.newValue?t.newValue.optedout:e;case K:case Q:return e.filter((e=>!It(t.payload.product,e)));case Z:{let[r,i]=_r(e,t.payload.product);return i.concat({...r,...t.payload.product,frequency:t.payload.frequency})}case ie:return e.map((e=>It(t.payload.product,e)?{...e,...t.payload.newProduct}:e));case be:return[];default:return e}}),"optedout"),bs=a(((e={},{type:t,payload:r})=>{switch(t){case le:return r&&r.count>0?{...e,...r.results[0]&&{...r.results[0],place:new Date(Date.parse(r.results[0].place.replace(/-/gi,"/")))}}:e;case ce:return{...e,products:(r.results||[]).map((e=>e.product))};case ye:return{...e,...r,public_id:r.order,...r.product&&{products:(e.products||[]).concat(r.product)}};default:return e}}),"nextUpcomingOrder"),vs=a(((e={},t)=>t.type===re?{...e,...t.payload.autoship}:e),"autoshipEligible"),_s=a(((e={},t)=>{switch(t.type){case te:return{...e};case re:return{...e,...t.payload.in_stock};default:return e}}),"inStock"),Ss=a(((e={},t)=>t.type===re?{...e,...t.payload.eligibility_groups}:e),"eligibilityGroups"),ws=a(((e,t,r)=>e.map((e=>{let i=null==r?void 0:r[e];return{...t[e],...i?{criteria:i.criteria?i.criteria:{node_type:"PREMISE",standard:Me,premise_value:null},threshold_field:i.threshold_field,threshold_value:i.threshold_value}:{},id:[e][0]}}))),"mapIncentive"),Ps=a(((e={},t)=>t.type===re?{...e,...[...new Set(Object.keys(t.payload.incentives||{}))].reduce(((e,r)=>({...e,[r]:Object.entries(t.payload.incentives).filter((([e])=>e===r)).reduce(((e,[,{initial:r,ongoing:i}])=>({...e,initial:[...e.initial||[],...ws(r,t.payload.incentives_display,t.payload.incentives_display_enhanced)],ongoing:[...e.ongoing||[],...ws(i,t.payload.incentives_display,t.payload.incentives_display_enhanced)]})),{})})),{})}:e),"incentives"),Os=a(((e={},t)=>{switch(t.type){case K:case Q:return{...e,[ur(t.payload.product)]:t.payload.frequency};case Z:return{...e,[ur(t.payload.product)]:void 0};default:return e}}),"frequency"),xs=a(((e=!1,t)=>{switch(t.type){case ae:return{...t.payload};case se:return!1;default:return e}}),"auth"),Es=a(((e="",t)=>t.type===ee?t.payload:e),"merchantId"),Cs=a(((e=null,t)=>t.type===oe?t.payload:e),"authUrl"),qs=a(((e={},t)=>t.type===re?{...e,offerId:(t.payload.module_view||{}).regular,...t.payload.modifiers}:e),"offer"),Ts=a(((e="",t)=>t.type===re?(t.payload.module_view||{}).regular||"":e),"offerId"),ks=a(((e=null,t)=>{switch(t.type){case Ee:return null;case ne:return t.payload;default:return e}}),"sessionId"),As=a(((e={},t)=>{switch(t.type){case re:return{...e,...Object.entries(t.payload.autoship).map((([e])=>({[e]:Object.keys(t.payload.modifiers)}))).reduce(((e,t)=>({...e,...t})),{})};case be:return{};default:return e}}),"productOffer"),Is=a(((e={},t)=>t.type===Ce?{...e,[ur(t.payload.product)]:t.payload.firstOrderPlaceDate}:e),"firstOrderPlaceDate"),Ns=a(((e={},t)=>t.type===qe?{...e,[ur(t.payload.product)]:t.payload.productToSubscribe}:e),"productToSubscribe"),Fs=a(((e={},t)=>{switch(t.type){case de:return{...e,name:"local",apiUrl:"http://py3web.ordergroove.localhost",legoUrl:"http://py3lego.ordergroove.localhost"};case pe:return{...e,name:$e,apiUrl:"https://staging.offers.ordergroove.com",legoUrl:"https://staging.restapi.ordergroove.com"};case he:return{...e,name:"dev",apiUrl:"https://dev.offers.ordergroove.com",legoUrl:"https://dev.restapi.ordergroove.com"};case fe:return{...e,name:Re,apiUrl:"https://offers.ordergroove.com",legoUrl:"https://restapi.ordergroove.com"};default:return e}}),"environment"),$s=a(((e={offerOptInLabel:"Subscribe to save",offerIncentiveText:"Save {{ogIncentive DiscountPercent}} when you subscribe",offerOptOutLabel:"Deliver one-time only",offerEveryLabel:"Delivery Every",offerTooltipTrigger:"[?]",offerTooltipContent:"Seems this is a great subscription offering. Many fun details about this program exist.",optinButtonLabel:"•",optoutButtonLabel:"•",optinStatusOptedInLabel:"You're opted in!",optinStatusOptedOutLabel:"You're not opted in.",optinToggleLabel:"•",upsellButtonLabel:"Add item to order on ",upsellButtonPrefix:"",upsellModalContent:"Some upsell modal content",upsellModalOptInLabel:"Subscribe",upsellModalOptOutLabel:"Purchase one time",upsellModalTitle:"Impulse Upsell",upsellModalConfirmLabel:"Ok",upsellModalCancelLabel:"Cancel",defaultFrequencyCopy:"(Most Popular)",frequencyPeriods:{1:"day",2:"week",3:"month"},prepaidOptInLabel:"Prepaid Subscription",prepaidShipmentsLabel:"Number of prepaid shipments"},t)=>t.type===ve?{...e,...t.payload}:e),"locale"),Rs=a(((e={offerType:"radio"},t)=>{switch(t.type){case _e:return{...e,...t.payload,defaultFrequency:t.payload.defaultFrequency?nt(t.payload.defaultFrequency):e.defaultFrequency,frequenciesEveryPeriod:[],frequencies:t.payload.frequencies?t.payload.frequencies.map(nt):e.frequencies};case Ie:return{...e,merchantSettings:{...t.payload}};default:return e}}),"config"),Ds=a(((e=!1,t)=>t.type===Se?t.payload.isPreview:e),"previewStandardOffer"),js=a(((e=!1,t)=>t.type===we?t.payload.isPreview:e),"previewUpsellOffer"),Ls=a(((e={},t)=>t.type===re?{...e,...t.payload.autoship_by_default}:e),"autoshipByDefault"),Ms=a(((e=[],t)=>t.type===re?{...e,...t.payload.default_frequencies}:e),"defaultFrequencies"),Us=a(((e=[],t)=>{switch(t.type){case Oe:return[...t.payload||[]];case Pe:return[t.payload,...e];default:return e}}),"templates"),Bs=a(((e={},t)=>t.type===Te?Ui(t.payload):e),"productPlans"),Vs=a(((e={},t)=>{switch(t.type){case ue:{let{[t.payload.oldCartProductKey]:r,...i}=e;return{...i,[t.payload.newCartProductKey]:r}}case X:return t.payload.prepaidShipments?{...e,[t.payload.product.id]:t.payload.prepaidShipments}:e;default:return e}}),"prepaidShipmentsSelected"),zs=a(((e={},t)=>e),"price"),Gs=k({optedin:ys,optedout:ms,nextUpcomingOrder:bs,autoshipEligible:vs,inStock:_s,eligibilityGroups:Ss,incentives:Ps,frequency:Os,auth:xs,merchantId:Es,authUrl:Cs,offer:qs,offerId:Ts,experiments:Pi,sessionId:ks,productOffer:As,firstOrderPlaceDate:Is,productToSubscribe:Ns,environment:Fs,locale:$s,config:Rs,previewStandardOffer:Ds,previewUpsellOffer:js,autoshipByDefault:Ls,defaultFrequencies:Ms,templates:Us,productPlans:Bs,prepaidShipmentsSelected:Vs,price:zs}),Hs=a((e=>{var t,r;return Array.isArray(null==(t=e.selling_plan)?void 0:t.options)&&(null==(r=e.selling_plan)?void 0:r.options.some((e=>"Shipment amount"===(null==e?void 0:e.name))))}),"isPrepaidAllocation"),Ws=a((e=>{if(e&&e.length>1){let t=e.find((e=>"Shipment amount"===(null==e?void 0:e.name))).value.split(" ");return t.length>0?+t[0]:null}return null}),"getPrepaidShipmentsNumberFromOptions"),Js=a((e=>{var t,r;return(e.selling_plan_id||(null!=(r=null==(t=e.selling_plan)?void 0:t.id)?r:"")).toString()}),"getAllocationFrequency"),Ys=a(((e,t)=>mt(e.compare_at_price,t)),"getAllocationRegularPrice"),Ks=a(((e,t)=>{var r;if(Hs(e)){let i=Ws(null==(r=e.selling_plan)?void 0:r.options),n=Math.round(e.price/i);return mt(n,t)}return mt(e.price,t)}),"getAllocationSubscriptionPrice"),Zs=a(((e,t)=>Math.round(100*(e.compare_at_price-t)/e.compare_at_price)),"getPrepaidPercentage"),Qs=a(((e,t)=>{var r,i,n;if(Hs(e)){let t=Ws(null==(r=e.selling_plan)?void 0:r.options),i=e.price/t,n=Zs(e,i);return bt(n)}let o="";return"percentage"===(null==(i=e.price_adjustments[0])?void 0:i.value_type)?o=bt(e.price_adjustments[0].value):null!=(n=e.price_adjustments[0])&&n.value?o=mt(e.price_adjustments[0].value,t):e.compare_at_price&&(o=mt(e.compare_at_price-e.price,t)),o}),"getAllocationDiscountRate"),Xs=a((e=>{var t;return Hs(e)?Ws(null==(t=e.selling_plan)?void 0:t.options):null}),"getAllocationNumberOfShipments"),el=a(((e,t,r,i)=>{var n,o;let a=Ws(null==(n=e.selling_plan)?void 0:n.options),s=e.price/a,l=e.compare_at_price-s,u=Zs(e,s),c=null==(o=null==r?void 0:r.price_adjustments)?void 0:o[0],d=c&&"percentage"===c.value_type?c.value:null;return t.regularPrepaidPrice=mt(e.price,i),t.prepaidSavingsPerShipment=mt(Math.round(l),i),t.prepaidSavingsTotal=mt(Math.round(l*a),i),d&&u&&(t.prepaidExtraSavingsPercentage=bt(u-d)),t}),"addPrepaidPriceAndSavings"),tl=a(((e,t,r)=>{var i;e.selling_plan||(e.selling_plan=t.find((t=>t.id===e.selling_plan_id)));let n={frequency:Js(e),regularPrice:Ys(e,r),subscriptionPrice:Ks(e,r),discountRate:Qs(e,r),prepaidShipments:Xs(e),hasPriceAdjustments:(null==(i=e.price_adjustments)?void 0:i.length)>0};if(Hs(e)){let i=Ot(t);return el(e,n,i,r)}return n}),"mapSellingPlanToDiscount"),rl=a(((e,t,r=[],i)=>[...e,tl(t,r,i)]),"sellingPlanAllocationsReducer"),il=a((e=>e.selling_plan_groups.reduce(((e,t)=>[...e,...t.selling_plans.map((e=>({...e,group:t})))]),[])),"getSellingPlans"),nl=a(((e={offerType:"radio",productFrequencies:{},frequencies:[],frequenciesEveryPeriod:[]},t)=>{var r;if(ke===t.type){let{payload:{product:i,currency:n}}=t,o={},a=null==(r=i.variants)?void 0:r.reduce(((t,r)=>al(t,r,i.selling_plan_groups,e)),{}),s={...e.productFrequencies,...a};o={...o,productFrequencies:s,...Object.values(s)[0]};let l=ll(i);return Object.keys(l).length&&(o={...o,prepaidSellingPlans:{...e.prepaidSellingPlans,...l}}),{...e,...o,storeCurrency:n}}if(re===t.type){let{payload:{offer:r}}=t,{defaultFrequency:i,product:n}=r||{},{prepaidSellingPlans:o={}}=e,a=ur(null==n?void 0:n.id),s=e.productFrequencies[a],l={...e.productFrequencies,[a]:{...s,defaultFrequency:sl(a,i,o,null==s?void 0:s.frequencies,null==s?void 0:s.frequenciesEveryPeriod)}};return{...e,productFrequencies:l,...Object.values(l)[0]}}return Ie===t.type?{...e,merchantSettings:{...t.payload}}:e}),"config");function ol(e,t){var r,i;let n=vt(e),o=xt(n);if(null!=o&&o.length){let e=Et(n),a=(null==(i=null==(r=n.options)?void 0:r[0])?void 0:i.values)||o,s=null==t?void 0:t.defaultFrequency;return s&&gr(s)&&(s=br(o,e,s)||yr(o)||s),{frequencies:o,frequenciesEveryPeriod:e,frequenciesText:a,...s?{defaultFrequency:s}:{}}}return null}function al(e,t,r,i){let n=t.selling_plan_allocations.map((e=>e.selling_plan_group_id)),o=ol(r.filter((e=>n.includes(e.id))),i.productFrequencies[t.id]);return o&&(e[t.id]=o),e}function sl(e,t,r,i=[],n=[]){var o;return null!=(o=r[e])&&o.some((({sellingPlan:e})=>e===t))?yr(i)||t:gr(t)&&(br(i,n,t)||yr(i))||t}function ll(e){let t=null==e?void 0:e.selling_plan_groups.filter((e=>/^Prepaid-.*/.test(e.name)));return t.length?t.reduce(((e,t)=>{let r=t.name.split("-")[1],i=t.selling_plans.map((e=>({numberShipments:qt(e),sellingPlan:String(e.id)})));return{...e,[r]:i}}),{}):{}}a(ol,"getFrequencies"),a(al,"reduceSellingPlansToFrequencies"),a(sl,"getUpdatedDefaultFrequency"),a(ll,"getPrepaidSellingPlans");var ul=nl,cl=a(((e,t,r)=>{let i=Object.keys(e).filter((e=>e.startsWith(t.toString())));return i.length?{...e,...i.reduce(((e,t)=>({...e,[t]:r})),{})}:e}),"overrideLineKey"),dl=a(((e,t,r)=>{if(!r)return null;if(!gr(r))return r;if(mr(e,t)){return br(e,t,r)||yr(e)}return r}),"getDefaultSellingPlan"),pl=a(((e,t,r)=>e.map((e=>gr(null==e?void 0:e.frequency)?{...e,frequency:mr(null==r?void 0:r.frequencies,null==r?void 0:r.frequenciesEveryPeriod)?br(null==r?void 0:r.frequencies,null==r?void 0:r.frequenciesEveryPeriod,e.frequency)||br(null==r?void 0:r.frequencies,null==r?void 0:r.frequenciesEveryPeriod,null==t?void 0:t.defaultFrequency)||yr(null==r?void 0:r.frequencies):e.frequency}:e))),"mapExistingOptinsFromOfferResponse"),hl=a((({autoship:e={},autoship_by_default:t={},default_frequencies:r={},in_stock:i={},eligibility_groups:n={}},o,a,s,l)=>Object.keys(e).reduce(((u,c)=>{var d;if(!o.some((e=>e.id===c))&&t[c]&&i[c]){if(e[c])return u.concat({id:c,frequency:fl({frequencyConfig:s,offerEl:a,default_frequencies:r,id:c})});if(null!=(d=n[c])&&d.includes(Ue)){let e=l?Tt(l):null;return u.concat({id:c,frequency:(null==e?void 0:e.sellingPlan)||Sl,prepaidShipments:(null==e?void 0:e.numberShipments)||null})}}return u}),[])),"reduceNewOptinsFromOfferResponse"),fl=a((({frequencyConfig:e,offerEl:t,default_frequencies:r,id:i})=>{let n,{frequencies:o,frequenciesEveryPeriod:a}=e,{defaultFrequency:s}=t||{},l=r[i];return n=r[i]&&mr(o,a)?br(o,a,`${l.every}_${l.every_period}`)||dl(o,a,s)||yr(o):r[i]?`${l.every}_${l.every_period}`:dl(o,a,s)||"_",n}),"getOptInDefaultFrequency"),gl=a(((e,t)=>({...cl(e,t.id,t.available),[t.id]:t.available})),"productOrVariantInStockReducer"),yl=a(((e,t)=>{let r=ur(t.key);return{...e,[t.key]:e[r]||null}}),"reduceProductCartLine"),ml=a(((e={},t)=>{var r;if(Ae===t.type){let{payload:r}=t;return r.items.reduce(yl,e)}if(ke===t.type){let{payload:{product:i}}=t,n=_t(null==i?void 0:i.selling_plan_groups),o=new Set(null!=(r=n.flatMap((e=>e.selling_plans.map((e=>e.id)))))?r:[]);return i.variants.reduce(((e,t)=>{var r,i;let n=(null!=(i=null==(r=null==t?void 0:t.selling_plan_allocations)?void 0:r.filter((e=>o.has(e.selling_plan_id))))?i:[]).length>0;return{...cl(e,t.id,n),[t.id]:n}}),e)}return Se===t.type?!0!==t.payload.isPreview?e:{...e,[t.payload.productId]:!0}:e}),"autoshipEligible"),bl=a(((e={},t)=>{var r;if(Ae===t.type)return t.payload.items.reduce(yl,e);if(ke===t.type){let{payload:{product:i}}=t;return[i,...null!=(r=null==i?void 0:i.variants)?r:[]].reduce(gl,e)||e}return te===t.type&&null===t.payload.product?{...e}:Se===t.type?!0!==t.payload.isPreview?e:{...e,[t.payload.productId]:!0}:e}),"inStock"),vl=a(((e={},t)=>e),"offer");function _l(e){let t=qt(e.selling_plan_allocation.selling_plan),r={id:e.key,frequency:`${e.selling_plan_allocation.selling_plan.id}`};return t&&(r.prepaidShipments=t),r}a(_l,"getOptedInItem");var Sl="prepaid-replace-me",wl=a(((e=[],t)=>{if(Ae===t.type){let r=t.payload;return e.filter((e=>!e.id.includes(":"))).concat(r.items.reduce(((e,t)=>t.selling_plan_allocation?[...e,_l(t)]:e),[]))}if(re===t.type){let r=t.payload,{offer:i={},frequencyConfig:n,prepaidSellingPlans:o}=r,a=pl(e,i,n),s=hl(r,a,i,n,o);return[...a,...s]}if(ke===t.type){let{product:r}=t.payload,i=vt(null==r?void 0:r.selling_plan_groups),n=ll(r),o=i?xt(i):[],a=i?Et(i):[];return e.map((e=>{let t=n[e.id];if(i&&gr(e.frequency))return{...e,frequency:br(o,a,e.frequency)||yr(o)};if(e.frequency===Sl&&(null==t?void 0:t.length)>0){let{sellingPlan:r,numberShipments:i}=Tt(t);return{...e,frequency:r,prepaidShipments:i}}return e})).filter((e=>e.frequency!==Sl))}if(X===t.type){let{payload:r}=t,i=ys(e,t),[n,o]=_r(i,r.product);return o.concat({...n,...r.product,frequency:r.frequency})}return ys(e,t)}),"optedin"),Pl=a(((e={},t)=>{var r;if(ke===t.type){let{payload:{product:i}}=t;return(null==(r=i.variants)?void 0:r.reduce(((e,t)=>({...e,[t.id]:{value:t.price}})),e))||e}return e}),"price"),Ol=a(((e={},t)=>e),"productOffer"),xl=a(((e={},t)=>{if(ke===t.type){let{payload:{product:r,currency:i}}=t,n=il(r);return r.variants.reduce(((e,t)=>{var r;return{...e,[t.id]:null==(r=t.selling_plan_allocations)?void 0:r.reduce(((e,t)=>rl(e,t,n,i)),[])}}),e)||e}if(Ae===t.type){let r=t.payload;return r.items.reduce(((e,t)=>t.selling_plan_allocation?{...e,[t.key]:rl([],t.selling_plan_allocation,[],r.currency)}:e),e)||e}return e}),"productPlans"),El=k({auth:xs,authUrl:Cs,autoshipByDefault:Ls,autoshipEligible:ml,config:ul,defaultFrequencies:Ms,eligibilityGroups:Ss,environment:Fs,firstOrderPlaceDate:Is,incentives:Ps,inStock:bl,locale:$s,merchantId:Es,nextUpcomingOrder:bs,offer:vl,offerId:Ts,experiments:Pi,optedin:wl,optedout:ms,previewStandardOffer:Ds,previewUpsellOffer:js,price:Pl,productOffer:Ol,productPlans:xl,productToSubscribe:Ns,sessionId:ks,templates:Us,prepaidShipmentsSelected:Vs});function Cl(e,t){return window.og&&window.og.previewMode?Gs(e,t):El(e,t)}a(Cl,"shopifyReducer");var ql=c(p()),Tl=c(d());function kl(e,t,r){let i=`[name="id"][value="${e}"]`,n=`form[action="/cart/add"] option[value="${e}"]`;if(!t)return;let o=document.querySelectorAll(i);o.length||(o=document.querySelectorAll(n)),[...o].forEach((e=>{let i=e.form,n=null==i?void 0:i.querySelector(`[name="${t}"]`);n||(n=document.createElement("input"),n.type="hidden",n.name=`attributes[${t}]`,null==i||i.appendChild(n)),n.value=r}))}function Al(){return`og__${Math.ceil((new Date).getTime()/1e3)}`}function Il(e,t){var r,i,n,o;if(!(null==(r=e.payload.offer)?void 0:r.autoshipByDefault))return;let a=null==(i=e.payload.offer)?void 0:i.product.id,s=Al(),l=(null==(n=e.payload.offer)?void 0:n.location)||"",u=(null==(o=e.payload.offer)?void 0:o.variationId)||"",c=Zl(a,t),d=[a,K.toLowerCase(),l,c,u].join(",");kl(a,s,d)}function Nl(e){return t=>r=>{switch(t(r),r.type){case K:case Z:case Q:{let e=r.payload.offer,t=Kl(r);e&&!e.isCart&&kl(e.product.id,t[0],t[1]);break}case re:Il(r,e)}}}a(kl,"updateTrackingInputs"),a(Al,"getTrackingKey"),a(Il,"addDefaultToSubTracking"),a(Nl,"shopifyTrackingMiddleware");var Fl,$l,Rl=(null==($l=null==(Fl=window.Shopify)?void 0:Fl.routes)?void 0:$l.root)||"/",Dl=`${Rl}cart.js`,jl=`${Rl}cart/change.js`,Ll=`${Rl}cart/update.js`,Ml=`${Rl}products/`,Ul="__ordergroove_offer_id",Bl=a((e=>(0,Tl.debounce)(100,!1,(function(t){let{id:r}=Object.fromEntries([...new FormData(t).entries()]);r?e.setAttribute("product",r):e.removeAttribute("product")}))),"makeSyncProductId");async function Vl(){var e,t;return(null==(t=null==(e=window.Shopify)?void 0:e.currency)?void 0:t.active)||(await Gl()).currency}async function zl(e,t){let r=Hl(t);if(r)try{let[i,n]=await Promise.all([Wl(r),Vl()]),o={product:i,offer:t,currency:n};e.dispatch({type:ke,payload:o})}catch(e){console.warn("OG: Unable to fetch product details for PDP",e)}let i=t.closest("form");if(!i){let e=t.parentElement;for(;e&&(i=e.querySelector('form[action$="/cart/add"]'),!i&&"body"!==e.tagName.toLowerCase());)e=e.parentElement}if(i){let e=Bl(t);i.addEventListener("change",(()=>e(i))),new MutationObserver((t=>{t.every((e=>"attributes"===e.type))?t.some((e=>"id"===e.target.name))&&e(i):e(i)})).observe(i,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["value"]})}else console.info("no /cart/add form found for og-offer",t)}async function Gl(){return(await fetch(Dl)).json()}function Hl(e){return[()=>null==e?void 0:e.dataset.shopifyProductHandle,()=>{var e,t;return((null==(t=null==(e=document.querySelector('[href$=".oembed"]'))?void 0:e.getAttribute("href"))?void 0:t.match(/\/([^/]+)\.oembed$/))||[])[1]},()=>{var e,t;return(document.querySelector('meta[property="og:type"][content="product"]')&&(null==(t=null==(e=document.querySelector('meta[property="og:url"][content]'))?void 0:e.getAttribute("content"))?void 0:t.match(/\/([^/]+)$/))||[])[1]},()=>{var e;return null==(e=[...document.querySelectorAll("[type$=json]")].map((e=>JSON.parse(e.textContent||"{}"))).find((e=>e.handle&&e.price)))?void 0:e.handle}].reduce(((e,t)=>e||t()),"")}a(Vl,"getCurrency"),a(zl,"setupPdp"),a(Gl,"getCart"),a(Hl,"guessProductHandle");var Wl=(0,ql.default)((async function(e){return(await fetch(`${Ml}${e}.js`)).json()}));async function Jl(e,t){let r=await Gl(),{items:i}=r,n=r;e.dispatch({type:Ae,payload:n});let o=Number(t.product.id);o<=i.length&&t.setAttribute("product",i[o-1].key),(await Promise.all(Array.from(new Set(i.map((({handle:e})=>e)))).map(Wl))).forEach((i=>{let n={product:i,offer:t,currency:r.currency};e.dispatch({type:ke,payload:n})}))}async function Yl(e,t){var r,i;let n=e.payload.offer,o=e.payload.frequency||Zl(e.payload.product.id,t),a=Kl(e);if(null!=n&&n.isCart)try{n.style.pointerEvents="none",n.style.opacity=".7";let s=Array.from(document.querySelectorAll('[id^="shopify-section-"][id$=__cart-items], [id^="shopify-section-"][id$="__cart-footer"],#cart-live-region-text,#cart-icon-bubble')),l=e.payload.product.id,u=await Gl(),c=null==(r=null==u?void 0:u.items)?void 0:r.findIndex((e=>e.key===l)),d=u.items[c],p=d.quantity,h=ur(l),f=Ql(t),g={...Object.fromEntries([a]),...f?{[Ul]:f}:{}};if(Object.keys(g).length>0&&200!==(await fetch(Ll,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({attributes:g})})).status)throw new Error("Cart attributes not updated");let y=await fetch(jl,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:l,quantity:p,properties:d.properties,selling_plan:o||null,sections:s.map((e=>e.id.replace(/^shopify-section-/,"")))})});if(200!==y.status)throw new Error("Cart not updated");let m=await y.json(),b=u.items.length===m.items.length?m.items[c].key:null==(i=m.items.find((e=>e.quantity===p&&e.product_id===h&&(!o&&!e.selling_plan_allocation||(null==e?void 0:e.selling_plan_allocation.selling_plan.id)===o))))?void 0:i.key;b&&(t.dispatch({type:ue,payload:{oldCartProductKey:l,newCartProductKey:b}}),n.setAttribute("product",b));let v=m;t.dispatch({type:Ae,payload:v});let _=new CustomEvent("og-cart-updated",{bubbles:!0,cancelable:!0});if(n.dispatchEvent(_),_.defaultPrevented)return;let S=m.sections;Object.values(S).length?s.forEach((e=>{let t=e.id.replace(/^shopify-section-/,"");if(!(t in S))return;let r=S[t],i=(new DOMParser).parseFromString(r.toString()||"","text/html").getElementById(e.id);i&&(e.innerHTML=i.innerHTML)})):window.location.pathname.startsWith("/cart")&&window.location.reload()}catch(e){console.log("OG Error updating cart",e)}finally{n.style.pointerEvents="auto",n.style.opacity="1"}}function Kl(e){var t,r;let i=e.payload.product.id;if(!i)return[];let n=Al(),o=(null==(t=e.payload.offer)?void 0:t.location)||"",a=(null==(r=e.payload.offer)?void 0:r.variationId)||"",s=[i,e.type.toLowerCase(),o];switch(e.type){case te:case Z:s.push(""),s.push(a);break;case K:case Q:s.push(e.payload.frequency),s.push(a);break;default:return[]}return[n,s.join(",")]}function Zl(e,t){let r=Mt({id:e})(t.getState());return r?r.frequency:void 0}function Ql(e){let t=e.getState();return or(t)?t.offerId:null}function Xl(e,t){null!=t&&t.isCart||null==t||!t.shouldEnableOffer||[...document.querySelectorAll('form[action$="/cart/add"] [name=id]')].forEach((t=>{let r=Zl(t.value,e);vr(t.form,"selling_plan",r),vr(t.form,"attributes[og__session]",e.getState().sessionId);let i=Ql(e);i&&vr(t.form,`attributes[${Ul}]`,i)}))}function eu(e){return t=>r=>{var i;switch(r.type){case K:case Z:case Q:break;case te:null!=(i=r.payload.offer)&&i.isCart?Jl(e,r.payload.offer):zl(e,r.payload.offer)}switch(t(r),r.type){case K:case Z:case Q:case X:Yl(r,e);case te:case re:case ke:Xl(e,r.payload.offer)}}}a(Jl,"setupCart"),a(Yl,"synchronizeCartOptin"),a(Kl,"getTrackingEvent"),a(Zl,"getSubscribedFrequency"),a(Ql,"getOfferIdAttribute"),a(Xl,"synchronizeSellingPlan"),a(eu,"shopifyMiddleware");var tu="og_auth_begin",ru=a((e=>{let[t,r,i,n]=atob(e).split("|");return{id:t,signature:i,timestamp:r,email:n}}),"parseIntegrationTempAuth");async function iu({store:e}){var t;let[r]=lr(),i=sr(),n=null!=i&&i.dataset.customer?ru(i.dataset.customer):null==(t=window.ogShopifyConfig)?void 0:t.customer;if(n){let t=await ou(n);if(t){let[i,n,o]=t.split("|");e.dispatch(kr(r,i,Number(n),o))}}else hr("og_auth")}async function nu(e){try{let t=await(await fetch(`/apps/subscriptions/auth/?customer=${e.id}&customer_signature=${e.signature}&customer_timestamp=${e.timestamp}`)).text(),r=t.lastIndexOf(tu);if(r<0)throw"Invalid response from OG auth endpoint";return JSON.parse(t.substring(r+13,t.lastIndexOf("og_auth_end")))}catch(e){console.error(e)}}async function ou(e){let t=fr("og_auth");if(t)return t;let{customerId:r,timestamp:i,signature:n}=await nu(e);if(!r)return"";let o=new Date,a=btoa(n);o.setTime(o.getTime()+72e5);let s=`${r}|${i}|${a};expires=${o.toUTCString()}`;return document.cookie=`og_auth=${s};secure;path=/`,s}a(iu,"authorizeShopifyCustomer"),a(nu,"fetchOGSignature"),a(ou,"getOrCreateAuthCookie");var au,su,lu,uu=Ci(...null!=(au=ut)&&au.shopify_selling_plans?[Cl,eu]:[Gs],ut.shopify&&Nl),cu=gs(uu),du=cu.isReady,pu=cu.addOptinChangedCallback,hu=cu.addTemplate,fu=cu.clear,gu=cu.config,yu=cu.disableOptinChangedCallbacks,mu=cu.getOptins,bu=cu.getProductsForPurchasePost,vu=cu.initialize,_u=cu.previewMode,Su=cu.register,wu=cu.resolveSettings,Pu=cu.setAuthUrl,Ou=cu.setEnvironment,xu=cu.setLocale,Eu=cu.setMerchantId,Cu=cu.setPublicPath,qu=cu.setTemplates,Tu=cu.setupCart,ku=cu.setupProduct,Au=cu.setupProducts,Iu=a((()=>pr(cu)),"autoInit"),Nu=cu.initialize;return null!=(su=ut)&&su.shopify_selling_plans&&ar((()=>iu(cu))),lu=S,u(t({},"__esModule",{value:!0}),lu)})()));
//# sourceMappingURL=/sm/2fad07a79b86da868351428a92b5aff81ec62d170298cab617e229a3b6edc754.map