@ordergroove/offers 2.34.8-alpha-PR-784-3.6 → 2.34.8-alpha-PR-784-4.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,7 @@
4
4
  │ └ examples/index.js
5
5
  └ examples/index.js ───────────────────────────────────────── 9.7kb ─── 3.4%
6
6
 
7
- dist/offers.js ───────────────────────────────────────────── 143.7kb ─ 100.0%
7
+ dist/offers.js ───────────────────────────────────────────── 143.8kb ─ 100.0%
8
8
  ├ src/components/Offer.js ─────────────────────────────────── 8.2kb ─── 5.7%
9
9
  │ └ src/make-api.js
10
10
  │ └ src/index.js
@@ -25,14 +25,14 @@
25
25
  │ └ src/components/Price.js
26
26
  │ └ src/make-api.js
27
27
  │ └ src/index.js
28
+ ├ src/shopify/shopifyMiddleware.ts ────────────────────────── 5.0kb ─── 3.5%
29
+ │ └ src/index.js
28
30
  ├ node_modules/lit-html/lib/parts.js ──────────────────────── 4.9kb ─── 3.4%
29
31
  │ └ node_modules/lit-html/lit-html.js
30
32
  │ └ node_modules/lit-element/lit-element.js
31
33
  │ └ src/components/Price.js
32
34
  │ └ src/make-api.js
33
35
  │ └ src/index.js
34
- ├ src/shopify/shopifyMiddleware.ts ────────────────────────── 4.9kb ─── 3.4%
35
- │ └ src/index.js
36
36
  ├ src/components/Modal.js ─────────────────────────────────── 4.8kb ─── 3.4%
37
37
  │ └ src/make-api.js
38
38
  │ └ src/index.js
@@ -111,7 +111,7 @@
111
111
  ├ src/components/Price.js ─────────────────────────────────── 1.5kb ─── 1.1%
112
112
  │ └ src/make-api.js
113
113
  │ └ src/index.js
114
- ├ src/components/OptinToggle.js ───────────────────────────── 1.5kb ─── 1.1%
114
+ ├ src/components/OptinToggle.js ───────────────────────────── 1.5kb ─── 1.0%
115
115
  │ └ src/make-api.js
116
116
  │ └ src/index.js
117
117
  ├ src/components/OptinSelect.js ───────────────────────────── 1.4kb ─── 1.0%
@@ -229,7 +229,7 @@
229
229
  ├ src/components/NextUpcomingOrder.js ─────────────────────── 377b ──── 0.3%
230
230
  │ └ src/make-api.js
231
231
  │ └ src/index.js
232
- ├ node_modules/lit-html/lib/template-factory.js ───────────── 368b ──── 0.3%
232
+ ├ node_modules/lit-html/lib/template-factory.js ───────────── 368b ──── 0.2%
233
233
  │ └ node_modules/lit-html/lit-html.js
234
234
  │ └ node_modules/lit-element/lit-element.js
235
235
  │ └ src/components/Price.js
package/dist/offers.js CHANGED
@@ -8,7 +8,7 @@ else {
8
8
  window.og['offers'] = factory();
9
9
  }
