@ordergroove/offers 2.28.3-alpha-PR-686-11.10 → 2.28.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/CHANGELOG.md +8 -0
- package/dist/bundle-report.html +13 -16
- package/dist/examples.js +26 -22
- package/dist/examples.js.map +2 -2
- package/dist/offers.js +30 -32
- package/dist/offers.js.map +3 -3
- package/package.json +3 -3
- package/src/core/utils.ts +1 -15
- package/src/make-api.js +0 -2
- package/src/components/DefaultFrequencyText.js +0 -56
package/dist/offers.js
CHANGED
|
@@ -8,8 +8,8 @@ else {
|
|
|
8
8
|
window.og['offers'] = factory();
|
|
9
9
|
}
|
|
10
10
|
})(()=>{
|
|
11
|
-
var lib=(()=>{var sa=Object.create;var Xe=Object.defineProperty;var ia=Object.getOwnPropertyDescriptor;var aa=Object.getOwnPropertyNames;var ca=Object.getPrototypeOf,la=Object.prototype.hasOwnProperty;var pn=t=>Xe(t,"__esModule",{value:!0}),n=(t,e)=>Xe(t,"name",{value:e,configurable:!0});var T=(t,e)=>()=>(t&&(e=t(t=0)),e);var me=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Cr=(t,e)=>{pn(t);for(var r in e)Xe(t,r,{get:e[r],enumerable:!0})},ua=(t,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of aa(e))!la.call(t,o)&&o!=="default"&&Xe(t,o,{get:()=>e[o],enumerable:!(r=ia(e,o))||r.enumerable});return t},re=t=>ua(pn(Xe(t!=null?sa(ca(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var At=me((Rt,_n)=>{(function(t,e){typeof Rt=="object"&&typeof _n!="undefined"?e(Rt):typeof define=="function"&&define.amd?define(["exports"],e):(t=t||self,e(t.throttleDebounce={}))})(Rt,function(t){"use strict";function e(o,s,i,a){var c,l=!1,u=0;function h(){c&&clearTimeout(c)}n(h,"clearExistingTimeout");function p(){h(),l=!0}n(p,"cancel"),typeof s!="boolean"&&(a=i,i=s,s=void 0);function m(){for(var C=arguments.length,_=new Array(C),f=0;f<C;f++)_[f]=arguments[f];var E=this,w=Date.now()-u;if(l)return;function b(){u=Date.now(),i.apply(E,_)}n(b,"exec");function y(){c=void 0}n(y,"clear"),a&&!c&&b(),h(),a===void 0&&w>o?b():s!==!0&&(c=setTimeout(a?y:b,a===void 0?o-w: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})})});function xn(){return typeof window.og_auth!="undefined"?Nt(window.og_auth):null}async function Ea(t=100){return new Promise(e=>{setTimeout(()=>e(xn()),t)})}async function Sn(t,e=ya,r=ba){let o;if(o=Nt(xn())||Nt(e()),o)return o;if(t&&typeof t=="string"){let s=await fetch(t);s.status>=200&&s.status<300&&(o=e()||await(_a(s)?s.json():Promise.resolve(r(t)).then(e)))}else o||(o=await Ea());if(o=Nt(o),o)return o;throw new Error("Unauthorized")}var En,ya,Nt,ba,_a,Tn=T(()=>{En=/^og_auth=/,ya=n((t=En)=>(document.cookie.split(/;\s*/).find(e=>e.match(t))||"").replace(En,""),"c"),Nt=n(t=>{if(typeof t=="object")return t;let e=String(t||"").split("|");return e.length===3?{sig_field:e[0],ts:parseInt(e[1],10),sig:e[2]}:null},"r"),ba=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"),_a=n(t=>(t.headers.get("content-type")||"").indexOf("application/json")!==-1,"d");n(xn,"a");n(Ea,"f");n(Sn,"u")});var k,F,U,Ie,W,P,tt,ke,qt,vn,It,Fe,On,kt,Ft,wn,Ue,De,Le,Cn,Pn,Ut,Rn,Dt,Me,An,Lt,Mt,rt,ot,jt,$t,ge,oe,Vt,Ht,K,Y,ne,ye,Gt,be,_e,Bt,zt,Nn,M=T(()=>{k="OPTIN_PRODUCT",F="OPTOUT_PRODUCT",U="PRODUCT_CHANGE_FREQUENCY",Ie="SET_MERCHANT_ID",W="REQUEST_OFFER",P="RECEIVE_OFFER",tt="PRODUCT_HAS_CHANGED",ke="CREATED_SESSION_ID",qt="SET_AUTH_URL",vn="REQUEST_AUTH",It="AUTHORIZE",Fe="UNAUTHORIZED",On="REQUEST_ORDERS",kt="RECEIVE_ORDERS",Ft="RECEIVE_ORDER_ITEMS",wn="FETCH_RESPONSE_ERROR",Ue="SET_ENVIRONMENT_STAGING",De="SET_ENVIRONMENT_DEV",Le="SET_ENVIRONMENT_PROD",Cn="CONCLUDE_UPSELL",Pn="REQUEST_CREATE_IU_ORDER",Ut="CREATE_ONE_TIME",Rn="REQUEST_CONVERT_ONE_TIME",Dt="CONVERT_ONE_TIME",Me="CHECKOUT",An="RECEIVE_FETCH",Lt="SET_LOCALE",Mt="SET_CONFIG",rt="SET_PREVIEW_STANDARD_OFFER",ot="SET_PREVIEW_UPSELL_OFFER",jt="ADD_TEMPLATE",$t="SET_TEMPLATES",ge="LOCAL_STORAGE_CHANGE",oe="LOCAL_STORAGE_CLEAR",Vt="SET_FIRST_ORDER_PLACE_DATE",Ht="SET_PRODUCT_TO_SUBSCRIBE",K="RECEIVE_PRODUCT_PLANS",Y="SETUP_PRODUCT",ne="SETUP_CART",ye="pdp",Gt="dev",be="staging",_e="prod",Bt="static.ordergroove.com",zt="staging.static.ordergroove.com",Nn="og-cart-updated"});var st=me((Vu,Mn)=>{var xa="Expected a function",qn="__lodash_hash_undefined__",Sa="[object Function]",Ta="[object GeneratorFunction]",va=/[\\^$.*+?()[\]{}|]/g,Oa=/^\[object .+?Constructor\]$/,wa=typeof window=="object"&&window&&window.Object===Object&&window,Ca=typeof self=="object"&&self&&self.Object===Object&&self,In=wa||Ca||Function("return this")();function Pa(t,e){return t==null?void 0:t[e]}n(Pa,"getValue");function Ra(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}n(Ra,"isHostObject");var Aa=Array.prototype,Na=Function.prototype,kn=Object.prototype,Ir=In["__core-js_shared__"],Fn=function(){var t=/[^.]+$/.exec(Ir&&Ir.keys&&Ir.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),Un=Na.toString,kr=kn.hasOwnProperty,qa=kn.toString,Ia=RegExp("^"+Un.call(kr).replace(va,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ka=Aa.splice,Fa=Dn(In,"Map"),nt=Dn(Object,"create");function Ee(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(Ee,"Hash");function Ua(){this.__data__=nt?nt(null):{}}n(Ua,"hashClear");function Da(t){return this.has(t)&&delete this.__data__[t]}n(Da,"hashDelete");function La(t){var e=this.__data__;if(nt){var r=e[t];return r===qn?void 0:r}return kr.call(e,t)?e[t]:void 0}n(La,"hashGet");function Ma(t){var e=this.__data__;return nt?e[t]!==void 0:kr.call(e,t)}n(Ma,"hashHas");function ja(t,e){var r=this.__data__;return r[t]=nt&&e===void 0?qn:e,this}n(ja,"hashSet");Ee.prototype.clear=Ua;Ee.prototype.delete=Da;Ee.prototype.get=La;Ee.prototype.has=Ma;Ee.prototype.set=ja;function je(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(je,"ListCache");function $a(){this.__data__=[]}n($a,"listCacheClear");function Va(t){var e=this.__data__,r=Wt(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():ka.call(e,r,1),!0}n(Va,"listCacheDelete");function Ha(t){var e=this.__data__,r=Wt(e,t);return r<0?void 0:e[r][1]}n(Ha,"listCacheGet");function Ga(t){return Wt(this.__data__,t)>-1}n(Ga,"listCacheHas");function Ba(t,e){var r=this.__data__,o=Wt(r,t);return o<0?r.push([t,e]):r[o][1]=e,this}n(Ba,"listCacheSet");je.prototype.clear=$a;je.prototype.delete=Va;je.prototype.get=Ha;je.prototype.has=Ga;je.prototype.set=Ba;function xe(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(xe,"MapCache");function za(){this.__data__={hash:new Ee,map:new(Fa||je),string:new Ee}}n(za,"mapCacheClear");function Wa(t){return Yt(this,t).delete(t)}n(Wa,"mapCacheDelete");function Ya(t){return Yt(this,t).get(t)}n(Ya,"mapCacheGet");function Ja(t){return Yt(this,t).has(t)}n(Ja,"mapCacheHas");function Qa(t,e){return Yt(this,t).set(t,e),this}n(Qa,"mapCacheSet");xe.prototype.clear=za;xe.prototype.delete=Wa;xe.prototype.get=Ya;xe.prototype.has=Ja;xe.prototype.set=Qa;function Wt(t,e){for(var r=t.length;r--;)if(tc(t[r][0],e))return r;return-1}n(Wt,"assocIndexOf");function Ka(t){if(!Ln(t)||Xa(t))return!1;var e=rc(t)||Ra(t)?Ia:Oa;return e.test(ec(t))}n(Ka,"baseIsNative");function Yt(t,e){var r=t.__data__;return Za(e)?r[typeof e=="string"?"string":"hash"]:r.map}n(Yt,"getMapData");function Dn(t,e){var r=Pa(t,e);return Ka(r)?r:void 0}n(Dn,"getNative");function Za(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}n(Za,"isKeyable");function Xa(t){return!!Fn&&Fn in t}n(Xa,"isMasked");function ec(t){if(t!=null){try{return Un.call(t)}catch{}try{return t+""}catch{}}return""}n(ec,"toSource");function Fr(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(Fr.Cache||xe),r}n(Fr,"memoize");Fr.Cache=xe;function tc(t,e){return t===e||t!==t&&e!==e}n(tc,"eq");function rc(t){var e=Ln(t)?qa.call(t):"";return e==Sa||e==Ta}n(rc,"isFunction");function Ln(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}n(Ln,"isObject");Mn.exports=Fr});var Jt,Ur,it,at,Qt,jn,$n,oc,nc,sc,ic,ac,ct,Dr,cc,Vn,lt,lc,se,ie=T(()=>{Jt=re(st()),Ur=n((...t)=>JSON.stringify(t),"memoizeKey"),it=n(t=>(...e)=>fetch(...t(...e)).then(r=>r.json()),"withFetchJson"),at=n(t=>(e,...r)=>{if(!e)throw Error("host required");let[o,s={}]=t(...r);return[`${e.replace(/\/+$/,"")}${o}`,s]},"withHost"),Qt=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"),jn=n(t=>(...e)=>{let[r,o={}]=t(...e);return[r,{method:"POST",...o,body:JSON.stringify(o.body),headers:{"Content-type":"application/json",...o.headers}}]},"withJsonBody"),$n=n((t=[])=>(Array.isArray(t)?t:Object.entries(t)).map(([e,r])=>[e,encodeURIComponent(r)].join("=")).join("&"),"toQuery"),oc=n(t=>JSON.stringify([].concat(t).map(e=>typeof e=="object"?e.id:e).filter(e=>e)),"toProductId"),nc=(0,Jt.default)(it(at((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=$n([["session_id",e],["page_type",1],["p",oc(r)],["module_view",JSON.stringify(["regular"])]]);return[`/offer/${t}/${o}?${s}`]})),Ur),sc=(0,Jt.default)(it(at(Qt((t=1,e="place")=>[`/orders/?${$n([["status",t],["ordering",e],["exclude_prepaid_orders","true"]])}`]))),Ur),ic=(0,Jt.default)(it(at(Qt(t=>{if(!t)throw Error("orderId required");return[`/items/?order=${t}`]}))),Ur),ac=it(at(Qt(jn((t,e,r,o)=>{if(!t)throw Error("product required");if(!e)throw Error("order required");if(!r)throw Error("quantity required");if(r<=0)throw Error("quantity must be greater or equal than one");if(!o)throw Error("offer required");return["/items/iu/",{body:{product:t,order:e,quantity:r,offer:o}}]})))),ct=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"),Dr=n(t=>t.match(/^\d+_\d$/),"isFrequencyValid"),cc=n((t,e)=>String.prototype.localeCompare.call(t&&t.split("_").reverse().join("_"),e&&e.split("_").reverse().join("_")),"compareFrequencies"),Vn=n(t=>[...new Set(t&&t.split(/\s+/))].filter(Dr).sort(cc),"parseFrequenciesList"),lt=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"),lc=it(at(Qt(jn((t,e,r)=>{if(!t)throw Error("item required");if(!e)throw Error("frequency required");let o=ct(e);if(!o)throw Error("invalid frequency");return["/subscriptions/create_from_item/",{body:{item:t.public_id,offer:r,...o}}]})))),se={fetchOffer:nc,fetchOrders:sc,fetchItems:ic,createOneTime:ac,convertOneTimeToSubscription:lc}});var $e,j,ut=T(()=>{I();$e=pt(),j={shopify:typeof($e==null?void 0:$e.dataset.shopifySellingPlans)!="undefined",shopify_selling_plans:typeof($e==null?void 0:$e.dataset.shopifySellingPlans)!="undefined"}});function Kt(t){document.readyState==="loading"?window.addEventListener("DOMContentLoaded",t):t()}function pt(){return document.querySelector([`script[src^="https://${Bt}"]`,`script[src^="https://${zt}"]`,`script[src^="http://${Bt}"]`,`script[src^="http://${zt}"]`].join(","))}function Lr(){let t=pt();if(!t)return[];let e=new URL(t.src),r=e.host.startsWith(be)?be:_e,o=e.pathname.split("/")[1];return!r&&!o?[]:[o,r,t]}function Bn(t){if(t.isReady())return;console.info("OG offers are auto initializing");let[e,r]=Lr();if(!r&&!e)return;let o=document.createElement("script");o.onload=()=>console.info("OG pull initialization chunk for merchant",e,r),o.onerror=()=>t.initialize(e,r),o.src=`${window.location.protocol}//${r===_e?Bt:zt}/${e}/main.js?initOnly=true`,document.head.appendChild(o)}function Wn(t){let e=document.cookie.match(`(^|;) ?${t}=([^;]*)(;|$)`);return e?e[2]:null}var R,Hn,Gn,zn,Se,Te,dt,$,Yn,uc,Jn,I=T(()=>{ut();M();n(Kt,"onReady");n(pt,"getMainJs");n(Lr,"resolveEnvAndMerchant");R=n(t=>{var r;if(!t)return"";let e=`${t.id||t}`;return((r=j)==null?void 0:r.shopify_selling_plans)&&(e=e.split(":")[0]),e},"safeProductId"),Hn=n((t,e)=>{var r;if(j.shopify_selling_plans){let o=(r=e.frequencies)==null?void 0:r.indexOf(t);if(o>=0&&e.frequenciesEveryPeriod[o])return e.frequenciesEveryPeriod[o]}return t},"safeOgFrequency"),Gn=n((t,e)=>{var o;if(!`${t}`.includes("_"))return t;let r=(o=e.frequenciesEveryPeriod)==null?void 0:o.indexOf(t);return r>=0&&e.frequenciesEveryPeriod[r]?e.frequencies[r]:t},"frequencyToSellingPlan");n(Bn,"autoInitializeOffers");zn=n(t=>{document.cookie=`${t}=; expires=Thu, 01 Jan 1970 00:00:01 GMT;`},"clearCookie");n(Wn,"getCookieValue");Se=n(t=>!!(t&&(t==null?void 0:t.includes("_"))),"isOgFrequency"),Te=n((t=[])=>(t==null?void 0:t[0])||null,"getFirstSellingPlan"),dt=n((t=[],e=[])=>{var r;return!!(((r=j)==null?void 0:r.shopify_selling_plans)&&t.length&&e.length)},"hasShopifySellingPlans"),$=n((t=[],e=[],r)=>{if(t.length!==e.length)return null;let o=e.findIndex(s=>s===r);return o>=0?t[o]:null},"mapFrequencyToSellingPlan"),Yn=n((t,e)=>r=>$(t,e,r),"curriedMapFrequencyToSellingPlan"),uc=n((t,e,r)=>Se(r)&&dt(t,e)?$(t,e,r):r,"getSafeSellingPlan"),Jn=n((t,e)=>r=>uc(t,e,r),"curriedGetSafeSellingPlan")});var ae,Ve,Qn,Zt,Kn,Zn,Mr,pc,ft,ce,Xn,Xt,es,dc,jr,$r,er,Vr,ts,He,Hr,fc,rs,os,hc,mc,gc,yc,ns,ss,is,as,cs,ls,us,N=T(()=>{Tn();M();ie();I();ae=n((t,e,r)=>({type:k,payload:{product:t,frequency:e,offer:r}}),"optinProduct"),Ve=n((t,e)=>({type:F,payload:{product:t,offer:e}}),"optoutProduct"),Qn=n((t,e)=>({type:tt,payload:{newProduct:t,product:e}}),"productHasChangedComponents"),Zt=n((t,e,r)=>({type:U,payload:{product:t,frequency:e,offer:r}}),"productChangeFrequency"),Kn=n(t=>({type:Cn,payload:{product:t}}),"concludeUpsell"),Zn=n(t=>({type:Ie,payload:t}),"setMerchantId"),Mr=n(t=>({type:ke,payload:`${t}.${Math.floor(Math.random()*999999)}.${Math.round(new Date().getTime()/1e3)}`}),"createSessionId"),pc=n(t=>({type:vn,payload:t}),"requestAuth"),ft=n((t,e,r,o)=>({type:It,payload:{public_id:t,sig_field:e,ts:r,sig:o}}),"authorize"),ce=n(t=>({type:Fe,payload:t}),"unauthorized"),Xn=n(t=>({type:qt,payload:t}),"setAuthUrl"),Xt=n(t=>({type:An,payload:t}),"fetchDone"),es=n((t=Sn)=>n(function(r,o){if(window.og&&window.og.previewMode)return r(ce({message:"Offers are running in preview mode"}));let{merchantId:s,authUrl:i}=o(),a=pc(i);return r(a),t(i).then(({sig_field:c,ts:l,sig:u})=>r(ft(s,c,l,u)),c=>r(ce(c))).finally(()=>r(Xt(a)))},"fetchAuthThunk"),"fetchAuth"),dc=n((t,e)=>({type:On,payload:{status:t,ordering:e}}),"requestOrders"),jr=n(t=>({type:kt,payload:t}),"receiveOrders"),$r=n(t=>({type:Ft,payload:t}),"receiveItems"),er=n((t=1,e="place")=>n(function(o,s){let{environment:{legoUrl:i},auth:a}=s();if(!a)return o(ce("No auth set."));let c=dc(t,e);return o(c),se.fetchOrders(i,a,t,e).then(l=>{if(l.results){o(jr(l));let u=(l.results[0]||{}).public_id;if(u)return se.fetchItems(i,a,u).then(h=>o($r(h)))}return o(ce(l.detail)),null},l=>o(ce(l))).finally(()=>o(Xt(c)))},"fetchOrdersThunk"),"fetchOrders"),Vr=n(t=>{switch(t){case Gt:return{type:De,payload:t};case be:return{type:Ue,payload:t};case _e:return{type:Le,payload:t};default:throw new Error(`${t} is not a supported environment`)}},"setEnvironment"),ts=n(()=>(t,e)=>{let{merchantId:r,sessionId:o}=e();return(!o||r&&!o.startsWith(r))&&t(Mr(r)),o},"requestSessionId"),He=n((t,e)=>({type:P,payload:{...t,offer:e}}),"receiveOffer"),Hr=n(t=>({type:wn,payload:t}),"fetchResponseError"),fc=n((t,e=ye,r)=>({type:W,payload:{product:t,module:e,offer:r}}),"requestOffer"),rs=n((t,e=ye,r)=>n(function(s,i){let{merchantId:a,sessionId:c,environment:{apiUrl:l}}=i(),u=fc(t,e,r);s(u);let h=R(t);return h?se.fetchOffer(l,a,c,h,e).then(p=>s(He(p,r)),p=>s(Hr(p))).finally(()=>s(Xt(u))):null},"fetchOfferThunk"),"fetchOffer"),os=n(()=>({type:Me}),"checkout"),hc=n((t,e,r,o)=>({type:Pn,payload:{product:t,order:e,quantity:r,offerId:o}}),"requestCreateOneTime"),mc=n(t=>({type:Ut,payload:t}),"receiveCreateOneTime"),gc=n((t,e)=>({type:Rn,payload:{item:t,frequency:e}}),"requestConvertOneTimeToSubscription"),yc=n((t,e)=>({type:Dt,payload:{response:t,product:e}}),"receiveConvertOneTime"),ns=n((t,e,r,o=!1,s=null)=>n(function(a,c){let{auth:l,config:u,environment:{legoUrl:h},previewUpsellOffer:p,offerId:m}=c();if(!l)return a(ce("No auth set."));let C=Hn(s,u),_=hc(t,e,r,m);return a(_),(p?Promise.resolve({legoUrl:h,product:t,order:e,quantity:r,offer:m}):se.createOneTime(h,l,t.id,e,r,m)).then(f=>(a(mc(f)),o?(a(gc(f,C)),(p?Promise.resolve({item:f,frequency:C}):se.convertOneTimeToSubscription(h,l,f,C,m)).then(E=>a(yc(E,t)),E=>a(Hr(E)))):f),f=>a(Hr(f))).finally(()=>a(Xt(_)))},"createIuThunk"),"createIu"),ss=n(t=>({type:Lt,payload:t}),"setLocale"),is=n(t=>({type:Mt,payload:t}),"setConfig"),as=n((t,e,r)=>({type:jt,payload:{selector:t,markup:e,config:r}}),"addTemplate"),cs=n(t=>({type:$t,payload:t}),"setTemplates"),ls=n((t,e)=>({type:Vt,payload:{product:t,firstOrderPlaceDate:e}}),"setFirstOrderPlaceDate"),us=n((t,e)=>({type:Ht,payload:{product:t,productToSubscribe:e}}),"setProductToSubscribe")});var Qr,Oe,we=T(()=>{Qr=typeof window!="undefined"&&window.customElements!=null&&window.customElements.polyfillWrapFlushCallback!==void 0,Oe=n((t,e,r=null)=>{for(;e!==r;){let o=e.nextSibling;t.removeChild(e),e=o}},"removeNodes")});var V,Kr,Ps,ze,Ce,Rs,mt,Q,ir,ue=T(()=>{V=`{{lit-${String(Math.random()).slice(2)}}}`,Kr=`<!--${V}-->`,Ps=new RegExp(`${V}|${Kr}`),ze="$lit$",Ce=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:u,values:{length:h}}=e;for(;l<h;){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:C}=m,_=0;for(let f=0;f<C;f++)Rs(m[f].name,ze)&&_++;for(;_-- >0;){let f=u[l],E=ir.exec(f)[2],w=E.toLowerCase()+ze,b=p.getAttribute(w);p.removeAttribute(w);let y=b.split(Ps);this.parts.push({type:"attribute",index:c,name:E,strings:y}),l+=y.length-1}}p.tagName==="TEMPLATE"&&(s.push(p),i.currentNode=p.content)}else if(p.nodeType===3){let m=p.data;if(m.indexOf(V)>=0){let C=p.parentNode,_=m.split(Ps),f=_.length-1;for(let E=0;E<f;E++){let w,b=_[E];if(b==="")w=Q();else{let y=ir.exec(b);y!==null&&Rs(y[2],ze)&&(b=b.slice(0,y.index)+y[1]+y[2].slice(0,-ze.length)+y[3]),w=document.createTextNode(b)}C.insertBefore(w,p),this.parts.push({type:"node",index:++c})}_[f]===""?(C.insertBefore(Q(),p),o.push(p)):p.data=_[f],l+=f}}else if(p.nodeType===8)if(p.data===V){let m=p.parentNode;(p.previousSibling===null||c===a)&&(c++,m.insertBefore(Q(),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(V,m+1))!==-1;)this.parts.push({type:"node",index:-1}),l++}}for(let p of o)p.parentNode.removeChild(p)}};n(Ce,"Template");Rs=n((t,e)=>{let r=t.length-e.length;return r>=0&&t.slice(r)===e},"endsWith"),mt=n(t=>t.index!==-1,"isTemplatePartActive"),Q=n(()=>document.createComment(""),"createMarker"),ir=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/});function Xr(t,e){let{element:{content:r},parts:o}=t,s=document.createTreeWalker(r,Zr,null,!1),i=gt(o),a=o[i],c=-1,l=0,u=[],h=null;for(;s.nextNode();){c++;let p=s.currentNode;for(p.previousSibling===h&&(h=null),e.has(p)&&(u.push(p),h===null&&(h=p)),h!==null&&l++;a!==void 0&&a.index===c;)a.index=h!==null?-1:a.index-l,i=gt(o,i),a=o[i]}u.forEach(p=>p.parentNode.removeChild(p))}function As(t,e,r=null){let{element:{content:o},parts:s}=t;if(r==null){o.appendChild(e);return}let i=document.createTreeWalker(o,Zr,null,!1),a=gt(s),c=0,l=-1;for(;i.nextNode();)for(l++,i.currentNode===r&&(c=Fc(e),r.parentNode.insertBefore(e,r));a!==-1&&s[a].index===l;){if(c>0){for(;a!==-1;)s[a].index+=c,a=gt(s,a);return}a=gt(s,a)}}var Zr,Fc,gt,Ns=T(()=>{ue();Zr=133;n(Xr,"removeNodesFromTemplate");Fc=n(t=>{let e=t.nodeType===11?0:1,r=document.createTreeWalker(t,Zr,null,!1);for(;r.nextNode();)e++;return e},"countNodes"),gt=n((t,e=-1)=>{for(let r=e+1;r<t.length;r++){let o=t[r];if(mt(o))return r}return-1},"nextActiveIndexInTemplateParts");n(As,"insertNodeIntoTemplate")});var Uc,Pe,eo=T(()=>{Uc=new WeakMap,Pe=n(t=>typeof t=="function"&&Uc.has(t),"isDirective")});var D,ar,to=T(()=>{D={},ar={}});var pe,cr=T(()=>{we();ue();pe=class{constructor(e,r,o){this.__parts=[],this.template=e,this.processor=r,this.options=o}update(e){let r=0;for(let o of this.__parts)o!==void 0&&o.setValue(e[r]),r++;for(let o of this.__parts)o!==void 0&&o.commit()}_clone(){let e=Qr?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],!mt(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 u=this.processor.handleTextExpression(this.options);u.insertAfterNode(l.previousSibling),this.__parts.push(u)}else this.__parts.push(...this.processor.handleAttributeExpressions(l,c.name,c.strings,this.options));i++}return Qr&&(document.adoptNode(e),customElements.upgrade(e)),e}};n(pe,"TemplateInstance")});var qs,Lc,X,lr=T(()=>{we();ue();qs=window.trustedTypes&&trustedTypes.createPolicy("lit-html",{createHTML:t=>t}),Lc=` ${V} `,X=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=ir.exec(i);c===null?r+=i+(o?Lc:Kr):r+=i.substr(0,c.index)+c[1]+c[2]+ze+c[3]+V}return r+=this.strings[e],r}getTemplateElement(){let e=document.createElement("template"),r=this.getHTML();return qs!==void 0&&(r=qs.createHTML(r)),e.innerHTML=r,e}};n(X,"TemplateResult")});var ur,pr,We,yt,ee,bt,_t,dr,Is,Et,Mc,fr=T(()=>{eo();we();to();cr();lr();ue();ur=n(t=>t===null||!(typeof t=="object"||typeof t=="function"),"isPrimitive"),pr=n(t=>Array.isArray(t)||!!(t&&t[Symbol.iterator]),"isIterable"),We=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 yt(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"||!pr(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(ur(c)||!pr(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(We,"AttributeCommitter");yt=class{constructor(e){this.value=void 0,this.committer=e}setValue(e){e!==D&&(!ur(e)||e!==this.value)&&(this.value=e,Pe(e)||(this.committer.dirty=!0))}commit(){for(;Pe(this.value);){let e=this.value;this.value=D,e(this)}this.value!==D&&this.committer.commit()}};n(yt,"AttributePart");ee=class{constructor(e){this.value=void 0,this.__pendingValue=void 0,this.options=e}appendInto(e){this.startNode=e.appendChild(Q()),this.endNode=e.appendChild(Q())}insertAfterNode(e){this.startNode=e,this.endNode=e.nextSibling}appendIntoPart(e){e.__insert(this.startNode=Q()),e.__insert(this.endNode=Q())}insertAfterPart(e){e.__insert(this.startNode=Q()),this.endNode=e.endNode,e.endNode=this.startNode}setValue(e){this.__pendingValue=e}commit(){if(this.startNode.parentNode===null)return;for(;Pe(this.__pendingValue);){let r=this.__pendingValue;this.__pendingValue=D,r(this)}let e=this.__pendingValue;e!==D&&(ur(e)?e!==this.value&&this.__commitText(e):e instanceof X?this.__commitTemplateResult(e):e instanceof Node?this.__commitNode(e):pr(e)?this.__commitIterable(e):e===ar?(this.value=ar,this.clear()):this.__commitText(e))}__insert(e){this.endNode.parentNode.insertBefore(e,this.endNode)}__commitNode(e){this.value!==e&&(this.clear(),this.__insert(e),this.value=e)}__commitText(e){let r=this.startNode.nextSibling;e=e??"";let o=typeof e=="string"?e:String(e);r===this.endNode.previousSibling&&r.nodeType===3?r.data=o:this.__commitNode(document.createTextNode(o)),this.value=e}__commitTemplateResult(e){let r=this.options.templateFactory(e);if(this.value instanceof pe&&this.value.template===r)this.value.update(e.values);else{let o=new pe(r,e.processor,this.options),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 ee(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){Oe(this.startNode.parentNode,e.nextSibling,this.endNode)}};n(ee,"NodePart");bt=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(;Pe(this.__pendingValue);){let r=this.__pendingValue;this.__pendingValue=D,r(this)}if(this.__pendingValue===D)return;let e=!!this.__pendingValue;this.value!==e&&(e?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=e),this.__pendingValue=D}};n(bt,"BooleanAttributePart");_t=class extends We{constructor(e,r,o){super(e,r,o);this.single=o.length===2&&o[0]===""&&o[1]===""}_createPart(){return new dr(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}};n(_t,"PropertyCommitter");dr=class extends yt{};n(dr,"PropertyPart");Is=!1;(()=>{try{let t={get capture(){return Is=!0,!1}};window.addEventListener("test",t,t),window.removeEventListener("test",t,t)}catch{}})();Et=class{constructor(e,r,o){this.value=void 0,this.__pendingValue=void 0,this.element=e,this.eventName=r,this.eventContext=o,this.__boundHandleEvent=s=>this.handleEvent(s)}setValue(e){this.__pendingValue=e}commit(){for(;Pe(this.__pendingValue);){let i=this.__pendingValue;this.__pendingValue=D,i(this)}if(this.__pendingValue===D)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=Mc(e),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=e,this.__pendingValue=D}handleEvent(e){typeof this.value=="function"?this.value.call(this.eventContext||this.element,e):this.value.handleEvent(e)}};n(Et,"EventPart");Mc=n(t=>t&&(Is?{capture:t.capture,passive:t.passive,once:t.once}:t.capture),"getOptions")});function ro(t){let e=Re.get(t.type);e===void 0&&(e={stringsArray:new WeakMap,keyString:new Map},Re.set(t.type,e));let r=e.stringsArray.get(t.strings);if(r!==void 0)return r;let o=t.strings.join(V);return r=e.keyString.get(o),r===void 0&&(r=new Ce(t,t.getTemplateElement()),e.keyString.set(o,r)),e.stringsArray.set(t.strings,r),r}var Re,hr=T(()=>{ue();n(ro,"templateFactory");Re=new Map});var de,oo,no=T(()=>{we();fr();hr();de=new WeakMap,oo=n((t,e,r)=>{let o=de.get(e);o===void 0&&(Oe(e,e.firstChild),de.set(e,o=new ee(Object.assign({templateFactory:ro},r))),o.appendInto(e)),o.setValue(t),o.commit()},"render")});var mr,so,io=T(()=>{fr();mr=class{handleAttributeExpressions(e,r,o,s){let i=r[0];return i==="."?new _t(e,r.slice(1),o).parts:i==="@"?[new Et(e,r.slice(1),s.eventContext)]:i==="?"?[new bt(e,r.slice(1),o)]:new We(e,r,o).parts}handleTextExpression(e){return new ee(e)}};n(mr,"DefaultTemplateProcessor");so=new mr});var d,ao=T(()=>{io();lr();io();eo();we();to();fr();no();hr();cr();lr();ue();typeof window!="undefined"&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.3.0");d=n((t,...e)=>new X(t,e,"html",so),"html")});var Fs,gr,$c,Vc,Hc,Us,Gc,Ds,Ls=T(()=>{we();Ns();no();hr();cr();ue();ao();Fs=n((t,e)=>`${t}--${e}`,"getTemplateCacheKey"),gr=!0;typeof window.ShadyCSS=="undefined"?gr=!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."),gr=!1);$c=n(t=>e=>{let r=Fs(e.type,t),o=Re.get(r);o===void 0&&(o={stringsArray:new WeakMap,keyString:new Map},Re.set(r,o));let s=o.stringsArray.get(e.strings);if(s!==void 0)return s;let i=e.strings.join(V);if(s=o.keyString.get(i),s===void 0){let a=e.getTemplateElement();gr&&window.ShadyCSS.prepareTemplateDom(a,t),s=new Ce(e,a),o.keyString.set(i,s)}return o.stringsArray.set(e.strings,s),s},"shadyTemplateFactory"),Vc=["html","svg"],Hc=n(t=>{Vc.forEach(e=>{let r=Re.get(Fs(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)}),Xr(o,i)})})},"removeStylesFromLitTemplates"),Us=new Set,Gc=n((t,e,r)=>{Us.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 u=0;u<i;u++){let h=s[u];h.parentNode.removeChild(h),a.textContent+=h.textContent}Hc(t);let c=o.content;r?As(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 u=new Set;u.add(a),Xr(r,u)}},"prepareTemplateStyles"),Ds=n((t,e,r)=>{if(!r||typeof r!="object"||!r.scopeName)throw new Error("The `scopeName` option is required.");let o=r.scopeName,s=de.has(e),i=gr&&e.nodeType===11&&!!e.host,a=i&&!Us.has(o),c=a?document.createDocumentFragment():e;if(oo(t,c,Object.assign({templateFactory:$c(o)},r)),a){let l=de.get(c);de.delete(c);let u=l.value instanceof pe?l.value.template:void 0;Gc(o,c,u),Oe(e,e.firstChild),e.appendChild(c),de.set(e,l)}!s&&i&&window.ShadyCSS.styleElement(e.host)},"render")});var Ms,co,js,lo,uo,po,fo,ho,mo,xt,go=T(()=>{window.JSCompiler_renameProperty=(t,e)=>t;co={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}},js=n((t,e)=>e!==t&&(e===e||t===t),"notEqual"),lo={attribute:!0,type:String,converter:co,reflect:!1,hasChanged:js},uo=1,po=1<<2,fo=1<<3,ho=1<<4,mo="finalized",xt=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=lo){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)||lo}static finalize(){let e=Object.getPrototypeOf(this);if(e.hasOwnProperty(mo)||e.finalize(),this[mo]=!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=js){return o(e,r)}static _propertyValueFromAttribute(e,r){let o=r.type,s=r.converter||co,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||co.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=lo){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|fo,a==null?this.removeAttribute(i):this.setAttribute(i,a),this._updateState=this._updateState&~fo}}_attributeToProperty(e,r){if(this._updateState&fo)return;let o=this.constructor,s=o._attributeToPropertyMap.get(e);if(s!==void 0){let i=o.getPropertyOptions(s);this._updateState=this._updateState|ho,this[s]=o._propertyValueFromAttribute(r,i),this._updateState=this._updateState&~ho}}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&ho)&&(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|po;try{await this._updatePromise}catch{}let e=this.performUpdate();return e!=null&&await e,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return this._updateState&po}get hasUpdated(){return this._updateState&uo}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&uo||(this._updateState=this._updateState|uo,this.firstUpdated(r)),this.updated(r))}_markUpdated(){this._changedProperties=new Map,this._updateState=this._updateState&~po}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(xt,"UpdatingElement");Ms=mo;xt[Ms]=!0});var $s,wd,Vs=T(()=>{$s=Element.prototype,wd=$s.msMatchesSelector||$s.webkitMatchesSelector});var yr,yo,St,Hs,Bc,O,bo=T(()=>{yr=window.ShadowRoot&&(window.ShadyCSS===void 0||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,yo=Symbol(),St=class{constructor(e,r){if(r!==yo)throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e}get styleSheet(){return this._styleSheet===void 0&&(yr?(this._styleSheet=new CSSStyleSheet,this._styleSheet.replaceSync(this.cssText)):this._styleSheet=null),this._styleSheet}toString(){return this.cssText}};n(St,"CSSResult");Hs=n(t=>new St(String(t),yo),"unsafeCSS"),Bc=n(t=>{if(t instanceof St)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 ta=Object.create;var Xe=Object.defineProperty;var ra=Object.getOwnPropertyDescriptor;var oa=Object.getOwnPropertyNames;var na=Object.getPrototypeOf,sa=Object.prototype.hasOwnProperty;var un=t=>Xe(t,"__esModule",{value:!0}),n=(t,e)=>Xe(t,"name",{value:e,configurable:!0});var S=(t,e)=>()=>(t&&(e=t(t=0)),e);var he=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Cr=(t,e)=>{un(t);for(var r in e)Xe(t,r,{get:e[r],enumerable:!0})},ia=(t,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of oa(e))!sa.call(t,o)&&o!=="default"&&Xe(t,o,{get:()=>e[o],enumerable:!(r=ra(e,o))||r.enumerable});return t},re=t=>ia(un(Xe(t!=null?ta(na(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var Rt=he((Pt,bn)=>{(function(t,e){typeof Pt=="object"&&typeof bn!="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,u=0;function h(){c&&clearTimeout(c)}n(h,"clearExistingTimeout");function p(){h(),l=!0}n(p,"cancel"),typeof s!="boolean"&&(a=i,i=s,s=void 0);function m(){for(var C=arguments.length,_=new Array(C),f=0;f<C;f++)_[f]=arguments[f];var E=this,w=Date.now()-u;if(l)return;function b(){u=Date.now(),i.apply(E,_)}n(b,"exec");function g(){c=void 0}n(g,"clear"),a&&!c&&b(),h(),a===void 0&&w>o?b():s!==!0&&(c=setTimeout(a?g:b,a===void 0?o-w: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})})});function En(){return typeof window.og_auth!="undefined"?At(window.og_auth):null}async function ga(t=100){return new Promise(e=>{setTimeout(()=>e(En()),t)})}async function xn(t,e=fa,r=ha){let o;if(o=At(En())||At(e()),o)return o;if(t&&typeof t=="string"){let s=await fetch(t);s.status>=200&&s.status<300&&(o=e()||await(ma(s)?s.json():Promise.resolve(r(t)).then(e)))}else o||(o=await ga());if(o=At(o),o)return o;throw new Error("Unauthorized")}var _n,fa,At,ha,ma,Sn=S(()=>{_n=/^og_auth=/,fa=n((t=_n)=>(document.cookie.split(/;\s*/).find(e=>e.match(t))||"").replace(_n,""),"c"),At=n(t=>{if(typeof t=="object")return t;let e=String(t||"").split("|");return e.length===3?{sig_field:e[0],ts:parseInt(e[1],10),sig:e[2]}:null},"r"),ha=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"),ma=n(t=>(t.headers.get("content-type")||"").indexOf("application/json")!==-1,"d");n(En,"a");n(ga,"f");n(xn,"u")});var q,k,F,Ne,z,P,tt,Ie,Nt,Tn,It,qe,vn,qt,kt,On,ke,Fe,Ue,wn,Cn,Ft,Pn,Ut,De,Rn,Dt,Lt,rt,ot,Mt,jt,me,oe,$t,Vt,K,W,ne,ge,Ht,ye,be,Bt,Gt,An,M=S(()=>{q="OPTIN_PRODUCT",k="OPTOUT_PRODUCT",F="PRODUCT_CHANGE_FREQUENCY",Ne="SET_MERCHANT_ID",z="REQUEST_OFFER",P="RECEIVE_OFFER",tt="PRODUCT_HAS_CHANGED",Ie="CREATED_SESSION_ID",Nt="SET_AUTH_URL",Tn="REQUEST_AUTH",It="AUTHORIZE",qe="UNAUTHORIZED",vn="REQUEST_ORDERS",qt="RECEIVE_ORDERS",kt="RECEIVE_ORDER_ITEMS",On="FETCH_RESPONSE_ERROR",ke="SET_ENVIRONMENT_STAGING",Fe="SET_ENVIRONMENT_DEV",Ue="SET_ENVIRONMENT_PROD",wn="CONCLUDE_UPSELL",Cn="REQUEST_CREATE_IU_ORDER",Ft="CREATE_ONE_TIME",Pn="REQUEST_CONVERT_ONE_TIME",Ut="CONVERT_ONE_TIME",De="CHECKOUT",Rn="RECEIVE_FETCH",Dt="SET_LOCALE",Lt="SET_CONFIG",rt="SET_PREVIEW_STANDARD_OFFER",ot="SET_PREVIEW_UPSELL_OFFER",Mt="ADD_TEMPLATE",jt="SET_TEMPLATES",me="LOCAL_STORAGE_CHANGE",oe="LOCAL_STORAGE_CLEAR",$t="SET_FIRST_ORDER_PLACE_DATE",Vt="SET_PRODUCT_TO_SUBSCRIBE",K="RECEIVE_PRODUCT_PLANS",W="SETUP_PRODUCT",ne="SETUP_CART",ge="pdp",Ht="dev",ye="staging",be="prod",Bt="static.ordergroove.com",Gt="staging.static.ordergroove.com",An="og-cart-updated"});var st=he((Uu,Ln)=>{var ya="Expected a function",Nn="__lodash_hash_undefined__",ba="[object Function]",_a="[object GeneratorFunction]",Ea=/[\\^$.*+?()[\]{}|]/g,xa=/^\[object .+?Constructor\]$/,Sa=typeof window=="object"&&window&&window.Object===Object&&window,Ta=typeof self=="object"&&self&&self.Object===Object&&self,In=Sa||Ta||Function("return this")();function va(t,e){return t==null?void 0:t[e]}n(va,"getValue");function Oa(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}n(Oa,"isHostObject");var wa=Array.prototype,Ca=Function.prototype,qn=Object.prototype,qr=In["__core-js_shared__"],kn=function(){var t=/[^.]+$/.exec(qr&&qr.keys&&qr.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),Fn=Ca.toString,kr=qn.hasOwnProperty,Pa=qn.toString,Ra=RegExp("^"+Fn.call(kr).replace(Ea,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Aa=wa.splice,Na=Un(In,"Map"),nt=Un(Object,"create");function _e(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(_e,"Hash");function Ia(){this.__data__=nt?nt(null):{}}n(Ia,"hashClear");function qa(t){return this.has(t)&&delete this.__data__[t]}n(qa,"hashDelete");function ka(t){var e=this.__data__;if(nt){var r=e[t];return r===Nn?void 0:r}return kr.call(e,t)?e[t]:void 0}n(ka,"hashGet");function Fa(t){var e=this.__data__;return nt?e[t]!==void 0:kr.call(e,t)}n(Fa,"hashHas");function Ua(t,e){var r=this.__data__;return r[t]=nt&&e===void 0?Nn:e,this}n(Ua,"hashSet");_e.prototype.clear=Ia;_e.prototype.delete=qa;_e.prototype.get=ka;_e.prototype.has=Fa;_e.prototype.set=Ua;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,"ListCache");function Da(){this.__data__=[]}n(Da,"listCacheClear");function La(t){var e=this.__data__,r=zt(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():Aa.call(e,r,1),!0}n(La,"listCacheDelete");function Ma(t){var e=this.__data__,r=zt(e,t);return r<0?void 0:e[r][1]}n(Ma,"listCacheGet");function ja(t){return zt(this.__data__,t)>-1}n(ja,"listCacheHas");function $a(t,e){var r=this.__data__,o=zt(r,t);return o<0?r.push([t,e]):r[o][1]=e,this}n($a,"listCacheSet");Le.prototype.clear=Da;Le.prototype.delete=La;Le.prototype.get=Ma;Le.prototype.has=ja;Le.prototype.set=$a;function Ee(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(Ee,"MapCache");function Va(){this.__data__={hash:new _e,map:new(Na||Le),string:new _e}}n(Va,"mapCacheClear");function Ha(t){return Wt(this,t).delete(t)}n(Ha,"mapCacheDelete");function Ba(t){return Wt(this,t).get(t)}n(Ba,"mapCacheGet");function Ga(t){return Wt(this,t).has(t)}n(Ga,"mapCacheHas");function za(t,e){return Wt(this,t).set(t,e),this}n(za,"mapCacheSet");Ee.prototype.clear=Va;Ee.prototype.delete=Ha;Ee.prototype.get=Ba;Ee.prototype.has=Ga;Ee.prototype.set=za;function zt(t,e){for(var r=t.length;r--;)if(Ka(t[r][0],e))return r;return-1}n(zt,"assocIndexOf");function Wa(t){if(!Dn(t)||Ja(t))return!1;var e=Za(t)||Oa(t)?Ra:xa;return e.test(Qa(t))}n(Wa,"baseIsNative");function Wt(t,e){var r=t.__data__;return Ya(e)?r[typeof e=="string"?"string":"hash"]:r.map}n(Wt,"getMapData");function Un(t,e){var r=va(t,e);return Wa(r)?r:void 0}n(Un,"getNative");function Ya(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}n(Ya,"isKeyable");function Ja(t){return!!kn&&kn in t}n(Ja,"isMasked");function Qa(t){if(t!=null){try{return Fn.call(t)}catch{}try{return t+""}catch{}}return""}n(Qa,"toSource");function Fr(t,e){if(typeof t!="function"||e&&typeof e!="function")throw new TypeError(ya);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(Fr.Cache||Ee),r}n(Fr,"memoize");Fr.Cache=Ee;function Ka(t,e){return t===e||t!==t&&e!==e}n(Ka,"eq");function Za(t){var e=Dn(t)?Pa.call(t):"";return e==ba||e==_a}n(Za,"isFunction");function Dn(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}n(Dn,"isObject");Ln.exports=Fr});var Yt,Ur,it,at,Jt,Mn,jn,Xa,ec,tc,rc,oc,ct,Dr,nc,$n,lt,sc,se,ie=S(()=>{Yt=re(st()),Ur=n((...t)=>JSON.stringify(t),"memoizeKey"),it=n(t=>(...e)=>fetch(...t(...e)).then(r=>r.json()),"withFetchJson"),at=n(t=>(e,...r)=>{if(!e)throw Error("host required");let[o,s={}]=t(...r);return[`${e.replace(/\/+$/,"")}${o}`,s]},"withHost"),Jt=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"),Mn=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"),jn=n((t=[])=>(Array.isArray(t)?t:Object.entries(t)).map(([e,r])=>[e,encodeURIComponent(r)].join("=")).join("&"),"toQuery"),Xa=n(t=>JSON.stringify([].concat(t).map(e=>typeof e=="object"?e.id:e).filter(e=>e)),"toProductId"),ec=(0,Yt.default)(it(at((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=jn([["session_id",e],["page_type",1],["p",Xa(r)],["module_view",JSON.stringify(["regular"])]]);return[`/offer/${t}/${o}?${s}`]})),Ur),tc=(0,Yt.default)(it(at(Jt((t=1,e="place")=>[`/orders/?${jn([["status",t],["ordering",e],["exclude_prepaid_orders","true"]])}`]))),Ur),rc=(0,Yt.default)(it(at(Jt(t=>{if(!t)throw Error("orderId required");return[`/items/?order=${t}`]}))),Ur),oc=it(at(Jt(Mn((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}}]})))),ct=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"),Dr=n(t=>t.match(/^\d+_\d$/),"isFrequencyValid"),nc=n((t,e)=>String.prototype.localeCompare.call(t&&t.split("_").reverse().join("_"),e&&e.split("_").reverse().join("_")),"compareFrequencies"),$n=n(t=>[...new Set(t&&t.split(/\s+/))].filter(Dr).sort(nc),"parseFrequenciesList"),lt=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"),sc=it(at(Jt(Mn((t,e,r)=>{if(!t)throw Error("item required");if(!e)throw Error("frequency required");let o=ct(e);if(!o)throw Error("invalid frequency");return["/subscriptions/create_from_item/",{body:{item:t.public_id,offer:r,...o}}]})))),se={fetchOffer:ec,fetchOrders:tc,fetchItems:rc,createOneTime:oc,convertOneTimeToSubscription:sc}});var Me,j,ut=S(()=>{U();Me=pt(),j={shopify:typeof(Me==null?void 0:Me.dataset.shopifySellingPlans)!="undefined",shopify_selling_plans:typeof(Me==null?void 0:Me.dataset.shopifySellingPlans)!="undefined"}});function Qt(t){document.readyState==="loading"?window.addEventListener("DOMContentLoaded",t):t()}function pt(){return document.querySelector([`script[src^="https://${Bt}"]`,`script[src^="https://${Gt}"]`,`script[src^="http://${Bt}"]`,`script[src^="http://${Gt}"]`].join(","))}function Lr(){let t=pt();if(!t)return[];let e=new URL(t.src),r=e.host.startsWith(ye)?ye:be,o=e.pathname.split("/")[1];return!r&&!o?[]:[o,r,t]}function Bn(t){if(t.isReady())return;console.info("OG offers are auto initializing");let[e,r]=Lr();if(!r&&!e)return;let o=document.createElement("script");o.onload=()=>console.info("OG pull initialization chunk for merchant",e,r),o.onerror=()=>t.initialize(e,r),o.src=`${window.location.protocol}//${r===be?Bt:Gt}/${e}/main.js?initOnly=true`,document.head.appendChild(o)}function zn(t){let e=document.cookie.match(`(^|;) ?${t}=([^;]*)(;|$)`);return e?e[2]:null}var R,Vn,Hn,Gn,je,xe,Kt,Y,U=S(()=>{ut();M();n(Qt,"onReady");n(pt,"getMainJs");n(Lr,"resolveEnvAndMerchant");R=n(t=>{var r;if(!t)return"";let e=`${t.id||t}`;return((r=j)==null?void 0:r.shopify_selling_plans)&&(e=e.split(":")[0]),e},"safeProductId"),Vn=n((t,e)=>{var r;if(j.shopify_selling_plans){let o=(r=e.frequencies)==null?void 0:r.indexOf(t);if(o>=0&&e.frequenciesEveryPeriod[o])return e.frequenciesEveryPeriod[o]}return t},"safeOgFrequency"),Hn=n((t,e)=>{var o;if(!`${t}`.includes("_"))return t;let r=(o=e.frequenciesEveryPeriod)==null?void 0:o.indexOf(t);return r>=0&&e.frequenciesEveryPeriod[r]?e.frequencies[r]:t},"frequencyToSellingPlan");n(Bn,"autoInitializeOffers");Gn=n(t=>{document.cookie=`${t}=; expires=Thu, 01 Jan 1970 00:00:01 GMT;`},"clearCookie");n(zn,"getCookieValue");je=n(t=>!!(t&&(t==null?void 0:t.includes("_"))),"isOgFrequency"),xe=n((t=[])=>(t==null?void 0:t[0])||null,"getFirstSellingPlan"),Kt=n((t=[],e=[])=>{var r;return!!(((r=j)==null?void 0:r.shopify_selling_plans)&&t.length&&e.length)},"hasShopifySellingPlans"),Y=n((t,e,r)=>{if(t.length!==e.length)return null;let o=e.findIndex(s=>s===r);return o>=0?t[o]:null},"mapFrequencyToSellingPlan")});var ae,$e,Wn,Zt,Yn,Jn,Mr,ic,dt,ce,Qn,Xt,Kn,ac,jr,$r,er,Vr,Zn,Ve,Hr,cc,Xn,es,lc,uc,pc,dc,ts,rs,os,ns,ss,is,as,A=S(()=>{Sn();M();ie();U();ae=n((t,e,r)=>({type:q,payload:{product:t,frequency:e,offer:r}}),"optinProduct"),$e=n((t,e)=>({type:k,payload:{product:t,offer:e}}),"optoutProduct"),Wn=n((t,e)=>({type:tt,payload:{newProduct:t,product:e}}),"productHasChangedComponents"),Zt=n((t,e,r)=>({type:F,payload:{product:t,frequency:e,offer:r}}),"productChangeFrequency"),Yn=n(t=>({type:wn,payload:{product:t}}),"concludeUpsell"),Jn=n(t=>({type:Ne,payload:t}),"setMerchantId"),Mr=n(t=>({type:Ie,payload:`${t}.${Math.floor(Math.random()*999999)}.${Math.round(new Date().getTime()/1e3)}`}),"createSessionId"),ic=n(t=>({type:Tn,payload:t}),"requestAuth"),dt=n((t,e,r,o)=>({type:It,payload:{public_id:t,sig_field:e,ts:r,sig:o}}),"authorize"),ce=n(t=>({type:qe,payload:t}),"unauthorized"),Qn=n(t=>({type:Nt,payload:t}),"setAuthUrl"),Xt=n(t=>({type:Rn,payload:t}),"fetchDone"),Kn=n((t=xn)=>n(function(r,o){if(window.og&&window.og.previewMode)return r(ce({message:"Offers are running in preview mode"}));let{merchantId:s,authUrl:i}=o(),a=ic(i);return r(a),t(i).then(({sig_field:c,ts:l,sig:u})=>r(dt(s,c,l,u)),c=>r(ce(c))).finally(()=>r(Xt(a)))},"fetchAuthThunk"),"fetchAuth"),ac=n((t,e)=>({type:vn,payload:{status:t,ordering:e}}),"requestOrders"),jr=n(t=>({type:qt,payload:t}),"receiveOrders"),$r=n(t=>({type:kt,payload:t}),"receiveItems"),er=n((t=1,e="place")=>n(function(o,s){let{environment:{legoUrl:i},auth:a}=s();if(!a)return o(ce("No auth set."));let c=ac(t,e);return o(c),se.fetchOrders(i,a,t,e).then(l=>{if(l.results){o(jr(l));let u=(l.results[0]||{}).public_id;if(u)return se.fetchItems(i,a,u).then(h=>o($r(h)))}return o(ce(l.detail)),null},l=>o(ce(l))).finally(()=>o(Xt(c)))},"fetchOrdersThunk"),"fetchOrders"),Vr=n(t=>{switch(t){case Ht:return{type:Fe,payload:t};case ye:return{type:ke,payload:t};case be:return{type:Ue,payload:t};default:throw new Error(`${t} is not a supported environment`)}},"setEnvironment"),Zn=n(()=>(t,e)=>{let{merchantId:r,sessionId:o}=e();return(!o||r&&!o.startsWith(r))&&t(Mr(r)),o},"requestSessionId"),Ve=n((t,e)=>({type:P,payload:{...t,offer:e}}),"receiveOffer"),Hr=n(t=>({type:On,payload:t}),"fetchResponseError"),cc=n((t,e=ge,r)=>({type:z,payload:{product:t,module:e,offer:r}}),"requestOffer"),Xn=n((t,e=ge,r)=>n(function(s,i){let{merchantId:a,sessionId:c,environment:{apiUrl:l}}=i(),u=cc(t,e,r);s(u);let h=R(t);return h?se.fetchOffer(l,a,c,h,e).then(p=>s(Ve(p,r)),p=>s(Hr(p))).finally(()=>s(Xt(u))):null},"fetchOfferThunk"),"fetchOffer"),es=n(()=>({type:De}),"checkout"),lc=n((t,e,r,o)=>({type:Cn,payload:{product:t,order:e,quantity:r,offerId:o}}),"requestCreateOneTime"),uc=n(t=>({type:Ft,payload:t}),"receiveCreateOneTime"),pc=n((t,e)=>({type:Pn,payload:{item:t,frequency:e}}),"requestConvertOneTimeToSubscription"),dc=n((t,e)=>({type:Ut,payload:{response:t,product:e}}),"receiveConvertOneTime"),ts=n((t,e,r,o=!1,s=null)=>n(function(a,c){let{auth:l,config:u,environment:{legoUrl:h},previewUpsellOffer:p,offerId:m}=c();if(!l)return a(ce("No auth set."));let C=Vn(s,u),_=lc(t,e,r,m);return a(_),(p?Promise.resolve({legoUrl:h,product:t,order:e,quantity:r,offer:m}):se.createOneTime(h,l,t.id,e,r,m)).then(f=>(a(uc(f)),o?(a(pc(f,C)),(p?Promise.resolve({item:f,frequency:C}):se.convertOneTimeToSubscription(h,l,f,C,m)).then(E=>a(dc(E,t)),E=>a(Hr(E)))):f),f=>a(Hr(f))).finally(()=>a(Xt(_)))},"createIuThunk"),"createIu"),rs=n(t=>({type:Dt,payload:t}),"setLocale"),os=n(t=>({type:Lt,payload:t}),"setConfig"),ns=n((t,e,r)=>({type:Mt,payload:{selector:t,markup:e,config:r}}),"addTemplate"),ss=n(t=>({type:jt,payload:t}),"setTemplates"),is=n((t,e)=>({type:$t,payload:{product:t,firstOrderPlaceDate:e}}),"setFirstOrderPlaceDate"),as=n((t,e)=>({type:Vt,payload:{product:t,productToSubscribe:e}}),"setProductToSubscribe")});var Qr,Te,ve=S(()=>{Qr=typeof window!="undefined"&&window.customElements!=null&&window.customElements.polyfillWrapFlushCallback!==void 0,Te=n((t,e,r=null)=>{for(;e!==r;){let o=e.nextSibling;t.removeChild(e),e=o}},"removeNodes")});var $,Kr,Os,ze,Oe,ws,ht,Q,ir,le=S(()=>{$=`{{lit-${String(Math.random()).slice(2)}}}`,Kr=`<!--${$}-->`,Os=new RegExp(`${$}|${Kr}`),ze="$lit$",Oe=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:u,values:{length:h}}=e;for(;l<h;){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:C}=m,_=0;for(let f=0;f<C;f++)ws(m[f].name,ze)&&_++;for(;_-- >0;){let f=u[l],E=ir.exec(f)[2],w=E.toLowerCase()+ze,b=p.getAttribute(w);p.removeAttribute(w);let g=b.split(Os);this.parts.push({type:"attribute",index:c,name:E,strings:g}),l+=g.length-1}}p.tagName==="TEMPLATE"&&(s.push(p),i.currentNode=p.content)}else if(p.nodeType===3){let m=p.data;if(m.indexOf($)>=0){let C=p.parentNode,_=m.split(Os),f=_.length-1;for(let E=0;E<f;E++){let w,b=_[E];if(b==="")w=Q();else{let g=ir.exec(b);g!==null&&ws(g[2],ze)&&(b=b.slice(0,g.index)+g[1]+g[2].slice(0,-ze.length)+g[3]),w=document.createTextNode(b)}C.insertBefore(w,p),this.parts.push({type:"node",index:++c})}_[f]===""?(C.insertBefore(Q(),p),o.push(p)):p.data=_[f],l+=f}}else if(p.nodeType===8)if(p.data===$){let m=p.parentNode;(p.previousSibling===null||c===a)&&(c++,m.insertBefore(Q(),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($,m+1))!==-1;)this.parts.push({type:"node",index:-1}),l++}}for(let p of o)p.parentNode.removeChild(p)}};n(Oe,"Template");ws=n((t,e)=>{let r=t.length-e.length;return r>=0&&t.slice(r)===e},"endsWith"),ht=n(t=>t.index!==-1,"isTemplatePartActive"),Q=n(()=>document.createComment(""),"createMarker"),ir=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/});function Xr(t,e){let{element:{content:r},parts:o}=t,s=document.createTreeWalker(r,Zr,null,!1),i=mt(o),a=o[i],c=-1,l=0,u=[],h=null;for(;s.nextNode();){c++;let p=s.currentNode;for(p.previousSibling===h&&(h=null),e.has(p)&&(u.push(p),h===null&&(h=p)),h!==null&&l++;a!==void 0&&a.index===c;)a.index=h!==null?-1:a.index-l,i=mt(o,i),a=o[i]}u.forEach(p=>p.parentNode.removeChild(p))}function Cs(t,e,r=null){let{element:{content:o},parts:s}=t;if(r==null){o.appendChild(e);return}let i=document.createTreeWalker(o,Zr,null,!1),a=mt(s),c=0,l=-1;for(;i.nextNode();)for(l++,i.currentNode===r&&(c=Ac(e),r.parentNode.insertBefore(e,r));a!==-1&&s[a].index===l;){if(c>0){for(;a!==-1;)s[a].index+=c,a=mt(s,a);return}a=mt(s,a)}}var Zr,Ac,mt,Ps=S(()=>{le();Zr=133;n(Xr,"removeNodesFromTemplate");Ac=n(t=>{let e=t.nodeType===11?0:1,r=document.createTreeWalker(t,Zr,null,!1);for(;r.nextNode();)e++;return e},"countNodes"),mt=n((t,e=-1)=>{for(let r=e+1;r<t.length;r++){let o=t[r];if(ht(o))return r}return-1},"nextActiveIndexInTemplateParts");n(Cs,"insertNodeIntoTemplate")});var Nc,we,eo=S(()=>{Nc=new WeakMap,we=n(t=>typeof t=="function"&&Nc.has(t),"isDirective")});var D,ar,to=S(()=>{D={},ar={}});var ue,cr=S(()=>{ve();le();ue=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=Qr?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],!ht(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 u=this.processor.handleTextExpression(this.options);u.insertAfterNode(l.previousSibling),this.__parts.push(u)}else this.__parts.push(...this.processor.handleAttributeExpressions(l,c.name,c.strings,this.options));i++}return Qr&&(document.adoptNode(e),customElements.upgrade(e)),e}};n(ue,"TemplateInstance")});var Rs,qc,X,lr=S(()=>{ve();le();Rs=window.trustedTypes&&trustedTypes.createPolicy("lit-html",{createHTML:t=>t}),qc=` ${$} `,X=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=ir.exec(i);c===null?r+=i+(o?qc:Kr):r+=i.substr(0,c.index)+c[1]+c[2]+ze+c[3]+$}return r+=this.strings[e],r}getTemplateElement(){let e=document.createElement("template"),r=this.getHTML();return Rs!==void 0&&(r=Rs.createHTML(r)),e.innerHTML=r,e}};n(X,"TemplateResult")});var ur,pr,We,gt,ee,yt,bt,dr,As,_t,kc,fr=S(()=>{eo();ve();to();cr();lr();le();ur=n(t=>t===null||!(typeof t=="object"||typeof t=="function"),"isPrimitive"),pr=n(t=>Array.isArray(t)||!!(t&&t[Symbol.iterator]),"isIterable"),We=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 gt(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"||!pr(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(ur(c)||!pr(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(We,"AttributeCommitter");gt=class{constructor(e){this.value=void 0,this.committer=e}setValue(e){e!==D&&(!ur(e)||e!==this.value)&&(this.value=e,we(e)||(this.committer.dirty=!0))}commit(){for(;we(this.value);){let e=this.value;this.value=D,e(this)}this.value!==D&&this.committer.commit()}};n(gt,"AttributePart");ee=class{constructor(e){this.value=void 0,this.__pendingValue=void 0,this.options=e}appendInto(e){this.startNode=e.appendChild(Q()),this.endNode=e.appendChild(Q())}insertAfterNode(e){this.startNode=e,this.endNode=e.nextSibling}appendIntoPart(e){e.__insert(this.startNode=Q()),e.__insert(this.endNode=Q())}insertAfterPart(e){e.__insert(this.startNode=Q()),this.endNode=e.endNode,e.endNode=this.startNode}setValue(e){this.__pendingValue=e}commit(){if(this.startNode.parentNode===null)return;for(;we(this.__pendingValue);){let r=this.__pendingValue;this.__pendingValue=D,r(this)}let e=this.__pendingValue;e!==D&&(ur(e)?e!==this.value&&this.__commitText(e):e instanceof X?this.__commitTemplateResult(e):e instanceof Node?this.__commitNode(e):pr(e)?this.__commitIterable(e):e===ar?(this.value=ar,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 ue&&this.value.template===r)this.value.update(e.values);else{let o=new ue(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 ee(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){Te(this.startNode.parentNode,e.nextSibling,this.endNode)}};n(ee,"NodePart");yt=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(;we(this.__pendingValue);){let r=this.__pendingValue;this.__pendingValue=D,r(this)}if(this.__pendingValue===D)return;let e=!!this.__pendingValue;this.value!==e&&(e?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=e),this.__pendingValue=D}};n(yt,"BooleanAttributePart");bt=class extends We{constructor(e,r,o){super(e,r,o);this.single=o.length===2&&o[0]===""&&o[1]===""}_createPart(){return new dr(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}};n(bt,"PropertyCommitter");dr=class extends gt{};n(dr,"PropertyPart");As=!1;(()=>{try{let t={get capture(){return As=!0,!1}};window.addEventListener("test",t,t),window.removeEventListener("test",t,t)}catch{}})();_t=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(;we(this.__pendingValue);){let i=this.__pendingValue;this.__pendingValue=D,i(this)}if(this.__pendingValue===D)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=kc(e),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=e,this.__pendingValue=D}handleEvent(e){typeof this.value=="function"?this.value.call(this.eventContext||this.element,e):this.value.handleEvent(e)}};n(_t,"EventPart");kc=n(t=>t&&(As?{capture:t.capture,passive:t.passive,once:t.once}:t.capture),"getOptions")});function ro(t){let e=Ce.get(t.type);e===void 0&&(e={stringsArray:new WeakMap,keyString:new Map},Ce.set(t.type,e));let r=e.stringsArray.get(t.strings);if(r!==void 0)return r;let o=t.strings.join($);return r=e.keyString.get(o),r===void 0&&(r=new Oe(t,t.getTemplateElement()),e.keyString.set(o,r)),e.stringsArray.set(t.strings,r),r}var Ce,hr=S(()=>{le();n(ro,"templateFactory");Ce=new Map});var pe,oo,no=S(()=>{ve();fr();hr();pe=new WeakMap,oo=n((t,e,r)=>{let o=pe.get(e);o===void 0&&(Te(e,e.firstChild),pe.set(e,o=new ee(Object.assign({templateFactory:ro},r))),o.appendInto(e)),o.setValue(t),o.commit()},"render")});var mr,so,io=S(()=>{fr();mr=class{handleAttributeExpressions(e,r,o,s){let i=r[0];return i==="."?new bt(e,r.slice(1),o).parts:i==="@"?[new _t(e,r.slice(1),s.eventContext)]:i==="?"?[new yt(e,r.slice(1),o)]:new We(e,r,o).parts}handleTextExpression(e){return new ee(e)}};n(mr,"DefaultTemplateProcessor");so=new mr});var d,ao=S(()=>{io();lr();io();eo();ve();to();fr();no();hr();cr();lr();le();typeof window!="undefined"&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.3.0");d=n((t,...e)=>new X(t,e,"html",so),"html")});var Is,gr,Uc,Dc,Lc,qs,Mc,ks,Fs=S(()=>{ve();Ps();no();hr();cr();le();ao();Is=n((t,e)=>`${t}--${e}`,"getTemplateCacheKey"),gr=!0;typeof window.ShadyCSS=="undefined"?gr=!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."),gr=!1);Uc=n(t=>e=>{let r=Is(e.type,t),o=Ce.get(r);o===void 0&&(o={stringsArray:new WeakMap,keyString:new Map},Ce.set(r,o));let s=o.stringsArray.get(e.strings);if(s!==void 0)return s;let i=e.strings.join($);if(s=o.keyString.get(i),s===void 0){let a=e.getTemplateElement();gr&&window.ShadyCSS.prepareTemplateDom(a,t),s=new Oe(e,a),o.keyString.set(i,s)}return o.stringsArray.set(e.strings,s),s},"shadyTemplateFactory"),Dc=["html","svg"],Lc=n(t=>{Dc.forEach(e=>{let r=Ce.get(Is(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)}),Xr(o,i)})})},"removeStylesFromLitTemplates"),qs=new Set,Mc=n((t,e,r)=>{qs.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 u=0;u<i;u++){let h=s[u];h.parentNode.removeChild(h),a.textContent+=h.textContent}Lc(t);let c=o.content;r?Cs(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 u=new Set;u.add(a),Xr(r,u)}},"prepareTemplateStyles"),ks=n((t,e,r)=>{if(!r||typeof r!="object"||!r.scopeName)throw new Error("The `scopeName` option is required.");let o=r.scopeName,s=pe.has(e),i=gr&&e.nodeType===11&&!!e.host,a=i&&!qs.has(o),c=a?document.createDocumentFragment():e;if(oo(t,c,Object.assign({templateFactory:Uc(o)},r)),a){let l=pe.get(c);pe.delete(c);let u=l.value instanceof ue?l.value.template:void 0;Mc(o,c,u),Te(e,e.firstChild),e.appendChild(c),pe.set(e,l)}!s&&i&&window.ShadyCSS.styleElement(e.host)},"render")});var Us,co,Ds,lo,uo,po,fo,ho,mo,Et,go=S(()=>{window.JSCompiler_renameProperty=(t,e)=>t;co={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}},Ds=n((t,e)=>e!==t&&(e===e||t===t),"notEqual"),lo={attribute:!0,type:String,converter:co,reflect:!1,hasChanged:Ds},uo=1,po=1<<2,fo=1<<3,ho=1<<4,mo="finalized",Et=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=lo){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)||lo}static finalize(){let e=Object.getPrototypeOf(this);if(e.hasOwnProperty(mo)||e.finalize(),this[mo]=!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=Ds){return o(e,r)}static _propertyValueFromAttribute(e,r){let o=r.type,s=r.converter||co,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||co.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=lo){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|fo,a==null?this.removeAttribute(i):this.setAttribute(i,a),this._updateState=this._updateState&~fo}}_attributeToProperty(e,r){if(this._updateState&fo)return;let o=this.constructor,s=o._attributeToPropertyMap.get(e);if(s!==void 0){let i=o.getPropertyOptions(s);this._updateState=this._updateState|ho,this[s]=o._propertyValueFromAttribute(r,i),this._updateState=this._updateState&~ho}}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&ho)&&(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|po;try{await this._updatePromise}catch{}let e=this.performUpdate();return e!=null&&await e,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return this._updateState&po}get hasUpdated(){return this._updateState&uo}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&uo||(this._updateState=this._updateState|uo,this.firstUpdated(r)),this.updated(r))}_markUpdated(){this._changedProperties=new Map,this._updateState=this._updateState&~po}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(Et,"UpdatingElement");Us=mo;Et[Us]=!0});var Ls,Ed,Ms=S(()=>{Ls=Element.prototype,Ed=Ls.msMatchesSelector||Ls.webkitMatchesSelector});var yr,yo,xt,js,jc,v,bo=S(()=>{yr=window.ShadowRoot&&(window.ShadyCSS===void 0||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,yo=Symbol(),xt=class{constructor(e,r){if(r!==yo)throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e}get styleSheet(){return this._styleSheet===void 0&&(yr?(this._styleSheet=new CSSStyleSheet,this._styleSheet.replaceSync(this.cssText)):this._styleSheet=null),this._styleSheet}toString(){return this.cssText}};n(xt,"CSSResult");js=n(t=>new xt(String(t),yo),"unsafeCSS"),jc=n(t=>{if(t instanceof xt)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"),v=n((t,...e)=>{let r=e.reduce((o,s,i)=>o+jc(s)+t[i+1],t[0]);return new xt(r,yo)},"css")});var $s,T,O=S(()=>{Fs();go();go();Ms();ao();bo();bo();(window.litElementVersions||(window.litElementVersions=[])).push("2.4.0");$s={},T=class extends Et{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&&!yr){let o=Array.prototype.slice.call(r.cssRules).reduce((s,i)=>s+i.cssText,"");return js(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):yr?this.renderRoot.adoptedStyleSheets=e.map(r=>r instanceof CSSStyleSheet?r:r.styleSheet):this._needsShimAdoptedStyleSheets=!0)}connectedCallback(){super.connectedCallback(),this.hasUpdated&&window.ShadyCSS!==void 0&&window.ShadyCSS.styleElement(this)}update(e){let r=this.render();super.update(e),r!==$s&&this.constructor.render(r,this.renderRoot,{scopeName:this.localName,eventContext:this}),this._needsShimAdoptedStyleSheets&&(this._needsShimAdoptedStyleSheets=!1,this.constructor._styles.forEach(o=>{let s=document.createElement("style");s.textContent=o.cssText,this.renderRoot.appendChild(s)}))}render(){return $s}};n(T,"LitElement");T.finalized=!0;T.render=ks});var br=he((Nd,Vs)=>{var $c={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"};Vs.exports=$c});var Bs=he((Id,Hs)=>{var Pe=br(),Vc=n(t=>{let e="",r=[];for(let o of t){let s=o.charCodeAt(0);switch(s){case Pe.PAR_OPEN:case Pe.PAR_CLOSE:case Pe.OP_NOT:case Pe.BINARY_AND:case Pe.BINARY_OR:e&&(r.push({type:Pe.LITERAL,value:e}),e=""),r.push({type:s,value:o});break;default:e+=o}}return e&&r.push({type:Pe.LITERAL,value:e}),r},"Tokenizer");Hs.exports=Vc});var zs=he((qd,Gs)=>{var de=br(),Hc=n(t=>{let e=[],r=[];return t.forEach(s=>{switch(s.type){case de.LITERAL:e.unshift(s);break;case de.BINARY_AND:case de.BINARY_OR:case de.OP_NOT:case de.PAR_OPEN:r.push(s);break;case de.PAR_CLOSE:for(;r.length&&r[r.length-1].type!==de.PAR_OPEN;)e.unshift(r.pop());r.pop(),r.length&&r[r.length-1].type===de.OP_NOT&&e.unshift(r.pop());break;default:break}}),r.length&&[...r.reverse(),...e]||e},"PolishNotation"),Bc=n(function*(t){for(let e=0;e<t.length-1;e++)yield t[e];return t[t.length-1]},"PolishGenerator");Gs.exports={PolishNotation:Hc,PolishGenerator:Bc}});var Ys=he((kd,Ws)=>{var L=br(),B=class{constructor(e,r,o,s){this.op=e,this.left=r,this.right=o,this.literal=s}isLeaf(){return this.op===L.LEAF}isAtomic(){return this.isLeaf()||this.op===L.OP_NOT&&this.left.isLeaf()}getLiteralValue(){return this.literal}static CreateAnd(e,r){return new B(L.BINARY_AND,e,r)}static CreateNot(e){return new B(L.OP_NOT,e)}static CreateOr(e,r){return new B(L.BINARY_OR,e,r)}static CreateLiteral(e){return new B(L.LEAF,null,null,e)}};n(B,"ExpNode");var Ye=n(t=>{let e=t.next().value;switch(e.type){case L.LITERAL:return B.CreateLiteral(e.value);case L.OP_NOT:return B.CreateNot(Ye(t));case L.BINARY_AND:{let r=Ye(t),o=Ye(t);return B.CreateAnd(r,o)}case L.BINARY_OR:{let r=Ye(t),o=Ye(t);return B.CreateOr(r,o)}}return null},"make"),Je=n((t,e)=>{if(t.isLeaf())return e(t.getLiteralValue());if(t.op===L.OP_NOT)return!Je(t.left,e);if(t.op===L.BINARY_OR)return Je(t.left,e)||Je(t.right,e);if(t.op===L.BINARY_AND)return Je(t.left,e)&&Je(t.right,e)},"nodeEvaluator");Ws.exports={make:Ye,nodeEvaluator:Je}});var Zs=he((Fd,Ks)=>{var Gc=Bs(),Js=zs(),Qs=Ys(),zc=n((t,e)=>{let r=Gc(t),o=Js.PolishNotation(r),s=Js.PolishGenerator(o),i=Qs.make(s);return Qs.nodeEvaluator(i,e)},"parse");Ks.exports={parse:zc}});var Ri={};Cr(Ri,{TestWizard:()=>Or,default:()=>ml});var Or,ml,Ai=S(()=>{O();A();Or=class extends T{static get styles(){return v`
|
|
13
13
|
:host {
|
|
14
14
|
position: fixed;
|
|
15
15
|
top: 5em;
|
|
@@ -100,16 +100,16 @@ var lib=(()=>{var sa=Object.create;var Xe=Object.defineProperty;var ia=Object.ge
|
|
|
100
100
|
upsell product is in next order
|
|
101
101
|
</button>
|
|
102
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(
|
|
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(Ve({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($r({count:1,next:null,previous:null,results:[{order:"24d50352579511ea806cbc764e100cfd",offer:null,subscription:"8a076b7a0ea011e7a5bcbc764e105eda",product:s,components:[],quantity:1,public_id:"24d6901e579511ea806cbc764e100cfd",product_attribute:null,price:"14.99",extra_cost:"0.00",total_price:"13.49",one_time:!1,frozen:!1,first_placed:null}]})),this.runTests()}}render(){return d`
|
|
104
104
|
<div>
|
|
105
105
|
${this.testsRan?this.resultsCodeBlock():d`
|
|
106
106
|
<div>Click the button to run tests</div>
|
|
107
107
|
`}
|
|
108
108
|
<button ?disabled=${this.disabled} @click="${this.runTests.bind(this)}" class="primary">Run Test</button>
|
|
109
109
|
</div>
|
|
110
|
-
`}};n(Or,"TestWizard");xl=Or});var qu={};Cr(qu,{addOptinChangedCallback:()=>uu,addTemplate:()=>pu,autoInit:()=>Au,clear:()=>du,config:()=>fu,default:()=>Nu,disableOptinChangedCallbacks:()=>hu,getOptins:()=>mu,getProductsForPurchasePost:()=>gu,initialize:()=>yu,isReady:()=>lu,offers:()=>S,platform:()=>j,previewMode:()=>bu,register:()=>_u,resolveSettings:()=>Eu,setAuthUrl:()=>xu,setEnvironment:()=>Su,setLocale:()=>Tu,setMerchantId:()=>vu,setPublicPath:()=>Ou,setTemplates:()=>wu,setupCart:()=>Cu,setupProduct:()=>Pu,setupProducts:()=>Ru,store:()=>ta});function Pr(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(Pr,"symbolObservablePonyfill");var qe;typeof self!="undefined"?qe=self:typeof window!="undefined"||typeof window!="undefined"?qe=window:typeof module!="undefined"?qe=module:qe=Function("return this")();var pa=Pr(qe),Rr=pa;var Ar=n(function(){return Math.random().toString(36).substring(7).split("").join(".")},"randomString"),et={INIT:"@@redux/INIT"+Ar(),REPLACE:"@@redux/REPLACE"+Ar(),PROBE_UNKNOWN_ACTION:n(function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Ar()},"PROBE_UNKNOWN_ACTION")};function da(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(da,"isPlainObject");function Nr(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(Nr)(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 u(){c===a&&(c=a.slice())}n(u,"ensureCanMutateNextListeners");function h(){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(h,"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 E=!0;return u(),c.push(f),n(function(){if(!!E){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.");E=!1,u();var b=c.indexOf(f);c.splice(b,1),a=null}},"unsubscribe")}n(p,"subscribe");function m(f){if(!da(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 E=a=c,w=0;w<E.length;w++){var b=E[w];b()}return f}n(m,"dispatch");function C(f){if(typeof f!="function")throw new Error("Expected the nextReducer to be a function.");s=f,m({type:et.REPLACE})}n(C,"replaceReducer");function _(){var f,E=p;return f={subscribe:n(function(b){if(typeof b!="object"||b===null)throw new TypeError("Expected the observer to be an object.");function y(){b.next&&b.next(h())}n(y,"observeState"),y();var Ct=E(y);return{unsubscribe:Ct}},"subscribe")},f[Rr]=function(){return this},f}return n(_,"observable"),m({type:et.INIT}),o={dispatch:m,subscribe:p,getState:h,replaceReducer:C},o[Rr]=_,o}n(Nr,"createStore");function fa(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(fa,"getUndefinedStateErrorMessage");function ha(t){Object.keys(t).forEach(function(e){var r=t[e],o=r(void 0,{type:et.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:et.PROBE_UNKNOWN_ACTION()})=="undefined")throw new Error('Reducer "'+e+'" returned undefined when probed with a random type. '+("Don't try to handle "+et.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(ha,"assertReducerShape");function Pt(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{ha(r)}catch(l){c=l}return n(function(u,h){if(u===void 0&&(u={}),c)throw c;if(!1)var p;for(var m=!1,C={},_=0;_<i.length;_++){var f=i[_],E=r[f],w=u[f],b=E(w,h);if(typeof b=="undefined"){var y=fa(f,h);throw new Error(y)}C[f]=b,m=m||b!==w}return m=m||i.length!==Object.keys(u).length,m?C:u},"combination")}n(Pt,"combineReducers");function dn(t,e){return function(){return e(t.apply(this,arguments))}}n(dn,"bindActionCreator");function fn(t,e){if(typeof t=="function")return dn(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]=dn(s,e))}return r}n(fn,"bindActionCreators");function ma(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}n(ma,"_defineProperty");function hn(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(hn,"ownKeys");function ga(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?hn(r,!0).forEach(function(o){ma(t,o,r[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):hn(r).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(r,o))})}return t}n(ga,"_objectSpread2");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))}})}n(qr,"compose");function mn(){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),ga({},s,{dispatch:i})}}}n(mn,"applyMiddleware");function gn(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(gn,"createThunkMiddleware");var yn=gn();yn.withExtraArgument=gn;var bn=yn;var ps=re(At());N();M();var ht="OG_STATE",ds=n(t=>{try{return t===null?void 0:JSON.parse(t)}catch{return}},"safeParseState"),Gr=n(()=>window.og&&window.og.previewMode,"isPreviewMode"),fs=n(()=>Gr()?{}:ds(localStorage.getItem(ht)),"loadState"),bc=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"),hs=n(t=>{if(Gr())return;let e=bc(t);e&&localStorage.getItem(ht)!==e&&localStorage.setItem(ht,e)},"saveState"),ms=n(t=>(0,ps.throttle)(500,e=>{if(Gr())return;let{key:r,newValue:o}=e;r===ht&&o===null?(t.dispatch({type:oe}),setTimeout(()=>t.dispatch(ts()),0)):r===ht&&t.dispatch({type:ge,newValue:ds(o)})}),"listenLocalStorageChanges");var ys=re(At());M();function _c(t,e){return t===e}n(_c,"defaultEqualityCheck");function Ec(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(Ec,"areArgumentsShallowlyEqual");function xc(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:_c,r=null,o=null;return function(){return Ec(e,r,arguments)||(o=t.apply(null,arguments)),r=arguments,o}}n(xc,"defaultMemoize");function Sc(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(Sc,"getDependencies");function Tc(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(),u=Sc(i),h=t.apply(void 0,[function(){return c++,l.apply(null,arguments)}].concat(r)),p=t(function(){for(var m=[],C=u.length,_=0;_<C;_++)m.push(u[_].apply(null,arguments));return h.apply(null,m)});return p.resultFunc=l,p.dependencies=u,p.recomputations=function(){return c},p.resetRecomputations=function(){return c=0},p}}n(Tc,"createSelectorCreator");var Ge=Tc(xc);var ve=re(st());ie();ut();I();ve.default.Cache=Map;function vc(t,e){if(t===e)return!0;if(t===null||e===null||t.length!==e.length)return!1;for(let r=0;r<t.length;++r)if(t[r]!==e[r])return!1;return!0}n(vc,"arraysEqual");function Oc(t,e,r){let o=lt(r);return j.shopify_selling_plans?$(t,e,o):o}n(Oc,"resolveFrequency");var q=n((t,e)=>!!(t===e||typeof t=="object"&&typeof e=="object"&&t&&e&&t.id===e.id&&(!(Array.isArray(t.components)&&Array.isArray(e.components))||vc((t.components||[]).sort(),(e.components||[]).sort()))),"isSameProduct"),tr=n(t=>t.optedin||[],"optedinSelector"),gs=n(t=>t.optedout||[],"optedoutSelector"),Br=n(t=>t.autoshipByDefault||{},"autoshipSelector"),wc=n(t=>t.defaultFrequencies||{},"defaultFrequenciesSelector"),Cc=n(t=>{var e;return((e=t==null?void 0:t.config)==null?void 0:e.frequencies)||[]},"sellingPlansSelector"),Pc=n(t=>{var e;return((e=t==null?void 0:t.config)==null?void 0:e.frequenciesEveryPeriod)||[]},"frequenciesEveryPeriodSelector"),Z=(0,ve.default)(t=>Ge(tr,gs,Br,(e,r,o)=>{let s=e.find(i=>q(t,i));return s||(r.find(i=>q(t,i))?!1:t&&o[t.id]?{id:t.id}:!1)}),t=>JSON.stringify(t)),rr=(0,ve.default)(t=>Ge(tr,e=>{let r=e.find(o=>q(t,o));return r||!1}),t=>JSON.stringify(t)),or=(0,ve.default)(t=>Ge(gs,e=>e.find(r=>q(t,r))));var J=(0,ve.default)(t=>Ge(Z(t),e=>e&&e.frequency||null)),le=(0,ve.default)(t=>Ge(wc,Cc,Pc,(e,r,o)=>e[R(t)]&&Oc(r,o,e[R(t)])||null)),zr=n(t=>t.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase(),"kebabCase"),G=n((t,e,r,o)=>({[r]:t.config&&t.config[r]||e&&e.hasAttribute&&e.hasAttribute(zr(r))&&e[r]||e.offer&&typeof(e.offer[r]!=="undefined")&&e.offer[r]||o}),"configSelector"),Be=n(t=>({templates:t.templates||[]}),"templatesSelector");var Rc=n((t,e,r=document)=>r.dispatchEvent(new CustomEvent(t,{detail:e})),"dispatchEvent"),bs=n(t=>({payload:{product:{id:e,components:r}={}}={}}={})=>setTimeout(()=>Rc("optin-changed",{productId:e,components:r,optedIn:t}),0),"dispatchOptinChangedEvent"),Ac=[{expressions:[({type:t}={})=>t===k,({type:t}={})=>t===U],fn:bs(!0)},{expressions:[({type:t}={})=>t===F],fn:bs(!1)}],_s=n(t=>e=>r=>{let o=t.getState();Ac.forEach(s=>{s.expressions.some(i=>i(r,o))&&s.fn(r)}),e(r)},"dispatchMiddleware"),Es=n(t=>e=>r=>{var s;let o;switch(r.type){case P:case F:case k:case U:o=new CustomEvent(`og-${r.type.toLowerCase().replace(/_/g,"-")}`,{bubbles:!0,cancelable:!0,detail:r.payload}),(((s=r.payload)==null?void 0:s.offer)||document).dispatchEvent(o);break;default:}(o==null?void 0:o.defaultPrevented)||e(r)},"offerEvents"),xs=n(t=>e=>r=>{e(r);let o=(0,ys.throttle)(500,()=>{hs({...t.getState()})});r.type!==ge&&o()},"localStorageMiddleware");N();M();var Wr=n(()=>{let t,e;return[new Promise((r,o)=>{t=r,e=o}),t,e]},"waitFor");function Ss(t){let[e,r]=Wr(),[o,s]=Wr(),[i,a]=Wr();o.then(l=>{let{sessionId:u}=t.getState();!u||l&&!u.startsWith(l)?t.dispatch(Mr(l)):a(u)});let c=Promise.all([o,e,i]);return c.then(()=>{var l;window.addEventListener("storage",ms(t)),((l=t.getState().auth)==null?void 0:l.ts)||t.dispatch(es())}),l=>async u=>{De===u.type||Ue===u.type||Le===u.type?r(u.payload):Ie===u.type?s(u.payload):ke===u.type?a(u.payload):await c,l(u)}}n(Ss,"waitUntilOffersReady");function Ts(t,...e){if(window.og&&window.og.store)return window.og.store;let r=window.og&&window.og.previewMode,o=typeof window=="object"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({name:"Ordergroove Offers"}):qr,s=[Ss,bn,_s,Es],i={};if(!r)try{i=fs(),s.push(xs)}catch{}let a=o(mn(...s,...e)),c=Nr(t,i,a);return window.og=window.og||{},window.og.store=c,c}n(Ts,"makeStore");var Nc=Object.defineProperty,nr=n((t,e)=>Nc(t,"name",{value:e,configurable:!0}),"i"),qc=nr(t=>e=>t.indexOf(e.origin)>=0,"createIsMessageAllowed"),vs=["https://rc3.ordergroove.com","https://rc3.stg.ordergroove.com","http://localhost:3000",window.location.origin],Os=nr(t=>(e,r)=>{vs.forEach(o=>t.postMessage({ogType:e,...r},o))},"createBroadcastMessage");function Yr(t=window.opener,e=window.og){let r=nr(o=>{let s=qc(vs),i=Os(o.source),a=o.data.options||{};if(s(o)&&o.data.ogType==="READY"){let c="//static.ordergroove.com/@ordergroove/offers-live-editor/0.6.1/dist/";c.startsWith("//")&&(c=window.location.protocol+c),c.endsWith("/")||(c+="/"),import(`${c}client.js`).then(({initializeClient:l})=>{l({isMessageAllowed:s,broadcastMessage:i,options:a,og:e}),window.removeEventListener("message",r)})}},"handleReady");t&&t!==window&&(window.addEventListener("message",r),Os(t)("READY"))}n(Yr,"f");nr(Yr,"offersLiveEditor");var sr=null,Ic=n(t=>({dispatch:t}),"defaultMapDispatchToProps"),ws=n(t=>{if(!sr)throw new Error("Missing redux store.");return sr},"resolveStore"),kc=n((t,e)=>r=>{let{getState:o,dispatch:s}=ws(r),i=t?t(o(),r):{},a=e(s,r);Object.assign(r,i,a)},"createRecalcProps"),g=n((t,e=Ic)=>r=>{let s=kc(t,typeof e=="function"?e:i=>fn(e,i));return class extends r{get store(){return sr}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this._storeUnsubscribe=ws(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"),Cs=n(t=>{sr=t},"setStore");ie();var Jr=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],...ct(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 li=re(ti());v();var Zc=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"),ri=n(t=>t.hasAttribute("product")&&{id:t.getAttribute("product"),...t.hasAttribute("product-components")&&{components:JSON.parse(t.getAttribute("product-components"))}},"buildProduct");var _o=n(t=>{let e=ri(t);if(!e){let r=t.offer;r&&(e=ri(r))}return e},"resolveProduct"),Xc=n(t=>{let e=t;for(;e;){if(e.tagName==="OG-OFFER")return e;e=e.nodeType===11?e.host:e.parentNode}},"resolveOffer"),Eo=n(t=>class extends t{get offer(){return Xc(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 Eo(t){get product(){return _o(this)}},"withProduct"),_r=n(t=>class extends t{get childOptions(){let e=[],r=null;return this.querySelectorAll("option").forEach(o=>{let s=Zc(o.value),i=o.innerText.trim();e.push({value:s,text:i}),!r&&o.selected&&(r=s)}),{options:e,isSelected:r}}},"withChildOptions");var Er={};Cr(Er,{autoshipByDefault:()=>el,eligibilityGroups:()=>si,eligible:()=>oi,hasUpcomingOrder:()=>ai,hasUpsellGroup:()=>ii,inStock:()=>xo,optedout:()=>rl,regularEligible:()=>nl,subscribed:()=>tl,subscriptionEligible:()=>ni,upcomingOrderContainsProduct:()=>ol,upsellEligible:()=>ci});var xo=n((t,e)=>(t.inStock||{})[(e.product||{}).id],"inStock"),oi=n((t,e)=>(t.autoshipEligible||{})[(e.product||{}).id]||!1,"eligible"),el=n((t,e)=>(t.autoshipByDefault||{})[(e.product||{}).id]||!1,"autoshipByDefault"),ni=n((t,e)=>(t.offerId&&t.offerId!=="0"||!1)&&oi(t,e)&&xo(t,e),"subscriptionEligible"),si=n((t,e)=>(t.eligibilityGroups||{})[(e.product||{}).id]||null,"eligibilityGroups"),ii=n((t,e)=>{let r=si(t,e);return r===null||!!r.find(o=>o==="upsell"||o==="impulse_upsell")},"hasUpsellGroup"),tl=n((t,e)=>rr(e.product)(t),"subscribed"),rl=n((t,e)=>or(e.product)(t),"optedout"),ai=n(t=>!!(t.nextUpcomingOrder&&t.nextUpcomingOrder.public_id),"hasUpcomingOrder"),ol=n((t,e)=>(t.nextUpcomingOrder&&t.nextUpcomingOrder.products||[]).includes((e.product||{}).id),"upcomingOrderContainsProduct"),ci=n((t,e)=>{var r;return!((r=e.offer)==null?void 0:r.isCart)&&t.offerId&&t.offerId!=="0"&&t.auth&&xo(t,e)&&ai(t)&&ii(t,e)},"upsellEligible"),nl=n((t,e)=>ni(t,e)&&!ci(t,e),"regularEligible");var sl=n(t=>t.replace(/(\r\n|\n|\r|\s)+/gm,""),"removeWhitespace"),So=class extends A(x){static get properties(){return{...super.properties,state:{type:Object,attribute:!1},test:{type:String}}}render(){return this.test&&li.default.parse(sl(this.test),r=>Er[r]&&Er[r](this.state,this))?d`
|
|
110
|
+
`}};n(Or,"TestWizard");ml=Or});var wu={};Cr(wu,{addOptinChangedCallback:()=>nu,addTemplate:()=>su,autoInit:()=>vu,clear:()=>iu,config:()=>au,default:()=>Ou,disableOptinChangedCallbacks:()=>cu,getOptins:()=>lu,getProductsForPurchasePost:()=>uu,initialize:()=>pu,isReady:()=>ou,offers:()=>x,platform:()=>j,previewMode:()=>du,register:()=>fu,resolveSettings:()=>hu,setAuthUrl:()=>mu,setEnvironment:()=>gu,setLocale:()=>yu,setMerchantId:()=>bu,setPublicPath:()=>_u,setTemplates:()=>Eu,setupCart:()=>xu,setupProduct:()=>Su,setupProducts:()=>Tu,store:()=>Ki});function Pr(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(Pr,"symbolObservablePonyfill");var Ae;typeof self!="undefined"?Ae=self:typeof window!="undefined"||typeof window!="undefined"?Ae=window:typeof module!="undefined"?Ae=module:Ae=Function("return this")();var aa=Pr(Ae),Rr=aa;var Ar=n(function(){return Math.random().toString(36).substring(7).split("").join(".")},"randomString"),et={INIT:"@@redux/INIT"+Ar(),REPLACE:"@@redux/REPLACE"+Ar(),PROBE_UNKNOWN_ACTION:n(function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Ar()},"PROBE_UNKNOWN_ACTION")};function ca(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(ca,"isPlainObject");function Nr(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(Nr)(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 u(){c===a&&(c=a.slice())}n(u,"ensureCanMutateNextListeners");function h(){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(h,"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 E=!0;return u(),c.push(f),n(function(){if(!!E){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.");E=!1,u();var b=c.indexOf(f);c.splice(b,1),a=null}},"unsubscribe")}n(p,"subscribe");function m(f){if(!ca(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 E=a=c,w=0;w<E.length;w++){var b=E[w];b()}return f}n(m,"dispatch");function C(f){if(typeof f!="function")throw new Error("Expected the nextReducer to be a function.");s=f,m({type:et.REPLACE})}n(C,"replaceReducer");function _(){var f,E=p;return f={subscribe:n(function(b){if(typeof b!="object"||b===null)throw new TypeError("Expected the observer to be an object.");function g(){b.next&&b.next(h())}n(g,"observeState"),g();var wt=E(g);return{unsubscribe:wt}},"subscribe")},f[Rr]=function(){return this},f}return n(_,"observable"),m({type:et.INIT}),o={dispatch:m,subscribe:p,getState:h,replaceReducer:C},o[Rr]=_,o}n(Nr,"createStore");function la(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(la,"getUndefinedStateErrorMessage");function ua(t){Object.keys(t).forEach(function(e){var r=t[e],o=r(void 0,{type:et.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:et.PROBE_UNKNOWN_ACTION()})=="undefined")throw new Error('Reducer "'+e+'" returned undefined when probed with a random type. '+("Don't try to handle "+et.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(ua,"assertReducerShape");function Ct(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{ua(r)}catch(l){c=l}return n(function(u,h){if(u===void 0&&(u={}),c)throw c;if(!1)var p;for(var m=!1,C={},_=0;_<i.length;_++){var f=i[_],E=r[f],w=u[f],b=E(w,h);if(typeof b=="undefined"){var g=la(f,h);throw new Error(g)}C[f]=b,m=m||b!==w}return m=m||i.length!==Object.keys(u).length,m?C:u},"combination")}n(Ct,"combineReducers");function pn(t,e){return function(){return e(t.apply(this,arguments))}}n(pn,"bindActionCreator");function dn(t,e){if(typeof t=="function")return pn(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]=pn(s,e))}return r}n(dn,"bindActionCreators");function pa(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}n(pa,"_defineProperty");function fn(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(fn,"ownKeys");function da(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?fn(r,!0).forEach(function(o){pa(t,o,r[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):fn(r).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(r,o))})}return t}n(da,"_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 hn(){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),da({},s,{dispatch:i})}}}n(hn,"applyMiddleware");function mn(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(mn,"createThunkMiddleware");var gn=mn();gn.withExtraArgument=mn;var yn=gn;var cs=re(Rt());A();M();var ft="OG_STATE",ls=n(t=>{try{return t===null?void 0:JSON.parse(t)}catch{return}},"safeParseState"),Br=n(()=>window.og&&window.og.previewMode,"isPreviewMode"),us=n(()=>Br()?{}:ls(localStorage.getItem(ft)),"loadState"),fc=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"),ps=n(t=>{if(Br())return;let e=fc(t);e&&localStorage.getItem(ft)!==e&&localStorage.setItem(ft,e)},"saveState"),ds=n(t=>(0,cs.throttle)(500,e=>{if(Br())return;let{key:r,newValue:o}=e;r===ft&&o===null?(t.dispatch({type:oe}),setTimeout(()=>t.dispatch(Zn()),0)):r===ft&&t.dispatch({type:me,newValue:ls(o)})}),"listenLocalStorageChanges");var hs=re(Rt());M();function hc(t,e){return t===e}n(hc,"defaultEqualityCheck");function mc(t,e,r){if(e===null||r===null||e.length!==r.length)return!1;for(var o=e.length,s=0;s<o;s++)if(!t(e[s],r[s]))return!1;return!0}n(mc,"areArgumentsShallowlyEqual");function gc(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:hc,r=null,o=null;return function(){return mc(e,r,arguments)||(o=t.apply(null,arguments)),r=arguments,o}}n(gc,"defaultMemoize");function yc(t){var e=Array.isArray(t[0])?t[0]:t;if(!e.every(function(o){return typeof o=="function"})){var r=e.map(function(o){return typeof o}).join(", ");throw new Error("Selector creators expect all input-selectors to be functions, "+("instead received the following types: ["+r+"]"))}return e}n(yc,"getDependencies");function bc(t){for(var e=arguments.length,r=Array(e>1?e-1:0),o=1;o<e;o++)r[o-1]=arguments[o];return function(){for(var s=arguments.length,i=Array(s),a=0;a<s;a++)i[a]=arguments[a];var c=0,l=i.pop(),u=yc(i),h=t.apply(void 0,[function(){return c++,l.apply(null,arguments)}].concat(r)),p=t(function(){for(var m=[],C=u.length,_=0;_<C;_++)m.push(u[_].apply(null,arguments));return h.apply(null,m)});return p.resultFunc=l,p.dependencies=u,p.recomputations=function(){return c},p.resetRecomputations=function(){return c=0},p}}n(bc,"createSelectorCreator");var He=bc(gc);var Se=re(st());ie();ut();U();Se.default.Cache=Map;function _c(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(_c,"arraysEqual");function Ec(t,e,r){let o=lt(r);return j.shopify_selling_plans?Y(t,e,o):o}n(Ec,"resolveFrequency");var N=n((t,e)=>!!(t===e||typeof t=="object"&&typeof e=="object"&&t&&e&&t.id===e.id&&(!(Array.isArray(t.components)&&Array.isArray(e.components))||_c((t.components||[]).sort(),(e.components||[]).sort()))),"isSameProduct"),tr=n(t=>t.optedin||[],"optedinSelector"),fs=n(t=>t.optedout||[],"optedoutSelector"),Gr=n(t=>t.autoshipByDefault||{},"autoshipSelector"),xc=n(t=>t.defaultFrequencies||{},"defaultFrequenciesSelector"),Sc=n(t=>{var e;return((e=t==null?void 0:t.config)==null?void 0:e.frequencies)||[]},"sellingPlansSelector"),Tc=n(t=>{var e;return((e=t==null?void 0:t.config)==null?void 0:e.frequenciesEveryPeriod)||[]},"frequenciesEveryPeriodSelector"),Z=(0,Se.default)(t=>He(tr,fs,Gr,(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)),rr=(0,Se.default)(t=>He(tr,e=>{let r=e.find(o=>N(t,o));return r||!1}),t=>JSON.stringify(t)),or=(0,Se.default)(t=>He(fs,e=>e.find(r=>N(t,r))));var J=(0,Se.default)(t=>He(Z(t),e=>e&&e.frequency||null)),Be=(0,Se.default)(t=>He(xc,Sc,Tc,(e,r,o)=>e[R(t)]&&Ec(r,o,e[R(t)])||null)),zr=n(t=>t.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase(),"kebabCase"),H=n((t,e,r,o)=>({[r]:t.config&&t.config[r]||e&&e.hasAttribute&&e.hasAttribute(zr(r))&&e[r]||e.offer&&typeof(e.offer[r]!=="undefined")&&e.offer[r]||o}),"configSelector"),Ge=n(t=>({templates:t.templates||[]}),"templatesSelector");var vc=n((t,e,r=document)=>r.dispatchEvent(new CustomEvent(t,{detail:e})),"dispatchEvent"),ms=n(t=>({payload:{product:{id:e,components:r}={}}={}}={})=>setTimeout(()=>vc("optin-changed",{productId:e,components:r,optedIn:t}),0),"dispatchOptinChangedEvent"),Oc=[{expressions:[({type:t}={})=>t===q,({type:t}={})=>t===F],fn:ms(!0)},{expressions:[({type:t}={})=>t===k],fn:ms(!1)}],gs=n(t=>e=>r=>{let o=t.getState();Oc.forEach(s=>{s.expressions.some(i=>i(r,o))&&s.fn(r)}),e(r)},"dispatchMiddleware"),ys=n(t=>e=>r=>{var s;let o;switch(r.type){case P:case k:case q:case F:o=new CustomEvent(`og-${r.type.toLowerCase().replace(/_/g,"-")}`,{bubbles:!0,cancelable:!0,detail:r.payload}),(((s=r.payload)==null?void 0:s.offer)||document).dispatchEvent(o);break;default:}(o==null?void 0:o.defaultPrevented)||e(r)},"offerEvents"),bs=n(t=>e=>r=>{e(r);let o=(0,hs.throttle)(500,()=>{ps({...t.getState()})});r.type!==me&&o()},"localStorageMiddleware");A();M();var Wr=n(()=>{let t,e;return[new Promise((r,o)=>{t=r,e=o}),t,e]},"waitFor");function _s(t){let[e,r]=Wr(),[o,s]=Wr(),[i,a]=Wr();o.then(l=>{let{sessionId:u}=t.getState();!u||l&&!u.startsWith(l)?t.dispatch(Mr(l)):a(u)});let c=Promise.all([o,e,i]);return c.then(()=>{var l;window.addEventListener("storage",ds(t)),((l=t.getState().auth)==null?void 0:l.ts)||t.dispatch(Kn())}),l=>async u=>{Fe===u.type||ke===u.type||Ue===u.type?r(u.payload):Ne===u.type?s(u.payload):Ie===u.type?a(u.payload):await c,l(u)}}n(_s,"waitUntilOffersReady");function Es(t,...e){if(window.og&&window.og.store)return window.og.store;let r=window.og&&window.og.previewMode,o=typeof window=="object"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({name:"Ordergroove Offers"}):Ir,s=[_s,yn,gs,ys],i={};if(!r)try{i=us(),s.push(bs)}catch{}let a=o(hn(...s,...e)),c=Nr(t,i,a);return window.og=window.og||{},window.og.store=c,c}n(Es,"makeStore");var wc=Object.defineProperty,nr=n((t,e)=>wc(t,"name",{value:e,configurable:!0}),"i"),Cc=nr(t=>e=>t.indexOf(e.origin)>=0,"createIsMessageAllowed"),xs=["https://rc3.ordergroove.com","https://rc3.stg.ordergroove.com","http://localhost:3000",window.location.origin],Ss=nr(t=>(e,r)=>{xs.forEach(o=>t.postMessage({ogType:e,...r},o))},"createBroadcastMessage");function Yr(t=window.opener,e=window.og){let r=nr(o=>{let s=Cc(xs),i=Ss(o.source),a=o.data.options||{};if(s(o)&&o.data.ogType==="READY"){let c="//static.ordergroove.com/@ordergroove/offers-live-editor/0.6.1/dist/";c.startsWith("//")&&(c=window.location.protocol+c),c.endsWith("/")||(c+="/"),import(`${c}client.js`).then(({initializeClient:l})=>{l({isMessageAllowed:s,broadcastMessage:i,options:a,og:e}),window.removeEventListener("message",r)})}},"handleReady");t&&t!==window&&(window.addEventListener("message",r),Ss(t)("READY"))}n(Yr,"f");nr(Yr,"offersLiveEditor");var sr=null,Pc=n(t=>({dispatch:t}),"defaultMapDispatchToProps"),Ts=n(t=>{if(!sr)throw new Error("Missing redux store.");return sr},"resolveStore"),Rc=n((t,e)=>r=>{let{getState:o,dispatch:s}=Ts(r),i=t?t(o(),r):{},a=e(s,r);Object.assign(r,i,a)},"createRecalcProps"),y=n((t,e=Pc)=>r=>{let s=Rc(t,typeof e=="function"?e:i=>dn(e,i));return class extends r{get store(){return sr}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this._storeUnsubscribe=Ts(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"),vs=n(t=>{sr=t},"setStore");ie();var Jr=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],...ct(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");A();O();var ii=re(Zs());O();var Wc=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"),Xs=n(t=>t.hasAttribute("product")&&{id:t.getAttribute("product"),...t.hasAttribute("product-components")&&{components:JSON.parse(t.getAttribute("product-components"))}},"buildProduct");var _o=n(t=>{let e=Xs(t);if(!e){let r=t.offer;r&&(e=Xs(r))}return e},"resolveProduct"),Yc=n(t=>{let e=t;for(;e;){if(e.tagName==="OG-OFFER")return e;e=e.nodeType===11?e.host:e.parentNode}},"resolveOffer"),Eo=n(t=>class extends t{get offer(){return Yc(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"),I=n(t=>class extends Eo(t){get product(){return _o(this)}},"withProduct"),_r=n(t=>class extends t{get childOptions(){let e=[],r=null;return this.querySelectorAll("option").forEach(o=>{let s=Wc(o.value),i=o.innerText.trim();e.push({value:s,text:i}),!r&&o.selected&&(r=s)}),{options:e,isSelected:r}}},"withChildOptions");var Er={};Cr(Er,{autoshipByDefault:()=>Jc,eligibilityGroups:()=>ri,eligible:()=>ei,hasUpcomingOrder:()=>ni,hasUpsellGroup:()=>oi,inStock:()=>xo,optedout:()=>Kc,regularEligible:()=>Xc,subscribed:()=>Qc,subscriptionEligible:()=>ti,upcomingOrderContainsProduct:()=>Zc,upsellEligible:()=>si});var xo=n((t,e)=>(t.inStock||{})[(e.product||{}).id],"inStock"),ei=n((t,e)=>(t.autoshipEligible||{})[(e.product||{}).id]||!1,"eligible"),Jc=n((t,e)=>(t.autoshipByDefault||{})[(e.product||{}).id]||!1,"autoshipByDefault"),ti=n((t,e)=>(t.offerId&&t.offerId!=="0"||!1)&&ei(t,e)&&xo(t,e),"subscriptionEligible"),ri=n((t,e)=>(t.eligibilityGroups||{})[(e.product||{}).id]||null,"eligibilityGroups"),oi=n((t,e)=>{let r=ri(t,e);return r===null||!!r.find(o=>o==="upsell"||o==="impulse_upsell")},"hasUpsellGroup"),Qc=n((t,e)=>rr(e.product)(t),"subscribed"),Kc=n((t,e)=>or(e.product)(t),"optedout"),ni=n(t=>!!(t.nextUpcomingOrder&&t.nextUpcomingOrder.public_id),"hasUpcomingOrder"),Zc=n((t,e)=>(t.nextUpcomingOrder&&t.nextUpcomingOrder.products||[]).includes((e.product||{}).id),"upcomingOrderContainsProduct"),si=n((t,e)=>{var r;return!((r=e.offer)==null?void 0:r.isCart)&&t.offerId&&t.offerId!=="0"&&t.auth&&xo(t,e)&&ni(t)&&oi(t,e)},"upsellEligible"),Xc=n((t,e)=>ti(t,e)&&!si(t,e),"regularEligible");var el=n(t=>t.replace(/(\r\n|\n|\r|\s)+/gm,""),"removeWhitespace"),So=class extends I(T){static get properties(){return{...super.properties,state:{type:Object,attribute:!1},test:{type:String}}}render(){return this.test&&ii.default.parse(el(this.test),r=>Er[r]&&Er[r](this.state,this))?d`
|
|
111
111
|
<slot></slot>
|
|
112
|
-
`:d``}shouldUpdate(e){return e.size&&(this.product&&this.product.id in this.state.autoshipEligible&&this.product.id in this.state.inStock||!this.product.id)}};n(So,"When");var
|
|
112
|
+
`:d``}shouldUpdate(e){return e.size&&(this.product&&this.product.id in this.state.autoshipEligible&&this.product.id in this.state.inStock||!this.product.id)}};n(So,"When");var tl=n(t=>({state:t}),"mapStateToProps"),ai=y(tl)(So);O();A();O();ie();var ci={type:Object,converter:{toAttribute(t){return t==null?t:JSON.stringify(t)},fromAttribute(t){return t&&t.match(/[{[]/)?JSON.parse(t):{id:t}}}},fe={type:String,attribute:"default-frequency",converter:{fromAttribute(t){return t&&Dr(t)?t:null}}},xr={type:Boolean,attribute:!0,reflect:!0},Qe={type:Object,attribute:!1};O();var rl=n(t=>class extends t{getOption(e,r=e){let o=zr(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"),V=rl(T);var G=class extends I(V){static get properties(){return{subscribed:xr,frequencyMatch:{type:Boolean,reflect:!0,attribute:"frequency-match"},productDefaultFrequency:{type:String},defaultFrequency:{type:String}}}static get styles(){return v`
|
|
113
113
|
:host {
|
|
114
114
|
cursor: default;
|
|
115
115
|
display: inline-block;
|
|
@@ -178,7 +178,7 @@ var lib=(()=>{var sa=Object.create;var Xe=Object.defineProperty;var ia=Object.ge
|
|
|
178
178
|
<slot name="frequency-mismatch"></slot>
|
|
179
179
|
`:d`
|
|
180
180
|
<slot name="not-subscribed"></slot>
|
|
181
|
-
`}};n(
|
|
181
|
+
`}};n(G,"OptinStatus");var te=n((t,e={})=>({subscribed:Z(e.product)(t),frequency:J(e.product)(t),productDefaultFrequency:Be((e.product||{}).id)(t),...H(t,e,"defaultFrequency"),...Ge(t,e)}),"mapStateToProps"),li=y(te)(G);U();ut();var To=class extends G{static get properties(){return{...super.properties,frequency:{type:String,reflect:!0},defaultFrequency:fe,optinButtonLabel:{type:String}}}updated(e){e.has("subscribed")&&(this.frequencyMatch=this.frequency===this.optinFrequency)}get optinFrequency(){let e;return this.hasAttribute("default-frequency")?e=this.getAttribute("default-frequency"):e=this.offer?this.offer.defaultFrequency:this.defaultFrequency,j.shopify_selling_plans&&this.store&&(e=Hn(e,this.store.getState().config)),e}handleClick(e){this.optinProduct(_o(this),this.optinFrequency,this.offer),e.preventDefault()}render(){return d`
|
|
182
182
|
<slot name="default">
|
|
183
183
|
<button id="action-trigger" class="btn radio ${this.subscribed?"active":""}"></button>
|
|
184
184
|
<label for="action-trigger">
|
|
@@ -187,7 +187,7 @@ var lib=(()=>{var sa=Object.create;var Xe=Object.defineProperty;var ia=Object.ge
|
|
|
187
187
|
</slot>
|
|
188
188
|
</label>
|
|
189
189
|
</slot>
|
|
190
|
-
`}};n(To,"OptinButton");var
|
|
190
|
+
`}};n(To,"OptinButton");var ui=y(te,{optinProduct:ae})(To);O();A();var vo=class extends G{static get properties(){return{...super.properties,label:{type:String}}}handleClick(e){this.optoutProduct(this.product,this.offer),e.preventDefault()}render(){return d`
|
|
191
191
|
<slot name="default">
|
|
192
192
|
<button id="action-trigger" class="btn radio ${this.subscribed?"":"active"}"></button>
|
|
193
193
|
<label for="action-trigger">
|
|
@@ -196,13 +196,13 @@ var lib=(()=>{var sa=Object.create;var Xe=Object.defineProperty;var ia=Object.ge
|
|
|
196
196
|
</slot>
|
|
197
197
|
</label>
|
|
198
198
|
</slot>
|
|
199
|
-
`}};n(vo,"OptoutButton");var
|
|
199
|
+
`}};n(vo,"OptoutButton");var pi=y(te,{optoutProduct:$e})(vo);O();A();O();ie();var Re=n((t,e)=>{let{every:r,every_period:o}=ct(t);return r&&o?d`
|
|
200
200
|
${r}
|
|
201
201
|
<og-text key="frequencyPeriods" variant="${o}" pluralize="${r}"></og-text>
|
|
202
202
|
${e&&e===t?d`
|
|
203
203
|
<og-text key="defaultFrequencyCopy"></og-text>
|
|
204
204
|
`:""}
|
|
205
|
-
`:t},"frequencyText"),
|
|
205
|
+
`:t},"frequencyText"),St=class extends I(V){static get properties(){return{...super.properties,disabled:{type:Boolean},subscribed:xr,frequency:{type:String},defaultFrequency:fe,productDefaultFrequency:{type:String},config:{type:Object},frequencies:{converter:{fromAttribute:$n}}}}static get styles(){return v`
|
|
206
206
|
:host[hidden] {
|
|
207
207
|
display: none;
|
|
208
208
|
}
|
|
@@ -212,7 +212,7 @@ var lib=(()=>{var sa=Object.create;var Xe=Object.defineProperty;var ia=Object.ge
|
|
|
212
212
|
`}constructor(){super();this.frequencies=[]}render(){let e=this.frequency||this.defaultFrequency;return d`
|
|
213
213
|
<span>
|
|
214
214
|
${this.subscribed&&d`
|
|
215
|
-
<slot name="subscribed">${
|
|
215
|
+
<slot name="subscribed">${Re(e)} </slot>
|
|
216
216
|
`||""}
|
|
217
217
|
${!this.subscribed&&d`
|
|
218
218
|
<slot name="not-subscribed"></slot>
|
|
@@ -221,7 +221,7 @@ var lib=(()=>{var sa=Object.create;var Xe=Object.defineProperty;var ia=Object.ge
|
|
|
221
221
|
<slot name="frequency-mismatch"></slot>
|
|
222
222
|
`||""}
|
|
223
223
|
</span>
|
|
224
|
-
`}};n(
|
|
224
|
+
`}};n(St,"FrequencyStatus");var Tt=n((t,e)=>{var r,o;return{subscribed:Z(e.product)(t),frequency:J(e.product)(t),productDefaultFrequency:Be((e.product||{}).id)(t),configDefaultFrequency:(r=t.config)==null?void 0:r.defaultFrequency,frequenciesText:(o=t.config)==null?void 0:o.frequenciesText,config:t.config,...H(t,e,"frequencies"),...H(t,e,"defaultFrequency"),...Ge(t,e)}},"mapStateToProps"),di=y(Tt)(St);var Oo=class extends _r(G){static get properties(){return{...super.properties,frequencies:{type:Array,attribute:!1},frequency:{type:String},defaultFrequency:fe}}static get styles(){return v`
|
|
225
225
|
:host {
|
|
226
226
|
display: inline-block;
|
|
227
227
|
cursor: pointer;
|
|
@@ -231,13 +231,13 @@ var lib=(()=>{var sa=Object.create;var Xe=Object.defineProperty;var ia=Object.ge
|
|
|
231
231
|
border-width: var(--og-select-border-width, 1px);
|
|
232
232
|
box-shadow: 0 1px 0 1px rgba(0, 0, 0, 0.04);
|
|
233
233
|
}
|
|
234
|
-
`}get currentFrequency(){return this.subscribed?this.frequency||this.productDefaultFrequency||this.defaultFrequency:"optedOut"}onOptinChange(e){e==="optedOut"?this.optoutProduct(this.product,this.offer):this.productChangeFrequency(this.product,e,this.offer)}render(){var o;let{options:e}=this.childOptions,r;return((o=this.frequencies)==null?void 0:o.length)?r=[e.find(s=>s.value==="optedOut"),...this.frequencies.map((s,i)=>({value:s,text:this.frequenciesText&&i in this.frequenciesText?this.frequenciesText[i]:
|
|
234
|
+
`}get currentFrequency(){return this.subscribed?this.frequency||this.productDefaultFrequency||this.defaultFrequency:"optedOut"}onOptinChange(e){e==="optedOut"?this.optoutProduct(this.product,this.offer):this.productChangeFrequency(this.product,e,this.offer)}render(){var o;let{options:e}=this.childOptions,r;return((o=this.frequencies)==null?void 0:o.length)?r=[e.find(s=>s.value==="optedOut"),...this.frequencies.map((s,i)=>({value:s,text:this.frequenciesText&&i in this.frequenciesText?this.frequenciesText[i]:Re(s,this.defaultFrequency)}))]:r=e,d`
|
|
235
235
|
<og-select
|
|
236
236
|
.options="${r}"
|
|
237
237
|
.selected="${this.currentFrequency}"
|
|
238
238
|
.onChange="${({target:{value:s}})=>this.onOptinChange(s)}"
|
|
239
239
|
></og-select>
|
|
240
|
-
`}};n(Oo,"OptinSelect");var
|
|
240
|
+
`}};n(Oo,"OptinSelect");var fi=y((t,e)=>({...te(t,e),...Tt(t,e),...H(t,e,"frequencies")}),{productChangeFrequency:Zt,optoutProduct:$e})(Oo);O();A();var wo=class extends I(V){static get styles(){return v`
|
|
241
241
|
:host[hidden] {
|
|
242
242
|
display: none;
|
|
243
243
|
}
|
|
@@ -248,7 +248,7 @@ var lib=(()=>{var sa=Object.create;var Xe=Object.defineProperty;var ia=Object.ge
|
|
|
248
248
|
<slot>
|
|
249
249
|
<og-next-upcoming-order></og-next-upcoming-order>
|
|
250
250
|
</slot>
|
|
251
|
-
`}};n(wo,"UpsellButton");var
|
|
251
|
+
`}};n(wo,"UpsellButton");var ol=n(t=>({isPreview:t.previewUpsellOffer}),"mapStateToProps"),hi=y(ol,{fetchOrders:er})(wo);O();A();var Co=class extends I(V){static get properties(){return{...super.properties,defaultFrequency:fe,auth:Qe,subscribed:{type:Boolean,attribute:!1},frequency:{type:String,attribute:!1},nextUpcomingOrder:{type:Object,attribute:!1},show:{type:Boolean,attribute:"show"},offerId:{type:String}}}constructor(){super();this.createIu=()=>0,this.concludeUpsell=()=>0}render(){return d`
|
|
252
252
|
<og-modal ?show=${this.show} @close=${()=>this.close()} @confirm=${()=>this.confirm()}>
|
|
253
253
|
<div slot="content">
|
|
254
254
|
<slot>
|
|
@@ -286,7 +286,7 @@ var lib=(()=>{var sa=Object.create;var Xe=Object.defineProperty;var ia=Object.ge
|
|
|
286
286
|
</slot>
|
|
287
287
|
</span>
|
|
288
288
|
</og-modal>
|
|
289
|
-
`}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(Co,"UpsellModal");var
|
|
289
|
+
`}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(Co,"UpsellModal");var nl=n((t,e)=>({auth:t.auth,offerId:t.offerId,subscribed:Z(e.product)(t),frequency:J(e.product)(t),...H(t,e,"defaultFrequency"),nextUpcomingOrder:t.previewUpsellOffer?{public_id:"preview-order-id"}:t.nextUpcomingOrder,isPreview:t.previewUpsellOffer}),"mapStateToProps"),mi=y(nl,{concludeUpsell:Yn,createIu:ts})(Co);O();A();var Po=class extends G{static get properties(){return{...super.properties,frequency:{type:String}}}static get styles(){return v`
|
|
290
290
|
:host {
|
|
291
291
|
cursor: default;
|
|
292
292
|
display: inline-block;
|
|
@@ -327,13 +327,13 @@ var lib=(()=>{var sa=Object.create;var Xe=Object.defineProperty;var ia=Object.ge
|
|
|
327
327
|
></slot>
|
|
328
328
|
</label>
|
|
329
329
|
</slot>
|
|
330
|
-
`}};n(Po,"OptinToggle");var
|
|
330
|
+
`}};n(Po,"OptinToggle");var gi=y(te,{optoutProduct:$e,optinProduct:ae})(Po);O();var sl=n((t,e)=>`${t}${parseInt(e,10)>1?"s":""}`,"pluralize"),Ro=class extends Eo(T){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&&sl(e,this.pluralize)}render(){return d`
|
|
331
331
|
${this.getText()}
|
|
332
|
-
`}};n(Ro,"Text");var
|
|
333
|
-
${this.label} ${s?
|
|
332
|
+
`}};n(Ro,"Text");var il=n(t=>({i18n:t.locale||{}}),"mapStateToProps"),yi=y(il)(Ro);O();U();var Ke=class{constructor(e){this.value=e,this.className="DiscountAmount"}toString(){return`${this.value}`}};n(Ke,"DiscountAmount");var vt=class extends Ke{constructor(e){super(e);this.className="DiscountPercent"}toString(){return`${super.toString()}%`}};n(vt,"DiscountPercent");var Ao=class extends vt{constructor(e){super(e);this.className="ShippingDiscountPercent"}toString(){return this.value===100?"free shipping":super.toString()}};n(Ao,"ShippingDiscountPercent");var No="Discount Percent",Io="Discount Amount",bi="total_price",_i="shipping_total",Ei="sub_total",qo=n(({field:t,object:e,type:r,value:o})=>{let i=[[new vt(o),{field:bi,object:"item",type:No}],[new Ke(o),{field:bi,object:"item",type:Io}],[new Ao(o),{field:_i,object:"order",type:No}],[new Ke(o),{field:_i,object:"order",type:Io}],[new vt(o),{field:Ei,object:"order",type:No}],[new Ke(o),{field:Ei,object:"order",type:Io}]].find(([,a])=>a.field===t&&a.object===e&&a.type===r);return i&&i[0]},"discountBuilder");function al(t){return!(qo(t).className!==this.incentiveClass||this.incentiveValue&&this.incentiveValue.toString()!==t.value.toString())}n(al,"filterIncentives");var ko=class extends I(T){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(al.bind({incentiveClass:e,incentiveValue:r}));return d`
|
|
333
|
+
${this.label} ${s?qo(s):this.renderFallback()}
|
|
334
334
|
`}renderFallback(){return d`
|
|
335
|
-
${
|
|
336
|
-
`}};n(ko,"IncentiveText");var
|
|
335
|
+
${qo({field:"sub_total",object:"order",type:"Discount Percent",value:this.value})}
|
|
336
|
+
`}};n(ko,"IncentiveText");var cl=n((t,e)=>{var r;return{incentives:(t.incentives||{})[e&&(e==null?void 0:e.product)&&R((r=e==null?void 0:e.product)==null?void 0:r.id)]||{}}},"mapStateToProps"),xi=y(cl)(ko);O();A();var Fo=class extends _r(St){static get properties(){return{...super.properties,defaultText:{type:String,attribute:"default-text"}}}static get styles(){return v`
|
|
337
337
|
:host {
|
|
338
338
|
display: inline-block;
|
|
339
339
|
cursor: pointer;
|
|
@@ -344,7 +344,7 @@ var lib=(()=>{var sa=Object.create;var Xe=Object.defineProperty;var ia=Object.ge
|
|
|
344
344
|
box-shadow: 0 1px 0 1px rgba(0, 0, 0, 0.04);
|
|
345
345
|
z-index: 1;
|
|
346
346
|
}
|
|
347
|
-
`}set defaultFrequency(e){this._defaultFrequency=e}get defaultFrequency(){var s,i;let{options:e,isSelected:r}=this.childOptions,o;if(this.productDefaultFrequency?o=this.productDefaultFrequency:r?o=r:e.length?o=e[0].value:o=this._defaultFrequency,((s=this.frequencies)==null?void 0:s.length)&&o&&((i=this.config)==null?void 0:i.frequenciesEveryPeriod)){let a=this.config.frequenciesEveryPeriod.findIndex(c=>c===o);if(a>=0)return this.frequencies[a]}return o}get currentFrequency(){return this.frequency?this.frequency:this.defaultFrequency}productChangeFrequency(e,r){this.frequency=r}render(){var o;let e,r=this.defaultFrequency;return((o=this.frequencies)==null?void 0:o.length)?e=this.frequencies.map((s,i)=>{let a;return this.config.frequenciesEveryPeriod&&i in this.config.frequenciesEveryPeriod?a=
|
|
347
|
+
`}set defaultFrequency(e){this._defaultFrequency=e}get defaultFrequency(){var s,i;let{options:e,isSelected:r}=this.childOptions,o;if(this.productDefaultFrequency?o=this.productDefaultFrequency:r?o=r:e.length?o=e[0].value:o=this._defaultFrequency,((s=this.frequencies)==null?void 0:s.length)&&o&&((i=this.config)==null?void 0:i.frequenciesEveryPeriod)){let a=this.config.frequenciesEveryPeriod.findIndex(c=>c===o);if(a>=0)return this.frequencies[a]}return o}get currentFrequency(){return this.frequency?this.frequency:this.defaultFrequency}productChangeFrequency(e,r){this.frequency=r}render(){var o;let e,r=this.defaultFrequency;return((o=this.frequencies)==null?void 0:o.length)?e=this.frequencies.map((s,i)=>{let a;return this.config.frequenciesEveryPeriod&&i in this.config.frequenciesEveryPeriod?a=Re(this.config.frequenciesEveryPeriod[i],r):this.frequenciesText&&i in this.frequenciesText?a=this.frequenciesText[i]:a=Re(s,this.defaultFrequency),{value:s,text:a}}):{options:e}=this.childOptions,e.length||(e=(this.frequencies||[]).map(s=>({value:s,text:Re(s,r)}))),e=e.map(({text:s,value:i})=>({text:i===r?d`
|
|
348
348
|
${s} ${this.defaultText||""}
|
|
349
349
|
`:s,value:i})),d`
|
|
350
350
|
<og-select
|
|
@@ -352,9 +352,9 @@ var lib=(()=>{var sa=Object.create;var Xe=Object.defineProperty;var ia=Object.ge
|
|
|
352
352
|
.selected="${this.currentFrequency}"
|
|
353
353
|
.onChange="${({target:{value:s}})=>{this.productChangeFrequency(this.product,s,this.offer)}}"
|
|
354
354
|
></og-select>
|
|
355
|
-
`}};n(Fo,"SelectFrequency");var
|
|
356
|
-
${
|
|
357
|
-
`}};n(Uo,"FormattedDate");var
|
|
355
|
+
`}};n(Fo,"SelectFrequency");var Si=y(Tt,{productChangeFrequency:Zt})(Fo);O();var ll={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 Ti=n((t,e)=>t instanceof Date?(e||"").toString().replace(/\{\{([-\w]+)\}\}/g,r=>{let o=r.replace(/[{}]/g,""),s=ll[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 Uo=class extends T{static get properties(){return{value:{type:String,reflect:!0},format:{type:String}}}createRenderRoot(){return this}render(){return d`
|
|
356
|
+
${Ti(this.value,this.format||"{{month-long}} {{day}}, {{year-numeric}}")}
|
|
357
|
+
`}};n(Uo,"FormattedDate");var ul=n(t=>({value:t.previewUpsellOffer?new Date:t.nextUpcomingOrder.place}),"mapStateToProps"),vi=y(ul)(Uo);O();var Ci=re(st());A();M();var Oi=n((t,e,r)=>n(async function(s){await s({type:rt,payload:t}),await s({type:qe}),await s(Ve({in_stock:{[e]:!0},eligibility_groups:{[e]:["subscription","upsell"]},result:"success",autoship:{[e]:!0},autoship_by_default:{[e]:!1},modifiers:{},module_view:{regular:"096135e6650111e9a444bc764e106cf4"},incentives_display:{"47c01e9aacbe40389b5c7325d79091aa":{field:"sub_total",object:"order",type:"Discount Percent",value:5},e6534b9d877f41e586c37b7d8abc3a58:{field:"total_price",object:"item",type:"Discount Percent",value:10},f35e842710b24929922db4a529eecd40:{field:"total_price",object:"item",type:"Discount Percent",value:10},"5be321d7c17f4e18a757212b9a20bfcc":{field:"total_price",object:"item",type:"Discount Percent",value:1}},incentives:{[e]:{initial:["5be321d7c17f4e18a757212b9a20bfcc"],ongoing:["e6534b9d877f41e586c37b7d8abc3a58","47c01e9aacbe40389b5c7325d79091aa","f35e842710b24929922db4a529eecd40"]}}},r))},"setPreviewStandardOfferThunk"),"setPreviewStandardOffer"),pl=n((t,e,r)=>n(async function(s,i){await s({type:ot,payload:t});let{merchantId:a}=i();t?(await s(Ve({in_stock:{[e]:!0},module_view:{regular:"096135e6650111e9a444bc764e106cf4"},default_frequencies:{[e]:{every:1,every_period:3}},eligibility_groups:{[e]:["subscription","upsell"]},result:"success",autoship:{[e]:!0},autoship_by_default:{[e]:!1},modifiers:{}},r)),await s(jr({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 s(dt(a,"sig_field","ts","sig"))):await s(ce())},"setPreviewUpsellOfferThunk"),"setPreviewUpsellOffer"),wi=n((t,e,r)=>async function(o,s){switch(await o({type:oe}),await o({type:rt,payload:!1}),await o({type:ot,payload:!1}),t){case"regular":o(Oi(!0,r.product.id,r));break;case"upsell":o(pl(!0,r.product.id,r));break;case"subscribed":o(Oi(!0,r.product.id,r)),o(ae(r.product,"2_2"));break;default:}},"setPreview");A();U();M();var dl=n((...t)=>JSON.stringify(t),"memoizeKey"),fl=(0,Ci.default)((t,e)=>Object.assign({components:e},t),dl),Do=class extends V{static get properties(){return{...super.properties,config:{type:Object,attribute:!1},product:ci,productComponents:{type:Array,attribute:"product-components"},offerId:{type:String,attribute:!1},auth:Qe,preview:{type:String,attribute:"preview",reflect:"true"},location:{type:String},autoshipByDefault:{type:Boolean,attribute:"autoship-by-default"},productDefaultFrequency:{type:String,attribute:!1},locale:{type:Object,attribute:!0},firstOrderPlaceDate:{type:String,attribute:"first-order-place-date"},productToSubscribe:{type:String,attribute:"product-to-subscribe"},subscribed:{type:Boolean,reflect:!0},frequency:{type:String,reflect:!0},productFrequency:{type:String},isCart:{type:Boolean,attribute:"cart"},optedin:{type:Object},variationId:{type:String}}}firstUpdated(){let e=Array.from(this.getAttributeNames()).find(r=>r.startsWith("preview-"));e==="preview-standard-offer"?this.preview="regular":e==="preview-upsell-offer"?this.preview="upsell":e==="preview-subscribed-offer"&&(this.preview="subscribed")}static get styles(){return v`
|
|
358
358
|
:host[hidden] {
|
|
359
359
|
display: none;
|
|
360
360
|
}
|
|
@@ -503,9 +503,9 @@ var lib=(()=>{var sa=Object.create;var Xe=Object.defineProperty;var ia=Object.ge
|
|
|
503
503
|
</og-when>
|
|
504
504
|
</og-when>
|
|
505
505
|
|
|
506
|
-
`}constructor(){super();this.module="pdp",this.product={},this.productComponents=[],this.fetchOffer=()=>0,this.fetchOrders=()=>0,this.productHasChangedComponents=()=>0,this.setFirstOrderPlaceDate=()=>0,this.setProductToSubscribe=()=>0,this.productChangeFrequency=()=>0}applyTemplate(e){super.applyTemplate(e);let{id:r,locale:o}=e;this.variationId=r,this.locale=o;let s=new CustomEvent("template-changed");this.dispatchEvent(s)}updated(e){if(e.has("preview")&&this.setPreview(this.preview,e.get("preview"),this),this.frequency=this.defaultFrequency,e.has("product")&&!this.isPreview&&
|
|
506
|
+
`}constructor(){super();this.module="pdp",this.product={},this.productComponents=[],this.fetchOffer=()=>0,this.fetchOrders=()=>0,this.productHasChangedComponents=()=>0,this.setFirstOrderPlaceDate=()=>0,this.setProductToSubscribe=()=>0,this.productChangeFrequency=()=>0}applyTemplate(e){super.applyTemplate(e);let{id:r,locale:o}=e;this.variationId=r,this.locale=o;let s=new CustomEvent("template-changed");this.dispatchEvent(s)}updated(e){if(e.has("preview")&&this.setPreview(this.preview,e.get("preview"),this),this.frequency=this.defaultFrequency,e.has("product")&&!this.isPreview&&Qt(()=>this.fetchOffer(this.product.id,ge,this)),e.has("firstOrderPlaceDate")&&this.product.id&&!this.isPreview&&this.setFirstOrderPlaceDate(this.product.id,this.firstOrderPlaceDate),e.has("productToSubscribe")&&this.product.id&&!this.isPreview&&this.setProductToSubscribe(this.product.id,this.productToSubscribe),e.has("auth")&&this.auth&&!this.isPreview&&this.fetchOrders(),e.has("productComponents")){let r=fl(this.product,this.productComponents),o=Object.assign({},this.product,{components:e.get("productComponents")});N(r,o)||this.productHasChangedComponents(r,o)}(e.has("offerId")||e.has("autoshipByDefault")||e.has("location")||e.has("product"))&&this.offerId&&this.autoshipByDefault&&(this.location==="cart"||this.isCart)&&this.product.id&&this.optinProduct&&!(this.optedin||[]).find(r=>N(r,this.product))&&this.optinProduct({...this.product,...this.productComponents.length&&{components:this.productComponents}},this.defaultFrequency,this)}get isPreview(){return this.preview||window.og.previewMode}render(){return d`
|
|
507
507
|
<slot></slot>
|
|
508
|
-
`}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(Do,"Offer");var
|
|
508
|
+
`}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(Do,"Offer");var hl=n((t,e)=>({config:t.config,auth:t.auth,offerId:((t.productOffer||{})[(e.product||{}).id]||[])[0],productFrequency:J(e.product)(t),productDefaultFrequency:Be((e.product||{}).id)(t),...H(t,e,"autoshipByDefault",Gr(t)[(e.product||{}).id]),...or(e.product)(t)&&{autoshipByDefault:!1},optedin:tr(t),subscribed:Z(e.product)(t),...Ge(t)}),"mapStateToProps"),Pi=y(hl,{fetchOffer:Xn,fetchOrders:er,productHasChangedComponents:Wn,optinProduct:ae,setFirstOrderPlaceDate:is,setProductToSubscribe:as,setPreview:wi})(Do);O();var Sr=class extends T{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 v`
|
|
509
509
|
:host[hidden] {
|
|
510
510
|
display: none;
|
|
511
511
|
}
|
|
@@ -652,7 +652,7 @@ var lib=(()=>{var sa=Object.create;var Xe=Object.defineProperty;var ia=Object.ge
|
|
|
652
652
|
</div>
|
|
653
653
|
</div>
|
|
654
654
|
</div>
|
|
655
|
-
`:d``}};n(Sr,"Modal");
|
|
655
|
+
`:d``}};n(Sr,"Modal");O();var Tr=class extends T{static get styles(){return v`
|
|
656
656
|
:host {
|
|
657
657
|
display: inline-block;
|
|
658
658
|
color: inherit;
|
|
@@ -711,7 +711,7 @@ var lib=(()=>{var sa=Object.create;var Xe=Object.defineProperty;var ia=Object.ge
|
|
|
711
711
|
`)}
|
|
712
712
|
</select>
|
|
713
713
|
<span>▼</span>
|
|
714
|
-
`}};n(Tr,"Select");
|
|
714
|
+
`}};n(Tr,"Select");O();var vr=class extends T{static get properties(){return{placement:{type:String,default:"bottom"}}}static get styles(){return v`
|
|
715
715
|
:host[hidden] {
|
|
716
716
|
display: none;
|
|
717
717
|
}
|
|
@@ -874,14 +874,12 @@ var lib=(()=>{var sa=Object.create;var Xe=Object.defineProperty;var ia=Object.ge
|
|
|
874
874
|
</slot>
|
|
875
875
|
</div>
|
|
876
876
|
</span>
|
|
877
|
-
`}};n(vr,"Tooltip");
|
|
878
|
-
<slot></slot>
|
|
879
|
-
`:d``}};n(Lo,"DefaultFrequencyText");var El=n((t,e)=>({config:t.config||{},productDefaultFrequency:le((e.product||{}).id)(t)}),"mapStateToProps"),qi=g(El)(Lo);var{TestWizard:Sl}=(ki(),Ii);function Mo(){let t="og-test-wizard";customElements.get(t)||customElements.define(t,Sl);let e=document.createElement(t);document.body.appendChild(e)}n(Mo,"default");var jo=[79,71,68,69,86],Fi=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===jo[t]){let o=jo[t];setTimeout(function(){t<=o&&(t=0)},5e3),t+=1,t>=jo.length&&Mo()}else t=0},!1)},"enable");ie();M();ie();I();var $o=n((t=[],e)=>{switch(e.type){case oe:return[];case ge:return e.newValue?e.newValue.optedin:t;case k:case U:let[[r],o]=t.reduce((s,i)=>s[q(e.payload.product,i)?0:1].push(i)&&s,[[],[]]);return(o||[]).concat({...r,...e.payload.product,frequency:e.payload.frequency});case F:return t.filter(s=>!q(e.payload.product,s));case tt:return t.map(s=>q(e.payload.product,s)?{...s,...e.payload.newProduct}:s);case Dt:return t.filter(s=>!q(e.payload.product,s));case Me:return[];default:return t}},"optedin"),Vo=n((t=[],e)=>{switch(e.type){case oe:return[];case ge:return e.newValue?e.newValue.optedout:t;case k:case U:return t.filter(s=>!q(e.payload.product,s));case F:let[[r],o]=t.reduce((s,i)=>s[q(e.payload.product,i)?0:1].push(i)&&s,[[],[]]);return(o||[]).concat({...r,...e.payload.product,frequency:e.payload.frequency});case tt:return t.map(s=>q(e.payload.product,s)?{...s,...e.payload.newProduct}:s);case Me:return[];default:return t}},"optedout"),Ho=n((t={},{type:e,payload:r})=>{switch(e){case kt: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 Ft:return{...t,products:(r.results||[]).map(o=>o.product)};case Ut:return{...t,...r,public_id:r.order,...r.product&&{products:(t.products||[]).concat(r.product)}};default:return t}},"nextUpcomingOrder"),Tl=n((t={},e)=>{switch(e.type){case P:return{...t,...e.payload.autoship};default:return t}},"autoshipEligible"),vl=n((t={},e)=>{switch(e.type){case W:return{...t};case P:return{...t,...e.payload.in_stock};default:return t}},"inStock"),Go=n((t={},e)=>{switch(e.type){case P:return{...t,...e.payload.eligibility_groups};default:return t}},"eligibilityGroups"),Ui=n((t,e)=>t.map(r=>({...e[r],id:[r][0]})),"mapIncentive"),Bo=n((t={},e)=>{switch(e.type){case P:return{...t,...[...new Set(Object.keys(e.payload.incentives||{}))].reduce((r,o)=>({...r,[o]:Object.entries(e.payload.incentives).filter(([s])=>s===o).reduce((s,[,{initial:i,ongoing:a}])=>({...s,initial:[...s.initial||[],...Ui(i,e.payload.incentives_display)],ongoing:[...s.ongoing||[],...Ui(a,e.payload.incentives_display)]}),{})}),{})};default:return t}},"incentives"),Ol=n((t={},e)=>{switch(e.type){case k:case U:return{...t,[R(e.payload.product)]:e.payload.frequency};case F:return{...t,[R(e.payload.product)]:void 0};default:return t}},"frequency"),zo=n((t=!1,e)=>{switch(e.type){case It:return{...e.payload};case Fe:return!1;default:return t}},"auth"),Wo=n((t="",e)=>{switch(e.type){case Ie:return e.payload;default:return t}},"merchantId"),Yo=n((t=null,e)=>{switch(e.type){case qt:return e.payload;default:return t}},"authUrl"),wl=n((t={},e)=>{switch(e.type){case P:return{...t,offerId:(e.payload.module_view||{}).regular,...e.payload.modifiers};default:return t}},"offer"),Jo=n((t="",e)=>{switch(e.type){case P:return(e.payload.module_view||{}).regular||"";default:return t}},"offerId"),Qo=n((t=null,e)=>{switch(e.type){case oe:return null;case ke:return e.payload;default:return t}},"sessionId"),Cl=n((t={},e)=>{switch(e.type){case P:return{...t,...Object.entries(e.payload.autoship).map(([r])=>({[r]:Object.keys(e.payload.modifiers)})).reduce((r,o)=>({...r,...o}))};case Me:return{};default:return t}},"productOffer"),Ko=n((t={},e)=>{switch(e.type){case Vt:return{...t,[R(e.payload.product)]:e.payload.firstOrderPlaceDate};default:return t}},"firstOrderPlaceDate"),Zo=n((t={},e)=>{switch(e.type){case Ht:return{...t,[R(e.payload.product)]:e.payload.productToSubscribe};default:return t}},"productToSubscribe"),wt=n((t={},e)=>{switch(e.type){case Ue:return{...t,name:be,apiUrl:"https://staging.offers.ordergroove.com",legoUrl:"https://staging.restapi.ordergroove.com"};case De:return{...t,name:Gt,apiUrl:"https://dev.offers.ordergroove.com",legoUrl:"https://dev.restapi.ordergroove.com"};case Le:return{...t,name:_e,apiUrl:"https://offers.ordergroove.com",legoUrl:"https://restapi.ordergroove.com"};default:return t}},"environment"),Xo=n((t={offerOptInLabel:"Subscribe to save",offerIncentiveText:"Save {{ogIncentive DiscountPercent}} when you subscribe",offerOptOutLabel:"Deliver one-time only",offerEveryLabel:"Delivery Every",offerTooltipTrigger:"[?]",offerTooltipContent:"Seems this is a great subscription offering. Many fun details about this program exist.",optinButtonLabel:"\u2022",optoutButtonLabel:"\u2022",optinStatusOptedInLabel:"You're opted in!",optinStatusOptedOutLabel:"You're not opted in.",optinToggleLabel:"\u2022",upsellButtonLabel:"Add item to order on ",upsellButtonPrefix:"",upsellModalContent:"Some upsell modal content",upsellModalOptInLabel:"Subscribe",upsellModalOptOutLabel:"Purchase one time",upsellModalTitle:"Impulse Upsell",upsellModalConfirmLabel:"Ok",upsellModalCancelLabel:"Cancel",defaultFrequencyCopy:"(Most Popular)",frequencyPeriods:{"1":"day","2":"week","3":"month"}},e)=>{switch(e.type){case Lt:return{...t,...e.payload};default:return t}},"locale"),Pl=n((t={offerType:"radio"},e)=>{switch(e.type){case Mt:return{...t,...e.payload,defaultFrequency:e.payload.defaultFrequency?lt(e.payload.defaultFrequency):t.defaultFrequency,frequenciesEveryPeriod:[],frequencies:e.payload.frequencies?e.payload.frequencies.map(lt):t.frequencies};default:return t}},"config"),en=n((t=!1,e)=>{switch(e.type){case rt:return e.payload;default:return t}},"previewStandardOffer"),tn=n((t=!1,e)=>{switch(e.type){case ot:return e.payload;default:return t}},"previewUpsellOffer"),rn=n((t=[],e)=>{switch(e.type){case P:return{...t,...e.payload.autoship_by_default};default:return t}},"autoshipByDefault"),on=n((t=[],e)=>{switch(e.type){case P:return{...t,...e.payload.default_frequencies};default:return t}},"defaultFrequencies"),nn=n((t=[],e)=>{switch(e.type){case $t:return[...e.payload||[]];case jt:return[e.payload,...t];default:return t}},"templates"),Rl=n((t={},e)=>{switch(e.type){case K:return{...e.payload};default:return t}},"productPlans"),wr=Pt({optedin:$o,optedout:Vo,nextUpcomingOrder:Ho,autoshipEligible:Tl,inStock:vl,eligibilityGroups:Go,incentives:Bo,frequency:Ol,auth:zo,merchantId:Wo,authUrl:Yo,offer:wl,offerId:Jo,sessionId:Qo,productOffer:Cl,firstOrderPlaceDate:Ko,productToSubscribe:Zo,environment:wt,locale:Xo,config:Pl,previewStandardOffer:en,previewUpsellOffer:tn,autoshipByDefault:rn,defaultFrequencies:on,templates:nn,productPlans:Rl});M();v();var sn=class extends A(H){static get properties(){return{...super.properties,regular:{type:Boolean,reflect:!0},subscription:{type:Boolean,reflect:!0},discount:{type:Boolean,reflect:!0},frequency:{type:Object},productPlans:{type:Object}}}get value(){var l,u;let e=(l=this.product.id)==null?void 0:l.split(":")[0],r=this.frequency||this.configDefaultFrequency||((u=this.offer)==null?void 0:u.defaultFrequency),s=(this.productPlans[e]||{})[r]||[];if(!s)return"";let[i,a,c]=s;return c===i?"":this.regular?i:this.discount?a:c}render(){let e=this.value;return e?d`
|
|
877
|
+
`}};n(vr,"Tooltip");var{TestWizard:gl}=(Ai(),Ri);function Lo(){let t="og-test-wizard";customElements.get(t)||customElements.define(t,gl);let e=document.createElement(t);document.body.appendChild(e)}n(Lo,"default");var Mo=[79,71,68,69,86],Ni=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===Mo[t]){let o=Mo[t];setTimeout(function(){t<=o&&(t=0)},5e3),t+=1,t>=Mo.length&&Lo()}else t=0},!1)},"enable");ie();M();ie();U();var jo=n((t=[],e)=>{switch(e.type){case oe:return[];case me:return e.newValue?e.newValue.optedin:t;case q:case F: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 k:return t.filter(s=>!N(e.payload.product,s));case tt:return t.map(s=>N(e.payload.product,s)?{...s,...e.payload.newProduct}:s);case Ut:return t.filter(s=>!N(e.payload.product,s));case De:return[];default:return t}},"optedin"),$o=n((t=[],e)=>{switch(e.type){case oe:return[];case me:return e.newValue?e.newValue.optedout:t;case q:case F:return t.filter(s=>!N(e.payload.product,s));case k: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 tt:return t.map(s=>N(e.payload.product,s)?{...s,...e.payload.newProduct}:s);case De:return[];default:return t}},"optedout"),Vo=n((t={},{type:e,payload:r})=>{switch(e){case qt: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 kt:return{...t,products:(r.results||[]).map(o=>o.product)};case Ft:return{...t,...r,public_id:r.order,...r.product&&{products:(t.products||[]).concat(r.product)}};default:return t}},"nextUpcomingOrder"),yl=n((t={},e)=>{switch(e.type){case P:return{...t,...e.payload.autoship};default:return t}},"autoshipEligible"),bl=n((t={},e)=>{switch(e.type){case z:return{...t};case P:return{...t,...e.payload.in_stock};default:return t}},"inStock"),Ho=n((t={},e)=>{switch(e.type){case P:return{...t,...e.payload.eligibility_groups};default:return t}},"eligibilityGroups"),Ii=n((t,e)=>t.map(r=>({...e[r],id:[r][0]})),"mapIncentive"),Bo=n((t={},e)=>{switch(e.type){case P:return{...t,...[...new Set(Object.keys(e.payload.incentives||{}))].reduce((r,o)=>({...r,[o]:Object.entries(e.payload.incentives).filter(([s])=>s===o).reduce((s,[,{initial:i,ongoing:a}])=>({...s,initial:[...s.initial||[],...Ii(i,e.payload.incentives_display)],ongoing:[...s.ongoing||[],...Ii(a,e.payload.incentives_display)]}),{})}),{})};default:return t}},"incentives"),_l=n((t={},e)=>{switch(e.type){case q:case F:return{...t,[R(e.payload.product)]:e.payload.frequency};case k:return{...t,[R(e.payload.product)]:void 0};default:return t}},"frequency"),Go=n((t=!1,e)=>{switch(e.type){case It:return{...e.payload};case qe:return!1;default:return t}},"auth"),zo=n((t="",e)=>{switch(e.type){case Ne:return e.payload;default:return t}},"merchantId"),Wo=n((t=null,e)=>{switch(e.type){case Nt:return e.payload;default:return t}},"authUrl"),El=n((t={},e)=>{switch(e.type){case P:return{...t,offerId:(e.payload.module_view||{}).regular,...e.payload.modifiers};default:return t}},"offer"),Yo=n((t="",e)=>{switch(e.type){case P:return(e.payload.module_view||{}).regular||"";default:return t}},"offerId"),Jo=n((t=null,e)=>{switch(e.type){case oe:return null;case Ie:return e.payload;default:return t}},"sessionId"),xl=n((t={},e)=>{switch(e.type){case P:return{...t,...Object.entries(e.payload.autoship).map(([r])=>({[r]:Object.keys(e.payload.modifiers)})).reduce((r,o)=>({...r,...o}))};case De:return{};default:return t}},"productOffer"),Qo=n((t={},e)=>{switch(e.type){case $t:return{...t,[R(e.payload.product)]:e.payload.firstOrderPlaceDate};default:return t}},"firstOrderPlaceDate"),Ko=n((t={},e)=>{switch(e.type){case Vt:return{...t,[R(e.payload.product)]:e.payload.productToSubscribe};default:return t}},"productToSubscribe"),Ot=n((t={},e)=>{switch(e.type){case ke:return{...t,name:ye,apiUrl:"https://staging.offers.ordergroove.com",legoUrl:"https://staging.restapi.ordergroove.com"};case Fe:return{...t,name:Ht,apiUrl:"https://dev.offers.ordergroove.com",legoUrl:"https://dev.restapi.ordergroove.com"};case Ue:return{...t,name:be,apiUrl:"https://offers.ordergroove.com",legoUrl:"https://restapi.ordergroove.com"};default:return t}},"environment"),Zo=n((t={offerOptInLabel:"Subscribe to save",offerIncentiveText:"Save {{ogIncentive DiscountPercent}} when you subscribe",offerOptOutLabel:"Deliver one-time only",offerEveryLabel:"Delivery Every",offerTooltipTrigger:"[?]",offerTooltipContent:"Seems this is a great subscription offering. Many fun details about this program exist.",optinButtonLabel:"\u2022",optoutButtonLabel:"\u2022",optinStatusOptedInLabel:"You're opted in!",optinStatusOptedOutLabel:"You're not opted in.",optinToggleLabel:"\u2022",upsellButtonLabel:"Add item to order on ",upsellButtonPrefix:"",upsellModalContent:"Some upsell modal content",upsellModalOptInLabel:"Subscribe",upsellModalOptOutLabel:"Purchase one time",upsellModalTitle:"Impulse Upsell",upsellModalConfirmLabel:"Ok",upsellModalCancelLabel:"Cancel",defaultFrequencyCopy:"(Most Popular)",frequencyPeriods:{"1":"day","2":"week","3":"month"}},e)=>{switch(e.type){case Dt:return{...t,...e.payload};default:return t}},"locale"),Sl=n((t={offerType:"radio"},e)=>{switch(e.type){case Lt:return{...t,...e.payload,defaultFrequency:e.payload.defaultFrequency?lt(e.payload.defaultFrequency):t.defaultFrequency,frequenciesEveryPeriod:[],frequencies:e.payload.frequencies?e.payload.frequencies.map(lt):t.frequencies};default:return t}},"config"),Xo=n((t=!1,e)=>{switch(e.type){case rt:return e.payload;default:return t}},"previewStandardOffer"),en=n((t=!1,e)=>{switch(e.type){case ot:return e.payload;default:return t}},"previewUpsellOffer"),tn=n((t=[],e)=>{switch(e.type){case P:return{...t,...e.payload.autoship_by_default};default:return t}},"autoshipByDefault"),rn=n((t=[],e)=>{switch(e.type){case P:return{...t,...e.payload.default_frequencies};default:return t}},"defaultFrequencies"),on=n((t=[],e)=>{switch(e.type){case jt:return[...e.payload||[]];case Mt:return[e.payload,...t];default:return t}},"templates"),Tl=n((t={},e)=>{switch(e.type){case K:return{...e.payload};default:return t}},"productPlans"),wr=Ct({optedin:jo,optedout:$o,nextUpcomingOrder:Vo,autoshipEligible:yl,inStock:bl,eligibilityGroups:Ho,incentives:Bo,frequency:_l,auth:Go,merchantId:zo,authUrl:Wo,offer:El,offerId:Yo,sessionId:Jo,productOffer:xl,firstOrderPlaceDate:Qo,productToSubscribe:Ko,environment:Ot,locale:Zo,config:Sl,previewStandardOffer:Xo,previewUpsellOffer:en,autoshipByDefault:tn,defaultFrequencies:rn,templates:on,productPlans:Tl});M();O();var nn=class extends I(V){static get properties(){return{...super.properties,regular:{type:Boolean,reflect:!0},subscription:{type:Boolean,reflect:!0},discount:{type:Boolean,reflect:!0},frequency:{type:Object},productPlans:{type:Object}}}get value(){var l,u;let e=(l=this.product.id)==null?void 0:l.split(":")[0],r=this.frequency||this.configDefaultFrequency||((u=this.offer)==null?void 0:u.defaultFrequency),s=(this.productPlans[e]||{})[r]||[];if(!s)return"";let[i,a,c]=s;return c===i?"":this.regular?i:this.discount?a:c}render(){let e=this.value;return e?d`
|
|
880
878
|
<slot name="prepend"></slot>
|
|
881
879
|
${e}
|
|
882
880
|
<slot name="append"></slot>
|
|
883
881
|
`:d`
|
|
884
882
|
<slot name="fallback"></slot>
|
|
885
|
-
`}};n(sn,"Price");var Al=n((t,e)=>{var r;return{productPlans:t.productPlans,configDefaultFrequency:(r=t.config)==null?void 0:r.defaultFrequency,frequency:J(e.product)(t)}},"mapStateToProps"),Di=g(Al)(sn);I();function an(t){Fi(),Cs(t);try{customElements.define("og-when",ui),customElements.define("og-text",Ei),customElements.define("og-incentive-text",vi),customElements.define("og-offer",Ni),customElements.define("og-select-frequency",Oi),customElements.define("og-optout-button",hi),customElements.define("og-optin-toggle",_i),customElements.define("og-optin-status",di),customElements.define("og-optin-button",fi),customElements.define("og-optin-select",gi),customElements.define("og-upsell-button",yi),customElements.define("og-frequency-status",mi),customElements.define("og-modal",Sr),customElements.define("og-select",Tr),customElements.define("og-tooltip",vr),customElements.define("og-upsell-modal",bi),customElements.define("og-next-upcoming-order",Ci),customElements.define("og-price",Di),customElements.define("og-default-frequency-text",qi)}catch{console.info("OG WebComponents already registered, skipping.")}let e=!1,r={store:t,isReady:()=>e,setEnvironment(o){return t.dispatch(Vr(o)),this},setMerchantId(o){return t.dispatch(Zn(o)),this},setAuthUrl(o){return t.dispatch(Xn(o)),this},getProductsForPurchasePost(o=[]){return Jr(t.getState(),o)},getOptins(o=[]){return Jr(t.getState(),o)},clear(){t.dispatch(os())},addOptinChangedCallback(o){typeof o=="function"&&document.addEventListener("optin-changed",s=>o(s.detail))},disableOptinChangedCallbacks(){document.addEventListener("optin-changed",o=>o.stopPropagation(),!0)},register(){},previewMode(o){return window.og=window.og||{},o===!1?delete window.og:window.og.previewMode=!0,this},config(o){return t.dispatch(is(o)),this},setLocale(o){return t.dispatch(ss(o)),this},addTemplate(o,s,i){return t.dispatch(as(o,s,i)),this},setTemplates(o){return t.dispatch(cs(o)),this},setPublicPath(o){return this},resolveSettings(o,s,i,a=t){if(o&&s&&i){let c=[];i.product?c.push(i.product):i.cart&&Array.isArray(i.cart.products)&&(c=c.concat(i.cart.products));let{apiUrl:l}=wt({},Vr(s)),{sessionId:u}=a.getState();u&&c.forEach(h=>{let p=R(h);se.fetchOffer(l,o,u,`${p}`,ye)}),i.product_discounts&&typeof i.product_discounts=="object"&&a.dispatch({type:K,payload:i.product_discounts})}},initialize(o,s,i){var c;e?console.warn("og.offers has been initialized already. Skipping."):r.resolveSettings(o,s,window.og_settings,t);let a=t.getState();return o&&o!==a.merchantId&&r.setMerchantId(o),s&&s!==((c=a.environment)==null?void 0:c.name)&&r.setEnvironment(s),i&&r.setAuthUrl(i),e=!0,this}};return window.OG=window.OG||{},Object.assign(window.OG,r),Object.assign(r.initialize,r),Yr(window.opener,r),r}n(an,"makeApi");M();I();var Ze=n(t=>t===null?"":`$${t.toString().replace(/(\d\d)$/,".$1")}`,"money"),Nl=n(t=>`${t}%`,"percentage"),ql=n(t=>{var r,o;let e="";return((r=t.price_adjustments[0])==null?void 0:r.value_type)==="percentage"?e=Nl(t.price_adjustments[0].value):((o=t.price_adjustments[0])==null?void 0:o.value)?e=Ze(t.price_adjustments[0].value):t.compare_at_price&&(e=Ze(t.compare_at_price-t.price)),e?[Ze(t.compare_at_price),e,Ze(t.price)]:[Ze(t.price),"",Ze(t.price)]},"mapSellingPlanToDiscount"),Li=n((t,e,r)=>{let o=Object.keys(t).filter(s=>s.startsWith(e.toString()));return o.length?{...t,...o.reduce((s,i)=>({...s,[i]:r}),{})}:t},"overrideLineKey"),Mi=n((t,e,r)=>{if(!r)return null;if(!Se(r))return r;if(dt(t,e)){let o=$(t,e,r);return o||Te(t)}return r},"getDefaultSellingPlan"),Il=n((t,e)=>t.map(r=>{var o,s,i,a,c,l,u;return Se(r==null?void 0:r.frequency)?{...r,frequency:dt((o=e==null?void 0:e.config)==null?void 0:o.frequencies,(s=e==null?void 0:e.config)==null?void 0:s.frequenciesEveryPeriod)?$((i=e==null?void 0:e.config)==null?void 0:i.frequencies,(a=e==null?void 0:e.config)==null?void 0:a.frequenciesEveryPeriod,r.frequency)||$((c=e==null?void 0:e.config)==null?void 0:c.frequencies,(l=e==null?void 0:e.config)==null?void 0:l.frequenciesEveryPeriod,e.defaultFrequency)||Te((u=e==null?void 0:e.config)==null?void 0:u.frequencies):r.frequency}:r}),"mapExistingOptinsFromOfferResponse"),kl=n(({autoship:t={},autoship_by_default:e={},default_frequencies:r={},in_stock:o={}},s,i)=>Object.keys(t).reduce((a,c)=>{if(!s.some(l=>l.id===c)){if(!(t[c]&&e[c]&&o[c]))return a;let{config:{frequencies:l,frequenciesEveryPeriod:u}={},defaultFrequency:h}=i,p=r[c],m;return r[c]&&dt(l,u)?m=$(l,u,`${p.every}_${p.every_period}`)||Mi(l,u,h)||Te(l):r[c]?m=`${p.every}_${p.every_period}`:m=Mi(l,u,h)||"_",a.concat({id:c,frequency:m})}return a},[]),"reduceNewOptinsFromOfferResponse"),ji=n(t=>t==null?void 0:t.selling_plan_groups.find(r=>r.name==="Subscribe and Save"),"getOGSellingPlanGroup"),Fl=n((t,e)=>({...Li(t,e.id,e.available),[e.id]:e.available}),"productOrVariantInStockReducer"),$i=n((t,[e])=>({...t,[e]:!0}),"productTrue"),Vi=n((t,e)=>{var r;return{...t,[e.selling_plan_id||((r=e.selling_plan)==null?void 0:r.id)]:ql(e)}},"sellingPlanAllocationsReducer"),Hi=n((t,e)=>{let r=R(e.key);return{...t,[e.key]:t[r]||null}},"reduceProductCartLine"),Ul=n((t={},e)=>{if(K===e.type)return Object.entries(e.payload).reduce($i,t);if(ne===e.type){let{payload:r}=e;return r.items.reduce(Hi,t)}if(Y===e.type){let{payload:{product:r}}=e;return[r,...(r==null?void 0:r.variants)||[]].reduce((o,s)=>{var i,a;return{...Li(o,s.id,((i=s.selling_plan_allocations)==null?void 0:i.length)>0),[s.id]:((a=s.selling_plan_allocations)==null?void 0:a.length)>0}},t)}return t},"autoshipEligible");function Dl(t){let e=["day","week","month"].findIndex(o=>t.toLowerCase().includes(o))+1,r=(t.match(/(\d+)/)||["",1])[1];return r&&e?`${r}_${e}`:null}n(Dl,"textToFreq");function Gi(t){var e;return(e=t==null?void 0:t.selling_plans)==null?void 0:e.map(({options:r})=>r||[]).flat().map(({value:r})=>Dl(r))}n(Gi,"sellingPlansToEveryPeriod");function Ll(t){var e;return(e=t==null?void 0:t.selling_plans)==null?void 0:e.map(({id:r})=>`${r}`)}n(Ll,"sellingPlansToFrequencies");var Ml=n((t={frequencies:[],offerType:"radio",frequenciesEveryPeriod:[]},e)=>{var r,o,s;if(K===e.type){let i=[...new Set(Object.values(e.payload).map(Object.keys).flat())];return{...t,frequencies:i}}if(Y===e.type){let{payload:{offer:i,product:a}}=e,c=ji(a),l=(r=c==null?void 0:c.selling_plans)==null?void 0:r.map(({id:u})=>`${u}`);if(l==null?void 0:l.length){let u=Gi(c),h=((s=(o=c.options)==null?void 0:o[0])==null?void 0:s.values)||l,p=t.defaultFrequency;return p&&Se(p)&&(p=$(l,u,p)||Te(l)||p),{...t,frequenciesEveryPeriod:u,frequencies:l,frequenciesText:h,...p?{defaultFrequency:p}:{}}}}if(P===e.type){let{payload:{offer:i}}=e,{defaultFrequency:a,config:{frequencies:c,frequenciesEveryPeriod:l}={}}=i;return Se(a)?{...t,defaultFrequency:$(c,l,a)||Te(c)||a}:{...t,defaultFrequency:a}}return t},"config"),jl=n((t={},e)=>{if(K===e.type)return Object.entries(e.payload).reduce($i,t);if(ne===e.type)return e.payload.items.reduce(Hi,t);if(Y===e.type){let{payload:{product:r}}=e;return[r,...r==null?void 0:r.variants].reduce(Fl,t)||t}return W===e.type&&e.payload.product===null?{...t}:t},"inStock"),$l=n((t={},e)=>t,"offer"),Vl=n((t=[],e)=>{if(ne===e.type){let r=e.payload;return t.filter(o=>!o.id.includes(":")).concat(r.items.reduce((o,s)=>s.selling_plan_allocation?[...o,{id:s.key,frequency:`${s.selling_plan_allocation.selling_plan.id}`}]:o,[]))}if(P===e.type){let{offer:r={},...o}=e.payload,s=Il(t,r),i=kl(o,s,r);return[...s,...i]}if(Y===e.type){let{product:r}=e.payload,o=ji(r),s=Ll(o),i=Gi(o);return t.map(a=>Se(a.frequency)?{...a,frequency:$(s,i,a.frequency)||Te(s)}:a)}return $o(t,e)},"optedin"),Hl=n((t={},e)=>t,"productOffer"),Gl=n((t={},e)=>{if(Y===e.type){let{payload:{product:r}}=e;return[r,...r==null?void 0:r.variants].reduce((o,s)=>{var i;return{...o,[s.id]:(i=s.selling_plan_allocations)==null?void 0:i.reduce(Vi,{})}},t)||t}return ne===e.type?e.payload.items.reduce((o,s)=>s.selling_plan_allocation?{...o,[s.key]:Vi({},s.selling_plan_allocation)}:o,t)||t:K===e.type?{...e.payload}:t},"productPlans"),Bl=Pt({auth:zo,authUrl:Yo,autoshipByDefault:rn,autoshipEligible:Ul,config:Ml,defaultFrequencies:on,eligibilityGroups:Go,environment:wt,firstOrderPlaceDate:Ko,incentives:Bo,inStock:jl,locale:Xo,merchantId:Wo,nextUpcomingOrder:Ho,offer:$l,offerId:Jo,optedin:Vl,optedout:Vo,previewStandardOffer:en,previewUpsellOffer:tn,productOffer:Hl,productPlans:Gl,productToSubscribe:Zo,sessionId:Qo,templates:nn});function cn(t,e){return window.og&&window.og.previewMode?wr(t,e):Bl(t,e)}n(cn,"shopifyReducer");var Bi=re(st()),zi=re(At());M();I();var Ki,Zi,Wi=((Zi=(Ki=window.Shopify)==null?void 0:Ki.routes)==null?void 0:Zi.root)||"/",zl="/cart",Wl=`${Wi}cart.js`,Yl=`${Wi}products/`,Jl='[id^="shopify-section-"][id$=__cart-items], [id^="shopify-section-"][id$="__cart-footer"],#cart-live-region-text,#cart-icon-bubble',Yi=(0,zi.debounce)(100,!1,function(t,e){let{id:r}=Object.fromEntries([...new FormData(t).entries()]);r?e.setAttribute("product",r):e.removeAttribute("product")});async function Ql(t,e){let r=Kl();if(r)try{let s=await Qi(r);t.dispatch({type:Y,payload:{product:s,offer:e}})}catch(s){console.warn("OG: Unable to fetch product details for PDP",s)}let o=e.closest("form");if(!o){let s=e.parentElement;for(;s&&(o=s.querySelector('form[action$="/cart/add"]'),!(o||s.tagName.toLowerCase()==="body"));)s=s.parentElement}o?(o.addEventListener("change",i=>Yi(o,e)),new MutationObserver(()=>Yi(o,e)).observe(o,{subtree:!0,childList:!0})):console.info("no /cart/add form found for og-offer",e)}n(Ql,"setupPdp");var Ji=n(async()=>await(await fetch(Wl)).json(),"getCart");function Kl(){return[()=>{var t,e;return(((e=(t=document.querySelector('[href$=".oembed"]'))==null?void 0:t.getAttribute("href"))==null?void 0:e.match(/\/([^\/]+)\.oembed$/))||[])[1]},()=>{var t,e;return(document.querySelector('meta[property="og:type"][content="product"]')&&((e=(t=document.querySelector('meta[property="og:url"][content]'))==null?void 0:t.getAttribute("content"))==null?void 0:e.match(/\/([^\/]+)$/))||[])[1]},()=>{var t;return(t=[...document.querySelectorAll("[type$=json]")].map(e=>JSON.parse(e.textContent||"{}")).find(e=>e.handle&&e.price))==null?void 0:t.handle}].reduce((t,e)=>t||e(),"")}n(Kl,"guessProductHandle");var Qi=(0,Bi.default)(async t=>(await fetch(`${Yl}${t}.js`)).json());async function Zl(t,e){let r=await Ji(),{items:o}=r;t.dispatch({type:ne,payload:r});let s=Number(e.product.id);s<=o.length&&e.setAttribute("product",o[s-1].key),(await Promise.all(Array.from(new Set(o.map(({handle:a})=>a))).map(Qi))).forEach(a=>t.dispatch({type:Y,payload:{product:a,offer:e}}))}n(Zl,"setupCart");async function Xl(t,e){var i,a;let r=t.payload.offer,o=t.payload.frequency||null,s=eu(t);if(!(r==null?void 0:r.isCart)){r&&tu(r.product.id,s[0],s[1]);return}try{r.style.pointerEvents="none",r.style.opacity=".7";let c=Array.from(document.querySelectorAll(Jl)),l=t.payload.product.id,u=await Ji(),h=(i=u==null?void 0:u.items)==null?void 0:i.findIndex(y=>y.key===l),p=u.items[h],m=p.quantity,C=R(l),_=await fetch("/cart/change.js",{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:l,quantity:m,attributes:Object.fromEntries([s]),properties:p.properties,selling_plan:o||null,sections:c.map(y=>y.id.replace(/^shopify-section-/,""))})});if(_.status!==200)throw new Error("Cart not updated");let f=await _.json(),E=u.items.length===f.items.length?f.items[h].key:(a=f.items.find(y=>y.quantity===m&&y.product_id===C&&(!o&&!y.selling_plan_allocation||(y==null?void 0:y.selling_plan_allocation.selling_plan.id)===o)))==null?void 0:a.key;E&&r.setAttribute("product",E),e.dispatch({type:ne,payload:f});let w=new CustomEvent(Nn,{bubbles:!0,cancelable:!0});if(r.dispatchEvent(w),w.defaultPrevented)return;let b=f.sections;Object.values(b).length?c.forEach(y=>{let Ct=y.id.replace(/^shopify-section-/,"");if(!(Ct in b))return;let na=b[Ct],un=new DOMParser().parseFromString(na.toString()||"","text/html").getElementById(y.id);un&&(y.innerHTML=un.innerHTML)}):window.location.pathname.startsWith(zl)&&window.location.reload()}catch(c){console.log("OG Error updating cart",c)}finally{r.style.pointerEvents="auto",r.style.opacity="1"}}n(Xl,"synchronizeCartOptin");function eu(t){var a,c;let e=t.payload.product.id;if(!e)return[];let r=`og__${Math.ceil(new Date().getTime()/1e3)}`,o=((a=t.payload.offer)==null?void 0:a.location)||"",s=((c=t.payload.offer)==null?void 0:c.variationId)||"",i=[e,t.type.toLowerCase(),o];switch(t.type){case W:case F:i.push(""),i.push(s);break;case k:case U:i.push(t.payload.frequency),i.push(s);break;default:return[]}return[r,i.join(",")]}n(eu,"getTrackingEvent");function tu(t,e,r){let o=`[name="id"][value="${t}"]`,s=`form[action="/cart/add"] option[value="${t}"]`;if(!e)return;let i=document.querySelectorAll(o);i.length||(i=document.querySelectorAll(s)),[...i].forEach(a=>{let c=a.form,l=c==null?void 0:c.querySelector(`[name="${e}"]`);l||(l=document.createElement("input"),l.type="hidden",l.name=`attributes[${e}]`,c==null||c.appendChild(l)),l.value=r})}n(tu,"updateTrackingInputs");function ru(t,e,r){let o=t.querySelector(`[name="${e}"]`);if(o&&!r){o.remove();return}!o&&r&&(o=document.createElement("input"),o.type="hidden",o.name=e,t.appendChild(o)),o&&(o.value=r)}n(ru,"getOrCreateHidden");function ou(t,e){[...document.querySelectorAll('form[action$="/cart/add"] [name=id]')].forEach(r=>{var a;let o=r.value,i=(a=rr({id:o})(t.getState()))==null?void 0:a.frequency;ru(r.form,"selling_plan",i)})}n(ou,"synchronizeSellingPlan");function ln(t){return e=>r=>{var o;switch(r.type){case k:case F:case U:break;case W:((o=r.payload.offer)==null?void 0:o.isCart)?Zl(t,r.payload.offer):Ql(t,r.payload.offer);break;default:}switch(e(r),r.type){case k:case F:case U:Xl(r,t);case W:case P:case Y:ou(t,r.payload.offer);break;default:}}}n(ln,"shopifyMiddleware");ut();I();N();I();var nu="/apps/subscriptions/auth/",Xi="og_auth_begin",su="og_auth_end",iu=n(t=>{let[e,r,o,s]=atob(t).split("|");return{id:e,signature:o,timestamp:r,email:s}},"parseIntegrationTempAuth");async function ea({store:t}){var s;let[e]=Lr(),r=pt(),o=(r==null?void 0:r.dataset.customer)?iu(r.dataset.customer):(s=window.ogShopifyConfig)==null?void 0:s.customer;if(o){let i=await cu(o);if(i){let[a,c,l]=i.split("|");t.dispatch(ft(e,a,Number(c),l))}}else zn("og_auth")}n(ea,"authorizeShopifyCustomer");async function au(t){try{let r=await(await fetch(`${nu}?customer=${t.id}&customer_signature=${t.signature}&customer_timestamp=${t.timestamp}`)).text(),o=r.lastIndexOf(Xi);if(o<0)throw"Invalid response from OG auth endpoint";return JSON.parse(r.substring(o+Xi.length,r.lastIndexOf(su)))}catch(e){console.error(e)}}n(au,"fetchOGSignature");async function cu(t){let e=Wn("og_auth");if(e)return e;let{customerId:r,timestamp:o,signature:s}=await au(t);if(!r)return"";let i=new Date,a=btoa(s);i.setTime(i.getTime()+2*60*60*1e3);let c=`${r}|${o}|${a};expires=${i.toUTCString()}`;return document.cookie=`og_auth=${c};secure;path=/`,c}n(cu,"getOrCreateAuthCookie");var ra,ta=Ts(...((ra=j)==null?void 0:ra.shopify_selling_plans)?[cn,ln]:[wr]),S=an(ta),lu=S.isReady,uu=S.addOptinChangedCallback,pu=S.addTemplate,du=S.clear,fu=S.config,hu=S.disableOptinChangedCallbacks,mu=S.getOptins,gu=S.getProductsForPurchasePost,yu=S.initialize,bu=S.previewMode,_u=S.register,Eu=S.resolveSettings,xu=S.setAuthUrl,Su=S.setEnvironment,Tu=S.setLocale,vu=S.setMerchantId,Ou=S.setPublicPath,wu=S.setTemplates,Cu=S.setupCart,Pu=S.setupProduct,Ru=S.setupProducts,Au=n(()=>Bn(S),"autoInit");var Nu=S.initialize,oa;((oa=j)==null?void 0:oa.shopify_selling_plans)&&Kt(()=>ea(S));return qu;})();
|
|
883
|
+
`}};n(nn,"Price");var vl=n((t,e)=>{var r;return{productPlans:t.productPlans,configDefaultFrequency:(r=t.config)==null?void 0:r.defaultFrequency,frequency:J(e.product)(t)}},"mapStateToProps"),qi=y(vl)(nn);U();function sn(t){Ni(),vs(t);try{customElements.define("og-when",ai),customElements.define("og-text",yi),customElements.define("og-incentive-text",xi),customElements.define("og-offer",Pi),customElements.define("og-select-frequency",Si),customElements.define("og-optout-button",pi),customElements.define("og-optin-toggle",gi),customElements.define("og-optin-status",li),customElements.define("og-optin-button",ui),customElements.define("og-optin-select",fi),customElements.define("og-upsell-button",hi),customElements.define("og-frequency-status",di),customElements.define("og-modal",Sr),customElements.define("og-select",Tr),customElements.define("og-tooltip",vr),customElements.define("og-upsell-modal",mi),customElements.define("og-next-upcoming-order",vi),customElements.define("og-price",qi)}catch{console.info("OG WebComponents already registered, skipping.")}let e=!1,r={store:t,isReady:()=>e,setEnvironment(o){return t.dispatch(Vr(o)),this},setMerchantId(o){return t.dispatch(Jn(o)),this},setAuthUrl(o){return t.dispatch(Qn(o)),this},getProductsForPurchasePost(o=[]){return Jr(t.getState(),o)},getOptins(o=[]){return Jr(t.getState(),o)},clear(){t.dispatch(es())},addOptinChangedCallback(o){typeof o=="function"&&document.addEventListener("optin-changed",s=>o(s.detail))},disableOptinChangedCallbacks(){document.addEventListener("optin-changed",o=>o.stopPropagation(),!0)},register(){},previewMode(o){return window.og=window.og||{},o===!1?delete window.og:window.og.previewMode=!0,this},config(o){return t.dispatch(os(o)),this},setLocale(o){return t.dispatch(rs(o)),this},addTemplate(o,s,i){return t.dispatch(ns(o,s,i)),this},setTemplates(o){return t.dispatch(ss(o)),this},setPublicPath(o){return this},resolveSettings(o,s,i,a=t){if(o&&s&&i){let c=[];i.product?c.push(i.product):i.cart&&Array.isArray(i.cart.products)&&(c=c.concat(i.cart.products));let{apiUrl:l}=Ot({},Vr(s)),{sessionId:u}=a.getState();u&&c.forEach(h=>{let p=R(h);se.fetchOffer(l,o,u,`${p}`,ge)}),i.product_discounts&&typeof i.product_discounts=="object"&&a.dispatch({type:K,payload:i.product_discounts})}},initialize(o,s,i){var c;e?console.warn("og.offers has been initialized already. Skipping."):r.resolveSettings(o,s,window.og_settings,t);let a=t.getState();return o&&o!==a.merchantId&&r.setMerchantId(o),s&&s!==((c=a.environment)==null?void 0:c.name)&&r.setEnvironment(s),i&&r.setAuthUrl(i),e=!0,this}};return window.OG=window.OG||{},Object.assign(window.OG,r),Object.assign(r.initialize,r),Yr(window.opener,r),r}n(sn,"makeApi");M();U();var Ze=n(t=>t===null?"":`$${t.toString().replace(/(\d\d)$/,".$1")}`,"money"),Ol=n(t=>`${t}%`,"percentage"),wl=n(t=>{var r,o;let e="";return((r=t.price_adjustments[0])==null?void 0:r.value_type)==="percentage"?e=Ol(t.price_adjustments[0].value):((o=t.price_adjustments[0])==null?void 0:o.value)?e=Ze(t.price_adjustments[0].value):t.compare_at_price&&(e=Ze(t.compare_at_price-t.price)),e?[Ze(t.compare_at_price),e,Ze(t.price)]:[Ze(t.price),"",Ze(t.price)]},"mapSellingPlanToDiscount"),ki=n((t,e,r)=>{let o=Object.keys(t).filter(s=>s.startsWith(e.toString()));return o.length?{...t,...o.reduce((s,i)=>({...s,[i]:r}),{})}:t},"overrideLineKey"),Fi=n((t,e,r)=>{if(!r)return null;if(!je(r))return r;if(Kt(t,e)){let o=Y(t,e,r);return o||xe(t)}return r},"getDefaultSellingPlan"),Cl=n((t,e)=>t.map(r=>{var o,s,i,a,c,l,u;return je(r==null?void 0:r.frequency)?{...r,frequency:Kt((o=e==null?void 0:e.config)==null?void 0:o.frequencies,(s=e==null?void 0:e.config)==null?void 0:s.frequenciesEveryPeriod)?Y((i=e==null?void 0:e.config)==null?void 0:i.frequencies,(a=e==null?void 0:e.config)==null?void 0:a.frequenciesEveryPeriod,r.frequency)||Y((c=e==null?void 0:e.config)==null?void 0:c.frequencies,(l=e==null?void 0:e.config)==null?void 0:l.frequenciesEveryPeriod,e.defaultFrequency)||xe((u=e==null?void 0:e.config)==null?void 0:u.frequencies):r.frequency}:r}),"mapExistingOptinsFromOfferResponse"),Pl=n(({autoship:t={},autoship_by_default:e={},default_frequencies:r={},in_stock:o={}},s,i)=>Object.keys(t).reduce((a,c)=>{if(!s.some(l=>l.id===c)){if(!(t[c]&&e[c]&&o[c]))return a;let{config:{frequencies:l,frequenciesEveryPeriod:u}={},defaultFrequency:h}=i,p=r[c],m;return r[c]&&Kt(l,u)?m=Y(l,u,`${p.every}_${p.every_period}`)||Fi(l,u,h)||xe(l):r[c]?m=`${p.every}_${p.every_period}`:m=Fi(l,u,h)||"_",a.concat({id:c,frequency:m})}return a},[]),"reduceNewOptinsFromOfferResponse"),Ui=n(t=>t==null?void 0:t.selling_plan_groups.find(r=>r.name==="Subscribe and Save"),"getOGSellingPlanGroup"),Rl=n((t,e)=>({...ki(t,e.id,e.available),[e.id]:e.available}),"productOrVariantInStockReducer"),Di=n((t,[e])=>({...t,[e]:!0}),"productTrue"),Li=n((t,e)=>{var r;return{...t,[e.selling_plan_id||((r=e.selling_plan)==null?void 0:r.id)]:wl(e)}},"sellingPlanAllocationsReducer"),Mi=n((t,e)=>{let r=R(e.key);return{...t,[e.key]:t[r]||null}},"reduceProductCartLine"),Al=n((t={},e)=>{if(K===e.type)return Object.entries(e.payload).reduce(Di,t);if(ne===e.type){let{payload:r}=e;return r.items.reduce(Mi,t)}if(W===e.type){let{payload:{product:r}}=e;return[r,...(r==null?void 0:r.variants)||[]].reduce((o,s)=>{var i,a;return{...ki(o,s.id,((i=s.selling_plan_allocations)==null?void 0:i.length)>0),[s.id]:((a=s.selling_plan_allocations)==null?void 0:a.length)>0}},t)}return t},"autoshipEligible");function Nl(t){let e=["day","week","month"].findIndex(o=>t.toLowerCase().includes(o))+1,r=(t.match(/(\d+)/)||["",1])[1];return r&&e?`${r}_${e}`:null}n(Nl,"textToFreq");function ji(t){var e;return(e=t==null?void 0:t.selling_plans)==null?void 0:e.map(({options:r})=>r||[]).flat().map(({value:r})=>Nl(r))}n(ji,"sellingPlansToEveryPeriod");function Il(t){var e;return(e=t==null?void 0:t.selling_plans)==null?void 0:e.map(({id:r})=>`${r}`)}n(Il,"sellingPlansToFrequencies");var ql=n((t={frequencies:[],offerType:"radio",frequenciesEveryPeriod:[]},e)=>{var r,o,s;if(K===e.type){let i=[...new Set(Object.values(e.payload).map(Object.keys).flat())];return{...t,frequencies:i}}if(W===e.type){let{payload:{offer:i,product:a}}=e,c=Ui(a),l=(r=c==null?void 0:c.selling_plans)==null?void 0:r.map(({id:u})=>`${u}`);if(l==null?void 0:l.length){let u=ji(c),h=((s=(o=c.options)==null?void 0:o[0])==null?void 0:s.values)||l,p=t.defaultFrequency;return p&&je(p)&&(p=Y(l,u,p)||xe(l)||p),{...t,frequenciesEveryPeriod:u,frequencies:l,frequenciesText:h,...p?{defaultFrequency:p}:{}}}}if(P===e.type){let{payload:{offer:i}}=e,{defaultFrequency:a,config:{frequencies:c,frequenciesEveryPeriod:l}={}}=i;return je(a)?{...t,defaultFrequency:Y(c,l,a)||xe(c)||a}:{...t,defaultFrequency:a}}return t},"config"),kl=n((t={},e)=>{if(K===e.type)return Object.entries(e.payload).reduce(Di,t);if(ne===e.type)return e.payload.items.reduce(Mi,t);if(W===e.type){let{payload:{product:r}}=e;return[r,...r==null?void 0:r.variants].reduce(Rl,t)||t}return z===e.type&&e.payload.product===null?{...t}:t},"inStock"),Fl=n((t={},e)=>t,"offer"),Ul=n((t=[],e)=>{if(ne===e.type){let r=e.payload;return t.filter(o=>!o.id.includes(":")).concat(r.items.reduce((o,s)=>s.selling_plan_allocation?[...o,{id:s.key,frequency:`${s.selling_plan_allocation.selling_plan.id}`}]:o,[]))}if(P===e.type){let{offer:r={},...o}=e.payload,s=Cl(t,r),i=Pl(o,s,r);return[...s,...i]}if(W===e.type){let{product:r}=e.payload,o=Ui(r),s=Il(o),i=ji(o);return t.map(a=>je(a.frequency)?{...a,frequency:Y(s,i,a.frequency)||xe(s)}:a)}return jo(t,e)},"optedin"),Dl=n((t={},e)=>t,"productOffer"),Ll=n((t={},e)=>{if(W===e.type){let{payload:{product:r}}=e;return[r,...r==null?void 0:r.variants].reduce((o,s)=>{var i;return{...o,[s.id]:(i=s.selling_plan_allocations)==null?void 0:i.reduce(Li,{})}},t)||t}return ne===e.type?e.payload.items.reduce((o,s)=>s.selling_plan_allocation?{...o,[s.key]:Li({},s.selling_plan_allocation)}:o,t)||t:K===e.type?{...e.payload}:t},"productPlans"),Ml=Ct({auth:Go,authUrl:Wo,autoshipByDefault:tn,autoshipEligible:Al,config:ql,defaultFrequencies:rn,eligibilityGroups:Ho,environment:Ot,firstOrderPlaceDate:Qo,incentives:Bo,inStock:kl,locale:Zo,merchantId:zo,nextUpcomingOrder:Vo,offer:Fl,offerId:Yo,optedin:Ul,optedout:$o,previewStandardOffer:Xo,previewUpsellOffer:en,productOffer:Dl,productPlans:Ll,productToSubscribe:Ko,sessionId:Jo,templates:on});function an(t,e){return window.og&&window.og.previewMode?wr(t,e):Ml(t,e)}n(an,"shopifyReducer");var $i=re(st()),Vi=re(Rt());M();U();var Wi,Yi,Hi=((Yi=(Wi=window.Shopify)==null?void 0:Wi.routes)==null?void 0:Yi.root)||"/",jl="/cart",$l=`${Hi}cart.js`,Vl=`${Hi}products/`,Hl='[id^="shopify-section-"][id$=__cart-items], [id^="shopify-section-"][id$="__cart-footer"],#cart-live-region-text,#cart-icon-bubble',Bi=(0,Vi.debounce)(100,!1,function(t,e){let{id:r}=Object.fromEntries([...new FormData(t).entries()]);r?e.setAttribute("product",r):e.removeAttribute("product")});async function Bl(t,e){let r=Gl();if(r)try{let s=await zi(r);t.dispatch({type:W,payload:{product:s,offer:e}})}catch(s){console.warn("OG: Unable to fetch product details for PDP",s)}let o=e.closest("form");if(!o){let s=e.parentElement;for(;s&&(o=s.querySelector('form[action$="/cart/add"]'),!(o||s.tagName.toLowerCase()==="body"));)s=s.parentElement}o?(o.addEventListener("change",i=>Bi(o,e)),new MutationObserver(()=>Bi(o,e)).observe(o,{subtree:!0,childList:!0})):console.info("no /cart/add form found for og-offer",e)}n(Bl,"setupPdp");var Gi=n(async()=>await(await fetch($l)).json(),"getCart");function Gl(){return[()=>{var t,e;return(((e=(t=document.querySelector('[href$=".oembed"]'))==null?void 0:t.getAttribute("href"))==null?void 0:e.match(/\/([^\/]+)\.oembed$/))||[])[1]},()=>{var t,e;return(document.querySelector('meta[property="og:type"][content="product"]')&&((e=(t=document.querySelector('meta[property="og:url"][content]'))==null?void 0:t.getAttribute("content"))==null?void 0:e.match(/\/([^\/]+)$/))||[])[1]},()=>{var t;return(t=[...document.querySelectorAll("[type$=json]")].map(e=>JSON.parse(e.textContent||"{}")).find(e=>e.handle&&e.price))==null?void 0:t.handle}].reduce((t,e)=>t||e(),"")}n(Gl,"guessProductHandle");var zi=(0,$i.default)(async t=>(await fetch(`${Vl}${t}.js`)).json());async function zl(t,e){let r=await Gi(),{items:o}=r;t.dispatch({type:ne,payload:r});let s=Number(e.product.id);s<=o.length&&e.setAttribute("product",o[s-1].key),(await Promise.all(Array.from(new Set(o.map(({handle:a})=>a))).map(zi))).forEach(a=>t.dispatch({type:W,payload:{product:a,offer:e}}))}n(zl,"setupCart");async function Wl(t,e){var i,a;let r=t.payload.offer,o=t.payload.frequency||null,s=Yl(t);if(!(r==null?void 0:r.isCart)){r&&Jl(r.product.id,s[0],s[1]);return}try{r.style.pointerEvents="none",r.style.opacity=".7";let c=Array.from(document.querySelectorAll(Hl)),l=t.payload.product.id,u=await Gi(),h=(i=u==null?void 0:u.items)==null?void 0:i.findIndex(g=>g.key===l),p=u.items[h],m=p.quantity,C=R(l),_=await fetch("/cart/change.js",{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:l,quantity:m,attributes:Object.fromEntries([s]),properties:p.properties,selling_plan:o||null,sections:c.map(g=>g.id.replace(/^shopify-section-/,""))})});if(_.status!==200)throw new Error("Cart not updated");let f=await _.json(),E=u.items.length===f.items.length?f.items[h].key:(a=f.items.find(g=>g.quantity===m&&g.product_id===C&&(!o&&!g.selling_plan_allocation||(g==null?void 0:g.selling_plan_allocation.selling_plan.id)===o)))==null?void 0:a.key;E&&r.setAttribute("product",E),e.dispatch({type:ne,payload:f});let w=new CustomEvent(An,{bubbles:!0,cancelable:!0});if(r.dispatchEvent(w),w.defaultPrevented)return;let b=f.sections;Object.values(b).length?c.forEach(g=>{let wt=g.id.replace(/^shopify-section-/,"");if(!(wt in b))return;let ea=b[wt],ln=new DOMParser().parseFromString(ea.toString()||"","text/html").getElementById(g.id);ln&&(g.innerHTML=ln.innerHTML)}):window.location.pathname.startsWith(jl)&&window.location.reload()}catch(c){console.log("OG Error updating cart",c)}finally{r.style.pointerEvents="auto",r.style.opacity="1"}}n(Wl,"synchronizeCartOptin");function Yl(t){var a,c;let e=t.payload.product.id;if(!e)return[];let r=`og__${Math.ceil(new Date().getTime()/1e3)}`,o=((a=t.payload.offer)==null?void 0:a.location)||"",s=((c=t.payload.offer)==null?void 0:c.variationId)||"",i=[e,t.type.toLowerCase(),o];switch(t.type){case z:case k:i.push(""),i.push(s);break;case q:case F:i.push(t.payload.frequency),i.push(s);break;default:return[]}return[r,i.join(",")]}n(Yl,"getTrackingEvent");function Jl(t,e,r){let o=`[name="id"][value="${t}"]`,s=`form[action="/cart/add"] option[value="${t}"]`;if(!e)return;let i=document.querySelectorAll(o);i.length||(i=document.querySelectorAll(s)),[...i].forEach(a=>{let c=a.form,l=c==null?void 0:c.querySelector(`[name="${e}"]`);l||(l=document.createElement("input"),l.type="hidden",l.name=`attributes[${e}]`,c==null||c.appendChild(l)),l.value=r})}n(Jl,"updateTrackingInputs");function Ql(t,e,r){let o=t.querySelector(`[name="${e}"]`);if(o&&!r){o.remove();return}!o&&r&&(o=document.createElement("input"),o.type="hidden",o.name=e,t.appendChild(o)),o&&(o.value=r)}n(Ql,"getOrCreateHidden");function Kl(t,e){[...document.querySelectorAll('form[action$="/cart/add"] [name=id]')].forEach(r=>{var a;let o=r.value,i=(a=rr({id:o})(t.getState()))==null?void 0:a.frequency;Ql(r.form,"selling_plan",i)})}n(Kl,"synchronizeSellingPlan");function cn(t){return e=>r=>{var o;switch(r.type){case q:case k:case F:break;case z:((o=r.payload.offer)==null?void 0:o.isCart)?zl(t,r.payload.offer):Bl(t,r.payload.offer);break;default:}switch(e(r),r.type){case q:case k:case F:Wl(r,t);case z:case P:case W:Kl(t,r.payload.offer);break;default:}}}n(cn,"shopifyMiddleware");ut();U();A();U();var Zl="/apps/subscriptions/auth/",Ji="og_auth_begin",Xl="og_auth_end",eu=n(t=>{let[e,r,o,s]=atob(t).split("|");return{id:e,signature:o,timestamp:r,email:s}},"parseIntegrationTempAuth");async function Qi({store:t}){var s;let[e]=Lr(),r=pt(),o=(r==null?void 0:r.dataset.customer)?eu(r.dataset.customer):(s=window.ogShopifyConfig)==null?void 0:s.customer;if(o){let i=await ru(o);if(i){let[a,c,l]=i.split("|");t.dispatch(dt(e,a,Number(c),l))}}else Gn("og_auth")}n(Qi,"authorizeShopifyCustomer");async function tu(t){try{let r=await(await fetch(`${Zl}?customer=${t.id}&customer_signature=${t.signature}&customer_timestamp=${t.timestamp}`)).text(),o=r.lastIndexOf(Ji);if(o<0)throw"Invalid response from OG auth endpoint";return JSON.parse(r.substring(o+Ji.length,r.lastIndexOf(Xl)))}catch(e){console.error(e)}}n(tu,"fetchOGSignature");async function ru(t){let e=zn("og_auth");if(e)return e;let{customerId:r,timestamp:o,signature:s}=await tu(t);if(!r)return"";let i=new Date,a=btoa(s);i.setTime(i.getTime()+2*60*60*1e3);let c=`${r}|${o}|${a};expires=${i.toUTCString()}`;return document.cookie=`og_auth=${c};secure;path=/`,c}n(ru,"getOrCreateAuthCookie");var Zi,Ki=Es(...((Zi=j)==null?void 0:Zi.shopify_selling_plans)?[an,cn]:[wr]),x=sn(Ki),ou=x.isReady,nu=x.addOptinChangedCallback,su=x.addTemplate,iu=x.clear,au=x.config,cu=x.disableOptinChangedCallbacks,lu=x.getOptins,uu=x.getProductsForPurchasePost,pu=x.initialize,du=x.previewMode,fu=x.register,hu=x.resolveSettings,mu=x.setAuthUrl,gu=x.setEnvironment,yu=x.setLocale,bu=x.setMerchantId,_u=x.setPublicPath,Eu=x.setTemplates,xu=x.setupCart,Su=x.setupProduct,Tu=x.setupProducts,vu=n(()=>Bn(x),"autoInit");var Ou=x.initialize,Xi;((Xi=j)==null?void 0:Xi.shopify_selling_plans)&&Qt(()=>Qi(x));return wu;})();
|
|
886
884
|
; return lib; });
|
|
887
885
|
//# sourceMappingURL=offers.js.map
|