@ordergroove/offers 2.24.0 → 2.24.1-alpha-PR-566-5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle-report.html +94 -93
- package/dist/examples.js +7 -7
- package/dist/examples.js.map +2 -2
- package/dist/offers.js +159 -144
- package/dist/offers.js.map +3 -3
- package/examples/index.js +15 -2
- package/package.json +2 -2
- package/src/__tests__/offers.spec.js +100 -5
- package/src/components/Offer.js +10 -1
- package/src/components/Price.js +56 -0
- package/src/components/__tests__/OG.fspec.js +2 -2
- package/src/components/__tests__/Price.fspec.js +43 -0
- package/src/core/constants.js +1 -0
- package/src/core/reducer.js +10 -0
- package/src/index.js +188 -150
- package/src/init-func-tests.js +1 -1
- package/src/init-test.js +2 -2
package/dist/offers.js
CHANGED
|
@@ -8,10 +8,108 @@ else {
|
|
|
8
8
|
window.og['offers'] = factory();
|
|
9
9
|
}
|
|
10
10
|
})(()=>{
|
|
11
|
-
var lib=(()=>{var Pa=Object.create;var Ye=Object.defineProperty;var Ra=Object.getOwnPropertyDescriptor;var Aa=Object.getOwnPropertyNames;var Na=Object.getPrototypeOf,ka=Object.prototype.hasOwnProperty;var Io=t=>Ye(t,"__esModule",{value:!0}),n=(t,e)=>Ye(t,"name",{value:e,configurable:!0}),qa=(t=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(t,{get:(e,r)=>(typeof require!="undefined"?require:e)[r]}):t)(function(t){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+t+'" is not supported')});var u=(t,e)=>()=>(t&&(e=t(t=0)),e);var K=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),b=(t,e)=>{Io(t);for(var r in e)Ye(t,r,{get:e[r],enumerable:!0})},Ia=(t,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Aa(e))!ka.call(t,o)&&o!=="default"&&Ye(t,o,{get:()=>e[o],enumerable:!(r=Ra(e,o))||r.enumerable});return t},de=t=>Ia(Io(Ye(t!=null?Pa(Na(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var Do={};b(Do,{default:()=>Da,offersLiveEditor:()=>Pr});function Cr(t){let e=Fa(Uo),r=Fo(t.source);e(t)&&t.data.ogType==="READY"&&import("//static.ordergroove.com/@ordergroove/offers-live-editor/0.4.0/dist/client.js").then(({initializeClient:o})=>{o(e,r),window.removeEventListener("message",Cr)})}function Pr(t=window.opener){t&&t!==window&&(window.addEventListener("message",Cr),Fo(t)("READY"))}var Ua,bt,Fa,Uo,Fo,Da,Lo=u(()=>{Ua=Object.defineProperty,bt=n((t,e)=>Ua(t,"name",{value:e,configurable:!0}),"s"),Fa=bt(t=>e=>t.indexOf(e.origin)>=0,"createIsMessageAllowed"),Uo=["https://rc3.ordergroove.com","https://rc3.stg.ordergroove.com","http://localhost:3000",window.location.origin],Fo=bt(t=>(e,r)=>{Uo.forEach(o=>t.postMessage({ogType:e,...r},o))},"createBroadcastMessage");n(Cr,"d");bt(Cr,"handleReady");n(Pr,"l");bt(Pr,"offersLiveEditor");Da=Pr});function Rr(t){var e,r=t.Symbol;return typeof r=="function"?r.observable?e=r.observable:(e=r("observable"),r.observable=e):e="@@observable",e}var jo=u(()=>{n(Rr,"symbolObservablePonyfill")});var Ce,La,Ar,Mo=u(()=>{jo();typeof self!="undefined"?Ce=self:typeof window!="undefined"||typeof window!="undefined"?Ce=window:typeof module!="undefined"?Ce=module:Ce=Function("return this")();La=Rr(Ce),Ar=La});function ja(t){if(typeof t!="object"||t===null)return!1;for(var e=t;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}function kr(t,e,r){var o;if(typeof e=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error("It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function.");if(typeof e=="function"&&typeof r=="undefined"&&(r=e,e=void 0),typeof r!="undefined"){if(typeof r!="function")throw new Error("Expected the enhancer to be a function.");return r(kr)(t,e)}if(typeof t!="function")throw new Error("Expected the reducer to be a function.");var s=t,i=e,a=[],c=a,l=!1;function f(){c===a&&(c=a.slice())}n(f,"ensureCanMutateNextListeners");function y(){if(l)throw new Error("You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return i}n(y,"getState");function d(h){if(typeof h!="function")throw new Error("Expected the listener to be a function.");if(l)throw new Error("You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api-reference/store#subscribelistener for more details.");var O=!0;return f(),c.push(h),n(function(){if(!!O){if(l)throw new Error("You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api-reference/store#subscribelistener for more details.");O=!1,f();var E=c.indexOf(h);c.splice(E,1),a=null}},"unsubscribe")}n(d,"subscribe");function g(h){if(!ja(h))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(typeof h.type=="undefined")throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(l)throw new Error("Reducers may not dispatch actions.");try{l=!0,i=s(i,h)}finally{l=!1}for(var O=a=c,C=0;C<O.length;C++){var E=O[C];E()}return h}n(g,"dispatch");function S(h){if(typeof h!="function")throw new Error("Expected the nextReducer to be a function.");s=h,g({type:Qe.REPLACE})}n(S,"replaceReducer");function _(){var h,O=d;return h={subscribe:n(function(E){if(typeof E!="object"||E===null)throw new TypeError("Expected the observer to be an object.");function P(){E.next&&E.next(y())}n(P,"observeState"),P();var Ca=O(P);return{unsubscribe:Ca}},"subscribe")},h[Ar]=function(){return this},h}return n(_,"observable"),g({type:Qe.INIT}),o={dispatch:g,subscribe:d,getState:y,replaceReducer:S},o[Ar]=_,o}function Ma(t,e){var r=e&&e.type,o=r&&'action "'+String(r)+'"'||"an action";return"Given "+o+', reducer "'+t+'" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.'}function Va(t){Object.keys(t).forEach(function(e){var r=t[e],o=r(void 0,{type:Qe.INIT});if(typeof o=="undefined")throw new Error('Reducer "'+e+`" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`);if(typeof r(void 0,{type:Qe.PROBE_UNKNOWN_ACTION()})=="undefined")throw new Error('Reducer "'+e+'" returned undefined when probed with a random type. '+("Don't try to handle "+Qe.INIT+' or other actions in "redux/*" ')+"namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.")})}function Vo(t){for(var e=Object.keys(t),r={},o=0;o<e.length;o++){var s=e[o];typeof t[s]=="function"&&(r[s]=t[s])}var i=Object.keys(r),a,c;try{Va(r)}catch(l){c=l}return n(function(f,y){if(f===void 0&&(f={}),c)throw c;if(!1)var d;for(var g=!1,S={},_=0;_<i.length;_++){var h=i[_],O=r[h],C=f[h],E=O(C,y);if(typeof E=="undefined"){var P=Ma(h,y);throw new Error(P)}S[h]=E,g=g||E!==C}return g=g||i.length!==Object.keys(f).length,g?S:f},"combination")}function $o(t,e){return function(){return e(t.apply(this,arguments))}}function Bo(t,e){if(typeof t=="function")return $o(t,e);if(typeof t!="object"||t===null)throw new Error("bindActionCreators expected an object or a function, instead received "+(t===null?"null":typeof t)+'. Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?');var r={};for(var o in t){var s=t[o];typeof s=="function"&&(r[o]=$o(s,e))}return r}function $a(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ho(t,e){var r=Object.keys(t);return Object.getOwnPropertySymbols&&r.push.apply(r,Object.getOwnPropertySymbols(t)),e&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),r}function Ba(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Ho(r,!0).forEach(function(o){$a(t,o,r[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Ho(r).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(r,o))})}return t}function qr(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return e.length===0?function(o){return o}:e.length===1?e[0]:e.reduce(function(o,s){return function(){return o(s.apply(void 0,arguments))}})}function zo(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return function(o){return function(){var s=o.apply(void 0,arguments),i=n(function(){throw new Error("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},"dispatch"),a={getState:s.getState,dispatch:n(function(){return i.apply(void 0,arguments)},"dispatch")},c=e.map(function(l){return l(a)});return i=qr.apply(void 0,c)(s.dispatch),Ba({},s,{dispatch:i})}}}var Nr,Qe,_t=u(()=>{Mo();Nr=n(function(){return Math.random().toString(36).substring(7).split("").join(".")},"randomString"),Qe={INIT:"@@redux/INIT"+Nr(),REPLACE:"@@redux/REPLACE"+Nr(),PROBE_UNKNOWN_ACTION:n(function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Nr()},"PROBE_UNKNOWN_ACTION")};n(ja,"isPlainObject");n(kr,"createStore");n(Ma,"getUndefinedStateErrorMessage");n(Va,"assertReducerShape");n(Vo,"combineReducers");n($o,"bindActionCreator");n(Bo,"bindActionCreators");n($a,"_defineProperty");n(Ho,"ownKeys");n(Ba,"_objectSpread2");n(qr,"compose");n(zo,"applyMiddleware")});var Wo={};b(Wo,{connect:()=>m,createRecalcProps:()=>Go,default:()=>Wa,resolveStore:()=>Ir,setStore:()=>za,unsetStore:()=>Ga});var Je,Ha,Ir,Go,m,za,Ga,Wa,R=u(()=>{_t();Je=null,Ha=n(t=>({dispatch:t}),"defaultMapDispatchToProps"),Ir=n(t=>{if(!Je)throw new Error("Missing redux store.");return Je},"resolveStore"),Go=n((t,e)=>r=>{let{getState:o,dispatch:s}=Ir(r),i=t?t(o(),r):{},a=e(s,r);Object.assign(r,i,a)},"createRecalcProps"),m=n((t,e=Ha)=>r=>{let s=Go(t,typeof e=="function"?e:i=>Bo(e,i));return class extends r{get store(){return Je}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this._storeUnsubscribe=Ir(this).subscribe(()=>s(this)),s(this)}attributeChangedCallback(i,a,c){super.attributeChangedCallback&&super.attributeChangedCallback(i,a,c),this._storeUnsubscribe&&a!==c&&s(this)}disconnectedCallback(){this._storeUnsubscribe(),super.disconnectedCallback&&super.disconnectedCallback()}}},"connect"),za=n(t=>{Je=t},"setStore"),Ga=n(()=>{Je=void 0},"unsetStore"),Wa=m});function Yo(t){var e=n(function(o){var s=o.dispatch,i=o.getState;return function(a){return function(c){return typeof c=="function"?c(s,i,t):a(c)}}},"middleware");return e}var Qo,Jo,Ko=u(()=>{n(Yo,"createThunkMiddleware");Qo=Yo();Qo.withExtraArgument=Yo;Jo=Qo});var Z,X,ee,Et,Zo,U,Ke,xt,St,Xo,vt,Pe,en,wt,Tt,tn,Ot,Ct,Pt,rn,on,Rt,nn,At,Re,sn,Nt,kt,Ze,Xe,qt,It,fe,te,Ut,Ft,Ae=u(()=>{Z="OPTIN_PRODUCT",X="OPTOUT_PRODUCT",ee="PRODUCT_CHANGE_FREQUENCY",Et="SET_MERCHANT_ID",Zo="REQUEST_OFFER",U="RECEIVE_OFFER",Ke="PRODUCT_HAS_CHANGED",xt="CREATED_SESSION_ID",St="SET_AUTH_URL",Xo="REQUEST_AUTH",vt="AUTHORIZE",Pe="UNAUTHORIZED",en="REQUEST_ORDERS",wt="RECEIVE_ORDERS",Tt="RECEIVE_ORDER_ITEMS",tn="FETCH_RESPONSE_ERROR",Ot="SET_ENVIRONMENT_STAGING",Ct="SET_ENVIRONMENT_DEV",Pt="SET_ENVIRONMENT_PROD",rn="CONCLUDE_UPSELL",on="REQUEST_CREATE_IU_ORDER",Rt="CREATE_ONE_TIME",nn="REQUEST_CONVERT_ONE_TIME",At="CONVERT_ONE_TIME",Re="CHECKOUT",sn="RECEIVE_FETCH",Nt="SET_LOCALE",kt="SET_CONFIG",Ze="SET_PREVIEW_STANDARD_OFFER",Xe="SET_PREVIEW_UPSELL_OFFER",qt="ADD_TEMPLATE",It="SET_TEMPLATES",fe="LOCAL_STORAGE_CHANGE",te="LOCAL_STORAGE_CLEAR",Ut="SET_FIRST_ORDER_PLACE_DATE",Ft="SET_PRODUCT_TO_SUBSCRIBE"});function Ya(t,e){return t===e}function Qa(t,e,r){if(e===null||r===null||e.length!==r.length)return!1;for(var o=e.length,s=0;s<o;s++)if(!t(e[s],r[s]))return!1;return!0}function Ja(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ya,r=null,o=null;return function(){return Qa(e,r,arguments)||(o=t.apply(null,arguments)),r=arguments,o}}function Ka(t){var e=Array.isArray(t[0])?t[0]:t;if(!e.every(function(o){return typeof o=="function"})){var r=e.map(function(o){return typeof o}).join(", ");throw new Error("Selector creators expect all input-selectors to be functions, "+("instead received the following types: ["+r+"]"))}return e}function Za(t){for(var e=arguments.length,r=Array(e>1?e-1:0),o=1;o<e;o++)r[o-1]=arguments[o];return function(){for(var s=arguments.length,i=Array(s),a=0;a<s;a++)i[a]=arguments[a];var c=0,l=i.pop(),f=Ka(i),y=t.apply(void 0,[function(){return c++,l.apply(null,arguments)}].concat(r)),d=t(function(){for(var g=[],S=f.length,_=0;_<S;_++)g.push(f[_].apply(null,arguments));return y.apply(null,g)});return d.resultFunc=l,d.dependencies=f,d.recomputations=function(){return c},d.resetRecomputations=function(){return c=0},d}}var Ne,an=u(()=>{n(Ya,"defaultEqualityCheck");n(Qa,"areArgumentsShallowlyEqual");n(Ja,"defaultMemoize");n(Ka,"getDependencies");n(Za,"createSelectorCreator");Ne=Za(Ja)});var jt=K((Lu,mn)=>{var Xa="Expected a function",cn="__lodash_hash_undefined__",ec="[object Function]",tc="[object GeneratorFunction]",rc=/[\\^$.*+?()[\]{}|]/g,oc=/^\[object .+?Constructor\]$/,nc=typeof window=="object"&&window&&window.Object===Object&&window,sc=typeof self=="object"&&self&&self.Object===Object&&self,ln=nc||sc||Function("return this")();function ic(t,e){return t==null?void 0:t[e]}n(ic,"getValue");function ac(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}n(ac,"isHostObject");var cc=Array.prototype,lc=Function.prototype,un=Object.prototype,Ur=ln["__core-js_shared__"],pn=function(){var t=/[^.]+$/.exec(Ur&&Ur.keys&&Ur.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),dn=lc.toString,Fr=un.hasOwnProperty,uc=un.toString,pc=RegExp("^"+dn.call(Fr).replace(rc,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),dc=cc.splice,fc=fn(ln,"Map"),et=fn(Object,"create");function he(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}n(he,"Hash");function hc(){this.__data__=et?et(null):{}}n(hc,"hashClear");function mc(t){return this.has(t)&&delete this.__data__[t]}n(mc,"hashDelete");function gc(t){var e=this.__data__;if(et){var r=e[t];return r===cn?void 0:r}return Fr.call(e,t)?e[t]:void 0}n(gc,"hashGet");function yc(t){var e=this.__data__;return et?e[t]!==void 0:Fr.call(e,t)}n(yc,"hashHas");function bc(t,e){var r=this.__data__;return r[t]=et&&e===void 0?cn:e,this}n(bc,"hashSet");he.prototype.clear=hc;he.prototype.delete=mc;he.prototype.get=gc;he.prototype.has=yc;he.prototype.set=bc;function ke(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}n(ke,"ListCache");function _c(){this.__data__=[]}n(_c,"listCacheClear");function Ec(t){var e=this.__data__,r=Dt(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():dc.call(e,r,1),!0}n(Ec,"listCacheDelete");function xc(t){var e=this.__data__,r=Dt(e,t);return r<0?void 0:e[r][1]}n(xc,"listCacheGet");function Sc(t){return Dt(this.__data__,t)>-1}n(Sc,"listCacheHas");function vc(t,e){var r=this.__data__,o=Dt(r,t);return o<0?r.push([t,e]):r[o][1]=e,this}n(vc,"listCacheSet");ke.prototype.clear=_c;ke.prototype.delete=Ec;ke.prototype.get=xc;ke.prototype.has=Sc;ke.prototype.set=vc;function me(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}n(me,"MapCache");function wc(){this.__data__={hash:new he,map:new(fc||ke),string:new he}}n(wc,"mapCacheClear");function Tc(t){return Lt(this,t).delete(t)}n(Tc,"mapCacheDelete");function Oc(t){return Lt(this,t).get(t)}n(Oc,"mapCacheGet");function Cc(t){return Lt(this,t).has(t)}n(Cc,"mapCacheHas");function Pc(t,e){return Lt(this,t).set(t,e),this}n(Pc,"mapCacheSet");me.prototype.clear=wc;me.prototype.delete=Tc;me.prototype.get=Oc;me.prototype.has=Cc;me.prototype.set=Pc;function Dt(t,e){for(var r=t.length;r--;)if(qc(t[r][0],e))return r;return-1}n(Dt,"assocIndexOf");function Rc(t){if(!hn(t)||Nc(t))return!1;var e=Ic(t)||ac(t)?pc:oc;return e.test(kc(t))}n(Rc,"baseIsNative");function Lt(t,e){var r=t.__data__;return Ac(e)?r[typeof e=="string"?"string":"hash"]:r.map}n(Lt,"getMapData");function fn(t,e){var r=ic(t,e);return Rc(r)?r:void 0}n(fn,"getNative");function Ac(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}n(Ac,"isKeyable");function Nc(t){return!!pn&&pn in t}n(Nc,"isMasked");function kc(t){if(t!=null){try{return dn.call(t)}catch{}try{return t+""}catch{}}return""}n(kc,"toSource");function Dr(t,e){if(typeof t!="function"||e&&typeof e!="function")throw new TypeError(Xa);var r=n(function(){var o=arguments,s=e?e.apply(this,o):o[0],i=r.cache;if(i.has(s))return i.get(s);var a=t.apply(this,o);return r.cache=i.set(s,a),a},"memoized");return r.cache=new(Dr.Cache||me),r}n(Dr,"memoize");Dr.Cache=me;function qc(t,e){return t===e||t!==t&&e!==e}n(qc,"eq");function Ic(t){var e=hn(t)?uc.call(t):"";return e==ec||e==tc}n(Ic,"isFunction");function hn(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}n(hn,"isObject");mn.exports=Dr});var vn={};b(vn,{api:()=>re,compareFrequencies:()=>xn,convertOneTimeToSubscription:()=>Sn,createOneTime:()=>En,default:()=>Fc,fetchItems:()=>_n,fetchOffer:()=>yn,fetchOrders:()=>bn,isFrequencyValid:()=>Vt,parseFrequenciesList:()=>Vr,parseFrequency:()=>Ue,stringifyFrequencies:()=>Uc,stringifyFrequency:()=>Fe,toProductId:()=>gn,toQuery:()=>Mr,withAuth:()=>tt,withFetchJson:()=>qe,withHost:()=>Ie,withJsonBody:()=>jr});var Mt,Lr,qe,Ie,tt,jr,Mr,gn,yn,bn,_n,En,Ue,Vt,xn,Vr,Uc,Fe,Sn,re,Fc,oe=u(()=>{Mt=de(jt()),Lr=n((...t)=>JSON.stringify(t),"memoizeKey"),qe=n(t=>(...e)=>fetch(...t(...e)).then(r=>r.json()),"withFetchJson"),Ie=n(t=>(e,...r)=>{if(!e)throw Error("host required");let[o,s={}]=t(...r);return[`${e.replace(/\/+$/,"")}${o}`,s]},"withHost"),tt=n(t=>(e,...r)=>{if(!e)throw Error("auth required");let[o,s={}]=t(...r);return[o,{...s,headers:{Authorization:JSON.stringify(e),...s.headers}}]},"withAuth"),jr=n(t=>(...e)=>{let[r,o={}]=t(...e);return[r,{method:"POST",...o,body:JSON.stringify(o.body),headers:{"Content-type":"application/json",...o.headers}}]},"withJsonBody"),Mr=n((t=[])=>(Array.isArray(t)?t:Object.entries(t)).map(([e,r])=>[e,encodeURIComponent(r)].join("=")).join("&"),"toQuery"),gn=n(t=>JSON.stringify([].concat(t).map(e=>typeof e=="object"?e.id:e).filter(e=>e)),"toProductId"),yn=(0,Mt.default)(qe(Ie((t,e,r,o="pdp")=>{if(!t)throw Error("merchantId required");if(!e)throw Error("sessionId required");if(!r)throw Error("product required");let s=Mr([["session_id",e],["page_type",1],["p",gn(r)],["module_view",JSON.stringify(["regular"])]]);return[`/offer/${t}/${o}?${s}`]})),Lr),bn=(0,Mt.default)(qe(Ie(tt((t=1,e="place")=>[`/orders/?${Mr([["status",t],["ordering",e]])}`]))),Lr),_n=(0,Mt.default)(qe(Ie(tt(t=>{if(!t)throw Error("orderId required");return[`/items/?order=${t}`]}))),Lr),En=qe(Ie(tt(jr((t,e,r,o)=>{if(!t)throw Error("product required");if(!e)throw Error("order required");if(!r)throw Error("quantity required");if(r<=0)throw Error("quantity must be greater or equal than one");if(!o)throw Error("offer required");return["/items/iu/",{body:{product:t,order:e,quantity:r,offer:o}}]})))),Ue=n(t=>{if(typeof t=="object")return{...t};let[e,r]=(t||"").split(/_/).map(o=>parseInt(o,10));return e&&r&&{every:e,every_period:r}},"parseFrequency"),Vt=n(t=>t.match(/^\d+_\d$/),"isFrequencyValid"),xn=n((t,e)=>String.prototype.localeCompare.call(t&&t.split("_").reverse().join("_"),e&&e.split("_").reverse().join("_")),"compareFrequencies"),Vr=n(t=>[...new Set(t&&t.split(/\s+/))].filter(Vt).sort(xn),"parseFrequenciesList"),Uc=n(t=>t==null?t:t.join(" "),"stringifyFrequencies"),Fe=n(t=>{if(typeof t=="object"){let{every:e,period:r,every_period:o}=t;return`${e}_${r||o}`}return typeof t=="string"?t:""},"stringifyFrequency"),Sn=qe(Ie(tt(jr((t,e,r)=>{if(!t)throw Error("item required");if(!e)throw Error("frequency required");let o=Ue(e);if(!o)throw Error("invalid frequency");return["/subscriptions/create_from_item/",{body:{item:t.public_id,offer:r,...o}}]})))),re={fetchOffer:yn,fetchOrders:bn,fetchItems:_n,createOneTime:En,convertOneTimeToSubscription:Sn},Fc=re});function Dc(t,e){if(t===e)return!0;if(t===null||e===null||t.length!==e.length)return!1;for(let r=0;r<t.length;++r)if(t[r]!==e[r])return!1;return!0}var ge,N,$t,wn,$r,Lc,z,Tn,On,ne,Bt,Br,G,De,W=u(()=>{an();ge=de(jt());oe();ge.default.Cache=Map;n(Dc,"arraysEqual");N=n((t,e)=>!!(t===e||typeof t=="object"&&typeof e=="object"&&t&&e&&t.id===e.id&&(!(Array.isArray(t.components)&&Array.isArray(e.components))||Dc((t.components||[]).sort(),(e.components||[]).sort()))),"isSameProduct"),$t=n(t=>t.optedin||[],"optedinSelector"),wn=n(t=>t.optedout||[],"optedoutSelector"),$r=n(t=>t.autoshipByDefault||{},"autoshipSelector"),Lc=n(t=>t.defaultFrequencies||{},"defaultFrequenciesSelector"),z=(0,ge.default)(t=>Ne($t,wn,$r,(e,r,o)=>{let s=e.find(i=>N(t,i));return s||(r.find(i=>N(t,i))?!1:t&&o[t.id]?{id:t.id}:!1)}),t=>JSON.stringify(t)),Tn=(0,ge.default)(t=>Ne($t,e=>{let r=e.find(o=>N(t,o));return r||!1}),t=>JSON.stringify(t)),On=(0,ge.default)(t=>Ne(wn,e=>e.find(r=>N(t,r)))),ne=(0,ge.default)(t=>Ne(z(t),e=>e&&e.frequency||null)),Bt=(0,ge.default)(t=>Ne(Lc,e=>e[t]&&Fe(e[t])||null)),Br=n(t=>t.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase(),"kebabCase"),G=n((t,e,r,o)=>({[r]:e&&e.hasAttribute&&e.hasAttribute(Br(r))&&e[r]||e.offer&&typeof(e.offer[r]!=="undefined")&&e.offer[r]||t.config&&t.config[r]||o}),"configSelector"),De=n(t=>({templates:t.templates||[]}),"templatesSelector")});var Zn={};b(Zn,{auth:()=>Un,authUrl:()=>Dn,autoshipByDefault:()=>Qn,autoshipEligible:()=>An,config:()=>Gn,default:()=>Hr,defaultFrequencies:()=>Jn,eligibilityGroups:()=>kn,environment:()=>Hn,firstOrderPlaceDate:()=>$n,frequency:()=>jc,inStock:()=>Nn,incentives:()=>In,locale:()=>zn,merchantId:()=>Fn,nextUpcomingOrder:()=>Rn,offer:()=>Ln,offerId:()=>jn,optedin:()=>Cn,optedout:()=>Pn,previewStandardOffer:()=>Wn,previewUpsellOffer:()=>Yn,productOffer:()=>Vn,productToSubscribe:()=>Bn,sessionId:()=>Mn,templates:()=>Kn});var Cn,Pn,Rn,An,Nn,kn,qn,In,jc,Un,Fn,Dn,Ln,jn,Mn,Vn,$n,Bn,Hn,zn,Gn,Wn,Yn,Qn,Jn,Kn,Hr,zr=u(()=>{_t();Ae();W();oe();Cn=n((t=[],e)=>{switch(e.type){case te:return[];case fe:return e.newValue?e.newValue.optedin:t;case Z:case ee:let[[r],o]=t.reduce((s,i)=>s[N(e.payload.product,i)?0:1].push(i)&&s,[[],[]]);return(o||[]).concat({...r,...e.payload.product,frequency:e.payload.frequency});case X:return t.filter(s=>!N(e.payload.product,s));case Ke:return t.map(s=>N(e.payload.product,s)?{...s,...e.payload.newProduct}:s);case At:return t.filter(s=>!N(e.payload.product,s));case Re:return[];default:return t}},"optedin"),Pn=n((t=[],e)=>{switch(e.type){case te:return[];case fe:return e.newValue?e.newValue.optedout:t;case Z:case ee:return t.filter(s=>!N(e.payload.product,s));case X:let[[r],o]=t.reduce((s,i)=>s[N(e.payload.product,i)?0:1].push(i)&&s,[[],[]]);return(o||[]).concat({...r,...e.payload.product,frequency:e.payload.frequency});case Ke:return t.map(s=>N(e.payload.product,s)?{...s,...e.payload.newProduct}:s);case Re:return[];default:return t}},"optedout"),Rn=n((t={},{type:e,payload:r})=>{switch(e){case wt:return r&&r.count>0?{...t,...r.results[0]&&{...r.results[0],place:new Date(Date.parse(r.results[0].place.replace(/-/gi,"/")))}}:t;case Tt:return{...t,products:(r.results||[]).map(o=>o.product)};case Rt:return{...t,...r,public_id:r.order,...r.product&&{products:(t.products||[]).concat(r.product)}};default:return t}},"nextUpcomingOrder"),An=n((t={},e)=>{switch(e.type){case U:return{...t,...e.payload.autoship};default:return t}},"autoshipEligible"),Nn=n((t={},e)=>{switch(e.type){case U:return{...t,...e.payload.in_stock};default:return t}},"inStock"),kn=n((t={},e)=>{switch(e.type){case U:return{...t,...e.payload.eligibility_groups};default:return t}},"eligibilityGroups"),qn=n((t,e)=>t.map(r=>({...e[r],id:[r][0]})),"mapIncentive"),In=n((t={},e)=>{switch(e.type){case U:return{...t,...[...new Set(Object.keys(e.payload.incentives||{}))].reduce((r,o)=>({...r,[o]:Object.entries(e.payload.incentives).filter(([s])=>s===o).reduce((s,[,{initial:i,ongoing:a}])=>({...s,initial:[...s.initial||[],...qn(i,e.payload.incentives_display)],ongoing:[...s.ongoing||[],...qn(a,e.payload.incentives_display)]}),{})}),{})};default:return t}},"incentives"),jc=n((t={},e)=>{switch(e.type){case Z:case ee:return{...t,[e.payload.product]:e.payload.frequency};case X:return{...t,[e.payload.product]:void 0};default:return t}},"frequency"),Un=n((t=!1,e)=>{switch(e.type){case vt:return{...e.payload};case Pe:return!1;default:return t}},"auth"),Fn=n((t="",e)=>{switch(e.type){case Et:return e.payload;default:return t}},"merchantId"),Dn=n((t=null,e)=>{switch(e.type){case St:return e.payload;default:return t}},"authUrl"),Ln=n((t={},e)=>{switch(e.type){case U:return{...t,offerId:(e.payload.module_view||{}).regular,...e.payload.modifiers};default:return t}},"offer"),jn=n((t="",e)=>{switch(e.type){case U:return(e.payload.module_view||{}).regular||"";default:return t}},"offerId"),Mn=n((t=null,e)=>{switch(e.type){case te:return null;case xt:return e.payload;default:return t}},"sessionId"),Vn=n((t={},e)=>{switch(e.type){case U:return{...t,...Object.entries(e.payload.autoship).map(([r])=>({[r]:Object.keys(e.payload.modifiers)})).reduce((r,o)=>({...r,...o}))};case Re:return{};default:return t}},"productOffer"),$n=n((t={},e)=>{switch(e.type){case Ut:return{...t,[e.payload.product]:e.payload.firstOrderPlaceDate};default:return t}},"firstOrderPlaceDate"),Bn=n((t={},e)=>{switch(e.type){case Ft:return{...t,[e.payload.product]:e.payload.productToSubscribe};default:return t}},"productToSubscribe"),Hn=n((t={},e)=>{switch(e.type){case Ot:return{...t,name:"staging",apiUrl:"https://staging.om.ordergroove.com",legoUrl:"https://staging.restapi.ordergroove.com"};case Ct:return{...t,name:"dev",apiUrl:"https://dev.om.ordergroove.com",legoUrl:"https://dev.restapi.ordergroove.com"};case Pt:return{...t,name:"prod",apiUrl:"https://om.ordergroove.com",legoUrl:"https://restapi.ordergroove.com"};default:return t}},"environment"),zn=n((t={offerOptInLabel:"Subscribe",offerOptOutLabel:"Purchase one time",offerEveryLabel:"Every",offerTooltipTrigger:"Hover for additional info",offerTooltipContent:"Seems this is a great subscription offering. Many fun details about this program exist.",optinButtonLabel:"\u2022",optoutButtonLabel:"\u2022",optinStatusOptedInLabel:"You're opted in!",optinStatusOptedOutLabel:"You're not opted in.",optinToggleLabel:"\u2022",upsellButtonLabel:"Add item to order on ",upsellButtonPrefix:"",upsellModalContent:"Some upsell modal content",upsellModalOptInLabel:"Subscribe",upsellModalOptOutLabel:"Purchase one time",upsellModalTitle:"Impulse Upsell",upsellModalConfirmLabel:"Ok",upsellModalCancelLabel:"Cancel",defaultFrequencyCopy:"(Recommended)",frequencyPeriods:{"1":"day","2":"week","3":"month"}},e)=>{switch(e.type){case Nt:return{...t,...e.payload};default:return t}},"locale"),Gn=n((t={frequencies:["1_2","1_2","1_3"],offerType:"radio"},e)=>{switch(e.type){case kt:return{...t,...e.payload,defaultFrequency:e.payload.defaultFrequency?Fe(e.payload.defaultFrequency):t.defaultFrequency,frequencies:e.payload.frequencies?e.payload.frequencies.map(Fe):t.frequencies};default:return t}},"config"),Wn=n((t=!1,e)=>{switch(e.type){case Ze:return e.payload;default:return t}},"previewStandardOffer"),Yn=n((t=!1,e)=>{switch(e.type){case Xe:return e.payload;default:return t}},"previewUpsellOffer"),Qn=n((t=[],e)=>{switch(e.type){case U:return{...t,...e.payload.autoship_by_default};default:return t}},"autoshipByDefault"),Jn=n((t=[],e)=>{switch(e.type){case U:return{...t,...e.payload.default_frequencies};default:return t}},"defaultFrequencies"),Kn=n((t=[],e)=>{switch(e.type){case It:return[...e.payload||[]];case qt:return[e.payload,...t];default:return t}},"templates"),Hr=Vo({environment:Hn,optedin:Cn,optedout:Pn,merchantId:Fn,offer:Ln,offerId:jn,productOffer:Vn,sessionId:Mn,inStock:Nn,eligibilityGroups:kn,autoshipByDefault:Qn,autoshipEligible:An,incentives:In,nextUpcomingOrder:Rn,auth:Un,authUrl:Dn,locale:zn,config:Gn,previewStandardOffer:Wn,previewUpsellOffer:Yn,templates:Kn,defaultFrequencies:Jn,firstOrderPlaceDate:$n,productToSubscribe:Bn})});var Gr=K((Ht,Xn)=>{(function(t,e){typeof Ht=="object"&&typeof Xn!="undefined"?e(Ht):typeof define=="function"&&define.amd?define(["exports"],e):(t=t||self,e(t.throttleDebounce={}))})(Ht,function(t){"use strict";function e(o,s,i,a){var c,l=!1,f=0;function y(){c&&clearTimeout(c)}n(y,"clearExistingTimeout");function d(){y(),l=!0}n(d,"cancel"),typeof s!="boolean"&&(a=i,i=s,s=void 0);function g(){for(var S=arguments.length,_=new Array(S),h=0;h<S;h++)_[h]=arguments[h];var O=this,C=Date.now()-f;if(l)return;function E(){f=Date.now(),i.apply(O,_)}n(E,"exec");function P(){c=void 0}n(P,"clear"),a&&!c&&E(),y(),a===void 0&&C>o?E():s!==!0&&(c=setTimeout(a?P:E,a===void 0?o-C:o))}return n(g,"wrapper"),g.cancel=d,g}n(e,"throttle");function r(o,s,i){return i===void 0?e(o,s,!1):e(o,i,s!==!1)}n(r,"debounce"),t.debounce=r,t.throttle=e,Object.defineProperty(t,"__esModule",{value:!0})})});var es,Mc,Vc,$c,Bc,ts,rs=u(()=>{es=/^og_auth=/,Mc=n((t=es)=>(document.cookie.split(/;\s*/).find(e=>e.match(t))||"").replace(es,""),"s"),Vc=n(t=>{if(typeof t=="object")return t;let e=(t||"").split("|");return e.length===3?{sig_field:e[0],ts:parseInt(e[1],10),sig:e[2]}:null},"i"),$c=n(t=>new Promise((e,r)=>{let o=document.createElement("iframe");o.style.setProperty("display","none","important"),document.body.appendChild(o),o.onload=e,o.onerror=r,o.src=t}),"p"),Bc=n(t=>(t.headers.get("content-type")||"").indexOf("application/json")!==-1,"c"),ts=n((t,e=Mc,r=$c)=>Promise.resolve(e()||t&&typeof t=="string"&&fetch(t).then(o=>o.status>=200&&o.status<300?e()||(Bc(o)?o.json():Promise.resolve(r(t)).then(e)):null)).then(Vc).then(o=>o===null?Promise.reject(new Error("Unauthorized")):o),"l")});var ps={};b(ps,{addTemplate:()=>Kc,authorize:()=>zt,checkout:()=>Yc,concludeUpsell:()=>Yr,createIu:()=>Kr,createSessionId:()=>os,fetchAuth:()=>Gc,fetchDone:()=>ot,fetchOffer:()=>Jr,fetchOrders:()=>nt,fetchResponseError:()=>Yt,optinProduct:()=>Y,optoutProduct:()=>ye,productChangeFrequency:()=>rt,productHasChangedComponents:()=>Wr,receiveConvertOneTime:()=>us,receiveCreateOneTime:()=>cs,receiveItems:()=>Wt,receiveOffer:()=>be,receiveOrders:()=>Gt,requestAuth:()=>ns,requestConvertOneTimeToSubscription:()=>ls,requestCreateOneTime:()=>as,requestOffer:()=>is,requestOrders:()=>ss,requestSessionId:()=>Qr,setAuthUrl:()=>zc,setConfig:()=>Jc,setEnvironment:()=>Wc,setFirstOrderPlaceDate:()=>Zr,setLocale:()=>Qc,setMerchantId:()=>Hc,setProductToSubscribe:()=>Xr,setTemplates:()=>Zc,unauthorized:()=>se});var Y,ye,Wr,rt,Yr,Hc,os,ns,zt,se,zc,ot,Gc,ss,Gt,Wt,nt,Wc,Qr,be,Yt,is,Jr,Yc,as,cs,ls,us,Kr,Qc,Jc,Kc,Zc,Zr,Xr,k=u(()=>{rs();Ae();oe();Y=n((t,e)=>({type:Z,payload:{product:t,frequency:e}}),"optinProduct"),ye=n(t=>({type:X,payload:{product:t}}),"optoutProduct"),Wr=n((t,e)=>({type:Ke,payload:{newProduct:t,product:e}}),"productHasChangedComponents"),rt=n((t,e)=>({type:ee,payload:{product:t,frequency:e}}),"productChangeFrequency"),Yr=n(t=>({type:rn,payload:{product:t}}),"concludeUpsell"),Hc=n(t=>({type:Et,payload:t}),"setMerchantId"),os=n(t=>({type:xt,payload:`${t}.${Math.floor(Math.random()*999999)}.${Math.round(new Date().getTime()/1e3)}`}),"createSessionId"),ns=n(t=>({type:Xo,payload:t}),"requestAuth"),zt=n((t,e,r,o)=>({type:vt,payload:{public_id:t,sig_field:e,ts:r,sig:o}}),"authorize"),se=n(t=>({type:Pe,payload:t}),"unauthorized"),zc=n(t=>({type:St,payload:t}),"setAuthUrl"),ot=n(t=>({type:sn,payload:t}),"fetchDone"),Gc=n((t=ts)=>n(function(r,o){if(window.og&&window.og.previewMode)return r(se({message:"Offers are running in preview mode"}));let{merchantId:s,authUrl:i}=o(),a=ns(i);return r(a),t(i).then(({sig_field:c,ts:l,sig:f})=>r(zt(s,c,l,f)),c=>r(se(c))).finally(()=>r(ot(a)))},"fetchAuthThunk"),"fetchAuth"),ss=n((t,e)=>({type:en,payload:{status:t,ordering:e}}),"requestOrders"),Gt=n(t=>({type:wt,payload:t}),"receiveOrders"),Wt=n(t=>({type:Tt,payload:t}),"receiveItems"),nt=n((t=1,e="place")=>n(function(o,s){let{environment:{legoUrl:i},auth:a}=s();if(!a)return o(se("No auth set."));let c=ss(t,e);return o(c),re.fetchOrders(i,a,t,e).then(l=>{o(Gt(l));let f=(l.results[0]||{}).public_id;return f?re.fetchItems(i,a,f).then(y=>o(Wt(y))):null},l=>o(se(l))).finally(()=>o(ot(c)))},"fetchOrdersThunk"),"fetchOrders"),Wc=n(t=>{switch(t){case"dev":return{type:Ct,payload:t};case"staging":return{type:Ot,payload:t};case"prod":return{type:Pt,payload:t};default:throw new Error(`${t} is not a supported environment`)}},"setEnvironment"),Qr=n(()=>(t,e)=>{let{merchantId:r,sessionId:o}=e();return(!o||r&&!o.startsWith(r))&&t(os(r)),o},"requestSessionId"),be=n(t=>({type:U,payload:t}),"receiveOffer"),Yt=n(t=>({type:tn,payload:t}),"fetchResponseError"),is=n((t,e="pdp")=>({type:Zo,payload:{product:t,module:e}}),"requestOffer"),Jr=n((t,e="pdp")=>n(function(o,s){let{merchantId:i,sessionId:a,environment:{apiUrl:c}}=s(),l=is(t,e);return o(l),re.fetchOffer(c,i,a,t,e).then(f=>o(be(f)),f=>o(Yt(f))).finally(()=>o(ot(l)))},"fetchOfferThunk"),"fetchOffer"),Yc=n(()=>({type:Re}),"checkout"),as=n((t,e,r,o)=>({type:on,payload:{product:t,order:e,quantity:r,offerId:o}}),"requestCreateOneTime"),cs=n(t=>({type:Rt,payload:t}),"receiveCreateOneTime"),ls=n((t,e)=>({type:nn,payload:{item:t,frequency:e}}),"requestConvertOneTimeToSubscription"),us=n((t,e)=>({type:At,payload:{response:t,product:e}}),"receiveConvertOneTime"),Kr=n((t,e,r,o=!1,s=null)=>n(function(a,c){let{auth:l,environment:{legoUrl:f},previewUpsellOffer:y,offerId:d}=c();if(!l)return a(se("No auth set."));let g=as(t,e,r,d);return a(g),(y?Promise.resolve({legoUrl:f,product:t,order:e,quantity:r,offer:d}):re.createOneTime(f,l,t.id,e,r,d)).then(S=>(a(cs(S)),o?(a(ls(S,s)),(y?Promise.resolve({item:S,frequency:s}):re.convertOneTimeToSubscription(f,l,S,s,d)).then(_=>a(us(_,t)),_=>a(Yt(_)))):S),S=>a(Yt(S))).finally(()=>a(ot(g)))},"createIuThunk"),"createIu"),Qc=n(t=>({type:Nt,payload:t}),"setLocale"),Jc=n(t=>({type:kt,payload:t}),"setConfig"),Kc=n((t,e,r)=>({type:qt,payload:{selector:t,markup:e,config:r}}),"addTemplate"),Zc=n(t=>({type:It,payload:t}),"setTemplates"),Zr=n((t,e)=>({type:Ut,payload:{product:t,firstOrderPlaceDate:e}}),"setFirstOrderPlaceDate"),Xr=n((t,e)=>({type:Ft,payload:{product:t,productToSubscribe:e}}),"setProductToSubscribe")});var hs={};b(hs,{STORE_ROOT:()=>_e,clearState:()=>el,listenLocalStorageChanges:()=>Xc,loadState:()=>ro,safeParseState:()=>eo,saveState:()=>oo,serializeState:()=>fs});var ds,_e,eo,to,ro,fs,oo,Xc,el,Qt=u(()=>{ds=de(Gr());k();Ae();_e="OG_STATE",eo=n(t=>{try{return t===null?void 0:JSON.parse(t)}catch{return}},"safeParseState"),to=n(()=>window.og&&window.og.previewMode,"isPreviewMode"),ro=n(()=>to()?{}:eo(localStorage.getItem(_e)),"loadState"),fs=n(t=>!t||!t.sessionId?!1:JSON.stringify({sessionId:t.sessionId,optedin:t.optedin,optedout:t.optedout,productOffer:t.productOffer,firstOrderPlaceDate:t.firstOrderPlaceDate,productToSubscribe:t.productToSubscribe}),"serializeState"),oo=n(t=>{if(to())return;let e=fs(t);e&&localStorage.getItem(_e)!==e&&localStorage.setItem(_e,e)},"saveState"),Xc=n(t=>(0,ds.throttle)(500,e=>{if(to())return;let{key:r,newValue:o}=e;r===_e&&o===null?(t.dispatch({type:te}),setTimeout(()=>t.dispatch(Qr()),0)):r===_e&&t.dispatch({type:fe,newValue:eo(o)})}),"listenLocalStorageChanges"),el=n(()=>localStorage.removeItem(_e),"clearState")});var ms,tl,gs,rl,ys,bs,_s=u(()=>{ms=de(Gr());Ae();W();Qt();tl=n((t,e,r=document)=>r.dispatchEvent(new CustomEvent(t,{detail:e})),"dispatchEvent"),gs=n(t=>({payload:{product:{id:e,components:r}={}}={}}={})=>setTimeout(()=>tl("optin-changed",{productId:e,components:r,optedIn:t}),0),"dispatchOptinChangedEvent"),rl=[{expressions:[({type:t}={})=>t===Z,({type:t}={})=>t===ee],fn:gs(!0)},{expressions:[({type:t}={})=>t===X],fn:gs(!1)}],ys=n(t=>e=>r=>{let o=t.getState();rl.forEach(s=>{s.expressions.some(i=>i(r,o))&&s.fn(r)}),e(r)},"dispatchMiddleware"),bs=n(t=>e=>r=>{e(r);let o=(0,ms.throttle)(500,()=>{oo({...t.getState()})});r.type!==fe&&o()},"localStorageMiddleware")});var xs={};b(xs,{default:()=>ol,getStore:()=>Es});function Es(){if(window.og&&window.og.store)return window.og.store;let t=window.og&&window.og.previewMode,e=typeof window=="object"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({}):qr,r=[Jo,ys];t||r.push(bs);let o=e(zo(...r)),s=kr(Hr,t?{}:ro(),o);return window.og=window.og||{},window.og.store=s,s}var ol,Ss=u(()=>{_t();Ko();zr();Qt();_s();n(Es,"getStore");ol=Es});var ws={};b(ws,{default:()=>nl,getProductsForPurchasePost:()=>vs});var vs,nl,Ts=u(()=>{oe();vs=n((t={},e=[])=>(t.optedin||[]).map(r=>{let o={product:r.id,subscription_info:{components:r.components||[]},tracking_override:{offer:((t.productOffer||{})[r.id]||[])[0],...Ue(r.frequency)}};return t.firstOrderPlaceDate&&t.firstOrderPlaceDate[r.id]&&(o.subscription_info.first_order_place_date=t.firstOrderPlaceDate[r.id]),t.productToSubscribe&&t.productToSubscribe[r.id]&&(o.tracking_override.product=t.productToSubscribe[r.id]),o}).filter(r=>r.tracking_override.offer).filter(r=>e.length?e.includes(r.product):r),"getProductsForPurchasePost"),nl={getProductsForPurchasePost:vs}});var no,Ee,xe=u(()=>{no=typeof window!="undefined"&&window.customElements!=null&&window.customElements.polyfillWrapFlushCallback!==void 0,Ee=n((t,e,r=null)=>{for(;e!==r;){let o=e.nextSibling;t.removeChild(e),e=o}},"removeNodes")});var F,so,Os,Le,Se,Cs,st,$,Jt,ie=u(()=>{F=`{{lit-${String(Math.random()).slice(2)}}}`,so=`<!--${F}-->`,Os=new RegExp(`${F}|${so}`),Le="$lit$",Se=class{constructor(e,r){this.parts=[],this.element=r;let o=[],s=[],i=document.createTreeWalker(r.content,133,null,!1),a=0,c=-1,l=0,{strings:f,values:{length:y}}=e;for(;l<y;){let d=i.nextNode();if(d===null){i.currentNode=s.pop();continue}if(c++,d.nodeType===1){if(d.hasAttributes()){let g=d.attributes,{length:S}=g,_=0;for(let h=0;h<S;h++)Cs(g[h].name,Le)&&_++;for(;_-- >0;){let h=f[l],O=Jt.exec(h)[2],C=O.toLowerCase()+Le,E=d.getAttribute(C);d.removeAttribute(C);let P=E.split(Os);this.parts.push({type:"attribute",index:c,name:O,strings:P}),l+=P.length-1}}d.tagName==="TEMPLATE"&&(s.push(d),i.currentNode=d.content)}else if(d.nodeType===3){let g=d.data;if(g.indexOf(F)>=0){let S=d.parentNode,_=g.split(Os),h=_.length-1;for(let O=0;O<h;O++){let C,E=_[O];if(E==="")C=$();else{let P=Jt.exec(E);P!==null&&Cs(P[2],Le)&&(E=E.slice(0,P.index)+P[1]+P[2].slice(0,-Le.length)+P[3]),C=document.createTextNode(E)}S.insertBefore(C,d),this.parts.push({type:"node",index:++c})}_[h]===""?(S.insertBefore($(),d),o.push(d)):d.data=_[h],l+=h}}else if(d.nodeType===8)if(d.data===F){let g=d.parentNode;(d.previousSibling===null||c===a)&&(c++,g.insertBefore($(),d)),a=c,this.parts.push({type:"node",index:c}),d.nextSibling===null?d.data="":(o.push(d),c--),l++}else{let g=-1;for(;(g=d.data.indexOf(F,g+1))!==-1;)this.parts.push({type:"node",index:-1}),l++}}for(let d of o)d.parentNode.removeChild(d)}};n(Se,"Template");Cs=n((t,e)=>{let r=t.length-e.length;return r>=0&&t.slice(r)===e},"endsWith"),st=n(t=>t.index!==-1,"isTemplatePartActive"),$=n(()=>document.createComment(""),"createMarker"),Jt=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/});function ao(t,e){let{element:{content:r},parts:o}=t,s=document.createTreeWalker(r,io,null,!1),i=it(o),a=o[i],c=-1,l=0,f=[],y=null;for(;s.nextNode();){c++;let d=s.currentNode;for(d.previousSibling===y&&(y=null),e.has(d)&&(f.push(d),y===null&&(y=d)),y!==null&&l++;a!==void 0&&a.index===c;)a.index=y!==null?-1:a.index-l,i=it(o,i),a=o[i]}f.forEach(d=>d.parentNode.removeChild(d))}function Ps(t,e,r=null){let{element:{content:o},parts:s}=t;if(r==null){o.appendChild(e);return}let i=document.createTreeWalker(o,io,null,!1),a=it(s),c=0,l=-1;for(;i.nextNode();)for(l++,i.currentNode===r&&(c=sl(e),r.parentNode.insertBefore(e,r));a!==-1&&s[a].index===l;){if(c>0){for(;a!==-1;)s[a].index+=c,a=it(s,a);return}a=it(s,a)}}var io,sl,it,Rs=u(()=>{ie();io=133;n(ao,"removeNodesFromTemplate");sl=n(t=>{let e=t.nodeType===11?0:1,r=document.createTreeWalker(t,io,null,!1);for(;r.nextNode();)e++;return e},"countNodes"),it=n((t,e=-1)=>{for(let r=e+1;r<t.length;r++){let o=t[r];if(st(o))return r}return-1},"nextActiveIndexInTemplateParts");n(Ps,"insertNodeIntoTemplate")});var il,ve,co=u(()=>{il=new WeakMap,ve=n(t=>typeof t=="function"&&il.has(t),"isDirective")});var q,Kt,lo=u(()=>{q={},Kt={}});var ae,Zt=u(()=>{xe();ie();ae=class{constructor(e,r,o){this.__parts=[],this.template=e,this.processor=r,this.options=o}update(e){let r=0;for(let o of this.__parts)o!==void 0&&o.setValue(e[r]),r++;for(let o of this.__parts)o!==void 0&&o.commit()}_clone(){let e=no?this.template.element.content.cloneNode(!0):document.importNode(this.template.element.content,!0),r=[],o=this.template.parts,s=document.createTreeWalker(e,133,null,!1),i=0,a=0,c,l=s.nextNode();for(;i<o.length;){if(c=o[i],!st(c)){this.__parts.push(void 0),i++;continue}for(;a<c.index;)a++,l.nodeName==="TEMPLATE"&&(r.push(l),s.currentNode=l.content),(l=s.nextNode())===null&&(s.currentNode=r.pop(),l=s.nextNode());if(c.type==="node"){let f=this.processor.handleTextExpression(this.options);f.insertAfterNode(l.previousSibling),this.__parts.push(f)}else this.__parts.push(...this.processor.handleAttributeExpressions(l,c.name,c.strings,this.options));i++}return no&&(document.adoptNode(e),customElements.upgrade(e)),e}};n(ae,"TemplateInstance")});var As,cl,Q,Xt=u(()=>{xe();ie();As=window.trustedTypes&&trustedTypes.createPolicy("lit-html",{createHTML:t=>t}),cl=` ${F} `,Q=class{constructor(e,r,o,s){this.strings=e,this.values=r,this.type=o,this.processor=s}getHTML(){let e=this.strings.length-1,r="",o=!1;for(let s=0;s<e;s++){let i=this.strings[s],a=i.lastIndexOf("<!--");o=(a>-1||o)&&i.indexOf("-->",a+1)===-1;let c=Jt.exec(i);c===null?r+=i+(o?cl:so):r+=i.substr(0,c.index)+c[1]+c[2]+Le+c[3]+F}return r+=this.strings[e],r}getTemplateElement(){let e=document.createElement("template"),r=this.getHTML();return As!==void 0&&(r=As.createHTML(r)),e.innerHTML=r,e}};n(Q,"TemplateResult")});var er,tr,je,at,J,ct,lt,rr,Ns,ut,ll,or=u(()=>{co();xe();lo();Zt();Xt();ie();er=n(t=>t===null||!(typeof t=="object"||typeof t=="function"),"isPrimitive"),tr=n(t=>Array.isArray(t)||!!(t&&t[Symbol.iterator]),"isIterable"),je=class{constructor(e,r,o){this.dirty=!0,this.element=e,this.name=r,this.strings=o,this.parts=[];for(let s=0;s<o.length-1;s++)this.parts[s]=this._createPart()}_createPart(){return new at(this)}_getValue(){let e=this.strings,r=e.length-1,o=this.parts;if(r===1&&e[0]===""&&e[1]===""){let i=o[0].value;if(typeof i=="symbol")return String(i);if(typeof i=="string"||!tr(i))return i}let s="";for(let i=0;i<r;i++){s+=e[i];let a=o[i];if(a!==void 0){let c=a.value;if(er(c)||!tr(c))s+=typeof c=="string"?c:String(c);else for(let l of c)s+=typeof l=="string"?l:String(l)}}return s+=e[r],s}commit(){this.dirty&&(this.dirty=!1,this.element.setAttribute(this.name,this._getValue()))}};n(je,"AttributeCommitter");at=class{constructor(e){this.value=void 0,this.committer=e}setValue(e){e!==q&&(!er(e)||e!==this.value)&&(this.value=e,ve(e)||(this.committer.dirty=!0))}commit(){for(;ve(this.value);){let e=this.value;this.value=q,e(this)}this.value!==q&&this.committer.commit()}};n(at,"AttributePart");J=class{constructor(e){this.value=void 0,this.__pendingValue=void 0,this.options=e}appendInto(e){this.startNode=e.appendChild($()),this.endNode=e.appendChild($())}insertAfterNode(e){this.startNode=e,this.endNode=e.nextSibling}appendIntoPart(e){e.__insert(this.startNode=$()),e.__insert(this.endNode=$())}insertAfterPart(e){e.__insert(this.startNode=$()),this.endNode=e.endNode,e.endNode=this.startNode}setValue(e){this.__pendingValue=e}commit(){if(this.startNode.parentNode===null)return;for(;ve(this.__pendingValue);){let r=this.__pendingValue;this.__pendingValue=q,r(this)}let e=this.__pendingValue;e!==q&&(er(e)?e!==this.value&&this.__commitText(e):e instanceof Q?this.__commitTemplateResult(e):e instanceof Node?this.__commitNode(e):tr(e)?this.__commitIterable(e):e===Kt?(this.value=Kt,this.clear()):this.__commitText(e))}__insert(e){this.endNode.parentNode.insertBefore(e,this.endNode)}__commitNode(e){this.value!==e&&(this.clear(),this.__insert(e),this.value=e)}__commitText(e){let r=this.startNode.nextSibling;e=e??"";let o=typeof e=="string"?e:String(e);r===this.endNode.previousSibling&&r.nodeType===3?r.data=o:this.__commitNode(document.createTextNode(o)),this.value=e}__commitTemplateResult(e){let r=this.options.templateFactory(e);if(this.value instanceof ae&&this.value.template===r)this.value.update(e.values);else{let o=new ae(r,e.processor,this.options),s=o._clone();o.update(e.values),this.__commitNode(s),this.value=o}}__commitIterable(e){Array.isArray(this.value)||(this.value=[],this.clear());let r=this.value,o=0,s;for(let i of e)s=r[o],s===void 0&&(s=new J(this.options),r.push(s),o===0?s.appendIntoPart(this):s.insertAfterPart(r[o-1])),s.setValue(i),s.commit(),o++;o<r.length&&(r.length=o,this.clear(s&&s.endNode))}clear(e=this.startNode){Ee(this.startNode.parentNode,e.nextSibling,this.endNode)}};n(J,"NodePart");ct=class{constructor(e,r,o){if(this.value=void 0,this.__pendingValue=void 0,o.length!==2||o[0]!==""||o[1]!=="")throw new Error("Boolean attributes can only contain a single expression");this.element=e,this.name=r,this.strings=o}setValue(e){this.__pendingValue=e}commit(){for(;ve(this.__pendingValue);){let r=this.__pendingValue;this.__pendingValue=q,r(this)}if(this.__pendingValue===q)return;let e=!!this.__pendingValue;this.value!==e&&(e?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=e),this.__pendingValue=q}};n(ct,"BooleanAttributePart");lt=class extends je{constructor(e,r,o){super(e,r,o);this.single=o.length===2&&o[0]===""&&o[1]===""}_createPart(){return new rr(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}};n(lt,"PropertyCommitter");rr=class extends at{};n(rr,"PropertyPart");Ns=!1;(()=>{try{let t={get capture(){return Ns=!0,!1}};window.addEventListener("test",t,t),window.removeEventListener("test",t,t)}catch{}})();ut=class{constructor(e,r,o){this.value=void 0,this.__pendingValue=void 0,this.element=e,this.eventName=r,this.eventContext=o,this.__boundHandleEvent=s=>this.handleEvent(s)}setValue(e){this.__pendingValue=e}commit(){for(;ve(this.__pendingValue);){let i=this.__pendingValue;this.__pendingValue=q,i(this)}if(this.__pendingValue===q)return;let e=this.__pendingValue,r=this.value,o=e==null||r!=null&&(e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive),s=e!=null&&(r==null||o);o&&this.element.removeEventListener(this.eventName,this.__boundHandleEvent,this.__options),s&&(this.__options=ll(e),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=e,this.__pendingValue=q}handleEvent(e){typeof this.value=="function"?this.value.call(this.eventContext||this.element,e):this.value.handleEvent(e)}};n(ut,"EventPart");ll=n(t=>t&&(Ns?{capture:t.capture,passive:t.passive,once:t.once}:t.capture),"getOptions")});function uo(t){let e=we.get(t.type);e===void 0&&(e={stringsArray:new WeakMap,keyString:new Map},we.set(t.type,e));let r=e.stringsArray.get(t.strings);if(r!==void 0)return r;let o=t.strings.join(F);return r=e.keyString.get(o),r===void 0&&(r=new Se(t,t.getTemplateElement()),e.keyString.set(o,r)),e.stringsArray.set(t.strings,r),r}var we,nr=u(()=>{ie();n(uo,"templateFactory");we=new Map});var ce,po,fo=u(()=>{xe();or();nr();ce=new WeakMap,po=n((t,e,r)=>{let o=ce.get(e);o===void 0&&(Ee(e,e.firstChild),ce.set(e,o=new J(Object.assign({templateFactory:uo},r))),o.appendInto(e)),o.setValue(t),o.commit()},"render")});var sr,ho,mo=u(()=>{or();sr=class{handleAttributeExpressions(e,r,o,s){let i=r[0];return i==="."?new lt(e,r.slice(1),o).parts:i==="@"?[new ut(e,r.slice(1),s.eventContext)]:i==="?"?[new ct(e,r.slice(1),o)]:new je(e,r,o).parts}handleTextExpression(e){return new J(e)}};n(sr,"DefaultTemplateProcessor");ho=new sr});var p,go=u(()=>{mo();Xt();mo();co();xe();lo();or();fo();nr();Zt();Xt();ie();typeof window!="undefined"&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.3.0");p=n((t,...e)=>new Q(t,e,"html",ho),"html")});var qs,ir,pl,dl,fl,Is,hl,Us,Fs=u(()=>{xe();Rs();fo();nr();Zt();ie();go();qs=n((t,e)=>`${t}--${e}`,"getTemplateCacheKey"),ir=!0;typeof window.ShadyCSS=="undefined"?ir=!1:typeof window.ShadyCSS.prepareTemplateDom=="undefined"&&(console.warn("Incompatible ShadyCSS version detected. Please update to at least @webcomponents/webcomponentsjs@2.0.2 and @webcomponents/shadycss@1.3.1."),ir=!1);pl=n(t=>e=>{let r=qs(e.type,t),o=we.get(r);o===void 0&&(o={stringsArray:new WeakMap,keyString:new Map},we.set(r,o));let s=o.stringsArray.get(e.strings);if(s!==void 0)return s;let i=e.strings.join(F);if(s=o.keyString.get(i),s===void 0){let a=e.getTemplateElement();ir&&window.ShadyCSS.prepareTemplateDom(a,t),s=new Se(e,a),o.keyString.set(i,s)}return o.stringsArray.set(e.strings,s),s},"shadyTemplateFactory"),dl=["html","svg"],fl=n(t=>{dl.forEach(e=>{let r=we.get(qs(e,t));r!==void 0&&r.keyString.forEach(o=>{let{element:{content:s}}=o,i=new Set;Array.from(s.querySelectorAll("style")).forEach(a=>{i.add(a)}),ao(o,i)})})},"removeStylesFromLitTemplates"),Is=new Set,hl=n((t,e,r)=>{Is.add(t);let o=r?r.element:document.createElement("template"),s=e.querySelectorAll("style"),{length:i}=s;if(i===0){window.ShadyCSS.prepareTemplateStyles(o,t);return}let a=document.createElement("style");for(let f=0;f<i;f++){let y=s[f];y.parentNode.removeChild(y),a.textContent+=y.textContent}fl(t);let c=o.content;r?Ps(r,a,c.firstChild):c.insertBefore(a,c.firstChild),window.ShadyCSS.prepareTemplateStyles(o,t);let l=c.querySelector("style");if(window.ShadyCSS.nativeShadow&&l!==null)e.insertBefore(l.cloneNode(!0),e.firstChild);else if(r){c.insertBefore(a,c.firstChild);let f=new Set;f.add(a),ao(r,f)}},"prepareTemplateStyles"),Us=n((t,e,r)=>{if(!r||typeof r!="object"||!r.scopeName)throw new Error("The `scopeName` option is required.");let o=r.scopeName,s=ce.has(e),i=ir&&e.nodeType===11&&!!e.host,a=i&&!Is.has(o),c=a?document.createDocumentFragment():e;if(po(t,c,Object.assign({templateFactory:pl(o)},r)),a){let l=ce.get(c);ce.delete(c);let f=l.value instanceof ae?l.value.template:void 0;hl(o,c,f),Ee(e,e.firstChild),e.appendChild(c),ce.set(e,l)}!s&&i&&window.ShadyCSS.styleElement(e.host)},"render")});var Ds,yo,Ls,bo,_o,Eo,xo,So,vo,pt,wo=u(()=>{window.JSCompiler_renameProperty=(t,e)=>t;yo={toAttribute(t,e){switch(e){case Boolean:return t?"":null;case Object:case Array:return t==null?t:JSON.stringify(t)}return t},fromAttribute(t,e){switch(e){case Boolean:return t!==null;case Number:return t===null?null:Number(t);case Object:case Array:return JSON.parse(t)}return t}},Ls=n((t,e)=>e!==t&&(e===e||t===t),"notEqual"),bo={attribute:!0,type:String,converter:yo,reflect:!1,hasChanged:Ls},_o=1,Eo=1<<2,xo=1<<3,So=1<<4,vo="finalized",pt=class extends HTMLElement{constructor(){super();this.initialize()}static get observedAttributes(){this.finalize();let e=[];return this._classProperties.forEach((r,o)=>{let s=this._attributeNameForProperty(o,r);s!==void 0&&(this._attributeToPropertyMap.set(s,o),e.push(s))}),e}static _ensureClassProperties(){if(!this.hasOwnProperty(JSCompiler_renameProperty("_classProperties",this))){this._classProperties=new Map;let e=Object.getPrototypeOf(this)._classProperties;e!==void 0&&e.forEach((r,o)=>this._classProperties.set(o,r))}}static createProperty(e,r=bo){if(this._ensureClassProperties(),this._classProperties.set(e,r),r.noAccessor||this.prototype.hasOwnProperty(e))return;let o=typeof e=="symbol"?Symbol():`__${e}`,s=this.getPropertyDescriptor(e,o,r);s!==void 0&&Object.defineProperty(this.prototype,e,s)}static getPropertyDescriptor(e,r,o){return{get(){return this[r]},set(s){let i=this[e];this[r]=s,this.requestUpdateInternal(e,i,o)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this._classProperties&&this._classProperties.get(e)||bo}static finalize(){let e=Object.getPrototypeOf(this);if(e.hasOwnProperty(vo)||e.finalize(),this[vo]=!0,this._ensureClassProperties(),this._attributeToPropertyMap=new Map,this.hasOwnProperty(JSCompiler_renameProperty("properties",this))){let r=this.properties,o=[...Object.getOwnPropertyNames(r),...typeof Object.getOwnPropertySymbols=="function"?Object.getOwnPropertySymbols(r):[]];for(let s of o)this.createProperty(s,r[s])}}static _attributeNameForProperty(e,r){let o=r.attribute;return o===!1?void 0:typeof o=="string"?o:typeof e=="string"?e.toLowerCase():void 0}static _valueHasChanged(e,r,o=Ls){return o(e,r)}static _propertyValueFromAttribute(e,r){let o=r.type,s=r.converter||yo,i=typeof s=="function"?s:s.fromAttribute;return i?i(e,o):e}static _propertyValueToAttribute(e,r){if(r.reflect===void 0)return;let o=r.type,s=r.converter;return(s&&s.toAttribute||yo.toAttribute)(e,o)}initialize(){this._updateState=0,this._updatePromise=new Promise(e=>this._enableUpdatingResolver=e),this._changedProperties=new Map,this._saveInstanceProperties(),this.requestUpdateInternal()}_saveInstanceProperties(){this.constructor._classProperties.forEach((e,r)=>{if(this.hasOwnProperty(r)){let o=this[r];delete this[r],this._instanceProperties||(this._instanceProperties=new Map),this._instanceProperties.set(r,o)}})}_applyInstanceProperties(){this._instanceProperties.forEach((e,r)=>this[r]=e),this._instanceProperties=void 0}connectedCallback(){this.enableUpdating()}enableUpdating(){this._enableUpdatingResolver!==void 0&&(this._enableUpdatingResolver(),this._enableUpdatingResolver=void 0)}disconnectedCallback(){}attributeChangedCallback(e,r,o){r!==o&&this._attributeToProperty(e,o)}_propertyToAttribute(e,r,o=bo){let s=this.constructor,i=s._attributeNameForProperty(e,o);if(i!==void 0){let a=s._propertyValueToAttribute(r,o);if(a===void 0)return;this._updateState=this._updateState|xo,a==null?this.removeAttribute(i):this.setAttribute(i,a),this._updateState=this._updateState&~xo}}_attributeToProperty(e,r){if(this._updateState&xo)return;let o=this.constructor,s=o._attributeToPropertyMap.get(e);if(s!==void 0){let i=o.getPropertyOptions(s);this._updateState=this._updateState|So,this[s]=o._propertyValueFromAttribute(r,i),this._updateState=this._updateState&~So}}requestUpdateInternal(e,r,o){let s=!0;if(e!==void 0){let i=this.constructor;o=o||i.getPropertyOptions(e),i._valueHasChanged(this[e],r,o.hasChanged)?(this._changedProperties.has(e)||this._changedProperties.set(e,r),o.reflect===!0&&!(this._updateState&So)&&(this._reflectingProperties===void 0&&(this._reflectingProperties=new Map),this._reflectingProperties.set(e,o))):s=!1}!this._hasRequestedUpdate&&s&&(this._updatePromise=this._enqueueUpdate())}requestUpdate(e,r){return this.requestUpdateInternal(e,r),this.updateComplete}async _enqueueUpdate(){this._updateState=this._updateState|Eo;try{await this._updatePromise}catch{}let e=this.performUpdate();return e!=null&&await e,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return this._updateState&Eo}get hasUpdated(){return this._updateState&_o}performUpdate(){if(!this._hasRequestedUpdate)return;this._instanceProperties&&this._applyInstanceProperties();let e=!1,r=this._changedProperties;try{e=this.shouldUpdate(r),e?this.update(r):this._markUpdated()}catch(o){throw e=!1,this._markUpdated(),o}e&&(this._updateState&_o||(this._updateState=this._updateState|_o,this.firstUpdated(r)),this.updated(r))}_markUpdated(){this._changedProperties=new Map,this._updateState=this._updateState&~Eo}get updateComplete(){return this._getUpdateComplete()}_getUpdateComplete(){return this._updatePromise}shouldUpdate(e){return!0}update(e){this._reflectingProperties!==void 0&&this._reflectingProperties.size>0&&(this._reflectingProperties.forEach((r,o)=>this._propertyToAttribute(o,this[o],r)),this._reflectingProperties=void 0),this._markUpdated()}updated(e){}firstUpdated(e){}};n(pt,"UpdatingElement");Ds=vo;pt[Ds]=!0});var js,id,Ms=u(()=>{js=Element.prototype,id=js.msMatchesSelector||js.webkitMatchesSelector});var ar,To,dt,Vs,ml,T,Oo=u(()=>{ar=window.ShadowRoot&&(window.ShadyCSS===void 0||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,To=Symbol(),dt=class{constructor(e,r){if(r!==To)throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e}get styleSheet(){return this._styleSheet===void 0&&(ar?(this._styleSheet=new CSSStyleSheet,this._styleSheet.replaceSync(this.cssText)):this._styleSheet=null),this._styleSheet}toString(){return this.cssText}};n(dt,"CSSResult");Vs=n(t=>new dt(String(t),To),"unsafeCSS"),ml=n(t=>{if(t instanceof dt)return t.cssText;if(typeof t=="number")return t;throw new Error(`Value passed to 'css' function must be a 'css' function result: ${t}. Use 'unsafeCSS' to pass non-literal values, but
|
|
12
|
-
take care to ensure page security.`)},"textFromCSSResult"),
|
|
11
|
+
var lib=(()=>{var Zs=Object.create;var ke=Object.defineProperty;var Xs=Object.getOwnPropertyDescriptor;var ei=Object.getOwnPropertyNames;var ti=Object.getPrototypeOf,ri=Object.prototype.hasOwnProperty;var mo=t=>ke(t,"__esModule",{value:!0}),n=(t,e)=>ke(t,"name",{value:e,configurable:!0}),oi=(t=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(t,{get:(e,r)=>(typeof require!="undefined"?require:e)[r]}):t)(function(t){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+t+'" is not supported')});var S=(t,e)=>()=>(t&&(e=t(t=0)),e);var te=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Xt=(t,e)=>{mo(t);for(var r in e)ke(t,r,{get:e[r],enumerable:!0})},ni=(t,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of ei(e))!ri.call(t,o)&&o!=="default"&&ke(t,o,{get:()=>e[o],enumerable:!(r=Xs(e,o))||r.enumerable});return t},re=t=>ni(mo(ke(t!=null?Zs(ti(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var oe,ne,se,ot,Po,q,qe,nt,st,Ro,it,_e,Ao,at,ct,No,lt,ut,pt,ko,Io,dt,qo,ft,xe,Uo,ht,mt,Ue,Fe,gt,yt,ie,G,bt,_t,xt,ae=S(()=>{oe="OPTIN_PRODUCT",ne="OPTOUT_PRODUCT",se="PRODUCT_CHANGE_FREQUENCY",ot="SET_MERCHANT_ID",Po="REQUEST_OFFER",q="RECEIVE_OFFER",qe="PRODUCT_HAS_CHANGED",nt="CREATED_SESSION_ID",st="SET_AUTH_URL",Ro="REQUEST_AUTH",it="AUTHORIZE",_e="UNAUTHORIZED",Ao="REQUEST_ORDERS",at="RECEIVE_ORDERS",ct="RECEIVE_ORDER_ITEMS",No="FETCH_RESPONSE_ERROR",lt="SET_ENVIRONMENT_STAGING",ut="SET_ENVIRONMENT_DEV",pt="SET_ENVIRONMENT_PROD",ko="CONCLUDE_UPSELL",Io="REQUEST_CREATE_IU_ORDER",dt="CREATE_ONE_TIME",qo="REQUEST_CONVERT_ONE_TIME",ft="CONVERT_ONE_TIME",xe="CHECKOUT",Uo="RECEIVE_FETCH",ht="SET_LOCALE",mt="SET_CONFIG",Ue="SET_PREVIEW_STANDARD_OFFER",Fe="SET_PREVIEW_UPSELL_OFFER",gt="ADD_TEMPLATE",yt="SET_TEMPLATES",ie="LOCAL_STORAGE_CHANGE",G="LOCAL_STORAGE_CLEAR",bt="SET_FIRST_ORDER_PLACE_DATE",_t="SET_PRODUCT_TO_SUBSCRIBE",xt="RECEIVE_PRODUCT_PLANS"});var vt=te((Jc,Bo)=>{var xi="Expected a function",Fo="__lodash_hash_undefined__",Ei="[object Function]",Si="[object GeneratorFunction]",vi=/[\\^$.*+?()[\]{}|]/g,wi=/^\[object .+?Constructor\]$/,Ti=typeof window=="object"&&window&&window.Object===Object&&window,Oi=typeof self=="object"&&self&&self.Object===Object&&self,Do=Ti||Oi||Function("return this")();function Ci(t,e){return t==null?void 0:t[e]}n(Ci,"getValue");function Pi(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}n(Pi,"isHostObject");var Ri=Array.prototype,Ai=Function.prototype,Lo=Object.prototype,ar=Do["__core-js_shared__"],jo=function(){var t=/[^.]+$/.exec(ar&&ar.keys&&ar.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),Mo=Ai.toString,cr=Lo.hasOwnProperty,Ni=Lo.toString,ki=RegExp("^"+Mo.call(cr).replace(vi,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ii=Ri.splice,qi=Vo(Do,"Map"),De=Vo(Object,"create");function ce(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(ce,"Hash");function Ui(){this.__data__=De?De(null):{}}n(Ui,"hashClear");function Fi(t){return this.has(t)&&delete this.__data__[t]}n(Fi,"hashDelete");function Di(t){var e=this.__data__;if(De){var r=e[t];return r===Fo?void 0:r}return cr.call(e,t)?e[t]:void 0}n(Di,"hashGet");function Li(t){var e=this.__data__;return De?e[t]!==void 0:cr.call(e,t)}n(Li,"hashHas");function ji(t,e){var r=this.__data__;return r[t]=De&&e===void 0?Fo:e,this}n(ji,"hashSet");ce.prototype.clear=Ui;ce.prototype.delete=Fi;ce.prototype.get=Di;ce.prototype.has=Li;ce.prototype.set=ji;function Se(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(Se,"ListCache");function Mi(){this.__data__=[]}n(Mi,"listCacheClear");function Vi(t){var e=this.__data__,r=Et(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():Ii.call(e,r,1),!0}n(Vi,"listCacheDelete");function $i(t){var e=this.__data__,r=Et(e,t);return r<0?void 0:e[r][1]}n($i,"listCacheGet");function Bi(t){return Et(this.__data__,t)>-1}n(Bi,"listCacheHas");function Hi(t,e){var r=this.__data__,o=Et(r,t);return o<0?r.push([t,e]):r[o][1]=e,this}n(Hi,"listCacheSet");Se.prototype.clear=Mi;Se.prototype.delete=Vi;Se.prototype.get=$i;Se.prototype.has=Bi;Se.prototype.set=Hi;function le(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(le,"MapCache");function zi(){this.__data__={hash:new ce,map:new(qi||Se),string:new ce}}n(zi,"mapCacheClear");function Gi(t){return St(this,t).delete(t)}n(Gi,"mapCacheDelete");function Wi(t){return St(this,t).get(t)}n(Wi,"mapCacheGet");function Yi(t){return St(this,t).has(t)}n(Yi,"mapCacheHas");function Qi(t,e){return St(this,t).set(t,e),this}n(Qi,"mapCacheSet");le.prototype.clear=zi;le.prototype.delete=Gi;le.prototype.get=Wi;le.prototype.has=Yi;le.prototype.set=Qi;function Et(t,e){for(var r=t.length;r--;)if(ea(t[r][0],e))return r;return-1}n(Et,"assocIndexOf");function Ji(t){if(!$o(t)||Zi(t))return!1;var e=ta(t)||Pi(t)?ki:wi;return e.test(Xi(t))}n(Ji,"baseIsNative");function St(t,e){var r=t.__data__;return Ki(e)?r[typeof e=="string"?"string":"hash"]:r.map}n(St,"getMapData");function Vo(t,e){var r=Ci(t,e);return Ji(r)?r:void 0}n(Vo,"getNative");function Ki(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}n(Ki,"isKeyable");function Zi(t){return!!jo&&jo in t}n(Zi,"isMasked");function Xi(t){if(t!=null){try{return Mo.call(t)}catch{}try{return t+""}catch{}}return""}n(Xi,"toSource");function lr(t,e){if(typeof t!="function"||e&&typeof e!="function")throw new TypeError(xi);var r=n(function(){var o=arguments,s=e?e.apply(this,o):o[0],i=r.cache;if(i.has(s))return i.get(s);var a=t.apply(this,o);return r.cache=i.set(s,a),a},"memoized");return r.cache=new(lr.Cache||le),r}n(lr,"memoize");lr.Cache=le;function ea(t,e){return t===e||t!==t&&e!==e}n(ea,"eq");function ta(t){var e=$o(t)?Ni.call(t):"";return e==Ei||e==Si}n(ta,"isFunction");function $o(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}n($o,"isObject");Bo.exports=lr});var wt,ur,Le,je,Tt,Ho,zo,ra,oa,na,sa,ia,Me,pr,aa,Go,Ve,ca,W,Y=S(()=>{wt=re(vt()),ur=n((...t)=>JSON.stringify(t),"memoizeKey"),Le=n(t=>(...e)=>fetch(...t(...e)).then(r=>r.json()),"withFetchJson"),je=n(t=>(e,...r)=>{if(!e)throw Error("host required");let[o,s={}]=t(...r);return[`${e.replace(/\/+$/,"")}${o}`,s]},"withHost"),Tt=n(t=>(e,...r)=>{if(!e)throw Error("auth required");let[o,s={}]=t(...r);return[o,{...s,headers:{Authorization:JSON.stringify(e),...s.headers}}]},"withAuth"),Ho=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"),zo=n((t=[])=>(Array.isArray(t)?t:Object.entries(t)).map(([e,r])=>[e,encodeURIComponent(r)].join("=")).join("&"),"toQuery"),ra=n(t=>JSON.stringify([].concat(t).map(e=>typeof e=="object"?e.id:e).filter(e=>e)),"toProductId"),oa=(0,wt.default)(Le(je((t,e,r,o="pdp")=>{if(!t)throw Error("merchantId required");if(!e)throw Error("sessionId required");if(!r)throw Error("product required");let s=zo([["session_id",e],["page_type",1],["p",ra(r)],["module_view",JSON.stringify(["regular"])]]);return[`/offer/${t}/${o}?${s}`]})),ur),na=(0,wt.default)(Le(je(Tt((t=1,e="place")=>[`/orders/?${zo([["status",t],["ordering",e]])}`]))),ur),sa=(0,wt.default)(Le(je(Tt(t=>{if(!t)throw Error("orderId required");return[`/items/?order=${t}`]}))),ur),ia=Le(je(Tt(Ho((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}}]})))),Me=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"),pr=n(t=>t.match(/^\d+_\d$/),"isFrequencyValid"),aa=n((t,e)=>String.prototype.localeCompare.call(t&&t.split("_").reverse().join("_"),e&&e.split("_").reverse().join("_")),"compareFrequencies"),Go=n(t=>[...new Set(t&&t.split(/\s+/))].filter(pr).sort(aa),"parseFrequenciesList"),Ve=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"),ca=Le(je(Tt(Ho((t,e,r)=>{if(!t)throw Error("item required");if(!e)throw Error("frequency required");let o=Me(e);if(!o)throw Error("invalid frequency");return["/subscriptions/create_from_item/",{body:{item:t.public_id,offer:r,...o}}]})))),W={fetchOffer:oa,fetchOrders:na,fetchItems:sa,createOneTime:ia,convertOneTimeToSubscription:ca}});var mr=te((Pt,Zo)=>{(function(t,e){typeof Pt=="object"&&typeof Zo!="undefined"?e(Pt):typeof define=="function"&&define.amd?define(["exports"],e):(t=t||self,e(t.throttleDebounce={}))})(Pt,function(t){"use strict";function e(o,s,i,a){var c,l=!1,d=0;function g(){c&&clearTimeout(c)}n(g,"clearExistingTimeout");function p(){g(),l=!0}n(p,"cancel"),typeof s!="boolean"&&(a=i,i=s,s=void 0);function m(){for(var E=arguments.length,y=new Array(E),f=0;f<E;f++)y[f]=arguments[f];var T=this,O=Date.now()-d;if(l)return;function b(){d=Date.now(),i.apply(T,y)}n(b,"exec");function P(){c=void 0}n(P,"clear"),a&&!c&&b(),g(),a===void 0&&O>o?b():s!==!0&&(c=setTimeout(a?P:b,a===void 0?o-O:o))}return n(m,"wrapper"),m.cancel=p,m}n(e,"throttle");function r(o,s,i){return i===void 0?e(o,s,!1):e(o,i,s!==!1)}n(r,"debounce"),t.debounce=r,t.throttle=e,Object.defineProperty(t,"__esModule",{value:!0})})});var Xo,Ua,Fa,Da,La,en,tn=S(()=>{Xo=/^og_auth=/,Ua=n((t=Xo)=>(document.cookie.split(/;\s*/).find(e=>e.match(t))||"").replace(Xo,""),"s"),Fa=n(t=>{if(typeof t=="object")return t;let e=(t||"").split("|");return e.length===3?{sig_field:e[0],ts:parseInt(e[1],10),sig:e[2]}:null},"i"),Da=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"),La=n(t=>(t.headers.get("content-type")||"").indexOf("application/json")!==-1,"c"),en=n((t,e=Ua,r=Da)=>Promise.resolve(e()||t&&typeof t=="string"&&fetch(t).then(o=>o.status>=200&&o.status<300?e()||(La(o)?o.json():Promise.resolve(r(t)).then(e)):null)).then(Fa).then(o=>o===null?Promise.reject(new Error("Unauthorized")):o),"l")});var Q,we,rn,Rt,on,nn,ja,Ma,gr,pe,sn,At,an,Va,yr,br,Nt,_r,kt,Te,xr,$a,cn,ln,Ba,Ha,za,Ga,un,pn,dn,fn,hn,mn,gn,N=S(()=>{tn();ae();Y();Q=n((t,e)=>({type:oe,payload:{product:t,frequency:e}}),"optinProduct"),we=n(t=>({type:ne,payload:{product:t}}),"optoutProduct"),rn=n((t,e)=>({type:qe,payload:{newProduct:t,product:e}}),"productHasChangedComponents"),Rt=n((t,e)=>({type:se,payload:{product:t,frequency:e}}),"productChangeFrequency"),on=n(t=>({type:ko,payload:{product:t}}),"concludeUpsell"),nn=n(t=>({type:ot,payload:t}),"setMerchantId"),ja=n(t=>({type:nt,payload:`${t}.${Math.floor(Math.random()*999999)}.${Math.round(new Date().getTime()/1e3)}`}),"createSessionId"),Ma=n(t=>({type:Ro,payload:t}),"requestAuth"),gr=n((t,e,r,o)=>({type:it,payload:{public_id:t,sig_field:e,ts:r,sig:o}}),"authorize"),pe=n(t=>({type:_e,payload:t}),"unauthorized"),sn=n(t=>({type:st,payload:t}),"setAuthUrl"),At=n(t=>({type:Uo,payload:t}),"fetchDone"),an=n((t=en)=>n(function(r,o){if(window.og&&window.og.previewMode)return r(pe({message:"Offers are running in preview mode"}));let{merchantId:s,authUrl:i}=o(),a=Ma(i);return r(a),t(i).then(({sig_field:c,ts:l,sig:d})=>r(gr(s,c,l,d)),c=>r(pe(c))).finally(()=>r(At(a)))},"fetchAuthThunk"),"fetchAuth"),Va=n((t,e)=>({type:Ao,payload:{status:t,ordering:e}}),"requestOrders"),yr=n(t=>({type:at,payload:t}),"receiveOrders"),br=n(t=>({type:ct,payload:t}),"receiveItems"),Nt=n((t=1,e="place")=>n(function(o,s){let{environment:{legoUrl:i},auth:a}=s();if(!a)return o(pe("No auth set."));let c=Va(t,e);return o(c),W.fetchOrders(i,a,t,e).then(l=>{o(yr(l));let d=(l.results[0]||{}).public_id;return d?W.fetchItems(i,a,d).then(g=>o(br(g))):null},l=>o(pe(l))).finally(()=>o(At(c)))},"fetchOrdersThunk"),"fetchOrders"),_r=n(t=>{switch(t){case"dev":return{type:ut,payload:t};case"staging":return{type:lt,payload:t};case"prod":return{type:pt,payload:t};default:throw new Error(`${t} is not a supported environment`)}},"setEnvironment"),kt=n(()=>(t,e)=>{let{merchantId:r,sessionId:o}=e();return(!o||r&&!o.startsWith(r))&&t(ja(r)),o},"requestSessionId"),Te=n(t=>({type:q,payload:t}),"receiveOffer"),xr=n(t=>({type:No,payload:t}),"fetchResponseError"),$a=n((t,e="pdp")=>({type:Po,payload:{product:t,module:e}}),"requestOffer"),cn=n((t,e="pdp")=>n(function(o,s){let{merchantId:i,sessionId:a,environment:{apiUrl:c}}=s(),l=$a(t,e);return o(l),W.fetchOffer(c,i,a,t,e).then(d=>o(Te(d)),d=>o(xr(d))).finally(()=>o(At(l)))},"fetchOfferThunk"),"fetchOffer"),ln=n(()=>({type:xe}),"checkout"),Ba=n((t,e,r,o)=>({type:Io,payload:{product:t,order:e,quantity:r,offerId:o}}),"requestCreateOneTime"),Ha=n(t=>({type:dt,payload:t}),"receiveCreateOneTime"),za=n((t,e)=>({type:qo,payload:{item:t,frequency:e}}),"requestConvertOneTimeToSubscription"),Ga=n((t,e)=>({type:ft,payload:{response:t,product:e}}),"receiveConvertOneTime"),un=n((t,e,r,o=!1,s=null)=>n(function(a,c){let{auth:l,environment:{legoUrl:d},previewUpsellOffer:g,offerId:p}=c();if(!l)return a(pe("No auth set."));let m=Ba(t,e,r,p);return a(m),(g?Promise.resolve({legoUrl:d,product:t,order:e,quantity:r,offer:p}):W.createOneTime(d,l,t.id,e,r,p)).then(E=>(a(Ha(E)),o?(a(za(E,s)),(g?Promise.resolve({item:E,frequency:s}):W.convertOneTimeToSubscription(d,l,E,s,p)).then(y=>a(Ga(y,t)),y=>a(xr(y)))):E),E=>a(xr(E))).finally(()=>a(At(m)))},"createIuThunk"),"createIu"),pn=n(t=>({type:ht,payload:t}),"setLocale"),dn=n(t=>({type:mt,payload:t}),"setConfig"),fn=n((t,e,r)=>({type:gt,payload:{selector:t,markup:e,config:r}}),"addTemplate"),hn=n(t=>({type:yt,payload:t}),"setTemplates"),mn=n((t,e)=>({type:bt,payload:{product:t,firstOrderPlaceDate:e}}),"setFirstOrderPlaceDate"),gn=n((t,e)=>({type:_t,payload:{product:t,productToSubscribe:e}}),"setProductToSubscribe")});var vr,de,fe=S(()=>{vr=typeof window!="undefined"&&window.customElements!=null&&window.customElements.polyfillWrapFlushCallback!==void 0,de=n((t,e,r=null)=>{for(;e!==r;){let o=e.nextSibling;t.removeChild(e),e=o}},"removeNodes")});var U,wr,Cn,Oe,he,Pn,Be,V,It,J=S(()=>{U=`{{lit-${String(Math.random()).slice(2)}}}`,wr=`<!--${U}-->`,Cn=new RegExp(`${U}|${wr}`),Oe="$lit$",he=class{constructor(e,r){this.parts=[],this.element=r;let o=[],s=[],i=document.createTreeWalker(r.content,133,null,!1),a=0,c=-1,l=0,{strings:d,values:{length:g}}=e;for(;l<g;){let p=i.nextNode();if(p===null){i.currentNode=s.pop();continue}if(c++,p.nodeType===1){if(p.hasAttributes()){let m=p.attributes,{length:E}=m,y=0;for(let f=0;f<E;f++)Pn(m[f].name,Oe)&&y++;for(;y-- >0;){let f=d[l],T=It.exec(f)[2],O=T.toLowerCase()+Oe,b=p.getAttribute(O);p.removeAttribute(O);let P=b.split(Cn);this.parts.push({type:"attribute",index:c,name:T,strings:P}),l+=P.length-1}}p.tagName==="TEMPLATE"&&(s.push(p),i.currentNode=p.content)}else if(p.nodeType===3){let m=p.data;if(m.indexOf(U)>=0){let E=p.parentNode,y=m.split(Cn),f=y.length-1;for(let T=0;T<f;T++){let O,b=y[T];if(b==="")O=V();else{let P=It.exec(b);P!==null&&Pn(P[2],Oe)&&(b=b.slice(0,P.index)+P[1]+P[2].slice(0,-Oe.length)+P[3]),O=document.createTextNode(b)}E.insertBefore(O,p),this.parts.push({type:"node",index:++c})}y[f]===""?(E.insertBefore(V(),p),o.push(p)):p.data=y[f],l+=f}}else if(p.nodeType===8)if(p.data===U){let m=p.parentNode;(p.previousSibling===null||c===a)&&(c++,m.insertBefore(V(),p)),a=c,this.parts.push({type:"node",index:c}),p.nextSibling===null?p.data="":(o.push(p),c--),l++}else{let m=-1;for(;(m=p.data.indexOf(U,m+1))!==-1;)this.parts.push({type:"node",index:-1}),l++}}for(let p of o)p.parentNode.removeChild(p)}};n(he,"Template");Pn=n((t,e)=>{let r=t.length-e.length;return r>=0&&t.slice(r)===e},"endsWith"),Be=n(t=>t.index!==-1,"isTemplatePartActive"),V=n(()=>document.createComment(""),"createMarker"),It=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/});function Or(t,e){let{element:{content:r},parts:o}=t,s=document.createTreeWalker(r,Tr,null,!1),i=He(o),a=o[i],c=-1,l=0,d=[],g=null;for(;s.nextNode();){c++;let p=s.currentNode;for(p.previousSibling===g&&(g=null),e.has(p)&&(d.push(p),g===null&&(g=p)),g!==null&&l++;a!==void 0&&a.index===c;)a.index=g!==null?-1:a.index-l,i=He(o,i),a=o[i]}d.forEach(p=>p.parentNode.removeChild(p))}function Rn(t,e,r=null){let{element:{content:o},parts:s}=t;if(r==null){o.appendChild(e);return}let i=document.createTreeWalker(o,Tr,null,!1),a=He(s),c=0,l=-1;for(;i.nextNode();)for(l++,i.currentNode===r&&(c=Ja(e),r.parentNode.insertBefore(e,r));a!==-1&&s[a].index===l;){if(c>0){for(;a!==-1;)s[a].index+=c,a=He(s,a);return}a=He(s,a)}}var Tr,Ja,He,An=S(()=>{J();Tr=133;n(Or,"removeNodesFromTemplate");Ja=n(t=>{let e=t.nodeType===11?0:1,r=document.createTreeWalker(t,Tr,null,!1);for(;r.nextNode();)e++;return e},"countNodes"),He=n((t,e=-1)=>{for(let r=e+1;r<t.length;r++){let o=t[r];if(Be(o))return r}return-1},"nextActiveIndexInTemplateParts");n(Rn,"insertNodeIntoTemplate")});var Ka,me,Cr=S(()=>{Ka=new WeakMap,me=n(t=>typeof t=="function"&&Ka.has(t),"isDirective")});var k,qt,Pr=S(()=>{k={},qt={}});var K,Ut=S(()=>{fe();J();K=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=vr?this.template.element.content.cloneNode(!0):document.importNode(this.template.element.content,!0),r=[],o=this.template.parts,s=document.createTreeWalker(e,133,null,!1),i=0,a=0,c,l=s.nextNode();for(;i<o.length;){if(c=o[i],!Be(c)){this.__parts.push(void 0),i++;continue}for(;a<c.index;)a++,l.nodeName==="TEMPLATE"&&(r.push(l),s.currentNode=l.content),(l=s.nextNode())===null&&(s.currentNode=r.pop(),l=s.nextNode());if(c.type==="node"){let d=this.processor.handleTextExpression(this.options);d.insertAfterNode(l.previousSibling),this.__parts.push(d)}else this.__parts.push(...this.processor.handleAttributeExpressions(l,c.name,c.strings,this.options));i++}return vr&&(document.adoptNode(e),customElements.upgrade(e)),e}};n(K,"TemplateInstance")});var Nn,Xa,B,Ft=S(()=>{fe();J();Nn=window.trustedTypes&&trustedTypes.createPolicy("lit-html",{createHTML:t=>t}),Xa=` ${U} `,B=class{constructor(e,r,o,s){this.strings=e,this.values=r,this.type=o,this.processor=s}getHTML(){let e=this.strings.length-1,r="",o=!1;for(let s=0;s<e;s++){let i=this.strings[s],a=i.lastIndexOf("<!--");o=(a>-1||o)&&i.indexOf("-->",a+1)===-1;let c=It.exec(i);c===null?r+=i+(o?Xa:wr):r+=i.substr(0,c.index)+c[1]+c[2]+Oe+c[3]+U}return r+=this.strings[e],r}getTemplateElement(){let e=document.createElement("template"),r=this.getHTML();return Nn!==void 0&&(r=Nn.createHTML(r)),e.innerHTML=r,e}};n(B,"TemplateResult")});var Dt,Lt,Ce,ze,H,Ge,We,jt,kn,Ye,ec,Mt=S(()=>{Cr();fe();Pr();Ut();Ft();J();Dt=n(t=>t===null||!(typeof t=="object"||typeof t=="function"),"isPrimitive"),Lt=n(t=>Array.isArray(t)||!!(t&&t[Symbol.iterator]),"isIterable"),Ce=class{constructor(e,r,o){this.dirty=!0,this.element=e,this.name=r,this.strings=o,this.parts=[];for(let s=0;s<o.length-1;s++)this.parts[s]=this._createPart()}_createPart(){return new ze(this)}_getValue(){let e=this.strings,r=e.length-1,o=this.parts;if(r===1&&e[0]===""&&e[1]===""){let i=o[0].value;if(typeof i=="symbol")return String(i);if(typeof i=="string"||!Lt(i))return i}let s="";for(let i=0;i<r;i++){s+=e[i];let a=o[i];if(a!==void 0){let c=a.value;if(Dt(c)||!Lt(c))s+=typeof c=="string"?c:String(c);else for(let l of c)s+=typeof l=="string"?l:String(l)}}return s+=e[r],s}commit(){this.dirty&&(this.dirty=!1,this.element.setAttribute(this.name,this._getValue()))}};n(Ce,"AttributeCommitter");ze=class{constructor(e){this.value=void 0,this.committer=e}setValue(e){e!==k&&(!Dt(e)||e!==this.value)&&(this.value=e,me(e)||(this.committer.dirty=!0))}commit(){for(;me(this.value);){let e=this.value;this.value=k,e(this)}this.value!==k&&this.committer.commit()}};n(ze,"AttributePart");H=class{constructor(e){this.value=void 0,this.__pendingValue=void 0,this.options=e}appendInto(e){this.startNode=e.appendChild(V()),this.endNode=e.appendChild(V())}insertAfterNode(e){this.startNode=e,this.endNode=e.nextSibling}appendIntoPart(e){e.__insert(this.startNode=V()),e.__insert(this.endNode=V())}insertAfterPart(e){e.__insert(this.startNode=V()),this.endNode=e.endNode,e.endNode=this.startNode}setValue(e){this.__pendingValue=e}commit(){if(this.startNode.parentNode===null)return;for(;me(this.__pendingValue);){let r=this.__pendingValue;this.__pendingValue=k,r(this)}let e=this.__pendingValue;e!==k&&(Dt(e)?e!==this.value&&this.__commitText(e):e instanceof B?this.__commitTemplateResult(e):e instanceof Node?this.__commitNode(e):Lt(e)?this.__commitIterable(e):e===qt?(this.value=qt,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 K&&this.value.template===r)this.value.update(e.values);else{let o=new K(r,e.processor,this.options),s=o._clone();o.update(e.values),this.__commitNode(s),this.value=o}}__commitIterable(e){Array.isArray(this.value)||(this.value=[],this.clear());let r=this.value,o=0,s;for(let i of e)s=r[o],s===void 0&&(s=new H(this.options),r.push(s),o===0?s.appendIntoPart(this):s.insertAfterPart(r[o-1])),s.setValue(i),s.commit(),o++;o<r.length&&(r.length=o,this.clear(s&&s.endNode))}clear(e=this.startNode){de(this.startNode.parentNode,e.nextSibling,this.endNode)}};n(H,"NodePart");Ge=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(;me(this.__pendingValue);){let r=this.__pendingValue;this.__pendingValue=k,r(this)}if(this.__pendingValue===k)return;let e=!!this.__pendingValue;this.value!==e&&(e?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=e),this.__pendingValue=k}};n(Ge,"BooleanAttributePart");We=class extends Ce{constructor(e,r,o){super(e,r,o);this.single=o.length===2&&o[0]===""&&o[1]===""}_createPart(){return new jt(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}};n(We,"PropertyCommitter");jt=class extends ze{};n(jt,"PropertyPart");kn=!1;(()=>{try{let t={get capture(){return kn=!0,!1}};window.addEventListener("test",t,t),window.removeEventListener("test",t,t)}catch{}})();Ye=class{constructor(e,r,o){this.value=void 0,this.__pendingValue=void 0,this.element=e,this.eventName=r,this.eventContext=o,this.__boundHandleEvent=s=>this.handleEvent(s)}setValue(e){this.__pendingValue=e}commit(){for(;me(this.__pendingValue);){let i=this.__pendingValue;this.__pendingValue=k,i(this)}if(this.__pendingValue===k)return;let e=this.__pendingValue,r=this.value,o=e==null||r!=null&&(e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive),s=e!=null&&(r==null||o);o&&this.element.removeEventListener(this.eventName,this.__boundHandleEvent,this.__options),s&&(this.__options=ec(e),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=e,this.__pendingValue=k}handleEvent(e){typeof this.value=="function"?this.value.call(this.eventContext||this.element,e):this.value.handleEvent(e)}};n(Ye,"EventPart");ec=n(t=>t&&(kn?{capture:t.capture,passive:t.passive,once:t.once}:t.capture),"getOptions")});function Rr(t){let e=ge.get(t.type);e===void 0&&(e={stringsArray:new WeakMap,keyString:new Map},ge.set(t.type,e));let r=e.stringsArray.get(t.strings);if(r!==void 0)return r;let o=t.strings.join(U);return r=e.keyString.get(o),r===void 0&&(r=new he(t,t.getTemplateElement()),e.keyString.set(o,r)),e.stringsArray.set(t.strings,r),r}var ge,Vt=S(()=>{J();n(Rr,"templateFactory");ge=new Map});var Z,Ar,Nr=S(()=>{fe();Mt();Vt();Z=new WeakMap,Ar=n((t,e,r)=>{let o=Z.get(e);o===void 0&&(de(e,e.firstChild),Z.set(e,o=new H(Object.assign({templateFactory:Rr},r))),o.appendInto(e)),o.setValue(t),o.commit()},"render")});var $t,kr,Ir=S(()=>{Mt();$t=class{handleAttributeExpressions(e,r,o,s){let i=r[0];return i==="."?new We(e,r.slice(1),o).parts:i==="@"?[new Ye(e,r.slice(1),s.eventContext)]:i==="?"?[new Ge(e,r.slice(1),o)]:new Ce(e,r,o).parts}handleTextExpression(e){return new H(e)}};n($t,"DefaultTemplateProcessor");kr=new $t});var u,qr=S(()=>{Ir();Ft();Ir();Cr();fe();Pr();Mt();Nr();Vt();Ut();Ft();J();typeof window!="undefined"&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.3.0");u=n((t,...e)=>new B(t,e,"html",kr),"html")});var qn,Bt,rc,oc,nc,Un,sc,Fn,Dn=S(()=>{fe();An();Nr();Vt();Ut();J();qr();qn=n((t,e)=>`${t}--${e}`,"getTemplateCacheKey"),Bt=!0;typeof window.ShadyCSS=="undefined"?Bt=!1:typeof window.ShadyCSS.prepareTemplateDom=="undefined"&&(console.warn("Incompatible ShadyCSS version detected. Please update to at least @webcomponents/webcomponentsjs@2.0.2 and @webcomponents/shadycss@1.3.1."),Bt=!1);rc=n(t=>e=>{let r=qn(e.type,t),o=ge.get(r);o===void 0&&(o={stringsArray:new WeakMap,keyString:new Map},ge.set(r,o));let s=o.stringsArray.get(e.strings);if(s!==void 0)return s;let i=e.strings.join(U);if(s=o.keyString.get(i),s===void 0){let a=e.getTemplateElement();Bt&&window.ShadyCSS.prepareTemplateDom(a,t),s=new he(e,a),o.keyString.set(i,s)}return o.stringsArray.set(e.strings,s),s},"shadyTemplateFactory"),oc=["html","svg"],nc=n(t=>{oc.forEach(e=>{let r=ge.get(qn(e,t));r!==void 0&&r.keyString.forEach(o=>{let{element:{content:s}}=o,i=new Set;Array.from(s.querySelectorAll("style")).forEach(a=>{i.add(a)}),Or(o,i)})})},"removeStylesFromLitTemplates"),Un=new Set,sc=n((t,e,r)=>{Un.add(t);let o=r?r.element:document.createElement("template"),s=e.querySelectorAll("style"),{length:i}=s;if(i===0){window.ShadyCSS.prepareTemplateStyles(o,t);return}let a=document.createElement("style");for(let d=0;d<i;d++){let g=s[d];g.parentNode.removeChild(g),a.textContent+=g.textContent}nc(t);let c=o.content;r?Rn(r,a,c.firstChild):c.insertBefore(a,c.firstChild),window.ShadyCSS.prepareTemplateStyles(o,t);let l=c.querySelector("style");if(window.ShadyCSS.nativeShadow&&l!==null)e.insertBefore(l.cloneNode(!0),e.firstChild);else if(r){c.insertBefore(a,c.firstChild);let d=new Set;d.add(a),Or(r,d)}},"prepareTemplateStyles"),Fn=n((t,e,r)=>{if(!r||typeof r!="object"||!r.scopeName)throw new Error("The `scopeName` option is required.");let o=r.scopeName,s=Z.has(e),i=Bt&&e.nodeType===11&&!!e.host,a=i&&!Un.has(o),c=a?document.createDocumentFragment():e;if(Ar(t,c,Object.assign({templateFactory:rc(o)},r)),a){let l=Z.get(c);Z.delete(c);let d=l.value instanceof K?l.value.template:void 0;sc(o,c,d),de(e,e.firstChild),e.appendChild(c),Z.set(e,l)}!s&&i&&window.ShadyCSS.styleElement(e.host)},"render")});var Ln,Ur,jn,Fr,Dr,Lr,jr,Mr,Vr,Qe,$r=S(()=>{window.JSCompiler_renameProperty=(t,e)=>t;Ur={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}},jn=n((t,e)=>e!==t&&(e===e||t===t),"notEqual"),Fr={attribute:!0,type:String,converter:Ur,reflect:!1,hasChanged:jn},Dr=1,Lr=1<<2,jr=1<<3,Mr=1<<4,Vr="finalized",Qe=class extends HTMLElement{constructor(){super();this.initialize()}static get observedAttributes(){this.finalize();let e=[];return this._classProperties.forEach((r,o)=>{let s=this._attributeNameForProperty(o,r);s!==void 0&&(this._attributeToPropertyMap.set(s,o),e.push(s))}),e}static _ensureClassProperties(){if(!this.hasOwnProperty(JSCompiler_renameProperty("_classProperties",this))){this._classProperties=new Map;let e=Object.getPrototypeOf(this)._classProperties;e!==void 0&&e.forEach((r,o)=>this._classProperties.set(o,r))}}static createProperty(e,r=Fr){if(this._ensureClassProperties(),this._classProperties.set(e,r),r.noAccessor||this.prototype.hasOwnProperty(e))return;let o=typeof e=="symbol"?Symbol():`__${e}`,s=this.getPropertyDescriptor(e,o,r);s!==void 0&&Object.defineProperty(this.prototype,e,s)}static getPropertyDescriptor(e,r,o){return{get(){return this[r]},set(s){let i=this[e];this[r]=s,this.requestUpdateInternal(e,i,o)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this._classProperties&&this._classProperties.get(e)||Fr}static finalize(){let e=Object.getPrototypeOf(this);if(e.hasOwnProperty(Vr)||e.finalize(),this[Vr]=!0,this._ensureClassProperties(),this._attributeToPropertyMap=new Map,this.hasOwnProperty(JSCompiler_renameProperty("properties",this))){let r=this.properties,o=[...Object.getOwnPropertyNames(r),...typeof Object.getOwnPropertySymbols=="function"?Object.getOwnPropertySymbols(r):[]];for(let s of o)this.createProperty(s,r[s])}}static _attributeNameForProperty(e,r){let o=r.attribute;return o===!1?void 0:typeof o=="string"?o:typeof e=="string"?e.toLowerCase():void 0}static _valueHasChanged(e,r,o=jn){return o(e,r)}static _propertyValueFromAttribute(e,r){let o=r.type,s=r.converter||Ur,i=typeof s=="function"?s:s.fromAttribute;return i?i(e,o):e}static _propertyValueToAttribute(e,r){if(r.reflect===void 0)return;let o=r.type,s=r.converter;return(s&&s.toAttribute||Ur.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=Fr){let s=this.constructor,i=s._attributeNameForProperty(e,o);if(i!==void 0){let a=s._propertyValueToAttribute(r,o);if(a===void 0)return;this._updateState=this._updateState|jr,a==null?this.removeAttribute(i):this.setAttribute(i,a),this._updateState=this._updateState&~jr}}_attributeToProperty(e,r){if(this._updateState&jr)return;let o=this.constructor,s=o._attributeToPropertyMap.get(e);if(s!==void 0){let i=o.getPropertyOptions(s);this._updateState=this._updateState|Mr,this[s]=o._propertyValueFromAttribute(r,i),this._updateState=this._updateState&~Mr}}requestUpdateInternal(e,r,o){let s=!0;if(e!==void 0){let i=this.constructor;o=o||i.getPropertyOptions(e),i._valueHasChanged(this[e],r,o.hasChanged)?(this._changedProperties.has(e)||this._changedProperties.set(e,r),o.reflect===!0&&!(this._updateState&Mr)&&(this._reflectingProperties===void 0&&(this._reflectingProperties=new Map),this._reflectingProperties.set(e,o))):s=!1}!this._hasRequestedUpdate&&s&&(this._updatePromise=this._enqueueUpdate())}requestUpdate(e,r){return this.requestUpdateInternal(e,r),this.updateComplete}async _enqueueUpdate(){this._updateState=this._updateState|Lr;try{await this._updatePromise}catch{}let e=this.performUpdate();return e!=null&&await e,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return this._updateState&Lr}get hasUpdated(){return this._updateState&Dr}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&Dr||(this._updateState=this._updateState|Dr,this.firstUpdated(r)),this.updated(r))}_markUpdated(){this._changedProperties=new Map,this._updateState=this._updateState&~Lr}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(Qe,"UpdatingElement");Ln=Vr;Qe[Ln]=!0});var Mn,wu,Vn=S(()=>{Mn=Element.prototype,wu=Mn.msMatchesSelector||Mn.webkitMatchesSelector});var Ht,Br,Je,$n,ic,w,Hr=S(()=>{Ht=window.ShadowRoot&&(window.ShadyCSS===void 0||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Br=Symbol(),Je=class{constructor(e,r){if(r!==Br)throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e}get styleSheet(){return this._styleSheet===void 0&&(Ht?(this._styleSheet=new CSSStyleSheet,this._styleSheet.replaceSync(this.cssText)):this._styleSheet=null),this._styleSheet}toString(){return this.cssText}};n(Je,"CSSResult");$n=n(t=>new Je(String(t),Br),"unsafeCSS"),ic=n(t=>{if(t instanceof Je)return t.cssText;if(typeof t=="number")return t;throw new Error(`Value passed to 'css' function must be a 'css' function result: ${t}. Use 'unsafeCSS' to pass non-literal values, but
|
|
12
|
+
take care to ensure page security.`)},"textFromCSSResult"),w=n((t,...e)=>{let r=e.reduce((o,s,i)=>o+ic(s)+t[i+1],t[0]);return new Je(r,Br)},"css")});var Bn,x,v=S(()=>{Dn();$r();$r();Vn();qr();Hr();Hr();(window.litElementVersions||(window.litElementVersions=[])).push("2.4.0");Bn={},x=class extends Qe{static getStyles(){return this.styles}static _getUniqueStyles(){if(this.hasOwnProperty(JSCompiler_renameProperty("_styles",this)))return;let e=this.getStyles();if(Array.isArray(e)){let r=n((i,a)=>i.reduceRight((c,l)=>Array.isArray(l)?r(l,c):(c.add(l),c),a),"addStyles"),o=r(e,new Set),s=[];o.forEach(i=>s.unshift(i)),this._styles=s}else this._styles=e===void 0?[]:[e];this._styles=this._styles.map(r=>{if(r instanceof CSSStyleSheet&&!Ht){let o=Array.prototype.slice.call(r.cssRules).reduce((s,i)=>s+i.cssText,"");return $n(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):Ht?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!==Bn&&this.constructor.render(r,this.renderRoot,{scopeName:this.localName,eventContext:this}),this._needsShimAdoptedStyleSheets&&(this._needsShimAdoptedStyleSheets=!1,this.constructor._styles.forEach(o=>{let s=document.createElement("style");s.textContent=o.cssText,this.renderRoot.appendChild(s)}))}render(){return Bn}};n(x,"LitElement");x.finalized=!0;x.render=Fn});var zt=te((Uu,Hn)=>{var ac={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"};Hn.exports=ac});var Gn=te((Fu,zn)=>{var ye=zt(),cc=n(t=>{let e="",r=[];for(let o of t){let s=o.charCodeAt(0);switch(s){case ye.PAR_OPEN:case ye.PAR_CLOSE:case ye.OP_NOT:case ye.BINARY_AND:case ye.BINARY_OR:e&&(r.push({type:ye.LITERAL,value:e}),e=""),r.push({type:s,value:o});break;default:e+=o}}return e&&r.push({type:ye.LITERAL,value:e}),r},"Tokenizer");zn.exports=cc});var Yn=te((Du,Wn)=>{var X=zt(),lc=n(t=>{let e=[],r=[];return t.forEach(s=>{switch(s.type){case X.LITERAL:e.unshift(s);break;case X.BINARY_AND:case X.BINARY_OR:case X.OP_NOT:case X.PAR_OPEN:r.push(s);break;case X.PAR_CLOSE:for(;r.length&&r[r.length-1].type!==X.PAR_OPEN;)e.unshift(r.pop());r.pop(),r.length&&r[r.length-1].type===X.OP_NOT&&e.unshift(r.pop());break;default:break}}),r.length&&[...r.reverse(),...e]||e},"PolishNotation"),uc=n(function*(t){for(let e=0;e<t.length-1;e++)yield t[e];return t[t.length-1]},"PolishGenerator");Wn.exports={PolishNotation:lc,PolishGenerator:uc}});var Jn=te((Lu,Qn)=>{var I=zt(),L=class{constructor(e,r,o,s){this.op=e,this.left=r,this.right=o,this.literal=s}isLeaf(){return this.op===I.LEAF}isAtomic(){return this.isLeaf()||this.op===I.OP_NOT&&this.left.isLeaf()}getLiteralValue(){return this.literal}static CreateAnd(e,r){return new L(I.BINARY_AND,e,r)}static CreateNot(e){return new L(I.OP_NOT,e)}static CreateOr(e,r){return new L(I.BINARY_OR,e,r)}static CreateLiteral(e){return new L(I.LEAF,null,null,e)}};n(L,"ExpNode");var Pe=n(t=>{let e=t.next().value;switch(e.type){case I.LITERAL:return L.CreateLiteral(e.value);case I.OP_NOT:return L.CreateNot(Pe(t));case I.BINARY_AND:{let r=Pe(t),o=Pe(t);return L.CreateAnd(r,o)}case I.BINARY_OR:{let r=Pe(t),o=Pe(t);return L.CreateOr(r,o)}}return null},"make"),Re=n((t,e)=>{if(t.isLeaf())return e(t.getLiteralValue());if(t.op===I.OP_NOT)return!Re(t.left,e);if(t.op===I.BINARY_OR)return Re(t.left,e)||Re(t.right,e);if(t.op===I.BINARY_AND)return Re(t.left,e)&&Re(t.right,e)},"nodeEvaluator");Qn.exports={make:Pe,nodeEvaluator:Re}});var es=te((ju,Xn)=>{var pc=Gn(),Kn=Yn(),Zn=Jn(),dc=n((t,e)=>{let r=pc(t),o=Kn.PolishNotation(r),s=Kn.PolishGenerator(o),i=Zn.make(s);return Zn.nodeEvaluator(i,e)},"parse");Xn.exports={parse:dc}});var Ns={};Xt(Ns,{TestWizard:()=>Zt,default:()=>Ic});var Zt,Ic,ks=S(()=>{v();N();Zt=class extends x{static get styles(){return w`
|
|
13
|
+
:host {
|
|
14
|
+
position: fixed;
|
|
15
|
+
top: 5em;
|
|
16
|
+
right: 5em;
|
|
17
|
+
background-color: rgba(255, 255, 255, 0.7);
|
|
18
|
+
width: 400px;
|
|
19
|
+
padding: 1em;
|
|
20
|
+
border-radius: 5px;
|
|
21
|
+
border: 1px solid #ccc;
|
|
22
|
+
box-shadow: 2px 2px 0 0 #000;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
button {
|
|
26
|
+
margin: 0 0.5em 0.5em;
|
|
27
|
+
background-color: gray;
|
|
28
|
+
color: white;
|
|
29
|
+
border: 0;
|
|
30
|
+
border-radius: 3px;
|
|
31
|
+
cursor: pointer;
|
|
32
|
+
padding: 0.5em;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
button.primary {
|
|
36
|
+
background-color: blue;
|
|
37
|
+
padding: 1em;
|
|
38
|
+
color: white;
|
|
39
|
+
border: 0;
|
|
40
|
+
border-radius: 3px;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
button[disabled] {
|
|
44
|
+
background-color: #777;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
div {
|
|
48
|
+
margin-bottom: 0.5em;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.message {
|
|
52
|
+
margin-left: 0.5em;
|
|
53
|
+
margin: 1em;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.success {
|
|
57
|
+
color: green;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.error {
|
|
61
|
+
color: red;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.warning {
|
|
65
|
+
color: orange;
|
|
66
|
+
}
|
|
67
|
+
a {
|
|
68
|
+
color: white;
|
|
69
|
+
}
|
|
70
|
+
`}runTests(){this.results=[],this.disabled=!0,this.requestUpdate(),document.querySelectorAll("og-offer").forEach(r=>{let o=r.store.getState(),s=r.getAttribute("product"),i=r.getAttribute("location"),a={messages:this.getOfferAttributeMessages(s,i).concat(this.getOfferRequestMessages(s,o)),product:s};this.results.push(a)}),this.testsRan=!0,this.disabled=!1,this.requestUpdate()}getOfferAttributeMessages(e,r){let o=[];return e||o.push({name:"Offer element found but missing product attribute",type:"error"}),r||o.push({name:"Offer element found but missing location attribute",type:"warning"}),e&&r&&o.push({name:"Offer element found and properly tagged",type:"success"}),o}getOfferRequestMessages(e,r){let o=r.inStock[e],s=r.autoshipEligible[e],i=[];return e&&o===!1&&i.push({name:"This product is marked as out of stock in the OG database",type:"warning"}),e&&s===!1&&i.push({name:"This product is not eligible for autoship",type:"warning"}),e&&o===null&&s===null&&i.push({name:"This product does not exist in our database",type:"error"}),i}resultsCodeBlock(){return this.results.length===0?u`
|
|
71
|
+
<div class="message error">No offer element found on the page</div>
|
|
72
|
+
`:this.results.map((e,r)=>u`
|
|
73
|
+
<div>For offer tag with product = "${e.product}"</div>
|
|
74
|
+
${e.messages.map(o=>u`
|
|
75
|
+
<div class="message ${o.type}">
|
|
76
|
+
${o.name}
|
|
77
|
+
</div>
|
|
78
|
+
`)}
|
|
79
|
+
<button @click=${this.toggleProductFlags(r,{})}>
|
|
80
|
+
Set inStock and eligible
|
|
81
|
+
</button>
|
|
82
|
+
<br />
|
|
83
|
+
<button @click=${this.toggleProductFlags(r,{inStock:!1})}>
|
|
84
|
+
Set to not inStock
|
|
85
|
+
</button>
|
|
86
|
+
<br />
|
|
87
|
+
<button @click=${this.toggleProductFlags(r,{autoship:!1})}>
|
|
88
|
+
Set to not eligible
|
|
89
|
+
</button>
|
|
90
|
+
<br />
|
|
91
|
+
<button @click=${this.toggleProductFlags(r,{autoship:!1,inStock:!1})}>
|
|
92
|
+
Set to not eligible and not in stock
|
|
93
|
+
</button>
|
|
94
|
+
<br />
|
|
95
|
+
<button @click=${this.toggleUpsellPreview(r)}>
|
|
96
|
+
Toggle upsell/regular in this offer
|
|
97
|
+
</button>
|
|
98
|
+
<br />
|
|
99
|
+
<button @click=${this.toggleUpsellNextOrder(r)}>
|
|
100
|
+
upsell product is in next order
|
|
101
|
+
</button>
|
|
102
|
+
<br />
|
|
103
|
+
`)}toggleUpsellPreview(e){return r=>{r.preventDefault();let o=document.querySelectorAll("og-offer")[e];o.getAttribute("preview-upsell-offer")?o.removeAttribute("preview-upsell-offer"):o.setAttribute("preview-upsell-offer",!0),this.runTests()}}toggleProductFlags(e,{inStock:r=!0,autoship:o=!0,groups:s=["subscription","upsell"]}){return i=>{i.preventDefault();let a=document.querySelectorAll("og-offer")[e],c=a.product.id;a.store.dispatch(Te({in_stock:{[c]:r},eligibility_groups:{[c]:s},result:"success",autoship:{[c]:o},module_view:{regular:"58a01e9aacbe40389b5c7325d79091bb"},modifiers:{},incentives_display:{"47c01e9aacbe40389b5c7325d79091aa":{field:"sub_total",object:"order",type:"Discount Percent",value:5},e6534b9d877f41e586c37b7d8abc3a58:{field:"total_price",object:"item",type:"Discount Percent",value:5},f35e842710b24929922db4a529eecd40:{field:"total_price",object:"item",type:"Discount Percent",value:10},"5be321d7c17f4e18a757212b9a20bfcc":{field:"total_price",object:"item",type:"Discount Percent",value:1}},incentives:{[c]:{initial:["5be321d7c17f4e18a757212b9a20bfcc"],ongoing:["e6534b9d877f41e586c37b7d8abc3a58","47c01e9aacbe40389b5c7325d79091aa","f35e842710b24929922db4a529eecd40"]}}})),this.runTests()}}toggleUpsellNextOrder(e){return r=>{let o=document.querySelectorAll("og-offer")[e],s=o.product.id;r.preventDefault(),o.store.dispatch(br({count:1,next:null,previous:null,results:[{order:"24d50352579511ea806cbc764e100cfd",offer:null,subscription:"8a076b7a0ea011e7a5bcbc764e105eda",product:s,components:[],quantity:1,public_id:"24d6901e579511ea806cbc764e100cfd",product_attribute:null,price:"14.99",extra_cost:"0.00",total_price:"13.49",one_time:!1,frozen:!1,first_placed:null}]})),this.runTests()}}render(){return u`
|
|
104
|
+
<div>
|
|
105
|
+
${this.testsRan?this.resultsCodeBlock():u`
|
|
106
|
+
<div>Click the button to run tests</div>
|
|
107
|
+
`}
|
|
108
|
+
<button ?disabled=${this.disabled} @click="${this.runTests.bind(this)}" class="primary">Run Test</button>
|
|
109
|
+
</div>
|
|
110
|
+
`}};n(Zt,"TestWizard");Ic=Zt});var Dc={};Xt(Dc,{addOptinChangedCallback:()=>Vs,addTemplate:()=>Ws,clear:()=>Ms,config:()=>zs,default:()=>Fc,disableOptinChangedCallbacks:()=>$s,getOptins:()=>js,getProductsForPurchasePost:()=>Ls,initialize:()=>ho,offers:()=>_,previewMode:()=>Hs,register:()=>Bs,resolveSettings:()=>Js,setAuthUrl:()=>Ds,setEnvironment:()=>Us,setLocale:()=>Gs,setMerchantId:()=>Fs,setPublicPath:()=>Qs,setTemplates:()=>Ys});var si=Object.defineProperty,tt=n((t,e)=>si(t,"name",{value:e,configurable:!0}),"s"),ii=tt(t=>e=>t.indexOf(e.origin)>=0,"createIsMessageAllowed"),go=["https://rc3.ordergroove.com","https://rc3.stg.ordergroove.com","http://localhost:3000",window.location.origin],yo=tt(t=>(e,r)=>{go.forEach(o=>t.postMessage({ogType:e,...r},o))},"createBroadcastMessage");function er(t){let e=ii(go),r=yo(t.source);e(t)&&t.data.ogType==="READY"&&import("//static.ordergroove.com/@ordergroove/offers-live-editor/0.4.0/dist/client.js").then(({initializeClient:o})=>{o(e,r),window.removeEventListener("message",er)})}n(er,"d");tt(er,"handleReady");function tr(t=window.opener){t&&t!==window&&(window.addEventListener("message",er),yo(t)("READY"))}n(tr,"l");tt(tr,"offersLiveEditor");function rr(t){var e,r=t.Symbol;return typeof r=="function"?r.observable?e=r.observable:(e=r("observable"),r.observable=e):e="@@observable",e}n(rr,"symbolObservablePonyfill");var be;typeof self!="undefined"?be=self:typeof window!="undefined"||typeof window!="undefined"?be=window:typeof module!="undefined"?be=module:be=Function("return this")();var ai=rr(be),or=ai;var nr=n(function(){return Math.random().toString(36).substring(7).split("").join(".")},"randomString"),Ie={INIT:"@@redux/INIT"+nr(),REPLACE:"@@redux/REPLACE"+nr(),PROBE_UNKNOWN_ACTION:n(function(){return"@@redux/PROBE_UNKNOWN_ACTION"+nr()},"PROBE_UNKNOWN_ACTION")};function ci(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(ci,"isPlainObject");function sr(t,e,r){var o;if(typeof e=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error("It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function.");if(typeof e=="function"&&typeof r=="undefined"&&(r=e,e=void 0),typeof r!="undefined"){if(typeof r!="function")throw new Error("Expected the enhancer to be a function.");return r(sr)(t,e)}if(typeof t!="function")throw new Error("Expected the reducer to be a function.");var s=t,i=e,a=[],c=a,l=!1;function d(){c===a&&(c=a.slice())}n(d,"ensureCanMutateNextListeners");function g(){if(l)throw new Error("You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return i}n(g,"getState");function p(f){if(typeof f!="function")throw new Error("Expected the listener to be a function.");if(l)throw new Error("You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api-reference/store#subscribelistener for more details.");var T=!0;return d(),c.push(f),n(function(){if(!!T){if(l)throw new Error("You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api-reference/store#subscribelistener for more details.");T=!1,d();var b=c.indexOf(f);c.splice(b,1),a=null}},"unsubscribe")}n(p,"subscribe");function m(f){if(!ci(f))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(typeof f.type=="undefined")throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(l)throw new Error("Reducers may not dispatch actions.");try{l=!0,i=s(i,f)}finally{l=!1}for(var T=a=c,O=0;O<T.length;O++){var b=T[O];b()}return f}n(m,"dispatch");function E(f){if(typeof f!="function")throw new Error("Expected the nextReducer to be a function.");s=f,m({type:Ie.REPLACE})}n(E,"replaceReducer");function y(){var f,T=p;return f={subscribe:n(function(b){if(typeof b!="object"||b===null)throw new TypeError("Expected the observer to be an object.");function P(){b.next&&b.next(g())}n(P,"observeState"),P();var Ks=T(P);return{unsubscribe:Ks}},"subscribe")},f[or]=function(){return this},f}return n(y,"observable"),m({type:Ie.INIT}),o={dispatch:m,subscribe:p,getState:g,replaceReducer:E},o[or]=y,o}n(sr,"createStore");function li(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(li,"getUndefinedStateErrorMessage");function ui(t){Object.keys(t).forEach(function(e){var r=t[e],o=r(void 0,{type:Ie.INIT});if(typeof o=="undefined")throw new Error('Reducer "'+e+`" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`);if(typeof r(void 0,{type:Ie.PROBE_UNKNOWN_ACTION()})=="undefined")throw new Error('Reducer "'+e+'" returned undefined when probed with a random type. '+("Don't try to handle "+Ie.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(ui,"assertReducerShape");function bo(t){for(var e=Object.keys(t),r={},o=0;o<e.length;o++){var s=e[o];typeof t[s]=="function"&&(r[s]=t[s])}var i=Object.keys(r),a,c;try{ui(r)}catch(l){c=l}return n(function(d,g){if(d===void 0&&(d={}),c)throw c;if(!1)var p;for(var m=!1,E={},y=0;y<i.length;y++){var f=i[y],T=r[f],O=d[f],b=T(O,g);if(typeof b=="undefined"){var P=li(f,g);throw new Error(P)}E[f]=b,m=m||b!==O}return m=m||i.length!==Object.keys(d).length,m?E:d},"combination")}n(bo,"combineReducers");function _o(t,e){return function(){return e(t.apply(this,arguments))}}n(_o,"bindActionCreator");function xo(t,e){if(typeof t=="function")return _o(t,e);if(typeof t!="object"||t===null)throw new Error("bindActionCreators expected an object or a function, instead received "+(t===null?"null":typeof t)+'. Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?');var r={};for(var o in t){var s=t[o];typeof s=="function"&&(r[o]=_o(s,e))}return r}n(xo,"bindActionCreators");function pi(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}n(pi,"_defineProperty");function Eo(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(Eo,"ownKeys");function di(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Eo(r,!0).forEach(function(o){pi(t,o,r[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Eo(r).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(r,o))})}return t}n(di,"_objectSpread2");function ir(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return e.length===0?function(o){return o}:e.length===1?e[0]:e.reduce(function(o,s){return function(){return o(s.apply(void 0,arguments))}})}n(ir,"compose");function So(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return function(o){return function(){var s=o.apply(void 0,arguments),i=n(function(){throw new Error("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},"dispatch"),a={getState:s.getState,dispatch:n(function(){return i.apply(void 0,arguments)},"dispatch")},c=e.map(function(l){return l(a)});return i=ir.apply(void 0,c)(s.dispatch),di({},s,{dispatch:i})}}}n(So,"applyMiddleware");var rt=null,fi=n(t=>({dispatch:t}),"defaultMapDispatchToProps"),vo=n(t=>{if(!rt)throw new Error("Missing redux store.");return rt},"resolveStore"),hi=n((t,e)=>r=>{let{getState:o,dispatch:s}=vo(r),i=t?t(o(),r):{},a=e(s,r);Object.assign(r,i,a)},"createRecalcProps"),h=n((t,e=fi)=>r=>{let s=hi(t,typeof e=="function"?e:i=>xo(e,i));return class extends r{get store(){return rt}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this._storeUnsubscribe=vo(this).subscribe(()=>s(this)),s(this)}attributeChangedCallback(i,a,c){super.attributeChangedCallback&&super.attributeChangedCallback(i,a,c),this._storeUnsubscribe&&a!==c&&s(this)}disconnectedCallback(){this._storeUnsubscribe(),super.disconnectedCallback&&super.disconnectedCallback()}}},"connect"),wo=n(t=>{rt=t},"setStore");function To(t){var e=n(function(o){var s=o.dispatch,i=o.getState;return function(a){return function(c){return typeof c=="function"?c(s,i,t):a(c)}}},"middleware");return e}n(To,"createThunkMiddleware");var Oo=To();Oo.withExtraArgument=To;var Co=Oo;ae();function mi(t,e){return t===e}n(mi,"defaultEqualityCheck");function gi(t,e,r){if(e===null||r===null||e.length!==r.length)return!1;for(var o=e.length,s=0;s<o;s++)if(!t(e[s],r[s]))return!1;return!0}n(gi,"areArgumentsShallowlyEqual");function yi(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:mi,r=null,o=null;return function(){return gi(e,r,arguments)||(o=t.apply(null,arguments)),r=arguments,o}}n(yi,"defaultMemoize");function bi(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(bi,"getDependencies");function _i(t){for(var e=arguments.length,r=Array(e>1?e-1:0),o=1;o<e;o++)r[o-1]=arguments[o];return function(){for(var s=arguments.length,i=Array(s),a=0;a<s;a++)i[a]=arguments[a];var c=0,l=i.pop(),d=bi(i),g=t.apply(void 0,[function(){return c++,l.apply(null,arguments)}].concat(r)),p=t(function(){for(var m=[],E=d.length,y=0;y<E;y++)m.push(d[y].apply(null,arguments));return g.apply(null,m)});return p.resultFunc=l,p.dependencies=d,p.recomputations=function(){return c},p.resetRecomputations=function(){return c=0},p}}n(_i,"createSelectorCreator");var Ee=_i(yi);var ue=re(vt());Y();ue.default.Cache=Map;function la(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(la,"arraysEqual");var R=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))||la((t.components||[]).sort(),(e.components||[]).sort()))),"isSameProduct"),Ot=n(t=>t.optedin||[],"optedinSelector"),Wo=n(t=>t.optedout||[],"optedoutSelector"),dr=n(t=>t.autoshipByDefault||{},"autoshipSelector"),ua=n(t=>t.defaultFrequencies||{},"defaultFrequenciesSelector"),$=(0,ue.default)(t=>Ee(Ot,Wo,dr,(e,r,o)=>{let s=e.find(i=>R(t,i));return s||(r.find(i=>R(t,i))?!1:t&&o[t.id]?{id:t.id}:!1)}),t=>JSON.stringify(t)),Yo=(0,ue.default)(t=>Ee(Ot,e=>{let r=e.find(o=>R(t,o));return r||!1}),t=>JSON.stringify(t)),Qo=(0,ue.default)(t=>Ee(Wo,e=>e.find(r=>R(t,r))));var M=(0,ue.default)(t=>Ee($(t),e=>e&&e.frequency||null)),Ct=(0,ue.default)(t=>Ee(ua,e=>e[t]&&Ve(e[t])||null)),fr=n(t=>t.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase(),"kebabCase"),D=n((t,e,r,o)=>({[r]:e&&e.hasAttribute&&e.hasAttribute(fr(r))&&e[r]||e.offer&&typeof(e.offer[r]!=="undefined")&&e.offer[r]||t.config&&t.config[r]||o}),"configSelector"),ve=n(t=>({templates:t.templates||[]}),"templatesSelector");Y();var pa=n((t=[],e)=>{switch(e.type){case G:return[];case ie:return e.newValue?e.newValue.optedin:t;case oe:case se:let[[r],o]=t.reduce((s,i)=>s[R(e.payload.product,i)?0:1].push(i)&&s,[[],[]]);return(o||[]).concat({...r,...e.payload.product,frequency:e.payload.frequency});case ne:return t.filter(s=>!R(e.payload.product,s));case qe:return t.map(s=>R(e.payload.product,s)?{...s,...e.payload.newProduct}:s);case ft:return t.filter(s=>!R(e.payload.product,s));case xe:return[];default:return t}},"optedin"),da=n((t=[],e)=>{switch(e.type){case G:return[];case ie:return e.newValue?e.newValue.optedout:t;case oe:case se:return t.filter(s=>!R(e.payload.product,s));case ne:let[[r],o]=t.reduce((s,i)=>s[R(e.payload.product,i)?0:1].push(i)&&s,[[],[]]);return(o||[]).concat({...r,...e.payload.product,frequency:e.payload.frequency});case qe:return t.map(s=>R(e.payload.product,s)?{...s,...e.payload.newProduct}:s);case xe:return[];default:return t}},"optedout"),fa=n((t={},{type:e,payload:r})=>{switch(e){case at:return r&&r.count>0?{...t,...r.results[0]&&{...r.results[0],place:new Date(Date.parse(r.results[0].place.replace(/-/gi,"/")))}}:t;case ct:return{...t,products:(r.results||[]).map(o=>o.product)};case dt:return{...t,...r,public_id:r.order,...r.product&&{products:(t.products||[]).concat(r.product)}};default:return t}},"nextUpcomingOrder"),ha=n((t={},e)=>{switch(e.type){case q:return{...t,...e.payload.autoship};default:return t}},"autoshipEligible"),ma=n((t={},e)=>{switch(e.type){case q:return{...t,...e.payload.in_stock};default:return t}},"inStock"),ga=n((t={},e)=>{switch(e.type){case q:return{...t,...e.payload.eligibility_groups};default:return t}},"eligibilityGroups"),Jo=n((t,e)=>t.map(r=>({...e[r],id:[r][0]})),"mapIncentive"),ya=n((t={},e)=>{switch(e.type){case q:return{...t,...[...new Set(Object.keys(e.payload.incentives||{}))].reduce((r,o)=>({...r,[o]:Object.entries(e.payload.incentives).filter(([s])=>s===o).reduce((s,[,{initial:i,ongoing:a}])=>({...s,initial:[...s.initial||[],...Jo(i,e.payload.incentives_display)],ongoing:[...s.ongoing||[],...Jo(a,e.payload.incentives_display)]}),{})}),{})};default:return t}},"incentives");var ba=n((t=!1,e)=>{switch(e.type){case it:return{...e.payload};case _e:return!1;default:return t}},"auth"),_a=n((t="",e)=>{switch(e.type){case ot:return e.payload;default:return t}},"merchantId"),xa=n((t=null,e)=>{switch(e.type){case st:return e.payload;default:return t}},"authUrl"),Ea=n((t={},e)=>{switch(e.type){case q:return{...t,offerId:(e.payload.module_view||{}).regular,...e.payload.modifiers};default:return t}},"offer"),Sa=n((t="",e)=>{switch(e.type){case q:return(e.payload.module_view||{}).regular||"";default:return t}},"offerId"),va=n((t=null,e)=>{switch(e.type){case G:return null;case nt:return e.payload;default:return t}},"sessionId"),wa=n((t={},e)=>{switch(e.type){case q:return{...t,...Object.entries(e.payload.autoship).map(([r])=>({[r]:Object.keys(e.payload.modifiers)})).reduce((r,o)=>({...r,...o}))};case xe:return{};default:return t}},"productOffer"),Ta=n((t={},e)=>{switch(e.type){case bt:return{...t,[e.payload.product]:e.payload.firstOrderPlaceDate};default:return t}},"firstOrderPlaceDate"),Oa=n((t={},e)=>{switch(e.type){case _t:return{...t,[e.payload.product]:e.payload.productToSubscribe};default:return t}},"productToSubscribe"),hr=n((t={},e)=>{switch(e.type){case lt:return{...t,name:"staging",apiUrl:"https://staging.om.ordergroove.com",legoUrl:"https://staging.restapi.ordergroove.com"};case ut:return{...t,name:"dev",apiUrl:"https://dev.om.ordergroove.com",legoUrl:"https://dev.restapi.ordergroove.com"};case pt:return{...t,name:"prod",apiUrl:"https://om.ordergroove.com",legoUrl:"https://restapi.ordergroove.com"};default:return t}},"environment"),Ca=n((t={offerOptInLabel:"Subscribe",offerOptOutLabel:"Purchase one time",offerEveryLabel:"Every",offerTooltipTrigger:"Hover for additional info",offerTooltipContent:"Seems this is a great subscription offering. Many fun details about this program exist.",optinButtonLabel:"\u2022",optoutButtonLabel:"\u2022",optinStatusOptedInLabel:"You're opted in!",optinStatusOptedOutLabel:"You're not opted in.",optinToggleLabel:"\u2022",upsellButtonLabel:"Add item to order on ",upsellButtonPrefix:"",upsellModalContent:"Some upsell modal content",upsellModalOptInLabel:"Subscribe",upsellModalOptOutLabel:"Purchase one time",upsellModalTitle:"Impulse Upsell",upsellModalConfirmLabel:"Ok",upsellModalCancelLabel:"Cancel",defaultFrequencyCopy:"(Recommended)",frequencyPeriods:{"1":"day","2":"week","3":"month"}},e)=>{switch(e.type){case ht:return{...t,...e.payload};default:return t}},"locale"),Pa=n((t={frequencies:["1_2","1_2","1_3"],offerType:"radio"},e)=>{switch(e.type){case mt:return{...t,...e.payload,defaultFrequency:e.payload.defaultFrequency?Ve(e.payload.defaultFrequency):t.defaultFrequency,frequencies:e.payload.frequencies?e.payload.frequencies.map(Ve):t.frequencies};default:return t}},"config"),Ra=n((t=!1,e)=>{switch(e.type){case Ue:return e.payload;default:return t}},"previewStandardOffer"),Aa=n((t=!1,e)=>{switch(e.type){case Fe:return e.payload;default:return t}},"previewUpsellOffer"),Na=n((t=[],e)=>{switch(e.type){case q:return{...t,...e.payload.autoship_by_default};default:return t}},"autoshipByDefault"),ka=n((t=[],e)=>{switch(e.type){case q:return{...t,...e.payload.default_frequencies};default:return t}},"defaultFrequencies"),Ia=n((t=[],e)=>{switch(e.type){case yt:return[...e.payload||[]];case gt:return[e.payload,...t];default:return t}},"templates"),qa=n((t={},e)=>{switch(e.type){case xt:return{...e.payload};default:return t}},"productPlans"),Ko=bo({productPlans:qa,environment:hr,optedin:pa,optedout:da,merchantId:_a,offer:Ea,offerId:Sa,productOffer:wa,sessionId:va,inStock:ma,eligibilityGroups:ga,autoshipByDefault:Na,autoshipEligible:ha,incentives:ya,nextUpcomingOrder:fa,auth:ba,authUrl:xa,locale:Ca,config:Pa,previewStandardOffer:Ra,previewUpsellOffer:Aa,templates:Ia,defaultFrequencies:ka,firstOrderPlaceDate:Ta,productToSubscribe:Oa});var yn=re(mr());N();ae();var $e="OG_STATE",bn=n(t=>{try{return t===null?void 0:JSON.parse(t)}catch{return}},"safeParseState"),Er=n(()=>window.og&&window.og.previewMode,"isPreviewMode"),_n=n(()=>Er()?{}:bn(localStorage.getItem($e)),"loadState"),Wa=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"),xn=n(t=>{if(Er())return;let e=Wa(t);e&&localStorage.getItem($e)!==e&&localStorage.setItem($e,e)},"saveState"),En=n(t=>(0,yn.throttle)(500,e=>{if(Er())return;let{key:r,newValue:o}=e;r===$e&&o===null?(t.dispatch({type:G}),setTimeout(()=>t.dispatch(kt()),0)):r===$e&&t.dispatch({type:ie,newValue:bn(o)})}),"listenLocalStorageChanges");var Sn=re(mr());ae();var Ya=n((t,e,r=document)=>r.dispatchEvent(new CustomEvent(t,{detail:e})),"dispatchEvent"),vn=n(t=>({payload:{product:{id:e,components:r}={}}={}}={})=>setTimeout(()=>Ya("optin-changed",{productId:e,components:r,optedIn:t}),0),"dispatchOptinChangedEvent"),Qa=[{expressions:[({type:t}={})=>t===oe,({type:t}={})=>t===se],fn:vn(!0)},{expressions:[({type:t}={})=>t===ne],fn:vn(!1)}],wn=n(t=>e=>r=>{let o=t.getState();Qa.forEach(s=>{s.expressions.some(i=>i(r,o))&&s.fn(r)}),e(r)},"dispatchMiddleware"),Tn=n(t=>e=>r=>{e(r);let o=(0,Sn.throttle)(500,()=>{xn({...t.getState()})});r.type!==ie&&o()},"localStorageMiddleware");function On(){if(window.og&&window.og.store)return window.og.store;let t=window.og&&window.og.previewMode,e=typeof window=="object"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({}):ir,r=[Co,wn];t||r.push(Tn);let o=e(So(...r)),s=sr(Ko,t?{}:_n(),o);return window.og=window.og||{},window.og.store=s,s}n(On,"getStore");Y();var Sr=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],...Me(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");N();v();var cs=re(es());v();var fc=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"),ts=n(t=>t.hasAttribute("product")&&{id:t.getAttribute("product"),...t.hasAttribute("product-components")&&{components:JSON.parse(t.getAttribute("product-components"))}},"buildProduct");var zr=n(t=>{let e=ts(t);if(!e){let r=t.offer;r&&(e=ts(r))}return e},"resolveProduct"),hc=n(t=>{let e=t;for(;e;){if(e.tagName==="OG-OFFER")return e;e=e.nodeType===11?e.host:e.parentNode}},"resolveOffer"),Gr=n(t=>class extends t{get offer(){return hc(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"),A=n(t=>class extends Gr(t){get product(){return zr(this)}},"withProduct"),Gt=n(t=>class extends t{get childOptions(){return this._childOptions||{options:[]}}connectedCallback(){let e=[],r=null;this.querySelectorAll("option").forEach(o=>{let s=fc(o.value),i=o.innerText.trim();e.push({value:s,text:i}),!r&&o.selected&&(r=s)}),this._childOptions={options:e,isSelected:r},super.connectedCallback&&super.connectedCallback()}},"withChildOptions");var Wt={};Xt(Wt,{eligibilityGroups:()=>ns,eligible:()=>rs,hasUpcomingOrder:()=>is,hasUpsellGroup:()=>ss,inStock:()=>Wr,regularEligible:()=>yc,subscribed:()=>mc,subscriptionEligible:()=>os,upcomingOrderContainsProduct:()=>gc,upsellEligible:()=>as});var Wr=n((t,e)=>(t.inStock||{})[(e.product||{}).id],"inStock"),rs=n((t,e)=>(t.autoshipEligible||{})[(e.product||{}).id]||!1,"eligible"),os=n((t,e)=>(t.offerId&&t.offerId!=="0"||!1)&&rs(t,e)&&Wr(t,e),"subscriptionEligible"),ns=n((t,e)=>(t.eligibilityGroups||{})[(e.product||{}).id]||null,"eligibilityGroups"),ss=n((t,e)=>{let r=ns(t,e);return r===null||!!r.find(o=>o==="upsell"||o==="impulse_upsell")},"hasUpsellGroup"),mc=n((t,e)=>Yo(e.product)(t),"subscribed"),is=n(t=>!!(t.nextUpcomingOrder&&t.nextUpcomingOrder.public_id),"hasUpcomingOrder"),gc=n((t,e)=>(t.nextUpcomingOrder&&t.nextUpcomingOrder.products||[]).includes((e.product||{}).id),"upcomingOrderContainsProduct"),as=n((t,e)=>t.offerId&&t.offerId!=="0"&&t.auth&&Wr(t,e)&&is(t)&&ss(t,e),"upsellEligible"),yc=n((t,e)=>os(t,e)&&!as(t,e),"regularEligible");var bc=n(t=>t.replace(/(\r\n|\n|\r|\s)+/gm,""),"removeWhitespace"),Yr=class extends A(x){static get properties(){return{...super.properties,state:{type:Object,attribute:!1},test:{type:String}}}render(){return this.test&&cs.default.parse(bc(this.test),r=>Wt[r]&&Wt[r](this.state,this))?u`
|
|
13
111
|
<slot></slot>
|
|
14
|
-
`:
|
|
112
|
+
`:u``}shouldUpdate(e){return e.size&&this.product&&this.product.id in this.state.autoshipEligible&&this.product.id in this.state.inStock}};n(Yr,"When");var _c=n(t=>({state:t}),"mapStateToProps"),ls=h(_c)(Yr);v();N();v();Y();var us={type:Object,converter:{toAttribute(t){return t==null?t:JSON.stringify(t)},fromAttribute(t){return t&&t.match(/[{[]/)?JSON.parse(t):{id:t}}}},ee={type:String,attribute:"default-frequency",converter:{fromAttribute(t){return t&&pr(t)?t:null}}},Yt={type:Boolean,attribute:!0,reflect:!0},Ae={type:Object,attribute:!1};v();var xc=n(t=>class extends t{getOption(e,r=e){let o=fr(e);if(this.hasAttribute(o)){let s=this.getAttribute(o);return s.toString().toLowerCase()==="true"?!0:s.toString().toLowerCase()==="false"?!1:s}if(this.template&&this.template.config&&typeof this.template.config[r]!="undefined")return this.template.config[r];if(this.config&&typeof this.config[r]!="undefined")return this.config[r]}applyTemplate(e){this.template=e;let r=typeof e.markup=="undefined"?this.constructor.initialTemplate:e.markup;r&&this._templateMarkup!==r&&(this._templateMarkup=r,this.innerHTML=r)}refreshTemplate(){if(this._templates&&this._templates.length){let e=this._templates.find(({selector:r})=>{try{return this.matches(r)}catch{return!1}});this.applyTemplate(e||{})}}set templates(e){this._templates=e,this.refreshTemplate()}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this.constructor.initialTemplate&&!this.innerHTML.trim()&&(this.innerHTML=this.constructor.initialTemplate)}},"withTemplate"),F=xc(x);var j=class extends A(F){static get properties(){return{subscribed:Yt,frequencyMatch:{type:Boolean,reflect:!0,attribute:"frequency-match"}}}static get styles(){return w`
|
|
15
113
|
:host {
|
|
16
114
|
cursor: default;
|
|
17
115
|
display: inline-block;
|
|
@@ -64,18 +162,18 @@ var lib=(()=>{var Pa=Object.create;var Ye=Object.defineProperty;var Ra=Object.ge
|
|
|
64
162
|
text-align: center;
|
|
65
163
|
overflow: visible;
|
|
66
164
|
}
|
|
67
|
-
`}constructor(){super();this.addEventListener("click",this.handleClick.bind(this))}updated(e){e.has("subscribed")&&(this.frequencyMatch=this.frequency===this.defaultFrequency)}handleClick(){}render(){return this.subscribed&&!this.defaultFrequency?
|
|
165
|
+
`}constructor(){super();this.addEventListener("click",this.handleClick.bind(this))}updated(e){e.has("subscribed")&&(this.frequencyMatch=this.frequency===this.defaultFrequency)}handleClick(){}render(){return this.subscribed&&!this.defaultFrequency?u`
|
|
68
166
|
<slot name="subscribed"></slot>
|
|
69
167
|
<slot name="frequency-mismatch"></slot>
|
|
70
|
-
`:this.subscribed&&this.defaultFrequency===this.frequency?
|
|
168
|
+
`:this.subscribed&&this.defaultFrequency===this.frequency?u`
|
|
71
169
|
<slot name="subscribed"></slot>
|
|
72
170
|
<slot name="frequency-match"></slot>
|
|
73
|
-
`:this.subscribed&&this.defaultFrequency!==this.frequency?
|
|
171
|
+
`:this.subscribed&&this.defaultFrequency!==this.frequency?u`
|
|
74
172
|
<slot name="subscribed"></slot>
|
|
75
173
|
<slot name="frequency-mismatch"></slot>
|
|
76
|
-
`:
|
|
174
|
+
`:u`
|
|
77
175
|
<slot name="not-subscribed"></slot>
|
|
78
|
-
`}};n(
|
|
176
|
+
`}};n(j,"OptinStatus");var z=n((t,e={})=>({subscribed:$(e.product)(t),frequency:M(e.product)(t),...D(t,e,"defaultFrequency"),...ve(t,e)}),"mapStateToProps"),ps=h(z)(j);var Qr=class extends j{static get properties(){return{...super.properties,frequency:{type:String,reflect:!0},defaultFrequency:ee,optinButtonLabel:{type:String}}}handleClick(e){this.optinProduct(zr(this),this.defaultFrequency),e.preventDefault()}render(){return u`
|
|
79
177
|
<slot name="default">
|
|
80
178
|
<button id="action-trigger" class="btn radio ${this.subscribed?"active":""}"></button>
|
|
81
179
|
<label for="action-trigger">
|
|
@@ -84,7 +182,7 @@ var lib=(()=>{var Pa=Object.create;var Ye=Object.defineProperty;var Ra=Object.ge
|
|
|
84
182
|
</slot>
|
|
85
183
|
</label>
|
|
86
184
|
</slot>
|
|
87
|
-
`}};n(
|
|
185
|
+
`}};n(Qr,"OptinButton");var ds=h(z,{optinProduct:Q})(Qr);v();N();var Jr=class extends j{static get properties(){return{...super.properties,label:{type:String}}}handleClick(e){this.optoutProduct(this.product),e.preventDefault()}render(){return u`
|
|
88
186
|
<slot name="default">
|
|
89
187
|
<button id="action-trigger" class="btn radio ${this.subscribed?"":"active"}"></button>
|
|
90
188
|
<label for="action-trigger">
|
|
@@ -93,32 +191,32 @@ var lib=(()=>{var Pa=Object.create;var Ye=Object.defineProperty;var Ra=Object.ge
|
|
|
93
191
|
</slot>
|
|
94
192
|
</label>
|
|
95
193
|
</slot>
|
|
96
|
-
`}};n(
|
|
194
|
+
`}};n(Jr,"OptoutButton");var fs=h(z,{optoutProduct:we})(Jr);v();N();v();Y();var Ke=n((t,e)=>{let{every:r,every_period:o}=Me(t);return u`
|
|
97
195
|
${r}
|
|
98
196
|
<og-text key="frequencyPeriods" variant="${o}" pluralize="${r}"></og-text>
|
|
99
|
-
${e&&e===t?
|
|
197
|
+
${e&&e===t?u`
|
|
100
198
|
<og-text key="defaultFrequencyCopy"></og-text>
|
|
101
199
|
`:""}
|
|
102
|
-
`},"frequencyText"),
|
|
200
|
+
`},"frequencyText"),Ze=class extends A(F){static get properties(){return{...super.properties,disabled:{type:Boolean},subscribed:Yt,frequency:{type:String},defaultFrequency:ee,productDefaultFrequency:{type:String},frequencies:{converter:{fromAttribute:Go}}}}static get styles(){return w`
|
|
103
201
|
:host[hidden] {
|
|
104
202
|
display: none;
|
|
105
203
|
}
|
|
106
204
|
:host {
|
|
107
205
|
display: inline-block;
|
|
108
206
|
}
|
|
109
|
-
`}constructor(){super();this.frequencies=[]}render(){let e=this.frequency||this.defaultFrequency;return
|
|
207
|
+
`}constructor(){super();this.frequencies=[]}render(){let e=this.frequency||this.defaultFrequency;return u`
|
|
110
208
|
<span>
|
|
111
|
-
${this.subscribed&&
|
|
112
|
-
<slot name="subscribed">${
|
|
209
|
+
${this.subscribed&&u`
|
|
210
|
+
<slot name="subscribed">${Ke(e)} </slot>
|
|
113
211
|
`||""}
|
|
114
|
-
${!this.subscribed&&
|
|
212
|
+
${!this.subscribed&&u`
|
|
115
213
|
<slot name="not-subscribed"></slot>
|
|
116
214
|
`||""}
|
|
117
|
-
${this.subscribed&&this.defaultFrequency&&this.defaultFrequency!==this.frequency&&
|
|
215
|
+
${this.subscribed&&this.defaultFrequency&&this.defaultFrequency!==this.frequency&&u`
|
|
118
216
|
<slot name="frequency-mismatch"></slot>
|
|
119
217
|
`||""}
|
|
120
218
|
</span>
|
|
121
|
-
`}};n(
|
|
219
|
+
`}};n(Ze,"FrequencyStatus");var Xe=n((t,e)=>({subscribed:$(e.product)(t),frequency:M(e.product)(t),productDefaultFrequency:Ct((e.product||{}).id)(t),...D(t,e,"frequencies",[]),...D(t,e,"defaultFrequency"),...ve(t,e)}),"mapStateToProps"),hs=h(Xe)(Ze);var Kr=class extends Gt(j){static get properties(){return{...super.properties,frequencies:{type:Array,attribute:!1},frequency:{type:String},defaultFrequency:ee}}static get styles(){return w`
|
|
122
220
|
:host {
|
|
123
221
|
display: inline-block;
|
|
124
222
|
cursor: pointer;
|
|
@@ -128,26 +226,26 @@ var lib=(()=>{var Pa=Object.create;var Ye=Object.defineProperty;var Ra=Object.ge
|
|
|
128
226
|
border-width: var(--og-select-border-width, 1px);
|
|
129
227
|
box-shadow: 0 1px 0 1px rgba(0, 0, 0, 0.04);
|
|
130
228
|
}
|
|
131
|
-
`}get isSelected(){return this.subscribed?this.frequency:"optedOut"}onOptinChange(e){e==="optedOut"?this.optoutProduct(this.product):this.productChangeFrequency(this.product,e)}render(){let{options:e,isSelected:r}=this.childOptions,o=e;return e.length||(o=[{value:"optedOut",text:
|
|
229
|
+
`}get isSelected(){return this.subscribed?this.frequency:"optedOut"}onOptinChange(e){e==="optedOut"?this.optoutProduct(this.product):this.productChangeFrequency(this.product,e)}render(){let{options:e,isSelected:r}=this.childOptions,o=e;return e.length||(o=[{value:"optedOut",text:u`
|
|
132
230
|
<og-text key="offerOptOutLabel"></og-text>
|
|
133
|
-
`},...(this.frequencies||[]).map(s=>({value:s,text:
|
|
231
|
+
`},...(this.frequencies||[]).map(s=>({value:s,text:Ke(s,this.defaultFrequency)}))]),u`
|
|
134
232
|
<og-select
|
|
135
233
|
.options="${o}"
|
|
136
234
|
.selected="${r}"
|
|
137
235
|
.onChange="${({target:{value:s}})=>this.onOptinChange(s)}"
|
|
138
236
|
></og-select>
|
|
139
|
-
`}};n(
|
|
237
|
+
`}};n(Kr,"OptinSelect");var ms=h((t,e)=>({...z(t,e),...Xe(t,e)}),{productChangeFrequency:Rt,optoutProduct:we})(Kr);v();N();var Zr=class extends A(F){static get styles(){return w`
|
|
140
238
|
:host[hidden] {
|
|
141
239
|
display: none;
|
|
142
240
|
}
|
|
143
241
|
:host {
|
|
144
242
|
display: inline-block;
|
|
145
243
|
}
|
|
146
|
-
`}static get properties(){return{...super.properties,upcomingOrderDate:{type:String,attribute:!1},auth
|
|
244
|
+
`}static get properties(){return{...super.properties,upcomingOrderDate:{type:String,attribute:!1},auth:Ae,isPreview:{type:Boolean,attribute:!1},target:{type:String}}}constructor(){super();this.fetchOrders=()=>0,this.addEventListener("click",this.handleClick.bind(this))}updated(e){e.has("auth")&&this.auth&&!this.upcomingOrderDate&&!this.isPreview&&this.fetchOrders()}handleClick(){let e;if(!this.target&&this.offer)e=this.offer.querySelector("og-upsell-modal"),e||(e=this.offer.shadowRoot.querySelector("og-upsell-modal"));else if(this.target)e=document.querySelector(this.target);else throw Error("You must specify a target attribute or place this element as child of og-offer");e&&e.setAttribute("show",!0)}render(){return u`
|
|
147
245
|
<slot>
|
|
148
246
|
<og-next-upcoming-order></og-next-upcoming-order>
|
|
149
247
|
</slot>
|
|
150
|
-
`}};n(
|
|
248
|
+
`}};n(Zr,"UpsellButton");var Ec=n(t=>({isPreview:t.previewUpsellOffer}),"mapStateToProps"),gs=h(Ec,{fetchOrders:Nt})(Zr);v();N();var Xr=class extends A(F){static get properties(){return{...super.properties,defaultFrequency:ee,auth:Ae,subscribed:{type:Boolean,attribute:!1},frequency:{type:String,attribute:!1},nextUpcomingOrder:{type:Object,attribute:!1},show:{type:Boolean,attribute:"show"},offerId:{type:String}}}constructor(){super();this.createIu=()=>0,this.concludeUpsell=()=>0}render(){return u`
|
|
151
249
|
<og-modal ?show=${this.show} @close=${()=>this.close()} @confirm=${()=>this.confirm()}>
|
|
152
250
|
<div slot="content">
|
|
153
251
|
<slot>
|
|
@@ -185,7 +283,7 @@ var lib=(()=>{var Pa=Object.create;var Ye=Object.defineProperty;var Ra=Object.ge
|
|
|
185
283
|
</slot>
|
|
186
284
|
</span>
|
|
187
285
|
</og-modal>
|
|
188
|
-
`}set defaultFrequency(e){this._defaultFrequency=e}get defaultFrequency(){let e=this.querySelector("og-select-frequency");return e?e.defaultFrequency:this._defaultFrequency}confirm(){this.createIu(this.product,this.nextUpcomingOrder.public_id,1,this.subscribed,this.frequency||this.defaultFrequency),this.close()}close(){this.concludeUpsell(),this.removeAttribute("show")}};n(
|
|
286
|
+
`}set defaultFrequency(e){this._defaultFrequency=e}get defaultFrequency(){let e=this.querySelector("og-select-frequency");return e?e.defaultFrequency:this._defaultFrequency}confirm(){this.createIu(this.product,this.nextUpcomingOrder.public_id,1,this.subscribed,this.frequency||this.defaultFrequency),this.close()}close(){this.concludeUpsell(),this.removeAttribute("show")}};n(Xr,"UpsellModal");var Sc=n((t,e)=>({auth:t.auth,offerId:t.offerId,subscribed:$(e.product)(t),frequency:M(e.product)(t),...D(t,e,"defaultFrequency"),nextUpcomingOrder:t.previewUpsellOffer?{public_id:"preview-order-id"}:t.nextUpcomingOrder,isPreview:t.previewUpsellOffer}),"mapStateToProps"),ys=h(Sc,{concludeUpsell:on,createIu:un})(Xr);v();N();var eo=class extends j{static get properties(){return{...super.properties,frequency:{type:String}}}handleClick(e){this.subscribed?this.optoutProduct(this.product):this.optinProduct(this.product,this.frequency||this.defaultFrequency),e.preventDefault()}render(){return u`
|
|
189
287
|
<slot name="default">
|
|
190
288
|
<button id="action-trigger" class="btn checkbox ${this.subscribed?"active":""}"></button>
|
|
191
289
|
<label for="action-trigger">
|
|
@@ -194,13 +292,13 @@ var lib=(()=>{var Pa=Object.create;var Ye=Object.defineProperty;var Ra=Object.ge
|
|
|
194
292
|
></slot>
|
|
195
293
|
</label>
|
|
196
294
|
</slot>
|
|
197
|
-
`}};n(
|
|
295
|
+
`}};n(eo,"OptinToggle");var bs=h(z,{optoutProduct:we,optinProduct:Q})(eo);v();var vc=n((t,e)=>`${t}${parseInt(e,10)>1?"s":""}`,"pluralize"),to=class extends Gr(x){static get properties(){return{pluralize:{type:Number},variant:{type:Number},i18n:{type:Object,attribute:!1},locale:{type:Object,attribute:!1},key:{type:String}}}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this._textOverride=this.innerText.trim()}getText(){return this._textOverride?this._textOverride:this.getPluralizedText(this.getVariantText(this.key))}getVariantText(e){let r={...this.i18n,...this.offer&&this.offer.locale},o=typeof r[e]!="undefined"?r[e]:"";return typeof this.variant=="undefined"?o:o[this.variant]}getPluralizedText(e){return typeof this.pluralize=="undefined"?e:e&&vc(e,this.pluralize)}render(){return u`
|
|
198
296
|
${this.getText()}
|
|
199
|
-
`}};n(
|
|
200
|
-
${this.label} ${s?
|
|
201
|
-
`}renderFallback(){let e=this.from,r=this.value,o=this.initial?"initial":"ongoing";return
|
|
202
|
-
${
|
|
203
|
-
`}};n(
|
|
297
|
+
`}};n(to,"Text");var wc=n(t=>({i18n:t.locale||{}}),"mapStateToProps"),_s=h(wc)(to);v();var Ne=class{constructor(e){this.value=e,this.className="DiscountAmount"}toString(){return`${this.value}`}};n(Ne,"DiscountAmount");var et=class extends Ne{constructor(e){super(e);this.className="DiscountPercent"}toString(){return`${super.toString()}%`}};n(et,"DiscountPercent");var ro=class extends et{constructor(e){super(e);this.className="ShippingDiscountPercent"}toString(){return this.value===100?"free shipping":super.toString()}};n(ro,"ShippingDiscountPercent");var oo="Discount Percent",no="Discount Amount",xs="total_price",Es="shipping_total",Ss="sub_total",so=n(({field:t,object:e,type:r,value:o})=>{let i=[[new et(o),{field:xs,object:"item",type:oo}],[new Ne(o),{field:xs,object:"item",type:no}],[new ro(o),{field:Es,object:"order",type:oo}],[new Ne(o),{field:Es,object:"order",type:no}],[new et(o),{field:Ss,object:"order",type:oo}],[new Ne(o),{field:Ss,object:"order",type:no}]].find(([,a])=>a.field===t&&a.object===e&&a.type===r);return i&&i[0]},"discountBuilder");function Tc(t){return!(so(t).className!==this.incentiveClass||this.incentiveValue&&this.incentiveValue.toString()!==t.value.toString())}n(Tc,"filterIncentives");var io=class extends A(x){static get properties(){return{...super.properties,incentives:{type:Object,attribute:!1},from:{type:String},label:{type:String},initial:{type:Boolean,default:!1},value:{type:Number}}}createRenderRoot(){return this}render(){let e=this.from,r=this.value,o=this.initial?"initial":"ongoing",s=(this.incentives[o]||[]).find(Tc.bind({incentiveClass:e,incentiveValue:r}));return u`
|
|
298
|
+
${this.label} ${s?so(s):this.renderFallback()}
|
|
299
|
+
`}renderFallback(){let e=this.from,r=this.value,o=this.initial?"initial":"ongoing";return u`
|
|
300
|
+
${so({field:"sub_total",object:"order",type:"Discount Percent",value:this.value})}
|
|
301
|
+
`}};n(io,"IncentiveText");var Oc=n((t,e)=>({incentives:(t.incentives||{})[e&&e.product&&e.product.id]||{}}),"mapStateToProps"),vs=h(Oc)(io);v();N();var ao=class extends Gt(Ze){static get properties(){return{...super.properties,defaultText:{type:String,attribute:"default-text"}}}static get styles(){return w`
|
|
204
302
|
:host {
|
|
205
303
|
display: inline-block;
|
|
206
304
|
cursor: pointer;
|
|
@@ -211,15 +309,15 @@ var lib=(()=>{var Pa=Object.create;var Ye=Object.defineProperty;var Ra=Object.ge
|
|
|
211
309
|
box-shadow: 0 1px 0 1px rgba(0, 0, 0, 0.04);
|
|
212
310
|
z-index: 1;
|
|
213
311
|
}
|
|
214
|
-
`}set defaultFrequency(e){this._defaultFrequency=e}get defaultFrequency(){let{options:e,isSelected:r}=this.childOptions;return this.productDefaultFrequency?this.productDefaultFrequency:r||(e.length?e[0].value:this._defaultFrequency)}get currentFrequency(){return this.frequency||this.defaultFrequency}productChangeFrequency(e,r){this.frequency=r}render(){let{options:e}=this.childOptions;e.length||(e=(this.frequencies||[]).map(o=>({value:o,text:
|
|
312
|
+
`}set defaultFrequency(e){this._defaultFrequency=e}get defaultFrequency(){let{options:e,isSelected:r}=this.childOptions;return this.productDefaultFrequency?this.productDefaultFrequency:r||(e.length?e[0].value:this._defaultFrequency)}get currentFrequency(){return this.frequency||this.defaultFrequency}productChangeFrequency(e,r){this.frequency=r}render(){let{options:e}=this.childOptions;e.length||(e=(this.frequencies||[]).map(o=>({value:o,text:Ke(o,this.defaultFrequency)})));let r=this.defaultFrequency;return e=e.map(({text:o,value:s})=>({text:s===r?`${o} ${(this.defaultText||"").trim()}`.trim():o,value:s})),u`
|
|
215
313
|
<og-select
|
|
216
314
|
.options="${e}"
|
|
217
315
|
.selected="${this.currentFrequency}"
|
|
218
316
|
.onChange="${({target:{value:o}})=>{this.productChangeFrequency(this.product,o)}}"
|
|
219
317
|
></og-select>
|
|
220
|
-
`}};n(
|
|
221
|
-
${
|
|
222
|
-
`}};n(
|
|
318
|
+
`}};n(ao,"SelectFrequency");var ws=h(Xe,{productChangeFrequency:Rt})(ao);v();var Cc={day:{day:"2-digit"},"day-numeric":{day:"numeric"},"day-short":{weekday:"short"},"day-long":{weekday:"long"},month:{month:"2-digit"},"month-numeric":{month:"numeric"},"month-short":{month:"short"},"month-long":{month:"long"},year:{year:"2-digit"},"year-numeric":{year:"numeric"}};var Ts=n((t,e)=>t instanceof Date?(e||"").toString().replace(/\{\{([-\w]+)\}\}/g,r=>{let o=r.replace(/[{}]/g,""),s=Cc[o];if(typeof s=="undefined")return o;let a=new Intl.DateTimeFormat("en-us",s).formatToParts(t),[{value:c}]=a;return c}):t,"formatDate");var co=class extends x{static get properties(){return{value:{type:String,reflect:!0},format:{type:String}}}createRenderRoot(){return this}render(){return u`
|
|
319
|
+
${Ts(this.value,this.format||"{{month-long}} {{day}}, {{year-numeric}}")}
|
|
320
|
+
`}};n(co,"FormattedDate");var Pc=n(t=>({value:t.previewUpsellOffer?new Date:t.nextUpcomingOrder.place}),"mapStateToProps"),Os=h(Pc)(co);v();var Rs=re(vt());N();ae();var Cs=n((t,e)=>n(async function(o){await o({type:Ue,payload:t}),await o({type:_e}),await o(Te({in_stock:{[e]:!0},eligibility_groups:{[e]:["subscription","upsell"]},result:"success",autoship:{[e]:!0},modifiers:{},module_view:{regular:"096135e6650111e9a444bc764e106cf4"},incentives_display:{"47c01e9aacbe40389b5c7325d79091aa":{field:"sub_total",object:"order",type:"Discount Percent",value:5},e6534b9d877f41e586c37b7d8abc3a58:{field:"total_price",object:"item",type:"Discount Percent",value:10},f35e842710b24929922db4a529eecd40:{field:"total_price",object:"item",type:"Discount Percent",value:10},"5be321d7c17f4e18a757212b9a20bfcc":{field:"total_price",object:"item",type:"Discount Percent",value:1}},incentives:{[e]:{initial:["5be321d7c17f4e18a757212b9a20bfcc"],ongoing:["e6534b9d877f41e586c37b7d8abc3a58","47c01e9aacbe40389b5c7325d79091aa","f35e842710b24929922db4a529eecd40"]}}}))},"setPreviewStandardOfferThunk"),"setPreviewStandardOffer"),Rc=n((t,e)=>n(async function(o,s){await o({type:Fe,payload:t});let{merchantId:i}=s();t?(await o(Te({in_stock:{[e]:!0},module_view:{regular:"096135e6650111e9a444bc764e106cf4"},default_frequencies:{[e]:{every:1,every_period:3}},eligibility_groups:{[e]:["subscription","upsell"]},result:"success",autoship:{[e]:!0},modifiers:{}})),await o(yr({count:1,next:null,previous:null,results:[{merchant:"0e5de2bedc5e11e3a2e4bc764e106cf4",customer:"TestCust",payment:"e98e789aba0111e9b90fbc764e107990",shipping_address:"b3a5816ae59611e78937bc764e1043b0",public_id:"23322d4a83eb11ea9a1ebc764e101db1",sub_total:"206.98",tax_total:"0.00",shipping_total:"10.00",discount_total:"0.00",total:"216.98",created:"2020-04-21 11:14:11",place:"2020-06-24 00:00:00",cancelled:null,tries:0,generic_error_count:0,status:1,type:1,order_merchant_id:null,rejected_message:null,extra_data:null,locked:!1,oos_free_shipping:!1}]})),await o(gr(i,"sig_field","ts","sig"))):await o(pe())},"setPreviewUpsellOfferThunk"),"setPreviewUpsellOffer"),Ps=n((t,e,r)=>async function(o,s){switch(await o({type:G}),await o({type:Ue,payload:!1}),await o({type:Fe,payload:!1}),t){case"regular":o(Cs(!0,r.product.id));break;case"upsell":o(Rc(!0,r.product.id));break;case"subscribed":o(Cs(!0,r.product.id)),o(Q(r.product,"2_2"));break;default:}},"setPreview");N();var Ac=n((...t)=>JSON.stringify(t),"memoizeKey"),Nc=(0,Rs.default)((t,e)=>Object.assign({components:e},t),Ac),lo=class extends F{static get properties(){return{...super.properties,config:{type:Object,attribute:!1},product:us,productComponents:{type:Array,attribute:"product-components"},offerId:{type:String,attribute:!1},auth:Ae,preview:{type:String,attribute:"preview",reflect:"true"},location:{type:String},autoshipByDefault:{type:Boolean,attribute:"autoship-by-default"},productDefaultFrequency:{type:String,attribute:!1},locale:{type:Object,attribute:!0},firstOrderPlaceDate:{type:String,attribute:"first-order-place-date"},productToSubscribe:{type:String,attribute:"product-to-subscribe"},subscribed:{type:Boolean,reflect:!0},frequency:{type:String,reflect:!0}}}firstUpdated(){let e=Array.from(this.getAttributeNames()).find(r=>r.startsWith("preview-"));e==="preview-standard-offer"?this.preview="regular":e==="preview-upsell-offer"?this.preview="upsell":e==="preview-subscribed-offer"&&(this.preview="subscribed")}static get styles(){return w`
|
|
223
321
|
:host[hidden] {
|
|
224
322
|
display: none;
|
|
225
323
|
}
|
|
@@ -288,13 +386,22 @@ var lib=(()=>{var Pa=Object.create;var Ye=Object.defineProperty;var Ra=Object.ge
|
|
|
288
386
|
`}static get initialTemplate(){return`
|
|
289
387
|
<og-when test="regularEligible">
|
|
290
388
|
<div>
|
|
389
|
+
|
|
291
390
|
<og-optout-button>
|
|
292
391
|
<og-text key="offerOptOutLabel"></og-text>
|
|
293
392
|
</og-optout-button>
|
|
294
393
|
</div>
|
|
295
394
|
<div>
|
|
296
395
|
<og-optin-button>
|
|
297
|
-
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
<og-price discount>
|
|
399
|
+
<span slot="prepend">Subscribe and get</span>
|
|
400
|
+
<span slot="append">off</span>
|
|
401
|
+
</og-price>
|
|
402
|
+
<og-price regular></og-price>
|
|
403
|
+
<og-price subscription></og-price>
|
|
404
|
+
|
|
298
405
|
</og-optin-button>
|
|
299
406
|
<og-tooltip placement="top-right">
|
|
300
407
|
<div slot="trigger">
|
|
@@ -358,9 +465,9 @@ var lib=(()=>{var Pa=Object.create;var Ye=Object.defineProperty;var Ra=Object.ge
|
|
|
358
465
|
The product is in your next upcomming order
|
|
359
466
|
</og-when>
|
|
360
467
|
</og-when>
|
|
361
|
-
`}constructor(){super();this.module="pdp",this.product={},this.productComponents=[],this.fetchOffer=()=>0,this.fetchOrders=()=>0,this.productHasChangedComponents=()=>0,this.setFirstOrderPlaceDate=()=>0,this.setProductToSubscribe=()=>0,this.productChangeFrequency=()=>0}applyTemplate(e){super.applyTemplate(e);let{locale:r}=e;this.locale=r;let o=new CustomEvent("template-changed");this.dispatchEvent(o)}updated(e){if(e.has("preview")&&this.setPreview(this.preview,e.get("preview"),this),this.frequency=this.defaultFrequency,e.has("product")&&this.product.id&&!this.isPreview&&this.fetchOffer(this.product.id),e.has("firstOrderPlaceDate")&&this.product.id&&!this.isPreview&&this.setFirstOrderPlaceDate(this.product.id,this.firstOrderPlaceDate),e.has("productToSubscribe")&&this.product.id&&!this.isPreview&&this.setProductToSubscribe(this.product.id,this.productToSubscribe),e.has("auth")&&this.auth&&!this.isPreview&&this.fetchOrders(),e.has("productComponents")){let r=
|
|
468
|
+
`}constructor(){super();this.module="pdp",this.product={},this.productComponents=[],this.fetchOffer=()=>0,this.fetchOrders=()=>0,this.productHasChangedComponents=()=>0,this.setFirstOrderPlaceDate=()=>0,this.setProductToSubscribe=()=>0,this.productChangeFrequency=()=>0}applyTemplate(e){super.applyTemplate(e);let{locale:r}=e;this.locale=r;let o=new CustomEvent("template-changed");this.dispatchEvent(o)}updated(e){if(e.has("preview")&&this.setPreview(this.preview,e.get("preview"),this),this.frequency=this.defaultFrequency,e.has("product")&&this.product.id&&!this.isPreview&&this.fetchOffer(this.product.id),e.has("firstOrderPlaceDate")&&this.product.id&&!this.isPreview&&this.setFirstOrderPlaceDate(this.product.id,this.firstOrderPlaceDate),e.has("productToSubscribe")&&this.product.id&&!this.isPreview&&this.setProductToSubscribe(this.product.id,this.productToSubscribe),e.has("auth")&&this.auth&&!this.isPreview&&this.fetchOrders(),e.has("productComponents")){let r=Nc(this.product,this.productComponents),o=Object.assign({},this.product,{components:e.get("productComponents")});R(r,o)||this.productHasChangedComponents(r,o)}(e.has("offerId")||e.has("autoshipByDefault")||e.has("location")||e.has("product"))&&this.offerId&&this.autoshipByDefault&&this.location==="cart"&&this.product.id&&this.optinProduct&&!(this.optedin||[]).find(r=>R(r,this.product))&&this.optinProduct({...this.product,...this.productComponents.length&&{components:this.productComponents}},this.defaultFrequency)}get isPreview(){return this.preview}render(){return u`
|
|
362
469
|
<slot></slot>
|
|
363
|
-
`}get defaultFrequency(){let e=this.productFrequency||this.productDefaultFrequency;if(e)return e;let r=this.querySelector("og-select-frequency");return r&&r.currentFrequency?r.currentFrequency:this.getOption("defaultFrequency")}};n(
|
|
470
|
+
`}get defaultFrequency(){let e=this.productFrequency||this.productDefaultFrequency;if(e)return e;let r=this.querySelector("og-select-frequency");return r&&r.currentFrequency?r.currentFrequency:this.getOption("defaultFrequency")}};n(lo,"Offer");var kc=n((t,e)=>({config:t.config,auth:t.auth,offerId:((t.productOffer||{})[(e.product||{}).id]||[])[0],productFrequency:M(e.product)(t),productDefaultFrequency:Ct((e.product||{}).id)(t),...D(t,e,"autoshipByDefault",dr(t)[(e.product||{}).id]),...Qo(e.product)(t)&&{autoshipByDefault:!1},optedin:Ot(t),subscribed:$(e.product)(t),...ve(t)}),"mapStateToProps"),As=h(kc,{fetchOffer:cn,fetchOrders:Nt,productHasChangedComponents:rn,optinProduct:Q,setFirstOrderPlaceDate:mn,setProductToSubscribe:gn,setPreview:Ps})(lo);v();var Qt=class extends x{constructor(){super();this.showCancelButton=!0,this.showConfirmButton=!0}static get properties(){return{title:{type:String,attribute:!1},content:{type:String,attribute:!1},confirmText:{type:String,attribute:!1},cancelText:{type:String,attribute:!1},showCancelButton:{type:Boolean},showConfirmButton:{type:Boolean},show:{type:Boolean,attribute:"show"}}}static get styles(){return w`
|
|
364
471
|
:host[hidden] {
|
|
365
472
|
display: none;
|
|
366
473
|
}
|
|
@@ -472,7 +579,7 @@ var lib=(()=>{var Pa=Object.create;var Ye=Object.defineProperty;var Ra=Object.ge
|
|
|
472
579
|
.btn {
|
|
473
580
|
cursor: pointer;
|
|
474
581
|
}
|
|
475
|
-
`}close(){this.removeAttribute("show"),this.dispatchEvent(new CustomEvent("close"))}confirm(){this.removeAttribute("show"),this.dispatchEvent(new CustomEvent("confirm"))}get confirmButton(){return this.showConfirmButton?
|
|
582
|
+
`}close(){this.removeAttribute("show"),this.dispatchEvent(new CustomEvent("close"))}confirm(){this.removeAttribute("show"),this.dispatchEvent(new CustomEvent("confirm"))}get confirmButton(){return this.showConfirmButton?u`
|
|
476
583
|
<span @click="${()=>this.confirm()}">
|
|
477
584
|
<slot name="confirm" class="btn">
|
|
478
585
|
<button class="og-modal__btn og-modal__btn-primary og-modal__confirm" @click="${()=>this.confirm()}">
|
|
@@ -480,7 +587,7 @@ var lib=(()=>{var Pa=Object.create;var Ye=Object.defineProperty;var Ra=Object.ge
|
|
|
480
587
|
</button>
|
|
481
588
|
</slot>
|
|
482
589
|
</span>
|
|
483
|
-
`:
|
|
590
|
+
`:u``}get cancelButton(){return this.showCancelButton?u`
|
|
484
591
|
<span @click="${()=>this.close()}" class="btn">
|
|
485
592
|
<slot name="cancel">
|
|
486
593
|
<button class="og-modal__btn og-modal__cancel" @click="${()=>this.close()}">
|
|
@@ -488,7 +595,7 @@ var lib=(()=>{var Pa=Object.create;var Ye=Object.defineProperty;var Ra=Object.ge
|
|
|
488
595
|
</button>
|
|
489
596
|
</slot>
|
|
490
597
|
</span>
|
|
491
|
-
`:
|
|
598
|
+
`:u``}render(){return this.show?u`
|
|
492
599
|
<div class="og-modal is-open" aria-hidden="true">
|
|
493
600
|
<div class="og-modal__overlay" tabindex="-1">
|
|
494
601
|
<div class="og-modal__container" role="dialog" aria-modal="true">
|
|
@@ -507,7 +614,7 @@ var lib=(()=>{var Pa=Object.create;var Ye=Object.defineProperty;var Ra=Object.ge
|
|
|
507
614
|
</div>
|
|
508
615
|
</div>
|
|
509
616
|
</div>
|
|
510
|
-
`:
|
|
617
|
+
`:u``}};n(Qt,"Modal");v();var Jt=class extends x{static get styles(){return w`
|
|
511
618
|
:host {
|
|
512
619
|
display: inline-block;
|
|
513
620
|
color: inherit;
|
|
@@ -566,9 +673,9 @@ var lib=(()=>{var Pa=Object.create;var Ye=Object.defineProperty;var Ra=Object.ge
|
|
|
566
673
|
line-height: 0.2em;
|
|
567
674
|
transform: scaleY(0.5);
|
|
568
675
|
}
|
|
569
|
-
`}static get properties(){return{options:{type:Array},selected:{type:String}}}render(){return
|
|
676
|
+
`}static get properties(){return{options:{type:Array},selected:{type:String}}}render(){return u`
|
|
570
677
|
<select @change="${this.onChange}" .value="${this.selected}">
|
|
571
|
-
${this.options.map(e=>
|
|
678
|
+
${this.options.map(e=>u`
|
|
572
679
|
<option value="${e.value}" ?selected=${this.selected===e.value}>${e.text}</option>
|
|
573
680
|
`)}
|
|
574
681
|
</select>
|
|
@@ -577,7 +684,7 @@ var lib=(()=>{var Pa=Object.create;var Ye=Object.defineProperty;var Ra=Object.ge
|
|
|
577
684
|
<path d="M10.5 15l7.5 7.5 7.5-7.5z" />
|
|
578
685
|
<path d="M0 0h36v36h-36z" fill="none" />
|
|
579
686
|
</svg> -->
|
|
580
|
-
`}};n(
|
|
687
|
+
`}};n(Jt,"Select");v();var Kt=class extends x{static get properties(){return{placement:{type:String,default:"top"}}}static get styles(){return w`
|
|
581
688
|
:host[hidden] {
|
|
582
689
|
display: none;
|
|
583
690
|
}
|
|
@@ -724,7 +831,7 @@ var lib=(()=>{var Pa=Object.create;var Ye=Object.defineProperty;var Ra=Object.ge
|
|
|
724
831
|
pointer-events: auto;
|
|
725
832
|
transform: translateY(0px);
|
|
726
833
|
}
|
|
727
|
-
`}connectedCallback(){super.connectedCallback(),this.showTooltip=this.showTooltip.bind(this),this.addEventListener("mouseenter",this.showTooltip)}showTooltip(){let r=this.shadowRoot.querySelector(".trigger").getBoundingClientRect(),o=this.shadowRoot.querySelector(".content"),s=o.getBoundingClientRect();!this.placement||this.placement==="top"||this.placement==="bottom"?o.style.left=`${(-1*s.width+r.width)/2}px`:(this.placement==="left"||this.placement==="right")&&(o.style.top=`${(-1*s.height+r.height)/2}px`)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("mouseenter",this.showTooltip),this.removeEventListener("mouseout",this.hideTooltip)}render(){return
|
|
834
|
+
`}connectedCallback(){super.connectedCallback(),this.showTooltip=this.showTooltip.bind(this),this.addEventListener("mouseenter",this.showTooltip)}showTooltip(){let r=this.shadowRoot.querySelector(".trigger").getBoundingClientRect(),o=this.shadowRoot.querySelector(".content"),s=o.getBoundingClientRect();!this.placement||this.placement==="top"||this.placement==="bottom"?o.style.left=`${(-1*s.width+r.width)/2}px`:(this.placement==="left"||this.placement==="right")&&(o.style.top=`${(-1*s.height+r.height)/2}px`)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("mouseenter",this.showTooltip),this.removeEventListener("mouseout",this.hideTooltip)}render(){return u`
|
|
728
835
|
<span class="tooltip">
|
|
729
836
|
<span class="trigger">
|
|
730
837
|
<slot name="trigger">
|
|
@@ -737,104 +844,12 @@ var lib=(()=>{var Pa=Object.create;var Ye=Object.defineProperty;var Ra=Object.ge
|
|
|
737
844
|
</slot>
|
|
738
845
|
</div>
|
|
739
846
|
</span>
|
|
740
|
-
`}};n(
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
padding: 1em;
|
|
748
|
-
border-radius: 5px;
|
|
749
|
-
border: 1px solid #ccc;
|
|
750
|
-
box-shadow: 2px 2px 0 0 #000;
|
|
751
|
-
}
|
|
752
|
-
|
|
753
|
-
button {
|
|
754
|
-
margin: 0 0.5em 0.5em;
|
|
755
|
-
background-color: gray;
|
|
756
|
-
color: white;
|
|
757
|
-
border: 0;
|
|
758
|
-
border-radius: 3px;
|
|
759
|
-
cursor: pointer;
|
|
760
|
-
padding: 0.5em;
|
|
761
|
-
}
|
|
762
|
-
|
|
763
|
-
button.primary {
|
|
764
|
-
background-color: blue;
|
|
765
|
-
padding: 1em;
|
|
766
|
-
color: white;
|
|
767
|
-
border: 0;
|
|
768
|
-
border-radius: 3px;
|
|
769
|
-
}
|
|
770
|
-
|
|
771
|
-
button[disabled] {
|
|
772
|
-
background-color: #777;
|
|
773
|
-
}
|
|
774
|
-
|
|
775
|
-
div {
|
|
776
|
-
margin-bottom: 0.5em;
|
|
777
|
-
}
|
|
778
|
-
|
|
779
|
-
.message {
|
|
780
|
-
margin-left: 0.5em;
|
|
781
|
-
margin: 1em;
|
|
782
|
-
}
|
|
783
|
-
|
|
784
|
-
.success {
|
|
785
|
-
color: green;
|
|
786
|
-
}
|
|
787
|
-
|
|
788
|
-
.error {
|
|
789
|
-
color: red;
|
|
790
|
-
}
|
|
791
|
-
|
|
792
|
-
.warning {
|
|
793
|
-
color: orange;
|
|
794
|
-
}
|
|
795
|
-
a {
|
|
796
|
-
color: white;
|
|
797
|
-
}
|
|
798
|
-
`}runTests(){this.results=[],this.disabled=!0,this.requestUpdate(),document.querySelectorAll("og-offer").forEach(r=>{let o=r.store.getState(),s=r.getAttribute("product"),i=r.getAttribute("location"),a={messages:this.getOfferAttributeMessages(s,i).concat(this.getOfferRequestMessages(s,o)),product:s};this.results.push(a)}),this.testsRan=!0,this.disabled=!1,this.requestUpdate()}getOfferAttributeMessages(e,r){let o=[];return e||o.push({name:"Offer element found but missing product attribute",type:"error"}),r||o.push({name:"Offer element found but missing location attribute",type:"warning"}),e&&r&&o.push({name:"Offer element found and properly tagged",type:"success"}),o}getOfferRequestMessages(e,r){let o=r.inStock[e],s=r.autoshipEligible[e],i=[];return e&&o===!1&&i.push({name:"This product is marked as out of stock in the OG database",type:"warning"}),e&&s===!1&&i.push({name:"This product is not eligible for autoship",type:"warning"}),e&&o===null&&s===null&&i.push({name:"This product does not exist in our database",type:"error"}),i}resultsCodeBlock(){return this.results.length===0?p`
|
|
799
|
-
<div class="message error">No offer element found on the page</div>
|
|
800
|
-
`:this.results.map((e,r)=>p`
|
|
801
|
-
<div>For offer tag with product = "${e.product}"</div>
|
|
802
|
-
${e.messages.map(o=>p`
|
|
803
|
-
<div class="message ${o.type}">
|
|
804
|
-
${o.name}
|
|
805
|
-
</div>
|
|
806
|
-
`)}
|
|
807
|
-
<button @click=${this.toggleProductFlags(r,{})}>
|
|
808
|
-
Set inStock and eligible
|
|
809
|
-
</button>
|
|
810
|
-
<br />
|
|
811
|
-
<button @click=${this.toggleProductFlags(r,{inStock:!1})}>
|
|
812
|
-
Set to not inStock
|
|
813
|
-
</button>
|
|
814
|
-
<br />
|
|
815
|
-
<button @click=${this.toggleProductFlags(r,{autoship:!1})}>
|
|
816
|
-
Set to not eligible
|
|
817
|
-
</button>
|
|
818
|
-
<br />
|
|
819
|
-
<button @click=${this.toggleProductFlags(r,{autoship:!1,inStock:!1})}>
|
|
820
|
-
Set to not eligible and not in stock
|
|
821
|
-
</button>
|
|
822
|
-
<br />
|
|
823
|
-
<button @click=${this.toggleUpsellPreview(r)}>
|
|
824
|
-
Toggle upsell/regular in this offer
|
|
825
|
-
</button>
|
|
826
|
-
<br />
|
|
827
|
-
<button @click=${this.toggleUpsellNextOrder(r)}>
|
|
828
|
-
upsell product is in next order
|
|
829
|
-
</button>
|
|
830
|
-
<br />
|
|
831
|
-
`)}toggleUpsellPreview(e){return r=>{r.preventDefault();let o=document.querySelectorAll("og-offer")[e];o.getAttribute("preview-upsell-offer")?o.removeAttribute("preview-upsell-offer"):o.setAttribute("preview-upsell-offer",!0),this.runTests()}}toggleProductFlags(e,{inStock:r=!0,autoship:o=!0,groups:s=["subscription","upsell"]}){return i=>{i.preventDefault();let a=document.querySelectorAll("og-offer")[e],c=a.product.id;a.store.dispatch(be({in_stock:{[c]:r},eligibility_groups:{[c]:s},result:"success",autoship:{[c]:o},module_view:{regular:"58a01e9aacbe40389b5c7325d79091bb"},modifiers:{},incentives_display:{"47c01e9aacbe40389b5c7325d79091aa":{field:"sub_total",object:"order",type:"Discount Percent",value:5},e6534b9d877f41e586c37b7d8abc3a58:{field:"total_price",object:"item",type:"Discount Percent",value:5},f35e842710b24929922db4a529eecd40:{field:"total_price",object:"item",type:"Discount Percent",value:10},"5be321d7c17f4e18a757212b9a20bfcc":{field:"total_price",object:"item",type:"Discount Percent",value:1}},incentives:{[c]:{initial:["5be321d7c17f4e18a757212b9a20bfcc"],ongoing:["e6534b9d877f41e586c37b7d8abc3a58","47c01e9aacbe40389b5c7325d79091aa","f35e842710b24929922db4a529eecd40"]}}})),this.runTests()}}toggleUpsellNextOrder(e){return r=>{let o=document.querySelectorAll("og-offer")[e],s=o.product.id;r.preventDefault(),o.store.dispatch(Wt({count:1,next:null,previous:null,results:[{order:"24d50352579511ea806cbc764e100cfd",offer:null,subscription:"8a076b7a0ea011e7a5bcbc764e105eda",product:s,components:[],quantity:1,public_id:"24d6901e579511ea806cbc764e100cfd",product_attribute:null,price:"14.99",extra_cost:"0.00",total_price:"13.49",one_time:!1,frozen:!1,first_placed:null}]})),this.runTests()}}render(){return p`
|
|
832
|
-
<div>
|
|
833
|
-
${this.testsRan?this.resultsCodeBlock():p`
|
|
834
|
-
<div>Click the button to run tests</div>
|
|
835
|
-
`}
|
|
836
|
-
<button ?disabled=${this.disabled} @click="${this.runTests.bind(this)}" class="primary">Run Test</button>
|
|
837
|
-
</div>
|
|
838
|
-
`}};n(Tr,"TestWizard");eu=Tr});function qo(){let t="og-test-wizard";customElements.get(t)||customElements.define(t,tu);let e=document.createElement(t);document.body.appendChild(e)}var tu,xa=u(()=>{({TestWizard:tu}=(Ea(),_a));n(qo,"default")});var va={};b(va,{default:()=>ru,enable:()=>Sa,keys:()=>Or});var Or,Sa,ru,wa=u(()=>{xa();Or=[79,71,68,69,86],Sa=n(()=>{if(window.OG_OFFERS_TEST_MODE_ENABLE)return;window.OG_OFFERS_TEST_MODE_ENABLE=!0;let t=0;document.addEventListener("keyup",async function(e){if(e.which===Or[t]){let o=Or[t];setTimeout(function(){t<=o&&(t=0)},5e3),t+=1,t>=Or.length&&qo()}else t=0},!1)},"enable"),ru=Sa});var Cu=K((ih,Oa)=>{var{offersLiveEditor:ou}=(Lo(),Do),{setStore:nu}=(R(),Wo),{getStore:su}=(Ss(),xs),{listenLocalStorageChanges:iu}=(Qt(),hs),Ta=(Ts(),ws),V=(k(),ps),{ConnectedWhen:au}=(fi(),di),{ConnectedOptinButton:cu}=(_i(),bi),{ConnectedOptoutButton:lu}=(Si(),xi),{ConnectedOptinSelect:uu}=(Ci(),Oi),{ConnectedUpsellButton:pu}=(Ai(),Ri),{ConnectedUpsellModal:du}=(qi(),ki),{ConnectedOptinToggle:fu}=(Fi(),Ui),{ConnectedOptinStatus:hu}=(He(),gi),{ConnectedText:mu}=(Vi(),Mi),{ConnectedIncentiveText:gu}=(Qi(),Yi),{ConnectedSelectFrequency:yu}=(Zi(),Ki),{ConnectedNextUpcomingOrder:bu}=(oa(),ra),{ConnectedOffer:_u}=(da(),pa),{Modal:Eu}=(ha(),fa),{Select:xu}=(ga(),ma),{Tooltip:Su}=(ba(),ya),{ConnectedFrequencyStatus:vu}=(mr(),wi),wu=(wa(),va),{default:Tu}=(oe(),vn),{environment:Ou}=(zr(),Zn);wu.enable();var A,w={setEnvironment(t){return A.dispatch(V.setEnvironment(t)),w},setMerchantId(t){return A.dispatch(V.setMerchantId(t)),w},setAuthUrl(t){return A.dispatch(V.setAuthUrl(t)),w},getProductsForPurchasePost(t=[]){return Ta.getProductsForPurchasePost(A.getState(),t)},getOptins(t=[]){return Ta.getProductsForPurchasePost(A.getState(),t)},clear(){A.dispatch(V.checkout())},addOptinChangedCallback(t){typeof t=="function"&&document.addEventListener("optin-changed",e=>t(e.detail))},disableOptinChangedCallbacks(){document.addEventListener("optin-changed",t=>t.stopPropagation(),!0)},register(){try{customElements.define("og-when",au),customElements.define("og-text",mu),customElements.define("og-incentive-text",gu),customElements.define("og-offer",_u),customElements.define("og-select-frequency",yu),customElements.define("og-optout-button",lu),customElements.define("og-optin-toggle",fu),customElements.define("og-optin-status",hu),customElements.define("og-optin-button",cu),customElements.define("og-optin-select",uu),customElements.define("og-upsell-button",pu),customElements.define("og-frequency-status",vu),customElements.define("og-modal",Eu),customElements.define("og-select",xu),customElements.define("og-tooltip",Su),customElements.define("og-upsell-modal",du),customElements.define("og-next-upcoming-order",bu)}catch(t){console.log("this?",t)}w.register=()=>0},previewMode(t){return window.og=window.og||{},t===!1?delete window.og:window.og.previewMode=!0,this},initialize(t,e,r){if(w.isReady)return console.warn("og.offers has been initialized already. Skipping."),w;A=su();let o=window.og_settings;if(t&&e&&o){let s=[];o.product?s.push(o.product):o.cart&&Array.isArray(o.cart.products)&&(s=s.concat(o.cart.products));let{apiUrl:i}=Ou({},V.setEnvironment(e)),{sessionId:a}=A.getState();a&&s.forEach(c=>Tu.fetchOffer(i,t,a,`${c}`,"pdp"))}return nu(A),t&&w.setMerchantId(t),e&&w.setEnvironment(e),r&&w.setAuthUrl(r),window.addEventListener("storage",iu(A)),t&&e&&(A.dispatch(V.requestSessionId()),A.dispatch(V.fetchAuth()),w.register()),w.isReady=!0,w},config(t){return A.dispatch(V.setConfig(t)),w},setLocale(t){return A.dispatch(V.setLocale(t)),w},addTemplate(t,e,r){return A.dispatch(V.addTemplate(t,e,r)),w},setTemplates(t){return A.dispatch(V.setTemplates(t)),w},setPublicPath(t){return w}};window.OG=window.OG||{};Object.assign(window.OG,w);Object.assign(w.initialize,w);ou();Oa.exports=w.initialize});return Cu();})();
|
|
847
|
+
`}};n(Kt,"Tooltip");var{TestWizard:qc}=(ks(),Ns);function uo(){let t="og-test-wizard";customElements.get(t)||customElements.define(t,qc);let e=document.createElement(t);document.body.appendChild(e)}n(uo,"default");var po=[79,71,68,69,86],Is=n(()=>{if(window.OG_OFFERS_TEST_MODE_ENABLE)return;window.OG_OFFERS_TEST_MODE_ENABLE=!0;let t=0;document.addEventListener("keyup",async function(e){if(e.which===po[t]){let o=po[t];setTimeout(function(){t<=o&&(t=0)},5e3),t+=1,t>=po.length&&uo()}else t=0},!1)},"enable");Y();ae();v();var fo=class extends A(F){static get properties(){return{...super.properties,regular:{type:Boolean,reflect:!0},subscription:{type:Boolean,reflect:!0},discount:{type:Boolean,reflect:!0}}}get value(){let e=this.frequency||this.defaultFrequency,o=(this.productPlans[this.product.id]||{})[e]||[];if(!o)return"";let[s,i,a]=o;return a===s?"":this.regular?(this.style.textDecoration="line-through",s):this.subscription?a:this.discount?i:""}render(){let e=this.value;return e?u`
|
|
848
|
+
<slot name="prepend"></slot>
|
|
849
|
+
${e}
|
|
850
|
+
<slot name="append"></slot>
|
|
851
|
+
`:u`
|
|
852
|
+
<slot></slot>
|
|
853
|
+
`}};n(fo,"Price");var Uc=n((t,e)=>({productPlans:t.productPlans,frequency:M(e.product)(t),...D(t,e,"defaultFrequency")}),"mapStateToProps"),qs=h(Uc)(fo);Is();var C,_={};function Us(t){return C.dispatch(_r(t)),_}n(Us,"setEnvironment");function Fs(t){return C.dispatch(nn(t)),_}n(Fs,"setMerchantId");function Ds(t){return C.dispatch(sn(t)),_}n(Ds,"setAuthUrl");function Ls(t=[]){return Sr(C.getState(),t)}n(Ls,"getProductsForPurchasePost");function js(t=[]){return Sr(C.getState(),t)}n(js,"getOptins");function Ms(){C.dispatch(ln())}n(Ms,"clear");function Vs(t){typeof t=="function"&&document.addEventListener("optin-changed",e=>t(e.detail))}n(Vs,"addOptinChangedCallback");function $s(){document.addEventListener("optin-changed",t=>t.stopPropagation(),!0)}n($s,"disableOptinChangedCallbacks");function Bs(){try{customElements.define("og-when",ls),customElements.define("og-text",_s),customElements.define("og-incentive-text",vs),customElements.define("og-offer",As),customElements.define("og-select-frequency",ws),customElements.define("og-optout-button",fs),customElements.define("og-optin-toggle",bs),customElements.define("og-optin-status",ps),customElements.define("og-optin-button",ds),customElements.define("og-optin-select",ms),customElements.define("og-upsell-button",gs),customElements.define("og-frequency-status",hs),customElements.define("og-modal",Qt),customElements.define("og-select",Jt),customElements.define("og-tooltip",Kt),customElements.define("og-upsell-modal",ys),customElements.define("og-next-upcoming-order",Os),customElements.define("og-price",qs)}catch(t){console.warn(t)}_.register=()=>0}n(Bs,"register");function Hs(t){return window.og=window.og||{},t===!1?delete window.og:window.og.previewMode=!0,this}n(Hs,"previewMode");function zs(t){return C.dispatch(dn(t)),_}n(zs,"config");function Gs(t){return C.dispatch(pn(t)),_}n(Gs,"setLocale");function Ws(t,e,r){return C.dispatch(fn(t,e,r)),_}n(Ws,"addTemplate");function Ys(t){return C.dispatch(hn(t)),_}n(Ys,"setTemplates");function Qs(t){return _}n(Qs,"setPublicPath");function Js(t,e,r,o=C){if(t&&e&&r){let s=[];r.product?s.push(r.product):r.cart&&Array.isArray(r.cart.products)&&(s=s.concat(r.cart.products));let{apiUrl:i}=hr({},_r(e)),{sessionId:a}=o.getState();a&&s.forEach(c=>{console.log(c),W.fetchOffer(i,t,a,`${c}`,"pdp")}),r.product_x_plans&&typeof r.product_x_plans=="object"&&o.dispatch({type:xt,payload:r.product_x_plans})}}n(Js,"resolveSettings");function ho(t,e,r){return _.isReady?(console.warn("og.offers has been initialized already. Skipping."),_):(C=On(),_.store=C,_.resolveSettings(t,e,window.og_settings,C),wo(C),t&&_.setMerchantId(t),e&&_.setEnvironment(e),r&&_.setAuthUrl(r),window.addEventListener("storage",En(C)),t&&e&&(C.dispatch(kt()),C.dispatch(an()),_.register()),_.isReady=!0,_)}n(ho,"initialize");var Fc=ho;Object.assign(_,{setEnvironment:Us,setMerchantId:Fs,setAuthUrl:Ds,getProductsForPurchasePost:Ls,getOptins:js,clear:Ms,addOptinChangedCallback:Vs,disableOptinChangedCallbacks:$s,register:Bs,previewMode:Hs,config:zs,setLocale:Gs,addTemplate:Ws,setTemplates:Ys,setPublicPath:Qs,resolveSettings:Js,initialize:ho});window.OG=window.OG||{};Object.assign(window.OG,_);Object.assign(_.initialize,_);tr();return Dc;})();
|
|
839
854
|
; return lib; });
|
|
840
855
|
//# sourceMappingURL=offers.js.map
|