10
10
  })(()=>{
11
- var lib=(()=>{var fa=Object.create;var pt=Object.defineProperty;var ha=Object.getOwnPropertyDescriptor;var ma=Object.getOwnPropertyNames;var ga=Object.getPrototypeOf,ya=Object.prototype.hasOwnProperty;var n=(t,e)=>pt(t,"name",{value:e,configurable:!0});var _e=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Sn=(t,e)=>{for(var r in e)pt(t,r,{get:e[r],enumerable:!0})},En=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of ma(e))!ya.call(t,i)&&i!==r&&pt(t,i,{get:()=>e[i],enumerable:!(o=ha(e,i))||o.enumerable});return t};var ce=(t,e,r)=>(r=t!=null?fa(ga(t)):{},En(e||!t||!t.__esModule?pt(r,"default",{value:t,enumerable:!0}):r,t)),ba=t=>En(pt({},"__esModule",{value:!0}),t);var Mt=_e((Lt,Rn)=>{(function(t,e){typeof Lt=="object"&&typeof Rn<"u"?e(Lt):typeof define=="function"&&define.amd?define(["exports"],e):(t=t||self,e(t.throttleDebounce={}))})(Lt,function(t){"use strict";function e(o,i,s,a){var c,p=!1,l=0;function f(){c&&clearTimeout(c)}n(f,"clearExistingTimeout");function d(){f(),p=!0}n(d,"cancel"),typeof i!="boolean"&&(a=s,s=i,i=void 0);function h(){for(var O=arguments.length,_=new Array(O),m=0;m<O;m++)_[m]=arguments[m];var S=this,T=Date.now()-l;if(p)return;function b(){l=Date.now(),s.apply(S,_)}n(b,"exec");function w(){c=void 0}n(w,"clear"),a&&!c&&b(),f(),a===void 0&&T>o?b():i!==!0&&(c=setTimeout(a?w:b,a===void 0?o-T:o))}return n(h,"wrapper"),h.cancel=d,h}n(e,"throttle");function r(o,i,s){return s===void 0?e(o,i,!1):e(o,s,i!==!1)}n(r,"debounce"),t.debounce=r,t.throttle=e,Object.defineProperty(t,"__esModule",{value:!0})})});var yt=_e((hu,Wn)=>{var Ra="Expected a function",Vn="__lodash_hash_undefined__",Aa="[object Function]",Na="[object GeneratorFunction]",Ia=/[\\^$.*+?()[\]{}|]/g,ka=/^\[object .+?Constructor\]$/,qa=typeof window=="object"&&window&&window.Object===Object&&window,Da=typeof self=="object"&&self&&self.Object===Object&&self,Hn=qa||Da||Function("return this")();function Fa(t,e){return t?.[e]}n(Fa,"getValue");function Ua(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}n(Ua,"isHostObject");var La=Array.prototype,Ma=Function.prototype,Gn=Object.prototype,eo=Hn["__core-js_shared__"],jn=function(){var t=/[^.]+$/.exec(eo&&eo.keys&&eo.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),Bn=Ma.toString,to=Gn.hasOwnProperty,$a=Gn.toString,ja=RegExp("^"+Bn.call(to).replace(Ia,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Va=La.splice,Ha=zn(Hn,"Map"),gt=zn(Object,"create");function Pe(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}n(Pe,"Hash");function Ga(){this.__data__=gt?gt(null):{}}n(Ga,"hashClear");function Ba(t){return this.has(t)&&delete this.__data__[t]}n(Ba,"hashDelete");function za(t){var e=this.__data__;if(gt){var r=e[t];return r===Vn?void 0:r}return to.call(e,t)?e[t]:void 0}n(za,"hashGet");function Ya(t){var e=this.__data__;return gt?e[t]!==void 0:to.call(e,t)}n(Ya,"hashHas");function Wa(t,e){var r=this.__data__;return r[t]=gt&&e===void 0?Vn:e,this}n(Wa,"hashSet");Pe.prototype.clear=Ga;Pe.prototype.delete=Ba;Pe.prototype.get=za;Pe.prototype.has=Ya;Pe.prototype.set=Wa;function He(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}n(He,"ListCache");function Ja(){this.__data__=[]}n(Ja,"listCacheClear");function Ka(t){var e=this.__data__,r=tr(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():Va.call(e,r,1),!0}n(Ka,"listCacheDelete");function Qa(t){var e=this.__data__,r=tr(e,t);return r<0?void 0:e[r][1]}n(Qa,"listCacheGet");function Za(t){return tr(this.__data__,t)>-1}n(Za,"listCacheHas");function Xa(t,e){var r=this.__data__,o=tr(r,t);return o<0?r.push([t,e]):r[o][1]=e,this}n(Xa,"listCacheSet");He.prototype.clear=Ja;He.prototype.delete=Ka;He.prototype.get=Qa;He.prototype.has=Za;He.prototype.set=Xa;function Te(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}n(Te,"MapCache");function ec(){this.__data__={hash:new Pe,map:new(Ha||He),string:new Pe}}n(ec,"mapCacheClear");function tc(t){return rr(this,t).delete(t)}n(tc,"mapCacheDelete");function rc(t){return rr(this,t).get(t)}n(rc,"mapCacheGet");function oc(t){return rr(this,t).has(t)}n(oc,"mapCacheHas");function nc(t,e){return rr(this,t).set(t,e),this}n(nc,"mapCacheSet");Te.prototype.clear=ec;Te.prototype.delete=tc;Te.prototype.get=rc;Te.prototype.has=oc;Te.prototype.set=nc;function tr(t,e){for(var r=t.length;r--;)if(pc(t[r][0],e))return r;return-1}n(tr,"assocIndexOf");function ic(t){if(!Yn(t)||ac(t))return!1;var e=lc(t)||Ua(t)?ja:ka;return e.test(cc(t))}n(ic,"baseIsNative");function rr(t,e){var r=t.__data__;return sc(e)?r[typeof e=="string"?"string":"hash"]:r.map}n(rr,"getMapData");function zn(t,e){var r=Fa(t,e);return ic(r)?r:void 0}n(zn,"getNative");function sc(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}n(sc,"isKeyable");function ac(t){return!!jn&&jn in t}n(ac,"isMasked");function cc(t){if(t!=null){try{return Bn.call(t)}catch{}try{return t+""}catch{}}return""}n(cc,"toSource");function ro(t,e){if(typeof t!="function"||e&&typeof e!="function")throw new TypeError(Ra);var r=n(function(){var o=arguments,i=e?e.apply(this,o):o[0],s=r.cache;if(s.has(i))return s.get(i);var a=t.apply(this,o);return r.cache=s.set(i,a),a},"memoized");return r.cache=new(ro.Cache||Te),r}n(ro,"memoize");ro.Cache=Te;function pc(t,e){return t===e||t!==t&&e!==e}n(pc,"eq");function lc(t){var e=Yn(t)?$a.call(t):"";return e==Aa||e==Na}n(lc,"isFunction");function Yn(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}n(Yn,"isObject");Wn.exports=ro});var Sr=_e((nf,Qi)=>{var rp={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"};Qi.exports=rp});var Xi=_e((sf,Zi)=>{var Ie=Sr(),op=n(t=>{let e="",r=[];for(let o of t){let i=o.charCodeAt(0);switch(i){case Ie.PAR_OPEN:case Ie.PAR_CLOSE:case Ie.OP_NOT:case Ie.BINARY_AND:case Ie.BINARY_OR:e&&(r.push({type:Ie.LITERAL,value:e}),e=""),r.push({type:i,value:o});break;default:e+=o}}return e&&r.push({type:Ie.LITERAL,value:e}),r},"Tokenizer");Zi.exports=op});var ts=_e((af,es)=>{var ye=Sr(),np=n(t=>{let e=[],r=[];return t.forEach(i=>{switch(i.type){case ye.LITERAL:e.unshift(i);break;case ye.BINARY_AND:case ye.BINARY_OR:case ye.OP_NOT:case ye.PAR_OPEN:r.push(i);break;case ye.PAR_CLOSE:for(;r.length&&r[r.length-1].type!==ye.PAR_OPEN;)e.unshift(r.pop());r.pop(),r.length&&r[r.length-1].type===ye.OP_NOT&&e.unshift(r.pop());break;default:break}}),r.length&&[...r.reverse(),...e]||e},"PolishNotation"),ip=n(function*(t){for(let e=0;e<t.length-1;e++)yield t[e];return t[t.length-1]},"PolishGenerator");es.exports={PolishNotation:np,PolishGenerator:ip}});var os=_e((cf,rs)=>{var U=Sr(),j=class{constructor(e,r,o,i){this.op=e,this.left=r,this.right=o,this.literal=i}isLeaf(){return this.op===U.LEAF}isAtomic(){return this.isLeaf()||this.op===U.OP_NOT&&this.left.isLeaf()}getLiteralValue(){return this.literal}static CreateAnd(e,r){return new j(U.BINARY_AND,e,r)}static CreateNot(e){return new j(U.OP_NOT,e)}static CreateOr(e,r){return new j(U.BINARY_OR,e,r)}static CreateLiteral(e){return new j(U.LEAF,null,null,e)}};n(j,"ExpNode");var ot=n(t=>{let e=t.next().value;switch(e.type){case U.LITERAL:return j.CreateLiteral(e.value);case U.OP_NOT:return j.CreateNot(ot(t));case U.BINARY_AND:{let r=ot(t),o=ot(t);return j.CreateAnd(r,o)}case U.BINARY_OR:{let r=ot(t),o=ot(t);return j.CreateOr(r,o)}}return null},"make"),nt=n((t,e)=>{if(t.isLeaf())return e(t.getLiteralValue());if(t.op===U.OP_NOT)return!nt(t.left,e);if(t.op===U.BINARY_OR)return nt(t.left,e)||nt(t.right,e);if(t.op===U.BINARY_AND)return nt(t.left,e)&&nt(t.right,e)},"nodeEvaluator");rs.exports={make:ot,nodeEvaluator:nt}});var as=_e((pf,ss)=>{var sp=Xi(),ns=ts(),is=os(),ap=n((t,e)=>{let r=sp(t),o=ns.PolishNotation(r),i=ns.PolishGenerator(o),s=is.make(i);return is.nodeEvaluator(s,e)},"parse");ss.exports={parse:ap}});var iu={};Sn(iu,{addOptinChangedCallback:()=>Ul,addTemplate:()=>Ll,autoInit:()=>ou,clear:()=>Ml,config:()=>$l,default:()=>nu,disableOptinChangedCallbacks:()=>jl,getOptins:()=>Vl,getProductsForPurchasePost:()=>Hl,initialize:()=>Gl,isReady:()=>Fl,offers:()=>v,platform:()=>q,previewMode:()=>Bl,register:()=>zl,resolveSettings:()=>Yl,setAuthUrl:()=>Wl,setEnvironment:()=>Jl,setLocale:()=>Kl,setMerchantId:()=>Ql,setPublicPath:()=>Zl,setTemplates:()=>Xl,setupCart:()=>eu,setupProduct:()=>tu,setupProducts:()=>ru,store:()=>ua});function Wr(t){var e,r=t.Symbol;return typeof r=="function"?r.observable?e=r.observable:(e=r("observable"),r.observable=e):e="@@observable",e}n(Wr,"symbolObservablePonyfill");var De;typeof self<"u"?De=self:typeof window<"u"||typeof window<"u"?De=window:typeof module<"u"?De=module:De=Function("return this")();var _a=Wr(De),Jr=_a;var Kr=n(function(){return Math.random().toString(36).substring(7).split("").join(".")},"randomString"),lt={INIT:"@@redux/INIT"+Kr(),REPLACE:"@@redux/REPLACE"+Kr(),PROBE_UNKNOWN_ACTION:n(function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Kr()},"PROBE_UNKNOWN_ACTION")};function Sa(t){if(typeof t!="object"||t===null)return!1;for(var e=t;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}n(Sa,"isPlainObject");function Qr(t,e,r){var o;if(typeof e=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error("It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function.");if(typeof e=="function"&&typeof r>"u"&&(r=e,e=void 0),typeof r<"u"){if(typeof r!="function")throw new Error("Expected the enhancer to be a function.");return r(Qr)(t,e)}if(typeof t!="function")throw new Error("Expected the reducer to be a function.");var i=t,s=e,a=[],c=a,p=!1;function l(){c===a&&(c=a.slice())}n(l,"ensureCanMutateNextListeners");function f(){if(p)throw new Error("You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return s}n(f,"getState");function d(m){if(typeof m!="function")throw new Error("Expected the listener to be a function.");if(p)throw new Error("You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api-reference/store#subscribelistener for more details.");var S=!0;return l(),c.push(m),n(function(){if(!!S){if(p)throw new Error("You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api-reference/store#subscribelistener for more details.");S=!1,l();var b=c.indexOf(m);c.splice(b,1),a=null}},"unsubscribe")}n(d,"subscribe");function h(m){if(!Sa(m))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(typeof m.type>"u")throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(p)throw new Error("Reducers may not dispatch actions.");try{p=!0,s=i(s,m)}finally{p=!1}for(var S=a=c,T=0;T<S.length;T++){var b=S[T];b()}return m}n(h,"dispatch");function O(m){if(typeof m!="function")throw new Error("Expected the nextReducer to be a function.");i=m,h({type:lt.REPLACE})}n(O,"replaceReducer");function _(){var m,S=d;return m={subscribe:n(function(b){if(typeof b!="object"||b===null)throw new TypeError("Expected the observer to be an object.");function w(){b.next&&b.next(f())}n(w,"observeState"),w();var R=S(w);return{unsubscribe:R}},"subscribe")},m[Jr]=function(){return this},m}return n(_,"observable"),h({type:lt.INIT}),o={dispatch:h,subscribe:d,getState:f,replaceReducer:O},o[Jr]=_,o}n(Qr,"createStore");function Ea(t,e){var r=e&&e.type,o=r&&'action "'+String(r)+'"'||"an action";return"Given "+o+', reducer "'+t+'" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.'}n(Ea,"getUndefinedStateErrorMessage");function xa(t){Object.keys(t).forEach(function(e){var r=t[e],o=r(void 0,{type:lt.INIT});if(typeof o>"u")throw new Error('Reducer "'+e+`" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`);if(typeof r(void 0,{type:lt.PROBE_UNKNOWN_ACTION()})>"u")throw new Error('Reducer "'+e+'" returned undefined when probed with a random type. '+("Don't try to handle "+lt.INIT+' or other actions in "redux/*" ')+"namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.")})}n(xa,"assertReducerShape");function Ut(t){for(var e=Object.keys(t),r={},o=0;o<e.length;o++){var i=e[o];typeof t[i]=="function"&&(r[i]=t[i])}var s=Object.keys(r),a,c;try{xa(r)}catch(p){c=p}return n(function(l,f){if(l===void 0&&(l={}),c)throw c;if(!1)var d;for(var h=!1,O={},_=0;_<s.length;_++){var m=s[_],S=r[m],T=l[m],b=S(T,f);if(typeof b>"u"){var w=Ea(m,f);throw new Error(w)}O[m]=b,h=h||b!==T}return h=h||s.length!==Object.keys(l).length,h?O:l},"combination")}n(Ut,"combineReducers");function xn(t,e){return function(){return e(t.apply(this,arguments))}}n(xn,"bindActionCreator");function On(t,e){if(typeof t=="function")return xn(t,e);if(typeof t!="object"||t===null)throw new Error("bindActionCreators expected an object or a function, instead received "+(t===null?"null":typeof t)+'. Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?');var r={};for(var o in t){var i=t[o];typeof i=="function"&&(r[o]=xn(i,e))}return r}n(On,"bindActionCreators");function va(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}n(va,"_defineProperty");function vn(t,e){var r=Object.keys(t);return Object.getOwnPropertySymbols&&r.push.apply(r,Object.getOwnPropertySymbols(t)),e&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),r}n(vn,"ownKeys");function Oa(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?vn(r,!0).forEach(function(o){va(t,o,r[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):vn(r).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(r,o))})}return t}n(Oa,"_objectSpread2");function Zr(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return e.length===0?function(o){return o}:e.length===1?e[0]:e.reduce(function(o,i){return function(){return o(i.apply(void 0,arguments))}})}n(Zr,"compose");function Pn(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return function(o){return function(){var i=o.apply(void 0,arguments),s=n(function(){throw new Error("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},"dispatch"),a={getState:i.getState,dispatch:n(function(){return s.apply(void 0,arguments)},"dispatch")},c=e.map(function(p){return p(a)});return s=Zr.apply(void 0,c)(i.dispatch),Oa({},i,{dispatch:s})}}}n(Pn,"applyMiddleware");function Tn(t){var e=n(function(o){var i=o.dispatch,s=o.getState;return function(a){return function(c){return typeof c=="function"?c(i,s,t):a(c)}}},"middleware");return e}n(Tn,"createThunkMiddleware");var wn=Tn();wn.withExtraArgument=Tn;var Cn=wn;var Ei=ce(Mt());var An=/^og_auth=/,Pa=n((t=An)=>(document.cookie.split(/;\s*/).find(e=>e.match(t))||"").replace(An,""),"c"),$t=n(t=>{if(typeof t=="object")return t;let e=String(t||"").split("|");return e.length===3?{sig_field:e[0],ts:parseInt(e[1],10),sig:e[2]}:null},"r"),Ta=n(t=>new Promise((e,r)=>{let o=document.createElement("iframe");o.style.setProperty("display","none","important"),document.body.appendChild(o),o.onload=e,o.onerror=r,o.src=t}),"p"),wa=n(t=>(t.headers.get("content-type")||"").indexOf("application/json")!==-1,"d");function Nn(){return typeof window.og_auth<"u"?$t(window.og_auth):null}n(Nn,"a");async function Ca(t=100){return new Promise(e=>{setTimeout(()=>e(Nn()),t)})}n(Ca,"f");async function In(t,e=Pa,r=Ta){let o;if(o=$t(Nn())||$t(e()),o)return o;if(t&&typeof t=="string"){let i=await fetch(t);i.status>=200&&i.status<300&&(o=e()||await(wa(i)?i.json():Promise.resolve(r(t)).then(e)))}else o||(o=await Ca());if(o=$t(o),o)return o;throw new Error("Unauthorized")}n(In,"u");var A="OPTIN_PRODUCT",I="OPTOUT_PRODUCT",k="PRODUCT_CHANGE_FREQUENCY",ie="PRODUCT_CHANGE_PREPAID_SHIPMENTS",Fe="SET_MERCHANT_ID",Y="REQUEST_OFFER",P="RECEIVE_OFFER",ut="PRODUCT_HAS_CHANGED",Ue="CREATED_SESSION_ID",jt="SET_AUTH_URL",kn="REQUEST_AUTH",Vt="AUTHORIZE",Se="UNAUTHORIZED",qn="REQUEST_ORDERS",Ht="RECEIVE_ORDERS",dt="CART_PRODUCT_KEY_HAS_CHANGED",Gt="RECEIVE_ORDER_ITEMS",Dn="FETCH_RESPONSE_ERROR",Le="SET_ENVIRONMENT_STAGING",Me="SET_ENVIRONMENT_DEV",$e="SET_ENVIRONMENT_PROD",Fn="CONCLUDE_UPSELL",Un="REQUEST_CREATE_IU_ORDER",Bt="CREATE_ONE_TIME",Ln="REQUEST_CONVERT_ONE_TIME",zt="CONVERT_ONE_TIME";var je="CHECKOUT",Mn="RECEIVE_FETCH",Yt="SET_LOCALE",Ve="SET_CONFIG",ft="SET_PREVIEW_STANDARD_OFFER",ht="SET_PREVIEW_UPSELL_OFFER",Xr="SET_PREVIEW_PREPAID_OFFER",Wt="ADD_TEMPLATE",Jt="SET_TEMPLATES",Ee="LOCAL_STORAGE_CHANGE",pe="LOCAL_STORAGE_CLEAR",Kt="SET_FIRST_ORDER_PLACE_DATE",Qt="SET_PRODUCT_TO_SUBSCRIBE",H="RECEIVE_PRODUCT_PLANS",W="SETUP_PRODUCT",le="SETUP_CART",xe="pdp",Zt="dev",ve="staging",Oe="prod",Xt="static.ordergroove.com",er="staging.static.ordergroove.com",$n="og-cart-updated";var or=ce(yt());var oo=n((...t)=>JSON.stringify(t),"memoizeKey"),bt=n(t=>(...e)=>fetch(...t(...e)).then(r=>r.json()),"withFetchJson"),_t=n(t=>(e,...r)=>{if(!e)throw Error("host required");let[o,i={}]=t(...r);return[`${e.replace(/\/+$/,"")}${o}`,i]},"withHost"),nr=n(t=>(e,...r)=>{if(!e)throw Error("auth required");let[o,i={}]=t(...r);return[o,{...i,headers:{Authorization:JSON.stringify(e),...i.headers}}]},"withAuth"),Jn=n(t=>(...e)=>{let[r,o={}]=t(...e);return[r,{method:"POST",...o,body:JSON.stringify(o.body),headers:{"Content-type":"application/json",...o.headers}}]},"withJsonBody"),Kn=n((t=[])=>(Array.isArray(t)?t:Object.entries(t)).map(([e,r])=>[e,encodeURIComponent(r)].join("=")).join("&"),"toQuery"),uc=n(t=>JSON.stringify([].concat(t).map(e=>typeof e=="object"?e.id:e).filter(e=>e)),"toProductId"),dc=(0,or.default)(bt(_t((t,e,r,o="pdp")=>{if(!t)throw Error("merchantId required");if(!e)throw Error("sessionId required");if(!r)throw Error("product required");let i=Kn([["session_id",e],["page_type",1],["p",uc(r)],["module_view",JSON.stringify(["regular"])]]);return[`/offer/${t}/${o}?${i}`]})),oo),fc=(0,or.default)(bt(_t(nr((t=1,e="place")=>[`/orders/?${Kn([["status",t],["ordering",e],["exclude_prepaid_orders","true"]])}`]))),oo),hc=(0,or.default)(bt(_t(nr(t=>{if(!t)throw Error("orderId required");return[`/items/?order=${t}`]}))),oo),mc=bt(_t(nr(Jn((t,e,r,o)=>{if(!t)throw Error("product required");if(!e)throw Error("order required");if(!r)throw Error("quantity required");if(r<=0)throw Error("quantity must be greater or equal than one");if(!o)throw Error("offer required");return["/items/iu/",{body:{product:t,order:e,quantity:r,offer:o}}]})))),St=n(t=>{if(typeof t=="object")return{...t};let[e,r]=(t||"").split(/_/).map(o=>parseInt(o,10));return e&&r&&{every:e,every_period:r}},"parseFrequency"),no=n(t=>t.match(/^\d+_\d$/),"isFrequencyValid"),gc=n((t,e)=>String.prototype.localeCompare.call(t&&t.split("_").reverse().join("_"),e&&e.split("_").reverse().join("_")),"compareFrequencies"),Qn=n(t=>[...new Set(t&&t.split(/\s+/))].filter(no).sort(gc),"parseFrequenciesList");var Et=n(t=>{if(typeof t=="object"){let{every:e,period:r,every_period:o}=t;return`${e}_${r||o}`}return typeof t=="string"?t:""},"stringifyFrequency"),yc=bt(_t(nr(Jn((t,e,r)=>{if(!t)throw Error("item required");if(!e)throw Error("frequency required");let o=St(e);if(!o)throw Error("invalid frequency");return["/subscriptions/create_from_item/",{body:{item:t.public_id,offer:r,...o}}]})))),ue={fetchOffer:dc,fetchOrders:fc,fetchItems:hc,createOneTime:mc,convertOneTimeToSubscription:yc};var io=xt(),q={shopify:typeof window.Shopify!="undefined",shopify_selling_plans:typeof(io==null?void 0:io.dataset.shopifySellingPlans)!="undefined"};function bc(t,e){return t===e}n(bc,"defaultEqualityCheck");function _c(t,e,r){if(e===null||r===null||e.length!==r.length)return!1;for(var o=e.length,i=0;i<o;i++)if(!t(e[i],r[i]))return!1;return!0}n(_c,"areArgumentsShallowlyEqual");function Sc(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:bc,r=null,o=null;return function(){return _c(e,r,arguments)||(o=t.apply(null,arguments)),r=arguments,o}}n(Sc,"defaultMemoize");function Ec(t){var e=Array.isArray(t[0])?t[0]:t;if(!e.every(function(o){return typeof o=="function"})){var r=e.map(function(o){return typeof o}).join(", ");throw new Error("Selector creators expect all input-selectors to be functions, "+("instead received the following types: ["+r+"]"))}return e}n(Ec,"getDependencies");function xc(t){for(var e=arguments.length,r=Array(e>1?e-1:0),o=1;o<e;o++)r[o-1]=arguments[o];return function(){for(var i=arguments.length,s=Array(i),a=0;a<i;a++)s[a]=arguments[a];var c=0,p=s.pop(),l=Ec(s),f=t.apply(void 0,[function(){return c++,p.apply(null,arguments)}].concat(r)),d=t(function(){for(var h=[],O=l.length,_=0;_<O;_++)h.push(l[_].apply(null,arguments));return f.apply(null,h)});return d.resultFunc=p,d.dependencies=l,d.recomputations=function(){return c},d.resetRecomputations=function(){return c=0},d}}n(xc,"createSelectorCreator");var J=xc(Sc);var G=ce(yt());G.default.Cache=Map;function vc(t,e){if(t===e)return!0;if(t===null||e===null||t.length!==e.length)return!1;for(let r=0;r<t.length;++r)if(t[r]!==e[r])return!1;return!0}n(vc,"arraysEqual");function Oc(t,e,r){let o=Et(r);return q.shopify_selling_plans?ee(t,e,o):o}n(Oc,"resolveFrequency");var N=n((t,e)=>!!(t===e||typeof t=="object"&&typeof e=="object"&&t&&e&&t.id===e.id&&(!(Array.isArray(t.components)&&Array.isArray(e.components))||vc((t.components||[]).sort(),(e.components||[]).sort()))),"isSameProduct"),vt=n(t=>t.optedin||[],"optedinSelector"),Zn=n(t=>t.optedout||[],"optedoutSelector"),so=n(t=>t.autoshipByDefault||{},"autoshipSelector"),Pc=n(t=>t.defaultFrequencies||{},"defaultFrequenciesSelector"),Tc=n(t=>{var e;return((e=t==null?void 0:t.config)==null?void 0:e.frequencies)||[]},"sellingPlansSelector"),wc=n(t=>{var e;return((e=t==null?void 0:t.config)==null?void 0:e.frequenciesEveryPeriod)||[]},"frequenciesEveryPeriodSelector"),Cc=n(t=>{var e;return((e=t==null?void 0:t.config)==null?void 0:e.prepaidSellingPlans)||[]},"prepaidSellingPlansSelector"),Rc=n(t=>(t==null?void 0:t.prepaidShipmentsSelected)||{},"prepaidShipmentsSelectedSelector"),K=(0,G.default)(t=>J(vt,Zn,so,(e,r,o)=>{let i=e.find(s=>N(t,s));return i||(r.find(s=>N(t,s))?!1:t&&o[t.id]?{id:t.id}:!1)}),t=>JSON.stringify(t)),ir=(0,G.default)(t=>J(vt,e=>{let r=e.find(o=>N(t,o));return r||!1}),t=>JSON.stringify(t)),Xn=(0,G.default)(t=>J(vt,e=>e.some(r=>N(t,r)&&r.prepaidShipments)),t=>JSON.stringify(t)),Q=(0,G.default)(t=>J(Rc,e=>e[t.id]||null),t=>JSON.stringify(t)),sr=(0,G.default)(t=>J(Zn,e=>e.find(r=>N(t,r))));var Z=(0,G.default)(t=>J(K(t),e=>e&&e.frequency||null)),L=(0,G.default)(t=>J(K(t),e=>e&&e.prepaidShipments||null)),X=(0,G.default)(t=>J(Cc,e=>{var o;return(((o=e[E(t)])==null?void 0:o.map(({numberShipments:i})=>i))||[]).sort((i,s)=>i-s)})),Ge=(0,G.default)(t=>J(Pc,Tc,wc,(e,r,o)=>e[E(t)]&&Oc(r,o,e[E(t)])||null)),ao=n(t=>t.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase(),"kebabCase"),M=n((t,e,r,o)=>({[r]:t.config&&t.config[r]||e&&e.hasAttribute&&e.hasAttribute(ao(r))&&e[r]||e.offer&&typeof(e.offer[r]!=="undefined")&&e.offer[r]||o}),"configSelector"),Be=n(t=>({templates:t.templates||[]}),"templatesSelector");function ar(t){document.readyState==="loading"?window.addEventListener("DOMContentLoaded",t):t()}n(ar,"onReady");function xt(){return document.querySelector([`script[src^="https://${Xt}"]`,`script[src^="https://${er}"]`,`script[src^="http://${Xt}"]`,`script[src^="http://${er}"]`].join(","))}n(xt,"getMainJs");function co(){let t=xt();if(!t)return[];let e=new URL(t.src),r=e.host.startsWith(ve)?ve:Oe,o=e.pathname.split("/")[1];return!r&&!o?[]:[o,r,t]}n(co,"resolveEnvAndMerchant");var E=n(t=>{var r;if(!t)return"";let e=`${t.id||t}`;return(r=q)!=null&&r.shopify_selling_plans&&(e=e.split(":")[0]),e},"safeProductId"),ei=n((t,e)=>{var r;if(q.shopify_selling_plans){let o=(r=e.frequencies)==null?void 0:r.indexOf(t);if(o>=0&&e.frequenciesEveryPeriod[o])return e.frequenciesEveryPeriod[o]}return t},"safeOgFrequency"),po=n((t,e)=>{var o;if(!`${t}`.includes("_"))return t;let r=(o=e.frequenciesEveryPeriod)==null?void 0:o.indexOf(t);return r>=0&&e.frequenciesEveryPeriod[r]?e.frequencies[r]:t},"frequencyToSellingPlan");function ti(t){if(t.isReady())return;console.info("OG offers are auto initializing");let[e,r]=co();if(!r&&!e)return;let o=document.createElement("script");o.onload=()=>console.info("OG pull initialization chunk for merchant",e,r),o.onerror=()=>t.initialize(e,r),o.src=`${window.location.protocol}//${r===Oe?Xt:er}/${e}/main.js?initOnly=true`,document.head.appendChild(o)}n(ti,"autoInitializeOffers");var ri=n(t=>{document.cookie=`${t}=; expires=Thu, 01 Jan 1970 00:00:01 GMT;`},"clearCookie");function oi(t){let e=document.cookie.match(`(^|;) ?${t}=([^;]*)(;|$)`);return e?e[2]:null}n(oi,"getCookieValue");var ze=n(t=>!!(t&&(t==null?void 0:t.includes("_"))),"isOgFrequency"),de=n((t=[])=>(t==null?void 0:t[0])||null,"getFirstSellingPlan"),cr=n((t=[],e=[])=>{var r;return!!(((r=q)==null?void 0:r.shopify_selling_plans)&&t.length&&e.length)},"hasShopifySellingPlans"),ee=n((t,e,r)=>{if(t.length!==e.length)return null;let o=e.findIndex(i=>i===r);return o>=0?t[o]:null},"mapFrequencyToSellingPlan");function ni(t,e,r){let o=t.querySelector(`[name="${e}"]`);if(o&&!r){o.remove();return}!o&&r&&(o=document.createElement("input"),o.type="hidden",o.name=e,t.appendChild(o)),o&&(o.value=r)}n(ni,"getOrCreateHidden");function Ye(t,e){let[[r],o]=t.reduce((i,s)=>i[N(e,s)?0:1].push(s)&&i,[[],[]]);return[r||{},o||[]]}n(Ye,"getMatchingProductIfExists");var B=n((t,e,r)=>({type:A,payload:{product:t,frequency:e,offer:r}}),"optinProduct"),We=n((t,e)=>({type:I,payload:{product:t,offer:e}}),"optoutProduct"),ii=n((t,e)=>({type:ut,payload:{newProduct:t,product:e}}),"productHasChangedComponents"),pr=n((t,e,r)=>({type:k,payload:{product:t,frequency:e,offer:r}}),"productChangeFrequency"),he=n((t,e,r)=>({type:ie,payload:{product:t,prepaidShipments:e,offer:r}}),"productChangePrepaidShipments");var si=n(t=>({type:Fn,payload:{product:t}}),"concludeUpsell"),ai=n(t=>({type:Fe,payload:t}),"setMerchantId"),uo=n(t=>({type:Ue,payload:`${t}.${Math.floor(Math.random()*999999)}.${Math.round(new Date().getTime()/1e3)}`}),"createSessionId"),Ac=n(t=>({type:kn,payload:t}),"requestAuth"),Ot=n((t,e,r,o)=>({type:Vt,payload:{public_id:t,sig_field:e,ts:r,sig:o}}),"authorize"),fe=n(t=>({type:Se,payload:t}),"unauthorized"),ci=n(t=>({type:jt,payload:t}),"setAuthUrl"),lr=n(t=>({type:Mn,payload:t}),"fetchDone"),pi=n((t=In)=>n(function(r,o){if(window.og&&window.og.previewMode)return r(fe({message:"Offers are running in preview mode"}));let{merchantId:i,authUrl:s}=o(),a=Ac(s);return r(a),t(s).then(({sig_field:c,ts:p,sig:l})=>r(Ot(i,c,p,l)),c=>r(fe(c))).finally(()=>r(lr(a)))},"fetchAuthThunk"),"fetchAuth"),Nc=n((t,e)=>({type:qn,payload:{status:t,ordering:e}}),"requestOrders"),fo=n(t=>({type:Ht,payload:t}),"receiveOrders"),ho=n(t=>({type:Gt,payload:t}),"receiveItems"),ur=n((t=1,e="place")=>n(function(o,i){let{environment:{legoUrl:s},auth:a}=i();if(!a)return o(fe("No auth set."));let c=Nc(t,e);return o(c),ue.fetchOrders(s,a,t,e).then(p=>{if(p.results){o(fo(p));let l=(p.results[0]||{}).public_id;if(l)return ue.fetchItems(s,a,l).then(f=>o(ho(f)))}return o(fe(p.detail)),null},p=>o(fe(p))).finally(()=>o(lr(c)))},"fetchOrdersThunk"),"fetchOrders"),mo=n(t=>{switch(t){case Zt:return{type:Me,payload:t};case ve:return{type:Le,payload:t};case Oe:return{type:$e,payload:t};default:throw new Error(`${t} is not a supported environment`)}},"setEnvironment"),li=n(()=>(t,e)=>{let{merchantId:r,sessionId:o}=e();return(!o||r&&!o.startsWith(r))&&t(uo(r)),o},"requestSessionId"),we=n((t,e)=>({type:P,payload:{...t,offer:e}}),"receiveOffer"),lo=n(t=>({type:Dn,payload:t}),"fetchResponseError"),Ic=n((t,e=xe,r)=>({type:Y,payload:{product:t,module:e,offer:r}}),"requestOffer"),ui=n((t,e=xe,r)=>n(function(i,s){let{merchantId:a,sessionId:c,environment:{apiUrl:p}}=s(),l=Ic(t,e,r);i(l);let f=E(t);return f?ue.fetchOffer(p,a,c,f,e).then(d=>i(we(d,r)),d=>i(lo(d))).finally(()=>i(lr(l))):null},"fetchOfferThunk"),"fetchOffer"),di=n(()=>({type:je}),"checkout"),kc=n((t,e,r,o)=>({type:Un,payload:{product:t,order:e,quantity:r,offerId:o}}),"requestCreateOneTime"),qc=n(t=>({type:Bt,payload:t}),"receiveCreateOneTime"),Dc=n((t,e)=>({type:Ln,payload:{item:t,frequency:e}}),"requestConvertOneTimeToSubscription"),Fc=n((t,e)=>({type:zt,payload:{response:t,product:e}}),"receiveConvertOneTime"),fi=n((t,e,r,o=!1,i=null)=>n(function(a,c){let{auth:p,config:l,environment:{legoUrl:f},previewUpsellOffer:d,offerId:h}=c();if(!p)return a(fe("No auth set."));let O=ei(i,l),_=kc(t,e,r,h);return a(_),(d?Promise.resolve({legoUrl:f,product:t,order:e,quantity:r,offer:h}):ue.createOneTime(f,p,t.id,e,r,h)).then(m=>(a(qc(m)),o?(a(Dc(m,O)),(d?Promise.resolve({item:m,frequency:O}):ue.convertOneTimeToSubscription(f,p,m,O,h)).then(S=>a(Fc(S,t)),S=>a(lo(S)))):m),m=>a(lo(m))).finally(()=>a(lr(_)))},"createIuThunk"),"createIu"),hi=n(t=>({type:Yt,payload:t}),"setLocale"),mi=n(t=>({type:Ve,payload:t}),"setConfig"),gi=n((t,e,r)=>({type:Wt,payload:{selector:t,markup:e,config:r}}),"addTemplate"),yi=n(t=>({type:Jt,payload:t}),"setTemplates"),bi=n((t,e)=>({type:Kt,payload:{product:t,firstOrderPlaceDate:e}}),"setFirstOrderPlaceDate"),_i=n((t,e)=>({type:Qt,payload:{product:t,productToSubscribe:e}}),"setProductToSubscribe");var Pt="OG_STATE",xi=n(t=>{try{return t===null?void 0:JSON.parse(t)}catch{return}},"safeParseState"),go=n(()=>window.og&&window.og.previewMode,"isPreviewMode"),vi=n(()=>go()?{}:xi(localStorage.getItem(Pt)),"loadState"),Uc=n(t=>!t||!t.sessionId?!1:JSON.stringify({sessionId:t.sessionId,optedin:t.optedin,optedout:t.optedout,productOffer:t.productOffer,firstOrderPlaceDate:t.firstOrderPlaceDate,productToSubscribe:t.productToSubscribe}),"serializeState"),Oi=n(t=>{if(go())return;let e=Uc(t);e&&localStorage.getItem(Pt)!==e&&localStorage.setItem(Pt,e)},"saveState"),Pi=n(t=>(0,Ei.throttle)(500,e=>{if(go())return;let{key:r,newValue:o}=e;r===Pt&&o===null?(t.dispatch({type:pe}),setTimeout(()=>t.dispatch(li()),0)):r===Pt&&t.dispatch({type:Ee,newValue:xi(o)})}),"listenLocalStorageChanges");var wi=ce(Mt());var Lc=n((t,e,r=document)=>r.dispatchEvent(new CustomEvent(t,{detail:e})),"dispatchEvent"),Ti=n(t=>({payload:{product:{id:e,components:r}={}}={}}={})=>setTimeout(()=>Lc("optin-changed",{productId:e,components:r,optedIn:t}),0),"dispatchOptinChangedEvent"),Mc=[{expressions:[({type:t}={})=>t===A,({type:t}={})=>t===k],fn:Ti(!0)},{expressions:[({type:t}={})=>t===I],fn:Ti(!1)}],Ci=n(t=>e=>r=>{let o=t.getState();Mc.forEach(i=>{i.expressions.some(s=>s(r,o))&&i.fn(r)}),e(r)},"dispatchMiddleware"),Ri=n(t=>e=>r=>{var i;let o;switch(r.type){case P:case I:case A:case k:o=new CustomEvent(`og-${r.type.toLowerCase().replace(/_/g,"-")}`,{bubbles:!0,cancelable:!0,detail:r.payload}),(((i=r.payload)==null?void 0:i.offer)||document).dispatchEvent(o);break;default:}o!=null&&o.defaultPrevented||e(r)},"offerEvents"),Ai=n(t=>e=>r=>{e(r);let o=(0,wi.throttle)(500,()=>{Oi({...t.getState()})});r.type!==Ee&&o()},"localStorageMiddleware");var yo=n(()=>{let t,e;return[new Promise((r,o)=>{t=r,e=o}),t,e]},"waitFor");function Ni(t){let[e,r]=yo(),[o,i]=yo(),[s,a]=yo();o.then(p=>{let{sessionId:l}=t.getState();!l||p&&!l.startsWith(p)?t.dispatch(uo(p)):a(l)});let c=Promise.all([o,e,s]);return c.then(()=>{var p;window.addEventListener("storage",Pi(t)),(p=t.getState().auth)!=null&&p.ts||t.dispatch(pi())}),p=>async l=>{Me===l.type||Le===l.type||$e===l.type?r(l.payload):Fe===l.type?i(l.payload):Ue===l.type?a(l.payload):await c,p(l)}}n(Ni,"waitUntilOffersReady");function Ii(t,...e){if(window.og&&window.og.store)return window.og.store;let r=window.og&&window.og.previewMode,o=typeof window=="object"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({name:"Ordergroove Offers"}):Zr,i=[Ni,Cn,Ci,Ri],s={};if(!r)try{s=vi(),i.push(Ai)}catch{}let a=o(Pn(...i,...e.filter(p=>p))),c=Qr(t,s,a);return window.og=window.og||{},window.og.store=c,c}n(Ii,"makeStore");var $c=Object.defineProperty,dr=n((t,e)=>$c(t,"name",{value:e,configurable:!0}),"i"),jc=dr(t=>e=>t.indexOf(e.origin)>=0,"createIsMessageAllowed"),qi=["https://rc3.ordergroove.com","https://rc3.stg.ordergroove.com","https://rc3-beta.stg.ordergroove.com","http://localhost:3000",window.location.origin],ki=dr(t=>(e,r)=>{qi.forEach(o=>t.postMessage({ogType:e,...r},o))},"createBroadcastMessage");function bo(t=window.opener,e=window.og){let r=dr(o=>{let i=jc(qi),s=ki(o.source),a=o.data.options||{};if(i(o)&&o.data.ogType==="READY"){let c="//static.ordergroove.com/@ordergroove/offers-live-editor/0.6.3/dist/";c.startsWith("//")&&(c=window.location.protocol+c),c.endsWith("/")||(c+="/"),import(`${c}client.js`).then(({initializeClient:p})=>{p({isMessageAllowed:i,broadcastMessage:s,options:a,og:e}),window.removeEventListener("message",r)})}},"handleReady");t&&t!==window&&(window.addEventListener("message",r),ki(t)("READY"))}n(bo,"f");dr(bo,"offersLiveEditor");var fr=null,Vc=n(t=>({dispatch:t}),"defaultMapDispatchToProps"),Di=n(t=>{if(!fr)throw new Error("Missing redux store.");return fr},"resolveStore"),Hc=n((t,e)=>r=>{let{getState:o,dispatch:i}=Di(r),s=t?t(o(),r):{},a=e(i,r);Object.assign(r,s,a)},"createRecalcProps"),g=n((t,e=Vc)=>r=>{let i=Hc(t,typeof e=="function"?e:s=>On(e,s));return class extends r{get store(){return fr}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this._storeUnsubscribe=Di(this).subscribe(()=>i(this)),i(this)}attributeChangedCallback(s,a,c){super.attributeChangedCallback&&super.attributeChangedCallback(s,a,c),this._storeUnsubscribe&&a!==c&&i(this)}disconnectedCallback(){this._storeUnsubscribe(),super.disconnectedCallback&&super.disconnectedCallback()}}},"connect"),Fi=n(t=>{fr=t},"setStore");var _o=n((t={},e=[])=>(t.optedin||[]).map(r=>{let o={product:r.id,subscription_info:{components:r.components||[]},tracking_override:{offer:((t.productOffer||{})[r.id]||[])[0],...St(r.frequency)}};return t.firstOrderPlaceDate&&t.firstOrderPlaceDate[r.id]&&(o.subscription_info.first_order_place_date=t.firstOrderPlaceDate[r.id]),t.productToSubscribe&&t.productToSubscribe[r.id]&&(o.tracking_override.product=t.productToSubscribe[r.id]),o}).filter(r=>r.tracking_override.offer).filter(r=>e.length?e.includes(r.product):r),"getProductsForPurchasePost"),Je=n((t={})=>{let e={};return Object.entries(t).forEach(([r,o])=>{Object.entries(o).forEach(([i,s])=>{let a={};s&&!Array.isArray(s)?a=s:a={frequency:i,prepaidShipments:null,regularPrice:s[0],subscriptionPrice:s[2],discountRate:s[1]},e[r]?e[r].push(a):e[r]=[a]})}),e},"getObjectStructuredProductPlans");var So=typeof window<"u"&&window.customElements!=null&&window.customElements.polyfillWrapFlushCallback!==void 0;var Ce=n((t,e,r=null)=>{for(;e!==r;){let o=e.nextSibling;t.removeChild(e),e=o}},"removeNodes");var $=`{{lit-${String(Math.random()).slice(2)}}}`,Eo=`<!--${$}-->`,Ui=new RegExp(`${$}|${Eo}`),Ke="$lit$",me=class{constructor(e,r){this.parts=[],this.element=r;let o=[],i=[],s=document.createTreeWalker(r.content,133,null,!1),a=0,c=-1,p=0,{strings:l,values:{length:f}}=e;for(;p<f;){let d=s.nextNode();if(d===null){s.currentNode=i.pop();continue}if(c++,d.nodeType===1){if(d.hasAttributes()){let h=d.attributes,{length:O}=h,_=0;for(let m=0;m<O;m++)Li(h[m].name,Ke)&&_++;for(;_-- >0;){let m=l[p],S=hr.exec(m)[2],T=S.toLowerCase()+Ke,b=d.getAttribute(T);d.removeAttribute(T);let w=b.split(Ui);this.parts.push({type:"attribute",index:c,name:S,strings:w}),p+=w.length-1}}d.tagName==="TEMPLATE"&&(i.push(d),s.currentNode=d.content)}else if(d.nodeType===3){let h=d.data;if(h.indexOf($)>=0){let O=d.parentNode,_=h.split(Ui),m=_.length-1;for(let S=0;S<m;S++){let T,b=_[S];if(b==="")T=te();else{let w=hr.exec(b);w!==null&&Li(w[2],Ke)&&(b=b.slice(0,w.index)+w[1]+w[2].slice(0,-Ke.length)+w[3]),T=document.createTextNode(b)}O.insertBefore(T,d),this.parts.push({type:"node",index:++c})}_[m]===""?(O.insertBefore(te(),d),o.push(d)):d.data=_[m],p+=m}}else if(d.nodeType===8)if(d.data===$){let h=d.parentNode;(d.previousSibling===null||c===a)&&(c++,h.insertBefore(te(),d)),a=c,this.parts.push({type:"node",index:c}),d.nextSibling===null?d.data="":(o.push(d),c--),p++}else{let h=-1;for(;(h=d.data.indexOf($,h+1))!==-1;)this.parts.push({type:"node",index:-1}),p++}}for(let d of o)d.parentNode.removeChild(d)}};n(me,"Template");var Li=n((t,e)=>{let r=t.length-e.length;return r>=0&&t.slice(r)===e},"endsWith"),Tt=n(t=>t.index!==-1,"isTemplatePartActive"),te=n(()=>document.createComment(""),"createMarker"),hr=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;var xo=133;function vo(t,e){let{element:{content:r},parts:o}=t,i=document.createTreeWalker(r,xo,null,!1),s=wt(o),a=o[s],c=-1,p=0,l=[],f=null;for(;i.nextNode();){c++;let d=i.currentNode;for(d.previousSibling===f&&(f=null),e.has(d)&&(l.push(d),f===null&&(f=d)),f!==null&&p++;a!==void 0&&a.index===c;)a.index=f!==null?-1:a.index-p,s=wt(o,s),a=o[s]}l.forEach(d=>d.parentNode.removeChild(d))}n(vo,"removeNodesFromTemplate");var Bc=n(t=>{let e=t.nodeType===11?0:1,r=document.createTreeWalker(t,xo,null,!1);for(;r.nextNode();)e++;return e},"countNodes"),wt=n((t,e=-1)=>{for(let r=e+1;r<t.length;r++){let o=t[r];if(Tt(o))return r}return-1},"nextActiveIndexInTemplateParts");function Mi(t,e,r=null){let{element:{content:o},parts:i}=t;if(r==null){o.appendChild(e);return}let s=document.createTreeWalker(o,xo,null,!1),a=wt(i),c=0,p=-1;for(;s.nextNode();)for(p++,s.currentNode===r&&(c=Bc(e),r.parentNode.insertBefore(e,r));a!==-1&&i[a].index===p;){if(c>0){for(;a!==-1;)i[a].index+=c,a=wt(i,a);return}a=wt(i,a)}}n(Mi,"insertNodeIntoTemplate");var zc=new WeakMap;var Re=n(t=>typeof t=="function"&&zc.has(t),"isDirective");var F={},mr={};var se=class{constructor(e,r,o){this.__parts=[],this.template=e,this.processor=r,this.options=o}update(e){let r=0;for(let o of this.__parts)o!==void 0&&o.setValue(e[r]),r++;for(let o of this.__parts)o!==void 0&&o.commit()}_clone(){let e=So?this.template.element.content.cloneNode(!0):document.importNode(this.template.element.content,!0),r=[],o=this.template.parts,i=document.createTreeWalker(e,133,null,!1),s=0,a=0,c,p=i.nextNode();for(;s<o.length;){if(c=o[s],!Tt(c)){this.__parts.push(void 0),s++;continue}for(;a<c.index;)a++,p.nodeName==="TEMPLATE"&&(r.push(p),i.currentNode=p.content),(p=i.nextNode())===null&&(i.currentNode=r.pop(),p=i.nextNode());if(c.type==="node"){let l=this.processor.handleTextExpression(this.options);l.insertAfterNode(p.previousSibling),this.__parts.push(l)}else this.__parts.push(...this.processor.handleAttributeExpressions(p,c.name,c.strings,this.options));s++}return So&&(document.adoptNode(e),customElements.upgrade(e)),e}};n(se,"TemplateInstance");var $i=window.trustedTypes&&trustedTypes.createPolicy("lit-html",{createHTML:t=>t}),Wc=` ${$} `,re=class{constructor(e,r,o,i){this.strings=e,this.values=r,this.type=o,this.processor=i}getHTML(){let e=this.strings.length-1,r="",o=!1;for(let i=0;i<e;i++){let s=this.strings[i],a=s.lastIndexOf("<!--");o=(a>-1||o)&&s.indexOf("-->",a+1)===-1;let c=hr.exec(s);c===null?r+=s+(o?Wc:Eo):r+=s.substr(0,c.index)+c[1]+c[2]+Ke+c[3]+$}return r+=this.strings[e],r}getTemplateElement(){let e=document.createElement("template"),r=this.getHTML();return $i!==void 0&&(r=$i.createHTML(r)),e.innerHTML=r,e}};n(re,"TemplateResult");var yr=n(t=>t===null||!(typeof t=="object"||typeof t=="function"),"isPrimitive"),gr=n(t=>Array.isArray(t)||!!(t&&t[Symbol.iterator]),"isIterable"),Ae=class{constructor(e,r,o){this.dirty=!0,this.element=e,this.name=r,this.strings=o,this.parts=[];for(let i=0;i<o.length-1;i++)this.parts[i]=this._createPart()}_createPart(){return new Qe(this)}_getValue(){let e=this.strings,r=e.length-1,o=this.parts;if(r===1&&e[0]===""&&e[1]===""){let s=o[0].value;if(typeof s=="symbol")return String(s);if(typeof s=="string"||!gr(s))return s}let i="";for(let s=0;s<r;s++){i+=e[s];let a=o[s];if(a!==void 0){let c=a.value;if(yr(c)||!gr(c))i+=typeof c=="string"?c:String(c);else for(let p of c)i+=typeof p=="string"?p:String(p)}}return i+=e[r],i}commit(){this.dirty&&(this.dirty=!1,this.element.setAttribute(this.name,this._getValue()))}};n(Ae,"AttributeCommitter");var Qe=class{constructor(e){this.value=void 0,this.committer=e}setValue(e){e!==F&&(!yr(e)||e!==this.value)&&(this.value=e,Re(e)||(this.committer.dirty=!0))}commit(){for(;Re(this.value);){let e=this.value;this.value=F,e(this)}this.value!==F&&this.committer.commit()}};n(Qe,"AttributePart");var oe=class{constructor(e){this.value=void 0,this.__pendingValue=void 0,this.options=e}appendInto(e){this.startNode=e.appendChild(te()),this.endNode=e.appendChild(te())}insertAfterNode(e){this.startNode=e,this.endNode=e.nextSibling}appendIntoPart(e){e.__insert(this.startNode=te()),e.__insert(this.endNode=te())}insertAfterPart(e){e.__insert(this.startNode=te()),this.endNode=e.endNode,e.endNode=this.startNode}setValue(e){this.__pendingValue=e}commit(){if(this.startNode.parentNode===null)return;for(;Re(this.__pendingValue);){let r=this.__pendingValue;this.__pendingValue=F,r(this)}let e=this.__pendingValue;e!==F&&(yr(e)?e!==this.value&&this.__commitText(e):e instanceof re?this.__commitTemplateResult(e):e instanceof Node?this.__commitNode(e):gr(e)?this.__commitIterable(e):e===mr?(this.value=mr,this.clear()):this.__commitText(e))}__insert(e){this.endNode.parentNode.insertBefore(e,this.endNode)}__commitNode(e){this.value!==e&&(this.clear(),this.__insert(e),this.value=e)}__commitText(e){let r=this.startNode.nextSibling;e=e??"";let o=typeof e=="string"?e:String(e);r===this.endNode.previousSibling&&r.nodeType===3?r.data=o:this.__commitNode(document.createTextNode(o)),this.value=e}__commitTemplateResult(e){let r=this.options.templateFactory(e);if(this.value instanceof se&&this.value.template===r)this.value.update(e.values);else{let o=new se(r,e.processor,this.options),i=o._clone();o.update(e.values),this.__commitNode(i),this.value=o}}__commitIterable(e){Array.isArray(this.value)||(this.value=[],this.clear());let r=this.value,o=0,i;for(let s of e)i=r[o],i===void 0&&(i=new oe(this.options),r.push(i),o===0?i.appendIntoPart(this):i.insertAfterPart(r[o-1])),i.setValue(s),i.commit(),o++;o<r.length&&(r.length=o,this.clear(i&&i.endNode))}clear(e=this.startNode){Ce(this.startNode.parentNode,e.nextSibling,this.endNode)}};n(oe,"NodePart");var Ze=class{constructor(e,r,o){if(this.value=void 0,this.__pendingValue=void 0,o.length!==2||o[0]!==""||o[1]!=="")throw new Error("Boolean attributes can only contain a single expression");this.element=e,this.name=r,this.strings=o}setValue(e){this.__pendingValue=e}commit(){for(;Re(this.__pendingValue);){let r=this.__pendingValue;this.__pendingValue=F,r(this)}if(this.__pendingValue===F)return;let e=!!this.__pendingValue;this.value!==e&&(e?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=e),this.__pendingValue=F}};n(Ze,"BooleanAttributePart");var Xe=class extends Ae{constructor(e,r,o){super(e,r,o),this.single=o.length===2&&o[0]===""&&o[1]===""}_createPart(){return new Ct(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}};n(Xe,"PropertyCommitter");var Ct=class extends Qe{};n(Ct,"PropertyPart");var ji=!1;(()=>{try{let t={get capture(){return ji=!0,!1}};window.addEventListener("test",t,t),window.removeEventListener("test",t,t)}catch{}})();var et=class{constructor(e,r,o){this.value=void 0,this.__pendingValue=void 0,this.element=e,this.eventName=r,this.eventContext=o,this.__boundHandleEvent=i=>this.handleEvent(i)}setValue(e){this.__pendingValue=e}commit(){for(;Re(this.__pendingValue);){let s=this.__pendingValue;this.__pendingValue=F,s(this)}if(this.__pendingValue===F)return;let e=this.__pendingValue,r=this.value,o=e==null||r!=null&&(e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive),i=e!=null&&(r==null||o);o&&this.element.removeEventListener(this.eventName,this.__boundHandleEvent,this.__options),i&&(this.__options=Jc(e),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=e,this.__pendingValue=F}handleEvent(e){typeof this.value=="function"?this.value.call(this.eventContext||this.element,e):this.value.handleEvent(e)}};n(et,"EventPart");var Jc=n(t=>t&&(ji?{capture:t.capture,passive:t.passive,once:t.once}:t.capture),"getOptions");function Oo(t){let e=Ne.get(t.type);e===void 0&&(e={stringsArray:new WeakMap,keyString:new Map},Ne.set(t.type,e));let r=e.stringsArray.get(t.strings);if(r!==void 0)return r;let o=t.strings.join($);return r=e.keyString.get(o),r===void 0&&(r=new me(t,t.getTemplateElement()),e.keyString.set(o,r)),e.stringsArray.set(t.strings,r),r}n(Oo,"templateFactory");var Ne=new Map;var ge=new WeakMap,Po=n((t,e,r)=>{let o=ge.get(e);o===void 0&&(Ce(e,e.firstChild),ge.set(e,o=new oe(Object.assign({templateFactory:Oo},r))),o.appendInto(e)),o.setValue(t),o.commit()},"render");var Rt=class{handleAttributeExpressions(e,r,o,i){let s=r[0];return s==="."?new Xe(e,r.slice(1),o).parts:s==="@"?[new et(e,r.slice(1),i.eventContext)]:s==="?"?[new Ze(e,r.slice(1),o)]:new Ae(e,r,o).parts}handleTextExpression(e){return new oe(e)}};n(Rt,"DefaultTemplateProcessor");var To=new Rt;typeof window<"u"&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.3.0");var u=n((t,...e)=>new re(t,e,"html",To),"html");var Hi=n((t,e)=>`${t}--${e}`,"getTemplateCacheKey"),br=!0;typeof window.ShadyCSS>"u"?br=!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."),br=!1);var Qc=n(t=>e=>{let r=Hi(e.type,t),o=Ne.get(r);o===void 0&&(o={stringsArray:new WeakMap,keyString:new Map},Ne.set(r,o));let i=o.stringsArray.get(e.strings);if(i!==void 0)return i;let s=e.strings.join($);if(i=o.keyString.get(s),i===void 0){let a=e.getTemplateElement();br&&window.ShadyCSS.prepareTemplateDom(a,t),i=new me(e,a),o.keyString.set(s,i)}return o.stringsArray.set(e.strings,i),i},"shadyTemplateFactory"),Zc=["html","svg"],Xc=n(t=>{Zc.forEach(e=>{let r=Ne.get(Hi(e,t));r!==void 0&&r.keyString.forEach(o=>{let{element:{content:i}}=o,s=new Set;Array.from(i.querySelectorAll("style")).forEach(a=>{s.add(a)}),vo(o,s)})})},"removeStylesFromLitTemplates"),Gi=new Set,ep=n((t,e,r)=>{Gi.add(t);let o=r?r.element:document.createElement("template"),i=e.querySelectorAll("style"),{length:s}=i;if(s===0){window.ShadyCSS.prepareTemplateStyles(o,t);return}let a=document.createElement("style");for(let l=0;l<s;l++){let f=i[l];f.parentNode.removeChild(f),a.textContent+=f.textContent}Xc(t);let c=o.content;r?Mi(r,a,c.firstChild):c.insertBefore(a,c.firstChild),window.ShadyCSS.prepareTemplateStyles(o,t);let p=c.querySelector("style");if(window.ShadyCSS.nativeShadow&&p!==null)e.insertBefore(p.cloneNode(!0),e.firstChild);else if(r){c.insertBefore(a,c.firstChild);let l=new Set;l.add(a),vo(r,l)}},"prepareTemplateStyles"),Bi=n((t,e,r)=>{if(!r||typeof r!="object"||!r.scopeName)throw new Error("The `scopeName` option is required.");let o=r.scopeName,i=ge.has(e),s=br&&e.nodeType===11&&!!e.host,a=s&&!Gi.has(o),c=a?document.createDocumentFragment():e;if(Po(t,c,Object.assign({templateFactory:Qc(o)},r)),a){let p=ge.get(c);ge.delete(c);let l=p.value instanceof se?p.value.template:void 0;ep(o,c,l),Ce(e,e.firstChild),e.appendChild(c),ge.set(e,p)}!i&&s&&window.ShadyCSS.styleElement(e.host)},"render");var zi;window.JSCompiler_renameProperty=(t,e)=>t;var Io={toAttribute(t,e){switch(e){case Boolean:return t?"":null;case Object:case Array:return t==null?t:JSON.stringify(t)}return t},fromAttribute(t,e){switch(e){case Boolean:return t!==null;case Number:return t===null?null:Number(t);case Object:case Array:return JSON.parse(t)}return t}},Yi=n((t,e)=>e!==t&&(e===e||t===t),"notEqual"),wo={attribute:!0,type:String,converter:Io,reflect:!1,hasChanged:Yi},Co=1,Ro=1<<2,Ao=1<<3,No=1<<4,ko="finalized",tt=class extends HTMLElement{constructor(){super(),this.initialize()}static get observedAttributes(){this.finalize();let e=[];return this._classProperties.forEach((r,o)=>{let i=this._attributeNameForProperty(o,r);i!==void 0&&(this._attributeToPropertyMap.set(i,o),e.push(i))}),e}static _ensureClassProperties(){if(!this.hasOwnProperty(JSCompiler_renameProperty("_classProperties",this))){this._classProperties=new Map;let e=Object.getPrototypeOf(this)._classProperties;e!==void 0&&e.forEach((r,o)=>this._classProperties.set(o,r))}}static createProperty(e,r=wo){if(this._ensureClassProperties(),this._classProperties.set(e,r),r.noAccessor||this.prototype.hasOwnProperty(e))return;let o=typeof e=="symbol"?Symbol():`__${e}`,i=this.getPropertyDescriptor(e,o,r);i!==void 0&&Object.defineProperty(this.prototype,e,i)}static getPropertyDescriptor(e,r,o){return{get(){return this[r]},set(i){let s=this[e];this[r]=i,this.requestUpdateInternal(e,s,o)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this._classProperties&&this._classProperties.get(e)||wo}static finalize(){let e=Object.getPrototypeOf(this);if(e.hasOwnProperty(ko)||e.finalize(),this[ko]=!0,this._ensureClassProperties(),this._attributeToPropertyMap=new Map,this.hasOwnProperty(JSCompiler_renameProperty("properties",this))){let r=this.properties,o=[...Object.getOwnPropertyNames(r),...typeof Object.getOwnPropertySymbols=="function"?Object.getOwnPropertySymbols(r):[]];for(let i of o)this.createProperty(i,r[i])}}static _attributeNameForProperty(e,r){let o=r.attribute;return o===!1?void 0:typeof o=="string"?o:typeof e=="string"?e.toLowerCase():void 0}static _valueHasChanged(e,r,o=Yi){return o(e,r)}static _propertyValueFromAttribute(e,r){let o=r.type,i=r.converter||Io,s=typeof i=="function"?i:i.fromAttribute;return s?s(e,o):e}static _propertyValueToAttribute(e,r){if(r.reflect===void 0)return;let o=r.type,i=r.converter;return(i&&i.toAttribute||Io.toAttribute)(e,o)}initialize(){this._updateState=0,this._updatePromise=new Promise(e=>this._enableUpdatingResolver=e),this._changedProperties=new Map,this._saveInstanceProperties(),this.requestUpdateInternal()}_saveInstanceProperties(){this.constructor._classProperties.forEach((e,r)=>{if(this.hasOwnProperty(r)){let o=this[r];delete this[r],this._instanceProperties||(this._instanceProperties=new Map),this._instanceProperties.set(r,o)}})}_applyInstanceProperties(){this._instanceProperties.forEach((e,r)=>this[r]=e),this._instanceProperties=void 0}connectedCallback(){this.enableUpdating()}enableUpdating(){this._enableUpdatingResolver!==void 0&&(this._enableUpdatingResolver(),this._enableUpdatingResolver=void 0)}disconnectedCallback(){}attributeChangedCallback(e,r,o){r!==o&&this._attributeToProperty(e,o)}_propertyToAttribute(e,r,o=wo){let i=this.constructor,s=i._attributeNameForProperty(e,o);if(s!==void 0){let a=i._propertyValueToAttribute(r,o);if(a===void 0)return;this._updateState=this._updateState|Ao,a==null?this.removeAttribute(s):this.setAttribute(s,a),this._updateState=this._updateState&~Ao}}_attributeToProperty(e,r){if(this._updateState&Ao)return;let o=this.constructor,i=o._attributeToPropertyMap.get(e);if(i!==void 0){let s=o.getPropertyOptions(i);this._updateState=this._updateState|No,this[i]=o._propertyValueFromAttribute(r,s),this._updateState=this._updateState&~No}}requestUpdateInternal(e,r,o){let i=!0;if(e!==void 0){let s=this.constructor;o=o||s.getPropertyOptions(e),s._valueHasChanged(this[e],r,o.hasChanged)?(this._changedProperties.has(e)||this._changedProperties.set(e,r),o.reflect===!0&&!(this._updateState&No)&&(this._reflectingProperties===void 0&&(this._reflectingProperties=new Map),this._reflectingProperties.set(e,o))):i=!1}!this._hasRequestedUpdate&&i&&(this._updatePromise=this._enqueueUpdate())}requestUpdate(e,r){return this.requestUpdateInternal(e,r),this.updateComplete}async _enqueueUpdate(){this._updateState=this._updateState|Ro;try{await this._updatePromise}catch{}let e=this.performUpdate();return e!=null&&await e,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return this._updateState&Ro}get hasUpdated(){return this._updateState&Co}performUpdate(){if(!this._hasRequestedUpdate)return;this._instanceProperties&&this._applyInstanceProperties();let e=!1,r=this._changedProperties;try{e=this.shouldUpdate(r),e?this.update(r):this._markUpdated()}catch(o){throw e=!1,this._markUpdated(),o}e&&(this._updateState&Co||(this._updateState=this._updateState|Co,this.firstUpdated(r)),this.updated(r))}_markUpdated(){this._changedProperties=new Map,this._updateState=this._updateState&~Ro}get updateComplete(){return this._getUpdateComplete()}_getUpdateComplete(){return this._updatePromise}shouldUpdate(e){return!0}update(e){this._reflectingProperties!==void 0&&this._reflectingProperties.size>0&&(this._reflectingProperties.forEach((r,o)=>this._propertyToAttribute(o,this[o],r)),this._reflectingProperties=void 0),this._markUpdated()}updated(e){}firstUpdated(e){}};n(tt,"UpdatingElement");zi=ko;tt[zi]=!0;var Wi=Element.prototype,Yd=Wi.msMatchesSelector||Wi.webkitMatchesSelector;var _r=window.ShadowRoot&&(window.ShadyCSS===void 0||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,qo=Symbol(),rt=class{constructor(e,r){if(r!==qo)throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e}get styleSheet(){return this._styleSheet===void 0&&(_r?(this._styleSheet=new CSSStyleSheet,this._styleSheet.replaceSync(this.cssText)):this._styleSheet=null),this._styleSheet}toString(){return this.cssText}};n(rt,"CSSResult");var Ji=n(t=>new rt(String(t),qo),"unsafeCSS"),tp=n(t=>{if(t instanceof rt)return t.cssText;if(typeof t=="number")return t;throw new Error(`Value passed to 'css' function must be a 'css' function result: ${t}. Use 'unsafeCSS' to pass non-literal values, but
11
+ var lib=(()=>{var fa=Object.create;var pt=Object.defineProperty;var ha=Object.getOwnPropertyDescriptor;var ma=Object.getOwnPropertyNames;var ga=Object.getPrototypeOf,ya=Object.prototype.hasOwnProperty;var n=(t,e)=>pt(t,"name",{value:e,configurable:!0});var _e=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Sn=(t,e)=>{for(var r in e)pt(t,r,{get:e[r],enumerable:!0})},En=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of ma(e))!ya.call(t,i)&&i!==r&&pt(t,i,{get:()=>e[i],enumerable:!(o=ha(e,i))||o.enumerable});return t};var ce=(t,e,r)=>(r=t!=null?fa(ga(t)):{},En(e||!t||!t.__esModule?pt(r,"default",{value:t,enumerable:!0}):r,t)),ba=t=>En(pt({},"__esModule",{value:!0}),t);var Mt=_e((Lt,Rn)=>{(function(t,e){typeof Lt=="object"&&typeof Rn<"u"?e(Lt):typeof define=="function"&&define.amd?define(["exports"],e):(t=t||self,e(t.throttleDebounce={}))})(Lt,function(t){"use strict";function e(o,i,s,a){var c,p=!1,l=0;function f(){c&&clearTimeout(c)}n(f,"clearExistingTimeout");function d(){f(),p=!0}n(d,"cancel"),typeof i!="boolean"&&(a=s,s=i,i=void 0);function h(){for(var O=arguments.length,_=new Array(O),m=0;m<O;m++)_[m]=arguments[m];var S=this,T=Date.now()-l;if(p)return;function b(){l=Date.now(),s.apply(S,_)}n(b,"exec");function w(){c=void 0}n(w,"clear"),a&&!c&&b(),f(),a===void 0&&T>o?b():i!==!0&&(c=setTimeout(a?w:b,a===void 0?o-T:o))}return n(h,"wrapper"),h.cancel=d,h}n(e,"throttle");function r(o,i,s){return s===void 0?e(o,i,!1):e(o,s,i!==!1)}n(r,"debounce"),t.debounce=r,t.throttle=e,Object.defineProperty(t,"__esModule",{value:!0})})});var yt=_e((mu,Wn)=>{var Ra="Expected a function",Vn="__lodash_hash_undefined__",Aa="[object Function]",Na="[object GeneratorFunction]",Ia=/[\\^$.*+?()[\]{}|]/g,ka=/^\[object .+?Constructor\]$/,qa=typeof window=="object"&&window&&window.Object===Object&&window,Da=typeof self=="object"&&self&&self.Object===Object&&self,Hn=qa||Da||Function("return this")();function Fa(t,e){return t?.[e]}n(Fa,"getValue");function Ua(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}n(Ua,"isHostObject");var La=Array.prototype,Ma=Function.prototype,Gn=Object.prototype,eo=Hn["__core-js_shared__"],jn=function(){var t=/[^.]+$/.exec(eo&&eo.keys&&eo.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),Bn=Ma.toString,to=Gn.hasOwnProperty,$a=Gn.toString,ja=RegExp("^"+Bn.call(to).replace(Ia,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Va=La.splice,Ha=zn(Hn,"Map"),gt=zn(Object,"create");function Pe(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}n(Pe,"Hash");function Ga(){this.__data__=gt?gt(null):{}}n(Ga,"hashClear");function Ba(t){return this.has(t)&&delete this.__data__[t]}n(Ba,"hashDelete");function za(t){var e=this.__data__;if(gt){var r=e[t];return r===Vn?void 0:r}return to.call(e,t)?e[t]:void 0}n(za,"hashGet");function Ya(t){var e=this.__data__;return gt?e[t]!==void 0:to.call(e,t)}n(Ya,"hashHas");function Wa(t,e){var r=this.__data__;return r[t]=gt&&e===void 0?Vn:e,this}n(Wa,"hashSet");Pe.prototype.clear=Ga;Pe.prototype.delete=Ba;Pe.prototype.get=za;Pe.prototype.has=Ya;Pe.prototype.set=Wa;function He(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}n(He,"ListCache");function Ja(){this.__data__=[]}n(Ja,"listCacheClear");function Ka(t){var e=this.__data__,r=tr(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():Va.call(e,r,1),!0}n(Ka,"listCacheDelete");function Qa(t){var e=this.__data__,r=tr(e,t);return r<0?void 0:e[r][1]}n(Qa,"listCacheGet");function Za(t){return tr(this.__data__,t)>-1}n(Za,"listCacheHas");function Xa(t,e){var r=this.__data__,o=tr(r,t);return o<0?r.push([t,e]):r[o][1]=e,this}n(Xa,"listCacheSet");He.prototype.clear=Ja;He.prototype.delete=Ka;He.prototype.get=Qa;He.prototype.has=Za;He.prototype.set=Xa;function Te(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}n(Te,"MapCache");function ec(){this.__data__={hash:new Pe,map:new(Ha||He),string:new Pe}}n(ec,"mapCacheClear");function tc(t){return rr(this,t).delete(t)}n(tc,"mapCacheDelete");function rc(t){return rr(this,t).get(t)}n(rc,"mapCacheGet");function oc(t){return rr(this,t).has(t)}n(oc,"mapCacheHas");function nc(t,e){return rr(this,t).set(t,e),this}n(nc,"mapCacheSet");Te.prototype.clear=ec;Te.prototype.delete=tc;Te.prototype.get=rc;Te.prototype.has=oc;Te.prototype.set=nc;function tr(t,e){for(var r=t.length;r--;)if(pc(t[r][0],e))return r;return-1}n(tr,"assocIndexOf");function ic(t){if(!Yn(t)||ac(t))return!1;var e=lc(t)||Ua(t)?ja:ka;return e.test(cc(t))}n(ic,"baseIsNative");function rr(t,e){var r=t.__data__;return sc(e)?r[typeof e=="string"?"string":"hash"]:r.map}n(rr,"getMapData");function zn(t,e){var r=Fa(t,e);return ic(r)?r:void 0}n(zn,"getNative");function sc(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}n(sc,"isKeyable");function ac(t){return!!jn&&jn in t}n(ac,"isMasked");function cc(t){if(t!=null){try{return Bn.call(t)}catch{}try{return t+""}catch{}}return""}n(cc,"toSource");function ro(t,e){if(typeof t!="function"||e&&typeof e!="function")throw new TypeError(Ra);var r=n(function(){var o=arguments,i=e?e.apply(this,o):o[0],s=r.cache;if(s.has(i))return s.get(i);var a=t.apply(this,o);return r.cache=s.set(i,a),a},"memoized");return r.cache=new(ro.Cache||Te),r}n(ro,"memoize");ro.Cache=Te;function pc(t,e){return t===e||t!==t&&e!==e}n(pc,"eq");function lc(t){var e=Yn(t)?$a.call(t):"";return e==Aa||e==Na}n(lc,"isFunction");function Yn(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}n(Yn,"isObject");Wn.exports=ro});var Sr=_e((sf,Qi)=>{var rp={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"};Qi.exports=rp});var Xi=_e((af,Zi)=>{var Ie=Sr(),op=n(t=>{let e="",r=[];for(let o of t){let i=o.charCodeAt(0);switch(i){case Ie.PAR_OPEN:case Ie.PAR_CLOSE:case Ie.OP_NOT:case Ie.BINARY_AND:case Ie.BINARY_OR:e&&(r.push({type:Ie.LITERAL,value:e}),e=""),r.push({type:i,value:o});break;default:e+=o}}return e&&r.push({type:Ie.LITERAL,value:e}),r},"Tokenizer");Zi.exports=op});var ts=_e((cf,es)=>{var ye=Sr(),np=n(t=>{let e=[],r=[];return t.forEach(i=>{switch(i.type){case ye.LITERAL:e.unshift(i);break;case ye.BINARY_AND:case ye.BINARY_OR:case ye.OP_NOT:case ye.PAR_OPEN:r.push(i);break;case ye.PAR_CLOSE:for(;r.length&&r[r.length-1].type!==ye.PAR_OPEN;)e.unshift(r.pop());r.pop(),r.length&&r[r.length-1].type===ye.OP_NOT&&e.unshift(r.pop());break;default:break}}),r.length&&[...r.reverse(),...e]||e},"PolishNotation"),ip=n(function*(t){for(let e=0;e<t.length-1;e++)yield t[e];return t[t.length-1]},"PolishGenerator");es.exports={PolishNotation:np,PolishGenerator:ip}});var os=_e((pf,rs)=>{var U=Sr(),j=class{constructor(e,r,o,i){this.op=e,this.left=r,this.right=o,this.literal=i}isLeaf(){return this.op===U.LEAF}isAtomic(){return this.isLeaf()||this.op===U.OP_NOT&&this.left.isLeaf()}getLiteralValue(){return this.literal}static CreateAnd(e,r){return new j(U.BINARY_AND,e,r)}static CreateNot(e){return new j(U.OP_NOT,e)}static CreateOr(e,r){return new j(U.BINARY_OR,e,r)}static CreateLiteral(e){return new j(U.LEAF,null,null,e)}};n(j,"ExpNode");var ot=n(t=>{let e=t.next().value;switch(e.type){case U.LITERAL:return j.CreateLiteral(e.value);case U.OP_NOT:return j.CreateNot(ot(t));case U.BINARY_AND:{let r=ot(t),o=ot(t);return j.CreateAnd(r,o)}case U.BINARY_OR:{let r=ot(t),o=ot(t);return j.CreateOr(r,o)}}return null},"make"),nt=n((t,e)=>{if(t.isLeaf())return e(t.getLiteralValue());if(t.op===U.OP_NOT)return!nt(t.left,e);if(t.op===U.BINARY_OR)return nt(t.left,e)||nt(t.right,e);if(t.op===U.BINARY_AND)return nt(t.left,e)&&nt(t.right,e)},"nodeEvaluator");rs.exports={make:ot,nodeEvaluator:nt}});var as=_e((lf,ss)=>{var sp=Xi(),ns=ts(),is=os(),ap=n((t,e)=>{let r=sp(t),o=ns.PolishNotation(r),i=ns.PolishGenerator(o),s=is.make(i);return is.nodeEvaluator(s,e)},"parse");ss.exports={parse:ap}});var su={};Sn(su,{addOptinChangedCallback:()=>Ll,addTemplate:()=>Ml,autoInit:()=>nu,clear:()=>$l,config:()=>jl,default:()=>iu,disableOptinChangedCallbacks:()=>Vl,getOptins:()=>Hl,getProductsForPurchasePost:()=>Gl,initialize:()=>Bl,isReady:()=>Ul,offers:()=>v,platform:()=>q,previewMode:()=>zl,register:()=>Yl,resolveSettings:()=>Wl,setAuthUrl:()=>Jl,setEnvironment:()=>Kl,setLocale:()=>Ql,setMerchantId:()=>Zl,setPublicPath:()=>Xl,setTemplates:()=>eu,setupCart:()=>tu,setupProduct:()=>ru,setupProducts:()=>ou,store:()=>ua});function Wr(t){var e,r=t.Symbol;return typeof r=="function"?r.observable?e=r.observable:(e=r("observable"),r.observable=e):e="@@observable",e}n(Wr,"symbolObservablePonyfill");var De;typeof self<"u"?De=self:typeof window<"u"||typeof window<"u"?De=window:typeof module<"u"?De=module:De=Function("return this")();var _a=Wr(De),Jr=_a;var Kr=n(function(){return Math.random().toString(36).substring(7).split("").join(".")},"randomString"),lt={INIT:"@@redux/INIT"+Kr(),REPLACE:"@@redux/REPLACE"+Kr(),PROBE_UNKNOWN_ACTION:n(function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Kr()},"PROBE_UNKNOWN_ACTION")};function Sa(t){if(typeof t!="object"||t===null)return!1;for(var e=t;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}n(Sa,"isPlainObject");function Qr(t,e,r){var o;if(typeof e=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error("It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function.");if(typeof e=="function"&&typeof r>"u"&&(r=e,e=void 0),typeof r<"u"){if(typeof r!="function")throw new Error("Expected the enhancer to be a function.");return r(Qr)(t,e)}if(typeof t!="function")throw new Error("Expected the reducer to be a function.");var i=t,s=e,a=[],c=a,p=!1;function l(){c===a&&(c=a.slice())}n(l,"ensureCanMutateNextListeners");function f(){if(p)throw new Error("You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return s}n(f,"getState");function d(m){if(typeof m!="function")throw new Error("Expected the listener to be a function.");if(p)throw new Error("You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api-reference/store#subscribelistener for more details.");var S=!0;return l(),c.push(m),n(function(){if(!!S){if(p)throw new Error("You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api-reference/store#subscribelistener for more details.");S=!1,l();var b=c.indexOf(m);c.splice(b,1),a=null}},"unsubscribe")}n(d,"subscribe");function h(m){if(!Sa(m))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(typeof m.type>"u")throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(p)throw new Error("Reducers may not dispatch actions.");try{p=!0,s=i(s,m)}finally{p=!1}for(var S=a=c,T=0;T<S.length;T++){var b=S[T];b()}return m}n(h,"dispatch");function O(m){if(typeof m!="function")throw new Error("Expected the nextReducer to be a function.");i=m,h({type:lt.REPLACE})}n(O,"replaceReducer");function _(){var m,S=d;return m={subscribe:n(function(b){if(typeof b!="object"||b===null)throw new TypeError("Expected the observer to be an object.");function w(){b.next&&b.next(f())}n(w,"observeState"),w();var R=S(w);return{unsubscribe:R}},"subscribe")},m[Jr]=function(){return this},m}return n(_,"observable"),h({type:lt.INIT}),o={dispatch:h,subscribe:d,getState:f,replaceReducer:O},o[Jr]=_,o}n(Qr,"createStore");function Ea(t,e){var r=e&&e.type,o=r&&'action "'+String(r)+'"'||"an action";return"Given "+o+', reducer "'+t+'" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.'}n(Ea,"getUndefinedStateErrorMessage");function xa(t){Object.keys(t).forEach(function(e){var r=t[e],o=r(void 0,{type:lt.INIT});if(typeof o>"u")throw new Error('Reducer "'+e+`" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`);if(typeof r(void 0,{type:lt.PROBE_UNKNOWN_ACTION()})>"u")throw new Error('Reducer "'+e+'" returned undefined when probed with a random type. '+("Don't try to handle "+lt.INIT+' or other actions in "redux/*" ')+"namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.")})}n(xa,"assertReducerShape");function Ut(t){for(var e=Object.keys(t),r={},o=0;o<e.length;o++){var i=e[o];typeof t[i]=="function"&&(r[i]=t[i])}var s=Object.keys(r),a,c;try{xa(r)}catch(p){c=p}return n(function(l,f){if(l===void 0&&(l={}),c)throw c;if(!1)var d;for(var h=!1,O={},_=0;_<s.length;_++){var m=s[_],S=r[m],T=l[m],b=S(T,f);if(typeof b>"u"){var w=Ea(m,f);throw new Error(w)}O[m]=b,h=h||b!==T}return h=h||s.length!==Object.keys(l).length,h?O:l},"combination")}n(Ut,"combineReducers");function xn(t,e){return function(){return e(t.apply(this,arguments))}}n(xn,"bindActionCreator");function On(t,e){if(typeof t=="function")return xn(t,e);if(typeof t!="object"||t===null)throw new Error("bindActionCreators expected an object or a function, instead received "+(t===null?"null":typeof t)+'. Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?');var r={};for(var o in t){var i=t[o];typeof i=="function"&&(r[o]=xn(i,e))}return r}n(On,"bindActionCreators");function va(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}n(va,"_defineProperty");function vn(t,e){var r=Object.keys(t);return Object.getOwnPropertySymbols&&r.push.apply(r,Object.getOwnPropertySymbols(t)),e&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),r}n(vn,"ownKeys");function Oa(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?vn(r,!0).forEach(function(o){va(t,o,r[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):vn(r).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(r,o))})}return t}n(Oa,"_objectSpread2");function Zr(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return e.length===0?function(o){return o}:e.length===1?e[0]:e.reduce(function(o,i){return function(){return o(i.apply(void 0,arguments))}})}n(Zr,"compose");function Pn(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return function(o){return function(){var i=o.apply(void 0,arguments),s=n(function(){throw new Error("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},"dispatch"),a={getState:i.getState,dispatch:n(function(){return s.apply(void 0,arguments)},"dispatch")},c=e.map(function(p){return p(a)});return s=Zr.apply(void 0,c)(i.dispatch),Oa({},i,{dispatch:s})}}}n(Pn,"applyMiddleware");function Tn(t){var e=n(function(o){var i=o.dispatch,s=o.getState;return function(a){return function(c){return typeof c=="function"?c(i,s,t):a(c)}}},"middleware");return e}n(Tn,"createThunkMiddleware");var wn=Tn();wn.withExtraArgument=Tn;var Cn=wn;var Ei=ce(Mt());var An=/^og_auth=/,Pa=n((t=An)=>(document.cookie.split(/;\s*/).find(e=>e.match(t))||"").replace(An,""),"c"),$t=n(t=>{if(typeof t=="object")return t;let e=String(t||"").split("|");return e.length===3?{sig_field:e[0],ts:parseInt(e[1],10),sig:e[2]}:null},"r"),Ta=n(t=>new Promise((e,r)=>{let o=document.createElement("iframe");o.style.setProperty("display","none","important"),document.body.appendChild(o),o.onload=e,o.onerror=r,o.src=t}),"p"),wa=n(t=>(t.headers.get("content-type")||"").indexOf("application/json")!==-1,"d");function Nn(){return typeof window.og_auth<"u"?$t(window.og_auth):null}n(Nn,"a");async function Ca(t=100){return new Promise(e=>{setTimeout(()=>e(Nn()),t)})}n(Ca,"f");async function In(t,e=Pa,r=Ta){let o;if(o=$t(Nn())||$t(e()),o)return o;if(t&&typeof t=="string"){let i=await fetch(t);i.status>=200&&i.status<300&&(o=e()||await(wa(i)?i.json():Promise.resolve(r(t)).then(e)))}else o||(o=await Ca());if(o=$t(o),o)return o;throw new Error("Unauthorized")}n(In,"u");var A="OPTIN_PRODUCT",I="OPTOUT_PRODUCT",k="PRODUCT_CHANGE_FREQUENCY",ie="PRODUCT_CHANGE_PREPAID_SHIPMENTS",Fe="SET_MERCHANT_ID",Y="REQUEST_OFFER",P="RECEIVE_OFFER",ut="PRODUCT_HAS_CHANGED",Ue="CREATED_SESSION_ID",jt="SET_AUTH_URL",kn="REQUEST_AUTH",Vt="AUTHORIZE",Se="UNAUTHORIZED",qn="REQUEST_ORDERS",Ht="RECEIVE_ORDERS",dt="CART_PRODUCT_KEY_HAS_CHANGED",Gt="RECEIVE_ORDER_ITEMS",Dn="FETCH_RESPONSE_ERROR",Le="SET_ENVIRONMENT_STAGING",Me="SET_ENVIRONMENT_DEV",$e="SET_ENVIRONMENT_PROD",Fn="CONCLUDE_UPSELL",Un="REQUEST_CREATE_IU_ORDER",Bt="CREATE_ONE_TIME",Ln="REQUEST_CONVERT_ONE_TIME",zt="CONVERT_ONE_TIME";var je="CHECKOUT",Mn="RECEIVE_FETCH",Yt="SET_LOCALE",Ve="SET_CONFIG",ft="SET_PREVIEW_STANDARD_OFFER",ht="SET_PREVIEW_UPSELL_OFFER",Xr="SET_PREVIEW_PREPAID_OFFER",Wt="ADD_TEMPLATE",Jt="SET_TEMPLATES",Ee="LOCAL_STORAGE_CHANGE",pe="LOCAL_STORAGE_CLEAR",Kt="SET_FIRST_ORDER_PLACE_DATE",Qt="SET_PRODUCT_TO_SUBSCRIBE",H="RECEIVE_PRODUCT_PLANS",W="SETUP_PRODUCT",le="SETUP_CART",xe="pdp",Zt="dev",ve="staging",Oe="prod",Xt="static.ordergroove.com",er="staging.static.ordergroove.com",$n="og-cart-updated";var or=ce(yt());var oo=n((...t)=>JSON.stringify(t),"memoizeKey"),bt=n(t=>(...e)=>fetch(...t(...e)).then(r=>r.json()),"withFetchJson"),_t=n(t=>(e,...r)=>{if(!e)throw Error("host required");let[o,i={}]=t(...r);return[`${e.replace(/\/+$/,"")}${o}`,i]},"withHost"),nr=n(t=>(e,...r)=>{if(!e)throw Error("auth required");let[o,i={}]=t(...r);return[o,{...i,headers:{Authorization:JSON.stringify(e),...i.headers}}]},"withAuth"),Jn=n(t=>(...e)=>{let[r,o={}]=t(...e);return[r,{method:"POST",...o,body:JSON.stringify(o.body),headers:{"Content-type":"application/json",...o.headers}}]},"withJsonBody"),Kn=n((t=[])=>(Array.isArray(t)?t:Object.entries(t)).map(([e,r])=>[e,encodeURIComponent(r)].join("=")).join("&"),"toQuery"),uc=n(t=>JSON.stringify([].concat(t).map(e=>typeof e=="object"?e.id:e).filter(e=>e)),"toProductId"),dc=(0,or.default)(bt(_t((t,e,r,o="pdp")=>{if(!t)throw Error("merchantId required");if(!e)throw Error("sessionId required");if(!r)throw Error("product required");let i=Kn([["session_id",e],["page_type",1],["p",uc(r)],["module_view",JSON.stringify(["regular"])]]);return[`/offer/${t}/${o}?${i}`]})),oo),fc=(0,or.default)(bt(_t(nr((t=1,e="place")=>[`/orders/?${Kn([["status",t],["ordering",e],["exclude_prepaid_orders","true"]])}`]))),oo),hc=(0,or.default)(bt(_t(nr(t=>{if(!t)throw Error("orderId required");return[`/items/?order=${t}`]}))),oo),mc=bt(_t(nr(Jn((t,e,r,o)=>{if(!t)throw Error("product required");if(!e)throw Error("order required");if(!r)throw Error("quantity required");if(r<=0)throw Error("quantity must be greater or equal than one");if(!o)throw Error("offer required");return["/items/iu/",{body:{product:t,order:e,quantity:r,offer:o}}]})))),St=n(t=>{if(typeof t=="object")return{...t};let[e,r]=(t||"").split(/_/).map(o=>parseInt(o,10));return e&&r&&{every:e,every_period:r}},"parseFrequency"),no=n(t=>t.match(/^\d+_\d$/),"isFrequencyValid"),gc=n((t,e)=>String.prototype.localeCompare.call(t&&t.split("_").reverse().join("_"),e&&e.split("_").reverse().join("_")),"compareFrequencies"),Qn=n(t=>[...new Set(t&&t.split(/\s+/))].filter(no).sort(gc),"parseFrequenciesList");var Et=n(t=>{if(typeof t=="object"){let{every:e,period:r,every_period:o}=t;return`${e}_${r||o}`}return typeof t=="string"?t:""},"stringifyFrequency"),yc=bt(_t(nr(Jn((t,e,r)=>{if(!t)throw Error("item required");if(!e)throw Error("frequency required");let o=St(e);if(!o)throw Error("invalid frequency");return["/subscriptions/create_from_item/",{body:{item:t.public_id,offer:r,...o}}]})))),ue={fetchOffer:dc,fetchOrders:fc,fetchItems:hc,createOneTime:mc,convertOneTimeToSubscription:yc};var io=xt(),q={shopify:typeof window.Shopify!="undefined",shopify_selling_plans:typeof(io==null?void 0:io.dataset.shopifySellingPlans)!="undefined"};function bc(t,e){return t===e}n(bc,"defaultEqualityCheck");function _c(t,e,r){if(e===null||r===null||e.length!==r.length)return!1;for(var o=e.length,i=0;i<o;i++)if(!t(e[i],r[i]))return!1;return!0}n(_c,"areArgumentsShallowlyEqual");function Sc(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:bc,r=null,o=null;return function(){return _c(e,r,arguments)||(o=t.apply(null,arguments)),r=arguments,o}}n(Sc,"defaultMemoize");function Ec(t){var e=Array.isArray(t[0])?t[0]:t;if(!e.every(function(o){return typeof o=="function"})){var r=e.map(function(o){return typeof o}).join(", ");throw new Error("Selector creators expect all input-selectors to be functions, "+("instead received the following types: ["+r+"]"))}return e}n(Ec,"getDependencies");function xc(t){for(var e=arguments.length,r=Array(e>1?e-1:0),o=1;o<e;o++)r[o-1]=arguments[o];return function(){for(var i=arguments.length,s=Array(i),a=0;a<i;a++)s[a]=arguments[a];var c=0,p=s.pop(),l=Ec(s),f=t.apply(void 0,[function(){return c++,p.apply(null,arguments)}].concat(r)),d=t(function(){for(var h=[],O=l.length,_=0;_<O;_++)h.push(l[_].apply(null,arguments));return f.apply(null,h)});return d.resultFunc=p,d.dependencies=l,d.recomputations=function(){return c},d.resetRecomputations=function(){return c=0},d}}n(xc,"createSelectorCreator");var J=xc(Sc);var G=ce(yt());G.default.Cache=Map;function vc(t,e){if(t===e)return!0;if(t===null||e===null||t.length!==e.length)return!1;for(let r=0;r<t.length;++r)if(t[r]!==e[r])return!1;return!0}n(vc,"arraysEqual");function Oc(t,e,r){let o=Et(r);return q.shopify_selling_plans?ee(t,e,o):o}n(Oc,"resolveFrequency");var N=n((t,e)=>!!(t===e||typeof t=="object"&&typeof e=="object"&&t&&e&&t.id===e.id&&(!(Array.isArray(t.components)&&Array.isArray(e.components))||vc((t.components||[]).sort(),(e.components||[]).sort()))),"isSameProduct"),vt=n(t=>t.optedin||[],"optedinSelector"),Zn=n(t=>t.optedout||[],"optedoutSelector"),so=n(t=>t.autoshipByDefault||{},"autoshipSelector"),Pc=n(t=>t.defaultFrequencies||{},"defaultFrequenciesSelector"),Tc=n(t=>{var e;return((e=t==null?void 0:t.config)==null?void 0:e.frequencies)||[]},"sellingPlansSelector"),wc=n(t=>{var e;return((e=t==null?void 0:t.config)==null?void 0:e.frequenciesEveryPeriod)||[]},"frequenciesEveryPeriodSelector"),Cc=n(t=>{var e;return((e=t==null?void 0:t.config)==null?void 0:e.prepaidSellingPlans)||[]},"prepaidSellingPlansSelector"),Rc=n(t=>(t==null?void 0:t.prepaidShipmentsSelected)||{},"prepaidShipmentsSelectedSelector"),K=(0,G.default)(t=>J(vt,Zn,so,(e,r,o)=>{let i=e.find(s=>N(t,s));return i||(r.find(s=>N(t,s))?!1:t&&o[t.id]?{id:t.id}:!1)}),t=>JSON.stringify(t)),ir=(0,G.default)(t=>J(vt,e=>{let r=e.find(o=>N(t,o));return r||!1}),t=>JSON.stringify(t)),Xn=(0,G.default)(t=>J(vt,e=>e.some(r=>N(t,r)&&r.prepaidShipments)),t=>JSON.stringify(t)),Q=(0,G.default)(t=>J(Rc,e=>e[t.id]||null),t=>JSON.stringify(t)),sr=(0,G.default)(t=>J(Zn,e=>e.find(r=>N(t,r))));var Z=(0,G.default)(t=>J(K(t),e=>e&&e.frequency||null)),L=(0,G.default)(t=>J(K(t),e=>e&&e.prepaidShipments||null)),X=(0,G.default)(t=>J(Cc,e=>{var o;return(((o=e[E(t)])==null?void 0:o.map(({numberShipments:i})=>i))||[]).sort((i,s)=>i-s)})),Ge=(0,G.default)(t=>J(Pc,Tc,wc,(e,r,o)=>e[E(t)]&&Oc(r,o,e[E(t)])||null)),ao=n(t=>t.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase(),"kebabCase"),M=n((t,e,r,o)=>({[r]:t.config&&t.config[r]||e&&e.hasAttribute&&e.hasAttribute(ao(r))&&e[r]||e.offer&&typeof(e.offer[r]!=="undefined")&&e.offer[r]||o}),"configSelector"),Be=n(t=>({templates:t.templates||[]}),"templatesSelector");function ar(t){document.readyState==="loading"?window.addEventListener("DOMContentLoaded",t):t()}n(ar,"onReady");function xt(){return document.querySelector([`script[src^="https://${Xt}"]`,`script[src^="https://${er}"]`,`script[src^="http://${Xt}"]`,`script[src^="http://${er}"]`].join(","))}n(xt,"getMainJs");function co(){let t=xt();if(!t)return[];let e=new URL(t.src),r=e.host.startsWith(ve)?ve:Oe,o=e.pathname.split("/")[1];return!r&&!o?[]:[o,r,t]}n(co,"resolveEnvAndMerchant");var E=n(t=>{var r;if(!t)return"";let e=`${t.id||t}`;return(r=q)!=null&&r.shopify_selling_plans&&(e=e.split(":")[0]),e},"safeProductId"),ei=n((t,e)=>{var r;if(q.shopify_selling_plans){let o=(r=e.frequencies)==null?void 0:r.indexOf(t);if(o>=0&&e.frequenciesEveryPeriod[o])return e.frequenciesEveryPeriod[o]}return t},"safeOgFrequency"),po=n((t,e)=>{var o;if(!`${t}`.includes("_"))return t;let r=(o=e.frequenciesEveryPeriod)==null?void 0:o.indexOf(t);return r>=0&&e.frequenciesEveryPeriod[r]?e.frequencies[r]:t},"frequencyToSellingPlan");function ti(t){if(t.isReady())return;console.info("OG offers are auto initializing");let[e,r]=co();if(!r&&!e)return;let o=document.createElement("script");o.onload=()=>console.info("OG pull initialization chunk for merchant",e,r),o.onerror=()=>t.initialize(e,r),o.src=`${window.location.protocol}//${r===Oe?Xt:er}/${e}/main.js?initOnly=true`,document.head.appendChild(o)}n(ti,"autoInitializeOffers");var ri=n(t=>{document.cookie=`${t}=; expires=Thu, 01 Jan 1970 00:00:01 GMT;`},"clearCookie");function oi(t){let e=document.cookie.match(`(^|;) ?${t}=([^;]*)(;|$)`);return e?e[2]:null}n(oi,"getCookieValue");var ze=n(t=>!!(t&&(t==null?void 0:t.includes("_"))),"isOgFrequency"),de=n((t=[])=>(t==null?void 0:t[0])||null,"getFirstSellingPlan"),cr=n((t=[],e=[])=>{var r;return!!(((r=q)==null?void 0:r.shopify_selling_plans)&&t.length&&e.length)},"hasShopifySellingPlans"),ee=n((t,e,r)=>{if(t.length!==e.length)return null;let o=e.findIndex(i=>i===r);return o>=0?t[o]:null},"mapFrequencyToSellingPlan");function ni(t,e,r){let o=t.querySelector(`[name="${e}"]`);if(o&&!r){o.remove();return}!o&&r&&(o=document.createElement("input"),o.type="hidden",o.name=e,t.appendChild(o)),o&&(o.value=r)}n(ni,"getOrCreateHidden");function Ye(t,e){let[[r],o]=t.reduce((i,s)=>i[N(e,s)?0:1].push(s)&&i,[[],[]]);return[r||{},o||[]]}n(Ye,"getMatchingProductIfExists");var B=n((t,e,r)=>({type:A,payload:{product:t,frequency:e,offer:r}}),"optinProduct"),We=n((t,e)=>({type:I,payload:{product:t,offer:e}}),"optoutProduct"),ii=n((t,e)=>({type:ut,payload:{newProduct:t,product:e}}),"productHasChangedComponents"),pr=n((t,e,r)=>({type:k,payload:{product:t,frequency:e,offer:r}}),"productChangeFrequency"),he=n((t,e,r)=>({type:ie,payload:{product:t,prepaidShipments:e,offer:r}}),"productChangePrepaidShipments");var si=n(t=>({type:Fn,payload:{product:t}}),"concludeUpsell"),ai=n(t=>({type:Fe,payload:t}),"setMerchantId"),uo=n(t=>({type:Ue,payload:`${t}.${Math.floor(Math.random()*999999)}.${Math.round(new Date().getTime()/1e3)}`}),"createSessionId"),Ac=n(t=>({type:kn,payload:t}),"requestAuth"),Ot=n((t,e,r,o)=>({type:Vt,payload:{public_id:t,sig_field:e,ts:r,sig:o}}),"authorize"),fe=n(t=>({type:Se,payload:t}),"unauthorized"),ci=n(t=>({type:jt,payload:t}),"setAuthUrl"),lr=n(t=>({type:Mn,payload:t}),"fetchDone"),pi=n((t=In)=>n(function(r,o){if(window.og&&window.og.previewMode)return r(fe({message:"Offers are running in preview mode"}));let{merchantId:i,authUrl:s}=o(),a=Ac(s);return r(a),t(s).then(({sig_field:c,ts:p,sig:l})=>r(Ot(i,c,p,l)),c=>r(fe(c))).finally(()=>r(lr(a)))},"fetchAuthThunk"),"fetchAuth"),Nc=n((t,e)=>({type:qn,payload:{status:t,ordering:e}}),"requestOrders"),fo=n(t=>({type:Ht,payload:t}),"receiveOrders"),ho=n(t=>({type:Gt,payload:t}),"receiveItems"),ur=n((t=1,e="place")=>n(function(o,i){let{environment:{legoUrl:s},auth:a}=i();if(!a)return o(fe("No auth set."));let c=Nc(t,e);return o(c),ue.fetchOrders(s,a,t,e).then(p=>{if(p.results){o(fo(p));let l=(p.results[0]||{}).public_id;if(l)return ue.fetchItems(s,a,l).then(f=>o(ho(f)))}return o(fe(p.detail)),null},p=>o(fe(p))).finally(()=>o(lr(c)))},"fetchOrdersThunk"),"fetchOrders"),mo=n(t=>{switch(t){case Zt:return{type:Me,payload:t};case ve:return{type:Le,payload:t};case Oe:return{type:$e,payload:t};default:throw new Error(`${t} is not a supported environment`)}},"setEnvironment"),li=n(()=>(t,e)=>{let{merchantId:r,sessionId:o}=e();return(!o||r&&!o.startsWith(r))&&t(uo(r)),o},"requestSessionId"),we=n((t,e)=>({type:P,payload:{...t,offer:e}}),"receiveOffer"),lo=n(t=>({type:Dn,payload:t}),"fetchResponseError"),Ic=n((t,e=xe,r)=>({type:Y,payload:{product:t,module:e,offer:r}}),"requestOffer"),ui=n((t,e=xe,r)=>n(function(i,s){let{merchantId:a,sessionId:c,environment:{apiUrl:p}}=s(),l=Ic(t,e,r);i(l);let f=E(t);return f?ue.fetchOffer(p,a,c,f,e).then(d=>i(we(d,r)),d=>i(lo(d))).finally(()=>i(lr(l))):null},"fetchOfferThunk"),"fetchOffer"),di=n(()=>({type:je}),"checkout"),kc=n((t,e,r,o)=>({type:Un,payload:{product:t,order:e,quantity:r,offerId:o}}),"requestCreateOneTime"),qc=n(t=>({type:Bt,payload:t}),"receiveCreateOneTime"),Dc=n((t,e)=>({type:Ln,payload:{item:t,frequency:e}}),"requestConvertOneTimeToSubscription"),Fc=n((t,e)=>({type:zt,payload:{response:t,product:e}}),"receiveConvertOneTime"),fi=n((t,e,r,o=!1,i=null)=>n(function(a,c){let{auth:p,config:l,environment:{legoUrl:f},previewUpsellOffer:d,offerId:h}=c();if(!p)return a(fe("No auth set."));let O=ei(i,l),_=kc(t,e,r,h);return a(_),(d?Promise.resolve({legoUrl:f,product:t,order:e,quantity:r,offer:h}):ue.createOneTime(f,p,t.id,e,r,h)).then(m=>(a(qc(m)),o?(a(Dc(m,O)),(d?Promise.resolve({item:m,frequency:O}):ue.convertOneTimeToSubscription(f,p,m,O,h)).then(S=>a(Fc(S,t)),S=>a(lo(S)))):m),m=>a(lo(m))).finally(()=>a(lr(_)))},"createIuThunk"),"createIu"),hi=n(t=>({type:Yt,payload:t}),"setLocale"),mi=n(t=>({type:Ve,payload:t}),"setConfig"),gi=n((t,e,r)=>({type:Wt,payload:{selector:t,markup:e,config:r}}),"addTemplate"),yi=n(t=>({type:Jt,payload:t}),"setTemplates"),bi=n((t,e)=>({type:Kt,payload:{product:t,firstOrderPlaceDate:e}}),"setFirstOrderPlaceDate"),_i=n((t,e)=>({type:Qt,payload:{product:t,productToSubscribe:e}}),"setProductToSubscribe");var Pt="OG_STATE",xi=n(t=>{try{return t===null?void 0:JSON.parse(t)}catch{return}},"safeParseState"),go=n(()=>window.og&&window.og.previewMode,"isPreviewMode"),vi=n(()=>go()?{}:xi(localStorage.getItem(Pt)),"loadState"),Uc=n(t=>!t||!t.sessionId?!1:JSON.stringify({sessionId:t.sessionId,optedin:t.optedin,optedout:t.optedout,productOffer:t.productOffer,firstOrderPlaceDate:t.firstOrderPlaceDate,productToSubscribe:t.productToSubscribe}),"serializeState"),Oi=n(t=>{if(go())return;let e=Uc(t);e&&localStorage.getItem(Pt)!==e&&localStorage.setItem(Pt,e)},"saveState"),Pi=n(t=>(0,Ei.throttle)(500,e=>{if(go())return;let{key:r,newValue:o}=e;r===Pt&&o===null?(t.dispatch({type:pe}),setTimeout(()=>t.dispatch(li()),0)):r===Pt&&t.dispatch({type:Ee,newValue:xi(o)})}),"listenLocalStorageChanges");var wi=ce(Mt());var Lc=n((t,e,r=document)=>r.dispatchEvent(new CustomEvent(t,{detail:e})),"dispatchEvent"),Ti=n(t=>({payload:{product:{id:e,components:r}={}}={}}={})=>setTimeout(()=>Lc("optin-changed",{productId:e,components:r,optedIn:t}),0),"dispatchOptinChangedEvent"),Mc=[{expressions:[({type:t}={})=>t===A,({type:t}={})=>t===k],fn:Ti(!0)},{expressions:[({type:t}={})=>t===I],fn:Ti(!1)}],Ci=n(t=>e=>r=>{let o=t.getState();Mc.forEach(i=>{i.expressions.some(s=>s(r,o))&&i.fn(r)}),e(r)},"dispatchMiddleware"),Ri=n(t=>e=>r=>{var i;let o;switch(r.type){case P:case I:case A:case k:o=new CustomEvent(`og-${r.type.toLowerCase().replace(/_/g,"-")}`,{bubbles:!0,cancelable:!0,detail:r.payload}),(((i=r.payload)==null?void 0:i.offer)||document).dispatchEvent(o);break;default:}o!=null&&o.defaultPrevented||e(r)},"offerEvents"),Ai=n(t=>e=>r=>{e(r);let o=(0,wi.throttle)(500,()=>{Oi({...t.getState()})});r.type!==Ee&&o()},"localStorageMiddleware");var yo=n(()=>{let t,e;return[new Promise((r,o)=>{t=r,e=o}),t,e]},"waitFor");function Ni(t){let[e,r]=yo(),[o,i]=yo(),[s,a]=yo();o.then(p=>{let{sessionId:l}=t.getState();!l||p&&!l.startsWith(p)?t.dispatch(uo(p)):a(l)});let c=Promise.all([o,e,s]);return c.then(()=>{var p;window.addEventListener("storage",Pi(t)),(p=t.getState().auth)!=null&&p.ts||t.dispatch(pi())}),p=>async l=>{Me===l.type||Le===l.type||$e===l.type?r(l.payload):Fe===l.type?i(l.payload):Ue===l.type?a(l.payload):await c,p(l)}}n(Ni,"waitUntilOffersReady");function Ii(t,...e){if(window.og&&window.og.store)return window.og.store;let r=window.og&&window.og.previewMode,o=typeof window=="object"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({name:"Ordergroove Offers"}):Zr,i=[Ni,Cn,Ci,Ri],s={};if(!r)try{s=vi(),i.push(Ai)}catch{}let a=o(Pn(...i,...e.filter(p=>p))),c=Qr(t,s,a);return window.og=window.og||{},window.og.store=c,c}n(Ii,"makeStore");var $c=Object.defineProperty,dr=n((t,e)=>$c(t,"name",{value:e,configurable:!0}),"i"),jc=dr(t=>e=>t.indexOf(e.origin)>=0,"createIsMessageAllowed"),qi=["https://rc3.ordergroove.com","https://rc3.stg.ordergroove.com","https://rc3-beta.stg.ordergroove.com","http://localhost:3000",window.location.origin],ki=dr(t=>(e,r)=>{qi.forEach(o=>t.postMessage({ogType:e,...r},o))},"createBroadcastMessage");function bo(t=window.opener,e=window.og){let r=dr(o=>{let i=jc(qi),s=ki(o.source),a=o.data.options||{};if(i(o)&&o.data.ogType==="READY"){let c="//static.ordergroove.com/@ordergroove/offers-live-editor/0.6.3/dist/";c.startsWith("//")&&(c=window.location.protocol+c),c.endsWith("/")||(c+="/"),import(`${c}client.js`).then(({initializeClient:p})=>{p({isMessageAllowed:i,broadcastMessage:s,options:a,og:e}),window.removeEventListener("message",r)})}},"handleReady");t&&t!==window&&(window.addEventListener("message",r),ki(t)("READY"))}n(bo,"f");dr(bo,"offersLiveEditor");var fr=null,Vc=n(t=>({dispatch:t}),"defaultMapDispatchToProps"),Di=n(t=>{if(!fr)throw new Error("Missing redux store.");return fr},"resolveStore"),Hc=n((t,e)=>r=>{let{getState:o,dispatch:i}=Di(r),s=t?t(o(),r):{},a=e(i,r);Object.assign(r,s,a)},"createRecalcProps"),g=n((t,e=Vc)=>r=>{let i=Hc(t,typeof e=="function"?e:s=>On(e,s));return class extends r{get store(){return fr}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this._storeUnsubscribe=Di(this).subscribe(()=>i(this)),i(this)}attributeChangedCallback(s,a,c){super.attributeChangedCallback&&super.attributeChangedCallback(s,a,c),this._storeUnsubscribe&&a!==c&&i(this)}disconnectedCallback(){this._storeUnsubscribe(),super.disconnectedCallback&&super.disconnectedCallback()}}},"connect"),Fi=n(t=>{fr=t},"setStore");var _o=n((t={},e=[])=>(t.optedin||[]).map(r=>{let o={product:r.id,subscription_info:{components:r.components||[]},tracking_override:{offer:((t.productOffer||{})[r.id]||[])[0],...St(r.frequency)}};return t.firstOrderPlaceDate&&t.firstOrderPlaceDate[r.id]&&(o.subscription_info.first_order_place_date=t.firstOrderPlaceDate[r.id]),t.productToSubscribe&&t.productToSubscribe[r.id]&&(o.tracking_override.product=t.productToSubscribe[r.id]),o}).filter(r=>r.tracking_override.offer).filter(r=>e.length?e.includes(r.product):r),"getProductsForPurchasePost"),Je=n((t={})=>{let e={};return Object.entries(t).forEach(([r,o])=>{Object.entries(o).forEach(([i,s])=>{let a={};s&&!Array.isArray(s)?a=s:a={frequency:i,prepaidShipments:null,regularPrice:s[0],subscriptionPrice:s[2],discountRate:s[1]},e[r]?e[r].push(a):e[r]=[a]})}),e},"getObjectStructuredProductPlans");var So=typeof window<"u"&&window.customElements!=null&&window.customElements.polyfillWrapFlushCallback!==void 0;var Ce=n((t,e,r=null)=>{for(;e!==r;){let o=e.nextSibling;t.removeChild(e),e=o}},"removeNodes");var $=`{{lit-${String(Math.random()).slice(2)}}}`,Eo=`<!--${$}-->`,Ui=new RegExp(`${$}|${Eo}`),Ke="$lit$",me=class{constructor(e,r){this.parts=[],this.element=r;let o=[],i=[],s=document.createTreeWalker(r.content,133,null,!1),a=0,c=-1,p=0,{strings:l,values:{length:f}}=e;for(;p<f;){let d=s.nextNode();if(d===null){s.currentNode=i.pop();continue}if(c++,d.nodeType===1){if(d.hasAttributes()){let h=d.attributes,{length:O}=h,_=0;for(let m=0;m<O;m++)Li(h[m].name,Ke)&&_++;for(;_-- >0;){let m=l[p],S=hr.exec(m)[2],T=S.toLowerCase()+Ke,b=d.getAttribute(T);d.removeAttribute(T);let w=b.split(Ui);this.parts.push({type:"attribute",index:c,name:S,strings:w}),p+=w.length-1}}d.tagName==="TEMPLATE"&&(i.push(d),s.currentNode=d.content)}else if(d.nodeType===3){let h=d.data;if(h.indexOf($)>=0){let O=d.parentNode,_=h.split(Ui),m=_.length-1;for(let S=0;S<m;S++){let T,b=_[S];if(b==="")T=te();else{let w=hr.exec(b);w!==null&&Li(w[2],Ke)&&(b=b.slice(0,w.index)+w[1]+w[2].slice(0,-Ke.length)+w[3]),T=document.createTextNode(b)}O.insertBefore(T,d),this.parts.push({type:"node",index:++c})}_[m]===""?(O.insertBefore(te(),d),o.push(d)):d.data=_[m],p+=m}}else if(d.nodeType===8)if(d.data===$){let h=d.parentNode;(d.previousSibling===null||c===a)&&(c++,h.insertBefore(te(),d)),a=c,this.parts.push({type:"node",index:c}),d.nextSibling===null?d.data="":(o.push(d),c--),p++}else{let h=-1;for(;(h=d.data.indexOf($,h+1))!==-1;)this.parts.push({type:"node",index:-1}),p++}}for(let d of o)d.parentNode.removeChild(d)}};n(me,"Template");var Li=n((t,e)=>{let r=t.length-e.length;return r>=0&&t.slice(r)===e},"endsWith"),Tt=n(t=>t.index!==-1,"isTemplatePartActive"),te=n(()=>document.createComment(""),"createMarker"),hr=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;var xo=133;function vo(t,e){let{element:{content:r},parts:o}=t,i=document.createTreeWalker(r,xo,null,!1),s=wt(o),a=o[s],c=-1,p=0,l=[],f=null;for(;i.nextNode();){c++;let d=i.currentNode;for(d.previousSibling===f&&(f=null),e.has(d)&&(l.push(d),f===null&&(f=d)),f!==null&&p++;a!==void 0&&a.index===c;)a.index=f!==null?-1:a.index-p,s=wt(o,s),a=o[s]}l.forEach(d=>d.parentNode.removeChild(d))}n(vo,"removeNodesFromTemplate");var Bc=n(t=>{let e=t.nodeType===11?0:1,r=document.createTreeWalker(t,xo,null,!1);for(;r.nextNode();)e++;return e},"countNodes"),wt=n((t,e=-1)=>{for(let r=e+1;r<t.length;r++){let o=t[r];if(Tt(o))return r}return-1},"nextActiveIndexInTemplateParts");function Mi(t,e,r=null){let{element:{content:o},parts:i}=t;if(r==null){o.appendChild(e);return}let s=document.createTreeWalker(o,xo,null,!1),a=wt(i),c=0,p=-1;for(;s.nextNode();)for(p++,s.currentNode===r&&(c=Bc(e),r.parentNode.insertBefore(e,r));a!==-1&&i[a].index===p;){if(c>0){for(;a!==-1;)i[a].index+=c,a=wt(i,a);return}a=wt(i,a)}}n(Mi,"insertNodeIntoTemplate");var zc=new WeakMap;var Re=n(t=>typeof t=="function"&&zc.has(t),"isDirective");var F={},mr={};var se=class{constructor(e,r,o){this.__parts=[],this.template=e,this.processor=r,this.options=o}update(e){let r=0;for(let o of this.__parts)o!==void 0&&o.setValue(e[r]),r++;for(let o of this.__parts)o!==void 0&&o.commit()}_clone(){let e=So?this.template.element.content.cloneNode(!0):document.importNode(this.template.element.content,!0),r=[],o=this.template.parts,i=document.createTreeWalker(e,133,null,!1),s=0,a=0,c,p=i.nextNode();for(;s<o.length;){if(c=o[s],!Tt(c)){this.__parts.push(void 0),s++;continue}for(;a<c.index;)a++,p.nodeName==="TEMPLATE"&&(r.push(p),i.currentNode=p.content),(p=i.nextNode())===null&&(i.currentNode=r.pop(),p=i.nextNode());if(c.type==="node"){let l=this.processor.handleTextExpression(this.options);l.insertAfterNode(p.previousSibling),this.__parts.push(l)}else this.__parts.push(...this.processor.handleAttributeExpressions(p,c.name,c.strings,this.options));s++}return So&&(document.adoptNode(e),customElements.upgrade(e)),e}};n(se,"TemplateInstance");var $i=window.trustedTypes&&trustedTypes.createPolicy("lit-html",{createHTML:t=>t}),Wc=` ${$} `,re=class{constructor(e,r,o,i){this.strings=e,this.values=r,this.type=o,this.processor=i}getHTML(){let e=this.strings.length-1,r="",o=!1;for(let i=0;i<e;i++){let s=this.strings[i],a=s.lastIndexOf("<!--");o=(a>-1||o)&&s.indexOf("-->",a+1)===-1;let c=hr.exec(s);c===null?r+=s+(o?Wc:Eo):r+=s.substr(0,c.index)+c[1]+c[2]+Ke+c[3]+$}return r+=this.strings[e],r}getTemplateElement(){let e=document.createElement("template"),r=this.getHTML();return $i!==void 0&&(r=$i.createHTML(r)),e.innerHTML=r,e}};n(re,"TemplateResult");var yr=n(t=>t===null||!(typeof t=="object"||typeof t=="function"),"isPrimitive"),gr=n(t=>Array.isArray(t)||!!(t&&t[Symbol.iterator]),"isIterable"),Ae=class{constructor(e,r,o){this.dirty=!0,this.element=e,this.name=r,this.strings=o,this.parts=[];for(let i=0;i<o.length-1;i++)this.parts[i]=this._createPart()}_createPart(){return new Qe(this)}_getValue(){let e=this.strings,r=e.length-1,o=this.parts;if(r===1&&e[0]===""&&e[1]===""){let s=o[0].value;if(typeof s=="symbol")return String(s);if(typeof s=="string"||!gr(s))return s}let i="";for(let s=0;s<r;s++){i+=e[s];let a=o[s];if(a!==void 0){let c=a.value;if(yr(c)||!gr(c))i+=typeof c=="string"?c:String(c);else for(let p of c)i+=typeof p=="string"?p:String(p)}}return i+=e[r],i}commit(){this.dirty&&(this.dirty=!1,this.element.setAttribute(this.name,this._getValue()))}};n(Ae,"AttributeCommitter");var Qe=class{constructor(e){this.value=void 0,this.committer=e}setValue(e){e!==F&&(!yr(e)||e!==this.value)&&(this.value=e,Re(e)||(this.committer.dirty=!0))}commit(){for(;Re(this.value);){let e=this.value;this.value=F,e(this)}this.value!==F&&this.committer.commit()}};n(Qe,"AttributePart");var oe=class{constructor(e){this.value=void 0,this.__pendingValue=void 0,this.options=e}appendInto(e){this.startNode=e.appendChild(te()),this.endNode=e.appendChild(te())}insertAfterNode(e){this.startNode=e,this.endNode=e.nextSibling}appendIntoPart(e){e.__insert(this.startNode=te()),e.__insert(this.endNode=te())}insertAfterPart(e){e.__insert(this.startNode=te()),this.endNode=e.endNode,e.endNode=this.startNode}setValue(e){this.__pendingValue=e}commit(){if(this.startNode.parentNode===null)return;for(;Re(this.__pendingValue);){let r=this.__pendingValue;this.__pendingValue=F,r(this)}let e=this.__pendingValue;e!==F&&(yr(e)?e!==this.value&&this.__commitText(e):e instanceof re?this.__commitTemplateResult(e):e instanceof Node?this.__commitNode(e):gr(e)?this.__commitIterable(e):e===mr?(this.value=mr,this.clear()):this.__commitText(e))}__insert(e){this.endNode.parentNode.insertBefore(e,this.endNode)}__commitNode(e){this.value!==e&&(this.clear(),this.__insert(e),this.value=e)}__commitText(e){let r=this.startNode.nextSibling;e=e??"";let o=typeof e=="string"?e:String(e);r===this.endNode.previousSibling&&r.nodeType===3?r.data=o:this.__commitNode(document.createTextNode(o)),this.value=e}__commitTemplateResult(e){let r=this.options.templateFactory(e);if(this.value instanceof se&&this.value.template===r)this.value.update(e.values);else{let o=new se(r,e.processor,this.options),i=o._clone();o.update(e.values),this.__commitNode(i),this.value=o}}__commitIterable(e){Array.isArray(this.value)||(this.value=[],this.clear());let r=this.value,o=0,i;for(let s of e)i=r[o],i===void 0&&(i=new oe(this.options),r.push(i),o===0?i.appendIntoPart(this):i.insertAfterPart(r[o-1])),i.setValue(s),i.commit(),o++;o<r.length&&(r.length=o,this.clear(i&&i.endNode))}clear(e=this.startNode){Ce(this.startNode.parentNode,e.nextSibling,this.endNode)}};n(oe,"NodePart");var Ze=class{constructor(e,r,o){if(this.value=void 0,this.__pendingValue=void 0,o.length!==2||o[0]!==""||o[1]!=="")throw new Error("Boolean attributes can only contain a single expression");this.element=e,this.name=r,this.strings=o}setValue(e){this.__pendingValue=e}commit(){for(;Re(this.__pendingValue);){let r=this.__pendingValue;this.__pendingValue=F,r(this)}if(this.__pendingValue===F)return;let e=!!this.__pendingValue;this.value!==e&&(e?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=e),this.__pendingValue=F}};n(Ze,"BooleanAttributePart");var Xe=class extends Ae{constructor(e,r,o){super(e,r,o),this.single=o.length===2&&o[0]===""&&o[1]===""}_createPart(){return new Ct(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}};n(Xe,"PropertyCommitter");var Ct=class extends Qe{};n(Ct,"PropertyPart");var ji=!1;(()=>{try{let t={get capture(){return ji=!0,!1}};window.addEventListener("test",t,t),window.removeEventListener("test",t,t)}catch{}})();var et=class{constructor(e,r,o){this.value=void 0,this.__pendingValue=void 0,this.element=e,this.eventName=r,this.eventContext=o,this.__boundHandleEvent=i=>this.handleEvent(i)}setValue(e){this.__pendingValue=e}commit(){for(;Re(this.__pendingValue);){let s=this.__pendingValue;this.__pendingValue=F,s(this)}if(this.__pendingValue===F)return;let e=this.__pendingValue,r=this.value,o=e==null||r!=null&&(e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive),i=e!=null&&(r==null||o);o&&this.element.removeEventListener(this.eventName,this.__boundHandleEvent,this.__options),i&&(this.__options=Jc(e),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=e,this.__pendingValue=F}handleEvent(e){typeof this.value=="function"?this.value.call(this.eventContext||this.element,e):this.value.handleEvent(e)}};n(et,"EventPart");var Jc=n(t=>t&&(ji?{capture:t.capture,passive:t.passive,once:t.once}:t.capture),"getOptions");function Oo(t){let e=Ne.get(t.type);e===void 0&&(e={stringsArray:new WeakMap,keyString:new Map},Ne.set(t.type,e));let r=e.stringsArray.get(t.strings);if(r!==void 0)return r;let o=t.strings.join($);return r=e.keyString.get(o),r===void 0&&(r=new me(t,t.getTemplateElement()),e.keyString.set(o,r)),e.stringsArray.set(t.strings,r),r}n(Oo,"templateFactory");var Ne=new Map;var ge=new WeakMap,Po=n((t,e,r)=>{let o=ge.get(e);o===void 0&&(Ce(e,e.firstChild),ge.set(e,o=new oe(Object.assign({templateFactory:Oo},r))),o.appendInto(e)),o.setValue(t),o.commit()},"render");var Rt=class{handleAttributeExpressions(e,r,o,i){let s=r[0];return s==="."?new Xe(e,r.slice(1),o).parts:s==="@"?[new et(e,r.slice(1),i.eventContext)]:s==="?"?[new Ze(e,r.slice(1),o)]:new Ae(e,r,o).parts}handleTextExpression(e){return new oe(e)}};n(Rt,"DefaultTemplateProcessor");var To=new Rt;typeof window<"u"&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.3.0");var u=n((t,...e)=>new re(t,e,"html",To),"html");var Hi=n((t,e)=>`${t}--${e}`,"getTemplateCacheKey"),br=!0;typeof window.ShadyCSS>"u"?br=!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."),br=!1);var Qc=n(t=>e=>{let r=Hi(e.type,t),o=Ne.get(r);o===void 0&&(o={stringsArray:new WeakMap,keyString:new Map},Ne.set(r,o));let i=o.stringsArray.get(e.strings);if(i!==void 0)return i;let s=e.strings.join($);if(i=o.keyString.get(s),i===void 0){let a=e.getTemplateElement();br&&window.ShadyCSS.prepareTemplateDom(a,t),i=new me(e,a),o.keyString.set(s,i)}return o.stringsArray.set(e.strings,i),i},"shadyTemplateFactory"),Zc=["html","svg"],Xc=n(t=>{Zc.forEach(e=>{let r=Ne.get(Hi(e,t));r!==void 0&&r.keyString.forEach(o=>{let{element:{content:i}}=o,s=new Set;Array.from(i.querySelectorAll("style")).forEach(a=>{s.add(a)}),vo(o,s)})})},"removeStylesFromLitTemplates"),Gi=new Set,ep=n((t,e,r)=>{Gi.add(t);let o=r?r.element:document.createElement("template"),i=e.querySelectorAll("style"),{length:s}=i;if(s===0){window.ShadyCSS.prepareTemplateStyles(o,t);return}let a=document.createElement("style");for(let l=0;l<s;l++){let f=i[l];f.parentNode.removeChild(f),a.textContent+=f.textContent}Xc(t);let c=o.content;r?Mi(r,a,c.firstChild):c.insertBefore(a,c.firstChild),window.ShadyCSS.prepareTemplateStyles(o,t);let p=c.querySelector("style");if(window.ShadyCSS.nativeShadow&&p!==null)e.insertBefore(p.cloneNode(!0),e.firstChild);else if(r){c.insertBefore(a,c.firstChild);let l=new Set;l.add(a),vo(r,l)}},"prepareTemplateStyles"),Bi=n((t,e,r)=>{if(!r||typeof r!="object"||!r.scopeName)throw new Error("The `scopeName` option is required.");let o=r.scopeName,i=ge.has(e),s=br&&e.nodeType===11&&!!e.host,a=s&&!Gi.has(o),c=a?document.createDocumentFragment():e;if(Po(t,c,Object.assign({templateFactory:Qc(o)},r)),a){let p=ge.get(c);ge.delete(c);let l=p.value instanceof se?p.value.template:void 0;ep(o,c,l),Ce(e,e.firstChild),e.appendChild(c),ge.set(e,p)}!i&&s&&window.ShadyCSS.styleElement(e.host)},"render");var zi;window.JSCompiler_renameProperty=(t,e)=>t;var Io={toAttribute(t,e){switch(e){case Boolean:return t?"":null;case Object:case Array:return t==null?t:JSON.stringify(t)}return t},fromAttribute(t,e){switch(e){case Boolean:return t!==null;case Number:return t===null?null:Number(t);case Object:case Array:return JSON.parse(t)}return t}},Yi=n((t,e)=>e!==t&&(e===e||t===t),"notEqual"),wo={attribute:!0,type:String,converter:Io,reflect:!1,hasChanged:Yi},Co=1,Ro=1<<2,Ao=1<<3,No=1<<4,ko="finalized",tt=class extends HTMLElement{constructor(){super(),this.initialize()}static get observedAttributes(){this.finalize();let e=[];return this._classProperties.forEach((r,o)=>{let i=this._attributeNameForProperty(o,r);i!==void 0&&(this._attributeToPropertyMap.set(i,o),e.push(i))}),e}static _ensureClassProperties(){if(!this.hasOwnProperty(JSCompiler_renameProperty("_classProperties",this))){this._classProperties=new Map;let e=Object.getPrototypeOf(this)._classProperties;e!==void 0&&e.forEach((r,o)=>this._classProperties.set(o,r))}}static createProperty(e,r=wo){if(this._ensureClassProperties(),this._classProperties.set(e,r),r.noAccessor||this.prototype.hasOwnProperty(e))return;let o=typeof e=="symbol"?Symbol():`__${e}`,i=this.getPropertyDescriptor(e,o,r);i!==void 0&&Object.defineProperty(this.prototype,e,i)}static getPropertyDescriptor(e,r,o){return{get(){return this[r]},set(i){let s=this[e];this[r]=i,this.requestUpdateInternal(e,s,o)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this._classProperties&&this._classProperties.get(e)||wo}static finalize(){let e=Object.getPrototypeOf(this);if(e.hasOwnProperty(ko)||e.finalize(),this[ko]=!0,this._ensureClassProperties(),this._attributeToPropertyMap=new Map,this.hasOwnProperty(JSCompiler_renameProperty("properties",this))){let r=this.properties,o=[...Object.getOwnPropertyNames(r),...typeof Object.getOwnPropertySymbols=="function"?Object.getOwnPropertySymbols(r):[]];for(let i of o)this.createProperty(i,r[i])}}static _attributeNameForProperty(e,r){let o=r.attribute;return o===!1?void 0:typeof o=="string"?o:typeof e=="string"?e.toLowerCase():void 0}static _valueHasChanged(e,r,o=Yi){return o(e,r)}static _propertyValueFromAttribute(e,r){let o=r.type,i=r.converter||Io,s=typeof i=="function"?i:i.fromAttribute;return s?s(e,o):e}static _propertyValueToAttribute(e,r){if(r.reflect===void 0)return;let o=r.type,i=r.converter;return(i&&i.toAttribute||Io.toAttribute)(e,o)}initialize(){this._updateState=0,this._updatePromise=new Promise(e=>this._enableUpdatingResolver=e),this._changedProperties=new Map,this._saveInstanceProperties(),this.requestUpdateInternal()}_saveInstanceProperties(){this.constructor._classProperties.forEach((e,r)=>{if(this.hasOwnProperty(r)){let o=this[r];delete this[r],this._instanceProperties||(this._instanceProperties=new Map),this._instanceProperties.set(r,o)}})}_applyInstanceProperties(){this._instanceProperties.forEach((e,r)=>this[r]=e),this._instanceProperties=void 0}connectedCallback(){this.enableUpdating()}enableUpdating(){this._enableUpdatingResolver!==void 0&&(this._enableUpdatingResolver(),this._enableUpdatingResolver=void 0)}disconnectedCallback(){}attributeChangedCallback(e,r,o){r!==o&&this._attributeToProperty(e,o)}_propertyToAttribute(e,r,o=wo){let i=this.constructor,s=i._attributeNameForProperty(e,o);if(s!==void 0){let a=i._propertyValueToAttribute(r,o);if(a===void 0)return;this._updateState=this._updateState|Ao,a==null?this.removeAttribute(s):this.setAttribute(s,a),this._updateState=this._updateState&~Ao}}_attributeToProperty(e,r){if(this._updateState&Ao)return;let o=this.constructor,i=o._attributeToPropertyMap.get(e);if(i!==void 0){let s=o.getPropertyOptions(i);this._updateState=this._updateState|No,this[i]=o._propertyValueFromAttribute(r,s),this._updateState=this._updateState&~No}}requestUpdateInternal(e,r,o){let i=!0;if(e!==void 0){let s=this.constructor;o=o||s.getPropertyOptions(e),s._valueHasChanged(this[e],r,o.hasChanged)?(this._changedProperties.has(e)||this._changedProperties.set(e,r),o.reflect===!0&&!(this._updateState&No)&&(this._reflectingProperties===void 0&&(this._reflectingProperties=new Map),this._reflectingProperties.set(e,o))):i=!1}!this._hasRequestedUpdate&&i&&(this._updatePromise=this._enqueueUpdate())}requestUpdate(e,r){return this.requestUpdateInternal(e,r),this.updateComplete}async _enqueueUpdate(){this._updateState=this._updateState|Ro;try{await this._updatePromise}catch{}let e=this.performUpdate();return e!=null&&await e,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return this._updateState&Ro}get hasUpdated(){return this._updateState&Co}performUpdate(){if(!this._hasRequestedUpdate)return;this._instanceProperties&&this._applyInstanceProperties();let e=!1,r=this._changedProperties;try{e=this.shouldUpdate(r),e?this.update(r):this._markUpdated()}catch(o){throw e=!1,this._markUpdated(),o}e&&(this._updateState&Co||(this._updateState=this._updateState|Co,this.firstUpdated(r)),this.updated(r))}_markUpdated(){this._changedProperties=new Map,this._updateState=this._updateState&~Ro}get updateComplete(){return this._getUpdateComplete()}_getUpdateComplete(){return this._updatePromise}shouldUpdate(e){return!0}update(e){this._reflectingProperties!==void 0&&this._reflectingProperties.size>0&&(this._reflectingProperties.forEach((r,o)=>this._propertyToAttribute(o,this[o],r)),this._reflectingProperties=void 0),this._markUpdated()}updated(e){}firstUpdated(e){}};n(tt,"UpdatingElement");zi=ko;tt[zi]=!0;var Wi=Element.prototype,Wd=Wi.msMatchesSelector||Wi.webkitMatchesSelector;var _r=window.ShadowRoot&&(window.ShadyCSS===void 0||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,qo=Symbol(),rt=class{constructor(e,r){if(r!==qo)throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e}get styleSheet(){return this._styleSheet===void 0&&(_r?(this._styleSheet=new CSSStyleSheet,this._styleSheet.replaceSync(this.cssText)):this._styleSheet=null),this._styleSheet}toString(){return this.cssText}};n(rt,"CSSResult");var Ji=n(t=>new rt(String(t),qo),"unsafeCSS"),tp=n(t=>{if(t instanceof rt)return t.cssText;if(typeof t=="number")return t;throw new Error(`Value passed to 'css' function must be a 'css' function result: ${t}. Use 'unsafeCSS' to pass non-literal values, but
12
12
  take care to ensure page security.`)},"textFromCSSResult"),y=n((t,...e)=>{let r=e.reduce((o,i,s)=>o+tp(i)+t[s+1],t[0]);return new rt(r,qo)},"css");(window.litElementVersions||(window.litElementVersions=[])).push("2.4.0");var Ki={},x=class extends tt{static getStyles(){return this.styles}static _getUniqueStyles(){if(this.hasOwnProperty(JSCompiler_renameProperty("_styles",this)))return;let e=this.getStyles();if(Array.isArray(e)){let r=n((s,a)=>s.reduceRight((c,p)=>Array.isArray(p)?r(p,c):(c.add(p),c),a),"addStyles"),o=r(e,new Set),i=[];o.forEach(s=>i.unshift(s)),this._styles=i}else this._styles=e===void 0?[]:[e];this._styles=this._styles.map(r=>{if(r instanceof CSSStyleSheet&&!_r){let o=Array.prototype.slice.call(r.cssRules).reduce((i,s)=>i+s.cssText,"");return Ji(o)}return r})}initialize(){super.initialize(),this.constructor._getUniqueStyles(),this.renderRoot=this.createRenderRoot(),window.ShadowRoot&&this.renderRoot instanceof window.ShadowRoot&&this.adoptStyles()}createRenderRoot(){return this.attachShadow({mode:"open"})}adoptStyles(){let e=this.constructor._styles;e.length!==0&&(window.ShadyCSS!==void 0&&!window.ShadyCSS.nativeShadow?window.ShadyCSS.ScopingShim.prepareAdoptedCssText(e.map(r=>r.cssText),this.localName):_r?this.renderRoot.adoptedStyleSheets=e.map(r=>r instanceof CSSStyleSheet?r:r.styleSheet):this._needsShimAdoptedStyleSheets=!0)}connectedCallback(){super.connectedCallback(),this.hasUpdated&&window.ShadyCSS!==void 0&&window.ShadyCSS.styleElement(this)}update(e){let r=this.render();super.update(e),r!==Ki&&this.constructor.render(r,this.renderRoot,{scopeName:this.localName,eventContext:this}),this._needsShimAdoptedStyleSheets&&(this._needsShimAdoptedStyleSheets=!1,this.constructor._styles.forEach(o=>{let i=document.createElement("style");i.textContent=o.cssText,this.renderRoot.appendChild(i)}))}render(){return Ki}};n(x,"LitElement");x.finalized=!0;x.render=Bi;var hs=ce(as());var cp=n(t=>{let e=String(t||"").trim().match(/(\d+)\s*([dwm])/);return e?`${e[1]}_${{d:1,w:2,m:3}[e[2]]}`:t},"sanitizeFrequencyString"),cs=n(t=>t.hasAttribute("product")&&{id:t.getAttribute("product"),...t.hasAttribute("product-components")&&{components:JSON.parse(t.getAttribute("product-components"))}},"buildProduct");var At=n(t=>{let e=cs(t);if(!e){let r=t.offer;r&&(e=cs(r))}return e},"resolveProduct"),pp=n(t=>{let e=t;for(;e;){if(e.tagName==="OG-OFFER")return e;e=e.nodeType===11?e.host:e.parentNode}},"resolveOffer"),Do=n(t=>class extends t{get offer(){return pp(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"),C=n(t=>class extends Do(t){get product(){return At(this)}},"withProduct"),Er=n(t=>class extends t{get childOptions(){let e=[],r=null;return this.querySelectorAll("option").forEach(o=>{let i=cp(o.value),s=o.innerText.trim();e.push({value:i,text:s}),!r&&o.selected&&(r=i)}),{options:e,isSelected:r}}},"withChildOptions");var xr={};Sn(xr,{autoshipByDefault:()=>lp,eligibilityGroups:()=>Uo,eligible:()=>ps,hasPrepaidOptions:()=>mp,hasUpcomingOrder:()=>ds,hasUpsellGroup:()=>us,inStock:()=>Fo,optedout:()=>fp,prepaidEligible:()=>up,prepaidSubscribed:()=>hp,regularEligible:()=>yp,subscribed:()=>dp,subscriptionEligible:()=>ls,upcomingOrderContainsProduct:()=>gp,upsellEligible:()=>fs});var Fo=n((t,e)=>(t.inStock||{})[(e.product||{}).id],"inStock"),ps=n((t,e)=>(t.autoshipEligible||{})[(e.product||{}).id]||!1,"eligible"),lp=n((t,e)=>(t.autoshipByDefault||{})[(e.product||{}).id]||!1,"autoshipByDefault"),ls=n((t,e)=>(t.offerId&&t.offerId!=="0"||!1)&&ps(t,e)&&Fo(t,e),"subscriptionEligible"),Uo=n((t,e)=>{let r=E((e.product||{}).id);return(t.eligibilityGroups||{})[r]||null},"eligibilityGroups"),us=n((t,e)=>{let r=Uo(t,e);return r===null||!!r.find(o=>o==="upsell"||o==="impulse_upsell")},"hasUpsellGroup"),up=n((t,e)=>{let r=Uo(t,e);return(r==null?void 0:r.some(o=>o==="prepaid"))||!1},"prepaidEligible"),dp=n((t,e)=>ir(e.product)(t),"subscribed"),fp=n((t,e)=>sr(e.product)(t),"optedout"),hp=n((t,e)=>Xn(e.product)(t),"prepaidSubscribed"),mp=n((t,e)=>X(e.product.id)(t).length>0,"hasPrepaidOptions"),ds=n(t=>!!(t.nextUpcomingOrder&&t.nextUpcomingOrder.public_id),"hasUpcomingOrder"),gp=n((t,e)=>(t.nextUpcomingOrder&&t.nextUpcomingOrder.products||[]).includes((e.product||{}).id),"upcomingOrderContainsProduct"),fs=n((t,e)=>{var r;return!((r=e.offer)!=null&&r.isCart)&&t.offerId&&t.offerId!=="0"&&t.auth&&Fo(t,e)&&ds(t)&&us(t,e)},"upsellEligible"),yp=n((t,e)=>ls(t,e)&&!fs(t,e),"regularEligible");var bp=n(t=>t.replace(/(\r\n|\n|\r|\s)+/gm,""),"removeWhitespace"),vr=class extends C(x){static get properties(){return{...super.properties,state:{type:Object,attribute:!1},test:{type:String}}}render(){if(!this.test)return u``;let e=bp(this.test);return e=e.replace(/(![a-zA-Z]+)/g,"($1)"),hs.default.parse(e,o=>xr[o]&&xr[o](this.state,this))?u`
13
13
  <slot></slot>
14
14
  `:u``}shouldUpdate(e){return e.size&&(this.product&&this.product.id in this.state.autoshipEligible&&this.product.id in this.state.inStock||!this.product.id)}};n(vr,"When");var _p=n(t=>({state:t}),"mapStateToProps"),ms=g(_p)(vr);var gs={type:Object,converter:{toAttribute(t){return t==null?t:JSON.stringify(t)},fromAttribute(t){return t&&t.match(/[{[]/)?JSON.parse(t):{id:t}}}},be={type:String,attribute:"default-frequency",converter:{fromAttribute(t){return t&&no(t)?t:null}}},Or={type:Boolean,attribute:!0,reflect:!0},it={type:Object,attribute:!1};var Sp=n(t=>class extends t{getOption(e,r=e){let o=ao(e);if(this.hasAttribute(o)){let i=this.getAttribute(o);return i.toString().toLowerCase()==="true"?!0:i.toString().toLowerCase()==="false"?!1:i}if(this.template&&this.template.config&&typeof this.template.config[r]!="undefined")return this.template.config[r];if(this.config&&typeof this.config[r]!="undefined")return this.config[r]}applyTemplate(e){this.template=e;let r=typeof e.markup=="undefined"?this.constructor.initialTemplate:e.markup;r&&this._templateMarkup!==r&&(this._templateMarkup=r,this.innerHTML=r)}refreshTemplate(){if(this._templates&&this._templates.length){let e=this._templates.find(({selector:r})=>{try{return this.matches(r)}catch{return!1}});this.applyTemplate(e||{})}}set templates(e){this._templates=e,this.refreshTemplate()}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this.constructor.initialTemplate&&!this.innerHTML.trim()&&(this.innerHTML=this.constructor.initialTemplate)}},"withTemplate"),D=Sp(x);var V=class extends C(D){static get properties(){return{subscribed:Or,frequencyMatch:{type:Boolean,reflect:!0,attribute:"frequency-match"},productDefaultFrequency:{type:String},defaultFrequency:{type:String},frequencies:{type:Array}}}static get styles(){return y`
@@ -797,7 +797,7 @@ var lib=(()=>{var fa=Object.create;var pt=Object.defineProperty;var ha=Object.ge
797
797
  </slot>
798
798
  </div>
799
799
  </span>
800
- `}};n(qt,"Tooltip");var ne=class extends C(x){static get properties(){return{options:{type:Array},shipmentsOptedIn:{type:Number},prepaidShipmentsSelected:{type:Number},defaultPrepaidShipments:{type:Number,attribute:"default-prepaid-shipments"}}}get prepaidOptedIn(){return this.shipmentsOptedIn>1}get selectedNumberOfShipments(){return this.prepaidShipmentsSelected||this.shipmentsOptedIn||this.getDefaultPrepaidShipments()}getDefaultPrepaidShipments(){return this.options.includes(this.defaultPrepaidShipments)?this.defaultPrepaidShipments:this.options[1]||this.options[0]}handleSelect({target:{value:e}}){let r=+e;this.productChangePrepaidShipments(this.product,r,this.offer)}render(){return u``}};n(ne,"PrepaidStatus");var Dp=n((t,e)=>({options:X(e.product.id)(t),shipmentsOptedIn:L(e.product)(t),prepaidShipmentsSelected:Q(e.product)(t)}),"mapStateToProps"),Em=g(Dp,{productChangePrepaidShipments:he})(ne);var Fr=class extends ne{constructor(){super(),this.options=[],this.text="shipments"}static get properties(){return{...super.properties,text:{type:String}}}static get styles(){return y`
800
+ `}};n(qt,"Tooltip");var ne=class extends C(x){static get properties(){return{options:{type:Array},shipmentsOptedIn:{type:Number},prepaidShipmentsSelected:{type:Number},defaultPrepaidShipments:{type:Number,attribute:"default-prepaid-shipments"}}}get prepaidOptedIn(){return this.shipmentsOptedIn>1}get selectedNumberOfShipments(){return this.prepaidShipmentsSelected||this.shipmentsOptedIn||this.getDefaultPrepaidShipments()}getDefaultPrepaidShipments(){return this.options.includes(this.defaultPrepaidShipments)?this.defaultPrepaidShipments:this.options[1]||this.options[0]}handleSelect({target:{value:e}}){let r=+e;this.productChangePrepaidShipments(this.product,r,this.offer)}render(){return u``}};n(ne,"PrepaidStatus");var Dp=n((t,e)=>({options:X(e.product.id)(t),shipmentsOptedIn:L(e.product)(t),prepaidShipmentsSelected:Q(e.product)(t)}),"mapStateToProps"),xm=g(Dp,{productChangePrepaidShipments:he})(ne);var Fr=class extends ne{constructor(){super(),this.options=[],this.text="shipments"}static get properties(){return{...super.properties,text:{type:String}}}static get styles(){return y`
801
801
  og-select {
802
802
  display: inline-block;
803
803
  cursor: pointer;
@@ -1048,6 +1048,6 @@ var lib=(()=>{var fa=Object.create;var pt=Object.defineProperty;var ha=Object.ge
1048
1048
  <slot name="append"></slot>
1049
1049
  `:u`
1050
1050
  <slot name="fallback"></slot>
1051
- `}};n(Hr,"Price");var Wp=n((t,e)=>{var r;return{productPlans:t.productPlans,configDefaultFrequency:(r=t.config)==null?void 0:r.defaultFrequency,frequency:Z(e.product)(t)}},"mapStateToProps"),Gs=g(Wp)(Hr);function cn(t){Vs(),Fi(t);try{customElements.define("og-when",ms),customElements.define("og-text",Ps),customElements.define("og-incentive-text",Rs),customElements.define("og-offer",Fs),customElements.define("og-select-frequency",As),customElements.define("og-optout-button",_s),customElements.define("og-optin-toggle",Os),customElements.define("og-optin-status",ys),customElements.define("og-optin-button",bs),customElements.define("og-optin-select",Es),customElements.define("og-upsell-button",xs),customElements.define("og-frequency-status",Ss),customElements.define("og-modal",It),customElements.define("og-select",kt),customElements.define("og-tooltip",qt),customElements.define("og-upsell-modal",vs),customElements.define("og-next-upcoming-order",Is),customElements.define("og-price",Gs),customElements.define("og-prepaid-toggle",Us),customElements.define("og-prepaid-data",Ls),customElements.define("og-prepaid-button",Ms),customElements.define("og-prepaid-select",$s),customElements.define("og-subscription-button",js)}catch{console.info("OG WebComponents already registered, skipping.")}let e=!1,r={store:t,isReady:()=>e,setEnvironment(o){return t.dispatch(mo(o)),this},setMerchantId(o){return t.dispatch(ai(o)),this},setAuthUrl(o){return t.dispatch(ci(o)),this},getProductsForPurchasePost(o=[]){return _o(t.getState(),o)},getOptins(o=[]){return _o(t.getState(),o)},clear(){t.dispatch(di())},addOptinChangedCallback(o){typeof o=="function"&&document.addEventListener("optin-changed",i=>o(i.detail))},disableOptinChangedCallbacks(){document.addEventListener("optin-changed",o=>o.stopPropagation(),!0)},register(){},previewMode(o){return window.og=window.og||{},o===!1?delete window.og:window.og.previewMode=!0,this},config(o){return t.dispatch(mi(o)),this},setLocale(o){return t.dispatch(hi(o)),this},addTemplate(o,i,s){return t.dispatch(gi(o,i,s)),this},setTemplates(o){return t.dispatch(yi(o)),this},setPublicPath(o){return this},resolveSettings(o,i,s,a=t){if(o&&i&&s){let c=[];s.product?c.push(s.product):s.cart&&Array.isArray(s.cart.products)&&(c=c.concat(s.cart.products));let{apiUrl:p}=Ft({},mo(i)),{sessionId:l}=a.getState();l&&c.forEach(f=>{let d=E(f);ue.fetchOffer(p,o,l,`${d}`,xe)}),s.product_discounts&&typeof s.product_discounts=="object"&&a.dispatch({type:H,payload:s.product_discounts})}},initialize(o,i,s){var c;e?console.warn("og.offers has been initialized already. Skipping."):r.resolveSettings(o,i,window.og_settings,t);let a=t.getState();return o&&o!==a.merchantId&&r.setMerchantId(o),i&&i!==((c=a.environment)==null?void 0:c.name)&&r.setEnvironment(i),s&&r.setAuthUrl(s),e=!0,this}};return window.OG=window.OG||{},Object.assign(window.OG,r),Object.assign(r.initialize,r),bo(window.opener,r),r}n(cn,"makeApi");var ae=n((t,e)=>t===null?"":new Intl.NumberFormat(void 0,{style:"currency",currency:e}).format(t/100),"money"),Gr=n(t=>`${t}%`,"percentage");var Br=n(t=>{var e,r;return Array.isArray((e=t.selling_plan)==null?void 0:e.options)&&((r=t.selling_plan)==null?void 0:r.options.some(o=>(o==null?void 0:o.name)==="Shipment amount"))},"isPrepaidAllocation"),zr=n(t=>{if(t&&t.length>1){let e=t.find(r=>(r==null?void 0:r.name)==="Shipment amount").value.split(" ");return e.length>0?+e[0]:null}return null},"getPrepaidShipmentsNumberFromOptions"),Jp=n(t=>{var e,r;return(t.selling_plan_id||((r=(e=t.selling_plan)==null?void 0:e.id)!=null?r:"")).toString()},"getAllocationFrequency"),Kp=n((t,e)=>ae(t.compare_at_price,e),"getAllocationRegularPrice"),Qp=n((t,e)=>{var r;if(Br(t)){let o=zr((r=t.selling_plan)==null?void 0:r.options),i=Math.round(t.price/o);return ae(i,e)}return ae(t.price,e)},"getAllocationSubscriptionPrice"),Bs=n((t,e)=>Math.round((t.compare_at_price-e)*100/t.compare_at_price),"getPrepaidPercentage"),Zp=n((t,e)=>{var o,i,s;if(Br(t)){let a=zr((o=t.selling_plan)==null?void 0:o.options),c=t.price/a,p=Bs(t,c);return Gr(p)}let r="";return((i=t.price_adjustments[0])==null?void 0:i.value_type)==="percentage"?r=Gr(t.price_adjustments[0].value):(s=t.price_adjustments[0])!=null&&s.value?r=ae(t.price_adjustments[0].value,e):t.compare_at_price&&(r=ae(t.compare_at_price-t.price,e)),r},"getAllocationDiscountRate"),Xp=n(t=>{var e;return Br(t)?zr((e=t.selling_plan)==null?void 0:e.options):null},"getAllocationNumberOfShipments"),el=n((t,e,r,o)=>{var f,d;let i=zr((f=t.selling_plan)==null?void 0:f.options),s=t.price/i,a=t.compare_at_price-s,c=Bs(t,s),p=(d=r==null?void 0:r.price_adjustments)==null?void 0:d[0],l=p&&p.value_type==="percentage"?p.value:null;return e.regularPrepaidPrice=ae(t.price,o),e.prepaidSavingsPerShipment=ae(Math.round(a),o),e.prepaidSavingsTotal=ae(Math.round(a*i),o),l&&c&&(e.prepaidExtraSavingsPercentage=Gr(c-l)),e},"addPrepaidPriceAndSavings"),pn="Subscribe and Save",tl=n((t,e,r)=>{t.selling_plan||(t.selling_plan=e.find(i=>i.id===t.selling_plan_id));let o={frequency:Jp(t),regularPrice:Kp(t,r),subscriptionPrice:Qp(t,r),discountRate:Zp(t,r),prepaidShipments:Xp(t)};if(Br(t)){let i=e.find(s=>s.group_name===pn&&s.options.length===1);return el(t,o,i,r)}return o},"mapSellingPlanToDiscount"),ln=n((t,e,r=[],o)=>[...t,tl(e,r,o)],"sellingPlanAllocationsReducer"),zs=n(t=>t.selling_plan_groups.reduce((e,r)=>[...e,...r.selling_plans.map(o=>({...o,group_name:r.name}))],[]),"getSellingPlans");var Ws=n((t,e,r)=>{let o=Object.keys(t).filter(i=>i.startsWith(e.toString()));return o.length?{...t,...o.reduce((i,s)=>({...i,[s]:r}),{})}:t},"overrideLineKey"),Ys=n((t,e,r)=>{if(!r)return null;if(!ze(r))return r;if(cr(t,e)){let o=ee(t,e,r);return o||de(t)}return r},"getDefaultSellingPlan"),rl=n((t,e)=>t.map(r=>{var o,i,s,a,c,p,l;return ze(r==null?void 0:r.frequency)?{...r,frequency:cr((o=e==null?void 0:e.config)==null?void 0:o.frequencies,(i=e==null?void 0:e.config)==null?void 0:i.frequenciesEveryPeriod)?ee((s=e==null?void 0:e.config)==null?void 0:s.frequencies,(a=e==null?void 0:e.config)==null?void 0:a.frequenciesEveryPeriod,r.frequency)||ee((c=e==null?void 0:e.config)==null?void 0:c.frequencies,(p=e==null?void 0:e.config)==null?void 0:p.frequenciesEveryPeriod,e.defaultFrequency)||de((l=e==null?void 0:e.config)==null?void 0:l.frequencies):r.frequency}:r}),"mapExistingOptinsFromOfferResponse"),ol=n(({autoship:t={},autoship_by_default:e={},default_frequencies:r={},in_stock:o={}},i,s)=>Object.keys(t).reduce((a,c)=>{if(!i.some(p=>p.id===c)){if(!(t[c]&&e[c]&&o[c]))return a;let{config:{frequencies:p,frequenciesEveryPeriod:l}={},defaultFrequency:f}=s,d=r[c],h;return r[c]&&cr(p,l)?h=ee(p,l,`${d.every}_${d.every_period}`)||Ys(p,l,f)||de(p):r[c]?h=`${d.every}_${d.every_period}`:h=Ys(p,l,f)||"_",a.concat({id:c,frequency:h})}return a},[]),"reduceNewOptinsFromOfferResponse"),Js=n(t=>t==null?void 0:t.selling_plan_groups.find(r=>r.name===pn),"getOGSellingPlanGroup"),nl=n((t,e)=>({...Ws(t,e.id,e.available),[e.id]:e.available}),"productOrVariantInStockReducer"),Ks=n((t,[e])=>({...t,[e]:!0}),"productTrue"),Qs=n((t,e)=>{let r=E(e.key);return{...t,[e.key]:t[r]||null}},"reduceProductCartLine"),il=n(t=>t.name.toUpperCase().includes("PREPAID"),"isPrepaidSellingPlanGroup"),sl=n((t,e)=>{if(!t||t.length===0)return[];if(!e||e.length===0)return t;let r=e.reduce((o,i)=>(il(i)||o.push(...i.selling_plans.map(s=>s.id)),o),[]);return t.filter(o=>r.includes(o.selling_plan_id))},"filterNonPrepaidSellingPlans"),al=n((t={},e)=>{if(H===e.type)return Object.entries(e.payload).reduce(Ks,t);if(le===e.type){let{payload:r}=e;return r.items.reduce(Qs,t)}if(W===e.type){let{payload:{product:r}}=e;return[r,...(r==null?void 0:r.variants)||[]].reduce((o,i)=>{let s=sl(i==null?void 0:i.selling_plan_allocations,r==null?void 0:r.selling_plan_groups);return{...Ws(o,i.id,(s==null?void 0:s.length)>0),[i.id]:(s==null?void 0:s.length)>0}},t)}return t},"autoshipEligible");function cl(t){let e=["day","week","month"].findIndex(o=>t.toLowerCase().includes(o))+1,r=(t.match(/(\d+)/)||["",1])[1];return r&&e?`${r}_${e}`:null}n(cl,"textToFreq");function Zs(t){var e;return(e=t==null?void 0:t.selling_plans)==null?void 0:e.map(({options:r})=>r||[]).flat().map(({value:r})=>cl(r))}n(Zs,"sellingPlansToEveryPeriod");function Xs(t){var e;return(e=t==null?void 0:t.selling_plans)==null?void 0:e.map(({id:r})=>`${r}`)}n(Xs,"sellingPlansToFrequencies");function ea(t){var r;let e=(r=t==null?void 0:t.options.find(({name:o})=>o==="Shipment amount"))==null?void 0:r.value.split(" ")[0];return e?Number(e):void 0}n(ea,"getPrepaidShipments");function pl(t){return t.reduce((e,r)=>{let o=r.name.split("-")[1],i=r.selling_plans.map(s=>({numberShipments:ea(s),sellingPlan:String(s.id)}));return{...e,[o]:i}},{})}n(pl,"getPrepaidSellingPlans");var ll=n((t={frequencies:[],offerType:"radio",frequenciesEveryPeriod:[]},e)=>{var r,o,i;if(H===e.type){let s=[...new Set(Object.values(e.payload).map(Object.keys).flat())];return{...t,frequencies:s}}if(W===e.type){let{payload:{product:s}}=e,a={},c=Js(s),p=Xs(c);if(p!=null&&p.length){let f=Zs(c),d=((o=(r=c.options)==null?void 0:r[0])==null?void 0:o.values)||p,h=t.defaultFrequency;h&&ze(h)&&(h=ee(p,f,h)||de(p)||h),a={frequencies:p,frequenciesEveryPeriod:f,frequenciesText:d,...h?{defaultFrequency:h}:{}}}let l=s==null?void 0:s.selling_plan_groups.filter(f=>/^Prepaid-.*/.test(f.name));return l.length&&(a={...a,prepaidSellingPlans:{...t.prepaidSellingPlans,...pl(l)}}),{...t,...a}}if(P===e.type){let{payload:{offer:s}}=e,{defaultFrequency:a,config:{frequencies:c,frequenciesEveryPeriod:p,prepaidSellingPlans:l={}}={},product:f}=s;return(i=l[f==null?void 0:f.id])!=null&&i.some(({sellingPlan:d})=>d===a)?{...t,defaultFrequency:de(c)||a}:ze(a)?{...t,defaultFrequency:ee(c,p,a)||de(c)||a}:{...t,defaultFrequency:a}}return t},"config"),ul=n((t={},e)=>{var r;if(H===e.type)return Object.entries(e.payload).reduce(Ks,t);if(le===e.type)return e.payload.items.reduce(Qs,t);if(W===e.type){let{payload:{product:o}}=e;return[o,...(r=o==null?void 0:o.variants)!=null?r:[]].reduce(nl,t)||t}return Y===e.type&&e.payload.product===null?{...t}:t},"inStock"),dl=n((t={},e)=>t,"offer");function fl({prepaidShipments:t,offer:e,product:r}){var o;if(t){let i=E(r.id),s=(o=e.config.prepaidSellingPlans[i])==null?void 0:o.find(a=>a.numberShipments===t);return s?s.sellingPlan:null}return e.config.frequencies[0]}n(fl,"getFrequencyForPrepaidShipments");function hl(t){let e=ea(t.selling_plan_allocation.selling_plan),r={id:t.key,frequency:`${t.selling_plan_allocation.selling_plan.id}`};return e&&(r.prepaidShipments=e),r}n(hl,"getOptedInItem");var ml=n((t=[],e)=>{if(le===e.type){let r=e.payload;return t.filter(o=>!o.id.includes(":")).concat(r.items.reduce((o,i)=>i.selling_plan_allocation?[...o,hl(i)]:o,[]))}if(P===e.type){let{offer:r={},...o}=e.payload,i=rl(t,r),s=ol(o,i,r);return[...i,...s]}if(W===e.type){let{product:r}=e.payload,o=Js(r);if(!o)return t;let i=Xs(o),s=Zs(o);return t.map(a=>ze(a.frequency)?{...a,frequency:ee(i,s,a.frequency)||de(i)}:a)}if(ie===e.type){let{payload:r}=e,o=jr(t,e),[i,s]=Ye(o,r.product);return s.concat({...i,...r.product,frequency:fl(r)})}return jr(t,e)},"optedin"),gl=n((t={},e)=>t,"productOffer"),yl=n((t={},e)=>{var r;if(W===e.type){let{payload:{product:o,currency:i}}=e,s=zs(o);return[o,...(r=o==null?void 0:o.variants)!=null?r:[]].reduce((a,c)=>{var p;return{...a,[c.id]:(p=c.selling_plan_allocations)==null?void 0:p.reduce((l,f)=>ln(l,f,s,i),[])}},t)||t}if(le===e.type){let o=e.payload;return o.items.reduce((i,s)=>s.selling_plan_allocation?{...i,[s.key]:ln([],s.selling_plan_allocation,[],o.currency)}:i,t)||t}return H===e.type?Je(e.payload):t},"productPlans"),bl=Ut({auth:Yo,authUrl:Jo,autoshipByDefault:on,autoshipEligible:al,config:ll,defaultFrequencies:nn,eligibilityGroups:Bo,environment:Ft,firstOrderPlaceDate:Zo,incentives:zo,inStock:ul,locale:en,merchantId:Wo,nextUpcomingOrder:Go,offer:dl,offerId:Ko,optedin:ml,optedout:Ho,previewStandardOffer:tn,previewUpsellOffer:rn,productOffer:gl,productPlans:yl,productToSubscribe:Xo,sessionId:Qo,templates:sn,prepaidShipmentsSelected:an});function un(t,e){return window.og&&window.og.previewMode?Vr(t,e):bl(t,e)}n(un,"shopifyReducer");var na=ce(yt()),ia=ce(Mt());function ta(t,e,r){let o=`[name="id"][value="${t}"]`,i=`form[action="/cart/add"] option[value="${t}"]`;if(!e)return;let s=document.querySelectorAll(o);s.length||(s=document.querySelectorAll(i)),[...s].forEach(a=>{let c=a.form,p=c==null?void 0:c.querySelector(`[name="${e}"]`);p||(p=document.createElement("input"),p.type="hidden",p.name=`attributes[${e}]`,c==null||c.appendChild(p)),p.value=r})}n(ta,"updateTrackingInputs");function dn(){return`og__${Math.ceil(new Date().getTime()/1e3)}`}n(dn,"getTrackingKey");function _l(t,e){var f,d,h,O;if(!((f=t.payload.offer)==null?void 0:f.autoshipByDefault))return;let o=(d=t.payload.offer)==null?void 0:d.product.id,i=dn(),s=((h=t.payload.offer)==null?void 0:h.location)||"",a=((O=t.payload.offer)==null?void 0:O.variationId)||"",c=Yr(o,e),l=[o,A.toLowerCase(),s,c,a].join(",");ta(o,i,l)}n(_l,"addDefaultToSubTracking");function fn(t){return e=>r=>{switch(e(r),r.type){case A:case I:case k:{let o=r.payload.offer,i=hn(r);o&&!o.isCart&&ta(o.product.id,i[0],i[1]);break}case P:_l(r,t);break;default:}}}n(fn,"shopifyTrackingMiddleware");var ra,oa,mn=((oa=(ra=window.Shopify)==null?void 0:ra.routes)==null?void 0:oa.root)||"/",Sl="/cart",El=`${mn}cart.js`,xl=`${mn}cart/change.js`,vl=`${mn}products/`,Ol='[id^="shopify-section-"][id$=__cart-items], [id^="shopify-section-"][id$="__cart-footer"],#cart-live-region-text,#cart-icon-bubble',Pl=n(t=>(0,ia.debounce)(100,!1,function(e){let{id:r}=Object.fromEntries([...new FormData(e).entries()]);r?t.setAttribute("product",r):t.removeAttribute("product")}),"makeSyncProductId");async function Tl(t,e){let r=wl(e);if(r)try{let[i,s]=await Promise.all([sa(r),gn()]),a={product:i,offer:e,currency:s.currency};t.dispatch({type:W,payload:a})}catch(i){console.warn("OG: Unable to fetch product details for PDP",i)}let o=e.closest("form");if(!o){let i=e.parentElement;for(;i&&(o=i.querySelector('form[action$="/cart/add"]'),!(o||i.tagName.toLowerCase()==="body"));)i=i.parentElement}if(o){let i=Pl(e);o.addEventListener("change",()=>i(o)),new MutationObserver(()=>i(o)).observe(o,{subtree:!0,childList:!0})}else console.info("no /cart/add form found for og-offer",e)}n(Tl,"setupPdp");async function gn(){return(await fetch(El)).json()}n(gn,"getCart");function wl(t){return[()=>t==null?void 0:t.dataset.shopifyProductHandle,()=>{var e,r;return(((r=(e=document.querySelector('[href$=".oembed"]'))==null?void 0:e.getAttribute("href"))==null?void 0:r.match(/\/([^/]+)\.oembed$/))||[])[1]},()=>{var e,r;return(document.querySelector('meta[property="og:type"][content="product"]')&&((r=(e=document.querySelector('meta[property="og:url"][content]'))==null?void 0:e.getAttribute("content"))==null?void 0:r.match(/\/([^/]+)$/))||[])[1]},()=>{var e;return(e=[...document.querySelectorAll("[type$=json]")].map(r=>JSON.parse(r.textContent||"{}")).find(r=>r.handle&&r.price))==null?void 0:e.handle}].reduce((e,r)=>e||r(),"")}n(wl,"guessProductHandle");var sa=(0,na.default)(async function(t){return(await fetch(`${vl}${t}.js`)).json()});async function Cl(t,e){let r=await gn(),{items:o}=r,i=r;t.dispatch({type:le,payload:i});let s=Number(e.product.id);s<=o.length&&e.setAttribute("product",o[s-1].key),(await Promise.all(Array.from(new Set(o.map(({handle:c})=>c))).map(sa))).forEach(c=>{let p={product:c,offer:e,currency:r.currency};t.dispatch({type:W,payload:p})})}n(Cl,"setupCart");async function Rl(t,e){var s,a;let r=t.payload.offer,o=t.payload.frequency||Yr(t.payload.product.id,e),i=hn(t);if(!!(r!=null&&r.isCart))try{r.style.pointerEvents="none",r.style.opacity=".7";let c=Array.from(document.querySelectorAll(Ol)),p=t.payload.product.id,l=await gn(),f=(s=l==null?void 0:l.items)==null?void 0:s.findIndex(R=>R.key===p),d=l.items[f],h=d.quantity,O=E(p),_=await fetch(xl,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:p,quantity:h,attributes:Object.fromEntries([i]),properties:d.properties,selling_plan:o||null,sections:c.map(R=>R.id.replace(/^shopify-section-/,""))})});if(_.status!==200)throw new Error("Cart not updated");let m=await _.json(),S=l.items.length===m.items.length?m.items[f].key:(a=m.items.find(R=>R.quantity===h&&R.product_id===O&&(!o&&!R.selling_plan_allocation||(R==null?void 0:R.selling_plan_allocation.selling_plan.id)===o)))==null?void 0:a.key;S&&(e.dispatch({type:dt,payload:{oldCartProductKey:p,newCartProductKey:S}}),r.setAttribute("product",S));let T=m;e.dispatch({type:le,payload:T});let b=new CustomEvent($n,{bubbles:!0,cancelable:!0});if(r.dispatchEvent(b),b.defaultPrevented)return;let w=m.sections;Object.values(w).length?c.forEach(R=>{let bn=R.id.replace(/^shopify-section-/,"");if(!(bn in w))return;let da=w[bn],_n=new DOMParser().parseFromString(da.toString()||"","text/html").getElementById(R.id);_n&&(R.innerHTML=_n.innerHTML)}):window.location.pathname.startsWith(Sl)&&window.location.reload()}catch(c){console.log("OG Error updating cart",c)}finally{r.style.pointerEvents="auto",r.style.opacity="1"}}n(Rl,"synchronizeCartOptin");function hn(t){var a,c;let e=t.payload.product.id;if(!e)return[];let r=dn(),o=((a=t.payload.offer)==null?void 0:a.location)||"",i=((c=t.payload.offer)==null?void 0:c.variationId)||"",s=[e,t.type.toLowerCase(),o];switch(t.type){case Y:case I:s.push(""),s.push(i);break;case A:case k:s.push(t.payload.frequency),s.push(i);break;default:return[]}return[r,s.join(",")]}n(hn,"getTrackingEvent");function Yr(t,e){var i;return(i=ir({id:t})(e.getState()))==null?void 0:i.frequency}n(Yr,"getSubscribedFrequency");function Al(t,e){e.isCart||[...document.querySelectorAll('form[action$="/cart/add"] [name=id]')].forEach(r=>{let o=r.value,i=Yr(o,t);ni(r.form,"selling_plan",i)})}n(Al,"synchronizeSellingPlan");function yn(t){return e=>r=>{var o;switch(r.type){case A:case I:case k:break;case Y:(o=r.payload.offer)!=null&&o.isCart?Cl(t,r.payload.offer):Tl(t,r.payload.offer);break;default:}switch(e(r),r.type){case A:case I:case k:case ie:Rl(r,t);case Y:case P:case W:Al(t,r.payload.offer);break;default:}}}n(yn,"shopifyMiddleware");var Nl="/apps/subscriptions/auth/",aa="og_auth_begin",Il="og_auth_end",kl=n(t=>{let[e,r,o,i]=atob(t).split("|");return{id:e,signature:o,timestamp:r,email:i}},"parseIntegrationTempAuth");async function ca({store:t}){var i;let[e]=co(),r=xt(),o=r!=null&&r.dataset.customer?kl(r.dataset.customer):(i=window.ogShopifyConfig)==null?void 0:i.customer;if(o){let s=await Dl(o);if(s){let[a,c,p]=s.split("|");t.dispatch(Ot(e,a,Number(c),p))}}else ri("og_auth")}n(ca,"authorizeShopifyCustomer");async function ql(t){try{let r=await(await fetch(`${Nl}?customer=${t.id}&customer_signature=${t.signature}&customer_timestamp=${t.timestamp}`)).text(),o=r.lastIndexOf(aa);if(o<0)throw"Invalid response from OG auth endpoint";return JSON.parse(r.substring(o+aa.length,r.lastIndexOf(Il)))}catch(e){console.error(e)}}n(ql,"fetchOGSignature");async function Dl(t){let e=oi("og_auth");if(e)return e;let{customerId:r,timestamp:o,signature:i}=await ql(t);if(!r)return"";let s=new Date,a=btoa(i);s.setTime(s.getTime()+2*60*60*1e3);let c=`${r}|${o}|${a};expires=${s.toUTCString()}`;return document.cookie=`og_auth=${c};secure;path=/`,c}n(Dl,"getOrCreateAuthCookie");var pa,ua=Ii(...(pa=q)!=null&&pa.shopify_selling_plans?[un,yn]:[Vr],q.shopify&&fn),v=cn(ua),Fl=v.isReady,Ul=v.addOptinChangedCallback,Ll=v.addTemplate,Ml=v.clear,$l=v.config,jl=v.disableOptinChangedCallbacks,Vl=v.getOptins,Hl=v.getProductsForPurchasePost,Gl=v.initialize,Bl=v.previewMode,zl=v.register,Yl=v.resolveSettings,Wl=v.setAuthUrl,Jl=v.setEnvironment,Kl=v.setLocale,Ql=v.setMerchantId,Zl=v.setPublicPath,Xl=v.setTemplates,eu=v.setupCart,tu=v.setupProduct,ru=v.setupProducts,ou=n(()=>ti(v),"autoInit");var nu=v.initialize,la;(la=q)!=null&&la.shopify_selling_plans&&ar(()=>ca(v));return ba(iu);})();
1051
+ `}};n(Hr,"Price");var Wp=n((t,e)=>{var r;return{productPlans:t.productPlans,configDefaultFrequency:(r=t.config)==null?void 0:r.defaultFrequency,frequency:Z(e.product)(t)}},"mapStateToProps"),Gs=g(Wp)(Hr);function cn(t){Vs(),Fi(t);try{customElements.define("og-when",ms),customElements.define("og-text",Ps),customElements.define("og-incentive-text",Rs),customElements.define("og-offer",Fs),customElements.define("og-select-frequency",As),customElements.define("og-optout-button",_s),customElements.define("og-optin-toggle",Os),customElements.define("og-optin-status",ys),customElements.define("og-optin-button",bs),customElements.define("og-optin-select",Es),customElements.define("og-upsell-button",xs),customElements.define("og-frequency-status",Ss),customElements.define("og-modal",It),customElements.define("og-select",kt),customElements.define("og-tooltip",qt),customElements.define("og-upsell-modal",vs),customElements.define("og-next-upcoming-order",Is),customElements.define("og-price",Gs),customElements.define("og-prepaid-toggle",Us),customElements.define("og-prepaid-data",Ls),customElements.define("og-prepaid-button",Ms),customElements.define("og-prepaid-select",$s),customElements.define("og-subscription-button",js)}catch{console.info("OG WebComponents already registered, skipping.")}let e=!1,r={store:t,isReady:()=>e,setEnvironment(o){return t.dispatch(mo(o)),this},setMerchantId(o){return t.dispatch(ai(o)),this},setAuthUrl(o){return t.dispatch(ci(o)),this},getProductsForPurchasePost(o=[]){return _o(t.getState(),o)},getOptins(o=[]){return _o(t.getState(),o)},clear(){t.dispatch(di())},addOptinChangedCallback(o){typeof o=="function"&&document.addEventListener("optin-changed",i=>o(i.detail))},disableOptinChangedCallbacks(){document.addEventListener("optin-changed",o=>o.stopPropagation(),!0)},register(){},previewMode(o){return window.og=window.og||{},o===!1?delete window.og:window.og.previewMode=!0,this},config(o){return t.dispatch(mi(o)),this},setLocale(o){return t.dispatch(hi(o)),this},addTemplate(o,i,s){return t.dispatch(gi(o,i,s)),this},setTemplates(o){return t.dispatch(yi(o)),this},setPublicPath(o){return this},resolveSettings(o,i,s,a=t){if(o&&i&&s){let c=[];s.product?c.push(s.product):s.cart&&Array.isArray(s.cart.products)&&(c=c.concat(s.cart.products));let{apiUrl:p}=Ft({},mo(i)),{sessionId:l}=a.getState();l&&c.forEach(f=>{let d=E(f);ue.fetchOffer(p,o,l,`${d}`,xe)}),s.product_discounts&&typeof s.product_discounts=="object"&&a.dispatch({type:H,payload:s.product_discounts})}},initialize(o,i,s){var c;e?console.warn("og.offers has been initialized already. Skipping."):r.resolveSettings(o,i,window.og_settings,t);let a=t.getState();return o&&o!==a.merchantId&&r.setMerchantId(o),i&&i!==((c=a.environment)==null?void 0:c.name)&&r.setEnvironment(i),s&&r.setAuthUrl(s),e=!0,this}};return window.OG=window.OG||{},Object.assign(window.OG,r),Object.assign(r.initialize,r),bo(window.opener,r),r}n(cn,"makeApi");var ae=n((t,e)=>t===null?"":new Intl.NumberFormat(void 0,{style:"currency",currency:e}).format(t/100),"money"),Gr=n(t=>`${t}%`,"percentage");var Br=n(t=>{var e,r;return Array.isArray((e=t.selling_plan)==null?void 0:e.options)&&((r=t.selling_plan)==null?void 0:r.options.some(o=>(o==null?void 0:o.name)==="Shipment amount"))},"isPrepaidAllocation"),zr=n(t=>{if(t&&t.length>1){let e=t.find(r=>(r==null?void 0:r.name)==="Shipment amount").value.split(" ");return e.length>0?+e[0]:null}return null},"getPrepaidShipmentsNumberFromOptions"),Jp=n(t=>{var e,r;return(t.selling_plan_id||((r=(e=t.selling_plan)==null?void 0:e.id)!=null?r:"")).toString()},"getAllocationFrequency"),Kp=n((t,e)=>ae(t.compare_at_price,e),"getAllocationRegularPrice"),Qp=n((t,e)=>{var r;if(Br(t)){let o=zr((r=t.selling_plan)==null?void 0:r.options),i=Math.round(t.price/o);return ae(i,e)}return ae(t.price,e)},"getAllocationSubscriptionPrice"),Bs=n((t,e)=>Math.round((t.compare_at_price-e)*100/t.compare_at_price),"getPrepaidPercentage"),Zp=n((t,e)=>{var o,i,s;if(Br(t)){let a=zr((o=t.selling_plan)==null?void 0:o.options),c=t.price/a,p=Bs(t,c);return Gr(p)}let r="";return((i=t.price_adjustments[0])==null?void 0:i.value_type)==="percentage"?r=Gr(t.price_adjustments[0].value):(s=t.price_adjustments[0])!=null&&s.value?r=ae(t.price_adjustments[0].value,e):t.compare_at_price&&(r=ae(t.compare_at_price-t.price,e)),r},"getAllocationDiscountRate"),Xp=n(t=>{var e;return Br(t)?zr((e=t.selling_plan)==null?void 0:e.options):null},"getAllocationNumberOfShipments"),el=n((t,e,r,o)=>{var f,d;let i=zr((f=t.selling_plan)==null?void 0:f.options),s=t.price/i,a=t.compare_at_price-s,c=Bs(t,s),p=(d=r==null?void 0:r.price_adjustments)==null?void 0:d[0],l=p&&p.value_type==="percentage"?p.value:null;return e.regularPrepaidPrice=ae(t.price,o),e.prepaidSavingsPerShipment=ae(Math.round(a),o),e.prepaidSavingsTotal=ae(Math.round(a*i),o),l&&c&&(e.prepaidExtraSavingsPercentage=Gr(c-l)),e},"addPrepaidPriceAndSavings"),pn="Subscribe and Save",tl=n((t,e,r)=>{t.selling_plan||(t.selling_plan=e.find(i=>i.id===t.selling_plan_id));let o={frequency:Jp(t),regularPrice:Kp(t,r),subscriptionPrice:Qp(t,r),discountRate:Zp(t,r),prepaidShipments:Xp(t)};if(Br(t)){let i=e.find(s=>s.group_name===pn&&s.options.length===1);return el(t,o,i,r)}return o},"mapSellingPlanToDiscount"),ln=n((t,e,r=[],o)=>[...t,tl(e,r,o)],"sellingPlanAllocationsReducer"),zs=n(t=>t.selling_plan_groups.reduce((e,r)=>[...e,...r.selling_plans.map(o=>({...o,group_name:r.name}))],[]),"getSellingPlans");var Ws=n((t,e,r)=>{let o=Object.keys(t).filter(i=>i.startsWith(e.toString()));return o.length?{...t,...o.reduce((i,s)=>({...i,[s]:r}),{})}:t},"overrideLineKey"),Ys=n((t,e,r)=>{if(!r)return null;if(!ze(r))return r;if(cr(t,e)){let o=ee(t,e,r);return o||de(t)}return r},"getDefaultSellingPlan"),rl=n((t,e)=>t.map(r=>{var o,i,s,a,c,p,l;return ze(r==null?void 0:r.frequency)?{...r,frequency:cr((o=e==null?void 0:e.config)==null?void 0:o.frequencies,(i=e==null?void 0:e.config)==null?void 0:i.frequenciesEveryPeriod)?ee((s=e==null?void 0:e.config)==null?void 0:s.frequencies,(a=e==null?void 0:e.config)==null?void 0:a.frequenciesEveryPeriod,r.frequency)||ee((c=e==null?void 0:e.config)==null?void 0:c.frequencies,(p=e==null?void 0:e.config)==null?void 0:p.frequenciesEveryPeriod,e.defaultFrequency)||de((l=e==null?void 0:e.config)==null?void 0:l.frequencies):r.frequency}:r}),"mapExistingOptinsFromOfferResponse"),ol=n(({autoship:t={},autoship_by_default:e={},default_frequencies:r={},in_stock:o={}},i,s)=>Object.keys(t).reduce((a,c)=>{if(!i.some(p=>p.id===c)){if(!(t[c]&&e[c]&&o[c]))return a;let{config:{frequencies:p,frequenciesEveryPeriod:l}={},defaultFrequency:f}=s,d=r[c],h;return r[c]&&cr(p,l)?h=ee(p,l,`${d.every}_${d.every_period}`)||Ys(p,l,f)||de(p):r[c]?h=`${d.every}_${d.every_period}`:h=Ys(p,l,f)||"_",a.concat({id:c,frequency:h})}return a},[]),"reduceNewOptinsFromOfferResponse"),Js=n(t=>t==null?void 0:t.selling_plan_groups.find(r=>r.name===pn),"getOGSellingPlanGroup"),nl=n((t,e)=>({...Ws(t,e.id,e.available),[e.id]:e.available}),"productOrVariantInStockReducer"),Ks=n((t,[e])=>({...t,[e]:!0}),"productTrue"),Qs=n((t,e)=>{let r=E(e.key);return{...t,[e.key]:t[r]||null}},"reduceProductCartLine"),il=n(t=>t.name.toUpperCase().includes("PREPAID"),"isPrepaidSellingPlanGroup"),sl=n((t,e)=>{if(!t||t.length===0)return[];if(!e||e.length===0)return t;let r=e.reduce((o,i)=>(il(i)||o.push(...i.selling_plans.map(s=>s.id)),o),[]);return t.filter(o=>r.includes(o.selling_plan_id))},"filterNonPrepaidSellingPlans"),al=n((t={},e)=>{if(H===e.type)return Object.entries(e.payload).reduce(Ks,t);if(le===e.type){let{payload:r}=e;return r.items.reduce(Qs,t)}if(W===e.type){let{payload:{product:r}}=e;return[r,...(r==null?void 0:r.variants)||[]].reduce((o,i)=>{let s=sl(i==null?void 0:i.selling_plan_allocations,r==null?void 0:r.selling_plan_groups);return{...Ws(o,i.id,(s==null?void 0:s.length)>0),[i.id]:(s==null?void 0:s.length)>0}},t)}return t},"autoshipEligible");function cl(t){let e=["day","week","month"].findIndex(o=>t.toLowerCase().includes(o))+1,r=(t.match(/(\d+)/)||["",1])[1];return r&&e?`${r}_${e}`:null}n(cl,"textToFreq");function Zs(t){var e;return(e=t==null?void 0:t.selling_plans)==null?void 0:e.map(({options:r})=>r||[]).flat().map(({value:r})=>cl(r))}n(Zs,"sellingPlansToEveryPeriod");function Xs(t){var e;return(e=t==null?void 0:t.selling_plans)==null?void 0:e.map(({id:r})=>`${r}`)}n(Xs,"sellingPlansToFrequencies");function ea(t){var r;let e=(r=t==null?void 0:t.options.find(({name:o})=>o==="Shipment amount"))==null?void 0:r.value.split(" ")[0];return e?Number(e):void 0}n(ea,"getPrepaidShipments");function pl(t){return t.reduce((e,r)=>{let o=r.name.split("-")[1],i=r.selling_plans.map(s=>({numberShipments:ea(s),sellingPlan:String(s.id)}));return{...e,[o]:i}},{})}n(pl,"getPrepaidSellingPlans");var ll=n((t={frequencies:[],offerType:"radio",frequenciesEveryPeriod:[]},e)=>{var r,o,i;if(H===e.type){let s=[...new Set(Object.values(e.payload).map(Object.keys).flat())];return{...t,frequencies:s}}if(W===e.type){let{payload:{product:s}}=e,a={},c=Js(s),p=Xs(c);if(p!=null&&p.length){let f=Zs(c),d=((o=(r=c.options)==null?void 0:r[0])==null?void 0:o.values)||p,h=t.defaultFrequency;h&&ze(h)&&(h=ee(p,f,h)||de(p)||h),a={frequencies:p,frequenciesEveryPeriod:f,frequenciesText:d,...h?{defaultFrequency:h}:{}}}let l=s==null?void 0:s.selling_plan_groups.filter(f=>/^Prepaid-.*/.test(f.name));return l.length&&(a={...a,prepaidSellingPlans:{...t.prepaidSellingPlans,...pl(l)}}),{...t,...a}}if(P===e.type){let{payload:{offer:s}}=e,{defaultFrequency:a,config:{frequencies:c,frequenciesEveryPeriod:p,prepaidSellingPlans:l={}}={},product:f}=s;return(i=l[f==null?void 0:f.id])!=null&&i.some(({sellingPlan:d})=>d===a)?{...t,defaultFrequency:de(c)||a}:ze(a)?{...t,defaultFrequency:ee(c,p,a)||de(c)||a}:{...t,defaultFrequency:a}}return t},"config"),ul=n((t={},e)=>{var r;if(H===e.type)return Object.entries(e.payload).reduce(Ks,t);if(le===e.type)return e.payload.items.reduce(Qs,t);if(W===e.type){let{payload:{product:o}}=e;return[o,...(r=o==null?void 0:o.variants)!=null?r:[]].reduce(nl,t)||t}return Y===e.type&&e.payload.product===null?{...t}:t},"inStock"),dl=n((t={},e)=>t,"offer");function fl({prepaidShipments:t,offer:e,product:r}){var o;if(t){let i=E(r.id),s=(o=e.config.prepaidSellingPlans[i])==null?void 0:o.find(a=>a.numberShipments===t);return s?s.sellingPlan:null}return e.config.frequencies[0]}n(fl,"getFrequencyForPrepaidShipments");function hl(t){let e=ea(t.selling_plan_allocation.selling_plan),r={id:t.key,frequency:`${t.selling_plan_allocation.selling_plan.id}`};return e&&(r.prepaidShipments=e),r}n(hl,"getOptedInItem");var ml=n((t=[],e)=>{if(le===e.type){let r=e.payload;return t.filter(o=>!o.id.includes(":")).concat(r.items.reduce((o,i)=>i.selling_plan_allocation?[...o,hl(i)]:o,[]))}if(P===e.type){let{offer:r={},...o}=e.payload,i=rl(t,r),s=ol(o,i,r);return[...i,...s]}if(W===e.type){let{product:r}=e.payload,o=Js(r);if(!o)return t;let i=Xs(o),s=Zs(o);return t.map(a=>ze(a.frequency)?{...a,frequency:ee(i,s,a.frequency)||de(i)}:a)}if(ie===e.type){let{payload:r}=e,o=jr(t,e),[i,s]=Ye(o,r.product);return s.concat({...i,...r.product,frequency:fl(r)})}return jr(t,e)},"optedin"),gl=n((t={},e)=>t,"productOffer"),yl=n((t={},e)=>{var r;if(W===e.type){let{payload:{product:o,currency:i}}=e,s=zs(o);return[o,...(r=o==null?void 0:o.variants)!=null?r:[]].reduce((a,c)=>{var p;return{...a,[c.id]:(p=c.selling_plan_allocations)==null?void 0:p.reduce((l,f)=>ln(l,f,s,i),[])}},t)||t}if(le===e.type){let o=e.payload;return o.items.reduce((i,s)=>s.selling_plan_allocation?{...i,[s.key]:ln([],s.selling_plan_allocation,[],o.currency)}:i,t)||t}return H===e.type?Je(e.payload):t},"productPlans"),bl=Ut({auth:Yo,authUrl:Jo,autoshipByDefault:on,autoshipEligible:al,config:ll,defaultFrequencies:nn,eligibilityGroups:Bo,environment:Ft,firstOrderPlaceDate:Zo,incentives:zo,inStock:ul,locale:en,merchantId:Wo,nextUpcomingOrder:Go,offer:dl,offerId:Ko,optedin:ml,optedout:Ho,previewStandardOffer:tn,previewUpsellOffer:rn,productOffer:gl,productPlans:yl,productToSubscribe:Xo,sessionId:Qo,templates:sn,prepaidShipmentsSelected:an});function un(t,e){return window.og&&window.og.previewMode?Vr(t,e):bl(t,e)}n(un,"shopifyReducer");var na=ce(yt()),ia=ce(Mt());function ta(t,e,r){let o=`[name="id"][value="${t}"]`,i=`form[action="/cart/add"] option[value="${t}"]`;if(!e)return;let s=document.querySelectorAll(o);s.length||(s=document.querySelectorAll(i)),[...s].forEach(a=>{let c=a.form,p=c==null?void 0:c.querySelector(`[name="${e}"]`);p||(p=document.createElement("input"),p.type="hidden",p.name=`attributes[${e}]`,c==null||c.appendChild(p)),p.value=r})}n(ta,"updateTrackingInputs");function dn(){return`og__${Math.ceil(new Date().getTime()/1e3)}`}n(dn,"getTrackingKey");function _l(t,e){var f,d,h,O;if(!((f=t.payload.offer)==null?void 0:f.autoshipByDefault))return;let o=(d=t.payload.offer)==null?void 0:d.product.id,i=dn(),s=((h=t.payload.offer)==null?void 0:h.location)||"",a=((O=t.payload.offer)==null?void 0:O.variationId)||"",c=Yr(o,e),l=[o,A.toLowerCase(),s,c,a].join(",");ta(o,i,l)}n(_l,"addDefaultToSubTracking");function fn(t){return e=>r=>{switch(e(r),r.type){case A:case I:case k:{let o=r.payload.offer,i=hn(r);o&&!o.isCart&&ta(o.product.id,i[0],i[1]);break}case P:_l(r,t);break;default:}}}n(fn,"shopifyTrackingMiddleware");var ra,oa,mn=((oa=(ra=window.Shopify)==null?void 0:ra.routes)==null?void 0:oa.root)||"/",Sl="/cart",El=`${mn}cart.js`,xl=`${mn}cart/change.js`,vl=`${mn}products/`,Ol='[id^="shopify-section-"][id$=__cart-items], [id^="shopify-section-"][id$="__cart-footer"],#cart-live-region-text,#cart-icon-bubble',Pl=n(t=>(0,ia.debounce)(100,!1,function(e){let{id:r}=Object.fromEntries([...new FormData(e).entries()]);r?t.setAttribute("product",r):t.removeAttribute("product")}),"makeSyncProductId");async function Tl(){var r,o;let t=(o=(r=window.Shopify)==null?void 0:r.currency)==null?void 0:o.active;return t||(await gn()).currency}n(Tl,"getCurrency");async function wl(t,e){let r=Cl(e);if(r)try{let[i,s]=await Promise.all([sa(r),Tl()]),a={product:i,offer:e,currency:s};t.dispatch({type:W,payload:a})}catch(i){console.warn("OG: Unable to fetch product details for PDP",i)}let o=e.closest("form");if(!o){let i=e.parentElement;for(;i&&(o=i.querySelector('form[action$="/cart/add"]'),!(o||i.tagName.toLowerCase()==="body"));)i=i.parentElement}if(o){let i=Pl(e);o.addEventListener("change",()=>i(o)),new MutationObserver(()=>i(o)).observe(o,{subtree:!0,childList:!0})}else console.info("no /cart/add form found for og-offer",e)}n(wl,"setupPdp");async function gn(){return(await fetch(El)).json()}n(gn,"getCart");function Cl(t){return[()=>t==null?void 0:t.dataset.shopifyProductHandle,()=>{var e,r;return(((r=(e=document.querySelector('[href$=".oembed"]'))==null?void 0:e.getAttribute("href"))==null?void 0:r.match(/\/([^/]+)\.oembed$/))||[])[1]},()=>{var e,r;return(document.querySelector('meta[property="og:type"][content="product"]')&&((r=(e=document.querySelector('meta[property="og:url"][content]'))==null?void 0:e.getAttribute("content"))==null?void 0:r.match(/\/([^/]+)$/))||[])[1]},()=>{var e;return(e=[...document.querySelectorAll("[type$=json]")].map(r=>JSON.parse(r.textContent||"{}")).find(r=>r.handle&&r.price))==null?void 0:e.handle}].reduce((e,r)=>e||r(),"")}n(Cl,"guessProductHandle");var sa=(0,na.default)(async function(t){return(await fetch(`${vl}${t}.js`)).json()});async function Rl(t,e){let r=await gn(),{items:o}=r,i=r;t.dispatch({type:le,payload:i});let s=Number(e.product.id);s<=o.length&&e.setAttribute("product",o[s-1].key),(await Promise.all(Array.from(new Set(o.map(({handle:c})=>c))).map(sa))).forEach(c=>{let p={product:c,offer:e,currency:r.currency};t.dispatch({type:W,payload:p})})}n(Rl,"setupCart");async function Al(t,e){var s,a;let r=t.payload.offer,o=t.payload.frequency||Yr(t.payload.product.id,e),i=hn(t);if(!!(r!=null&&r.isCart))try{r.style.pointerEvents="none",r.style.opacity=".7";let c=Array.from(document.querySelectorAll(Ol)),p=t.payload.product.id,l=await gn(),f=(s=l==null?void 0:l.items)==null?void 0:s.findIndex(R=>R.key===p),d=l.items[f],h=d.quantity,O=E(p),_=await fetch(xl,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:p,quantity:h,attributes:Object.fromEntries([i]),properties:d.properties,selling_plan:o||null,sections:c.map(R=>R.id.replace(/^shopify-section-/,""))})});if(_.status!==200)throw new Error("Cart not updated");let m=await _.json(),S=l.items.length===m.items.length?m.items[f].key:(a=m.items.find(R=>R.quantity===h&&R.product_id===O&&(!o&&!R.selling_plan_allocation||(R==null?void 0:R.selling_plan_allocation.selling_plan.id)===o)))==null?void 0:a.key;S&&(e.dispatch({type:dt,payload:{oldCartProductKey:p,newCartProductKey:S}}),r.setAttribute("product",S));let T=m;e.dispatch({type:le,payload:T});let b=new CustomEvent($n,{bubbles:!0,cancelable:!0});if(r.dispatchEvent(b),b.defaultPrevented)return;let w=m.sections;Object.values(w).length?c.forEach(R=>{let bn=R.id.replace(/^shopify-section-/,"");if(!(bn in w))return;let da=w[bn],_n=new DOMParser().parseFromString(da.toString()||"","text/html").getElementById(R.id);_n&&(R.innerHTML=_n.innerHTML)}):window.location.pathname.startsWith(Sl)&&window.location.reload()}catch(c){console.log("OG Error updating cart",c)}finally{r.style.pointerEvents="auto",r.style.opacity="1"}}n(Al,"synchronizeCartOptin");function hn(t){var a,c;let e=t.payload.product.id;if(!e)return[];let r=dn(),o=((a=t.payload.offer)==null?void 0:a.location)||"",i=((c=t.payload.offer)==null?void 0:c.variationId)||"",s=[e,t.type.toLowerCase(),o];switch(t.type){case Y:case I:s.push(""),s.push(i);break;case A:case k:s.push(t.payload.frequency),s.push(i);break;default:return[]}return[r,s.join(",")]}n(hn,"getTrackingEvent");function Yr(t,e){var i;return(i=ir({id:t})(e.getState()))==null?void 0:i.frequency}n(Yr,"getSubscribedFrequency");function Nl(t,e){e.isCart||[...document.querySelectorAll('form[action$="/cart/add"] [name=id]')].forEach(r=>{let o=r.value,i=Yr(o,t);ni(r.form,"selling_plan",i)})}n(Nl,"synchronizeSellingPlan");function yn(t){return e=>r=>{var o;switch(r.type){case A:case I:case k:break;case Y:(o=r.payload.offer)!=null&&o.isCart?Rl(t,r.payload.offer):wl(t,r.payload.offer);break;default:}switch(e(r),r.type){case A:case I:case k:case ie:Al(r,t);case Y:case P:case W:Nl(t,r.payload.offer);break;default:}}}n(yn,"shopifyMiddleware");var Il="/apps/subscriptions/auth/",aa="og_auth_begin",kl="og_auth_end",ql=n(t=>{let[e,r,o,i]=atob(t).split("|");return{id:e,signature:o,timestamp:r,email:i}},"parseIntegrationTempAuth");async function ca({store:t}){var i;let[e]=co(),r=xt(),o=r!=null&&r.dataset.customer?ql(r.dataset.customer):(i=window.ogShopifyConfig)==null?void 0:i.customer;if(o){let s=await Fl(o);if(s){let[a,c,p]=s.split("|");t.dispatch(Ot(e,a,Number(c),p))}}else ri("og_auth")}n(ca,"authorizeShopifyCustomer");async function Dl(t){try{let r=await(await fetch(`${Il}?customer=${t.id}&customer_signature=${t.signature}&customer_timestamp=${t.timestamp}`)).text(),o=r.lastIndexOf(aa);if(o<0)throw"Invalid response from OG auth endpoint";return JSON.parse(r.substring(o+aa.length,r.lastIndexOf(kl)))}catch(e){console.error(e)}}n(Dl,"fetchOGSignature");async function Fl(t){let e=oi("og_auth");if(e)return e;let{customerId:r,timestamp:o,signature:i}=await Dl(t);if(!r)return"";let s=new Date,a=btoa(i);s.setTime(s.getTime()+2*60*60*1e3);let c=`${r}|${o}|${a};expires=${s.toUTCString()}`;return document.cookie=`og_auth=${c};secure;path=/`,c}n(Fl,"getOrCreateAuthCookie");var pa,ua=Ii(...(pa=q)!=null&&pa.shopify_selling_plans?[un,yn]:[Vr],q.shopify&&fn),v=cn(ua),Ul=v.isReady,Ll=v.addOptinChangedCallback,Ml=v.addTemplate,$l=v.clear,jl=v.config,Vl=v.disableOptinChangedCallbacks,Hl=v.getOptins,Gl=v.getProductsForPurchasePost,Bl=v.initialize,zl=v.previewMode,Yl=v.register,Wl=v.resolveSettings,Jl=v.setAuthUrl,Kl=v.setEnvironment,Ql=v.setLocale,Zl=v.setMerchantId,Xl=v.setPublicPath,eu=v.setTemplates,tu=v.setupCart,ru=v.setupProduct,ou=v.setupProducts,nu=n(()=>ti(v),"autoInit");var iu=v.initialize,la;(la=q)!=null&&la.shopify_selling_plans&&ar(()=>ca(v));return ba(su);})();
1052
1052
  ; return lib; });
1053
1053
  //# sourceMappingURL=offers.js.map