@ordergroove/offers 2.28.9 → 2.28.11-alpha-PR-703-17.87

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/offers.js CHANGED
@@ -8,8 +8,8 @@ else {
8
8
  window.og['offers'] = factory();
9
9
  }
10
10
  })(()=>{
11
- var lib=(()=>{var aa=Object.create;var Ze=Object.defineProperty;var ca=Object.getOwnPropertyDescriptor;var la=Object.getOwnPropertyNames;var ua=Object.getPrototypeOf,pa=Object.prototype.hasOwnProperty;var mn=t=>Ze(t,"__esModule",{value:!0}),n=(t,e)=>Ze(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),wr=(t,e)=>{mn(t);for(var r in e)Ze(t,r,{get:e[r],enumerable:!0})},da=(t,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of la(e))!pa.call(t,o)&&o!=="default"&&Ze(t,o,{get:()=>e[o],enumerable:!(r=ca(e,o))||r.enumerable});return t},re=t=>da(mn(Ze(t!=null?aa(ua(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var Pt=he((Ct,Tn)=>{(function(t,e){typeof Ct=="object"&&typeof Tn!="undefined"?e(Ct):typeof define=="function"&&define.amd?define(["exports"],e):(t=t||self,e(t.throttleDebounce={}))})(Ct,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 T=arguments.length,_=new Array(T),f=0;f<T;f++)_[f]=arguments[f];var E=this,C=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&&C>o?b():s!==!0&&(c=setTimeout(a?g:b,a===void 0?o-C: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 On(){return typeof window.og_auth!="undefined"?Rt(window.og_auth):null}async function Sa(t=100){return new Promise(e=>{setTimeout(()=>e(On()),t)})}async function wn(t,e=_a,r=Ea){let o;if(o=Rt(On())||Rt(e()),o)return o;if(t&&typeof t=="string"){let s=await fetch(t);s.status>=200&&s.status<300&&(o=e()||await(xa(s)?s.json():Promise.resolve(r(t)).then(e)))}else o||(o=await Sa());if(o=Rt(o),o)return o;throw new Error("Unauthorized")}var vn,_a,Rt,Ea,xa,Cn=S(()=>{vn=/^og_auth=/,_a=n((t=vn)=>(document.cookie.split(/;\s*/).find(e=>e.match(t))||"").replace(vn,""),"c"),Rt=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"),Ea=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"),xa=n(t=>(t.headers.get("content-type")||"").indexOf("application/json")!==-1,"d");n(On,"a");n(Sa,"f");n(wn,"u")});var A,N,k,Ne,z,P,et,ke,At,Pn,Nt,qe,Rn,kt,qt,An,Ie,Fe,Ue,Nn,kn,It,qn,Ft,De,In,Ut,Dt,tt,rt,Lt,Mt,me,oe,jt,$t,K,W,ne,ge,Vt,ye,be,Ht,Bt,Fn,D=S(()=>{A="OPTIN_PRODUCT",N="OPTOUT_PRODUCT",k="PRODUCT_CHANGE_FREQUENCY",Ne="SET_MERCHANT_ID",z="REQUEST_OFFER",P="RECEIVE_OFFER",et="PRODUCT_HAS_CHANGED",ke="CREATED_SESSION_ID",At="SET_AUTH_URL",Pn="REQUEST_AUTH",Nt="AUTHORIZE",qe="UNAUTHORIZED",Rn="REQUEST_ORDERS",kt="RECEIVE_ORDERS",qt="RECEIVE_ORDER_ITEMS",An="FETCH_RESPONSE_ERROR",Ie="SET_ENVIRONMENT_STAGING",Fe="SET_ENVIRONMENT_DEV",Ue="SET_ENVIRONMENT_PROD",Nn="CONCLUDE_UPSELL",kn="REQUEST_CREATE_IU_ORDER",It="CREATE_ONE_TIME",qn="REQUEST_CONVERT_ONE_TIME",Ft="CONVERT_ONE_TIME",De="CHECKOUT",In="RECEIVE_FETCH",Ut="SET_LOCALE",Dt="SET_CONFIG",tt="SET_PREVIEW_STANDARD_OFFER",rt="SET_PREVIEW_UPSELL_OFFER",Lt="ADD_TEMPLATE",Mt="SET_TEMPLATES",me="LOCAL_STORAGE_CHANGE",oe="LOCAL_STORAGE_CLEAR",jt="SET_FIRST_ORDER_PLACE_DATE",$t="SET_PRODUCT_TO_SUBSCRIBE",K="RECEIVE_PRODUCT_PLANS",W="SETUP_PRODUCT",ne="SETUP_CART",ge="pdp",Vt="dev",ye="staging",be="prod",Ht="static.ordergroove.com",Bt="staging.static.ordergroove.com",Fn="og-cart-updated"});var nt=he((ju,Hn)=>{var Ta="Expected a function",Un="__lodash_hash_undefined__",va="[object Function]",Oa="[object GeneratorFunction]",wa=/[\\^$.*+?()[\]{}|]/g,Ca=/^\[object .+?Constructor\]$/,Pa=typeof window=="object"&&window&&window.Object===Object&&window,Ra=typeof self=="object"&&self&&self.Object===Object&&self,Dn=Pa||Ra||Function("return this")();function Aa(t,e){return t==null?void 0:t[e]}n(Aa,"getValue");function Na(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}n(Na,"isHostObject");var ka=Array.prototype,qa=Function.prototype,Ln=Object.prototype,kr=Dn["__core-js_shared__"],Mn=function(){var t=/[^.]+$/.exec(kr&&kr.keys&&kr.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),jn=qa.toString,qr=Ln.hasOwnProperty,Ia=Ln.toString,Fa=RegExp("^"+jn.call(qr).replace(wa,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ua=ka.splice,Da=$n(Dn,"Map"),ot=$n(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 La(){this.__data__=ot?ot(null):{}}n(La,"hashClear");function Ma(t){return this.has(t)&&delete this.__data__[t]}n(Ma,"hashDelete");function ja(t){var e=this.__data__;if(ot){var r=e[t];return r===Un?void 0:r}return qr.call(e,t)?e[t]:void 0}n(ja,"hashGet");function $a(t){var e=this.__data__;return ot?e[t]!==void 0:qr.call(e,t)}n($a,"hashHas");function Va(t,e){var r=this.__data__;return r[t]=ot&&e===void 0?Un:e,this}n(Va,"hashSet");_e.prototype.clear=La;_e.prototype.delete=Ma;_e.prototype.get=ja;_e.prototype.has=$a;_e.prototype.set=Va;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 Ha(){this.__data__=[]}n(Ha,"listCacheClear");function Ba(t){var e=this.__data__,r=Gt(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():Ua.call(e,r,1),!0}n(Ba,"listCacheDelete");function Ga(t){var e=this.__data__,r=Gt(e,t);return r<0?void 0:e[r][1]}n(Ga,"listCacheGet");function za(t){return Gt(this.__data__,t)>-1}n(za,"listCacheHas");function Wa(t,e){var r=this.__data__,o=Gt(r,t);return o<0?r.push([t,e]):r[o][1]=e,this}n(Wa,"listCacheSet");Le.prototype.clear=Ha;Le.prototype.delete=Ba;Le.prototype.get=Ga;Le.prototype.has=za;Le.prototype.set=Wa;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 Ya(){this.__data__={hash:new _e,map:new(Da||Le),string:new _e}}n(Ya,"mapCacheClear");function Ja(t){return zt(this,t).delete(t)}n(Ja,"mapCacheDelete");function Qa(t){return zt(this,t).get(t)}n(Qa,"mapCacheGet");function Ka(t){return zt(this,t).has(t)}n(Ka,"mapCacheHas");function Za(t,e){return zt(this,t).set(t,e),this}n(Za,"mapCacheSet");Ee.prototype.clear=Ya;Ee.prototype.delete=Ja;Ee.prototype.get=Qa;Ee.prototype.has=Ka;Ee.prototype.set=Za;function Gt(t,e){for(var r=t.length;r--;)if(oc(t[r][0],e))return r;return-1}n(Gt,"assocIndexOf");function Xa(t){if(!Vn(t)||tc(t))return!1;var e=nc(t)||Na(t)?Fa:Ca;return e.test(rc(t))}n(Xa,"baseIsNative");function zt(t,e){var r=t.__data__;return ec(e)?r[typeof e=="string"?"string":"hash"]:r.map}n(zt,"getMapData");function $n(t,e){var r=Aa(t,e);return Xa(r)?r:void 0}n($n,"getNative");function ec(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}n(ec,"isKeyable");function tc(t){return!!Mn&&Mn in t}n(tc,"isMasked");function rc(t){if(t!=null){try{return jn.call(t)}catch{}try{return t+""}catch{}}return""}n(rc,"toSource");function Ir(t,e){if(typeof t!="function"||e&&typeof e!="function")throw new TypeError(Ta);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(Ir.Cache||Ee),r}n(Ir,"memoize");Ir.Cache=Ee;function oc(t,e){return t===e||t!==t&&e!==e}n(oc,"eq");function nc(t){var e=Vn(t)?Ia.call(t):"";return e==va||e==Oa}n(nc,"isFunction");function Vn(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}n(Vn,"isObject");Hn.exports=Ir});var Wt,Fr,st,it,Yt,Bn,Gn,sc,ic,ac,cc,lc,at,Ur,uc,zn,ct,pc,se,ie=S(()=>{Wt=re(nt()),Fr=n((...t)=>JSON.stringify(t),"memoizeKey"),st=n(t=>(...e)=>fetch(...t(...e)).then(r=>r.json()),"withFetchJson"),it=n(t=>(e,...r)=>{if(!e)throw Error("host required");let[o,s={}]=t(...r);return[`${e.replace(/\/+$/,"")}${o}`,s]},"withHost"),Yt=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"),Bn=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"),Gn=n((t=[])=>(Array.isArray(t)?t:Object.entries(t)).map(([e,r])=>[e,encodeURIComponent(r)].join("=")).join("&"),"toQuery"),sc=n(t=>JSON.stringify([].concat(t).map(e=>typeof e=="object"?e.id:e).filter(e=>e)),"toProductId"),ic=(0,Wt.default)(st(it((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=Gn([["session_id",e],["page_type",1],["p",sc(r)],["module_view",JSON.stringify(["regular"])]]);return[`/offer/${t}/${o}?${s}`]})),Fr),ac=(0,Wt.default)(st(it(Yt((t=1,e="place")=>[`/orders/?${Gn([["status",t],["ordering",e],["exclude_prepaid_orders","true"]])}`]))),Fr),cc=(0,Wt.default)(st(it(Yt(t=>{if(!t)throw Error("orderId required");return[`/items/?order=${t}`]}))),Fr),lc=st(it(Yt(Bn((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}}]})))),at=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"),Ur=n(t=>t.match(/^\d+_\d$/),"isFrequencyValid"),uc=n((t,e)=>String.prototype.localeCompare.call(t&&t.split("_").reverse().join("_"),e&&e.split("_").reverse().join("_")),"compareFrequencies"),zn=n(t=>[...new Set(t&&t.split(/\s+/))].filter(Ur).sort(uc),"parseFrequenciesList"),ct=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"),pc=st(it(Yt(Bn((t,e,r)=>{if(!t)throw Error("item required");if(!e)throw Error("frequency required");let o=at(e);if(!o)throw Error("invalid frequency");return["/subscriptions/create_from_item/",{body:{item:t.public_id,offer:r,...o}}]})))),se={fetchOffer:ic,fetchOrders:ac,fetchItems:cc,createOneTime:lc,convertOneTimeToSubscription:pc}});var Dr,F,lt=S(()=>{L();Dr=ut(),F={shopify:typeof window.Shopify!="undefined",shopify_selling_plans:typeof(Dr==null?void 0:Dr.dataset.shopifySellingPlans)!="undefined"}});function Jt(t){document.readyState==="loading"?window.addEventListener("DOMContentLoaded",t):t()}function ut(){return document.querySelector([`script[src^="https://${Ht}"]`,`script[src^="https://${Bt}"]`,`script[src^="http://${Ht}"]`,`script[src^="http://${Bt}"]`].join(","))}function Lr(){let t=ut();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 Yn(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?Ht:Bt}/${e}/main.js?initOnly=true`,document.head.appendChild(o)}function Qn(t){let e=document.cookie.match(`(^|;) ?${t}=([^;]*)(;|$)`);return e?e[2]:null}function Kn(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)}var R,Wn,Mr,Jn,Me,xe,Qt,Y,L=S(()=>{lt();D();n(Jt,"onReady");n(ut,"getMainJs");n(Lr,"resolveEnvAndMerchant");R=n(t=>{var r;if(!t)return"";let e=`${t.id||t}`;return((r=F)==null?void 0:r.shopify_selling_plans)&&(e=e.split(":")[0]),e},"safeProductId"),Wn=n((t,e)=>{var r;if(F.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"),Mr=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(Yn,"autoInitializeOffers");Jn=n(t=>{document.cookie=`${t}=; expires=Thu, 01 Jan 1970 00:00:01 GMT;`},"clearCookie");n(Qn,"getCookieValue");Me=n(t=>!!(t&&(t==null?void 0:t.includes("_"))),"isOgFrequency"),xe=n((t=[])=>(t==null?void 0:t[0])||null,"getFirstSellingPlan"),Qt=n((t=[],e=[])=>{var r;return!!(((r=F)==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");n(Kn,"getOrCreateHidden")});var ae,je,Zn,Kt,Xn,es,jr,dc,pt,ce,ts,Zt,rs,fc,$r,Vr,Xt,Hr,os,$e,Br,hc,ns,ss,mc,gc,yc,bc,is,as,cs,ls,us,ps,ds,q=S(()=>{Cn();D();ie();L();ae=n((t,e,r)=>({type:A,payload:{product:t,frequency:e,offer:r}}),"optinProduct"),je=n((t,e)=>({type:N,payload:{product:t,offer:e}}),"optoutProduct"),Zn=n((t,e)=>({type:et,payload:{newProduct:t,product:e}}),"productHasChangedComponents"),Kt=n((t,e,r)=>({type:k,payload:{product:t,frequency:e,offer:r}}),"productChangeFrequency"),Xn=n(t=>({type:Nn,payload:{product:t}}),"concludeUpsell"),es=n(t=>({type:Ne,payload:t}),"setMerchantId"),jr=n(t=>({type:ke,payload:`${t}.${Math.floor(Math.random()*999999)}.${Math.round(new Date().getTime()/1e3)}`}),"createSessionId"),dc=n(t=>({type:Pn,payload:t}),"requestAuth"),pt=n((t,e,r,o)=>({type:Nt,payload:{public_id:t,sig_field:e,ts:r,sig:o}}),"authorize"),ce=n(t=>({type:qe,payload:t}),"unauthorized"),ts=n(t=>({type:At,payload:t}),"setAuthUrl"),Zt=n(t=>({type:In,payload:t}),"fetchDone"),rs=n((t=wn)=>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=dc(i);return r(a),t(i).then(({sig_field:c,ts:l,sig:u})=>r(pt(s,c,l,u)),c=>r(ce(c))).finally(()=>r(Zt(a)))},"fetchAuthThunk"),"fetchAuth"),fc=n((t,e)=>({type:Rn,payload:{status:t,ordering:e}}),"requestOrders"),$r=n(t=>({type:kt,payload:t}),"receiveOrders"),Vr=n(t=>({type:qt,payload:t}),"receiveItems"),Xt=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=fc(t,e);return o(c),se.fetchOrders(i,a,t,e).then(l=>{if(l.results){o($r(l));let u=(l.results[0]||{}).public_id;if(u)return se.fetchItems(i,a,u).then(h=>o(Vr(h)))}return o(ce(l.detail)),null},l=>o(ce(l))).finally(()=>o(Zt(c)))},"fetchOrdersThunk"),"fetchOrders"),Hr=n(t=>{switch(t){case Vt:return{type:Fe,payload:t};case ye:return{type:Ie,payload:t};case be:return{type:Ue,payload:t};default:throw new Error(`${t} is not a supported environment`)}},"setEnvironment"),os=n(()=>(t,e)=>{let{merchantId:r,sessionId:o}=e();return(!o||r&&!o.startsWith(r))&&t(jr(r)),o},"requestSessionId"),$e=n((t,e)=>({type:P,payload:{...t,offer:e}}),"receiveOffer"),Br=n(t=>({type:An,payload:t}),"fetchResponseError"),hc=n((t,e=ge,r)=>({type:z,payload:{product:t,module:e,offer:r}}),"requestOffer"),ns=n((t,e=ge,r)=>n(function(s,i){let{merchantId:a,sessionId:c,environment:{apiUrl:l}}=i(),u=hc(t,e,r);s(u);let h=R(t);return h?se.fetchOffer(l,a,c,h,e).then(p=>s($e(p,r)),p=>s(Br(p))).finally(()=>s(Zt(u))):null},"fetchOfferThunk"),"fetchOffer"),ss=n(()=>({type:De}),"checkout"),mc=n((t,e,r,o)=>({type:kn,payload:{product:t,order:e,quantity:r,offerId:o}}),"requestCreateOneTime"),gc=n(t=>({type:It,payload:t}),"receiveCreateOneTime"),yc=n((t,e)=>({type:qn,payload:{item:t,frequency:e}}),"requestConvertOneTimeToSubscription"),bc=n((t,e)=>({type:Ft,payload:{response:t,product:e}}),"receiveConvertOneTime"),is=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 T=Wn(s,u),_=mc(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(gc(f)),o?(a(yc(f,T)),(p?Promise.resolve({item:f,frequency:T}):se.convertOneTimeToSubscription(h,l,f,T,m)).then(E=>a(bc(E,t)),E=>a(Br(E)))):f),f=>a(Br(f))).finally(()=>a(Zt(_)))},"createIuThunk"),"createIu"),as=n(t=>({type:Ut,payload:t}),"setLocale"),cs=n(t=>({type:Dt,payload:t}),"setConfig"),ls=n((t,e,r)=>({type:Lt,payload:{selector:t,markup:e,config:r}}),"addTemplate"),us=n(t=>({type:Mt,payload:t}),"setTemplates"),ps=n((t,e)=>({type:jt,payload:{product:t,firstOrderPlaceDate:e}}),"setFirstOrderPlaceDate"),ds=n((t,e)=>({type:$t,payload:{product:t,productToSubscribe:e}}),"setProductToSubscribe")});var Kr,Te,ve=S(()=>{Kr=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 V,Zr,As,Ge,Oe,Ns,ft,Q,sr,le=S(()=>{V=`{{lit-${String(Math.random()).slice(2)}}}`,Zr=`<!--${V}-->`,As=new RegExp(`${V}|${Zr}`),Ge="$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:T}=m,_=0;for(let f=0;f<T;f++)Ns(m[f].name,Ge)&&_++;for(;_-- >0;){let f=u[l],E=sr.exec(f)[2],C=E.toLowerCase()+Ge,b=p.getAttribute(C);p.removeAttribute(C);let g=b.split(As);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(V)>=0){let T=p.parentNode,_=m.split(As),f=_.length-1;for(let E=0;E<f;E++){let C,b=_[E];if(b==="")C=Q();else{let g=sr.exec(b);g!==null&&Ns(g[2],Ge)&&(b=b.slice(0,g.index)+g[1]+g[2].slice(0,-Ge.length)+g[3]),C=document.createTextNode(b)}T.insertBefore(C,p),this.parts.push({type:"node",index:++c})}_[f]===""?(T.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(Oe,"Template");Ns=n((t,e)=>{let r=t.length-e.length;return r>=0&&t.slice(r)===e},"endsWith"),ft=n(t=>t.index!==-1,"isTemplatePartActive"),Q=n(()=>document.createComment(""),"createMarker"),sr=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/});function eo(t,e){let{element:{content:r},parts:o}=t,s=document.createTreeWalker(r,Xr,null,!1),i=ht(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=ht(o,i),a=o[i]}u.forEach(p=>p.parentNode.removeChild(p))}function ks(t,e,r=null){let{element:{content:o},parts:s}=t;if(r==null){o.appendChild(e);return}let i=document.createTreeWalker(o,Xr,null,!1),a=ht(s),c=0,l=-1;for(;i.nextNode();)for(l++,i.currentNode===r&&(c=Uc(e),r.parentNode.insertBefore(e,r));a!==-1&&s[a].index===l;){if(c>0){for(;a!==-1;)s[a].index+=c,a=ht(s,a);return}a=ht(s,a)}}var Xr,Uc,ht,qs=S(()=>{le();Xr=133;n(eo,"removeNodesFromTemplate");Uc=n(t=>{let e=t.nodeType===11?0:1,r=document.createTreeWalker(t,Xr,null,!1);for(;r.nextNode();)e++;return e},"countNodes"),ht=n((t,e=-1)=>{for(let r=e+1;r<t.length;r++){let o=t[r];if(ft(o))return r}return-1},"nextActiveIndexInTemplateParts");n(ks,"insertNodeIntoTemplate")});var Dc,we,to=S(()=>{Dc=new WeakMap,we=n(t=>typeof t=="function"&&Dc.has(t),"isDirective")});var M,ir,ro=S(()=>{M={},ir={}});var ue,ar=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=Kr?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],!ft(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 Kr&&(document.adoptNode(e),customElements.upgrade(e)),e}};n(ue,"TemplateInstance")});var Is,Mc,X,cr=S(()=>{ve();le();Is=window.trustedTypes&&trustedTypes.createPolicy("lit-html",{createHTML:t=>t}),Mc=` ${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=sr.exec(i);c===null?r+=i+(o?Mc:Zr):r+=i.substr(0,c.index)+c[1]+c[2]+Ge+c[3]+V}return r+=this.strings[e],r}getTemplateElement(){let e=document.createElement("template"),r=this.getHTML();return Is!==void 0&&(r=Is.createHTML(r)),e.innerHTML=r,e}};n(X,"TemplateResult")});var lr,ur,ze,mt,ee,gt,yt,pr,Fs,bt,jc,dr=S(()=>{to();ve();ro();ar();cr();le();lr=n(t=>t===null||!(typeof t=="object"||typeof t=="function"),"isPrimitive"),ur=n(t=>Array.isArray(t)||!!(t&&t[Symbol.iterator]),"isIterable"),ze=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 mt(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"||!ur(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(lr(c)||!ur(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(ze,"AttributeCommitter");mt=class{constructor(e){this.value=void 0,this.committer=e}setValue(e){e!==M&&(!lr(e)||e!==this.value)&&(this.value=e,we(e)||(this.committer.dirty=!0))}commit(){for(;we(this.value);){let e=this.value;this.value=M,e(this)}this.value!==M&&this.committer.commit()}};n(mt,"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=M,r(this)}let e=this.__pendingValue;e!==M&&(lr(e)?e!==this.value&&this.__commitText(e):e instanceof X?this.__commitTemplateResult(e):e instanceof Node?this.__commitNode(e):ur(e)?this.__commitIterable(e):e===ir?(this.value=ir,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");gt=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=M,r(this)}if(this.__pendingValue===M)return;let e=!!this.__pendingValue;this.value!==e&&(e?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=e),this.__pendingValue=M}};n(gt,"BooleanAttributePart");yt=class extends ze{constructor(e,r,o){super(e,r,o);this.single=o.length===2&&o[0]===""&&o[1]===""}_createPart(){return new pr(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}};n(yt,"PropertyCommitter");pr=class extends mt{};n(pr,"PropertyPart");Fs=!1;(()=>{try{let t={get capture(){return Fs=!0,!1}};window.addEventListener("test",t,t),window.removeEventListener("test",t,t)}catch{}})();bt=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=M,i(this)}if(this.__pendingValue===M)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=jc(e),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=e,this.__pendingValue=M}handleEvent(e){typeof this.value=="function"?this.value.call(this.eventContext||this.element,e):this.value.handleEvent(e)}};n(bt,"EventPart");jc=n(t=>t&&(Fs?{capture:t.capture,passive:t.passive,once:t.once}:t.capture),"getOptions")});function oo(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(V);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,fr=S(()=>{le();n(oo,"templateFactory");Ce=new Map});var pe,no,so=S(()=>{ve();dr();fr();pe=new WeakMap,no=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:oo},r))),o.appendInto(e)),o.setValue(t),o.commit()},"render")});var hr,io,ao=S(()=>{dr();hr=class{handleAttributeExpressions(e,r,o,s){let i=r[0];return i==="."?new yt(e,r.slice(1),o).parts:i==="@"?[new bt(e,r.slice(1),s.eventContext)]:i==="?"?[new gt(e,r.slice(1),o)]:new ze(e,r,o).parts}handleTextExpression(e){return new ee(e)}};n(hr,"DefaultTemplateProcessor");io=new hr});var d,co=S(()=>{ao();cr();ao();to();ve();ro();dr();so();fr();ar();cr();le();typeof window!="undefined"&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.3.0");d=n((t,...e)=>new X(t,e,"html",io),"html")});var Ds,mr,Vc,Hc,Bc,Ls,Gc,Ms,js=S(()=>{ve();qs();so();fr();ar();le();co();Ds=n((t,e)=>`${t}--${e}`,"getTemplateCacheKey"),mr=!0;typeof window.ShadyCSS=="undefined"?mr=!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."),mr=!1);Vc=n(t=>e=>{let r=Ds(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(V);if(s=o.keyString.get(i),s===void 0){let a=e.getTemplateElement();mr&&window.ShadyCSS.prepareTemplateDom(a,t),s=new Oe(e,a),o.keyString.set(i,s)}return o.stringsArray.set(e.strings,s),s},"shadyTemplateFactory"),Hc=["html","svg"],Bc=n(t=>{Hc.forEach(e=>{let r=Ce.get(Ds(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)}),eo(o,i)})})},"removeStylesFromLitTemplates"),Ls=new Set,Gc=n((t,e,r)=>{Ls.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}Bc(t);let c=o.content;r?ks(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),eo(r,u)}},"prepareTemplateStyles"),Ms=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=mr&&e.nodeType===11&&!!e.host,a=i&&!Ls.has(o),c=a?document.createDocumentFragment():e;if(no(t,c,Object.assign({templateFactory:Vc(o)},r)),a){let l=pe.get(c);pe.delete(c);let u=l.value instanceof ue?l.value.template:void 0;Gc(o,c,u),Te(e,e.firstChild),e.appendChild(c),pe.set(e,l)}!s&&i&&window.ShadyCSS.styleElement(e.host)},"render")});var $s,lo,Vs,uo,po,fo,ho,mo,go,_t,yo=S(()=>{window.JSCompiler_renameProperty=(t,e)=>t;lo={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}},Vs=n((t,e)=>e!==t&&(e===e||t===t),"notEqual"),uo={attribute:!0,type:String,converter:lo,reflect:!1,hasChanged:Vs},po=1,fo=1<<2,ho=1<<3,mo=1<<4,go="finalized",_t=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=uo){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)||uo}static finalize(){let e=Object.getPrototypeOf(this);if(e.hasOwnProperty(go)||e.finalize(),this[go]=!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=Vs){return o(e,r)}static _propertyValueFromAttribute(e,r){let o=r.type,s=r.converter||lo,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||lo.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=uo){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|ho,a==null?this.removeAttribute(i):this.setAttribute(i,a),this._updateState=this._updateState&~ho}}_attributeToProperty(e,r){if(this._updateState&ho)return;let o=this.constructor,s=o._attributeToPropertyMap.get(e);if(s!==void 0){let i=o.getPropertyOptions(s);this._updateState=this._updateState|mo,this[s]=o._propertyValueFromAttribute(r,i),this._updateState=this._updateState&~mo}}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&mo)&&(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|fo;try{await this._updatePromise}catch{}let e=this.performUpdate();return e!=null&&await e,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return this._updateState&fo}get hasUpdated(){return this._updateState&po}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&po||(this._updateState=this._updateState|po,this.firstUpdated(r)),this.updated(r))}_markUpdated(){this._changedProperties=new Map,this._updateState=this._updateState&~fo}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(_t,"UpdatingElement");$s=go;_t[$s]=!0});var Hs,vd,Bs=S(()=>{Hs=Element.prototype,vd=Hs.msMatchesSelector||Hs.webkitMatchesSelector});var gr,bo,Et,Gs,zc,O,_o=S(()=>{gr=window.ShadowRoot&&(window.ShadyCSS===void 0||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,bo=Symbol(),Et=class{constructor(e,r){if(r!==bo)throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e}get styleSheet(){return this._styleSheet===void 0&&(gr?(this._styleSheet=new CSSStyleSheet,this._styleSheet.replaceSync(this.cssText)):this._styleSheet=null),this._styleSheet}toString(){return this.cssText}};n(Et,"CSSResult");Gs=n(t=>new Et(String(t),bo),"unsafeCSS"),zc=n(t=>{if(t instanceof Et)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"),O=n((t,...e)=>{let r=e.reduce((o,s,i)=>o+zc(s)+t[i+1],t[0]);return new Et(r,bo)},"css")});var zs,v,w=S(()=>{js();yo();yo();Bs();co();_o();_o();(window.litElementVersions||(window.litElementVersions=[])).push("2.4.0");zs={},v=class extends _t{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&&!gr){let o=Array.prototype.slice.call(r.cssRules).reduce((s,i)=>s+i.cssText,"");return Gs(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):gr?this.renderRoot.adoptedStyleSheets=e.map(r=>r instanceof CSSStyleSheet?r:r.styleSheet):this._needsShimAdoptedStyleSheets=!0)}connectedCallback(){super.connectedCallback(),this.hasUpdated&&window.ShadyCSS!==void 0&&window.ShadyCSS.styleElement(this)}update(e){let r=this.render();super.update(e),r!==zs&&this.constructor.render(r,this.renderRoot,{scopeName:this.localName,eventContext:this}),this._needsShimAdoptedStyleSheets&&(this._needsShimAdoptedStyleSheets=!1,this.constructor._styles.forEach(o=>{let s=document.createElement("style");s.textContent=o.cssText,this.renderRoot.appendChild(s)}))}render(){return zs}};n(v,"LitElement");v.finalized=!0;v.render=Ms});var yr=he((Fd,Ws)=>{var Wc={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"};Ws.exports=Wc});var Js=he((Ud,Ys)=>{var Pe=yr(),Yc=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");Ys.exports=Yc});var Ks=he((Dd,Qs)=>{var de=yr(),Jc=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"),Qc=n(function*(t){for(let e=0;e<t.length-1;e++)yield t[e];return t[t.length-1]},"PolishGenerator");Qs.exports={PolishNotation:Jc,PolishGenerator:Qc}});var Xs=he((Ld,Zs)=>{var j=yr(),B=class{constructor(e,r,o,s){this.op=e,this.left=r,this.right=o,this.literal=s}isLeaf(){return this.op===j.LEAF}isAtomic(){return this.isLeaf()||this.op===j.OP_NOT&&this.left.isLeaf()}getLiteralValue(){return this.literal}static CreateAnd(e,r){return new B(j.BINARY_AND,e,r)}static CreateNot(e){return new B(j.OP_NOT,e)}static CreateOr(e,r){return new B(j.BINARY_OR,e,r)}static CreateLiteral(e){return new B(j.LEAF,null,null,e)}};n(B,"ExpNode");var We=n(t=>{let e=t.next().value;switch(e.type){case j.LITERAL:return B.CreateLiteral(e.value);case j.OP_NOT:return B.CreateNot(We(t));case j.BINARY_AND:{let r=We(t),o=We(t);return B.CreateAnd(r,o)}case j.BINARY_OR:{let r=We(t),o=We(t);return B.CreateOr(r,o)}}return null},"make"),Ye=n((t,e)=>{if(t.isLeaf())return e(t.getLiteralValue());if(t.op===j.OP_NOT)return!Ye(t.left,e);if(t.op===j.BINARY_OR)return Ye(t.left,e)||Ye(t.right,e);if(t.op===j.BINARY_AND)return Ye(t.left,e)&&Ye(t.right,e)},"nodeEvaluator");Zs.exports={make:We,nodeEvaluator:Ye}});var oi=he((Md,ri)=>{var Kc=Js(),ei=Ks(),ti=Xs(),Zc=n((t,e)=>{let r=Kc(t),o=ei.PolishNotation(r),s=ei.PolishGenerator(o),i=ti.make(s);return ti.nodeEvaluator(i,e)},"parse");ri.exports={parse:Zc}});var Ii={};wr(Ii,{TestWizard:()=>vr,default:()=>xl});var vr,xl,Fi=S(()=>{w();q();vr=class extends v{static get styles(){return O`
11
+ var lib=(()=>{var ya=Object.create;var tt=Object.defineProperty;var ba=Object.getOwnPropertyDescriptor;var _a=Object.getOwnPropertyNames;var Ea=Object.getPrototypeOf,xa=Object.prototype.hasOwnProperty;var En=t=>tt(t,"__esModule",{value:!0}),n=(t,e)=>tt(t,"name",{value:e,configurable:!0});var E=(t,e)=>()=>(t&&(e=t(t=0)),e);var be=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Ar=(t,e)=>{En(t);for(var r in e)tt(t,r,{get:e[r],enumerable:!0})},Sa=(t,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of _a(e))!xa.call(t,o)&&o!=="default"&&tt(t,o,{get:()=>e[o],enumerable:!(r=ba(e,o))||r.enumerable});return t},ne=t=>Sa(En(tt(t!=null?ya(Ea(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var It=be((Nt,Pn)=>{(function(t,e){typeof Nt=="object"&&typeof Pn!="undefined"?e(Nt):typeof define=="function"&&define.amd?define(["exports"],e):(t=t||self,e(t.throttleDebounce={}))})(Nt,function(t){"use strict";function e(o,s,i,a){var c,l=!1,u=0;function m(){c&&clearTimeout(c)}n(m,"clearExistingTimeout");function p(){m(),l=!0}n(p,"cancel"),typeof s!="boolean"&&(a=i,i=s,s=void 0);function f(){for(var O=arguments.length,_=new Array(O),h=0;h<O;h++)_[h]=arguments[h];var x=this,C=Date.now()-u;if(l)return;function b(){u=Date.now(),i.apply(x,_)}n(b,"exec");function y(){c=void 0}n(y,"clear"),a&&!c&&b(),m(),a===void 0&&C>o?b():s!==!0&&(c=setTimeout(a?y:b,a===void 0?o-C:o))}return n(f,"wrapper"),f.cancel=p,f}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 An(){return typeof window.og_auth!="undefined"?kt(window.og_auth):null}async function Ia(t=100){return new Promise(e=>{setTimeout(()=>e(An()),t)})}async function Nn(t,e=Ra,r=Aa){let o;if(o=kt(An())||kt(e()),o)return o;if(t&&typeof t=="string"){let s=await fetch(t);s.status>=200&&s.status<300&&(o=e()||await(Na(s)?s.json():Promise.resolve(r(t)).then(e)))}else o||(o=await Ia());if(o=kt(o),o)return o;throw new Error("Unauthorized")}var Rn,Ra,kt,Aa,Na,In=E(()=>{Rn=/^og_auth=/,Ra=n((t=Rn)=>(document.cookie.split(/;\s*/).find(e=>e.match(t))||"").replace(Rn,""),"c"),kt=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"),Aa=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"),Na=n(t=>(t.headers.get("content-type")||"").indexOf("application/json")!==-1,"d");n(An,"a");n(Ia,"f");n(Nn,"u")});var A,q,U,se,qe,W,P,ot,Ue,qt,kn,Ut,Fe,qn,Ft,Dt,Un,De,Le,Me,Fn,Dn,Lt,Ln,Mt,je,Mn,jt,$t,nt,st,Vt,Ht,_e,ie,Gt,Bt,X,Y,ae,Ee,zt,xe,Se,Wt,Yt,jn,L=E(()=>{A="OPTIN_PRODUCT",q="OPTOUT_PRODUCT",U="PRODUCT_CHANGE_FREQUENCY",se="PRODUCT_CHANGE_PREPAID_SHIPMENTS",qe="SET_MERCHANT_ID",W="REQUEST_OFFER",P="RECEIVE_OFFER",ot="PRODUCT_HAS_CHANGED",Ue="CREATED_SESSION_ID",qt="SET_AUTH_URL",kn="REQUEST_AUTH",Ut="AUTHORIZE",Fe="UNAUTHORIZED",qn="REQUEST_ORDERS",Ft="RECEIVE_ORDERS",Dt="RECEIVE_ORDER_ITEMS",Un="FETCH_RESPONSE_ERROR",De="SET_ENVIRONMENT_STAGING",Le="SET_ENVIRONMENT_DEV",Me="SET_ENVIRONMENT_PROD",Fn="CONCLUDE_UPSELL",Dn="REQUEST_CREATE_IU_ORDER",Lt="CREATE_ONE_TIME",Ln="REQUEST_CONVERT_ONE_TIME",Mt="CONVERT_ONE_TIME",je="CHECKOUT",Mn="RECEIVE_FETCH",jt="SET_LOCALE",$t="SET_CONFIG",nt="SET_PREVIEW_STANDARD_OFFER",st="SET_PREVIEW_UPSELL_OFFER",Vt="ADD_TEMPLATE",Ht="SET_TEMPLATES",_e="LOCAL_STORAGE_CHANGE",ie="LOCAL_STORAGE_CLEAR",Gt="SET_FIRST_ORDER_PLACE_DATE",Bt="SET_PRODUCT_TO_SUBSCRIBE",X="RECEIVE_PRODUCT_PLANS",Y="SETUP_PRODUCT",ae="SETUP_CART",Ee="pdp",zt="dev",xe="staging",Se="prod",Wt="static.ordergroove.com",Yt="staging.static.ordergroove.com",jn="og-cart-updated"});var at=be((ep,Yn)=>{var ka="Expected a function",$n="__lodash_hash_undefined__",qa="[object Function]",Ua="[object GeneratorFunction]",Fa=/[\\^$.*+?()[\]{}|]/g,Da=/^\[object .+?Constructor\]$/,La=typeof window=="object"&&window&&window.Object===Object&&window,Ma=typeof self=="object"&&self&&self.Object===Object&&self,Vn=La||Ma||Function("return this")();function ja(t,e){return t==null?void 0:t[e]}n(ja,"getValue");function $a(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}n($a,"isHostObject");var Va=Array.prototype,Ha=Function.prototype,Hn=Object.prototype,Fr=Vn["__core-js_shared__"],Gn=function(){var t=/[^.]+$/.exec(Fr&&Fr.keys&&Fr.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),Bn=Ha.toString,Dr=Hn.hasOwnProperty,Ga=Hn.toString,Ba=RegExp("^"+Bn.call(Dr).replace(Fa,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),za=Va.splice,Wa=zn(Vn,"Map"),it=zn(Object,"create");function Te(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}n(Te,"Hash");function Ya(){this.__data__=it?it(null):{}}n(Ya,"hashClear");function Ja(t){return this.has(t)&&delete this.__data__[t]}n(Ja,"hashDelete");function Qa(t){var e=this.__data__;if(it){var r=e[t];return r===$n?void 0:r}return Dr.call(e,t)?e[t]:void 0}n(Qa,"hashGet");function Ka(t){var e=this.__data__;return it?e[t]!==void 0:Dr.call(e,t)}n(Ka,"hashHas");function Za(t,e){var r=this.__data__;return r[t]=it&&e===void 0?$n:e,this}n(Za,"hashSet");Te.prototype.clear=Ya;Te.prototype.delete=Ja;Te.prototype.get=Qa;Te.prototype.has=Ka;Te.prototype.set=Za;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,"ListCache");function Xa(){this.__data__=[]}n(Xa,"listCacheClear");function ec(t){var e=this.__data__,r=Jt(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():za.call(e,r,1),!0}n(ec,"listCacheDelete");function tc(t){var e=this.__data__,r=Jt(e,t);return r<0?void 0:e[r][1]}n(tc,"listCacheGet");function rc(t){return Jt(this.__data__,t)>-1}n(rc,"listCacheHas");function oc(t,e){var r=this.__data__,o=Jt(r,t);return o<0?r.push([t,e]):r[o][1]=e,this}n(oc,"listCacheSet");$e.prototype.clear=Xa;$e.prototype.delete=ec;$e.prototype.get=tc;$e.prototype.has=rc;$e.prototype.set=oc;function ve(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(ve,"MapCache");function nc(){this.__data__={hash:new Te,map:new(Wa||$e),string:new Te}}n(nc,"mapCacheClear");function sc(t){return Qt(this,t).delete(t)}n(sc,"mapCacheDelete");function ic(t){return Qt(this,t).get(t)}n(ic,"mapCacheGet");function ac(t){return Qt(this,t).has(t)}n(ac,"mapCacheHas");function cc(t,e){return Qt(this,t).set(t,e),this}n(cc,"mapCacheSet");ve.prototype.clear=nc;ve.prototype.delete=sc;ve.prototype.get=ic;ve.prototype.has=ac;ve.prototype.set=cc;function Jt(t,e){for(var r=t.length;r--;)if(fc(t[r][0],e))return r;return-1}n(Jt,"assocIndexOf");function lc(t){if(!Wn(t)||pc(t))return!1;var e=hc(t)||$a(t)?Ba:Da;return e.test(dc(t))}n(lc,"baseIsNative");function Qt(t,e){var r=t.__data__;return uc(e)?r[typeof e=="string"?"string":"hash"]:r.map}n(Qt,"getMapData");function zn(t,e){var r=ja(t,e);return lc(r)?r:void 0}n(zn,"getNative");function uc(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}n(uc,"isKeyable");function pc(t){return!!Gn&&Gn in t}n(pc,"isMasked");function dc(t){if(t!=null){try{return Bn.call(t)}catch{}try{return t+""}catch{}}return""}n(dc,"toSource");function Lr(t,e){if(typeof t!="function"||e&&typeof e!="function")throw new TypeError(ka);var r=n(function(){var o=arguments,s=e?e.apply(this,o):o[0],i=r.cache;if(i.has(s))return i.get(s);var a=t.apply(this,o);return r.cache=i.set(s,a),a},"memoized");return r.cache=new(Lr.Cache||ve),r}n(Lr,"memoize");Lr.Cache=ve;function fc(t,e){return t===e||t!==t&&e!==e}n(fc,"eq");function hc(t){var e=Wn(t)?Ga.call(t):"";return e==qa||e==Ua}n(hc,"isFunction");function Wn(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}n(Wn,"isObject");Yn.exports=Lr});var Kt,Mr,ct,lt,Zt,Jn,Qn,mc,gc,yc,bc,_c,ut,jr,Ec,Kn,pt,xc,ce,le=E(()=>{Kt=ne(at()),Mr=n((...t)=>JSON.stringify(t),"memoizeKey"),ct=n(t=>(...e)=>fetch(...t(...e)).then(r=>r.json()),"withFetchJson"),lt=n(t=>(e,...r)=>{if(!e)throw Error("host required");let[o,s={}]=t(...r);return[`${e.replace(/\/+$/,"")}${o}`,s]},"withHost"),Zt=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"),Qn=n((t=[])=>(Array.isArray(t)?t:Object.entries(t)).map(([e,r])=>[e,encodeURIComponent(r)].join("=")).join("&"),"toQuery"),mc=n(t=>JSON.stringify([].concat(t).map(e=>typeof e=="object"?e.id:e).filter(e=>e)),"toProductId"),gc=(0,Kt.default)(ct(lt((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=Qn([["session_id",e],["page_type",1],["p",mc(r)],["module_view",JSON.stringify(["regular"])]]);return[`/offer/${t}/${o}?${s}`]})),Mr),yc=(0,Kt.default)(ct(lt(Zt((t=1,e="place")=>[`/orders/?${Qn([["status",t],["ordering",e],["exclude_prepaid_orders","true"]])}`]))),Mr),bc=(0,Kt.default)(ct(lt(Zt(t=>{if(!t)throw Error("orderId required");return[`/items/?order=${t}`]}))),Mr),_c=ct(lt(Zt(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}}]})))),ut=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"),jr=n(t=>t.match(/^\d+_\d$/),"isFrequencyValid"),Ec=n((t,e)=>String.prototype.localeCompare.call(t&&t.split("_").reverse().join("_"),e&&e.split("_").reverse().join("_")),"compareFrequencies"),Kn=n(t=>[...new Set(t&&t.split(/\s+/))].filter(jr).sort(Ec),"parseFrequenciesList"),pt=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"),xc=ct(lt(Zt(Jn((t,e,r)=>{if(!t)throw Error("item required");if(!e)throw Error("frequency required");let o=ut(e);if(!o)throw Error("invalid frequency");return["/subscriptions/create_from_item/",{body:{item:t.public_id,offer:r,...o}}]})))),ce={fetchOffer:gc,fetchOrders:yc,fetchItems:bc,createOneTime:_c,convertOneTimeToSubscription:xc}});var $r,F,dt=E(()=>{M();$r=ft(),F={shopify:typeof window.Shopify!="undefined",shopify_selling_plans:typeof($r==null?void 0:$r.dataset.shopifySellingPlans)!="undefined"}});function Sc(t,e){return t===e}function Tc(t,e,r){if(e===null||r===null||e.length!==r.length)return!1;for(var o=e.length,s=0;s<o;s++)if(!t(e[s],r[s]))return!1;return!0}function vc(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Sc,r=null,o=null;return function(){return Tc(e,r,arguments)||(o=t.apply(null,arguments)),r=arguments,o}}function Oc(t){var e=Array.isArray(t[0])?t[0]:t;if(!e.every(function(o){return typeof o=="function"})){var r=e.map(function(o){return typeof o}).join(", ");throw new Error("Selector creators expect all input-selectors to be functions, "+("instead received the following types: ["+r+"]"))}return e}function wc(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=Oc(i),m=t.apply(void 0,[function(){return c++,l.apply(null,arguments)}].concat(r)),p=t(function(){for(var f=[],O=u.length,_=0;_<O;_++)f.push(u[_].apply(null,arguments));return m.apply(null,f)});return p.resultFunc=l,p.dependencies=u,p.recomputations=function(){return c},p.resetRecomputations=function(){return c=0},p}}var ue,Zn=E(()=>{n(Sc,"defaultEqualityCheck");n(Tc,"areArgumentsShallowlyEqual");n(vc,"defaultMemoize");n(Oc,"getDependencies");n(wc,"createSelectorCreator");ue=wc(vc)});function Cc(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}function Pc(t,e,r){let o=pt(r);return F.shopify_selling_plans?K(t,e,o):o}var ee,N,ht,Xn,Vr,Rc,Ac,Nc,J,Xt,es,er,Q,ts,Ve,Hr,V,He,D=E(()=>{Zn();ee=ne(at());le();dt();M();ee.default.Cache=Map;n(Cc,"arraysEqual");n(Pc,"resolveFrequency");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))||Cc((t.components||[]).sort(),(e.components||[]).sort()))),"isSameProduct"),ht=n(t=>t.optedin||[],"optedinSelector"),Xn=n(t=>t.optedout||[],"optedoutSelector"),Vr=n(t=>t.autoshipByDefault||{},"autoshipSelector"),Rc=n(t=>t.defaultFrequencies||{},"defaultFrequenciesSelector"),Ac=n(t=>{var e;return((e=t==null?void 0:t.config)==null?void 0:e.frequencies)||[]},"sellingPlansSelector"),Nc=n(t=>{var e;return((e=t==null?void 0:t.config)==null?void 0:e.frequenciesEveryPeriod)||[]},"frequenciesEveryPeriodSelector"),J=(0,ee.default)(t=>ue(ht,Xn,Vr,(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)),Xt=(0,ee.default)(t=>ue(ht,e=>{let r=e.find(o=>N(t,o));return r||!1}),t=>JSON.stringify(t)),es=(0,ee.default)(t=>ue(ht,e=>e.some(r=>N(t,r)&&r.prepaidShipments)),t=>JSON.stringify(t)),er=(0,ee.default)(t=>ue(Xn,e=>e.find(r=>N(t,r)))),Q=(0,ee.default)(t=>ue(J(t),e=>e&&e.frequency||null)),ts=(0,ee.default)(t=>ue(J(t),e=>e&&e.prepaidShipments||null)),Ve=(0,ee.default)(t=>ue(Rc,Ac,Nc,(e,r,o)=>e[R(t)]&&Pc(r,o,e[R(t)])||null)),Hr=n(t=>t.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase(),"kebabCase"),V=n((t,e,r,o)=>({[r]:t.config&&t.config[r]||e&&e.hasAttribute&&e.hasAttribute(Hr(r))&&e[r]||e.offer&&typeof(e.offer[r]!=="undefined")&&e.offer[r]||o}),"configSelector"),He=n(t=>({templates:t.templates||[]}),"templatesSelector")});function tr(t){document.readyState==="loading"?window.addEventListener("DOMContentLoaded",t):t()}function ft(){return document.querySelector([`script[src^="https://${Wt}"]`,`script[src^="https://${Yt}"]`,`script[src^="http://${Wt}"]`,`script[src^="http://${Yt}"]`].join(","))}function Gr(){let t=ft();if(!t)return[];let e=new URL(t.src),r=e.host.startsWith(xe)?xe:Se,o=e.pathname.split("/")[1];return!r&&!o?[]:[o,r,t]}function os(t){if(t.isReady())return;console.info("OG offers are auto initializing");let[e,r]=Gr();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===Se?Wt:Yt}/${e}/main.js?initOnly=true`,document.head.appendChild(o)}function ss(t){let e=document.cookie.match(`(^|;) ?${t}=([^;]*)(;|$)`);return e?e[2]:null}function is(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)}function Be(t,e){let[[r],o]=t.reduce((s,i)=>s[N(e,i)?0:1].push(i)&&s,[[],[]]);return[r||{},o||[]]}var R,rs,Br,ns,Ge,Oe,rr,K,M=E(()=>{dt();L();D();n(tr,"onReady");n(ft,"getMainJs");n(Gr,"resolveEnvAndMerchant");R=n(t=>{var r;if(!t)return"";let e=`${t.id||t}`;return((r=F)==null?void 0:r.shopify_selling_plans)&&(e=e.split(":")[0]),e},"safeProductId"),rs=n((t,e)=>{var r;if(F.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"),Br=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(os,"autoInitializeOffers");ns=n(t=>{document.cookie=`${t}=; expires=Thu, 01 Jan 1970 00:00:01 GMT;`},"clearCookie");n(ss,"getCookieValue");Ge=n(t=>!!(t&&(t==null?void 0:t.includes("_"))),"isOgFrequency"),Oe=n((t=[])=>(t==null?void 0:t[0])||null,"getFirstSellingPlan"),rr=n((t=[],e=[])=>{var r;return!!(((r=F)==null?void 0:r.shopify_selling_plans)&&t.length&&e.length)},"hasShopifySellingPlans"),K=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");n(is,"getOrCreateHidden");n(Be,"getMatchingProductIfExists")});var pe,ze,as,or,cs,ls,us,zr,Ic,mt,de,ps,nr,ds,kc,Wr,Yr,sr,Jr,fs,We,Qr,qc,hs,ms,Uc,Fc,Dc,Lc,gs,ys,bs,_s,Es,xs,Ss,I=E(()=>{In();L();le();M();pe=n((t,e,r)=>({type:A,payload:{product:t,frequency:e,offer:r}}),"optinProduct"),ze=n((t,e)=>({type:q,payload:{product:t,offer:e}}),"optoutProduct"),as=n((t,e)=>({type:ot,payload:{newProduct:t,product:e}}),"productHasChangedComponents"),or=n((t,e,r)=>({type:U,payload:{product:t,frequency:e,offer:r}}),"productChangeFrequency"),cs=n((t,e,r)=>({type:se,payload:{product:t,prepaidShipments:e,offer:r}}),"productChangePrepaidShipments"),ls=n(t=>({type:Fn,payload:{product:t}}),"concludeUpsell"),us=n(t=>({type:qe,payload:t}),"setMerchantId"),zr=n(t=>({type:Ue,payload:`${t}.${Math.floor(Math.random()*999999)}.${Math.round(new Date().getTime()/1e3)}`}),"createSessionId"),Ic=n(t=>({type:kn,payload:t}),"requestAuth"),mt=n((t,e,r,o)=>({type:Ut,payload:{public_id:t,sig_field:e,ts:r,sig:o}}),"authorize"),de=n(t=>({type:Fe,payload:t}),"unauthorized"),ps=n(t=>({type:qt,payload:t}),"setAuthUrl"),nr=n(t=>({type:Mn,payload:t}),"fetchDone"),ds=n((t=Nn)=>n(function(r,o){if(window.og&&window.og.previewMode)return r(de({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(mt(s,c,l,u)),c=>r(de(c))).finally(()=>r(nr(a)))},"fetchAuthThunk"),"fetchAuth"),kc=n((t,e)=>({type:qn,payload:{status:t,ordering:e}}),"requestOrders"),Wr=n(t=>({type:Ft,payload:t}),"receiveOrders"),Yr=n(t=>({type:Dt,payload:t}),"receiveItems"),sr=n((t=1,e="place")=>n(function(o,s){let{environment:{legoUrl:i},auth:a}=s();if(!a)return o(de("No auth set."));let c=kc(t,e);return o(c),ce.fetchOrders(i,a,t,e).then(l=>{if(l.results){o(Wr(l));let u=(l.results[0]||{}).public_id;if(u)return ce.fetchItems(i,a,u).then(m=>o(Yr(m)))}return o(de(l.detail)),null},l=>o(de(l))).finally(()=>o(nr(c)))},"fetchOrdersThunk"),"fetchOrders"),Jr=n(t=>{switch(t){case zt:return{type:Le,payload:t};case xe:return{type:De,payload:t};case Se:return{type:Me,payload:t};default:throw new Error(`${t} is not a supported environment`)}},"setEnvironment"),fs=n(()=>(t,e)=>{let{merchantId:r,sessionId:o}=e();return(!o||r&&!o.startsWith(r))&&t(zr(r)),o},"requestSessionId"),We=n((t,e)=>({type:P,payload:{...t,offer:e}}),"receiveOffer"),Qr=n(t=>({type:Un,payload:t}),"fetchResponseError"),qc=n((t,e=Ee,r)=>({type:W,payload:{product:t,module:e,offer:r}}),"requestOffer"),hs=n((t,e=Ee,r)=>n(function(s,i){let{merchantId:a,sessionId:c,environment:{apiUrl:l}}=i(),u=qc(t,e,r);s(u);let m=R(t);return m?ce.fetchOffer(l,a,c,m,e).then(p=>s(We(p,r)),p=>s(Qr(p))).finally(()=>s(nr(u))):null},"fetchOfferThunk"),"fetchOffer"),ms=n(()=>({type:je}),"checkout"),Uc=n((t,e,r,o)=>({type:Dn,payload:{product:t,order:e,quantity:r,offerId:o}}),"requestCreateOneTime"),Fc=n(t=>({type:Lt,payload:t}),"receiveCreateOneTime"),Dc=n((t,e)=>({type:Ln,payload:{item:t,frequency:e}}),"requestConvertOneTimeToSubscription"),Lc=n((t,e)=>({type:Mt,payload:{response:t,product:e}}),"receiveConvertOneTime"),gs=n((t,e,r,o=!1,s=null)=>n(function(a,c){let{auth:l,config:u,environment:{legoUrl:m},previewUpsellOffer:p,offerId:f}=c();if(!l)return a(de("No auth set."));let O=rs(s,u),_=Uc(t,e,r,f);return a(_),(p?Promise.resolve({legoUrl:m,product:t,order:e,quantity:r,offer:f}):ce.createOneTime(m,l,t.id,e,r,f)).then(h=>(a(Fc(h)),o?(a(Dc(h,O)),(p?Promise.resolve({item:h,frequency:O}):ce.convertOneTimeToSubscription(m,l,h,O,f)).then(x=>a(Lc(x,t)),x=>a(Qr(x)))):h),h=>a(Qr(h))).finally(()=>a(nr(_)))},"createIuThunk"),"createIu"),ys=n(t=>({type:jt,payload:t}),"setLocale"),bs=n(t=>({type:$t,payload:t}),"setConfig"),_s=n((t,e,r)=>({type:Vt,payload:{selector:t,markup:e,config:r}}),"addTemplate"),Es=n(t=>({type:Ht,payload:t}),"setTemplates"),xs=n((t,e)=>({type:Gt,payload:{product:t,firstOrderPlaceDate:e}}),"setFirstOrderPlaceDate"),Ss=n((t,e)=>({type:Bt,payload:{product:t,productToSubscribe:e}}),"setProductToSubscribe")});var to,we,Ce=E(()=>{to=typeof window!="undefined"&&window.customElements!=null&&window.customElements.polyfillWrapFlushCallback!==void 0,we=n((t,e,r=null)=>{for(;e!==r;){let o=e.nextSibling;t.removeChild(e),e=o}},"removeNodes")});var H,ro,Ms,Ye,Pe,js,yt,Z,cr,fe=E(()=>{H=`{{lit-${String(Math.random()).slice(2)}}}`,ro=`<!--${H}-->`,Ms=new RegExp(`${H}|${ro}`),Ye="$lit$",Pe=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:m}}=e;for(;l<m;){let p=i.nextNode();if(p===null){i.currentNode=s.pop();continue}if(c++,p.nodeType===1){if(p.hasAttributes()){let f=p.attributes,{length:O}=f,_=0;for(let h=0;h<O;h++)js(f[h].name,Ye)&&_++;for(;_-- >0;){let h=u[l],x=cr.exec(h)[2],C=x.toLowerCase()+Ye,b=p.getAttribute(C);p.removeAttribute(C);let y=b.split(Ms);this.parts.push({type:"attribute",index:c,name:x,strings:y}),l+=y.length-1}}p.tagName==="TEMPLATE"&&(s.push(p),i.currentNode=p.content)}else if(p.nodeType===3){let f=p.data;if(f.indexOf(H)>=0){let O=p.parentNode,_=f.split(Ms),h=_.length-1;for(let x=0;x<h;x++){let C,b=_[x];if(b==="")C=Z();else{let y=cr.exec(b);y!==null&&js(y[2],Ye)&&(b=b.slice(0,y.index)+y[1]+y[2].slice(0,-Ye.length)+y[3]),C=document.createTextNode(b)}O.insertBefore(C,p),this.parts.push({type:"node",index:++c})}_[h]===""?(O.insertBefore(Z(),p),o.push(p)):p.data=_[h],l+=h}}else if(p.nodeType===8)if(p.data===H){let f=p.parentNode;(p.previousSibling===null||c===a)&&(c++,f.insertBefore(Z(),p)),a=c,this.parts.push({type:"node",index:c}),p.nextSibling===null?p.data="":(o.push(p),c--),l++}else{let f=-1;for(;(f=p.data.indexOf(H,f+1))!==-1;)this.parts.push({type:"node",index:-1}),l++}}for(let p of o)p.parentNode.removeChild(p)}};n(Pe,"Template");js=n((t,e)=>{let r=t.length-e.length;return r>=0&&t.slice(r)===e},"endsWith"),yt=n(t=>t.index!==-1,"isTemplatePartActive"),Z=n(()=>document.createComment(""),"createMarker"),cr=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/});function no(t,e){let{element:{content:r},parts:o}=t,s=document.createTreeWalker(r,oo,null,!1),i=bt(o),a=o[i],c=-1,l=0,u=[],m=null;for(;s.nextNode();){c++;let p=s.currentNode;for(p.previousSibling===m&&(m=null),e.has(p)&&(u.push(p),m===null&&(m=p)),m!==null&&l++;a!==void 0&&a.index===c;)a.index=m!==null?-1:a.index-l,i=bt(o,i),a=o[i]}u.forEach(p=>p.parentNode.removeChild(p))}function $s(t,e,r=null){let{element:{content:o},parts:s}=t;if(r==null){o.appendChild(e);return}let i=document.createTreeWalker(o,oo,null,!1),a=bt(s),c=0,l=-1;for(;i.nextNode();)for(l++,i.currentNode===r&&(c=zc(e),r.parentNode.insertBefore(e,r));a!==-1&&s[a].index===l;){if(c>0){for(;a!==-1;)s[a].index+=c,a=bt(s,a);return}a=bt(s,a)}}var oo,zc,bt,Vs=E(()=>{fe();oo=133;n(no,"removeNodesFromTemplate");zc=n(t=>{let e=t.nodeType===11?0:1,r=document.createTreeWalker(t,oo,null,!1);for(;r.nextNode();)e++;return e},"countNodes"),bt=n((t,e=-1)=>{for(let r=e+1;r<t.length;r++){let o=t[r];if(yt(o))return r}return-1},"nextActiveIndexInTemplateParts");n($s,"insertNodeIntoTemplate")});var Wc,Re,so=E(()=>{Wc=new WeakMap,Re=n(t=>typeof t=="function"&&Wc.has(t),"isDirective")});var j,lr,io=E(()=>{j={},lr={}});var he,ur=E(()=>{Ce();fe();he=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=to?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],!yt(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 to&&(document.adoptNode(e),customElements.upgrade(e)),e}};n(he,"TemplateInstance")});var Hs,Jc,te,pr=E(()=>{Ce();fe();Hs=window.trustedTypes&&trustedTypes.createPolicy("lit-html",{createHTML:t=>t}),Jc=` ${H} `,te=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=cr.exec(i);c===null?r+=i+(o?Jc:ro):r+=i.substr(0,c.index)+c[1]+c[2]+Ye+c[3]+H}return r+=this.strings[e],r}getTemplateElement(){let e=document.createElement("template"),r=this.getHTML();return Hs!==void 0&&(r=Hs.createHTML(r)),e.innerHTML=r,e}};n(te,"TemplateResult")});var dr,fr,Je,_t,re,Et,xt,hr,Gs,St,Qc,mr=E(()=>{so();Ce();io();ur();pr();fe();dr=n(t=>t===null||!(typeof t=="object"||typeof t=="function"),"isPrimitive"),fr=n(t=>Array.isArray(t)||!!(t&&t[Symbol.iterator]),"isIterable"),Je=class{constructor(e,r,o){this.dirty=!0,this.element=e,this.name=r,this.strings=o,this.parts=[];for(let s=0;s<o.length-1;s++)this.parts[s]=this._createPart()}_createPart(){return new _t(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"||!fr(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(dr(c)||!fr(c))s+=typeof c=="string"?c:String(c);else for(let l of c)s+=typeof l=="string"?l:String(l)}}return s+=e[r],s}commit(){this.dirty&&(this.dirty=!1,this.element.setAttribute(this.name,this._getValue()))}};n(Je,"AttributeCommitter");_t=class{constructor(e){this.value=void 0,this.committer=e}setValue(e){e!==j&&(!dr(e)||e!==this.value)&&(this.value=e,Re(e)||(this.committer.dirty=!0))}commit(){for(;Re(this.value);){let e=this.value;this.value=j,e(this)}this.value!==j&&this.committer.commit()}};n(_t,"AttributePart");re=class{constructor(e){this.value=void 0,this.__pendingValue=void 0,this.options=e}appendInto(e){this.startNode=e.appendChild(Z()),this.endNode=e.appendChild(Z())}insertAfterNode(e){this.startNode=e,this.endNode=e.nextSibling}appendIntoPart(e){e.__insert(this.startNode=Z()),e.__insert(this.endNode=Z())}insertAfterPart(e){e.__insert(this.startNode=Z()),this.endNode=e.endNode,e.endNode=this.startNode}setValue(e){this.__pendingValue=e}commit(){if(this.startNode.parentNode===null)return;for(;Re(this.__pendingValue);){let r=this.__pendingValue;this.__pendingValue=j,r(this)}let e=this.__pendingValue;e!==j&&(dr(e)?e!==this.value&&this.__commitText(e):e instanceof te?this.__commitTemplateResult(e):e instanceof Node?this.__commitNode(e):fr(e)?this.__commitIterable(e):e===lr?(this.value=lr,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 he&&this.value.template===r)this.value.update(e.values);else{let o=new he(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 re(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){we(this.startNode.parentNode,e.nextSibling,this.endNode)}};n(re,"NodePart");Et=class{constructor(e,r,o){if(this.value=void 0,this.__pendingValue=void 0,o.length!==2||o[0]!==""||o[1]!=="")throw new Error("Boolean attributes can only contain a single expression");this.element=e,this.name=r,this.strings=o}setValue(e){this.__pendingValue=e}commit(){for(;Re(this.__pendingValue);){let r=this.__pendingValue;this.__pendingValue=j,r(this)}if(this.__pendingValue===j)return;let e=!!this.__pendingValue;this.value!==e&&(e?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=e),this.__pendingValue=j}};n(Et,"BooleanAttributePart");xt=class extends Je{constructor(e,r,o){super(e,r,o);this.single=o.length===2&&o[0]===""&&o[1]===""}_createPart(){return new hr(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}};n(xt,"PropertyCommitter");hr=class extends _t{};n(hr,"PropertyPart");Gs=!1;(()=>{try{let t={get capture(){return Gs=!0,!1}};window.addEventListener("test",t,t),window.removeEventListener("test",t,t)}catch{}})();St=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(;Re(this.__pendingValue);){let i=this.__pendingValue;this.__pendingValue=j,i(this)}if(this.__pendingValue===j)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=Qc(e),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=e,this.__pendingValue=j}handleEvent(e){typeof this.value=="function"?this.value.call(this.eventContext||this.element,e):this.value.handleEvent(e)}};n(St,"EventPart");Qc=n(t=>t&&(Gs?{capture:t.capture,passive:t.passive,once:t.once}:t.capture),"getOptions")});function ao(t){let e=Ae.get(t.type);e===void 0&&(e={stringsArray:new WeakMap,keyString:new Map},Ae.set(t.type,e));let r=e.stringsArray.get(t.strings);if(r!==void 0)return r;let o=t.strings.join(H);return r=e.keyString.get(o),r===void 0&&(r=new Pe(t,t.getTemplateElement()),e.keyString.set(o,r)),e.stringsArray.set(t.strings,r),r}var Ae,gr=E(()=>{fe();n(ao,"templateFactory");Ae=new Map});var me,co,lo=E(()=>{Ce();mr();gr();me=new WeakMap,co=n((t,e,r)=>{let o=me.get(e);o===void 0&&(we(e,e.firstChild),me.set(e,o=new re(Object.assign({templateFactory:ao},r))),o.appendInto(e)),o.setValue(t),o.commit()},"render")});var yr,uo,po=E(()=>{mr();yr=class{handleAttributeExpressions(e,r,o,s){let i=r[0];return i==="."?new xt(e,r.slice(1),o).parts:i==="@"?[new St(e,r.slice(1),s.eventContext)]:i==="?"?[new Et(e,r.slice(1),o)]:new Je(e,r,o).parts}handleTextExpression(e){return new re(e)}};n(yr,"DefaultTemplateProcessor");uo=new yr});var d,fo=E(()=>{po();pr();po();so();Ce();io();mr();lo();gr();ur();pr();fe();typeof window!="undefined"&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.3.0");d=n((t,...e)=>new te(t,e,"html",uo),"html")});var zs,br,Zc,Xc,el,Ws,tl,Ys,Js=E(()=>{Ce();Vs();lo();gr();ur();fe();fo();zs=n((t,e)=>`${t}--${e}`,"getTemplateCacheKey"),br=!0;typeof window.ShadyCSS=="undefined"?br=!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."),br=!1);Zc=n(t=>e=>{let r=zs(e.type,t),o=Ae.get(r);o===void 0&&(o={stringsArray:new WeakMap,keyString:new Map},Ae.set(r,o));let s=o.stringsArray.get(e.strings);if(s!==void 0)return s;let i=e.strings.join(H);if(s=o.keyString.get(i),s===void 0){let a=e.getTemplateElement();br&&window.ShadyCSS.prepareTemplateDom(a,t),s=new Pe(e,a),o.keyString.set(i,s)}return o.stringsArray.set(e.strings,s),s},"shadyTemplateFactory"),Xc=["html","svg"],el=n(t=>{Xc.forEach(e=>{let r=Ae.get(zs(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)}),no(o,i)})})},"removeStylesFromLitTemplates"),Ws=new Set,tl=n((t,e,r)=>{Ws.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 m=s[u];m.parentNode.removeChild(m),a.textContent+=m.textContent}el(t);let c=o.content;r?$s(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),no(r,u)}},"prepareTemplateStyles"),Ys=n((t,e,r)=>{if(!r||typeof r!="object"||!r.scopeName)throw new Error("The `scopeName` option is required.");let o=r.scopeName,s=me.has(e),i=br&&e.nodeType===11&&!!e.host,a=i&&!Ws.has(o),c=a?document.createDocumentFragment():e;if(co(t,c,Object.assign({templateFactory:Zc(o)},r)),a){let l=me.get(c);me.delete(c);let u=l.value instanceof he?l.value.template:void 0;tl(o,c,u),we(e,e.firstChild),e.appendChild(c),me.set(e,l)}!s&&i&&window.ShadyCSS.styleElement(e.host)},"render")});var Qs,ho,Ks,mo,go,yo,bo,_o,Eo,Tt,xo=E(()=>{window.JSCompiler_renameProperty=(t,e)=>t;ho={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}},Ks=n((t,e)=>e!==t&&(e===e||t===t),"notEqual"),mo={attribute:!0,type:String,converter:ho,reflect:!1,hasChanged:Ks},go=1,yo=1<<2,bo=1<<3,_o=1<<4,Eo="finalized",Tt=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=mo){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)||mo}static finalize(){let e=Object.getPrototypeOf(this);if(e.hasOwnProperty(Eo)||e.finalize(),this[Eo]=!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=Ks){return o(e,r)}static _propertyValueFromAttribute(e,r){let o=r.type,s=r.converter||ho,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||ho.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=mo){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|bo,a==null?this.removeAttribute(i):this.setAttribute(i,a),this._updateState=this._updateState&~bo}}_attributeToProperty(e,r){if(this._updateState&bo)return;let o=this.constructor,s=o._attributeToPropertyMap.get(e);if(s!==void 0){let i=o.getPropertyOptions(s);this._updateState=this._updateState|_o,this[s]=o._propertyValueFromAttribute(r,i),this._updateState=this._updateState&~_o}}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&_o)&&(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|yo;try{await this._updatePromise}catch{}let e=this.performUpdate();return e!=null&&await e,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return this._updateState&yo}get hasUpdated(){return this._updateState&go}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&go||(this._updateState=this._updateState|go,this.firstUpdated(r)),this.updated(r))}_markUpdated(){this._changedProperties=new Map,this._updateState=this._updateState&~yo}get updateComplete(){return this._getUpdateComplete()}_getUpdateComplete(){return this._updatePromise}shouldUpdate(e){return!0}update(e){this._reflectingProperties!==void 0&&this._reflectingProperties.size>0&&(this._reflectingProperties.forEach((r,o)=>this._propertyToAttribute(o,this[o],r)),this._reflectingProperties=void 0),this._markUpdated()}updated(e){}firstUpdated(e){}};n(Tt,"UpdatingElement");Qs=Eo;Tt[Qs]=!0});var Zs,Md,Xs=E(()=>{Zs=Element.prototype,Md=Zs.msMatchesSelector||Zs.webkitMatchesSelector});var _r,So,vt,ei,rl,v,To=E(()=>{_r=window.ShadowRoot&&(window.ShadyCSS===void 0||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,So=Symbol(),vt=class{constructor(e,r){if(r!==So)throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e}get styleSheet(){return this._styleSheet===void 0&&(_r?(this._styleSheet=new CSSStyleSheet,this._styleSheet.replaceSync(this.cssText)):this._styleSheet=null),this._styleSheet}toString(){return this.cssText}};n(vt,"CSSResult");ei=n(t=>new vt(String(t),So),"unsafeCSS"),rl=n(t=>{if(t instanceof vt)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+rl(s)+t[i+1],t[0]);return new vt(r,So)},"css")});var ti,S,w=E(()=>{Js();xo();xo();Xs();fo();To();To();(window.litElementVersions||(window.litElementVersions=[])).push("2.4.0");ti={},S=class extends Tt{static getStyles(){return this.styles}static _getUniqueStyles(){if(this.hasOwnProperty(JSCompiler_renameProperty("_styles",this)))return;let e=this.getStyles();if(Array.isArray(e)){let r=n((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&&!_r){let o=Array.prototype.slice.call(r.cssRules).reduce((s,i)=>s+i.cssText,"");return ei(o)}return r})}initialize(){super.initialize(),this.constructor._getUniqueStyles(),this.renderRoot=this.createRenderRoot(),window.ShadowRoot&&this.renderRoot instanceof window.ShadowRoot&&this.adoptStyles()}createRenderRoot(){return this.attachShadow({mode:"open"})}adoptStyles(){let e=this.constructor._styles;e.length!==0&&(window.ShadyCSS!==void 0&&!window.ShadyCSS.nativeShadow?window.ShadyCSS.ScopingShim.prepareAdoptedCssText(e.map(r=>r.cssText),this.localName):_r?this.renderRoot.adoptedStyleSheets=e.map(r=>r instanceof CSSStyleSheet?r:r.styleSheet):this._needsShimAdoptedStyleSheets=!0)}connectedCallback(){super.connectedCallback(),this.hasUpdated&&window.ShadyCSS!==void 0&&window.ShadyCSS.styleElement(this)}update(e){let r=this.render();super.update(e),r!==ti&&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 ti}};n(S,"LitElement");S.finalized=!0;S.render=Ys});var Er=be((Qd,ri)=>{var ol={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"};ri.exports=ol});var ni=be((Kd,oi)=>{var Ne=Er(),nl=n(t=>{let e="",r=[];for(let o of t){let s=o.charCodeAt(0);switch(s){case Ne.PAR_OPEN:case Ne.PAR_CLOSE:case Ne.OP_NOT:case Ne.BINARY_AND:case Ne.BINARY_OR:e&&(r.push({type:Ne.LITERAL,value:e}),e=""),r.push({type:s,value:o});break;default:e+=o}}return e&&r.push({type:Ne.LITERAL,value:e}),r},"Tokenizer");oi.exports=nl});var ii=be((Zd,si)=>{var ge=Er(),sl=n(t=>{let e=[],r=[];return t.forEach(s=>{switch(s.type){case ge.LITERAL:e.unshift(s);break;case ge.BINARY_AND:case ge.BINARY_OR:case ge.OP_NOT:case ge.PAR_OPEN:r.push(s);break;case ge.PAR_CLOSE:for(;r.length&&r[r.length-1].type!==ge.PAR_OPEN;)e.unshift(r.pop());r.pop(),r.length&&r[r.length-1].type===ge.OP_NOT&&e.unshift(r.pop());break;default:break}}),r.length&&[...r.reverse(),...e]||e},"PolishNotation"),il=n(function*(t){for(let e=0;e<t.length-1;e++)yield t[e];return t[t.length-1]},"PolishGenerator");si.exports={PolishNotation:sl,PolishGenerator:il}});var ci=be((Xd,ai)=>{var $=Er(),B=class{constructor(e,r,o,s){this.op=e,this.left=r,this.right=o,this.literal=s}isLeaf(){return this.op===$.LEAF}isAtomic(){return this.isLeaf()||this.op===$.OP_NOT&&this.left.isLeaf()}getLiteralValue(){return this.literal}static CreateAnd(e,r){return new B($.BINARY_AND,e,r)}static CreateNot(e){return new B($.OP_NOT,e)}static CreateOr(e,r){return new B($.BINARY_OR,e,r)}static CreateLiteral(e){return new B($.LEAF,null,null,e)}};n(B,"ExpNode");var Qe=n(t=>{let e=t.next().value;switch(e.type){case $.LITERAL:return B.CreateLiteral(e.value);case $.OP_NOT:return B.CreateNot(Qe(t));case $.BINARY_AND:{let r=Qe(t),o=Qe(t);return B.CreateAnd(r,o)}case $.BINARY_OR:{let r=Qe(t),o=Qe(t);return B.CreateOr(r,o)}}return null},"make"),Ke=n((t,e)=>{if(t.isLeaf())return e(t.getLiteralValue());if(t.op===$.OP_NOT)return!Ke(t.left,e);if(t.op===$.BINARY_OR)return Ke(t.left,e)||Ke(t.right,e);if(t.op===$.BINARY_AND)return Ke(t.left,e)&&Ke(t.right,e)},"nodeEvaluator");ai.exports={make:Qe,nodeEvaluator:Ke}});var di=be((ef,pi)=>{var al=ni(),li=ii(),ui=ci(),cl=n((t,e)=>{let r=al(t),o=li.PolishNotation(r),s=li.PolishGenerator(o),i=ui.make(s);return ui.nodeEvaluator(i,e)},"parse");pi.exports={parse:cl}});var Hi={};Ar(Hi,{TestWizard:()=>Cr,default:()=>ql});var Cr,ql,Gi=E(()=>{w();I();Cr=class extends S{static get styles(){return v`
13
13
  :host {
14
14
  position: fixed;
15
15
  top: 5em;
@@ -100,16 +100,16 @@ var lib=(()=>{var aa=Object.create;var Ze=Object.defineProperty;var ca=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($e({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(Vr({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`
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(We({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(Yr({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(vr,"TestWizard");xl=vr});var Au={};wr(Au,{addOptinChangedCallback:()=>cu,addTemplate:()=>lu,autoInit:()=>Pu,clear:()=>uu,config:()=>pu,default:()=>Ru,disableOptinChangedCallbacks:()=>du,getOptins:()=>fu,getProductsForPurchasePost:()=>hu,initialize:()=>mu,isReady:()=>au,offers:()=>x,platform:()=>F,previewMode:()=>gu,register:()=>yu,resolveSettings:()=>bu,setAuthUrl:()=>_u,setEnvironment:()=>Eu,setLocale:()=>xu,setMerchantId:()=>Su,setPublicPath:()=>Tu,setTemplates:()=>vu,setupCart:()=>Ou,setupProduct:()=>wu,setupProducts:()=>Cu,store:()=>oa});function Cr(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(Cr,"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 fa=Cr(Ae),Pr=fa;var Rr=n(function(){return Math.random().toString(36).substring(7).split("").join(".")},"randomString"),Xe={INIT:"@@redux/INIT"+Rr(),REPLACE:"@@redux/REPLACE"+Rr(),PROBE_UNKNOWN_ACTION:n(function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Rr()},"PROBE_UNKNOWN_ACTION")};function ha(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(ha,"isPlainObject");function Ar(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(Ar)(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(!ha(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,C=0;C<E.length;C++){var b=E[C];b()}return f}n(m,"dispatch");function T(f){if(typeof f!="function")throw new Error("Expected the nextReducer to be a function.");s=f,m({type:Xe.REPLACE})}n(T,"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 Ot=E(g);return{unsubscribe:Ot}},"subscribe")},f[Pr]=function(){return this},f}return n(_,"observable"),m({type:Xe.INIT}),o={dispatch:m,subscribe:p,getState:h,replaceReducer:T},o[Pr]=_,o}n(Ar,"createStore");function ma(t,e){var r=e&&e.type,o=r&&'action "'+String(r)+'"'||"an action";return"Given "+o+', reducer "'+t+'" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.'}n(ma,"getUndefinedStateErrorMessage");function ga(t){Object.keys(t).forEach(function(e){var r=t[e],o=r(void 0,{type:Xe.INIT});if(typeof o=="undefined")throw new Error('Reducer "'+e+`" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`);if(typeof r(void 0,{type:Xe.PROBE_UNKNOWN_ACTION()})=="undefined")throw new Error('Reducer "'+e+'" returned undefined when probed with a random type. '+("Don't try to handle "+Xe.INIT+' or other actions in "redux/*" ')+"namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.")})}n(ga,"assertReducerShape");function wt(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{ga(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,T={},_=0;_<i.length;_++){var f=i[_],E=r[f],C=u[f],b=E(C,h);if(typeof b=="undefined"){var g=ma(f,h);throw new Error(g)}T[f]=b,m=m||b!==C}return m=m||i.length!==Object.keys(u).length,m?T:u},"combination")}n(wt,"combineReducers");function gn(t,e){return function(){return e(t.apply(this,arguments))}}n(gn,"bindActionCreator");function yn(t,e){if(typeof t=="function")return gn(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]=gn(s,e))}return r}n(yn,"bindActionCreators");function ya(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}n(ya,"_defineProperty");function bn(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(bn,"ownKeys");function ba(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?bn(r,!0).forEach(function(o){ya(t,o,r[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):bn(r).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(r,o))})}return t}n(ba,"_objectSpread2");function Nr(){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(Nr,"compose");function _n(){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=Nr.apply(void 0,c)(s.dispatch),ba({},s,{dispatch:i})}}}n(_n,"applyMiddleware");function En(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(En,"createThunkMiddleware");var xn=En();xn.withExtraArgument=En;var Sn=xn;var fs=re(Pt());q();D();var dt="OG_STATE",hs=n(t=>{try{return t===null?void 0:JSON.parse(t)}catch{return}},"safeParseState"),Gr=n(()=>window.og&&window.og.previewMode,"isPreviewMode"),ms=n(()=>Gr()?{}:hs(localStorage.getItem(dt)),"loadState"),_c=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"),gs=n(t=>{if(Gr())return;let e=_c(t);e&&localStorage.getItem(dt)!==e&&localStorage.setItem(dt,e)},"saveState"),ys=n(t=>(0,fs.throttle)(500,e=>{if(Gr())return;let{key:r,newValue:o}=e;r===dt&&o===null?(t.dispatch({type:oe}),setTimeout(()=>t.dispatch(os()),0)):r===dt&&t.dispatch({type:me,newValue:hs(o)})}),"listenLocalStorageChanges");var _s=re(Pt());D();function Ec(t,e){return t===e}n(Ec,"defaultEqualityCheck");function xc(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(xc,"areArgumentsShallowlyEqual");function Sc(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ec,r=null,o=null;return function(){return xc(e,r,arguments)||(o=t.apply(null,arguments)),r=arguments,o}}n(Sc,"defaultMemoize");function Tc(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(Tc,"getDependencies");function vc(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=Tc(i),h=t.apply(void 0,[function(){return c++,l.apply(null,arguments)}].concat(r)),p=t(function(){for(var m=[],T=u.length,_=0;_<T;_++)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(vc,"createSelectorCreator");var Ve=vc(Sc);var Se=re(nt());ie();lt();L();Se.default.Cache=Map;function Oc(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(Oc,"arraysEqual");function wc(t,e,r){let o=ct(r);return F.shopify_selling_plans?Y(t,e,o):o}n(wc,"resolveFrequency");var I=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))||Oc((t.components||[]).sort(),(e.components||[]).sort()))),"isSameProduct"),er=n(t=>t.optedin||[],"optedinSelector"),bs=n(t=>t.optedout||[],"optedoutSelector"),zr=n(t=>t.autoshipByDefault||{},"autoshipSelector"),Cc=n(t=>t.defaultFrequencies||{},"defaultFrequenciesSelector"),Pc=n(t=>{var e;return((e=t==null?void 0:t.config)==null?void 0:e.frequencies)||[]},"sellingPlansSelector"),Rc=n(t=>{var e;return((e=t==null?void 0:t.config)==null?void 0:e.frequenciesEveryPeriod)||[]},"frequenciesEveryPeriodSelector"),Z=(0,Se.default)(t=>Ve(er,bs,zr,(e,r,o)=>{let s=e.find(i=>I(t,i));return s||(r.find(i=>I(t,i))?!1:t&&o[t.id]?{id:t.id}:!1)}),t=>JSON.stringify(t)),tr=(0,Se.default)(t=>Ve(er,e=>{let r=e.find(o=>I(t,o));return r||!1}),t=>JSON.stringify(t)),rr=(0,Se.default)(t=>Ve(bs,e=>e.find(r=>I(t,r))));var J=(0,Se.default)(t=>Ve(Z(t),e=>e&&e.frequency||null)),He=(0,Se.default)(t=>Ve(Cc,Pc,Rc,(e,r,o)=>e[R(t)]&&wc(r,o,e[R(t)])||null)),Wr=n(t=>t.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase(),"kebabCase"),$=n((t,e,r,o)=>({[r]:t.config&&t.config[r]||e&&e.hasAttribute&&e.hasAttribute(Wr(r))&&e[r]||e.offer&&typeof(e.offer[r]!=="undefined")&&e.offer[r]||o}),"configSelector"),Be=n(t=>({templates:t.templates||[]}),"templatesSelector");var Ac=n((t,e,r=document)=>r.dispatchEvent(new CustomEvent(t,{detail:e})),"dispatchEvent"),Es=n(t=>({payload:{product:{id:e,components:r}={}}={}}={})=>setTimeout(()=>Ac("optin-changed",{productId:e,components:r,optedIn:t}),0),"dispatchOptinChangedEvent"),Nc=[{expressions:[({type:t}={})=>t===A,({type:t}={})=>t===k],fn:Es(!0)},{expressions:[({type:t}={})=>t===N],fn:Es(!1)}],xs=n(t=>e=>r=>{let o=t.getState();Nc.forEach(s=>{s.expressions.some(i=>i(r,o))&&s.fn(r)}),e(r)},"dispatchMiddleware"),Ss=n(t=>e=>r=>{var s;let o;switch(r.type){case P:case N:case A:case k: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"),Ts=n(t=>e=>r=>{e(r);let o=(0,_s.throttle)(500,()=>{gs({...t.getState()})});r.type!==me&&o()},"localStorageMiddleware");q();D();var Yr=n(()=>{let t,e;return[new Promise((r,o)=>{t=r,e=o}),t,e]},"waitFor");function vs(t){let[e,r]=Yr(),[o,s]=Yr(),[i,a]=Yr();o.then(l=>{let{sessionId:u}=t.getState();!u||l&&!u.startsWith(l)?t.dispatch(jr(l)):a(u)});let c=Promise.all([o,e,i]);return c.then(()=>{var l;window.addEventListener("storage",ys(t)),((l=t.getState().auth)==null?void 0:l.ts)||t.dispatch(rs())}),l=>async u=>{Fe===u.type||Ie===u.type||Ue===u.type?r(u.payload):Ne===u.type?s(u.payload):ke===u.type?a(u.payload):await c,l(u)}}n(vs,"waitUntilOffersReady");function Os(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"}):Nr,s=[vs,Sn,xs,Ss],i={};if(!r)try{i=ms(),s.push(Ts)}catch{}let a=o(_n(...s,...e.filter(l=>l))),c=Ar(t,i,a);return window.og=window.og||{},window.og.store=c,c}n(Os,"makeStore");var kc=Object.defineProperty,or=n((t,e)=>kc(t,"name",{value:e,configurable:!0}),"i"),qc=or(t=>e=>t.indexOf(e.origin)>=0,"createIsMessageAllowed"),ws=["https://rc3.ordergroove.com","https://rc3.stg.ordergroove.com","http://localhost:3000",window.location.origin],Cs=or(t=>(e,r)=>{ws.forEach(o=>t.postMessage({ogType:e,...r},o))},"createBroadcastMessage");function Jr(t=window.opener,e=window.og){let r=or(o=>{let s=qc(ws),i=Cs(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),Cs(t)("READY"))}n(Jr,"f");or(Jr,"offersLiveEditor");var nr=null,Ic=n(t=>({dispatch:t}),"defaultMapDispatchToProps"),Ps=n(t=>{if(!nr)throw new Error("Missing redux store.");return nr},"resolveStore"),Fc=n((t,e)=>r=>{let{getState:o,dispatch:s}=Ps(r),i=t?t(o(),r):{},a=e(s,r);Object.assign(r,i,a)},"createRecalcProps"),y=n((t,e=Ic)=>r=>{let s=Fc(t,typeof e=="function"?e:i=>yn(e,i));return class extends r{get store(){return nr}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this._storeUnsubscribe=Ps(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"),Rs=n(t=>{nr=t},"setStore");ie();var Qr=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],...at(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");q();w();var pi=re(oi());w();var Xc=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"),ni=n(t=>t.hasAttribute("product")&&{id:t.getAttribute("product"),...t.hasAttribute("product-components")&&{components:JSON.parse(t.getAttribute("product-components"))}},"buildProduct");var Eo=n(t=>{let e=ni(t);if(!e){let r=t.offer;r&&(e=ni(r))}return e},"resolveProduct"),el=n(t=>{let e=t;for(;e;){if(e.tagName==="OG-OFFER")return e;e=e.nodeType===11?e.host:e.parentNode}},"resolveOffer"),xo=n(t=>class extends t{get offer(){return el(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"),U=n(t=>class extends xo(t){get product(){return Eo(this)}},"withProduct"),br=n(t=>class extends t{get childOptions(){let e=[],r=null;return this.querySelectorAll("option").forEach(o=>{let s=Xc(o.value),i=o.innerText.trim();e.push({value:s,text:i}),!r&&o.selected&&(r=s)}),{options:e,isSelected:r}}},"withChildOptions");var _r={};wr(_r,{autoshipByDefault:()=>tl,eligibilityGroups:()=>ai,eligible:()=>si,hasUpcomingOrder:()=>li,hasUpsellGroup:()=>ci,inStock:()=>So,optedout:()=>ol,regularEligible:()=>sl,subscribed:()=>rl,subscriptionEligible:()=>ii,upcomingOrderContainsProduct:()=>nl,upsellEligible:()=>ui});var So=n((t,e)=>(t.inStock||{})[(e.product||{}).id],"inStock"),si=n((t,e)=>(t.autoshipEligible||{})[(e.product||{}).id]||!1,"eligible"),tl=n((t,e)=>(t.autoshipByDefault||{})[(e.product||{}).id]||!1,"autoshipByDefault"),ii=n((t,e)=>(t.offerId&&t.offerId!=="0"||!1)&&si(t,e)&&So(t,e),"subscriptionEligible"),ai=n((t,e)=>(t.eligibilityGroups||{})[(e.product||{}).id]||null,"eligibilityGroups"),ci=n((t,e)=>{let r=ai(t,e);return r===null||!!r.find(o=>o==="upsell"||o==="impulse_upsell")},"hasUpsellGroup"),rl=n((t,e)=>tr(e.product)(t),"subscribed"),ol=n((t,e)=>rr(e.product)(t),"optedout"),li=n(t=>!!(t.nextUpcomingOrder&&t.nextUpcomingOrder.public_id),"hasUpcomingOrder"),nl=n((t,e)=>(t.nextUpcomingOrder&&t.nextUpcomingOrder.products||[]).includes((e.product||{}).id),"upcomingOrderContainsProduct"),ui=n((t,e)=>{var r;return!((r=e.offer)==null?void 0:r.isCart)&&t.offerId&&t.offerId!=="0"&&t.auth&&So(t,e)&&li(t)&&ci(t,e)},"upsellEligible"),sl=n((t,e)=>ii(t,e)&&!ui(t,e),"regularEligible");var il=n(t=>t.replace(/(\r\n|\n|\r|\s)+/gm,""),"removeWhitespace"),To=class extends U(v){static get properties(){return{...super.properties,state:{type:Object,attribute:!1},test:{type:String}}}render(){return this.test&&pi.default.parse(il(this.test),r=>_r[r]&&_r[r](this.state,this))?d`
110
+ `}};n(Cr,"TestWizard");ql=Cr});var Gu={};Ar(Gu,{addOptinChangedCallback:()=>Su,addTemplate:()=>Tu,autoInit:()=>Vu,clear:()=>vu,config:()=>Ou,default:()=>Hu,disableOptinChangedCallbacks:()=>wu,getOptins:()=>Cu,getProductsForPurchasePost:()=>Pu,initialize:()=>Ru,isReady:()=>xu,offers:()=>T,platform:()=>F,previewMode:()=>Au,register:()=>Nu,resolveSettings:()=>Iu,setAuthUrl:()=>ku,setEnvironment:()=>qu,setLocale:()=>Uu,setMerchantId:()=>Fu,setPublicPath:()=>Du,setTemplates:()=>Lu,setupCart:()=>Mu,setupProduct:()=>ju,setupProducts:()=>$u,store:()=>fa});function Nr(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(Nr,"symbolObservablePonyfill");var ke;typeof self!="undefined"?ke=self:typeof window!="undefined"||typeof window!="undefined"?ke=window:typeof module!="undefined"?ke=module:ke=Function("return this")();var Ta=Nr(ke),Ir=Ta;var kr=n(function(){return Math.random().toString(36).substring(7).split("").join(".")},"randomString"),rt={INIT:"@@redux/INIT"+kr(),REPLACE:"@@redux/REPLACE"+kr(),PROBE_UNKNOWN_ACTION:n(function(){return"@@redux/PROBE_UNKNOWN_ACTION"+kr()},"PROBE_UNKNOWN_ACTION")};function va(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(va,"isPlainObject");function qr(t,e,r){var o;if(typeof e=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error("It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function.");if(typeof e=="function"&&typeof r=="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(qr)(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 m(){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(m,"getState");function p(h){if(typeof h!="function")throw new Error("Expected the listener to be a function.");if(l)throw new Error("You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api-reference/store#subscribelistener for more details.");var x=!0;return u(),c.push(h),n(function(){if(!!x){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.");x=!1,u();var b=c.indexOf(h);c.splice(b,1),a=null}},"unsubscribe")}n(p,"subscribe");function f(h){if(!va(h))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(typeof h.type=="undefined")throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(l)throw new Error("Reducers may not dispatch actions.");try{l=!0,i=s(i,h)}finally{l=!1}for(var x=a=c,C=0;C<x.length;C++){var b=x[C];b()}return h}n(f,"dispatch");function O(h){if(typeof h!="function")throw new Error("Expected the nextReducer to be a function.");s=h,f({type:rt.REPLACE})}n(O,"replaceReducer");function _(){var h,x=p;return h={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(m())}n(y,"observeState"),y();var Rt=x(y);return{unsubscribe:Rt}},"subscribe")},h[Ir]=function(){return this},h}return n(_,"observable"),f({type:rt.INIT}),o={dispatch:f,subscribe:p,getState:m,replaceReducer:O},o[Ir]=_,o}n(qr,"createStore");function Oa(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(Oa,"getUndefinedStateErrorMessage");function wa(t){Object.keys(t).forEach(function(e){var r=t[e],o=r(void 0,{type:rt.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:rt.PROBE_UNKNOWN_ACTION()})=="undefined")throw new Error('Reducer "'+e+'" returned undefined when probed with a random type. '+("Don't try to handle "+rt.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(wa,"assertReducerShape");function At(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{wa(r)}catch(l){c=l}return n(function(u,m){if(u===void 0&&(u={}),c)throw c;if(!1)var p;for(var f=!1,O={},_=0;_<i.length;_++){var h=i[_],x=r[h],C=u[h],b=x(C,m);if(typeof b=="undefined"){var y=Oa(h,m);throw new Error(y)}O[h]=b,f=f||b!==C}return f=f||i.length!==Object.keys(u).length,f?O:u},"combination")}n(At,"combineReducers");function xn(t,e){return function(){return e(t.apply(this,arguments))}}n(xn,"bindActionCreator");function Sn(t,e){if(typeof t=="function")return xn(t,e);if(typeof t!="object"||t===null)throw new Error("bindActionCreators expected an object or a function, instead received "+(t===null?"null":typeof t)+'. Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?');var r={};for(var o in t){var s=t[o];typeof s=="function"&&(r[o]=xn(s,e))}return r}n(Sn,"bindActionCreators");function Ca(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}n(Ca,"_defineProperty");function Tn(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(Tn,"ownKeys");function Pa(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Tn(r,!0).forEach(function(o){Ca(t,o,r[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Tn(r).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(r,o))})}return t}n(Pa,"_objectSpread2");function Ur(){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(Ur,"compose");function vn(){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=Ur.apply(void 0,c)(s.dispatch),Pa({},s,{dispatch:i})}}}n(vn,"applyMiddleware");function On(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(On,"createThunkMiddleware");var wn=On();wn.withExtraArgument=On;var Cn=wn;var Ts=ne(It());I();L();var gt="OG_STATE",vs=n(t=>{try{return t===null?void 0:JSON.parse(t)}catch{return}},"safeParseState"),Kr=n(()=>window.og&&window.og.previewMode,"isPreviewMode"),Os=n(()=>Kr()?{}:vs(localStorage.getItem(gt)),"loadState"),Mc=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"),ws=n(t=>{if(Kr())return;let e=Mc(t);e&&localStorage.getItem(gt)!==e&&localStorage.setItem(gt,e)},"saveState"),Cs=n(t=>(0,Ts.throttle)(500,e=>{if(Kr())return;let{key:r,newValue:o}=e;r===gt&&o===null?(t.dispatch({type:ie}),setTimeout(()=>t.dispatch(fs()),0)):r===gt&&t.dispatch({type:_e,newValue:vs(o)})}),"listenLocalStorageChanges");var Ps=ne(It());L();D();var jc=n((t,e,r=document)=>r.dispatchEvent(new CustomEvent(t,{detail:e})),"dispatchEvent"),Rs=n(t=>({payload:{product:{id:e,components:r}={}}={}}={})=>setTimeout(()=>jc("optin-changed",{productId:e,components:r,optedIn:t}),0),"dispatchOptinChangedEvent"),$c=[{expressions:[({type:t}={})=>t===A,({type:t}={})=>t===U],fn:Rs(!0)},{expressions:[({type:t}={})=>t===q],fn:Rs(!1)}],As=n(t=>e=>r=>{let o=t.getState();$c.forEach(s=>{s.expressions.some(i=>i(r,o))&&s.fn(r)}),e(r)},"dispatchMiddleware"),Ns=n(t=>e=>r=>{var s;let o;switch(r.type){case P:case q:case A: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"),Is=n(t=>e=>r=>{e(r);let o=(0,Ps.throttle)(500,()=>{ws({...t.getState()})});r.type!==_e&&o()},"localStorageMiddleware");I();L();var Zr=n(()=>{let t,e;return[new Promise((r,o)=>{t=r,e=o}),t,e]},"waitFor");function ks(t){let[e,r]=Zr(),[o,s]=Zr(),[i,a]=Zr();o.then(l=>{let{sessionId:u}=t.getState();!u||l&&!u.startsWith(l)?t.dispatch(zr(l)):a(u)});let c=Promise.all([o,e,i]);return c.then(()=>{var l;window.addEventListener("storage",Cs(t)),((l=t.getState().auth)==null?void 0:l.ts)||t.dispatch(ds())}),l=>async u=>{Le===u.type||De===u.type||Me===u.type?r(u.payload):qe===u.type?s(u.payload):Ue===u.type?a(u.payload):await c,l(u)}}n(ks,"waitUntilOffersReady");function qs(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"}):Ur,s=[ks,Cn,As,Ns],i={};if(!r)try{i=Os(),s.push(Is)}catch{}let a=o(vn(...s,...e.filter(l=>l))),c=qr(t,i,a);return window.og=window.og||{},window.og.store=c,c}n(qs,"makeStore");var Vc=Object.defineProperty,ir=n((t,e)=>Vc(t,"name",{value:e,configurable:!0}),"i"),Hc=ir(t=>e=>t.indexOf(e.origin)>=0,"createIsMessageAllowed"),Us=["https://rc3.ordergroove.com","https://rc3.stg.ordergroove.com","http://localhost:3000",window.location.origin],Fs=ir(t=>(e,r)=>{Us.forEach(o=>t.postMessage({ogType:e,...r},o))},"createBroadcastMessage");function Xr(t=window.opener,e=window.og){let r=ir(o=>{let s=Hc(Us),i=Fs(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),Fs(t)("READY"))}n(Xr,"f");ir(Xr,"offersLiveEditor");var ar=null,Gc=n(t=>({dispatch:t}),"defaultMapDispatchToProps"),Ds=n(t=>{if(!ar)throw new Error("Missing redux store.");return ar},"resolveStore"),Bc=n((t,e)=>r=>{let{getState:o,dispatch:s}=Ds(r),i=t?t(o(),r):{},a=e(s,r);Object.assign(r,i,a)},"createRecalcProps"),g=n((t,e=Gc)=>r=>{let s=Bc(t,typeof e=="function"?e:i=>Sn(e,i));return class extends r{get store(){return ar}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this._storeUnsubscribe=Ds(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"),Ls=n(t=>{ar=t},"setStore");le();var eo=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],...ut(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");I();w();var _i=ne(di());w();var ll=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"),fi=n(t=>t.hasAttribute("product")&&{id:t.getAttribute("product"),...t.hasAttribute("product-components")&&{components:JSON.parse(t.getAttribute("product-components"))}},"buildProduct");var vo=n(t=>{let e=fi(t);if(!e){let r=t.offer;r&&(e=fi(r))}return e},"resolveProduct"),ul=n(t=>{let e=t;for(;e;){if(e.tagName==="OG-OFFER")return e;e=e.nodeType===11?e.host:e.parentNode}},"resolveOffer"),Oo=n(t=>class extends t{get offer(){return ul(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"),k=n(t=>class extends Oo(t){get product(){return vo(this)}},"withProduct"),xr=n(t=>class extends t{get childOptions(){let e=[],r=null;return this.querySelectorAll("option").forEach(o=>{let s=ll(o.value),i=o.innerText.trim();e.push({value:s,text:i}),!r&&o.selected&&(r=s)}),{options:e,isSelected:r}}},"withChildOptions");var Sr={};Ar(Sr,{autoshipByDefault:()=>pl,eligibilityGroups:()=>Co,eligible:()=>hi,hasUpcomingOrder:()=>yi,hasUpsellGroup:()=>gi,inStock:()=>wo,optedout:()=>hl,prepaidEligible:()=>dl,prepaidSubscribed:()=>ml,regularEligible:()=>yl,subscribed:()=>fl,subscriptionEligible:()=>mi,upcomingOrderContainsProduct:()=>gl,upsellEligible:()=>bi});D();var wo=n((t,e)=>(t.inStock||{})[(e.product||{}).id],"inStock"),hi=n((t,e)=>(t.autoshipEligible||{})[(e.product||{}).id]||!1,"eligible"),pl=n((t,e)=>(t.autoshipByDefault||{})[(e.product||{}).id]||!1,"autoshipByDefault"),mi=n((t,e)=>(t.offerId&&t.offerId!=="0"||!1)&&hi(t,e)&&wo(t,e),"subscriptionEligible"),Co=n((t,e)=>(t.eligibilityGroups||{})[(e.product||{}).id]||null,"eligibilityGroups"),gi=n((t,e)=>{let r=Co(t,e);return r===null||!!r.find(o=>o==="upsell"||o==="impulse_upsell")},"hasUpsellGroup"),dl=n((t,e)=>{let r=Co(t,e);return(r==null?void 0:r.some(o=>o==="prepaid"))||!1},"prepaidEligible"),fl=n((t,e)=>Xt(e.product)(t),"subscribed"),hl=n((t,e)=>er(e.product)(t),"optedout"),ml=n((t,e)=>es(e.product)(t),"prepaidSubscribed"),yi=n(t=>!!(t.nextUpcomingOrder&&t.nextUpcomingOrder.public_id),"hasUpcomingOrder"),gl=n((t,e)=>(t.nextUpcomingOrder&&t.nextUpcomingOrder.products||[]).includes((e.product||{}).id),"upcomingOrderContainsProduct"),bi=n((t,e)=>{var r;return!((r=e.offer)==null?void 0:r.isCart)&&t.offerId&&t.offerId!=="0"&&t.auth&&wo(t,e)&&yi(t)&&gi(t,e)},"upsellEligible"),yl=n((t,e)=>mi(t,e)&&!bi(t,e),"regularEligible");var bl=n(t=>t.replace(/(\r\n|\n|\r|\s)+/gm,""),"removeWhitespace"),Po=class extends k(S){static get properties(){return{...super.properties,state:{type:Object,attribute:!1},test:{type:String}}}render(){return this.test&&_i.default.parse(bl(this.test),r=>Sr[r]&&Sr[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(To,"When");var al=n(t=>({state:t}),"mapStateToProps"),di=y(al)(To);w();q();w();ie();var fi={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&&Ur(t)?t:null}}},Er={type:Boolean,attribute:!0,reflect:!0},Je={type:Object,attribute:!1};w();var cl=n(t=>class extends t{getOption(e,r=e){let o=Wr(e);if(this.hasAttribute(o)){let s=this.getAttribute(o);return s.toString().toLowerCase()==="true"?!0:s.toString().toLowerCase()==="false"?!1:s}if(this.template&&this.template.config&&typeof this.template.config[r]!="undefined")return this.template.config[r];if(this.config&&typeof this.config[r]!="undefined")return this.config[r]}applyTemplate(e){this.template=e;let r=typeof e.markup=="undefined"?this.constructor.initialTemplate:e.markup;r&&this._templateMarkup!==r&&(this._templateMarkup=r,this.innerHTML=r)}refreshTemplate(){if(this._templates&&this._templates.length){let e=this._templates.find(({selector:r})=>{try{return this.matches(r)}catch{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"),H=cl(v);var G=class extends U(H){static get properties(){return{subscribed:Er,frequencyMatch:{type:Boolean,reflect:!0,attribute:"frequency-match"},productDefaultFrequency:{type:String},defaultFrequency:{type:String},frequencies:{type:Array}}}static get styles(){return O`
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(Po,"When");var _l=n(t=>({state:t}),"mapStateToProps"),Ei=g(_l)(Po);w();I();w();D();le();var xi={type:Object,converter:{toAttribute(t){return t==null?t:JSON.stringify(t)},fromAttribute(t){return t&&t.match(/[{[]/)?JSON.parse(t):{id:t}}}},ye={type:String,attribute:"default-frequency",converter:{fromAttribute(t){return t&&jr(t)?t:null}}},Tr={type:Boolean,attribute:!0,reflect:!0},Ze={type:Object,attribute:!1};w();D();var El=n(t=>class extends t{getOption(e,r=e){let o=Hr(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"),G=El(S);var z=class extends k(G){static get properties(){return{subscribed:Tr,frequencyMatch:{type:Boolean,reflect:!0,attribute:"frequency-match"},productDefaultFrequency:{type:String},defaultFrequency:{type:String},frequencies:{type:Array}}}static get styles(){return v`
113
113
  :host {
114
114
  cursor: default;
115
115
  display: inline-block;
@@ -183,7 +183,7 @@ var lib=(()=>{var aa=Object.create;var Ze=Object.defineProperty;var ca=Object.ge
183
183
  <slot name="frequency-mismatch"></slot>
184
184
  `:d`
185
185
  <slot name="not-subscribed"></slot>
186
- `}};n(G,"OptinStatus");var te=n((t,e={})=>({subscribed:Z(e.product)(t),frequency:J(e.product)(t),productDefaultFrequency:He((e.product||{}).id)(t),...$(t,e,"defaultFrequency"),...$(t,e,"frequencies"),...Be(t,e)}),"mapStateToProps"),hi=y(te)(G);L();lt();var vo=class extends G{static get properties(){return{...super.properties,frequency:{type:String,reflect:!0},defaultFrequency:fe,optinButtonLabel:{type:String}}}updated(e){if(e.has("subscribed")||e.has("frequencies")){if(F.shopify_selling_plans&&this.store){let r=this.getAttribute("default-frequency");r=Mr(r,this.store.getState().config),this.sellingPlanFreq=r}this.frequencyMatch=this.frequency===this.optinFrequency}}get optinFrequency(){let e;return this.sellingPlanFreq?e=this.sellingPlanFreq:this.hasAttribute("default-frequency")?e=this.getAttribute("default-frequency"):e=this.offer?this.offer.defaultFrequency:this.defaultFrequency,F.shopify_selling_plans&&this.store&&(e=Mr(e,this.store.getState().config)),e}handleClick(e){this.optinProduct(Eo(this),this.optinFrequency,this.offer),e.preventDefault()}render(){return d`
186
+ `}};n(z,"OptinStatus");var oe=n((t,e={})=>({subscribed:J(e.product)(t),frequency:Q(e.product)(t),productDefaultFrequency:Ve((e.product||{}).id)(t),...V(t,e,"defaultFrequency"),...V(t,e,"frequencies"),...He(t,e)}),"mapStateToProps"),Si=g(oe)(z);M();dt();var Ro=class extends z{static get properties(){return{...super.properties,frequency:{type:String,reflect:!0},defaultFrequency:ye,optinButtonLabel:{type:String}}}updated(e){if(e.has("subscribed")||e.has("frequencies")){if(F.shopify_selling_plans&&this.store){let r=this.getAttribute("default-frequency");r=Br(r,this.store.getState().config),this.sellingPlanFreq=r}this.frequencyMatch=this.frequency===this.optinFrequency}}get optinFrequency(){let e;return this.sellingPlanFreq?e=this.sellingPlanFreq:this.hasAttribute("default-frequency")?e=this.getAttribute("default-frequency"):e=this.offer?this.offer.defaultFrequency:this.defaultFrequency,F.shopify_selling_plans&&this.store&&(e=Br(e,this.store.getState().config)),e}handleClick(e){this.optinProduct(vo(this),this.optinFrequency,this.offer),e.preventDefault()}render(){return d`
187
187
  <slot name="default">
188
188
  <button id="action-trigger" class="btn radio ${this.subscribed?"active":""}"></button>
189
189
  <label for="action-trigger">
@@ -192,7 +192,7 @@ var lib=(()=>{var aa=Object.create;var Ze=Object.defineProperty;var ca=Object.ge
192
192
  </slot>
193
193
  </label>
194
194
  </slot>
195
- `}};n(vo,"OptinButton");var mi=y(te,{optinProduct:ae})(vo);w();q();var Oo=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`
195
+ `}};n(Ro,"OptinButton");var Ti=g(oe,{optinProduct:pe})(Ro);w();I();var Ao=class extends z{static get properties(){return{...super.properties,label:{type:String}}}handleClick(e){this.optoutProduct(this.product,this.offer),e.preventDefault()}render(){return d`
196
196
  <slot name="default">
197
197
  <button id="action-trigger" class="btn radio ${this.subscribed?"":"active"}"></button>
198
198
  <label for="action-trigger">
@@ -201,13 +201,13 @@ var lib=(()=>{var aa=Object.create;var Ze=Object.defineProperty;var ca=Object.ge
201
201
  </slot>
202
202
  </label>
203
203
  </slot>
204
- `}};n(Oo,"OptoutButton");var gi=y(te,{optoutProduct:je})(Oo);w();q();w();ie();var Re=n((t,e)=>{let{every:r,every_period:o}=at(t);return r&&o?d`
204
+ `}};n(Ao,"OptoutButton");var vi=g(oe,{optoutProduct:ze})(Ao);w();I();w();D();le();var Ie=n((t,e)=>{let{every:r,every_period:o}=ut(t);return r&&o?d`
205
205
  ${r}
206
206
  <og-text key="frequencyPeriods" variant="${o}" pluralize="${r}"></og-text>
207
207
  ${e&&e===t?d`
208
208
  <og-text key="defaultFrequencyCopy"></og-text>
209
209
  `:""}
210
- `:t},"frequencyText"),xt=class extends U(H){static get properties(){return{...super.properties,disabled:{type:Boolean},subscribed:Er,frequency:{type:String},defaultFrequency:fe,productDefaultFrequency:{type:String},config:{type:Object},frequencies:{converter:{fromAttribute:zn}}}}static get styles(){return O`
210
+ `:t},"frequencyText"),Ot=class extends k(G){static get properties(){return{...super.properties,disabled:{type:Boolean},subscribed:Tr,frequency:{type:String},defaultFrequency:ye,productDefaultFrequency:{type:String},config:{type:Object},frequencies:{converter:{fromAttribute:Kn}}}}static get styles(){return v`
211
211
  :host[hidden] {
212
212
  display: none;
213
213
  }
@@ -217,7 +217,7 @@ var lib=(()=>{var aa=Object.create;var Ze=Object.defineProperty;var ca=Object.ge
217
217
  `}constructor(){super();this.frequencies=[]}render(){let e=this.frequency||this.defaultFrequency;return d`
218
218
  <span>
219
219
  ${this.subscribed&&d`
220
- <slot name="subscribed">${Re(e)} </slot>
220
+ <slot name="subscribed">${Ie(e)} </slot>
221
221
  `||""}
222
222
  ${!this.subscribed&&d`
223
223
  <slot name="not-subscribed"></slot>
@@ -226,7 +226,7 @@ var lib=(()=>{var aa=Object.create;var Ze=Object.defineProperty;var ca=Object.ge
226
226
  <slot name="frequency-mismatch"></slot>
227
227
  `||""}
228
228
  </span>
229
- `}};n(xt,"FrequencyStatus");var St=n((t,e)=>{var r,o;return{subscribed:Z(e.product)(t),frequency:J(e.product)(t),productDefaultFrequency:He((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,...$(t,e,"frequencies"),...$(t,e,"defaultFrequency"),...Be(t,e)}},"mapStateToProps"),yi=y(St)(xt);var wo=class extends br(G){static get properties(){return{...super.properties,frequencies:{type:Array,attribute:!1},frequency:{type:String},defaultFrequency:fe}}static get styles(){return O`
229
+ `}};n(Ot,"FrequencyStatus");var wt=n((t,e)=>{var r,o;return{subscribed:J(e.product)(t),frequency:Q(e.product)(t),productDefaultFrequency:Ve((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,...V(t,e,"frequencies"),...V(t,e,"defaultFrequency"),...He(t,e)}},"mapStateToProps"),Oi=g(wt)(Ot);D();var No=class extends xr(z){static get properties(){return{...super.properties,frequencies:{type:Array,attribute:!1},frequency:{type:String},defaultFrequency:ye}}static get styles(){return v`
230
230
  :host {
231
231
  display: inline-block;
232
232
  cursor: pointer;
@@ -236,24 +236,24 @@ var lib=(()=>{var aa=Object.create;var Ze=Object.defineProperty;var ca=Object.ge
236
236
  border-width: var(--og-select-border-width, 1px);
237
237
  box-shadow: 0 1px 0 1px rgba(0, 0, 0, 0.04);
238
238
  }
239
- `}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`
239
+ `}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]:Ie(s,this.defaultFrequency)}))]:r=e,d`
240
240
  <og-select
241
241
  .options="${r}"
242
242
  .selected="${this.currentFrequency}"
243
243
  .onChange="${({target:{value:s}})=>this.onOptinChange(s)}"
244
244
  ></og-select>
245
- `}};n(wo,"OptinSelect");var bi=y((t,e)=>({...te(t,e),...St(t,e),...$(t,e,"frequencies")}),{productChangeFrequency:Kt,optoutProduct:je})(wo);w();q();var Co=class extends U(H){static get styles(){return O`
245
+ `}};n(No,"OptinSelect");var wi=g((t,e)=>({...oe(t,e),...wt(t,e),...V(t,e,"frequencies")}),{productChangeFrequency:or,optoutProduct:ze})(No);w();I();var Io=class extends k(G){static get styles(){return v`
246
246
  :host[hidden] {
247
247
  display: none;
248
248
  }
249
249
  :host {
250
250
  display: inline-block;
251
251
  }
252
- `}static get properties(){return{...super.properties,upcomingOrderDate:{type:String,attribute:!1},auth:Je,isPreview:{type:Boolean,attribute:!1},target:{type:String}}}constructor(){super();this.fetchOrders=()=>0,this.addEventListener("click",this.handleClick.bind(this))}updated(e){e.has("auth")&&this.auth&&!this.upcomingOrderDate&&!this.isPreview&&this.fetchOrders()}handleClick(){let e;if(!this.target&&this.offer)e=this.offer.querySelector("og-upsell-modal"),e||(e=this.offer.shadowRoot.querySelector("og-upsell-modal"));else if(this.target)e=document.querySelector(this.target);else throw Error("You must specify a target attribute or place this element as child of og-offer");e&&e.setAttribute("show",!0)}render(){return d`
252
+ `}static get properties(){return{...super.properties,upcomingOrderDate:{type:String,attribute:!1},auth:Ze,isPreview:{type:Boolean,attribute:!1},target:{type:String}}}constructor(){super();this.fetchOrders=()=>0,this.addEventListener("click",this.handleClick.bind(this))}updated(e){e.has("auth")&&this.auth&&!this.upcomingOrderDate&&!this.isPreview&&this.fetchOrders()}handleClick(){let e;if(!this.target&&this.offer)e=this.offer.querySelector("og-upsell-modal"),e||(e=this.offer.shadowRoot.querySelector("og-upsell-modal"));else if(this.target)e=document.querySelector(this.target);else throw Error("You must specify a target attribute or place this element as child of og-offer");e&&e.setAttribute("show",!0)}render(){return d`
253
253
  <slot>
254
254
  <og-next-upcoming-order></og-next-upcoming-order>
255
255
  </slot>
256
- `}};n(Co,"UpsellButton");var ll=n(t=>({isPreview:t.previewUpsellOffer}),"mapStateToProps"),_i=y(ll,{fetchOrders:Xt})(Co);w();q();var Po=class extends U(H){static get properties(){return{...super.properties,defaultFrequency:fe,auth:Je,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`
256
+ `}};n(Io,"UpsellButton");var xl=n(t=>({isPreview:t.previewUpsellOffer}),"mapStateToProps"),Ci=g(xl,{fetchOrders:sr})(Io);w();I();D();var ko=class extends k(G){static get properties(){return{...super.properties,defaultFrequency:ye,auth:Ze,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`
257
257
  <og-modal ?show=${this.show} @close=${()=>this.close()} @confirm=${()=>this.confirm()}>
258
258
  <div slot="content">
259
259
  <slot>
@@ -291,7 +291,7 @@ var lib=(()=>{var aa=Object.create;var Ze=Object.defineProperty;var ca=Object.ge
291
291
  </slot>
292
292
  </span>
293
293
  </og-modal>
294
- `}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(Po,"UpsellModal");var ul=n((t,e)=>({auth:t.auth,offerId:t.offerId,subscribed:Z(e.product)(t),frequency:J(e.product)(t),...$(t,e,"defaultFrequency"),nextUpcomingOrder:t.previewUpsellOffer?{public_id:"preview-order-id"}:t.nextUpcomingOrder,isPreview:t.previewUpsellOffer}),"mapStateToProps"),Ei=y(ul,{concludeUpsell:Xn,createIu:is})(Po);w();q();var Ro=class extends G{static get properties(){return{...super.properties,frequency:{type:String}}}static get styles(){return O`
294
+ `}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(ko,"UpsellModal");var Sl=n((t,e)=>({auth:t.auth,offerId:t.offerId,subscribed:J(e.product)(t),frequency:Q(e.product)(t),...V(t,e,"defaultFrequency"),nextUpcomingOrder:t.previewUpsellOffer?{public_id:"preview-order-id"}:t.nextUpcomingOrder,isPreview:t.previewUpsellOffer}),"mapStateToProps"),Pi=g(Sl,{concludeUpsell:ls,createIu:gs})(ko);w();I();var qo=class extends z{static get properties(){return{...super.properties,frequency:{type:String}}}static get styles(){return v`
295
295
  :host {
296
296
  cursor: default;
297
297
  display: inline-block;
@@ -332,13 +332,13 @@ var lib=(()=>{var aa=Object.create;var Ze=Object.defineProperty;var ca=Object.ge
332
332
  ></slot>
333
333
  </label>
334
334
  </slot>
335
- `}};n(Ro,"OptinToggle");var xi=y(te,{optoutProduct:je,optinProduct:ae})(Ro);w();var pl=n((t,e)=>`${t}${parseInt(e,10)>1?"s":""}`,"pluralize"),Ao=class extends xo(v){static get properties(){return{pluralize:{type:Number},variant:{type:Number},i18n:{type:Object,attribute:!1},locale:{type:Object,attribute:!1},key:{type:String}}}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this._textOverride=this.innerText.trim()}getText(){return this._textOverride?this._textOverride:this.getPluralizedText(this.getVariantText(this.key))}getVariantText(e){let r={...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&&pl(e,this.pluralize)}render(){return d`
335
+ `}};n(qo,"OptinToggle");var Ri=g(oe,{optoutProduct:ze,optinProduct:pe})(qo);w();var Tl=n((t,e)=>`${t}${parseInt(e,10)>1?"s":""}`,"pluralize"),Uo=class extends Oo(S){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&&Tl(e,this.pluralize)}render(){return d`
336
336
  ${this.getText()}
337
- `}};n(Ao,"Text");var dl=n(t=>({i18n:t.locale||{}}),"mapStateToProps"),Si=y(dl)(Ao);w();L();var Qe=class{constructor(e){this.value=e,this.className="DiscountAmount"}toString(){return`${this.value}`}};n(Qe,"DiscountAmount");var Tt=class extends Qe{constructor(e){super(e);this.className="DiscountPercent"}toString(){return`${super.toString()}%`}};n(Tt,"DiscountPercent");var No=class extends Tt{constructor(e){super(e);this.className="ShippingDiscountPercent"}toString(){return this.value===100?"free shipping":super.toString()}};n(No,"ShippingDiscountPercent");var ko="Discount Percent",qo="Discount Amount",Ti="total_price",vi="shipping_total",Oi="sub_total",Io=n(({field:t,object:e,type:r,value:o})=>{let i=[[new Tt(o),{field:Ti,object:"item",type:ko}],[new Qe(o),{field:Ti,object:"item",type:qo}],[new No(o),{field:vi,object:"order",type:ko}],[new Qe(o),{field:vi,object:"order",type:qo}],[new Tt(o),{field:Oi,object:"order",type:ko}],[new Qe(o),{field:Oi,object:"order",type:qo}]].find(([,a])=>a.field===t&&a.object===e&&a.type===r);return i&&i[0]},"discountBuilder");function fl(t){return!(Io(t).className!==this.incentiveClass||this.incentiveValue&&this.incentiveValue.toString()!==t.value.toString())}n(fl,"filterIncentives");var Fo=class extends U(v){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(fl.bind({incentiveClass:e,incentiveValue:r}));return d`
338
- ${this.label} ${s?Io(s):this.renderFallback()}
337
+ `}};n(Uo,"Text");var vl=n(t=>({i18n:t.locale||{}}),"mapStateToProps"),Ai=g(vl)(Uo);w();M();var Xe=class{constructor(e){this.value=e,this.className="DiscountAmount"}toString(){return`${this.value}`}};n(Xe,"DiscountAmount");var Ct=class extends Xe{constructor(e){super(e);this.className="DiscountPercent"}toString(){return`${super.toString()}%`}};n(Ct,"DiscountPercent");var Fo=class extends Ct{constructor(e){super(e);this.className="ShippingDiscountPercent"}toString(){return this.value===100?"free shipping":super.toString()}};n(Fo,"ShippingDiscountPercent");var Do="Discount Percent",Lo="Discount Amount",Ni="total_price",Ii="shipping_total",ki="sub_total",Mo=n(({field:t,object:e,type:r,value:o})=>{let i=[[new Ct(o),{field:Ni,object:"item",type:Do}],[new Xe(o),{field:Ni,object:"item",type:Lo}],[new Fo(o),{field:Ii,object:"order",type:Do}],[new Xe(o),{field:Ii,object:"order",type:Lo}],[new Ct(o),{field:ki,object:"order",type:Do}],[new Xe(o),{field:ki,object:"order",type:Lo}]].find(([,a])=>a.field===t&&a.object===e&&a.type===r);return i&&i[0]},"discountBuilder");function Ol(t){return!(Mo(t).className!==this.incentiveClass||this.incentiveValue&&this.incentiveValue.toString()!==t.value.toString())}n(Ol,"filterIncentives");var jo=class extends k(S){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(Ol.bind({incentiveClass:e,incentiveValue:r}));return d`
338
+ ${this.label} ${s?Mo(s):this.renderFallback()}
339
339
  `}renderFallback(){return d`
340
- ${Io({field:"sub_total",object:"order",type:"Discount Percent",value:this.value})}
341
- `}};n(Fo,"IncentiveText");var hl=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"),wi=y(hl)(Fo);w();q();var Uo=class extends br(xt){static get properties(){return{...super.properties,defaultText:{type:String,attribute:"default-text"}}}static get styles(){return O`
340
+ ${Mo({field:"sub_total",object:"order",type:"Discount Percent",value:this.value})}
341
+ `}};n(jo,"IncentiveText");var wl=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"),qi=g(wl)(jo);w();I();var $o=class extends xr(Ot){static get properties(){return{...super.properties,defaultText:{type:String,attribute:"default-text"}}}static get styles(){return v`
342
342
  :host {
343
343
  display: inline-block;
344
344
  cursor: pointer;
@@ -349,7 +349,7 @@ var lib=(()=>{var aa=Object.create;var Ze=Object.defineProperty;var ca=Object.ge
349
349
  box-shadow: 0 1px 0 1px rgba(0, 0, 0, 0.04);
350
350
  z-index: 1;
351
351
  }
352
- `}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`
352
+ `}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=Ie(this.config.frequenciesEveryPeriod[i],r):this.frequenciesText&&i in this.frequenciesText?a=this.frequenciesText[i]:a=Ie(s,this.defaultFrequency),{value:s,text:a}}):{options:e}=this.childOptions,e.length||(e=(this.frequencies||[]).map(s=>({value:s,text:Ie(s,r)}))),e=e.map(({text:s,value:i})=>({text:i===r?d`
353
353
  ${s} ${this.defaultText||""}
354
354
  `:s,value:i})),d`
355
355
  <og-select
@@ -357,9 +357,9 @@ var lib=(()=>{var aa=Object.create;var Ze=Object.defineProperty;var ca=Object.ge
357
357
  .selected="${this.currentFrequency}"
358
358
  .onChange="${({target:{value:s}})=>{this.productChangeFrequency(this.product,s,this.offer)}}"
359
359
  ></og-select>
360
- `}};n(Uo,"SelectFrequency");var Ci=y(St,{productChangeFrequency:Kt})(Uo);w();var ml={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 Pi=n((t,e)=>t instanceof Date?(e||"").toString().replace(/\{\{([-\w]+)\}\}/g,r=>{let o=r.replace(/[{}]/g,""),s=ml[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 Do=class extends v{static get properties(){return{value:{type:String,reflect:!0},format:{type:String}}}createRenderRoot(){return this}render(){return d`
361
- ${Pi(this.value,this.format||"{{month-long}} {{day}}, {{year-numeric}}")}
362
- `}};n(Do,"FormattedDate");var gl=n(t=>({value:t.previewUpsellOffer?new Date:t.nextUpcomingOrder.place}),"mapStateToProps"),Ri=y(gl)(Do);w();var ki=re(nt());q();D();var Ai=n((t,e,r)=>n(async function(s){await s({type:tt,payload:t}),await s({type:qe}),await s($e({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"),yl=n((t,e,r)=>n(async function(s,i){await s({type:rt,payload:t});let{merchantId:a}=i();t?(await s($e({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($r({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(pt(a,"sig_field","ts","sig"))):await s(ce())},"setPreviewUpsellOfferThunk"),"setPreviewUpsellOffer"),Ni=n((t,e,r)=>async function(o,s){switch(await o({type:oe}),await o({type:tt,payload:!1}),await o({type:rt,payload:!1}),t){case"regular":o(Ai(!0,r.product.id,r));break;case"upsell":o(yl(!0,r.product.id,r));break;case"subscribed":o(Ai(!0,r.product.id,r)),o(ae(r.product,"2_2"));break;default:}},"setPreview");q();L();D();var bl=n((...t)=>JSON.stringify(t),"memoizeKey"),_l=(0,ki.default)((t,e)=>Object.assign({components:e},t),bl),Lo=class extends H{static get properties(){return{...super.properties,config:{type:Object,attribute:!1},product:fi,productComponents:{type:Array,attribute:"product-components"},offerId:{type:String,attribute:!1},auth:Je,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 O`
360
+ `}};n($o,"SelectFrequency");var Ui=g(wt,{productChangeFrequency:or})($o);w();var Cl={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 Fi=n((t,e)=>t instanceof Date?(e||"").toString().replace(/\{\{([-\w]+)\}\}/g,r=>{let o=r.replace(/[{}]/g,""),s=Cl[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 Vo=class extends S{static get properties(){return{value:{type:String,reflect:!0},format:{type:String}}}createRenderRoot(){return this}render(){return d`
361
+ ${Fi(this.value,this.format||"{{month-long}} {{day}}, {{year-numeric}}")}
362
+ `}};n(Vo,"FormattedDate");var Pl=n(t=>({value:t.previewUpsellOffer?new Date:t.nextUpcomingOrder.place}),"mapStateToProps"),Di=g(Pl)(Vo);w();var ji=ne(at());I();L();var Li=n((t,e,r)=>n(async function(s){await s({type:nt,payload:t}),await s({type:Fe}),await s(We({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"),Rl=n((t,e,r)=>n(async function(s,i){await s({type:st,payload:t});let{merchantId:a}=i();t?(await s(We({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(Wr({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(mt(a,"sig_field","ts","sig"))):await s(de())},"setPreviewUpsellOfferThunk"),"setPreviewUpsellOffer"),Mi=n((t,e,r)=>async function(o,s){switch(await o({type:ie}),await o({type:nt,payload:!1}),await o({type:st,payload:!1}),t){case"regular":o(Li(!0,r.product.id,r));break;case"upsell":o(Rl(!0,r.product.id,r));break;case"subscribed":o(Li(!0,r.product.id,r)),o(pe(r.product,"2_2"));break;default:}},"setPreview");I();D();M();L();var Al=n((...t)=>JSON.stringify(t),"memoizeKey"),Nl=(0,ji.default)((t,e)=>Object.assign({components:e},t),Al),Ho=class extends G{static get properties(){return{...super.properties,config:{type:Object,attribute:!1},product:xi,productComponents:{type:Array,attribute:"product-components"},offerId:{type:String,attribute:!1},auth:Ze,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`
363
363
  :host[hidden] {
364
364
  display: none;
365
365
  }
@@ -508,9 +508,9 @@ var lib=(()=>{var aa=Object.create;var Ze=Object.defineProperty;var ca=Object.ge
508
508
  </og-when>
509
509
  </og-when>
510
510
 
511
- `}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&&Jt(()=>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=_l(this.product,this.productComponents),o=Object.assign({},this.product,{components:e.get("productComponents")});I(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=>I(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`
511
+ `}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&&tr(()=>this.fetchOffer(this.product.id,Ee,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=Nl(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`
512
512
  <slot></slot>
513
- `}get defaultFrequency(){let e=this.productFrequency||this.productDefaultFrequency;if(e)return e;let r=this.querySelector("og-select-frequency");return r&&r.currentFrequency?r.currentFrequency:this.getOption("defaultFrequency")}};n(Lo,"Offer");var El=n((t,e)=>({config:t.config,auth:t.auth,offerId:((t.productOffer||{})[(e.product||{}).id]||[])[0],productFrequency:J(e.product)(t),productDefaultFrequency:He((e.product||{}).id)(t),...$(t,e,"autoshipByDefault",zr(t)[(e.product||{}).id]),...rr(e.product)(t)&&{autoshipByDefault:!1},optedin:er(t),subscribed:Z(e.product)(t),...Be(t)}),"mapStateToProps"),qi=y(El,{fetchOffer:ns,fetchOrders:Xt,productHasChangedComponents:Zn,optinProduct:ae,setFirstOrderPlaceDate:ps,setProductToSubscribe:ds,setPreview:Ni})(Lo);w();var xr=class extends v{constructor(){super();this.showCancelButton=!0,this.showConfirmButton=!0}static get properties(){return{title:{type:String,attribute:!1},content:{type:String,attribute:!1},confirmText:{type:String,attribute:!1},cancelText:{type:String,attribute:!1},showCancelButton:{type:Boolean},showConfirmButton:{type:Boolean},show:{type:Boolean,attribute:"show"}}}static get styles(){return O`
513
+ `}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(Ho,"Offer");var Il=n((t,e)=>({config:t.config,auth:t.auth,offerId:((t.productOffer||{})[(e.product||{}).id]||[])[0],productFrequency:Q(e.product)(t),productDefaultFrequency:Ve((e.product||{}).id)(t),...V(t,e,"autoshipByDefault",Vr(t)[(e.product||{}).id]),...er(e.product)(t)&&{autoshipByDefault:!1},optedin:ht(t),subscribed:J(e.product)(t),...He(t)}),"mapStateToProps"),$i=g(Il,{fetchOffer:hs,fetchOrders:sr,productHasChangedComponents:as,optinProduct:pe,setFirstOrderPlaceDate:xs,setProductToSubscribe:Ss,setPreview:Mi})(Ho);w();var vr=class extends S{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`
514
514
  :host[hidden] {
515
515
  display: none;
516
516
  }
@@ -541,11 +541,11 @@ var lib=(()=>{var aa=Object.create;var Ze=Object.defineProperty;var ca=Object.ge
541
541
  }
542
542
 
543
543
  .og-modal__container {
544
- background-color: #fff;
545
- padding: 30px;
544
+ background-color: var(--og-modal-background-color, #fff);
545
+ padding: var(--og-modal-padding, 30px);
546
546
  max-width: 500px;
547
547
  max-height: 100vh;
548
- border-radius: 4px;
548
+ border-radius: var(--og-modal-border-radius, 4px);
549
549
  box-sizing: border-box;
550
550
  }
551
551
 
@@ -657,7 +657,7 @@ var lib=(()=>{var aa=Object.create;var Ze=Object.defineProperty;var ca=Object.ge
657
657
  </div>
658
658
  </div>
659
659
  </div>
660
- `:d``}};n(xr,"Modal");w();var Sr=class extends v{static get styles(){return O`
660
+ `:d``}};n(vr,"Modal");w();var Or=class extends S{static get styles(){return v`
661
661
  :host {
662
662
  display: inline-block;
663
663
  color: inherit;
@@ -712,11 +712,11 @@ var lib=(()=>{var aa=Object.create;var Ze=Object.defineProperty;var ca=Object.ge
712
712
  `}static get properties(){return{options:{type:Array},selected:{type:String}}}render(){return d`
713
713
  <select @change="${n(r=>this.onChange(r),"handleOnChange")}">
714
714
  ${this.options.map(r=>d`
715
- <option value="${r.value}" ?selected=${r.value===this.selected}>${r.text}</option>
715
+ <option value="${r.value}" .selected=${r.value===this.selected}>${r.text}</option>
716
716
  `)}
717
717
  </select>
718
718
  <span>&#9660;</span>
719
- `}};n(Sr,"Select");w();var Tr=class extends v{static get properties(){return{placement:{type:String,default:"bottom"}}}static get styles(){return O`
719
+ `}};n(Or,"Select");w();var wr=class extends S{static get properties(){return{placement:{type:String,default:"bottom"}}}static get styles(){return v`
720
720
  :host[hidden] {
721
721
  display: none;
722
722
  }
@@ -879,12 +879,46 @@ var lib=(()=>{var aa=Object.create;var Ze=Object.defineProperty;var ca=Object.ge
879
879
  </slot>
880
880
  </div>
881
881
  </span>
882
- `}};n(Tr,"Tooltip");var{TestWizard:Sl}=(Fi(),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],Ui=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();D();ie();L();var $o=n((t=[],e)=>{switch(e.type){case oe:return[];case me:return e.newValue?e.newValue.optedin:t;case A:case k:let[[r],o]=t.reduce((s,i)=>s[I(e.payload.product,i)?0:1].push(i)&&s,[[],[]]);return(o||[]).concat({...r,...e.payload.product,frequency:e.payload.frequency});case N:return t.filter(s=>!I(e.payload.product,s));case et:return t.map(s=>I(e.payload.product,s)?{...s,...e.payload.newProduct}:s);case Ft:return t.filter(s=>!I(e.payload.product,s));case De:return[];default:return t}},"optedin"),Vo=n((t=[],e)=>{switch(e.type){case oe:return[];case me:return e.newValue?e.newValue.optedout:t;case A:case k:return t.filter(s=>!I(e.payload.product,s));case N:let[[r],o]=t.reduce((s,i)=>s[I(e.payload.product,i)?0:1].push(i)&&s,[[],[]]);return(o||[]).concat({...r,...e.payload.product,frequency:e.payload.frequency});case et:return t.map(s=>I(e.payload.product,s)?{...s,...e.payload.newProduct}:s);case De: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 qt:return{...t,products:(r.results||[]).map(o=>o.product)};case It: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 z:return{...t};case P:return{...t,...e.payload.in_stock};default:return t}},"inStock"),Bo=n((t={},e)=>{switch(e.type){case P:return{...t,...e.payload.eligibility_groups};default:return t}},"eligibilityGroups"),Di=n((t,e)=>t.map(r=>({...e[r],id:[r][0]})),"mapIncentive"),Go=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||[],...Di(i,e.payload.incentives_display)],ongoing:[...s.ongoing||[],...Di(a,e.payload.incentives_display)]}),{})}),{})};default:return t}},"incentives"),Ol=n((t={},e)=>{switch(e.type){case A:case k:return{...t,[R(e.payload.product)]:e.payload.frequency};case N:return{...t,[R(e.payload.product)]:void 0};default:return t}},"frequency"),zo=n((t=!1,e)=>{switch(e.type){case Nt:return{...e.payload};case qe:return!1;default:return t}},"auth"),Wo=n((t="",e)=>{switch(e.type){case Ne:return e.payload;default:return t}},"merchantId"),Yo=n((t=null,e)=>{switch(e.type){case At: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 De:return{};default:return t}},"productOffer"),Ko=n((t={},e)=>{switch(e.type){case jt:return{...t,[R(e.payload.product)]:e.payload.firstOrderPlaceDate};default:return t}},"firstOrderPlaceDate"),Zo=n((t={},e)=>{switch(e.type){case $t:return{...t,[R(e.payload.product)]:e.payload.productToSubscribe};default:return t}},"productToSubscribe"),vt=n((t={},e)=>{switch(e.type){case Ie:return{...t,name:ye,apiUrl:"https://staging.offers.ordergroove.com",legoUrl:"https://staging.restapi.ordergroove.com"};case Fe:return{...t,name:Vt,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"),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 Ut:return{...t,...e.payload};default:return t}},"locale"),Pl=n((t={offerType:"radio"},e)=>{switch(e.type){case Dt:return{...t,...e.payload,defaultFrequency:e.payload.defaultFrequency?ct(e.payload.defaultFrequency):t.defaultFrequency,frequenciesEveryPeriod:[],frequencies:e.payload.frequencies?e.payload.frequencies.map(ct):t.frequencies};default:return t}},"config"),en=n((t=!1,e)=>{switch(e.type){case tt:return e.payload;default:return t}},"previewStandardOffer"),tn=n((t=!1,e)=>{switch(e.type){case rt: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 Mt:return[...e.payload||[]];case Lt:return[e.payload,...t];default:return t}},"templates"),Rl=n((t={},e)=>{switch(e.type){case K:return{...e.payload};default:return t}},"productPlans"),Or=wt({optedin:$o,optedout:Vo,nextUpcomingOrder:Ho,autoshipEligible:Tl,inStock:vl,eligibilityGroups:Bo,incentives:Go,frequency:Ol,auth:zo,merchantId:Wo,authUrl:Yo,offer:wl,offerId:Jo,sessionId:Qo,productOffer:Cl,firstOrderPlaceDate:Ko,productToSubscribe:Zo,environment:vt,locale:Xo,config:Pl,previewStandardOffer:en,previewUpsellOffer:tn,autoshipByDefault:rn,defaultFrequencies:on,templates:nn,productPlans:Rl});D();w();var sn=class extends U(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`
882
+ `}};n(wr,"Tooltip");w();D();I();var Go=class extends k(S){constructor(){super();this._selectedOption=null}static get properties(){return{shipments:{type:Number}}}static get styles(){return v`
883
+ og-select {
884
+ display: inline-block;
885
+ cursor: pointer;
886
+ background-color: #fff;
887
+ border: var(--og-select-border, 1px solid #aaa);
888
+ border-width: var(--og-select-border-width, 1px);
889
+ box-shadow: 0 1px 0 1px rgba(0, 0, 0, 0.04);
890
+ z-index: 1;
891
+ }
892
+
893
+ input {
894
+ width: 1.2em;
895
+ height: 1.2em;
896
+ accent-color: black;
897
+ border-radius: 4px;
898
+ }
899
+ `}get childOptions(){return Array.from(this.querySelectorAll("option")).map(r=>({value:+r.value,text:r.text||`${r.value} shipments`}))}get checked(){return this.shipments>1}handleChange(e){if(e.target.checked){let r=this._selectedOption||+this.querySelector("option").value;this.productChangePrepaidShipments(this.product,r,this.offer)}else this.productChangePrepaidShipments(this.product,null,this.offer)}handleSelect({target:{value:e}}){let r=+e;this._selectedOption=r,this.productChangePrepaidShipments(this.product,r,this.offer)}render(){return d`
900
+ <div>
901
+ <input id="cbx" type="checkbox" .checked=${this.checked} @change=${this.handleChange} />
902
+ <label for="cbx">
903
+ <slot name="label">Prepay for</slot>
904
+ ${this.childOptions.length>1?d`
905
+ <og-select
906
+ .options=${this.childOptions}
907
+ .selected=${this._selectedOption||this.shipments}
908
+ .onChange="${e=>this.handleSelect(e)}"
909
+ ></og-select>
910
+ `:d`
911
+ <span>${this.childOptions[0].text}</span>
912
+ `}
913
+ <slot name="append"></slot>
914
+ </label>
915
+ </div>
916
+ `}};n(Go,"PrepaidToggle");var kl=n((t,e)=>({shipments:ts(e.product)(t)}),"mapStateToProps"),Vi=g(kl,{productChangePrepaidShipments:cs})(Go);var{TestWizard:Ul}=(Gi(),Hi);function Bo(){let t="og-test-wizard";customElements.get(t)||customElements.define(t,Ul);let e=document.createElement(t);document.body.appendChild(e)}n(Bo,"default");var zo=[79,71,68,69,86],Bi=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===zo[t]){let o=zo[t];setTimeout(function(){t<=o&&(t=0)},5e3),t+=1,t>=zo.length&&Bo()}else t=0},!1)},"enable");le();L();D();le();M();var Pr=n((t=[],e)=>{switch(e.type){case ie:return[];case _e:return e.newValue?e.newValue.optedin:t;case A:case U:{let[{prepaidShipments:c,...l},u]=Be(t,e.payload.product);return u.concat({...l,...e.payload.product,frequency:e.payload.frequency})}case se:let{payload:r}=e,[{prepaidShipments:o,...s},i]=Be(t,r.product),a={...s,...r.product};return r.prepaidShipments&&(a.prepaidShipments=r.prepaidShipments),i.concat(a);case q:return t.filter(c=>!N(e.payload.product,c));case ot:return t.map(c=>N(e.payload.product,c)?{...c,...e.payload.newProduct}:c);case Mt:return t.filter(c=>!N(e.payload.product,c));case je:return[];default:return t}},"optedin"),Wo=n((t=[],e)=>{switch(e.type){case ie:return[];case _e:return e.newValue?e.newValue.optedout:t;case A:case U:return t.filter(s=>!N(e.payload.product,s));case q:let[r,o]=Be(t,e.payload.product);return o.concat({...r,...e.payload.product,frequency:e.payload.frequency});case ot:return t.map(s=>N(e.payload.product,s)?{...s,...e.payload.newProduct}:s);case je:return[];default:return t}},"optedout"),Yo=n((t={},{type:e,payload:r})=>{switch(e){case Ft: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 Dt:return{...t,products:(r.results||[]).map(o=>o.product)};case Lt:return{...t,...r,public_id:r.order,...r.product&&{products:(t.products||[]).concat(r.product)}};default:return t}},"nextUpcomingOrder"),Fl=n((t={},e)=>{switch(e.type){case P:return{...t,...e.payload.autoship};default:return t}},"autoshipEligible"),Dl=n((t={},e)=>{switch(e.type){case W:return{...t};case P:return{...t,...e.payload.in_stock};default:return t}},"inStock"),Jo=n((t={},e)=>{switch(e.type){case P:return{...t,...e.payload.eligibility_groups};default:return t}},"eligibilityGroups"),zi=n((t,e)=>t.map(r=>({...e[r],id:[r][0]})),"mapIncentive"),Qo=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||[],...zi(i,e.payload.incentives_display)],ongoing:[...s.ongoing||[],...zi(a,e.payload.incentives_display)]}),{})}),{})};default:return t}},"incentives"),Ll=n((t={},e)=>{switch(e.type){case A:case U:return{...t,[R(e.payload.product)]:e.payload.frequency};case q:return{...t,[R(e.payload.product)]:void 0};default:return t}},"frequency"),Ko=n((t=!1,e)=>{switch(e.type){case Ut:return{...e.payload};case Fe:return!1;default:return t}},"auth"),Zo=n((t="",e)=>{switch(e.type){case qe:return e.payload;default:return t}},"merchantId"),Xo=n((t=null,e)=>{switch(e.type){case qt:return e.payload;default:return t}},"authUrl"),Ml=n((t={},e)=>{switch(e.type){case P:return{...t,offerId:(e.payload.module_view||{}).regular,...e.payload.modifiers};default:return t}},"offer"),en=n((t="",e)=>{switch(e.type){case P:return(e.payload.module_view||{}).regular||"";default:return t}},"offerId"),tn=n((t=null,e)=>{switch(e.type){case ie:return null;case Ue:return e.payload;default:return t}},"sessionId"),jl=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 je:return{};default:return t}},"productOffer"),rn=n((t={},e)=>{switch(e.type){case Gt:return{...t,[R(e.payload.product)]:e.payload.firstOrderPlaceDate};default:return t}},"firstOrderPlaceDate"),on=n((t={},e)=>{switch(e.type){case Bt:return{...t,[R(e.payload.product)]:e.payload.productToSubscribe};default:return t}},"productToSubscribe"),Pt=n((t={},e)=>{switch(e.type){case De:return{...t,name:xe,apiUrl:"https://staging.offers.ordergroove.com",legoUrl:"https://staging.restapi.ordergroove.com"};case Le:return{...t,name:zt,apiUrl:"https://dev.offers.ordergroove.com",legoUrl:"https://dev.restapi.ordergroove.com"};case Me:return{...t,name:Se,apiUrl:"https://offers.ordergroove.com",legoUrl:"https://restapi.ordergroove.com"};default:return t}},"environment"),nn=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 jt:return{...t,...e.payload};default:return t}},"locale"),$l=n((t={offerType:"radio"},e)=>{switch(e.type){case $t:return{...t,...e.payload,defaultFrequency:e.payload.defaultFrequency?pt(e.payload.defaultFrequency):t.defaultFrequency,frequenciesEveryPeriod:[],frequencies:e.payload.frequencies?e.payload.frequencies.map(pt):t.frequencies};default:return t}},"config"),sn=n((t=!1,e)=>{switch(e.type){case nt:return e.payload;default:return t}},"previewStandardOffer"),an=n((t=!1,e)=>{switch(e.type){case st:return e.payload;default:return t}},"previewUpsellOffer"),cn=n((t=[],e)=>{switch(e.type){case P:return{...t,...e.payload.autoship_by_default};default:return t}},"autoshipByDefault"),ln=n((t=[],e)=>{switch(e.type){case P:return{...t,...e.payload.default_frequencies};default:return t}},"defaultFrequencies"),un=n((t=[],e)=>{switch(e.type){case Ht:return[...e.payload||[]];case Vt:return[e.payload,...t];default:return t}},"templates"),Vl=n((t={},e)=>{switch(e.type){case X:return{...e.payload};default:return t}},"productPlans"),Rr=At({optedin:Pr,optedout:Wo,nextUpcomingOrder:Yo,autoshipEligible:Fl,inStock:Dl,eligibilityGroups:Jo,incentives:Qo,frequency:Ll,auth:Ko,merchantId:Zo,authUrl:Xo,offer:Ml,offerId:en,sessionId:tn,productOffer:jl,firstOrderPlaceDate:rn,productToSubscribe:on,environment:Pt,locale:nn,config:$l,previewStandardOffer:sn,previewUpsellOffer:an,autoshipByDefault:cn,defaultFrequencies:ln,templates:un,productPlans:Vl});L();w();D();var pn=class extends k(G){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`
883
917
  <slot name="prepend"></slot>
884
918
  ${e}
885
919
  <slot name="append"></slot>
886
920
  `:d`
887
921
  <slot name="fallback"></slot>
888
- `}};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"),Li=y(Al)(sn);L();function an(t){Ui(),Rs(t);try{customElements.define("og-when",di),customElements.define("og-text",Si),customElements.define("og-incentive-text",wi),customElements.define("og-offer",qi),customElements.define("og-select-frequency",Ci),customElements.define("og-optout-button",gi),customElements.define("og-optin-toggle",xi),customElements.define("og-optin-status",hi),customElements.define("og-optin-button",mi),customElements.define("og-optin-select",bi),customElements.define("og-upsell-button",_i),customElements.define("og-frequency-status",yi),customElements.define("og-modal",xr),customElements.define("og-select",Sr),customElements.define("og-tooltip",Tr),customElements.define("og-upsell-modal",Ei),customElements.define("og-next-upcoming-order",Ri),customElements.define("og-price",Li)}catch{console.info("OG WebComponents already registered, skipping.")}let e=!1,r={store:t,isReady:()=>e,setEnvironment(o){return t.dispatch(Hr(o)),this},setMerchantId(o){return t.dispatch(es(o)),this},setAuthUrl(o){return t.dispatch(ts(o)),this},getProductsForPurchasePost(o=[]){return Qr(t.getState(),o)},getOptins(o=[]){return Qr(t.getState(),o)},clear(){t.dispatch(ss())},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(cs(o)),this},setLocale(o){return t.dispatch(as(o)),this},addTemplate(o,s,i){return t.dispatch(ls(o,s,i)),this},setTemplates(o){return t.dispatch(us(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}=vt({},Hr(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),Jr(window.opener,r),r}n(an,"makeApi");D();L();var Ke=n(t=>t===null?"":`$${t.toString().replace(/(\d\d)$/,".$1")}`,"money"),Nl=n(t=>`${t}%`,"percentage"),kl=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=Ke(t.price_adjustments[0].value):t.compare_at_price&&(e=Ke(t.compare_at_price-t.price)),e?[Ke(t.compare_at_price),e,Ke(t.price)]:[Ke(t.price),"",Ke(t.price)]},"mapSellingPlanToDiscount"),Mi=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"),ji=n((t,e,r)=>{if(!r)return null;if(!Me(r))return r;if(Qt(t,e)){let o=Y(t,e,r);return o||xe(t)}return r},"getDefaultSellingPlan"),ql=n((t,e)=>t.map(r=>{var o,s,i,a,c,l,u;return Me(r==null?void 0:r.frequency)?{...r,frequency:Qt((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"),Il=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]&&Qt(l,u)?m=Y(l,u,`${p.every}_${p.every_period}`)||ji(l,u,h)||xe(l):r[c]?m=`${p.every}_${p.every_period}`:m=ji(l,u,h)||"_",a.concat({id:c,frequency:m})}return a},[]),"reduceNewOptinsFromOfferResponse"),$i=n(t=>t==null?void 0:t.selling_plan_groups.find(r=>r.name==="Subscribe and Save"),"getOGSellingPlanGroup"),Fl=n((t,e)=>({...Mi(t,e.id,e.available),[e.id]:e.available}),"productOrVariantInStockReducer"),Vi=n((t,[e])=>({...t,[e]:!0}),"productTrue"),Hi=n((t,e)=>{var r;return{...t,[e.selling_plan_id||((r=e.selling_plan)==null?void 0:r.id)]:kl(e)}},"sellingPlanAllocationsReducer"),Bi=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(Vi,t);if(ne===e.type){let{payload:r}=e;return r.items.reduce(Bi,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{...Mi(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(W===e.type){let{payload:{offer:i,product:a}}=e,c=$i(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&&Me(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 Me(a)?{...t,defaultFrequency:Y(c,l,a)||xe(c)||a}:{...t,defaultFrequency:a}}return t},"config"),jl=n((t={},e)=>{if(K===e.type)return Object.entries(e.payload).reduce(Vi,t);if(ne===e.type)return e.payload.items.reduce(Bi,t);if(W===e.type){let{payload:{product:r}}=e;return[r,...r==null?void 0:r.variants].reduce(Fl,t)||t}return z===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=ql(t,r),i=Il(o,s,r);return[...s,...i]}if(W===e.type){let{product:r}=e.payload,o=$i(r),s=Ll(o),i=Gi(o);return t.map(a=>Me(a.frequency)?{...a,frequency:Y(s,i,a.frequency)||xe(s)}:a)}return $o(t,e)},"optedin"),Hl=n((t={},e)=>t,"productOffer"),Bl=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(Hi,{})}},t)||t}return ne===e.type?e.payload.items.reduce((o,s)=>s.selling_plan_allocation?{...o,[s.key]:Hi({},s.selling_plan_allocation)}:o,t)||t:K===e.type?{...e.payload}:t},"productPlans"),Gl=wt({auth:zo,authUrl:Yo,autoshipByDefault:rn,autoshipEligible:Ul,config:Ml,defaultFrequencies:on,eligibilityGroups:Bo,environment:vt,firstOrderPlaceDate:Ko,incentives:Go,inStock:jl,locale:Xo,merchantId:Wo,nextUpcomingOrder:Ho,offer:$l,offerId:Jo,optedin:Vl,optedout:Vo,previewStandardOffer:en,previewUpsellOffer:tn,productOffer:Hl,productPlans:Bl,productToSubscribe:Zo,sessionId:Qo,templates:nn});function cn(t,e){return window.og&&window.og.previewMode?Or(t,e):Gl(t,e)}n(cn,"shopifyReducer");var Wi=re(nt()),Yi=re(Pt());D();L();D();function zi(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(zi,"updateTrackingInputs");function ln(){return`og__${Math.ceil(new Date().getTime()/1e3)}`}n(ln,"getTrackingKey");function zl(t,e){var h,p,m,T;if(!((h=t.payload.offer)==null?void 0:h.autoshipByDefault))return;let o=(p=t.payload.offer)==null?void 0:p.product.id,s=ln(),i=((m=t.payload.offer)==null?void 0:m.location)||"",a=((T=t.payload.offer)==null?void 0:T.variationId)||"",c=dn(o,e),u=[o,A.toLowerCase(),i,c,a].join(",");zi(o,s,u)}n(zl,"addDefaultToSubTracking");function un(t){return e=>r=>{switch(e(r),r.type){case A:case N:case k:let o=r.payload.offer,s=pn(r);o&&!o.isCart&&zi(o.product.id,s[0],s[1]);break;case P:zl(r,t);break;default:}}}n(un,"shopifyTrackingMiddleware");var Xi,ea,Ji=((ea=(Xi=window.Shopify)==null?void 0:Xi.routes)==null?void 0:ea.root)||"/",Wl="/cart",Yl=`${Ji}cart.js`,Jl=`${Ji}products/`,Ql='[id^="shopify-section-"][id$=__cart-items], [id^="shopify-section-"][id$="__cart-footer"],#cart-live-region-text,#cart-icon-bubble',Qi=(0,Yi.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 Kl(t,e){let r=Zl();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=>Qi(o,e)),new MutationObserver(()=>Qi(o,e)).observe(o,{subtree:!0,childList:!0})):console.info("no /cart/add form found for og-offer",e)}n(Kl,"setupPdp");var Ki=n(async()=>await(await fetch(Yl)).json(),"getCart");function Zl(){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(Zl,"guessProductHandle");var Zi=(0,Wi.default)(async t=>(await fetch(`${Jl}${t}.js`)).json());async function Xl(t,e){let r=await Ki(),{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(Xl,"setupCart");async function eu(t,e){var i,a;let r=t.payload.offer,o=t.payload.frequency||null,s=pn(t);if(!!(r==null?void 0:r.isCart))try{r.style.pointerEvents="none",r.style.opacity=".7";let c=Array.from(document.querySelectorAll(Ql)),l=t.payload.product.id,u=await Ki(),h=(i=u==null?void 0:u.items)==null?void 0:i.findIndex(g=>g.key===l),p=u.items[h],m=p.quantity,T=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===T&&(!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 C=new CustomEvent(Fn,{bubbles:!0,cancelable:!0});if(r.dispatchEvent(C),C.defaultPrevented)return;let b=f.sections;Object.values(b).length?c.forEach(g=>{let Ot=g.id.replace(/^shopify-section-/,"");if(!(Ot in b))return;let ia=b[Ot],hn=new DOMParser().parseFromString(ia.toString()||"","text/html").getElementById(g.id);hn&&(g.innerHTML=hn.innerHTML)}):window.location.pathname.startsWith(Wl)&&window.location.reload()}catch(c){console.log("OG Error updating cart",c)}finally{r.style.pointerEvents="auto",r.style.opacity="1"}}n(eu,"synchronizeCartOptin");function pn(t){var a,c;let e=t.payload.product.id;if(!e)return[];let r=ln(),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 N:i.push(""),i.push(s);break;case A:case k:i.push(t.payload.frequency),i.push(s);break;default:return[]}return[r,i.join(",")]}n(pn,"getTrackingEvent");function dn(t,e){var s;return(s=tr({id:t})(e.getState()))==null?void 0:s.frequency}n(dn,"getSubscribedFrequency");function tu(t,e){e.isCart||[...document.querySelectorAll('form[action$="/cart/add"] [name=id]')].forEach(r=>{let o=r.value,s=dn(o,t);Kn(r.form,"selling_plan",s)})}n(tu,"synchronizeSellingPlan");function fn(t){return e=>r=>{var o;switch(r.type){case A:case N:case k:break;case z:((o=r.payload.offer)==null?void 0:o.isCart)?Xl(t,r.payload.offer):Kl(t,r.payload.offer);break;default:}switch(e(r),r.type){case A:case N:case k:eu(r,t);case z:case P:case W:tu(t,r.payload.offer);break;default:}}}n(fn,"shopifyMiddleware");lt();L();q();L();var ru="/apps/subscriptions/auth/",ta="og_auth_begin",ou="og_auth_end",nu=n(t=>{let[e,r,o,s]=atob(t).split("|");return{id:e,signature:o,timestamp:r,email:s}},"parseIntegrationTempAuth");async function ra({store:t}){var s;let[e]=Lr(),r=ut(),o=(r==null?void 0:r.dataset.customer)?nu(r.dataset.customer):(s=window.ogShopifyConfig)==null?void 0:s.customer;if(o){let i=await iu(o);if(i){let[a,c,l]=i.split("|");t.dispatch(pt(e,a,Number(c),l))}}else Jn("og_auth")}n(ra,"authorizeShopifyCustomer");async function su(t){try{let r=await(await fetch(`${ru}?customer=${t.id}&customer_signature=${t.signature}&customer_timestamp=${t.timestamp}`)).text(),o=r.lastIndexOf(ta);if(o<0)throw"Invalid response from OG auth endpoint";return JSON.parse(r.substring(o+ta.length,r.lastIndexOf(ou)))}catch(e){console.error(e)}}n(su,"fetchOGSignature");async function iu(t){let e=Qn("og_auth");if(e)return e;let{customerId:r,timestamp:o,signature:s}=await su(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(iu,"getOrCreateAuthCookie");var na,oa=Os(...((na=F)==null?void 0:na.shopify_selling_plans)?[cn,fn]:[Or],F.shopify&&un),x=an(oa),au=x.isReady,cu=x.addOptinChangedCallback,lu=x.addTemplate,uu=x.clear,pu=x.config,du=x.disableOptinChangedCallbacks,fu=x.getOptins,hu=x.getProductsForPurchasePost,mu=x.initialize,gu=x.previewMode,yu=x.register,bu=x.resolveSettings,_u=x.setAuthUrl,Eu=x.setEnvironment,xu=x.setLocale,Su=x.setMerchantId,Tu=x.setPublicPath,vu=x.setTemplates,Ou=x.setupCart,wu=x.setupProduct,Cu=x.setupProducts,Pu=n(()=>Yn(x),"autoInit");var Ru=x.initialize,sa;((sa=F)==null?void 0:sa.shopify_selling_plans)&&Jt(()=>ra(x));return Au;})();
922
+ `}};n(pn,"Price");var Hl=n((t,e)=>{var r;return{productPlans:t.productPlans,configDefaultFrequency:(r=t.config)==null?void 0:r.defaultFrequency,frequency:Q(e.product)(t)}},"mapStateToProps"),Wi=g(Hl)(pn);M();function dn(t){Bi(),Ls(t);try{customElements.define("og-when",Ei),customElements.define("og-text",Ai),customElements.define("og-incentive-text",qi),customElements.define("og-offer",$i),customElements.define("og-select-frequency",Ui),customElements.define("og-optout-button",vi),customElements.define("og-optin-toggle",Ri),customElements.define("og-optin-status",Si),customElements.define("og-optin-button",Ti),customElements.define("og-optin-select",wi),customElements.define("og-upsell-button",Ci),customElements.define("og-frequency-status",Oi),customElements.define("og-modal",vr),customElements.define("og-select",Or),customElements.define("og-tooltip",wr),customElements.define("og-upsell-modal",Pi),customElements.define("og-next-upcoming-order",Di),customElements.define("og-price",Wi),customElements.define("og-prepaid-toggle",Vi)}catch{console.info("OG WebComponents already registered, skipping.")}let e=!1,r={store:t,isReady:()=>e,setEnvironment(o){return t.dispatch(Jr(o)),this},setMerchantId(o){return t.dispatch(us(o)),this},setAuthUrl(o){return t.dispatch(ps(o)),this},getProductsForPurchasePost(o=[]){return eo(t.getState(),o)},getOptins(o=[]){return eo(t.getState(),o)},clear(){t.dispatch(ms())},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(bs(o)),this},setLocale(o){return t.dispatch(ys(o)),this},addTemplate(o,s,i){return t.dispatch(_s(o,s,i)),this},setTemplates(o){return t.dispatch(Es(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}=Pt({},Jr(s)),{sessionId:u}=a.getState();u&&c.forEach(m=>{let p=R(m);ce.fetchOffer(l,o,u,`${p}`,Ee)}),i.product_discounts&&typeof i.product_discounts=="object"&&a.dispatch({type:X,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),Xr(window.opener,r),r}n(dn,"makeApi");L();M();var et=n(t=>t===null?"":`$${t.toString().replace(/(\d\d)$/,".$1")}`,"money"),Gl=n(t=>`${t}%`,"percentage"),Bl=n(t=>{var r,o;let e="";return((r=t.price_adjustments[0])==null?void 0:r.value_type)==="percentage"?e=Gl(t.price_adjustments[0].value):((o=t.price_adjustments[0])==null?void 0:o.value)?e=et(t.price_adjustments[0].value):t.compare_at_price&&(e=et(t.compare_at_price-t.price)),e?[et(t.compare_at_price),e,et(t.price)]:[et(t.price),"",et(t.price)]},"mapSellingPlanToDiscount"),Yi=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"),Ji=n((t,e,r)=>{if(!r)return null;if(!Ge(r))return r;if(rr(t,e)){let o=K(t,e,r);return o||Oe(t)}return r},"getDefaultSellingPlan"),zl=n((t,e)=>t.map(r=>{var o,s,i,a,c,l,u;return Ge(r==null?void 0:r.frequency)?{...r,frequency:rr((o=e==null?void 0:e.config)==null?void 0:o.frequencies,(s=e==null?void 0:e.config)==null?void 0:s.frequenciesEveryPeriod)?K((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)||K((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)||Oe((u=e==null?void 0:e.config)==null?void 0:u.frequencies):r.frequency}:r}),"mapExistingOptinsFromOfferResponse"),Wl=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:m}=i,p=r[c],f;return r[c]&&rr(l,u)?f=K(l,u,`${p.every}_${p.every_period}`)||Ji(l,u,m)||Oe(l):r[c]?f=`${p.every}_${p.every_period}`:f=Ji(l,u,m)||"_",a.concat({id:c,frequency:f})}return a},[]),"reduceNewOptinsFromOfferResponse"),Qi=n(t=>t==null?void 0:t.selling_plan_groups.find(r=>r.name==="Subscribe and Save"),"getOGSellingPlanGroup"),Yl=n((t,e)=>({...Yi(t,e.id,e.available),[e.id]:e.available}),"productOrVariantInStockReducer"),Ki=n((t,[e])=>({...t,[e]:!0}),"productTrue"),Zi=n((t,e)=>{var r;return{...t,[e.selling_plan_id||((r=e.selling_plan)==null?void 0:r.id)]:Bl(e)}},"sellingPlanAllocationsReducer"),Xi=n((t,e)=>{let r=R(e.key);return{...t,[e.key]:t[r]||null}},"reduceProductCartLine"),Jl=n((t={},e)=>{if(X===e.type)return Object.entries(e.payload).reduce(Ki,t);if(ae===e.type){let{payload:r}=e;return r.items.reduce(Xi,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{...Yi(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 Ql(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(Ql,"textToFreq");function ea(t){var e;return(e=t==null?void 0:t.selling_plans)==null?void 0:e.map(({options:r})=>r||[]).flat().map(({value:r})=>Ql(r))}n(ea,"sellingPlansToEveryPeriod");function ta(t){var e;return(e=t==null?void 0:t.selling_plans)==null?void 0:e.map(({id:r})=>`${r}`)}n(ta,"sellingPlansToFrequencies");function Kl(t){return t.reduce((e,r)=>{let o=r.name.split("-")[1],s=r.selling_plans.map(i=>{var c;let a=(c=i==null?void 0:i.options.find(({name:l})=>l==="Shipment amount"))==null?void 0:c.value.split(" ")[0];return{numberShipments:Number(a),sellingPlan:String(i.id)}});return{...e,[o]:s}},{})}n(Kl,"getPrepaidSellingPlans");var Zl=n((t={frequencies:[],offerType:"radio",frequenciesEveryPeriod:[]},e)=>{var r,o;if(X===e.type){let s=[...new Set(Object.values(e.payload).map(Object.keys).flat())];return{...t,frequencies:s}}if(Y===e.type){let{payload:{offer:s,product:i}}=e,a={},c=Qi(i),l=ta(c);if(l==null?void 0:l.length){let m=ea(c),p=((o=(r=c.options)==null?void 0:r[0])==null?void 0:o.values)||l,f=t.defaultFrequency;f&&Ge(f)&&(f=K(l,m,f)||Oe(l)||f),a={frequencies:l,frequenciesEveryPeriod:m,frequenciesText:p,...f?{defaultFrequency:f}:{}}}let u=i==null?void 0:i.selling_plan_groups.filter(m=>/^Prepaid-.*/.test(m.name));return u.length&&(a={...a,prepaidSellingPlans:Kl(u)}),{...t,...a}}if(P===e.type){let{payload:{offer:s}}=e,{defaultFrequency:i,config:{frequencies:a,frequenciesEveryPeriod:c}={}}=s;return Ge(i)?{...t,defaultFrequency:K(a,c,i)||Oe(a)||i}:{...t,defaultFrequency:i}}return t},"config"),Xl=n((t={},e)=>{if(X===e.type)return Object.entries(e.payload).reduce(Ki,t);if(ae===e.type)return e.payload.items.reduce(Xi,t);if(Y===e.type){let{payload:{product:r}}=e;return[r,...r==null?void 0:r.variants].reduce(Yl,t)||t}return W===e.type&&e.payload.product===null?{...t}:t},"inStock"),eu=n((t={},e)=>t,"offer");function tu({prepaidShipments:t,offer:e,product:r}){var o;if(t){let s=r.id,i=(o=e.config.prepaidSellingPlans[s])==null?void 0:o.find(a=>a.numberShipments===t);return i?i.sellingPlan:null}return e.config.frequencies[0]}n(tu,"getFrequencyForPrepaidShipments");var ru=n((t=[],e)=>{if(ae===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=zl(t,r),i=Wl(o,s,r);return[...s,...i]}if(Y===e.type){let{product:r}=e.payload,o=Qi(r),s=ta(o),i=ea(o);return t.map(a=>Ge(a.frequency)?{...a,frequency:K(s,i,a.frequency)||Oe(s)}:a)}if(se===e.type){let{payload:r}=e,o=Pr(t,e),[s,i]=Be(o,r.product);return i.concat({...s,...r.product,frequency:tu(r)})}return Pr(t,e)},"optedin"),ou=n((t={},e)=>t,"productOffer"),nu=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(Zi,{})}},t)||t}return ae===e.type?e.payload.items.reduce((o,s)=>s.selling_plan_allocation?{...o,[s.key]:Zi({},s.selling_plan_allocation)}:o,t)||t:X===e.type?{...e.payload}:t},"productPlans"),su=At({auth:Ko,authUrl:Xo,autoshipByDefault:cn,autoshipEligible:Jl,config:Zl,defaultFrequencies:ln,eligibilityGroups:Jo,environment:Pt,firstOrderPlaceDate:rn,incentives:Qo,inStock:Xl,locale:nn,merchantId:Zo,nextUpcomingOrder:Yo,offer:eu,offerId:en,optedin:ru,optedout:Wo,previewStandardOffer:sn,previewUpsellOffer:an,productOffer:ou,productPlans:nu,productToSubscribe:on,sessionId:tn,templates:un});function fn(t,e){return window.og&&window.og.previewMode?Rr(t,e):su(t,e)}n(fn,"shopifyReducer");var oa=ne(at()),na=ne(It());L();D();M();L();function ra(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(ra,"updateTrackingInputs");function hn(){return`og__${Math.ceil(new Date().getTime()/1e3)}`}n(hn,"getTrackingKey");function iu(t,e){var m,p,f,O;if(!((m=t.payload.offer)==null?void 0:m.autoshipByDefault))return;let o=(p=t.payload.offer)==null?void 0:p.product.id,s=hn(),i=((f=t.payload.offer)==null?void 0:f.location)||"",a=((O=t.payload.offer)==null?void 0:O.variationId)||"",c=yn(o,e),u=[o,A.toLowerCase(),i,c,a].join(",");ra(o,s,u)}n(iu,"addDefaultToSubTracking");function mn(t){return e=>r=>{switch(e(r),r.type){case A:case q:case U:let o=r.payload.offer,s=gn(r);o&&!o.isCart&&ra(o.product.id,s[0],s[1]);break;case P:iu(r,t);break;default:}}}n(mn,"shopifyTrackingMiddleware");var la,ua,sa=((ua=(la=window.Shopify)==null?void 0:la.routes)==null?void 0:ua.root)||"/",au="/cart",cu=`${sa}cart.js`,lu=`${sa}products/`,uu='[id^="shopify-section-"][id$=__cart-items], [id^="shopify-section-"][id$="__cart-footer"],#cart-live-region-text,#cart-icon-bubble',ia=(0,na.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 pu(t,e){let r=du();if(r)try{let s=await ca(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=>ia(o,e)),new MutationObserver(()=>ia(o,e)).observe(o,{subtree:!0,childList:!0})):console.info("no /cart/add form found for og-offer",e)}n(pu,"setupPdp");var aa=n(async()=>await(await fetch(cu)).json(),"getCart");function du(){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(du,"guessProductHandle");var ca=(0,oa.default)(async t=>(await fetch(`${lu}${t}.js`)).json());async function fu(t,e){let r=await aa(),{items:o}=r;t.dispatch({type:ae,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(ca))).forEach(a=>t.dispatch({type:Y,payload:{product:a,offer:e}}))}n(fu,"setupCart");async function hu(t,e){var i,a;let r=t.payload.offer,o=t.payload.frequency||null,s=gn(t);if(!!(r==null?void 0:r.isCart))try{r.style.pointerEvents="none",r.style.opacity=".7";let c=Array.from(document.querySelectorAll(uu)),l=t.payload.product.id,u=await aa(),m=(i=u==null?void 0:u.items)==null?void 0:i.findIndex(y=>y.key===l),p=u.items[m],f=p.quantity,O=R(l),_=await fetch("/cart/change.js",{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:l,quantity:f,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 h=await _.json(),x=u.items.length===h.items.length?h.items[m].key:(a=h.items.find(y=>y.quantity===f&&y.product_id===O&&(!o&&!y.selling_plan_allocation||(y==null?void 0:y.selling_plan_allocation.selling_plan.id)===o)))==null?void 0:a.key;x&&r.setAttribute("product",x),e.dispatch({type:ae,payload:h});let C=new CustomEvent(jn,{bubbles:!0,cancelable:!0});if(r.dispatchEvent(C),C.defaultPrevented)return;let b=h.sections;Object.values(b).length?c.forEach(y=>{let Rt=y.id.replace(/^shopify-section-/,"");if(!(Rt in b))return;let ga=b[Rt],_n=new DOMParser().parseFromString(ga.toString()||"","text/html").getElementById(y.id);_n&&(y.innerHTML=_n.innerHTML)}):window.location.pathname.startsWith(au)&&window.location.reload()}catch(c){console.log("OG Error updating cart",c)}finally{r.style.pointerEvents="auto",r.style.opacity="1"}}n(hu,"synchronizeCartOptin");function gn(t){var a,c;let e=t.payload.product.id;if(!e)return[];let r=hn(),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 q:i.push(""),i.push(s);break;case A:case U:i.push(t.payload.frequency),i.push(s);break;default:return[]}return[r,i.join(",")]}n(gn,"getTrackingEvent");function yn(t,e){var s;return(s=Xt({id:t})(e.getState()))==null?void 0:s.frequency}n(yn,"getSubscribedFrequency");function mu(t,e){e.isCart||[...document.querySelectorAll('form[action$="/cart/add"] [name=id]')].forEach(r=>{let o=r.value,s=yn(o,t);is(r.form,"selling_plan",s)})}n(mu,"synchronizeSellingPlan");function bn(t){return e=>r=>{var o;switch(r.type){case A:case q:case U:break;case W:((o=r.payload.offer)==null?void 0:o.isCart)?fu(t,r.payload.offer):pu(t,r.payload.offer);break;default:}switch(e(r),r.type){case A:case q:case U:hu(r,t);case se:case W:case P:case Y:mu(t,r.payload.offer);break;default:}}}n(bn,"shopifyMiddleware");dt();M();I();M();var gu="/apps/subscriptions/auth/",pa="og_auth_begin",yu="og_auth_end",bu=n(t=>{let[e,r,o,s]=atob(t).split("|");return{id:e,signature:o,timestamp:r,email:s}},"parseIntegrationTempAuth");async function da({store:t}){var s;let[e]=Gr(),r=ft(),o=(r==null?void 0:r.dataset.customer)?bu(r.dataset.customer):(s=window.ogShopifyConfig)==null?void 0:s.customer;if(o){let i=await Eu(o);if(i){let[a,c,l]=i.split("|");t.dispatch(mt(e,a,Number(c),l))}}else ns("og_auth")}n(da,"authorizeShopifyCustomer");async function _u(t){try{let r=await(await fetch(`${gu}?customer=${t.id}&customer_signature=${t.signature}&customer_timestamp=${t.timestamp}`)).text(),o=r.lastIndexOf(pa);if(o<0)throw"Invalid response from OG auth endpoint";return JSON.parse(r.substring(o+pa.length,r.lastIndexOf(yu)))}catch(e){console.error(e)}}n(_u,"fetchOGSignature");async function Eu(t){let e=ss("og_auth");if(e)return e;let{customerId:r,timestamp:o,signature:s}=await _u(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(Eu,"getOrCreateAuthCookie");var ha,fa=qs(...((ha=F)==null?void 0:ha.shopify_selling_plans)?[fn,bn]:[Rr],F.shopify&&mn),T=dn(fa),xu=T.isReady,Su=T.addOptinChangedCallback,Tu=T.addTemplate,vu=T.clear,Ou=T.config,wu=T.disableOptinChangedCallbacks,Cu=T.getOptins,Pu=T.getProductsForPurchasePost,Ru=T.initialize,Au=T.previewMode,Nu=T.register,Iu=T.resolveSettings,ku=T.setAuthUrl,qu=T.setEnvironment,Uu=T.setLocale,Fu=T.setMerchantId,Du=T.setPublicPath,Lu=T.setTemplates,Mu=T.setupCart,ju=T.setupProduct,$u=T.setupProducts,Vu=n(()=>os(T),"autoInit");var Hu=T.initialize,ma;((ma=F)==null?void 0:ma.shopify_selling_plans)&&tr(()=>da(T));return Gu;})();
889
923
  ; return lib; });
890
924
  //# sourceMappingURL=offers.js.map