@ordergroove/offers 2.27.22 → 2.27.23-alpha-PR-672-4.2

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