@ordergroove/offers 2.30.3 → 2.30.4-alpha-PR-716-2.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle-report.html +2 -2
- package/dist/offers.js +16 -16
- package/dist/offers.js.map +2 -2
- package/package.json +2 -2
- package/src/shopify/shopifyMiddleware.ts +12 -11
package/dist/offers.js
CHANGED
|
@@ -8,8 +8,8 @@ else {
|
|
|
8
8
|
window.og['offers'] = factory();
|
|
9
9
|
}
|
|
10
10
|
})(()=>{
|
|
11
|
-
var lib=(()=>{var Na=Object.create;var ot=Object.defineProperty;var Ia=Object.getOwnPropertyDescriptor;var ka=Object.getOwnPropertyNames;var qa=Object.getPrototypeOf,Da=Object.prototype.hasOwnProperty;var Nn=t=>ot(t,"__esModule",{value:!0}),n=(t,e)=>ot(t,"name",{value:e,configurable:!0});var S=(t,e)=>()=>(t&&(e=t(t=0)),e);var _e=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Fr=(t,e)=>{Nn(t);for(var r in e)ot(t,r,{get:e[r],enumerable:!0})},Fa=(t,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of ka(e))!Da.call(t,o)&&o!=="default"&&ot(t,o,{get:()=>e[o],enumerable:!(r=Ia(e,o))||r.enumerable});return t},ce=t=>Fa(Nn(ot(t!=null?Na(qa(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var qt=_e((kt,Mn)=>{(function(t,e){typeof kt=="object"&&typeof Mn!="undefined"?e(kt):typeof define=="function"&&define.amd?define(["exports"],e):(t=t||self,e(t.throttleDebounce={}))})(kt,function(t){"use strict";function e(o,s,i,a){var c,l=!1,p=0;function f(){c&&clearTimeout(c)}n(f,"clearExistingTimeout");function u(){f(),l=!0}n(u,"cancel"),typeof s!="boolean"&&(a=i,i=s,s=void 0);function h(){for(var P=arguments.length,_=new Array(P),m=0;m<P;m++)_[m]=arguments[m];var x=this,C=Date.now()-p;if(l)return;function b(){p=Date.now(),i.apply(x,_)}n(b,"exec");function y(){c=void 0}n(y,"clear"),a&&!c&&b(),f(),a===void 0&&C>o?b():s!==!0&&(c=setTimeout(a?y:b,a===void 0?o-C:o))}return n(h,"wrapper"),h.cancel=u,h}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 $n(){return typeof window.og_auth!="undefined"?Dt(window.og_auth):null}async function za(t=100){return new Promise(e=>{setTimeout(()=>e($n()),t)})}async function Vn(t,e=Ha,r=Ga){let o;if(o=Dt($n())||Dt(e()),o)return o;if(t&&typeof t=="string"){let s=await fetch(t);s.status>=200&&s.status<300&&(o=e()||await(Ba(s)?s.json():Promise.resolve(r(t)).then(e)))}else o||(o=await za());if(o=Dt(o),o)return o;throw new Error("Unauthorized")}var jn,Ha,Dt,Ga,Ba,Hn=S(()=>{jn=/^og_auth=/,Ha=n((t=jn)=>(document.cookie.split(/;\s*/).find(e=>e.match(t))||"").replace(jn,""),"c"),Dt=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"),Ga=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"),Ba=n(t=>(t.headers.get("content-type")||"").indexOf("application/json")!==-1,"d");n($n,"a");n(za,"f");n(Vn,"u")});var N,q,D,re,Ue,J,R,st,Le,Ft,Gn,Ut,Se,Bn,Lt,Mt,zn,Me,je,$e,Wn,Yn,jt,Jn,$t,Ve,Qn,Vt,He,it,at,Vr,Ht,Gt,Ee,le,Bt,zt,B,Q,pe,xe,Wt,ve,Te,Yt,Jt,Kn,j=S(()=>{N="OPTIN_PRODUCT",q="OPTOUT_PRODUCT",D="PRODUCT_CHANGE_FREQUENCY",re="PRODUCT_CHANGE_PREPAID_SHIPMENTS",Ue="SET_MERCHANT_ID",J="REQUEST_OFFER",R="RECEIVE_OFFER",st="PRODUCT_HAS_CHANGED",Le="CREATED_SESSION_ID",Ft="SET_AUTH_URL",Gn="REQUEST_AUTH",Ut="AUTHORIZE",Se="UNAUTHORIZED",Bn="REQUEST_ORDERS",Lt="RECEIVE_ORDERS",Mt="RECEIVE_ORDER_ITEMS",zn="FETCH_RESPONSE_ERROR",Me="SET_ENVIRONMENT_STAGING",je="SET_ENVIRONMENT_DEV",$e="SET_ENVIRONMENT_PROD",Wn="CONCLUDE_UPSELL",Yn="REQUEST_CREATE_IU_ORDER",jt="CREATE_ONE_TIME",Jn="REQUEST_CONVERT_ONE_TIME",$t="CONVERT_ONE_TIME",Ve="CHECKOUT",Qn="RECEIVE_FETCH",Vt="SET_LOCALE",He="SET_CONFIG",it="SET_PREVIEW_STANDARD_OFFER",at="SET_PREVIEW_UPSELL_OFFER",Vr="SET_PREVIEW_PREPAID_OFFER",Ht="ADD_TEMPLATE",Gt="SET_TEMPLATES",Ee="LOCAL_STORAGE_CHANGE",le="LOCAL_STORAGE_CLEAR",Bt="SET_FIRST_ORDER_PLACE_DATE",zt="SET_PRODUCT_TO_SUBSCRIBE",B="RECEIVE_PRODUCT_PLANS",Q="SETUP_PRODUCT",pe="SETUP_CART",xe="pdp",Wt="dev",ve="staging",Te="prod",Yt="static.ordergroove.com",Jt="staging.static.ordergroove.com",Kn="og-cart-updated"});var lt=_e((Ou,ss)=>{var Wa="Expected a function",Zn="__lodash_hash_undefined__",Ya="[object Function]",Ja="[object GeneratorFunction]",Qa=/[\\^$.*+?()[\]{}|]/g,Ka=/^\[object .+?Constructor\]$/,Za=typeof window=="object"&&window&&window.Object===Object&&window,Xa=typeof self=="object"&&self&&self.Object===Object&&self,Xn=Za||Xa||Function("return this")();function ec(t,e){return t==null?void 0:t[e]}n(ec,"getValue");function tc(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}n(tc,"isHostObject");var rc=Array.prototype,oc=Function.prototype,es=Object.prototype,Hr=Xn["__core-js_shared__"],ts=function(){var t=/[^.]+$/.exec(Hr&&Hr.keys&&Hr.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),rs=oc.toString,Gr=es.hasOwnProperty,nc=es.toString,sc=RegExp("^"+rs.call(Gr).replace(Qa,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ic=rc.splice,ac=os(Xn,"Map"),ct=os(Object,"create");function Oe(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(Oe,"Hash");function cc(){this.__data__=ct?ct(null):{}}n(cc,"hashClear");function lc(t){return this.has(t)&&delete this.__data__[t]}n(lc,"hashDelete");function pc(t){var e=this.__data__;if(ct){var r=e[t];return r===Zn?void 0:r}return Gr.call(e,t)?e[t]:void 0}n(pc,"hashGet");function uc(t){var e=this.__data__;return ct?e[t]!==void 0:Gr.call(e,t)}n(uc,"hashHas");function dc(t,e){var r=this.__data__;return r[t]=ct&&e===void 0?Zn:e,this}n(dc,"hashSet");Oe.prototype.clear=cc;Oe.prototype.delete=lc;Oe.prototype.get=pc;Oe.prototype.has=uc;Oe.prototype.set=dc;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,"ListCache");function fc(){this.__data__=[]}n(fc,"listCacheClear");function hc(t){var e=this.__data__,r=Qt(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():ic.call(e,r,1),!0}n(hc,"listCacheDelete");function mc(t){var e=this.__data__,r=Qt(e,t);return r<0?void 0:e[r][1]}n(mc,"listCacheGet");function gc(t){return Qt(this.__data__,t)>-1}n(gc,"listCacheHas");function yc(t,e){var r=this.__data__,o=Qt(r,t);return o<0?r.push([t,e]):r[o][1]=e,this}n(yc,"listCacheSet");Ge.prototype.clear=fc;Ge.prototype.delete=hc;Ge.prototype.get=mc;Ge.prototype.has=gc;Ge.prototype.set=yc;function Pe(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}n(Pe,"MapCache");function bc(){this.__data__={hash:new Oe,map:new(ac||Ge),string:new Oe}}n(bc,"mapCacheClear");function _c(t){return Kt(this,t).delete(t)}n(_c,"mapCacheDelete");function Sc(t){return Kt(this,t).get(t)}n(Sc,"mapCacheGet");function Ec(t){return Kt(this,t).has(t)}n(Ec,"mapCacheHas");function xc(t,e){return Kt(this,t).set(t,e),this}n(xc,"mapCacheSet");Pe.prototype.clear=bc;Pe.prototype.delete=_c;Pe.prototype.get=Sc;Pe.prototype.has=Ec;Pe.prototype.set=xc;function Qt(t,e){for(var r=t.length;r--;)if(wc(t[r][0],e))return r;return-1}n(Qt,"assocIndexOf");function vc(t){if(!ns(t)||Oc(t))return!1;var e=Cc(t)||tc(t)?sc:Ka;return e.test(Pc(t))}n(vc,"baseIsNative");function Kt(t,e){var r=t.__data__;return Tc(e)?r[typeof e=="string"?"string":"hash"]:r.map}n(Kt,"getMapData");function os(t,e){var r=ec(t,e);return vc(r)?r:void 0}n(os,"getNative");function Tc(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}n(Tc,"isKeyable");function Oc(t){return!!ts&&ts in t}n(Oc,"isMasked");function Pc(t){if(t!=null){try{return rs.call(t)}catch{}try{return t+""}catch{}}return""}n(Pc,"toSource");function Br(t,e){if(typeof t!="function"||e&&typeof e!="function")throw new TypeError(Wa);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(Br.Cache||Pe),r}n(Br,"memoize");Br.Cache=Pe;function wc(t,e){return t===e||t!==t&&e!==e}n(wc,"eq");function Cc(t){var e=ns(t)?nc.call(t):"";return e==Ya||e==Ja}n(Cc,"isFunction");function ns(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}n(ns,"isObject");ss.exports=Br});var Zt,zr,pt,ut,Xt,is,as,Rc,Ac,Nc,Ic,kc,dt,Wr,qc,cs,ft,Dc,ue,de=S(()=>{Zt=ce(lt()),zr=n((...t)=>JSON.stringify(t),"memoizeKey"),pt=n(t=>(...e)=>fetch(...t(...e)).then(r=>r.json()),"withFetchJson"),ut=n(t=>(e,...r)=>{if(!e)throw Error("host required");let[o,s={}]=t(...r);return[`${e.replace(/\/+$/,"")}${o}`,s]},"withHost"),Xt=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"),is=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"),as=n((t=[])=>(Array.isArray(t)?t:Object.entries(t)).map(([e,r])=>[e,encodeURIComponent(r)].join("=")).join("&"),"toQuery"),Rc=n(t=>JSON.stringify([].concat(t).map(e=>typeof e=="object"?e.id:e).filter(e=>e)),"toProductId"),Ac=(0,Zt.default)(pt(ut((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=as([["session_id",e],["page_type",1],["p",Rc(r)],["module_view",JSON.stringify(["regular"])]]);return[`/offer/${t}/${o}?${s}`]})),zr),Nc=(0,Zt.default)(pt(ut(Xt((t=1,e="place")=>[`/orders/?${as([["status",t],["ordering",e],["exclude_prepaid_orders","true"]])}`]))),zr),Ic=(0,Zt.default)(pt(ut(Xt(t=>{if(!t)throw Error("orderId required");return[`/items/?order=${t}`]}))),zr),kc=pt(ut(Xt(is((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}}]})))),dt=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"),Wr=n(t=>t.match(/^\d+_\d$/),"isFrequencyValid"),qc=n((t,e)=>String.prototype.localeCompare.call(t&&t.split("_").reverse().join("_"),e&&e.split("_").reverse().join("_")),"compareFrequencies"),cs=n(t=>[...new Set(t&&t.split(/\s+/))].filter(Wr).sort(qc),"parseFrequenciesList"),ft=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"),Dc=pt(ut(Xt(is((t,e,r)=>{if(!t)throw Error("item required");if(!e)throw Error("frequency required");let o=dt(e);if(!o)throw Error("invalid frequency");return["/subscriptions/create_from_item/",{body:{item:t.public_id,offer:r,...o}}]})))),ue={fetchOffer:Ac,fetchOrders:Nc,fetchItems:Ic,createOneTime:kc,convertOneTimeToSubscription:Dc}});var Yr,L,ht=S(()=>{F();Yr=mt(),L={shopify:typeof window.Shopify!="undefined",shopify_selling_plans:typeof(Yr==null?void 0:Yr.dataset.shopifySellingPlans)!="undefined"}});function Fc(t,e){return t===e}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}function Lc(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Fc,r=null,o=null;return function(){return Uc(e,r,arguments)||(o=t.apply(null,arguments)),r=arguments,o}}function Mc(t){var e=Array.isArray(t[0])?t[0]:t;if(!e.every(function(o){return typeof o=="function"})){var r=e.map(function(o){return typeof o}).join(", ");throw new Error("Selector creators expect all input-selectors to be functions, "+("instead received the following types: ["+r+"]"))}return e}function jc(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(),p=Mc(i),f=t.apply(void 0,[function(){return c++,l.apply(null,arguments)}].concat(r)),u=t(function(){for(var h=[],P=p.length,_=0;_<P;_++)h.push(p[_].apply(null,arguments));return f.apply(null,h)});return u.resultFunc=l,u.dependencies=p,u.recomputations=function(){return c},u.resetRecomputations=function(){return c=0},u}}var K,ls=S(()=>{n(Fc,"defaultEqualityCheck");n(Uc,"areArgumentsShallowlyEqual");n(Lc,"defaultMemoize");n(Mc,"getDependencies");n(jc,"createSelectorCreator");K=jc(Lc)});function $c(t,e){if(t===e)return!0;if(t===null||e===null||t.length!==e.length)return!1;for(let r=0;r<t.length;++r)if(t[r]!==e[r])return!1;return!0}function Vc(t,e,r){let o=ft(r);return L.shopify_selling_plans?ee(t,e,o):o}var z,I,gt,ps,Jr,Hc,Gc,Bc,zc,Wc,Z,er,us,tr,rr,X,or,ds,Be,Qr,H,ze,U=S(()=>{ls();z=ce(lt());de();ht();F();z.default.Cache=Map;n($c,"arraysEqual");n(Vc,"resolveFrequency");I=n((t,e)=>!!(t===e||typeof t=="object"&&typeof e=="object"&&t&&e&&t.id===e.id&&(!(Array.isArray(t.components)&&Array.isArray(e.components))||$c((t.components||[]).sort(),(e.components||[]).sort()))),"isSameProduct"),gt=n(t=>t.optedin||[],"optedinSelector"),ps=n(t=>t.optedout||[],"optedoutSelector"),Jr=n(t=>t.autoshipByDefault||{},"autoshipSelector"),Hc=n(t=>t.defaultFrequencies||{},"defaultFrequenciesSelector"),Gc=n(t=>{var e;return((e=t==null?void 0:t.config)==null?void 0:e.frequencies)||[]},"sellingPlansSelector"),Bc=n(t=>{var e;return((e=t==null?void 0:t.config)==null?void 0:e.frequenciesEveryPeriod)||[]},"frequenciesEveryPeriodSelector"),zc=n(t=>{var e;return((e=t==null?void 0:t.config)==null?void 0:e.prepaidSellingPlans)||[]},"prepaidSellingPlansSelector"),Wc=n(t=>(t==null?void 0:t.prepaidShipmentsSelected)||{},"prepaidShipmentsSelectedSelector"),Z=(0,z.default)(t=>K(gt,ps,Jr,(e,r,o)=>{let s=e.find(i=>I(t,i));return s||(r.find(i=>I(t,i))?!1:t&&o[t.id]?{id:t.id}:!1)}),t=>JSON.stringify(t)),er=(0,z.default)(t=>K(gt,e=>{let r=e.find(o=>I(t,o));return r||!1}),t=>JSON.stringify(t)),us=(0,z.default)(t=>K(gt,e=>e.some(r=>I(t,r)&&r.prepaidShipments)),t=>JSON.stringify(t)),tr=(0,z.default)(t=>K(Wc,e=>e[t.id]||null),t=>JSON.stringify(t)),rr=(0,z.default)(t=>K(ps,e=>e.find(r=>I(t,r)))),X=(0,z.default)(t=>K(Z(t),e=>e&&e.frequency||null)),or=(0,z.default)(t=>K(Z(t),e=>e&&e.prepaidShipments||null)),ds=(0,z.default)(t=>K(zc,e=>{var r;return((r=e[t])==null?void 0:r.map(({numberShipments:o})=>o))||[]})),Be=(0,z.default)(t=>K(Hc,Gc,Bc,(e,r,o)=>e[w(t)]&&Vc(r,o,e[w(t)])||null)),Qr=n(t=>t.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase(),"kebabCase"),H=n((t,e,r,o)=>({[r]:t.config&&t.config[r]||e&&e.hasAttribute&&e.hasAttribute(Qr(r))&&e[r]||e.offer&&typeof(e.offer[r]!=="undefined")&&e.offer[r]||o}),"configSelector"),ze=n(t=>({templates:t.templates||[]}),"templatesSelector")});function nr(t){document.readyState==="loading"?window.addEventListener("DOMContentLoaded",t):t()}function mt(){return document.querySelector([`script[src^="https://${Yt}"]`,`script[src^="https://${Jt}"]`,`script[src^="http://${Yt}"]`,`script[src^="http://${Jt}"]`].join(","))}function Kr(){let t=mt();if(!t)return[];let e=new URL(t.src),r=e.host.startsWith(ve)?ve:Te,o=e.pathname.split("/")[1];return!r&&!o?[]:[o,r,t]}function hs(t){if(t.isReady())return;console.info("OG offers are auto initializing");let[e,r]=Kr();if(!r&&!e)return;let o=document.createElement("script");o.onload=()=>console.info("OG pull initialization chunk for merchant",e,r),o.onerror=()=>t.initialize(e,r),o.src=`${window.location.protocol}//${r===Te?Yt:Jt}/${e}/main.js?initOnly=true`,document.head.appendChild(o)}function gs(t){let e=document.cookie.match(`(^|;) ?${t}=([^;]*)(;|$)`);return e?e[2]:null}function ys(t,e,r){let o=t.querySelector(`[name="${e}"]`);if(o&&!r){o.remove();return}!o&&r&&(o=document.createElement("input"),o.type="hidden",o.name=e,t.appendChild(o)),o&&(o.value=r)}function Ye(t,e){let[[r],o]=t.reduce((s,i)=>s[I(e,i)?0:1].push(i)&&s,[[],[]]);return[r||{},o||[]]}var w,fs,Zr,ms,We,we,sr,ee,F=S(()=>{ht();j();U();n(nr,"onReady");n(mt,"getMainJs");n(Kr,"resolveEnvAndMerchant");w=n(t=>{var r;if(!t)return"";let e=`${t.id||t}`;return((r=L)==null?void 0:r.shopify_selling_plans)&&(e=e.split(":")[0]),e},"safeProductId"),fs=n((t,e)=>{var r;if(L.shopify_selling_plans){let o=(r=e.frequencies)==null?void 0:r.indexOf(t);if(o>=0&&e.frequenciesEveryPeriod[o])return e.frequenciesEveryPeriod[o]}return t},"safeOgFrequency"),Zr=n((t,e)=>{var o;if(!`${t}`.includes("_"))return t;let r=(o=e.frequenciesEveryPeriod)==null?void 0:o.indexOf(t);return r>=0&&e.frequenciesEveryPeriod[r]?e.frequencies[r]:t},"frequencyToSellingPlan");n(hs,"autoInitializeOffers");ms=n(t=>{document.cookie=`${t}=; expires=Thu, 01 Jan 1970 00:00:01 GMT;`},"clearCookie");n(gs,"getCookieValue");We=n(t=>!!(t&&(t==null?void 0:t.includes("_"))),"isOgFrequency"),we=n((t=[])=>(t==null?void 0:t[0])||null,"getFirstSellingPlan"),sr=n((t=[],e=[])=>{var r;return!!(((r=L)==null?void 0:r.shopify_selling_plans)&&t.length&&e.length)},"hasShopifySellingPlans"),ee=n((t,e,r)=>{if(t.length!==e.length)return null;let o=e.findIndex(s=>s===r);return o>=0?t[o]:null},"mapFrequencyToSellingPlan");n(ys,"getOrCreateHidden");n(Ye,"getMatchingProductIfExists")});var oe,Je,bs,ir,_s,Ss,Es,Xr,Yc,yt,fe,xs,ar,vs,Jc,eo,to,cr,ro,Ts,Ce,oo,Qc,Os,Ps,Kc,Zc,Xc,el,ws,Cs,Rs,As,Ns,Is,ks,k=S(()=>{Hn();j();de();F();oe=n((t,e,r)=>({type:N,payload:{product:t,frequency:e,offer:r}}),"optinProduct"),Je=n((t,e)=>({type:q,payload:{product:t,offer:e}}),"optoutProduct"),bs=n((t,e)=>({type:st,payload:{newProduct:t,product:e}}),"productHasChangedComponents"),ir=n((t,e,r)=>({type:D,payload:{product:t,frequency:e,offer:r}}),"productChangeFrequency"),_s=n((t,e,r)=>({type:re,payload:{product:t,prepaidShipments:e,offer:r}}),"productChangePrepaidShipments"),Ss=n(t=>({type:Wn,payload:{product:t}}),"concludeUpsell"),Es=n(t=>({type:Ue,payload:t}),"setMerchantId"),Xr=n(t=>({type:Le,payload:`${t}.${Math.floor(Math.random()*999999)}.${Math.round(new Date().getTime()/1e3)}`}),"createSessionId"),Yc=n(t=>({type:Gn,payload:t}),"requestAuth"),yt=n((t,e,r,o)=>({type:Ut,payload:{public_id:t,sig_field:e,ts:r,sig:o}}),"authorize"),fe=n(t=>({type:Se,payload:t}),"unauthorized"),xs=n(t=>({type:Ft,payload:t}),"setAuthUrl"),ar=n(t=>({type:Qn,payload:t}),"fetchDone"),vs=n((t=Vn)=>n(function(r,o){if(window.og&&window.og.previewMode)return r(fe({message:"Offers are running in preview mode"}));let{merchantId:s,authUrl:i}=o(),a=Yc(i);return r(a),t(i).then(({sig_field:c,ts:l,sig:p})=>r(yt(s,c,l,p)),c=>r(fe(c))).finally(()=>r(ar(a)))},"fetchAuthThunk"),"fetchAuth"),Jc=n((t,e)=>({type:Bn,payload:{status:t,ordering:e}}),"requestOrders"),eo=n(t=>({type:Lt,payload:t}),"receiveOrders"),to=n(t=>({type:Mt,payload:t}),"receiveItems"),cr=n((t=1,e="place")=>n(function(o,s){let{environment:{legoUrl:i},auth:a}=s();if(!a)return o(fe("No auth set."));let c=Jc(t,e);return o(c),ue.fetchOrders(i,a,t,e).then(l=>{if(l.results){o(eo(l));let p=(l.results[0]||{}).public_id;if(p)return ue.fetchItems(i,a,p).then(f=>o(to(f)))}return o(fe(l.detail)),null},l=>o(fe(l))).finally(()=>o(ar(c)))},"fetchOrdersThunk"),"fetchOrders"),ro=n(t=>{switch(t){case Wt:return{type:je,payload:t};case ve:return{type:Me,payload:t};case Te:return{type:$e,payload:t};default:throw new Error(`${t} is not a supported environment`)}},"setEnvironment"),Ts=n(()=>(t,e)=>{let{merchantId:r,sessionId:o}=e();return(!o||r&&!o.startsWith(r))&&t(Xr(r)),o},"requestSessionId"),Ce=n((t,e)=>({type:R,payload:{...t,offer:e}}),"receiveOffer"),oo=n(t=>({type:zn,payload:t}),"fetchResponseError"),Qc=n((t,e=xe,r)=>({type:J,payload:{product:t,module:e,offer:r}}),"requestOffer"),Os=n((t,e=xe,r)=>n(function(s,i){let{merchantId:a,sessionId:c,environment:{apiUrl:l}}=i(),p=Qc(t,e,r);s(p);let f=w(t);return f?ue.fetchOffer(l,a,c,f,e).then(u=>s(Ce(u,r)),u=>s(oo(u))).finally(()=>s(ar(p))):null},"fetchOfferThunk"),"fetchOffer"),Ps=n(()=>({type:Ve}),"checkout"),Kc=n((t,e,r,o)=>({type:Yn,payload:{product:t,order:e,quantity:r,offerId:o}}),"requestCreateOneTime"),Zc=n(t=>({type:jt,payload:t}),"receiveCreateOneTime"),Xc=n((t,e)=>({type:Jn,payload:{item:t,frequency:e}}),"requestConvertOneTimeToSubscription"),el=n((t,e)=>({type:$t,payload:{response:t,product:e}}),"receiveConvertOneTime"),ws=n((t,e,r,o=!1,s=null)=>n(function(a,c){let{auth:l,config:p,environment:{legoUrl:f},previewUpsellOffer:u,offerId:h}=c();if(!l)return a(fe("No auth set."));let P=fs(s,p),_=Kc(t,e,r,h);return a(_),(u?Promise.resolve({legoUrl:f,product:t,order:e,quantity:r,offer:h}):ue.createOneTime(f,l,t.id,e,r,h)).then(m=>(a(Zc(m)),o?(a(Xc(m,P)),(u?Promise.resolve({item:m,frequency:P}):ue.convertOneTimeToSubscription(f,l,m,P,h)).then(x=>a(el(x,t)),x=>a(oo(x)))):m),m=>a(oo(m))).finally(()=>a(ar(_)))},"createIuThunk"),"createIu"),Cs=n(t=>({type:Vt,payload:t}),"setLocale"),Rs=n(t=>({type:He,payload:t}),"setConfig"),As=n((t,e,r)=>({type:Ht,payload:{selector:t,markup:e,config:r}}),"addTemplate"),Ns=n(t=>({type:Gt,payload:t}),"setTemplates"),Is=n((t,e)=>({type:Bt,payload:{product:t,firstOrderPlaceDate:e}}),"setFirstOrderPlaceDate"),ks=n((t,e)=>({type:zt,payload:{product:t,productToSubscribe:e}}),"setProductToSubscribe")});var co,Re,Ae=S(()=>{co=typeof window!="undefined"&&window.customElements!=null&&window.customElements.polyfillWrapFlushCallback!==void 0,Re=n((t,e,r=null)=>{for(;e!==r;){let o=e.nextSibling;t.removeChild(e),e=o}},"removeNodes")});var G,lo,Qs,Ke,Ne,Ks,_t,te,ur,he=S(()=>{G=`{{lit-${String(Math.random()).slice(2)}}}`,lo=`<!--${G}-->`,Qs=new RegExp(`${G}|${lo}`),Ke="$lit$",Ne=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:p,values:{length:f}}=e;for(;l<f;){let u=i.nextNode();if(u===null){i.currentNode=s.pop();continue}if(c++,u.nodeType===1){if(u.hasAttributes()){let h=u.attributes,{length:P}=h,_=0;for(let m=0;m<P;m++)Ks(h[m].name,Ke)&&_++;for(;_-- >0;){let m=p[l],x=ur.exec(m)[2],C=x.toLowerCase()+Ke,b=u.getAttribute(C);u.removeAttribute(C);let y=b.split(Qs);this.parts.push({type:"attribute",index:c,name:x,strings:y}),l+=y.length-1}}u.tagName==="TEMPLATE"&&(s.push(u),i.currentNode=u.content)}else if(u.nodeType===3){let h=u.data;if(h.indexOf(G)>=0){let P=u.parentNode,_=h.split(Qs),m=_.length-1;for(let x=0;x<m;x++){let C,b=_[x];if(b==="")C=te();else{let y=ur.exec(b);y!==null&&Ks(y[2],Ke)&&(b=b.slice(0,y.index)+y[1]+y[2].slice(0,-Ke.length)+y[3]),C=document.createTextNode(b)}P.insertBefore(C,u),this.parts.push({type:"node",index:++c})}_[m]===""?(P.insertBefore(te(),u),o.push(u)):u.data=_[m],l+=m}}else if(u.nodeType===8)if(u.data===G){let h=u.parentNode;(u.previousSibling===null||c===a)&&(c++,h.insertBefore(te(),u)),a=c,this.parts.push({type:"node",index:c}),u.nextSibling===null?u.data="":(o.push(u),c--),l++}else{let h=-1;for(;(h=u.data.indexOf(G,h+1))!==-1;)this.parts.push({type:"node",index:-1}),l++}}for(let u of o)u.parentNode.removeChild(u)}};n(Ne,"Template");Ks=n((t,e)=>{let r=t.length-e.length;return r>=0&&t.slice(r)===e},"endsWith"),_t=n(t=>t.index!==-1,"isTemplatePartActive"),te=n(()=>document.createComment(""),"createMarker"),ur=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/});function uo(t,e){let{element:{content:r},parts:o}=t,s=document.createTreeWalker(r,po,null,!1),i=St(o),a=o[i],c=-1,l=0,p=[],f=null;for(;s.nextNode();){c++;let u=s.currentNode;for(u.previousSibling===f&&(f=null),e.has(u)&&(p.push(u),f===null&&(f=u)),f!==null&&l++;a!==void 0&&a.index===c;)a.index=f!==null?-1:a.index-l,i=St(o,i),a=o[i]}p.forEach(u=>u.parentNode.removeChild(u))}function Zs(t,e,r=null){let{element:{content:o},parts:s}=t;if(r==null){o.appendChild(e);return}let i=document.createTreeWalker(o,po,null,!1),a=St(s),c=0,l=-1;for(;i.nextNode();)for(l++,i.currentNode===r&&(c=cl(e),r.parentNode.insertBefore(e,r));a!==-1&&s[a].index===l;){if(c>0){for(;a!==-1;)s[a].index+=c,a=St(s,a);return}a=St(s,a)}}var po,cl,St,Xs=S(()=>{he();po=133;n(uo,"removeNodesFromTemplate");cl=n(t=>{let e=t.nodeType===11?0:1,r=document.createTreeWalker(t,po,null,!1);for(;r.nextNode();)e++;return e},"countNodes"),St=n((t,e=-1)=>{for(let r=e+1;r<t.length;r++){let o=t[r];if(_t(o))return r}return-1},"nextActiveIndexInTemplateParts");n(Zs,"insertNodeIntoTemplate")});var ll,Ie,fo=S(()=>{ll=new WeakMap,Ie=n(t=>typeof t=="function"&&ll.has(t),"isDirective")});var $,dr,ho=S(()=>{$={},dr={}});var me,fr=S(()=>{Ae();he();me=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=co?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],!_t(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 p=this.processor.handleTextExpression(this.options);p.insertAfterNode(l.previousSibling),this.__parts.push(p)}else this.__parts.push(...this.processor.handleAttributeExpressions(l,c.name,c.strings,this.options));i++}return co&&(document.adoptNode(e),customElements.upgrade(e)),e}};n(me,"TemplateInstance")});var ei,ul,ne,hr=S(()=>{Ae();he();ei=window.trustedTypes&&trustedTypes.createPolicy("lit-html",{createHTML:t=>t}),ul=` ${G} `,ne=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=ur.exec(i);c===null?r+=i+(o?ul:lo):r+=i.substr(0,c.index)+c[1]+c[2]+Ke+c[3]+G}return r+=this.strings[e],r}getTemplateElement(){let e=document.createElement("template"),r=this.getHTML();return ei!==void 0&&(r=ei.createHTML(r)),e.innerHTML=r,e}};n(ne,"TemplateResult")});var mr,gr,Ze,Et,se,xt,vt,yr,ti,Tt,dl,br=S(()=>{fo();Ae();ho();fr();hr();he();mr=n(t=>t===null||!(typeof t=="object"||typeof t=="function"),"isPrimitive"),gr=n(t=>Array.isArray(t)||!!(t&&t[Symbol.iterator]),"isIterable"),Ze=class{constructor(e,r,o){this.dirty=!0,this.element=e,this.name=r,this.strings=o,this.parts=[];for(let s=0;s<o.length-1;s++)this.parts[s]=this._createPart()}_createPart(){return new Et(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"||!gr(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(mr(c)||!gr(c))s+=typeof c=="string"?c:String(c);else for(let l of c)s+=typeof l=="string"?l:String(l)}}return s+=e[r],s}commit(){this.dirty&&(this.dirty=!1,this.element.setAttribute(this.name,this._getValue()))}};n(Ze,"AttributeCommitter");Et=class{constructor(e){this.value=void 0,this.committer=e}setValue(e){e!==$&&(!mr(e)||e!==this.value)&&(this.value=e,Ie(e)||(this.committer.dirty=!0))}commit(){for(;Ie(this.value);){let e=this.value;this.value=$,e(this)}this.value!==$&&this.committer.commit()}};n(Et,"AttributePart");se=class{constructor(e){this.value=void 0,this.__pendingValue=void 0,this.options=e}appendInto(e){this.startNode=e.appendChild(te()),this.endNode=e.appendChild(te())}insertAfterNode(e){this.startNode=e,this.endNode=e.nextSibling}appendIntoPart(e){e.__insert(this.startNode=te()),e.__insert(this.endNode=te())}insertAfterPart(e){e.__insert(this.startNode=te()),this.endNode=e.endNode,e.endNode=this.startNode}setValue(e){this.__pendingValue=e}commit(){if(this.startNode.parentNode===null)return;for(;Ie(this.__pendingValue);){let r=this.__pendingValue;this.__pendingValue=$,r(this)}let e=this.__pendingValue;e!==$&&(mr(e)?e!==this.value&&this.__commitText(e):e instanceof ne?this.__commitTemplateResult(e):e instanceof Node?this.__commitNode(e):gr(e)?this.__commitIterable(e):e===dr?(this.value=dr,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 me&&this.value.template===r)this.value.update(e.values);else{let o=new me(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 se(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){Re(this.startNode.parentNode,e.nextSibling,this.endNode)}};n(se,"NodePart");xt=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(;Ie(this.__pendingValue);){let r=this.__pendingValue;this.__pendingValue=$,r(this)}if(this.__pendingValue===$)return;let e=!!this.__pendingValue;this.value!==e&&(e?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=e),this.__pendingValue=$}};n(xt,"BooleanAttributePart");vt=class extends Ze{constructor(e,r,o){super(e,r,o);this.single=o.length===2&&o[0]===""&&o[1]===""}_createPart(){return new yr(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}};n(vt,"PropertyCommitter");yr=class extends Et{};n(yr,"PropertyPart");ti=!1;(()=>{try{let t={get capture(){return ti=!0,!1}};window.addEventListener("test",t,t),window.removeEventListener("test",t,t)}catch{}})();Tt=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(;Ie(this.__pendingValue);){let i=this.__pendingValue;this.__pendingValue=$,i(this)}if(this.__pendingValue===$)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=dl(e),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=e,this.__pendingValue=$}handleEvent(e){typeof this.value=="function"?this.value.call(this.eventContext||this.element,e):this.value.handleEvent(e)}};n(Tt,"EventPart");dl=n(t=>t&&(ti?{capture:t.capture,passive:t.passive,once:t.once}:t.capture),"getOptions")});function mo(t){let e=ke.get(t.type);e===void 0&&(e={stringsArray:new WeakMap,keyString:new Map},ke.set(t.type,e));let r=e.stringsArray.get(t.strings);if(r!==void 0)return r;let o=t.strings.join(G);return r=e.keyString.get(o),r===void 0&&(r=new Ne(t,t.getTemplateElement()),e.keyString.set(o,r)),e.stringsArray.set(t.strings,r),r}var ke,_r=S(()=>{he();n(mo,"templateFactory");ke=new Map});var ge,go,yo=S(()=>{Ae();br();_r();ge=new WeakMap,go=n((t,e,r)=>{let o=ge.get(e);o===void 0&&(Re(e,e.firstChild),ge.set(e,o=new se(Object.assign({templateFactory:mo},r))),o.appendInto(e)),o.setValue(t),o.commit()},"render")});var Sr,bo,_o=S(()=>{br();Sr=class{handleAttributeExpressions(e,r,o,s){let i=r[0];return i==="."?new vt(e,r.slice(1),o).parts:i==="@"?[new Tt(e,r.slice(1),s.eventContext)]:i==="?"?[new xt(e,r.slice(1),o)]:new Ze(e,r,o).parts}handleTextExpression(e){return new se(e)}};n(Sr,"DefaultTemplateProcessor");bo=new Sr});var d,So=S(()=>{_o();hr();_o();fo();Ae();ho();br();yo();_r();fr();hr();he();typeof window!="undefined"&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.3.0");d=n((t,...e)=>new ne(t,e,"html",bo),"html")});var oi,Er,hl,ml,gl,ni,yl,si,ii=S(()=>{Ae();Xs();yo();_r();fr();he();So();oi=n((t,e)=>`${t}--${e}`,"getTemplateCacheKey"),Er=!0;typeof window.ShadyCSS=="undefined"?Er=!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."),Er=!1);hl=n(t=>e=>{let r=oi(e.type,t),o=ke.get(r);o===void 0&&(o={stringsArray:new WeakMap,keyString:new Map},ke.set(r,o));let s=o.stringsArray.get(e.strings);if(s!==void 0)return s;let i=e.strings.join(G);if(s=o.keyString.get(i),s===void 0){let a=e.getTemplateElement();Er&&window.ShadyCSS.prepareTemplateDom(a,t),s=new Ne(e,a),o.keyString.set(i,s)}return o.stringsArray.set(e.strings,s),s},"shadyTemplateFactory"),ml=["html","svg"],gl=n(t=>{ml.forEach(e=>{let r=ke.get(oi(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)}),uo(o,i)})})},"removeStylesFromLitTemplates"),ni=new Set,yl=n((t,e,r)=>{ni.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 p=0;p<i;p++){let f=s[p];f.parentNode.removeChild(f),a.textContent+=f.textContent}gl(t);let c=o.content;r?Zs(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 p=new Set;p.add(a),uo(r,p)}},"prepareTemplateStyles"),si=n((t,e,r)=>{if(!r||typeof r!="object"||!r.scopeName)throw new Error("The `scopeName` option is required.");let o=r.scopeName,s=ge.has(e),i=Er&&e.nodeType===11&&!!e.host,a=i&&!ni.has(o),c=a?document.createDocumentFragment():e;if(go(t,c,Object.assign({templateFactory:hl(o)},r)),a){let l=ge.get(c);ge.delete(c);let p=l.value instanceof me?l.value.template:void 0;yl(o,c,p),Re(e,e.firstChild),e.appendChild(c),ge.set(e,l)}!s&&i&&window.ShadyCSS.styleElement(e.host)},"render")});var ai,Eo,ci,xo,vo,To,Oo,Po,wo,Ot,Co=S(()=>{window.JSCompiler_renameProperty=(t,e)=>t;Eo={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}},ci=n((t,e)=>e!==t&&(e===e||t===t),"notEqual"),xo={attribute:!0,type:String,converter:Eo,reflect:!1,hasChanged:ci},vo=1,To=1<<2,Oo=1<<3,Po=1<<4,wo="finalized",Ot=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=xo){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)||xo}static finalize(){let e=Object.getPrototypeOf(this);if(e.hasOwnProperty(wo)||e.finalize(),this[wo]=!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=ci){return o(e,r)}static _propertyValueFromAttribute(e,r){let o=r.type,s=r.converter||Eo,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||Eo.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=xo){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|Oo,a==null?this.removeAttribute(i):this.setAttribute(i,a),this._updateState=this._updateState&~Oo}}_attributeToProperty(e,r){if(this._updateState&Oo)return;let o=this.constructor,s=o._attributeToPropertyMap.get(e);if(s!==void 0){let i=o.getPropertyOptions(s);this._updateState=this._updateState|Po,this[s]=o._propertyValueFromAttribute(r,i),this._updateState=this._updateState&~Po}}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&Po)&&(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|To;try{await this._updatePromise}catch{}let e=this.performUpdate();return e!=null&&await e,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return this._updateState&To}get hasUpdated(){return this._updateState&vo}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&vo||(this._updateState=this._updateState|vo,this.firstUpdated(r)),this.updated(r))}_markUpdated(){this._changedProperties=new Map,this._updateState=this._updateState&~To}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(Ot,"UpdatingElement");ai=wo;Ot[ai]=!0});var li,uf,pi=S(()=>{li=Element.prototype,uf=li.msMatchesSelector||li.webkitMatchesSelector});var xr,Ro,Pt,ui,bl,E,Ao=S(()=>{xr=window.ShadowRoot&&(window.ShadyCSS===void 0||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ro=Symbol(),Pt=class{constructor(e,r){if(r!==Ro)throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e}get styleSheet(){return this._styleSheet===void 0&&(xr?(this._styleSheet=new CSSStyleSheet,this._styleSheet.replaceSync(this.cssText)):this._styleSheet=null),this._styleSheet}toString(){return this.cssText}};n(Pt,"CSSResult");ui=n(t=>new Pt(String(t),Ro),"unsafeCSS"),bl=n(t=>{if(t instanceof Pt)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"),E=n((t,...e)=>{let r=e.reduce((o,s,i)=>o+
|
|
11
|
+
var lib=(()=>{var Aa=Object.create;var ot=Object.defineProperty;var Na=Object.getOwnPropertyDescriptor;var Ia=Object.getOwnPropertyNames;var ka=Object.getPrototypeOf,qa=Object.prototype.hasOwnProperty;var Nn=t=>ot(t,"__esModule",{value:!0}),n=(t,e)=>ot(t,"name",{value:e,configurable:!0});var S=(t,e)=>()=>(t&&(e=t(t=0)),e);var _e=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Fr=(t,e)=>{Nn(t);for(var r in e)ot(t,r,{get:e[r],enumerable:!0})},Da=(t,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Ia(e))!qa.call(t,o)&&o!=="default"&&ot(t,o,{get:()=>e[o],enumerable:!(r=Na(e,o))||r.enumerable});return t},ce=t=>Da(Nn(ot(t!=null?Aa(ka(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var qt=_e((kt,Mn)=>{(function(t,e){typeof kt=="object"&&typeof Mn!="undefined"?e(kt):typeof define=="function"&&define.amd?define(["exports"],e):(t=t||self,e(t.throttleDebounce={}))})(kt,function(t){"use strict";function e(o,s,i,a){var c,l=!1,p=0;function f(){c&&clearTimeout(c)}n(f,"clearExistingTimeout");function u(){f(),l=!0}n(u,"cancel"),typeof s!="boolean"&&(a=i,i=s,s=void 0);function h(){for(var P=arguments.length,_=new Array(P),m=0;m<P;m++)_[m]=arguments[m];var x=this,C=Date.now()-p;if(l)return;function b(){p=Date.now(),i.apply(x,_)}n(b,"exec");function y(){c=void 0}n(y,"clear"),a&&!c&&b(),f(),a===void 0&&C>o?b():s!==!0&&(c=setTimeout(a?y:b,a===void 0?o-C:o))}return n(h,"wrapper"),h.cancel=u,h}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 $n(){return typeof window.og_auth!="undefined"?Dt(window.og_auth):null}async function Ba(t=100){return new Promise(e=>{setTimeout(()=>e($n()),t)})}async function Vn(t,e=Va,r=Ha){let o;if(o=Dt($n())||Dt(e()),o)return o;if(t&&typeof t=="string"){let s=await fetch(t);s.status>=200&&s.status<300&&(o=e()||await(Ga(s)?s.json():Promise.resolve(r(t)).then(e)))}else o||(o=await Ba());if(o=Dt(o),o)return o;throw new Error("Unauthorized")}var jn,Va,Dt,Ha,Ga,Hn=S(()=>{jn=/^og_auth=/,Va=n((t=jn)=>(document.cookie.split(/;\s*/).find(e=>e.match(t))||"").replace(jn,""),"c"),Dt=n(t=>{if(typeof t=="object")return t;let e=String(t||"").split("|");return e.length===3?{sig_field:e[0],ts:parseInt(e[1],10),sig:e[2]}:null},"r"),Ha=n(t=>new Promise((e,r)=>{let o=document.createElement("iframe");o.style.setProperty("display","none","important"),document.body.appendChild(o),o.onload=e,o.onerror=r,o.src=t}),"p"),Ga=n(t=>(t.headers.get("content-type")||"").indexOf("application/json")!==-1,"d");n($n,"a");n(Ba,"f");n(Vn,"u")});var N,q,D,re,Ue,J,R,st,Le,Ft,Gn,Ut,Se,Bn,Lt,Mt,zn,Me,je,$e,Wn,Yn,jt,Jn,$t,Ve,Qn,Vt,He,it,at,Vr,Ht,Gt,Ee,le,Bt,zt,B,Q,pe,xe,Wt,ve,Te,Yt,Jt,Kn,j=S(()=>{N="OPTIN_PRODUCT",q="OPTOUT_PRODUCT",D="PRODUCT_CHANGE_FREQUENCY",re="PRODUCT_CHANGE_PREPAID_SHIPMENTS",Ue="SET_MERCHANT_ID",J="REQUEST_OFFER",R="RECEIVE_OFFER",st="PRODUCT_HAS_CHANGED",Le="CREATED_SESSION_ID",Ft="SET_AUTH_URL",Gn="REQUEST_AUTH",Ut="AUTHORIZE",Se="UNAUTHORIZED",Bn="REQUEST_ORDERS",Lt="RECEIVE_ORDERS",Mt="RECEIVE_ORDER_ITEMS",zn="FETCH_RESPONSE_ERROR",Me="SET_ENVIRONMENT_STAGING",je="SET_ENVIRONMENT_DEV",$e="SET_ENVIRONMENT_PROD",Wn="CONCLUDE_UPSELL",Yn="REQUEST_CREATE_IU_ORDER",jt="CREATE_ONE_TIME",Jn="REQUEST_CONVERT_ONE_TIME",$t="CONVERT_ONE_TIME",Ve="CHECKOUT",Qn="RECEIVE_FETCH",Vt="SET_LOCALE",He="SET_CONFIG",it="SET_PREVIEW_STANDARD_OFFER",at="SET_PREVIEW_UPSELL_OFFER",Vr="SET_PREVIEW_PREPAID_OFFER",Ht="ADD_TEMPLATE",Gt="SET_TEMPLATES",Ee="LOCAL_STORAGE_CHANGE",le="LOCAL_STORAGE_CLEAR",Bt="SET_FIRST_ORDER_PLACE_DATE",zt="SET_PRODUCT_TO_SUBSCRIBE",B="RECEIVE_PRODUCT_PLANS",Q="SETUP_PRODUCT",pe="SETUP_CART",xe="pdp",Wt="dev",ve="staging",Te="prod",Yt="static.ordergroove.com",Jt="staging.static.ordergroove.com",Kn="og-cart-updated"});var lt=_e((Ou,ss)=>{var za="Expected a function",Zn="__lodash_hash_undefined__",Wa="[object Function]",Ya="[object GeneratorFunction]",Ja=/[\\^$.*+?()[\]{}|]/g,Qa=/^\[object .+?Constructor\]$/,Ka=typeof window=="object"&&window&&window.Object===Object&&window,Za=typeof self=="object"&&self&&self.Object===Object&&self,Xn=Ka||Za||Function("return this")();function Xa(t,e){return t==null?void 0:t[e]}n(Xa,"getValue");function ec(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}n(ec,"isHostObject");var tc=Array.prototype,rc=Function.prototype,es=Object.prototype,Hr=Xn["__core-js_shared__"],ts=function(){var t=/[^.]+$/.exec(Hr&&Hr.keys&&Hr.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),rs=rc.toString,Gr=es.hasOwnProperty,oc=es.toString,nc=RegExp("^"+rs.call(Gr).replace(Ja,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),sc=tc.splice,ic=os(Xn,"Map"),ct=os(Object,"create");function Oe(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(Oe,"Hash");function ac(){this.__data__=ct?ct(null):{}}n(ac,"hashClear");function cc(t){return this.has(t)&&delete this.__data__[t]}n(cc,"hashDelete");function lc(t){var e=this.__data__;if(ct){var r=e[t];return r===Zn?void 0:r}return Gr.call(e,t)?e[t]:void 0}n(lc,"hashGet");function pc(t){var e=this.__data__;return ct?e[t]!==void 0:Gr.call(e,t)}n(pc,"hashHas");function uc(t,e){var r=this.__data__;return r[t]=ct&&e===void 0?Zn:e,this}n(uc,"hashSet");Oe.prototype.clear=ac;Oe.prototype.delete=cc;Oe.prototype.get=lc;Oe.prototype.has=pc;Oe.prototype.set=uc;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,"ListCache");function dc(){this.__data__=[]}n(dc,"listCacheClear");function fc(t){var e=this.__data__,r=Qt(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():sc.call(e,r,1),!0}n(fc,"listCacheDelete");function hc(t){var e=this.__data__,r=Qt(e,t);return r<0?void 0:e[r][1]}n(hc,"listCacheGet");function mc(t){return Qt(this.__data__,t)>-1}n(mc,"listCacheHas");function gc(t,e){var r=this.__data__,o=Qt(r,t);return o<0?r.push([t,e]):r[o][1]=e,this}n(gc,"listCacheSet");Ge.prototype.clear=dc;Ge.prototype.delete=fc;Ge.prototype.get=hc;Ge.prototype.has=mc;Ge.prototype.set=gc;function Pe(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}n(Pe,"MapCache");function yc(){this.__data__={hash:new Oe,map:new(ic||Ge),string:new Oe}}n(yc,"mapCacheClear");function bc(t){return Kt(this,t).delete(t)}n(bc,"mapCacheDelete");function _c(t){return Kt(this,t).get(t)}n(_c,"mapCacheGet");function Sc(t){return Kt(this,t).has(t)}n(Sc,"mapCacheHas");function Ec(t,e){return Kt(this,t).set(t,e),this}n(Ec,"mapCacheSet");Pe.prototype.clear=yc;Pe.prototype.delete=bc;Pe.prototype.get=_c;Pe.prototype.has=Sc;Pe.prototype.set=Ec;function Qt(t,e){for(var r=t.length;r--;)if(Pc(t[r][0],e))return r;return-1}n(Qt,"assocIndexOf");function xc(t){if(!ns(t)||Tc(t))return!1;var e=wc(t)||ec(t)?nc:Qa;return e.test(Oc(t))}n(xc,"baseIsNative");function Kt(t,e){var r=t.__data__;return vc(e)?r[typeof e=="string"?"string":"hash"]:r.map}n(Kt,"getMapData");function os(t,e){var r=Xa(t,e);return xc(r)?r:void 0}n(os,"getNative");function vc(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}n(vc,"isKeyable");function Tc(t){return!!ts&&ts in t}n(Tc,"isMasked");function Oc(t){if(t!=null){try{return rs.call(t)}catch{}try{return t+""}catch{}}return""}n(Oc,"toSource");function Br(t,e){if(typeof t!="function"||e&&typeof e!="function")throw new TypeError(za);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(Br.Cache||Pe),r}n(Br,"memoize");Br.Cache=Pe;function Pc(t,e){return t===e||t!==t&&e!==e}n(Pc,"eq");function wc(t){var e=ns(t)?oc.call(t):"";return e==Wa||e==Ya}n(wc,"isFunction");function ns(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}n(ns,"isObject");ss.exports=Br});var Zt,zr,pt,ut,Xt,is,as,Cc,Rc,Ac,Nc,Ic,dt,Wr,kc,cs,ft,qc,ue,de=S(()=>{Zt=ce(lt()),zr=n((...t)=>JSON.stringify(t),"memoizeKey"),pt=n(t=>(...e)=>fetch(...t(...e)).then(r=>r.json()),"withFetchJson"),ut=n(t=>(e,...r)=>{if(!e)throw Error("host required");let[o,s={}]=t(...r);return[`${e.replace(/\/+$/,"")}${o}`,s]},"withHost"),Xt=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"),is=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"),as=n((t=[])=>(Array.isArray(t)?t:Object.entries(t)).map(([e,r])=>[e,encodeURIComponent(r)].join("=")).join("&"),"toQuery"),Cc=n(t=>JSON.stringify([].concat(t).map(e=>typeof e=="object"?e.id:e).filter(e=>e)),"toProductId"),Rc=(0,Zt.default)(pt(ut((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=as([["session_id",e],["page_type",1],["p",Cc(r)],["module_view",JSON.stringify(["regular"])]]);return[`/offer/${t}/${o}?${s}`]})),zr),Ac=(0,Zt.default)(pt(ut(Xt((t=1,e="place")=>[`/orders/?${as([["status",t],["ordering",e],["exclude_prepaid_orders","true"]])}`]))),zr),Nc=(0,Zt.default)(pt(ut(Xt(t=>{if(!t)throw Error("orderId required");return[`/items/?order=${t}`]}))),zr),Ic=pt(ut(Xt(is((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}}]})))),dt=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"),Wr=n(t=>t.match(/^\d+_\d$/),"isFrequencyValid"),kc=n((t,e)=>String.prototype.localeCompare.call(t&&t.split("_").reverse().join("_"),e&&e.split("_").reverse().join("_")),"compareFrequencies"),cs=n(t=>[...new Set(t&&t.split(/\s+/))].filter(Wr).sort(kc),"parseFrequenciesList"),ft=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"),qc=pt(ut(Xt(is((t,e,r)=>{if(!t)throw Error("item required");if(!e)throw Error("frequency required");let o=dt(e);if(!o)throw Error("invalid frequency");return["/subscriptions/create_from_item/",{body:{item:t.public_id,offer:r,...o}}]})))),ue={fetchOffer:Rc,fetchOrders:Ac,fetchItems:Nc,createOneTime:Ic,convertOneTimeToSubscription:qc}});var Yr,L,ht=S(()=>{F();Yr=mt(),L={shopify:typeof window.Shopify!="undefined",shopify_selling_plans:typeof(Yr==null?void 0:Yr.dataset.shopifySellingPlans)!="undefined"}});function Dc(t,e){return t===e}function Fc(t,e,r){if(e===null||r===null||e.length!==r.length)return!1;for(var o=e.length,s=0;s<o;s++)if(!t(e[s],r[s]))return!1;return!0}function Uc(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Dc,r=null,o=null;return function(){return Fc(e,r,arguments)||(o=t.apply(null,arguments)),r=arguments,o}}function Lc(t){var e=Array.isArray(t[0])?t[0]:t;if(!e.every(function(o){return typeof o=="function"})){var r=e.map(function(o){return typeof o}).join(", ");throw new Error("Selector creators expect all input-selectors to be functions, "+("instead received the following types: ["+r+"]"))}return e}function Mc(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(),p=Lc(i),f=t.apply(void 0,[function(){return c++,l.apply(null,arguments)}].concat(r)),u=t(function(){for(var h=[],P=p.length,_=0;_<P;_++)h.push(p[_].apply(null,arguments));return f.apply(null,h)});return u.resultFunc=l,u.dependencies=p,u.recomputations=function(){return c},u.resetRecomputations=function(){return c=0},u}}var K,ls=S(()=>{n(Dc,"defaultEqualityCheck");n(Fc,"areArgumentsShallowlyEqual");n(Uc,"defaultMemoize");n(Lc,"getDependencies");n(Mc,"createSelectorCreator");K=Mc(Uc)});function jc(t,e){if(t===e)return!0;if(t===null||e===null||t.length!==e.length)return!1;for(let r=0;r<t.length;++r)if(t[r]!==e[r])return!1;return!0}function $c(t,e,r){let o=ft(r);return L.shopify_selling_plans?ee(t,e,o):o}var z,I,gt,ps,Jr,Vc,Hc,Gc,Bc,zc,Z,er,us,tr,rr,X,or,ds,Be,Qr,H,ze,U=S(()=>{ls();z=ce(lt());de();ht();F();z.default.Cache=Map;n(jc,"arraysEqual");n($c,"resolveFrequency");I=n((t,e)=>!!(t===e||typeof t=="object"&&typeof e=="object"&&t&&e&&t.id===e.id&&(!(Array.isArray(t.components)&&Array.isArray(e.components))||jc((t.components||[]).sort(),(e.components||[]).sort()))),"isSameProduct"),gt=n(t=>t.optedin||[],"optedinSelector"),ps=n(t=>t.optedout||[],"optedoutSelector"),Jr=n(t=>t.autoshipByDefault||{},"autoshipSelector"),Vc=n(t=>t.defaultFrequencies||{},"defaultFrequenciesSelector"),Hc=n(t=>{var e;return((e=t==null?void 0:t.config)==null?void 0:e.frequencies)||[]},"sellingPlansSelector"),Gc=n(t=>{var e;return((e=t==null?void 0:t.config)==null?void 0:e.frequenciesEveryPeriod)||[]},"frequenciesEveryPeriodSelector"),Bc=n(t=>{var e;return((e=t==null?void 0:t.config)==null?void 0:e.prepaidSellingPlans)||[]},"prepaidSellingPlansSelector"),zc=n(t=>(t==null?void 0:t.prepaidShipmentsSelected)||{},"prepaidShipmentsSelectedSelector"),Z=(0,z.default)(t=>K(gt,ps,Jr,(e,r,o)=>{let s=e.find(i=>I(t,i));return s||(r.find(i=>I(t,i))?!1:t&&o[t.id]?{id:t.id}:!1)}),t=>JSON.stringify(t)),er=(0,z.default)(t=>K(gt,e=>{let r=e.find(o=>I(t,o));return r||!1}),t=>JSON.stringify(t)),us=(0,z.default)(t=>K(gt,e=>e.some(r=>I(t,r)&&r.prepaidShipments)),t=>JSON.stringify(t)),tr=(0,z.default)(t=>K(zc,e=>e[t.id]||null),t=>JSON.stringify(t)),rr=(0,z.default)(t=>K(ps,e=>e.find(r=>I(t,r)))),X=(0,z.default)(t=>K(Z(t),e=>e&&e.frequency||null)),or=(0,z.default)(t=>K(Z(t),e=>e&&e.prepaidShipments||null)),ds=(0,z.default)(t=>K(Bc,e=>{var r;return((r=e[t])==null?void 0:r.map(({numberShipments:o})=>o))||[]})),Be=(0,z.default)(t=>K(Vc,Hc,Gc,(e,r,o)=>e[w(t)]&&$c(r,o,e[w(t)])||null)),Qr=n(t=>t.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase(),"kebabCase"),H=n((t,e,r,o)=>({[r]:t.config&&t.config[r]||e&&e.hasAttribute&&e.hasAttribute(Qr(r))&&e[r]||e.offer&&typeof(e.offer[r]!=="undefined")&&e.offer[r]||o}),"configSelector"),ze=n(t=>({templates:t.templates||[]}),"templatesSelector")});function nr(t){document.readyState==="loading"?window.addEventListener("DOMContentLoaded",t):t()}function mt(){return document.querySelector([`script[src^="https://${Yt}"]`,`script[src^="https://${Jt}"]`,`script[src^="http://${Yt}"]`,`script[src^="http://${Jt}"]`].join(","))}function Kr(){let t=mt();if(!t)return[];let e=new URL(t.src),r=e.host.startsWith(ve)?ve:Te,o=e.pathname.split("/")[1];return!r&&!o?[]:[o,r,t]}function hs(t){if(t.isReady())return;console.info("OG offers are auto initializing");let[e,r]=Kr();if(!r&&!e)return;let o=document.createElement("script");o.onload=()=>console.info("OG pull initialization chunk for merchant",e,r),o.onerror=()=>t.initialize(e,r),o.src=`${window.location.protocol}//${r===Te?Yt:Jt}/${e}/main.js?initOnly=true`,document.head.appendChild(o)}function gs(t){let e=document.cookie.match(`(^|;) ?${t}=([^;]*)(;|$)`);return e?e[2]:null}function ys(t,e,r){let o=t.querySelector(`[name="${e}"]`);if(o&&!r){o.remove();return}!o&&r&&(o=document.createElement("input"),o.type="hidden",o.name=e,t.appendChild(o)),o&&(o.value=r)}function Ye(t,e){let[[r],o]=t.reduce((s,i)=>s[I(e,i)?0:1].push(i)&&s,[[],[]]);return[r||{},o||[]]}var w,fs,Zr,ms,We,we,sr,ee,F=S(()=>{ht();j();U();n(nr,"onReady");n(mt,"getMainJs");n(Kr,"resolveEnvAndMerchant");w=n(t=>{var r;if(!t)return"";let e=`${t.id||t}`;return((r=L)==null?void 0:r.shopify_selling_plans)&&(e=e.split(":")[0]),e},"safeProductId"),fs=n((t,e)=>{var r;if(L.shopify_selling_plans){let o=(r=e.frequencies)==null?void 0:r.indexOf(t);if(o>=0&&e.frequenciesEveryPeriod[o])return e.frequenciesEveryPeriod[o]}return t},"safeOgFrequency"),Zr=n((t,e)=>{var o;if(!`${t}`.includes("_"))return t;let r=(o=e.frequenciesEveryPeriod)==null?void 0:o.indexOf(t);return r>=0&&e.frequenciesEveryPeriod[r]?e.frequencies[r]:t},"frequencyToSellingPlan");n(hs,"autoInitializeOffers");ms=n(t=>{document.cookie=`${t}=; expires=Thu, 01 Jan 1970 00:00:01 GMT;`},"clearCookie");n(gs,"getCookieValue");We=n(t=>!!(t&&(t==null?void 0:t.includes("_"))),"isOgFrequency"),we=n((t=[])=>(t==null?void 0:t[0])||null,"getFirstSellingPlan"),sr=n((t=[],e=[])=>{var r;return!!(((r=L)==null?void 0:r.shopify_selling_plans)&&t.length&&e.length)},"hasShopifySellingPlans"),ee=n((t,e,r)=>{if(t.length!==e.length)return null;let o=e.findIndex(s=>s===r);return o>=0?t[o]:null},"mapFrequencyToSellingPlan");n(ys,"getOrCreateHidden");n(Ye,"getMatchingProductIfExists")});var oe,Je,bs,ir,_s,Ss,Es,Xr,Wc,yt,fe,xs,ar,vs,Yc,eo,to,cr,ro,Ts,Ce,oo,Jc,Os,Ps,Qc,Kc,Zc,Xc,ws,Cs,Rs,As,Ns,Is,ks,k=S(()=>{Hn();j();de();F();oe=n((t,e,r)=>({type:N,payload:{product:t,frequency:e,offer:r}}),"optinProduct"),Je=n((t,e)=>({type:q,payload:{product:t,offer:e}}),"optoutProduct"),bs=n((t,e)=>({type:st,payload:{newProduct:t,product:e}}),"productHasChangedComponents"),ir=n((t,e,r)=>({type:D,payload:{product:t,frequency:e,offer:r}}),"productChangeFrequency"),_s=n((t,e,r)=>({type:re,payload:{product:t,prepaidShipments:e,offer:r}}),"productChangePrepaidShipments"),Ss=n(t=>({type:Wn,payload:{product:t}}),"concludeUpsell"),Es=n(t=>({type:Ue,payload:t}),"setMerchantId"),Xr=n(t=>({type:Le,payload:`${t}.${Math.floor(Math.random()*999999)}.${Math.round(new Date().getTime()/1e3)}`}),"createSessionId"),Wc=n(t=>({type:Gn,payload:t}),"requestAuth"),yt=n((t,e,r,o)=>({type:Ut,payload:{public_id:t,sig_field:e,ts:r,sig:o}}),"authorize"),fe=n(t=>({type:Se,payload:t}),"unauthorized"),xs=n(t=>({type:Ft,payload:t}),"setAuthUrl"),ar=n(t=>({type:Qn,payload:t}),"fetchDone"),vs=n((t=Vn)=>n(function(r,o){if(window.og&&window.og.previewMode)return r(fe({message:"Offers are running in preview mode"}));let{merchantId:s,authUrl:i}=o(),a=Wc(i);return r(a),t(i).then(({sig_field:c,ts:l,sig:p})=>r(yt(s,c,l,p)),c=>r(fe(c))).finally(()=>r(ar(a)))},"fetchAuthThunk"),"fetchAuth"),Yc=n((t,e)=>({type:Bn,payload:{status:t,ordering:e}}),"requestOrders"),eo=n(t=>({type:Lt,payload:t}),"receiveOrders"),to=n(t=>({type:Mt,payload:t}),"receiveItems"),cr=n((t=1,e="place")=>n(function(o,s){let{environment:{legoUrl:i},auth:a}=s();if(!a)return o(fe("No auth set."));let c=Yc(t,e);return o(c),ue.fetchOrders(i,a,t,e).then(l=>{if(l.results){o(eo(l));let p=(l.results[0]||{}).public_id;if(p)return ue.fetchItems(i,a,p).then(f=>o(to(f)))}return o(fe(l.detail)),null},l=>o(fe(l))).finally(()=>o(ar(c)))},"fetchOrdersThunk"),"fetchOrders"),ro=n(t=>{switch(t){case Wt:return{type:je,payload:t};case ve:return{type:Me,payload:t};case Te:return{type:$e,payload:t};default:throw new Error(`${t} is not a supported environment`)}},"setEnvironment"),Ts=n(()=>(t,e)=>{let{merchantId:r,sessionId:o}=e();return(!o||r&&!o.startsWith(r))&&t(Xr(r)),o},"requestSessionId"),Ce=n((t,e)=>({type:R,payload:{...t,offer:e}}),"receiveOffer"),oo=n(t=>({type:zn,payload:t}),"fetchResponseError"),Jc=n((t,e=xe,r)=>({type:J,payload:{product:t,module:e,offer:r}}),"requestOffer"),Os=n((t,e=xe,r)=>n(function(s,i){let{merchantId:a,sessionId:c,environment:{apiUrl:l}}=i(),p=Jc(t,e,r);s(p);let f=w(t);return f?ue.fetchOffer(l,a,c,f,e).then(u=>s(Ce(u,r)),u=>s(oo(u))).finally(()=>s(ar(p))):null},"fetchOfferThunk"),"fetchOffer"),Ps=n(()=>({type:Ve}),"checkout"),Qc=n((t,e,r,o)=>({type:Yn,payload:{product:t,order:e,quantity:r,offerId:o}}),"requestCreateOneTime"),Kc=n(t=>({type:jt,payload:t}),"receiveCreateOneTime"),Zc=n((t,e)=>({type:Jn,payload:{item:t,frequency:e}}),"requestConvertOneTimeToSubscription"),Xc=n((t,e)=>({type:$t,payload:{response:t,product:e}}),"receiveConvertOneTime"),ws=n((t,e,r,o=!1,s=null)=>n(function(a,c){let{auth:l,config:p,environment:{legoUrl:f},previewUpsellOffer:u,offerId:h}=c();if(!l)return a(fe("No auth set."));let P=fs(s,p),_=Qc(t,e,r,h);return a(_),(u?Promise.resolve({legoUrl:f,product:t,order:e,quantity:r,offer:h}):ue.createOneTime(f,l,t.id,e,r,h)).then(m=>(a(Kc(m)),o?(a(Zc(m,P)),(u?Promise.resolve({item:m,frequency:P}):ue.convertOneTimeToSubscription(f,l,m,P,h)).then(x=>a(Xc(x,t)),x=>a(oo(x)))):m),m=>a(oo(m))).finally(()=>a(ar(_)))},"createIuThunk"),"createIu"),Cs=n(t=>({type:Vt,payload:t}),"setLocale"),Rs=n(t=>({type:He,payload:t}),"setConfig"),As=n((t,e,r)=>({type:Ht,payload:{selector:t,markup:e,config:r}}),"addTemplate"),Ns=n(t=>({type:Gt,payload:t}),"setTemplates"),Is=n((t,e)=>({type:Bt,payload:{product:t,firstOrderPlaceDate:e}}),"setFirstOrderPlaceDate"),ks=n((t,e)=>({type:zt,payload:{product:t,productToSubscribe:e}}),"setProductToSubscribe")});var co,Re,Ae=S(()=>{co=typeof window!="undefined"&&window.customElements!=null&&window.customElements.polyfillWrapFlushCallback!==void 0,Re=n((t,e,r=null)=>{for(;e!==r;){let o=e.nextSibling;t.removeChild(e),e=o}},"removeNodes")});var G,lo,Qs,Ke,Ne,Ks,_t,te,ur,he=S(()=>{G=`{{lit-${String(Math.random()).slice(2)}}}`,lo=`<!--${G}-->`,Qs=new RegExp(`${G}|${lo}`),Ke="$lit$",Ne=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:p,values:{length:f}}=e;for(;l<f;){let u=i.nextNode();if(u===null){i.currentNode=s.pop();continue}if(c++,u.nodeType===1){if(u.hasAttributes()){let h=u.attributes,{length:P}=h,_=0;for(let m=0;m<P;m++)Ks(h[m].name,Ke)&&_++;for(;_-- >0;){let m=p[l],x=ur.exec(m)[2],C=x.toLowerCase()+Ke,b=u.getAttribute(C);u.removeAttribute(C);let y=b.split(Qs);this.parts.push({type:"attribute",index:c,name:x,strings:y}),l+=y.length-1}}u.tagName==="TEMPLATE"&&(s.push(u),i.currentNode=u.content)}else if(u.nodeType===3){let h=u.data;if(h.indexOf(G)>=0){let P=u.parentNode,_=h.split(Qs),m=_.length-1;for(let x=0;x<m;x++){let C,b=_[x];if(b==="")C=te();else{let y=ur.exec(b);y!==null&&Ks(y[2],Ke)&&(b=b.slice(0,y.index)+y[1]+y[2].slice(0,-Ke.length)+y[3]),C=document.createTextNode(b)}P.insertBefore(C,u),this.parts.push({type:"node",index:++c})}_[m]===""?(P.insertBefore(te(),u),o.push(u)):u.data=_[m],l+=m}}else if(u.nodeType===8)if(u.data===G){let h=u.parentNode;(u.previousSibling===null||c===a)&&(c++,h.insertBefore(te(),u)),a=c,this.parts.push({type:"node",index:c}),u.nextSibling===null?u.data="":(o.push(u),c--),l++}else{let h=-1;for(;(h=u.data.indexOf(G,h+1))!==-1;)this.parts.push({type:"node",index:-1}),l++}}for(let u of o)u.parentNode.removeChild(u)}};n(Ne,"Template");Ks=n((t,e)=>{let r=t.length-e.length;return r>=0&&t.slice(r)===e},"endsWith"),_t=n(t=>t.index!==-1,"isTemplatePartActive"),te=n(()=>document.createComment(""),"createMarker"),ur=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/});function uo(t,e){let{element:{content:r},parts:o}=t,s=document.createTreeWalker(r,po,null,!1),i=St(o),a=o[i],c=-1,l=0,p=[],f=null;for(;s.nextNode();){c++;let u=s.currentNode;for(u.previousSibling===f&&(f=null),e.has(u)&&(p.push(u),f===null&&(f=u)),f!==null&&l++;a!==void 0&&a.index===c;)a.index=f!==null?-1:a.index-l,i=St(o,i),a=o[i]}p.forEach(u=>u.parentNode.removeChild(u))}function Zs(t,e,r=null){let{element:{content:o},parts:s}=t;if(r==null){o.appendChild(e);return}let i=document.createTreeWalker(o,po,null,!1),a=St(s),c=0,l=-1;for(;i.nextNode();)for(l++,i.currentNode===r&&(c=al(e),r.parentNode.insertBefore(e,r));a!==-1&&s[a].index===l;){if(c>0){for(;a!==-1;)s[a].index+=c,a=St(s,a);return}a=St(s,a)}}var po,al,St,Xs=S(()=>{he();po=133;n(uo,"removeNodesFromTemplate");al=n(t=>{let e=t.nodeType===11?0:1,r=document.createTreeWalker(t,po,null,!1);for(;r.nextNode();)e++;return e},"countNodes"),St=n((t,e=-1)=>{for(let r=e+1;r<t.length;r++){let o=t[r];if(_t(o))return r}return-1},"nextActiveIndexInTemplateParts");n(Zs,"insertNodeIntoTemplate")});var cl,Ie,fo=S(()=>{cl=new WeakMap,Ie=n(t=>typeof t=="function"&&cl.has(t),"isDirective")});var $,dr,ho=S(()=>{$={},dr={}});var me,fr=S(()=>{Ae();he();me=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=co?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],!_t(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 p=this.processor.handleTextExpression(this.options);p.insertAfterNode(l.previousSibling),this.__parts.push(p)}else this.__parts.push(...this.processor.handleAttributeExpressions(l,c.name,c.strings,this.options));i++}return co&&(document.adoptNode(e),customElements.upgrade(e)),e}};n(me,"TemplateInstance")});var ei,pl,ne,hr=S(()=>{Ae();he();ei=window.trustedTypes&&trustedTypes.createPolicy("lit-html",{createHTML:t=>t}),pl=` ${G} `,ne=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=ur.exec(i);c===null?r+=i+(o?pl:lo):r+=i.substr(0,c.index)+c[1]+c[2]+Ke+c[3]+G}return r+=this.strings[e],r}getTemplateElement(){let e=document.createElement("template"),r=this.getHTML();return ei!==void 0&&(r=ei.createHTML(r)),e.innerHTML=r,e}};n(ne,"TemplateResult")});var mr,gr,Ze,Et,se,xt,vt,yr,ti,Tt,ul,br=S(()=>{fo();Ae();ho();fr();hr();he();mr=n(t=>t===null||!(typeof t=="object"||typeof t=="function"),"isPrimitive"),gr=n(t=>Array.isArray(t)||!!(t&&t[Symbol.iterator]),"isIterable"),Ze=class{constructor(e,r,o){this.dirty=!0,this.element=e,this.name=r,this.strings=o,this.parts=[];for(let s=0;s<o.length-1;s++)this.parts[s]=this._createPart()}_createPart(){return new Et(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"||!gr(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(mr(c)||!gr(c))s+=typeof c=="string"?c:String(c);else for(let l of c)s+=typeof l=="string"?l:String(l)}}return s+=e[r],s}commit(){this.dirty&&(this.dirty=!1,this.element.setAttribute(this.name,this._getValue()))}};n(Ze,"AttributeCommitter");Et=class{constructor(e){this.value=void 0,this.committer=e}setValue(e){e!==$&&(!mr(e)||e!==this.value)&&(this.value=e,Ie(e)||(this.committer.dirty=!0))}commit(){for(;Ie(this.value);){let e=this.value;this.value=$,e(this)}this.value!==$&&this.committer.commit()}};n(Et,"AttributePart");se=class{constructor(e){this.value=void 0,this.__pendingValue=void 0,this.options=e}appendInto(e){this.startNode=e.appendChild(te()),this.endNode=e.appendChild(te())}insertAfterNode(e){this.startNode=e,this.endNode=e.nextSibling}appendIntoPart(e){e.__insert(this.startNode=te()),e.__insert(this.endNode=te())}insertAfterPart(e){e.__insert(this.startNode=te()),this.endNode=e.endNode,e.endNode=this.startNode}setValue(e){this.__pendingValue=e}commit(){if(this.startNode.parentNode===null)return;for(;Ie(this.__pendingValue);){let r=this.__pendingValue;this.__pendingValue=$,r(this)}let e=this.__pendingValue;e!==$&&(mr(e)?e!==this.value&&this.__commitText(e):e instanceof ne?this.__commitTemplateResult(e):e instanceof Node?this.__commitNode(e):gr(e)?this.__commitIterable(e):e===dr?(this.value=dr,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 me&&this.value.template===r)this.value.update(e.values);else{let o=new me(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 se(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){Re(this.startNode.parentNode,e.nextSibling,this.endNode)}};n(se,"NodePart");xt=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(;Ie(this.__pendingValue);){let r=this.__pendingValue;this.__pendingValue=$,r(this)}if(this.__pendingValue===$)return;let e=!!this.__pendingValue;this.value!==e&&(e?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=e),this.__pendingValue=$}};n(xt,"BooleanAttributePart");vt=class extends Ze{constructor(e,r,o){super(e,r,o);this.single=o.length===2&&o[0]===""&&o[1]===""}_createPart(){return new yr(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}};n(vt,"PropertyCommitter");yr=class extends Et{};n(yr,"PropertyPart");ti=!1;(()=>{try{let t={get capture(){return ti=!0,!1}};window.addEventListener("test",t,t),window.removeEventListener("test",t,t)}catch{}})();Tt=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(;Ie(this.__pendingValue);){let i=this.__pendingValue;this.__pendingValue=$,i(this)}if(this.__pendingValue===$)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=ul(e),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=e,this.__pendingValue=$}handleEvent(e){typeof this.value=="function"?this.value.call(this.eventContext||this.element,e):this.value.handleEvent(e)}};n(Tt,"EventPart");ul=n(t=>t&&(ti?{capture:t.capture,passive:t.passive,once:t.once}:t.capture),"getOptions")});function mo(t){let e=ke.get(t.type);e===void 0&&(e={stringsArray:new WeakMap,keyString:new Map},ke.set(t.type,e));let r=e.stringsArray.get(t.strings);if(r!==void 0)return r;let o=t.strings.join(G);return r=e.keyString.get(o),r===void 0&&(r=new Ne(t,t.getTemplateElement()),e.keyString.set(o,r)),e.stringsArray.set(t.strings,r),r}var ke,_r=S(()=>{he();n(mo,"templateFactory");ke=new Map});var ge,go,yo=S(()=>{Ae();br();_r();ge=new WeakMap,go=n((t,e,r)=>{let o=ge.get(e);o===void 0&&(Re(e,e.firstChild),ge.set(e,o=new se(Object.assign({templateFactory:mo},r))),o.appendInto(e)),o.setValue(t),o.commit()},"render")});var Sr,bo,_o=S(()=>{br();Sr=class{handleAttributeExpressions(e,r,o,s){let i=r[0];return i==="."?new vt(e,r.slice(1),o).parts:i==="@"?[new Tt(e,r.slice(1),s.eventContext)]:i==="?"?[new xt(e,r.slice(1),o)]:new Ze(e,r,o).parts}handleTextExpression(e){return new se(e)}};n(Sr,"DefaultTemplateProcessor");bo=new Sr});var d,So=S(()=>{_o();hr();_o();fo();Ae();ho();br();yo();_r();fr();hr();he();typeof window!="undefined"&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.3.0");d=n((t,...e)=>new ne(t,e,"html",bo),"html")});var oi,Er,fl,hl,ml,ni,gl,si,ii=S(()=>{Ae();Xs();yo();_r();fr();he();So();oi=n((t,e)=>`${t}--${e}`,"getTemplateCacheKey"),Er=!0;typeof window.ShadyCSS=="undefined"?Er=!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."),Er=!1);fl=n(t=>e=>{let r=oi(e.type,t),o=ke.get(r);o===void 0&&(o={stringsArray:new WeakMap,keyString:new Map},ke.set(r,o));let s=o.stringsArray.get(e.strings);if(s!==void 0)return s;let i=e.strings.join(G);if(s=o.keyString.get(i),s===void 0){let a=e.getTemplateElement();Er&&window.ShadyCSS.prepareTemplateDom(a,t),s=new Ne(e,a),o.keyString.set(i,s)}return o.stringsArray.set(e.strings,s),s},"shadyTemplateFactory"),hl=["html","svg"],ml=n(t=>{hl.forEach(e=>{let r=ke.get(oi(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)}),uo(o,i)})})},"removeStylesFromLitTemplates"),ni=new Set,gl=n((t,e,r)=>{ni.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 p=0;p<i;p++){let f=s[p];f.parentNode.removeChild(f),a.textContent+=f.textContent}ml(t);let c=o.content;r?Zs(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 p=new Set;p.add(a),uo(r,p)}},"prepareTemplateStyles"),si=n((t,e,r)=>{if(!r||typeof r!="object"||!r.scopeName)throw new Error("The `scopeName` option is required.");let o=r.scopeName,s=ge.has(e),i=Er&&e.nodeType===11&&!!e.host,a=i&&!ni.has(o),c=a?document.createDocumentFragment():e;if(go(t,c,Object.assign({templateFactory:fl(o)},r)),a){let l=ge.get(c);ge.delete(c);let p=l.value instanceof me?l.value.template:void 0;gl(o,c,p),Re(e,e.firstChild),e.appendChild(c),ge.set(e,l)}!s&&i&&window.ShadyCSS.styleElement(e.host)},"render")});var ai,Eo,ci,xo,vo,To,Oo,Po,wo,Ot,Co=S(()=>{window.JSCompiler_renameProperty=(t,e)=>t;Eo={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}},ci=n((t,e)=>e!==t&&(e===e||t===t),"notEqual"),xo={attribute:!0,type:String,converter:Eo,reflect:!1,hasChanged:ci},vo=1,To=1<<2,Oo=1<<3,Po=1<<4,wo="finalized",Ot=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=xo){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)||xo}static finalize(){let e=Object.getPrototypeOf(this);if(e.hasOwnProperty(wo)||e.finalize(),this[wo]=!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=ci){return o(e,r)}static _propertyValueFromAttribute(e,r){let o=r.type,s=r.converter||Eo,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||Eo.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=xo){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|Oo,a==null?this.removeAttribute(i):this.setAttribute(i,a),this._updateState=this._updateState&~Oo}}_attributeToProperty(e,r){if(this._updateState&Oo)return;let o=this.constructor,s=o._attributeToPropertyMap.get(e);if(s!==void 0){let i=o.getPropertyOptions(s);this._updateState=this._updateState|Po,this[s]=o._propertyValueFromAttribute(r,i),this._updateState=this._updateState&~Po}}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&Po)&&(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|To;try{await this._updatePromise}catch{}let e=this.performUpdate();return e!=null&&await e,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return this._updateState&To}get hasUpdated(){return this._updateState&vo}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&vo||(this._updateState=this._updateState|vo,this.firstUpdated(r)),this.updated(r))}_markUpdated(){this._changedProperties=new Map,this._updateState=this._updateState&~To}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(Ot,"UpdatingElement");ai=wo;Ot[ai]=!0});var li,uf,pi=S(()=>{li=Element.prototype,uf=li.msMatchesSelector||li.webkitMatchesSelector});var xr,Ro,Pt,ui,yl,E,Ao=S(()=>{xr=window.ShadowRoot&&(window.ShadyCSS===void 0||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ro=Symbol(),Pt=class{constructor(e,r){if(r!==Ro)throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e}get styleSheet(){return this._styleSheet===void 0&&(xr?(this._styleSheet=new CSSStyleSheet,this._styleSheet.replaceSync(this.cssText)):this._styleSheet=null),this._styleSheet}toString(){return this.cssText}};n(Pt,"CSSResult");ui=n(t=>new Pt(String(t),Ro),"unsafeCSS"),yl=n(t=>{if(t instanceof Pt)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"),E=n((t,...e)=>{let r=e.reduce((o,s,i)=>o+yl(s)+t[i+1],t[0]);return new Pt(r,Ro)},"css")});var di,v,O=S(()=>{ii();Co();Co();pi();So();Ao();Ao();(window.litElementVersions||(window.litElementVersions=[])).push("2.4.0");di={},v=class extends Ot{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&&!xr){let o=Array.prototype.slice.call(r.cssRules).reduce((s,i)=>s+i.cssText,"");return ui(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):xr?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!==di&&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 di}};n(v,"LitElement");v.finalized=!0;v.render=si});var vr=_e((xf,fi)=>{var bl={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"};fi.exports=bl});var mi=_e((vf,hi)=>{var qe=vr(),_l=n(t=>{let e="",r=[];for(let o of t){let s=o.charCodeAt(0);switch(s){case qe.PAR_OPEN:case qe.PAR_CLOSE:case qe.OP_NOT:case qe.BINARY_AND:case qe.BINARY_OR:e&&(r.push({type:qe.LITERAL,value:e}),e=""),r.push({type:s,value:o});break;default:e+=o}}return e&&r.push({type:qe.LITERAL,value:e}),r},"Tokenizer");hi.exports=_l});var yi=_e((Tf,gi)=>{var ye=vr(),Sl=n(t=>{let e=[],r=[];return t.forEach(s=>{switch(s.type){case ye.LITERAL:e.unshift(s);break;case ye.BINARY_AND:case ye.BINARY_OR:case ye.OP_NOT:case ye.PAR_OPEN:r.push(s);break;case ye.PAR_CLOSE:for(;r.length&&r[r.length-1].type!==ye.PAR_OPEN;)e.unshift(r.pop());r.pop(),r.length&&r[r.length-1].type===ye.OP_NOT&&e.unshift(r.pop());break;default:break}}),r.length&&[...r.reverse(),...e]||e},"PolishNotation"),El=n(function*(t){for(let e=0;e<t.length-1;e++)yield t[e];return t[t.length-1]},"PolishGenerator");gi.exports={PolishNotation:Sl,PolishGenerator:El}});var _i=_e((Of,bi)=>{var V=vr(),W=class{constructor(e,r,o,s){this.op=e,this.left=r,this.right=o,this.literal=s}isLeaf(){return this.op===V.LEAF}isAtomic(){return this.isLeaf()||this.op===V.OP_NOT&&this.left.isLeaf()}getLiteralValue(){return this.literal}static CreateAnd(e,r){return new W(V.BINARY_AND,e,r)}static CreateNot(e){return new W(V.OP_NOT,e)}static CreateOr(e,r){return new W(V.BINARY_OR,e,r)}static CreateLiteral(e){return new W(V.LEAF,null,null,e)}};n(W,"ExpNode");var Xe=n(t=>{let e=t.next().value;switch(e.type){case V.LITERAL:return W.CreateLiteral(e.value);case V.OP_NOT:return W.CreateNot(Xe(t));case V.BINARY_AND:{let r=Xe(t),o=Xe(t);return W.CreateAnd(r,o)}case V.BINARY_OR:{let r=Xe(t),o=Xe(t);return W.CreateOr(r,o)}}return null},"make"),et=n((t,e)=>{if(t.isLeaf())return e(t.getLiteralValue());if(t.op===V.OP_NOT)return!et(t.left,e);if(t.op===V.BINARY_OR)return et(t.left,e)||et(t.right,e);if(t.op===V.BINARY_AND)return et(t.left,e)&&et(t.right,e)},"nodeEvaluator");bi.exports={make:Xe,nodeEvaluator:et}});var vi=_e((Pf,xi)=>{var xl=mi(),Si=yi(),Ei=_i(),vl=n((t,e)=>{let r=xl(t),o=Si.PolishNotation(r),s=Si.PolishGenerator(o),i=Ei.make(s);return Ei.nodeEvaluator(i,e)},"parse");xi.exports={parse:vl}});var ta={};Fr(ta,{TestWizard:()=>Ar,default:()=>Zl});var Ar,Zl,ra=S(()=>{O();k();Ar=class extends v{static get styles(){return E`
|
|
13
13
|
:host {
|
|
14
14
|
position: fixed;
|
|
15
15
|
top: 5em;
|
|
@@ -107,9 +107,9 @@ var lib=(()=>{var Na=Object.create;var ot=Object.defineProperty;var Ia=Object.ge
|
|
|
107
107
|
`}
|
|
108
108
|
<button ?disabled=${this.disabled} @click="${this.runTests.bind(this)}" class="primary">Run Test</button>
|
|
109
109
|
</div>
|
|
110
|
-
`}};n(Ar,"TestWizard");Xl=Ar});var mu={};Fr(mu,{addOptinChangedCallback:()=>Wp,addTemplate:()=>Yp,autoInit:()=>fu,clear:()=>Jp,config:()=>Qp,default:()=>hu,disableOptinChangedCallbacks:()=>Kp,getOptins:()=>Zp,getProductsForPurchasePost:()=>Xp,initialize:()=>eu,isReady:()=>zp,offers:()=>T,platform:()=>L,previewMode:()=>tu,register:()=>ru,resolveSettings:()=>ou,setAuthUrl:()=>nu,setEnvironment:()=>su,setLocale:()=>iu,setMerchantId:()=>au,setPublicPath:()=>cu,setTemplates:()=>lu,setupCart:()=>pu,setupProduct:()=>uu,setupProducts:()=>du,store:()=>wa});function Ur(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(Ur,"symbolObservablePonyfill");var Fe;typeof self!="undefined"?Fe=self:typeof window!="undefined"||typeof window!="undefined"?Fe=window:typeof module!="undefined"?Fe=module:Fe=Function("return this")();var Ua=Ur(Fe),Lr=Ua;var Mr=n(function(){return Math.random().toString(36).substring(7).split("").join(".")},"randomString"),nt={INIT:"@@redux/INIT"+Mr(),REPLACE:"@@redux/REPLACE"+Mr(),PROBE_UNKNOWN_ACTION:n(function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Mr()},"PROBE_UNKNOWN_ACTION")};function La(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(La,"isPlainObject");function jr(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(jr)(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 p(){c===a&&(c=a.slice())}n(p,"ensureCanMutateNextListeners");function f(){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(f,"getState");function u(m){if(typeof m!="function")throw new Error("Expected the listener to be a function.");if(l)throw new Error("You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api-reference/store#subscribelistener for more details.");var x=!0;return p(),c.push(m),n(function(){if(!!x){if(l)throw new Error("You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api-reference/store#subscribelistener for more details.");x=!1,p();var b=c.indexOf(m);c.splice(b,1),a=null}},"unsubscribe")}n(u,"subscribe");function h(m){if(!La(m))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(typeof m.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,m)}finally{l=!1}for(var x=a=c,C=0;C<x.length;C++){var b=x[C];b()}return m}n(h,"dispatch");function P(m){if(typeof m!="function")throw new Error("Expected the nextReducer to be a function.");s=m,h({type:nt.REPLACE})}n(P,"replaceReducer");function _(){var m,x=u;return m={subscribe:n(function(b){if(typeof b!="object"||b===null)throw new TypeError("Expected the observer to be an object.");function y(){b.next&&b.next(f())}n(y,"observeState"),y();var Nt=x(y);return{unsubscribe:Nt}},"subscribe")},m[Lr]=function(){return this},m}return n(_,"observable"),h({type:nt.INIT}),o={dispatch:h,subscribe:u,getState:f,replaceReducer:P},o[Lr]=_,o}n(jr,"createStore");function Ma(t,e){var r=e&&e.type,o=r&&'action "'+String(r)+'"'||"an action";return"Given "+o+', reducer "'+t+'" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.'}n(Ma,"getUndefinedStateErrorMessage");function ja(t){Object.keys(t).forEach(function(e){var r=t[e],o=r(void 0,{type:nt.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:nt.PROBE_UNKNOWN_ACTION()})=="undefined")throw new Error('Reducer "'+e+'" returned undefined when probed with a random type. '+("Don't try to handle "+nt.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(ja,"assertReducerShape");function It(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{ja(r)}catch(l){c=l}return n(function(p,f){if(p===void 0&&(p={}),c)throw c;if(!1)var u;for(var h=!1,P={},_=0;_<i.length;_++){var m=i[_],x=r[m],C=p[m],b=x(C,f);if(typeof b=="undefined"){var y=Ma(m,f);throw new Error(y)}P[m]=b,h=h||b!==C}return h=h||i.length!==Object.keys(p).length,h?P:p},"combination")}n(It,"combineReducers");function In(t,e){return function(){return e(t.apply(this,arguments))}}n(In,"bindActionCreator");function kn(t,e){if(typeof t=="function")return In(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]=In(s,e))}return r}n(kn,"bindActionCreators");function $a(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}n($a,"_defineProperty");function qn(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(qn,"ownKeys");function Va(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?qn(r,!0).forEach(function(o){$a(t,o,r[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):qn(r).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(r,o))})}return t}n(Va,"_objectSpread2");function $r(){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($r,"compose");function Dn(){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=$r.apply(void 0,c)(s.dispatch),Va({},s,{dispatch:i})}}}n(Dn,"applyMiddleware");function Fn(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(Fn,"createThunkMiddleware");var Un=Fn();Un.withExtraArgument=Fn;var Ln=Un;var qs=ce(qt());k();j();var bt="OG_STATE",Ds=n(t=>{try{return t===null?void 0:JSON.parse(t)}catch{return}},"safeParseState"),no=n(()=>window.og&&window.og.previewMode,"isPreviewMode"),Fs=n(()=>no()?{}:Ds(localStorage.getItem(bt)),"loadState"),tl=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"),Us=n(t=>{if(no())return;let e=tl(t);e&&localStorage.getItem(bt)!==e&&localStorage.setItem(bt,e)},"saveState"),Ls=n(t=>(0,qs.throttle)(500,e=>{if(no())return;let{key:r,newValue:o}=e;r===bt&&o===null?(t.dispatch({type:le}),setTimeout(()=>t.dispatch(Ts()),0)):r===bt&&t.dispatch({type:Ee,newValue:Ds(o)})}),"listenLocalStorageChanges");var Ms=ce(qt());j();U();var rl=n((t,e,r=document)=>r.dispatchEvent(new CustomEvent(t,{detail:e})),"dispatchEvent"),js=n(t=>({payload:{product:{id:e,components:r}={}}={}}={})=>setTimeout(()=>rl("optin-changed",{productId:e,components:r,optedIn:t}),0),"dispatchOptinChangedEvent"),ol=[{expressions:[({type:t}={})=>t===N,({type:t}={})=>t===D],fn:js(!0)},{expressions:[({type:t}={})=>t===q],fn:js(!1)}],$s=n(t=>e=>r=>{let o=t.getState();ol.forEach(s=>{s.expressions.some(i=>i(r,o))&&s.fn(r)}),e(r)},"dispatchMiddleware"),Vs=n(t=>e=>r=>{var s;let o;switch(r.type){case R:case q:case N: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"),Hs=n(t=>e=>r=>{e(r);let o=(0,Ms.throttle)(500,()=>{Us({...t.getState()})});r.type!==Ee&&o()},"localStorageMiddleware");k();j();var so=n(()=>{let t,e;return[new Promise((r,o)=>{t=r,e=o}),t,e]},"waitFor");function Gs(t){let[e,r]=so(),[o,s]=so(),[i,a]=so();o.then(l=>{let{sessionId:p}=t.getState();!p||l&&!p.startsWith(l)?t.dispatch(Xr(l)):a(p)});let c=Promise.all([o,e,i]);return c.then(()=>{var l;window.addEventListener("storage",Ls(t)),((l=t.getState().auth)==null?void 0:l.ts)||t.dispatch(vs())}),l=>async p=>{je===p.type||Me===p.type||$e===p.type?r(p.payload):Ue===p.type?s(p.payload):Le===p.type?a(p.payload):await c,l(p)}}n(Gs,"waitUntilOffersReady");function Bs(t,...e){if(window.og&&window.og.store)return window.og.store;let r=window.og&&window.og.previewMode,o=typeof window=="object"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({name:"Ordergroove Offers"}):$r,s=[Gs,Ln,$s,Vs],i={};if(!r)try{i=Fs(),s.push(Hs)}catch{}let a=o(Dn(...s,...e.filter(l=>l))),c=jr(t,i,a);return window.og=window.og||{},window.og.store=c,c}n(Bs,"makeStore");var nl=Object.defineProperty,lr=n((t,e)=>nl(t,"name",{value:e,configurable:!0}),"i"),sl=lr(t=>e=>t.indexOf(e.origin)>=0,"createIsMessageAllowed"),zs=["https://rc3.ordergroove.com","https://rc3.stg.ordergroove.com","http://localhost:3000",window.location.origin],Ws=lr(t=>(e,r)=>{zs.forEach(o=>t.postMessage({ogType:e,...r},o))},"createBroadcastMessage");function io(t=window.opener,e=window.og){let r=lr(o=>{let s=sl(zs),i=Ws(o.source),a=o.data.options||{};if(s(o)&&o.data.ogType==="READY"){let c="//static.ordergroove.com/@ordergroove/offers-live-editor/0.6.1/dist/";c.startsWith("//")&&(c=window.location.protocol+c),c.endsWith("/")||(c+="/"),import(`${c}client.js`).then(({initializeClient:l})=>{l({isMessageAllowed:s,broadcastMessage:i,options:a,og:e}),window.removeEventListener("message",r)})}},"handleReady");t&&t!==window&&(window.addEventListener("message",r),Ws(t)("READY"))}n(io,"f");lr(io,"offersLiveEditor");var pr=null,il=n(t=>({dispatch:t}),"defaultMapDispatchToProps"),Ys=n(t=>{if(!pr)throw new Error("Missing redux store.");return pr},"resolveStore"),al=n((t,e)=>r=>{let{getState:o,dispatch:s}=Ys(r),i=t?t(o(),r):{},a=e(s,r);Object.assign(r,i,a)},"createRecalcProps"),g=n((t,e=il)=>r=>{let s=al(t,typeof e=="function"?e:i=>kn(e,i));return class extends r{get store(){return pr}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this._storeUnsubscribe=Ys(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"),Js=n(t=>{pr=t},"setStore");de();var ao=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],...dt(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"),Qe=n((t={})=>{let e={};return Object.entries(t).forEach(([r,o])=>{Object.entries(o).forEach(([s,i])=>{let a={};i&&!Array.isArray(i)?a=i:a={frequency:s,prepaidShipments:null,regularPrice:i[0],subscriptionPrice:i[2],discountRate:i[1]},e[r]?e[r].push(a):e[r]=[a]})}),e},"getObjectStructuredProductPlans");k();O();var Ai=ce(vi());O();var Ol=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"),Ti=n(t=>t.hasAttribute("product")&&{id:t.getAttribute("product"),...t.hasAttribute("product-components")&&{components:JSON.parse(t.getAttribute("product-components"))}},"buildProduct");var No=n(t=>{let e=Ti(t);if(!e){let r=t.offer;r&&(e=Ti(r))}return e},"resolveProduct"),Pl=n(t=>{let e=t;for(;e;){if(e.tagName==="OG-OFFER")return e;e=e.nodeType===11?e.host:e.parentNode}},"resolveOffer"),Io=n(t=>class extends t{get offer(){return Pl(this)}connectedCallback(){super.connectedCallback(),this.offersChangeTemplate=this.offersChangeTemplate.bind(this),this.offer&&this.offer.addEventListener("template-changed",this.offersChangeTemplate)}disconnectedCallback(){super.disconnectedCallback(),this.offer&&this.offer.removeEventListener("template-changed",this.offersChangeTemplate)}offersChangeTemplate(){this._enqueueUpdate()}},"withOfferTemplate"),A=n(t=>class extends Io(t){get product(){return No(this)}},"withProduct"),Tr=n(t=>class extends t{get childOptions(){let e=[],r=null;return this.querySelectorAll("option").forEach(o=>{let s=Ol(o.value),i=o.innerText.trim();e.push({value:s,text:i}),!r&&o.selected&&(r=s)}),{options:e,isSelected:r}}},"withChildOptions");var Or={};Fr(Or,{autoshipByDefault:()=>wl,eligibilityGroups:()=>qo,eligible:()=>Oi,hasUpcomingOrder:()=>Ci,hasUpsellGroup:()=>wi,inStock:()=>ko,optedout:()=>Al,prepaidEligible:()=>Cl,prepaidSubscribed:()=>Nl,regularEligible:()=>kl,subscribed:()=>Rl,subscriptionEligible:()=>Pi,upcomingOrderContainsProduct:()=>Il,upsellEligible:()=>Ri});U();var ko=n((t,e)=>(t.inStock||{})[(e.product||{}).id],"inStock"),Oi=n((t,e)=>(t.autoshipEligible||{})[(e.product||{}).id]||!1,"eligible"),wl=n((t,e)=>(t.autoshipByDefault||{})[(e.product||{}).id]||!1,"autoshipByDefault"),Pi=n((t,e)=>(t.offerId&&t.offerId!=="0"||!1)&&Oi(t,e)&&ko(t,e),"subscriptionEligible"),qo=n((t,e)=>(t.eligibilityGroups||{})[(e.product||{}).id]||null,"eligibilityGroups"),wi=n((t,e)=>{let r=qo(t,e);return r===null||!!r.find(o=>o==="upsell"||o==="impulse_upsell")},"hasUpsellGroup"),Cl=n((t,e)=>{let r=qo(t,e);return(r==null?void 0:r.some(o=>o==="prepaid"))||!1},"prepaidEligible"),Rl=n((t,e)=>er(e.product)(t),"subscribed"),Al=n((t,e)=>rr(e.product)(t),"optedout"),Nl=n((t,e)=>us(e.product)(t),"prepaidSubscribed"),Ci=n(t=>!!(t.nextUpcomingOrder&&t.nextUpcomingOrder.public_id),"hasUpcomingOrder"),Il=n((t,e)=>(t.nextUpcomingOrder&&t.nextUpcomingOrder.products||[]).includes((e.product||{}).id),"upcomingOrderContainsProduct"),Ri=n((t,e)=>{var r;return!((r=e.offer)==null?void 0:r.isCart)&&t.offerId&&t.offerId!=="0"&&t.auth&&ko(t,e)&&Ci(t)&&wi(t,e)},"upsellEligible"),kl=n((t,e)=>Pi(t,e)&&!Ri(t,e),"regularEligible");var ql=n(t=>t.replace(/(\r\n|\n|\r|\s)+/gm,""),"removeWhitespace"),Do=class extends A(v){static get properties(){return{...super.properties,state:{type:Object,attribute:!1},test:{type:String}}}render(){return this.test&&Ai.default.parse(ql(this.test),r=>Or[r]&&Or[r](this.state,this))?d`
|
|
110
|
+
`}};n(Ar,"TestWizard");Zl=Ar});var mu={};Fr(mu,{addOptinChangedCallback:()=>Wp,addTemplate:()=>Yp,autoInit:()=>fu,clear:()=>Jp,config:()=>Qp,default:()=>hu,disableOptinChangedCallbacks:()=>Kp,getOptins:()=>Zp,getProductsForPurchasePost:()=>Xp,initialize:()=>eu,isReady:()=>zp,offers:()=>T,platform:()=>L,previewMode:()=>tu,register:()=>ru,resolveSettings:()=>ou,setAuthUrl:()=>nu,setEnvironment:()=>su,setLocale:()=>iu,setMerchantId:()=>au,setPublicPath:()=>cu,setTemplates:()=>lu,setupCart:()=>pu,setupProduct:()=>uu,setupProducts:()=>du,store:()=>Pa});function Ur(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(Ur,"symbolObservablePonyfill");var Fe;typeof self!="undefined"?Fe=self:typeof window!="undefined"||typeof window!="undefined"?Fe=window:typeof module!="undefined"?Fe=module:Fe=Function("return this")();var Fa=Ur(Fe),Lr=Fa;var Mr=n(function(){return Math.random().toString(36).substring(7).split("").join(".")},"randomString"),nt={INIT:"@@redux/INIT"+Mr(),REPLACE:"@@redux/REPLACE"+Mr(),PROBE_UNKNOWN_ACTION:n(function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Mr()},"PROBE_UNKNOWN_ACTION")};function Ua(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(Ua,"isPlainObject");function jr(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(jr)(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 p(){c===a&&(c=a.slice())}n(p,"ensureCanMutateNextListeners");function f(){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(f,"getState");function u(m){if(typeof m!="function")throw new Error("Expected the listener to be a function.");if(l)throw new Error("You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api-reference/store#subscribelistener for more details.");var x=!0;return p(),c.push(m),n(function(){if(!!x){if(l)throw new Error("You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api-reference/store#subscribelistener for more details.");x=!1,p();var b=c.indexOf(m);c.splice(b,1),a=null}},"unsubscribe")}n(u,"subscribe");function h(m){if(!Ua(m))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(typeof m.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,m)}finally{l=!1}for(var x=a=c,C=0;C<x.length;C++){var b=x[C];b()}return m}n(h,"dispatch");function P(m){if(typeof m!="function")throw new Error("Expected the nextReducer to be a function.");s=m,h({type:nt.REPLACE})}n(P,"replaceReducer");function _(){var m,x=u;return m={subscribe:n(function(b){if(typeof b!="object"||b===null)throw new TypeError("Expected the observer to be an object.");function y(){b.next&&b.next(f())}n(y,"observeState"),y();var Nt=x(y);return{unsubscribe:Nt}},"subscribe")},m[Lr]=function(){return this},m}return n(_,"observable"),h({type:nt.INIT}),o={dispatch:h,subscribe:u,getState:f,replaceReducer:P},o[Lr]=_,o}n(jr,"createStore");function La(t,e){var r=e&&e.type,o=r&&'action "'+String(r)+'"'||"an action";return"Given "+o+', reducer "'+t+'" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.'}n(La,"getUndefinedStateErrorMessage");function Ma(t){Object.keys(t).forEach(function(e){var r=t[e],o=r(void 0,{type:nt.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:nt.PROBE_UNKNOWN_ACTION()})=="undefined")throw new Error('Reducer "'+e+'" returned undefined when probed with a random type. '+("Don't try to handle "+nt.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(Ma,"assertReducerShape");function It(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{Ma(r)}catch(l){c=l}return n(function(p,f){if(p===void 0&&(p={}),c)throw c;if(!1)var u;for(var h=!1,P={},_=0;_<i.length;_++){var m=i[_],x=r[m],C=p[m],b=x(C,f);if(typeof b=="undefined"){var y=La(m,f);throw new Error(y)}P[m]=b,h=h||b!==C}return h=h||i.length!==Object.keys(p).length,h?P:p},"combination")}n(It,"combineReducers");function In(t,e){return function(){return e(t.apply(this,arguments))}}n(In,"bindActionCreator");function kn(t,e){if(typeof t=="function")return In(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]=In(s,e))}return r}n(kn,"bindActionCreators");function ja(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}n(ja,"_defineProperty");function qn(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(qn,"ownKeys");function $a(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?qn(r,!0).forEach(function(o){ja(t,o,r[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):qn(r).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(r,o))})}return t}n($a,"_objectSpread2");function $r(){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($r,"compose");function Dn(){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=$r.apply(void 0,c)(s.dispatch),$a({},s,{dispatch:i})}}}n(Dn,"applyMiddleware");function Fn(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(Fn,"createThunkMiddleware");var Un=Fn();Un.withExtraArgument=Fn;var Ln=Un;var qs=ce(qt());k();j();var bt="OG_STATE",Ds=n(t=>{try{return t===null?void 0:JSON.parse(t)}catch{return}},"safeParseState"),no=n(()=>window.og&&window.og.previewMode,"isPreviewMode"),Fs=n(()=>no()?{}:Ds(localStorage.getItem(bt)),"loadState"),el=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"),Us=n(t=>{if(no())return;let e=el(t);e&&localStorage.getItem(bt)!==e&&localStorage.setItem(bt,e)},"saveState"),Ls=n(t=>(0,qs.throttle)(500,e=>{if(no())return;let{key:r,newValue:o}=e;r===bt&&o===null?(t.dispatch({type:le}),setTimeout(()=>t.dispatch(Ts()),0)):r===bt&&t.dispatch({type:Ee,newValue:Ds(o)})}),"listenLocalStorageChanges");var Ms=ce(qt());j();U();var tl=n((t,e,r=document)=>r.dispatchEvent(new CustomEvent(t,{detail:e})),"dispatchEvent"),js=n(t=>({payload:{product:{id:e,components:r}={}}={}}={})=>setTimeout(()=>tl("optin-changed",{productId:e,components:r,optedIn:t}),0),"dispatchOptinChangedEvent"),rl=[{expressions:[({type:t}={})=>t===N,({type:t}={})=>t===D],fn:js(!0)},{expressions:[({type:t}={})=>t===q],fn:js(!1)}],$s=n(t=>e=>r=>{let o=t.getState();rl.forEach(s=>{s.expressions.some(i=>i(r,o))&&s.fn(r)}),e(r)},"dispatchMiddleware"),Vs=n(t=>e=>r=>{var s;let o;switch(r.type){case R:case q:case N: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"),Hs=n(t=>e=>r=>{e(r);let o=(0,Ms.throttle)(500,()=>{Us({...t.getState()})});r.type!==Ee&&o()},"localStorageMiddleware");k();j();var so=n(()=>{let t,e;return[new Promise((r,o)=>{t=r,e=o}),t,e]},"waitFor");function Gs(t){let[e,r]=so(),[o,s]=so(),[i,a]=so();o.then(l=>{let{sessionId:p}=t.getState();!p||l&&!p.startsWith(l)?t.dispatch(Xr(l)):a(p)});let c=Promise.all([o,e,i]);return c.then(()=>{var l;window.addEventListener("storage",Ls(t)),((l=t.getState().auth)==null?void 0:l.ts)||t.dispatch(vs())}),l=>async p=>{je===p.type||Me===p.type||$e===p.type?r(p.payload):Ue===p.type?s(p.payload):Le===p.type?a(p.payload):await c,l(p)}}n(Gs,"waitUntilOffersReady");function Bs(t,...e){if(window.og&&window.og.store)return window.og.store;let r=window.og&&window.og.previewMode,o=typeof window=="object"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({name:"Ordergroove Offers"}):$r,s=[Gs,Ln,$s,Vs],i={};if(!r)try{i=Fs(),s.push(Hs)}catch{}let a=o(Dn(...s,...e.filter(l=>l))),c=jr(t,i,a);return window.og=window.og||{},window.og.store=c,c}n(Bs,"makeStore");var ol=Object.defineProperty,lr=n((t,e)=>ol(t,"name",{value:e,configurable:!0}),"i"),nl=lr(t=>e=>t.indexOf(e.origin)>=0,"createIsMessageAllowed"),zs=["https://rc3.ordergroove.com","https://rc3.stg.ordergroove.com","http://localhost:3000",window.location.origin],Ws=lr(t=>(e,r)=>{zs.forEach(o=>t.postMessage({ogType:e,...r},o))},"createBroadcastMessage");function io(t=window.opener,e=window.og){let r=lr(o=>{let s=nl(zs),i=Ws(o.source),a=o.data.options||{};if(s(o)&&o.data.ogType==="READY"){let c="//static.ordergroove.com/@ordergroove/offers-live-editor/0.6.1/dist/";c.startsWith("//")&&(c=window.location.protocol+c),c.endsWith("/")||(c+="/"),import(`${c}client.js`).then(({initializeClient:l})=>{l({isMessageAllowed:s,broadcastMessage:i,options:a,og:e}),window.removeEventListener("message",r)})}},"handleReady");t&&t!==window&&(window.addEventListener("message",r),Ws(t)("READY"))}n(io,"f");lr(io,"offersLiveEditor");var pr=null,sl=n(t=>({dispatch:t}),"defaultMapDispatchToProps"),Ys=n(t=>{if(!pr)throw new Error("Missing redux store.");return pr},"resolveStore"),il=n((t,e)=>r=>{let{getState:o,dispatch:s}=Ys(r),i=t?t(o(),r):{},a=e(s,r);Object.assign(r,i,a)},"createRecalcProps"),g=n((t,e=sl)=>r=>{let s=il(t,typeof e=="function"?e:i=>kn(e,i));return class extends r{get store(){return pr}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this._storeUnsubscribe=Ys(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"),Js=n(t=>{pr=t},"setStore");de();var ao=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],...dt(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"),Qe=n((t={})=>{let e={};return Object.entries(t).forEach(([r,o])=>{Object.entries(o).forEach(([s,i])=>{let a={};i&&!Array.isArray(i)?a=i:a={frequency:s,prepaidShipments:null,regularPrice:i[0],subscriptionPrice:i[2],discountRate:i[1]},e[r]?e[r].push(a):e[r]=[a]})}),e},"getObjectStructuredProductPlans");k();O();var Ai=ce(vi());O();var Tl=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"),Ti=n(t=>t.hasAttribute("product")&&{id:t.getAttribute("product"),...t.hasAttribute("product-components")&&{components:JSON.parse(t.getAttribute("product-components"))}},"buildProduct");var No=n(t=>{let e=Ti(t);if(!e){let r=t.offer;r&&(e=Ti(r))}return e},"resolveProduct"),Ol=n(t=>{let e=t;for(;e;){if(e.tagName==="OG-OFFER")return e;e=e.nodeType===11?e.host:e.parentNode}},"resolveOffer"),Io=n(t=>class extends t{get offer(){return Ol(this)}connectedCallback(){super.connectedCallback(),this.offersChangeTemplate=this.offersChangeTemplate.bind(this),this.offer&&this.offer.addEventListener("template-changed",this.offersChangeTemplate)}disconnectedCallback(){super.disconnectedCallback(),this.offer&&this.offer.removeEventListener("template-changed",this.offersChangeTemplate)}offersChangeTemplate(){this._enqueueUpdate()}},"withOfferTemplate"),A=n(t=>class extends Io(t){get product(){return No(this)}},"withProduct"),Tr=n(t=>class extends t{get childOptions(){let e=[],r=null;return this.querySelectorAll("option").forEach(o=>{let s=Tl(o.value),i=o.innerText.trim();e.push({value:s,text:i}),!r&&o.selected&&(r=s)}),{options:e,isSelected:r}}},"withChildOptions");var Or={};Fr(Or,{autoshipByDefault:()=>Pl,eligibilityGroups:()=>qo,eligible:()=>Oi,hasUpcomingOrder:()=>Ci,hasUpsellGroup:()=>wi,inStock:()=>ko,optedout:()=>Rl,prepaidEligible:()=>wl,prepaidSubscribed:()=>Al,regularEligible:()=>Il,subscribed:()=>Cl,subscriptionEligible:()=>Pi,upcomingOrderContainsProduct:()=>Nl,upsellEligible:()=>Ri});U();var ko=n((t,e)=>(t.inStock||{})[(e.product||{}).id],"inStock"),Oi=n((t,e)=>(t.autoshipEligible||{})[(e.product||{}).id]||!1,"eligible"),Pl=n((t,e)=>(t.autoshipByDefault||{})[(e.product||{}).id]||!1,"autoshipByDefault"),Pi=n((t,e)=>(t.offerId&&t.offerId!=="0"||!1)&&Oi(t,e)&&ko(t,e),"subscriptionEligible"),qo=n((t,e)=>(t.eligibilityGroups||{})[(e.product||{}).id]||null,"eligibilityGroups"),wi=n((t,e)=>{let r=qo(t,e);return r===null||!!r.find(o=>o==="upsell"||o==="impulse_upsell")},"hasUpsellGroup"),wl=n((t,e)=>{let r=qo(t,e);return(r==null?void 0:r.some(o=>o==="prepaid"))||!1},"prepaidEligible"),Cl=n((t,e)=>er(e.product)(t),"subscribed"),Rl=n((t,e)=>rr(e.product)(t),"optedout"),Al=n((t,e)=>us(e.product)(t),"prepaidSubscribed"),Ci=n(t=>!!(t.nextUpcomingOrder&&t.nextUpcomingOrder.public_id),"hasUpcomingOrder"),Nl=n((t,e)=>(t.nextUpcomingOrder&&t.nextUpcomingOrder.products||[]).includes((e.product||{}).id),"upcomingOrderContainsProduct"),Ri=n((t,e)=>{var r;return!((r=e.offer)==null?void 0:r.isCart)&&t.offerId&&t.offerId!=="0"&&t.auth&&ko(t,e)&&Ci(t)&&wi(t,e)},"upsellEligible"),Il=n((t,e)=>Pi(t,e)&&!Ri(t,e),"regularEligible");var kl=n(t=>t.replace(/(\r\n|\n|\r|\s)+/gm,""),"removeWhitespace"),Do=class extends A(v){static get properties(){return{...super.properties,state:{type:Object,attribute:!1},test:{type:String}}}render(){return this.test&&Ai.default.parse(kl(this.test),r=>Or[r]&&Or[r](this.state,this))?d`
|
|
111
111
|
<slot></slot>
|
|
112
|
-
`:d``}shouldUpdate(e){return e.size&&(this.product&&this.product.id in this.state.autoshipEligible&&this.product.id in this.state.inStock||!this.product.id)}};n(Do,"When");var
|
|
112
|
+
`:d``}shouldUpdate(e){return e.size&&(this.product&&this.product.id in this.state.autoshipEligible&&this.product.id in this.state.inStock||!this.product.id)}};n(Do,"When");var ql=n(t=>({state:t}),"mapStateToProps"),Ni=g(ql)(Do);O();k();O();U();de();var Ii={type:Object,converter:{toAttribute(t){return t==null?t:JSON.stringify(t)},fromAttribute(t){return t&&t.match(/[{[]/)?JSON.parse(t):{id:t}}}},be={type:String,attribute:"default-frequency",converter:{fromAttribute(t){return t&&Wr(t)?t:null}}},Pr={type:Boolean,attribute:!0,reflect:!0},tt={type:Object,attribute:!1};O();U();var Dl=n(t=>class extends t{getOption(e,r=e){let o=Qr(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"),M=Dl(v);var Y=class extends A(M){static get properties(){return{subscribed:Pr,frequencyMatch:{type:Boolean,reflect:!0,attribute:"frequency-match"},productDefaultFrequency:{type:String},defaultFrequency:{type:String},frequencies:{type:Array}}}static get styles(){return E`
|
|
113
113
|
:host {
|
|
114
114
|
cursor: default;
|
|
115
115
|
display: inline-block;
|
|
@@ -253,7 +253,7 @@ var lib=(()=>{var Na=Object.create;var ot=Object.defineProperty;var Ia=Object.ge
|
|
|
253
253
|
<slot>
|
|
254
254
|
<og-next-upcoming-order></og-next-upcoming-order>
|
|
255
255
|
</slot>
|
|
256
|
-
`}};n(Mo,"UpsellButton");var
|
|
256
|
+
`}};n(Mo,"UpsellButton");var Fl=n(t=>({isPreview:t.previewUpsellOffer}),"mapStateToProps"),Li=g(Fl,{fetchOrders:cr})(Mo);O();k();U();var jo=class extends A(M){static get properties(){return{...super.properties,defaultFrequency:be,auth:tt,subscribed:{type:Boolean,attribute:!1},frequency:{type:String,attribute:!1},nextUpcomingOrder:{type:Object,attribute:!1},show:{type:Boolean,attribute:"show"},offerId:{type:String}}}constructor(){super();this.createIu=()=>0,this.concludeUpsell=()=>0}render(){return d`
|
|
257
257
|
<og-modal ?show=${this.show} @close=${()=>this.close()} @confirm=${()=>this.confirm()}>
|
|
258
258
|
<div slot="content">
|
|
259
259
|
<slot>
|
|
@@ -291,7 +291,7 @@ var lib=(()=>{var Na=Object.create;var ot=Object.defineProperty;var Ia=Object.ge
|
|
|
291
291
|
</slot>
|
|
292
292
|
</span>
|
|
293
293
|
</og-modal>
|
|
294
|
-
`}set defaultFrequency(e){this._defaultFrequency=e}get defaultFrequency(){let e=this.querySelector("og-select-frequency");return e?e.defaultFrequency:this._defaultFrequency}confirm(){this.createIu(this.product,this.nextUpcomingOrder.public_id,1,this.subscribed,this.frequency||this.defaultFrequency),this.close()}close(){this.concludeUpsell(),this.removeAttribute("show")}};n(jo,"UpsellModal");var
|
|
294
|
+
`}set defaultFrequency(e){this._defaultFrequency=e}get defaultFrequency(){let e=this.querySelector("og-select-frequency");return e?e.defaultFrequency:this._defaultFrequency}confirm(){this.createIu(this.product,this.nextUpcomingOrder.public_id,1,this.subscribed,this.frequency||this.defaultFrequency),this.close()}close(){this.concludeUpsell(),this.removeAttribute("show")}};n(jo,"UpsellModal");var Ul=n((t,e)=>({auth:t.auth,offerId:t.offerId,subscribed:Z(e.product)(t),frequency:X(e.product)(t),...H(t,e,"defaultFrequency"),nextUpcomingOrder:t.previewUpsellOffer?{public_id:"preview-order-id"}:t.nextUpcomingOrder,isPreview:t.previewUpsellOffer}),"mapStateToProps"),Mi=g(Ul,{concludeUpsell:Ss,createIu:ws})(jo);O();k();var $o=class extends Y{static get properties(){return{...super.properties,frequency:{type:String}}}static get styles(){return E`
|
|
295
295
|
:host {
|
|
296
296
|
cursor: default;
|
|
297
297
|
display: inline-block;
|
|
@@ -332,13 +332,13 @@ var lib=(()=>{var Na=Object.create;var ot=Object.defineProperty;var Ia=Object.ge
|
|
|
332
332
|
></slot>
|
|
333
333
|
</label>
|
|
334
334
|
</slot>
|
|
335
|
-
`}};n($o,"OptinToggle");var ji=g(ie,{optoutProduct:Je,optinProduct:oe})($o);O();var
|
|
335
|
+
`}};n($o,"OptinToggle");var ji=g(ie,{optoutProduct:Je,optinProduct:oe})($o);O();var Ll=n((t,e)=>`${t}${parseInt(e,10)>1?"s":""}`,"pluralize"),Vo=class extends Io(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&&Ll(e,this.pluralize)}render(){return d`
|
|
336
336
|
${this.getText()}
|
|
337
|
-
`}};n(Vo,"Text");var
|
|
337
|
+
`}};n(Vo,"Text");var Ml=n(t=>({i18n:t.locale||{}}),"mapStateToProps"),$i=g(Ml)(Vo);O();F();var rt=class{constructor(e){this.value=e,this.className="DiscountAmount"}toString(){return`${this.value}`}};n(rt,"DiscountAmount");var Rt=class extends rt{constructor(e){super(e);this.className="DiscountPercent"}toString(){return`${super.toString()}%`}};n(Rt,"DiscountPercent");var Ho=class extends Rt{constructor(e){super(e);this.className="ShippingDiscountPercent"}toString(){return this.value===100?"free shipping":super.toString()}};n(Ho,"ShippingDiscountPercent");var Go="Discount Percent",Bo="Discount Amount",Vi="total_price",Hi="shipping_total",Gi="sub_total",zo=n(({field:t,object:e,type:r,value:o})=>{let i=[[new Rt(o),{field:Vi,object:"item",type:Go}],[new rt(o),{field:Vi,object:"item",type:Bo}],[new Ho(o),{field:Hi,object:"order",type:Go}],[new rt(o),{field:Hi,object:"order",type:Bo}],[new Rt(o),{field:Gi,object:"order",type:Go}],[new rt(o),{field:Gi,object:"order",type:Bo}]].find(([,a])=>a.field===t&&a.object===e&&a.type===r);return i&&i[0]},"discountBuilder");function jl(t){return!(zo(t).className!==this.incentiveClass||this.incentiveValue&&this.incentiveValue.toString()!==t.value.toString())}n(jl,"filterIncentives");var Wo=class extends A(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(jl.bind({incentiveClass:e,incentiveValue:r}));return d`
|
|
338
338
|
${this.label} ${s?zo(s):this.renderFallback()}
|
|
339
339
|
`}renderFallback(){return d`
|
|
340
340
|
${zo({field:"sub_total",object:"order",type:"Discount Percent",value:this.value})}
|
|
341
|
-
`}};n(Wo,"IncentiveText");var
|
|
341
|
+
`}};n(Wo,"IncentiveText");var $l=n((t,e)=>{var r;return{incentives:(t.incentives||{})[e&&(e==null?void 0:e.product)&&w((r=e==null?void 0:e.product)==null?void 0:r.id)]||{}}},"mapStateToProps"),Bi=g($l)(Wo);O();k();var Yo=class extends Tr(wt){static get properties(){return{...super.properties,defaultText:{type:String,attribute:"default-text"}}}static get styles(){return E`
|
|
342
342
|
:host {
|
|
343
343
|
display: inline-block;
|
|
344
344
|
cursor: pointer;
|
|
@@ -357,9 +357,9 @@ var lib=(()=>{var Na=Object.create;var ot=Object.defineProperty;var Ia=Object.ge
|
|
|
357
357
|
.selected="${this.currentFrequency}"
|
|
358
358
|
.onChange="${({target:{value:s}})=>{this.productChangeFrequency(this.product,s,this.offer)}}"
|
|
359
359
|
></og-select>
|
|
360
|
-
`}};n(Yo,"SelectFrequency");var zi=g(Ct,{productChangeFrequency:ir})(Yo);O();var
|
|
360
|
+
`}};n(Yo,"SelectFrequency");var zi=g(Ct,{productChangeFrequency:ir})(Yo);O();var Vl={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 Wi=n((t,e)=>t instanceof Date?(e||"").toString().replace(/\{\{([-\w]+)\}\}/g,r=>{let o=r.replace(/[{}]/g,""),s=Vl[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 Jo=class extends v{static get properties(){return{value:{type:String,reflect:!0},format:{type:String}}}createRenderRoot(){return this}render(){return d`
|
|
361
361
|
${Wi(this.value,this.format||"{{month-long}} {{day}}, {{year-numeric}}")}
|
|
362
|
-
`}};n(Jo,"FormattedDate");var
|
|
362
|
+
`}};n(Jo,"FormattedDate");var Hl=n(t=>({value:t.previewUpsellOffer?new Date:t.nextUpcomingOrder.place}),"mapStateToProps"),Yi=g(Hl)(Jo);O();var Ki=ce(lt());k();j();var Ji=n((t,e,r)=>n(async function(s){await s({type:it,payload:t}),await s({type:Se}),await s(Ce({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"),Gl=n((t,e)=>(Object.entries(e).forEach(([r,o])=>{if(Object.prototype.hasOwnProperty.call(t,r)){let s=t[r].concat(o),i=[...new Set(s.map(a=>JSON.stringify(a)))];t[r]=i.map(a=>JSON.parse(a))}else t[r]=o}),t),"mergeProductPlansToState"),Bl=n((t,e,r)=>n(async function(s,i){await s({type:at,payload:t});let{merchantId:a}=i();t?(await s(Ce({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(eo({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(yt(a,"sig_field","ts","sig"))):await s(fe())},"setPreviewUpsellOfferThunk"),"setPreviewUpsellOffer"),zl=n((t,e,r)=>n(async function(s,i){let a=i().productPlans;await s({type:Vr,payload:t}),await s({type:Se}),await s(Ce({in_stock:{[e]:!0},eligibility_groups:{[e]:["subscription","upsell","prepaid"]},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)),await s({type:B,payload:Gl(a,Qe({[e]:[{frequency:"1_3",regularPrice:"$15.00",subscriptionPrice:"$12.00",discountRate:"25%",prepaidShipments:3,regularPrepaidPrice:"$36.00",prepaidSavingsPerShipment:"$3.00",prepaidSavingsTotal:"$9.00",prepaidExtraSavingsPercentage:"10%"},{frequency:"1_3",regularPrice:"$15.00",subscriptionPrice:"$12.00",discountRate:"20%",prepaidShipments:6,regularPrepaidPrice:"$72.00",prepaidSavingsPerShipment:"$3.00",prepaidSavingsTotal:"$18.00",prepaidExtraSavingsPercentage:"10%"},{frequency:"1_3",regularPrice:"$15.00",subscriptionPrice:"$12.00",discountRate:"20%",prepaidShipments:12,regularPrepaidPrice:"$144.00",prepaidSavingsPerShipment:"$3.00",prepaidSavingsTotal:"$36.00",prepaidExtraSavingsPercentage:"10%"}]}))}),await s({type:He,payload:{prepaidSellingPlans:{[e]:[{numberShipments:3,sellingPlan:"1_3"},{numberShipments:6,sellingPlan:"1_3"},{numberShipments:12,sellingPlan:"1_3"}]}}})},"setPreviewPrepaidThunk"),"setPreviewPrepaid"),Qi=n((t,e,r)=>async function(o,s){switch(await o({type:le}),await o({type:it,payload:!1}),await o({type:at,payload:!1}),t){case"regular":o(Ji(!0,r.product.id,r));break;case"upsell":o(Bl(!0,r.product.id,r));break;case"subscribed":o(Ji(!0,r.product.id,r)),o(oe(r.product,"2_2"));break;case"prepaid":o(zl(!0,r.product.id,r)),o(oe(r.product,"1_3"));break;default:}},"setPreview");k();U();F();j();var Wl=n((...t)=>JSON.stringify(t),"memoizeKey"),Yl=(0,Ki.default)((t,e)=>Object.assign({components:e},t),Wl),Qo=class extends M{static get properties(){return{...super.properties,config:{type:Object,attribute:!1},product:Ii,productComponents:{type:Array,attribute:"product-components"},offerId:{type:String,attribute:!1},auth:tt,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":e==="preview-prepaid-offer"&&(this.preview="prepaid")}static get styles(){return E`
|
|
363
363
|
:host[hidden] {
|
|
364
364
|
display: none;
|
|
365
365
|
}
|
|
@@ -508,9 +508,9 @@ var lib=(()=>{var Na=Object.create;var ot=Object.defineProperty;var Ia=Object.ge
|
|
|
508
508
|
</og-when>
|
|
509
509
|
</og-when>
|
|
510
510
|
|
|
511
|
-
`}constructor(){super();this.module="pdp",this.product={},this.productComponents=[],this.fetchOffer=()=>0,this.fetchOrders=()=>0,this.productHasChangedComponents=()=>0,this.setFirstOrderPlaceDate=()=>0,this.setProductToSubscribe=()=>0,this.productChangeFrequency=()=>0}applyTemplate(e){super.applyTemplate(e);let{id:r,locale:o}=e;this.variationId=r,this.locale=o;let s=new CustomEvent("template-changed");this.dispatchEvent(s)}updated(e){if(e.has("preview")&&this.setPreview(this.preview,e.get("preview"),this),this.frequency=this.defaultFrequency,e.has("product")&&!this.isPreview&&nr(()=>this.fetchOffer(this.product.id,xe,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=
|
|
511
|
+
`}constructor(){super();this.module="pdp",this.product={},this.productComponents=[],this.fetchOffer=()=>0,this.fetchOrders=()=>0,this.productHasChangedComponents=()=>0,this.setFirstOrderPlaceDate=()=>0,this.setProductToSubscribe=()=>0,this.productChangeFrequency=()=>0}applyTemplate(e){super.applyTemplate(e);let{id:r,locale:o}=e;this.variationId=r,this.locale=o;let s=new CustomEvent("template-changed");this.dispatchEvent(s)}updated(e){if(e.has("preview")&&this.setPreview(this.preview,e.get("preview"),this),this.frequency=this.defaultFrequency,e.has("product")&&!this.isPreview&&nr(()=>this.fetchOffer(this.product.id,xe,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=Yl(this.product,this.productComponents),o=Object.assign({},this.product,{components:e.get("productComponents")});I(r,o)||this.productHasChangedComponents(r,o)}(e.has("offerId")||e.has("autoshipByDefault")||e.has("location")||e.has("product"))&&this.offerId&&this.autoshipByDefault&&(this.location==="cart"||this.isCart)&&this.product.id&&this.optinProduct&&!(this.optedin||[]).find(r=>I(r,this.product))&&this.optinProduct({...this.product,...this.productComponents.length&&{components:this.productComponents}},this.defaultFrequency,this)}get isPreview(){return this.preview||window.og.previewMode}render(){return d`
|
|
512
512
|
<slot></slot>
|
|
513
|
-
`}get defaultFrequency(){let e=this.productFrequency||this.productDefaultFrequency;if(e)return e;let r=this.querySelector("og-select-frequency");return r&&r.currentFrequency?r.currentFrequency:this.getOption("defaultFrequency")}};n(Qo,"Offer");var
|
|
513
|
+
`}get defaultFrequency(){let e=this.productFrequency||this.productDefaultFrequency;if(e)return e;let r=this.querySelector("og-select-frequency");return r&&r.currentFrequency?r.currentFrequency:this.getOption("defaultFrequency")}};n(Qo,"Offer");var Jl=n((t,e)=>({config:t.config,auth:t.auth,offerId:((t.productOffer||{})[(e.product||{}).id]||[])[0],productFrequency:X(e.product)(t),productDefaultFrequency:Be((e.product||{}).id)(t),...H(t,e,"autoshipByDefault",Jr(t)[(e.product||{}).id]),...rr(e.product)(t)&&{autoshipByDefault:!1},optedin:gt(t),subscribed:Z(e.product)(t),...ze(t)}),"mapStateToProps"),Zi=g(Jl,{fetchOffer:Os,fetchOrders:cr,productHasChangedComponents:bs,optinProduct:oe,setFirstOrderPlaceDate:Is,setProductToSubscribe:ks,setPreview:Qi})(Qo);O();var wr=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 E`
|
|
514
514
|
:host[hidden] {
|
|
515
515
|
display: none;
|
|
516
516
|
}
|
|
@@ -918,7 +918,7 @@ var lib=(()=>{var Na=Object.create;var ot=Object.defineProperty;var Ia=Object.ge
|
|
|
918
918
|
<slot name="append"></slot>
|
|
919
919
|
</label>
|
|
920
920
|
</div>
|
|
921
|
-
`}};n(Ko,"PrepaidToggle");var
|
|
921
|
+
`}};n(Ko,"PrepaidToggle");var Ql=n((t,e)=>({options:ds(e.product.id)(t),shipmentsOptedIn:or(e.product)(t),prepaidShipmentsSelected:tr(e.product)(t)}),"mapStateToProps"),Xi=g(Ql,{productChangePrepaidShipments:_s})(Ko);O();U();F();var Zo=class extends A(M){static get properties(){return{...super.properties,shipmentsOptedIn:{type:Number},productPlans:{type:Object},prepaidShipmentsSelected:{type:Number},totalPrice:{type:Boolean,reflect:!0,attribute:"total-price"},perDeliveryPrice:{type:Boolean,reflect:!0,attribute:"per-delivery-price"},totalSavings:{type:Boolean,reflect:!0,attribute:"total-savings"},perDeliverySavings:{type:Boolean,reflect:!0,attribute:"per-delivery-savings"},percentageSavings:{type:Boolean,reflect:!0,attribute:"percentage-savings"},extraPercentageSavings:{type:Boolean,reflect:!0,attribute:"extra-percentage-savings"},numberOfShipments:{type:Boolean,reflect:!0,attribute:"number-of-shipments"}}}static get styles(){return E`
|
|
922
922
|
:host {
|
|
923
923
|
display: inline-block;
|
|
924
924
|
text-indent: initial;
|
|
@@ -929,12 +929,12 @@ var lib=(()=>{var Na=Object.create;var ot=Object.defineProperty;var Ia=Object.ge
|
|
|
929
929
|
<slot name="append"></slot>
|
|
930
930
|
`:d`
|
|
931
931
|
<slot name="fallback"></slot>
|
|
932
|
-
`}};n(Zo,"PrepaidData");var
|
|
932
|
+
`}};n(Zo,"PrepaidData");var Kl=n((t,e)=>({shipmentsOptedIn:or(e.product)(t),prepaidShipmentsSelected:tr(e.product)(t),productPlans:t.productPlans}),"mapStateToProps"),ea=g(Kl)(Zo);var{TestWizard:Xl}=(ra(),ta);function Xo(){let t="og-test-wizard";customElements.get(t)||customElements.define(t,Xl);let e=document.createElement(t);document.body.appendChild(e)}n(Xo,"default");var en=[79,71,68,69,86],oa=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===en[t]){let o=en[t];setTimeout(function(){t<=o&&(t=0)},5e3),t+=1,t>=en.length&&Xo()}else t=0},!1)},"enable");de();j();U();de();F();var Nr=n((t=[],e)=>{switch(e.type){case le:return[];case Ee:return e.newValue?e.newValue.optedin:t;case N:case D:{let[{prepaidShipments:c,...l},p]=Ye(t,e.payload.product);return p.concat({...l,...e.payload.product,frequency:e.payload.frequency})}case re:let{payload:r}=e,[{prepaidShipments:o,...s},i]=Ye(t,r.product),a={...s,...r.product};return r.prepaidShipments&&(a.prepaidShipments=r.prepaidShipments),i.concat(a);case q:return t.filter(c=>!I(e.payload.product,c));case st:return t.map(c=>I(e.payload.product,c)?{...c,...e.payload.newProduct}:c);case $t:return t.filter(c=>!I(e.payload.product,c));case Ve:return[];default:return t}},"optedin"),tn=n((t=[],e)=>{switch(e.type){case le:return[];case Ee:return e.newValue?e.newValue.optedout:t;case N:case D:return t.filter(s=>!I(e.payload.product,s));case q:let[r,o]=Ye(t,e.payload.product);return o.concat({...r,...e.payload.product,frequency:e.payload.frequency});case st:return t.map(s=>I(e.payload.product,s)?{...s,...e.payload.newProduct}:s);case Ve:return[];default:return t}},"optedout"),rn=n((t={},{type:e,payload:r})=>{switch(e){case Lt: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 Mt:return{...t,products:(r.results||[]).map(o=>o.product)};case jt:return{...t,...r,public_id:r.order,...r.product&&{products:(t.products||[]).concat(r.product)}};default:return t}},"nextUpcomingOrder"),ep=n((t={},e)=>{switch(e.type){case R:return{...t,...e.payload.autoship};default:return t}},"autoshipEligible"),tp=n((t={},e)=>{switch(e.type){case J:return{...t};case R:return{...t,...e.payload.in_stock};default:return t}},"inStock"),on=n((t={},e)=>{switch(e.type){case R:return{...t,...e.payload.eligibility_groups};default:return t}},"eligibilityGroups"),na=n((t,e)=>t.map(r=>({...e[r],id:[r][0]})),"mapIncentive"),nn=n((t={},e)=>{switch(e.type){case R: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||[],...na(i,e.payload.incentives_display)],ongoing:[...s.ongoing||[],...na(a,e.payload.incentives_display)]}),{})}),{})};default:return t}},"incentives"),rp=n((t={},e)=>{switch(e.type){case N:case D:return{...t,[w(e.payload.product)]:e.payload.frequency};case q:return{...t,[w(e.payload.product)]:void 0};default:return t}},"frequency"),sn=n((t=!1,e)=>{switch(e.type){case Ut:return{...e.payload};case Se:return!1;default:return t}},"auth"),an=n((t="",e)=>{switch(e.type){case Ue:return e.payload;default:return t}},"merchantId"),cn=n((t=null,e)=>{switch(e.type){case Ft:return e.payload;default:return t}},"authUrl"),op=n((t={},e)=>{switch(e.type){case R:return{...t,offerId:(e.payload.module_view||{}).regular,...e.payload.modifiers};default:return t}},"offer"),ln=n((t="",e)=>{switch(e.type){case R:return(e.payload.module_view||{}).regular||"";default:return t}},"offerId"),pn=n((t=null,e)=>{switch(e.type){case le:return null;case Le:return e.payload;default:return t}},"sessionId"),np=n((t={},e)=>{switch(e.type){case R:return{...t,...Object.entries(e.payload.autoship).map(([r])=>({[r]:Object.keys(e.payload.modifiers)})).reduce((r,o)=>({...r,...o}))};case Ve:return{};default:return t}},"productOffer"),un=n((t={},e)=>{switch(e.type){case Bt:return{...t,[w(e.payload.product)]:e.payload.firstOrderPlaceDate};default:return t}},"firstOrderPlaceDate"),dn=n((t={},e)=>{switch(e.type){case zt:return{...t,[w(e.payload.product)]:e.payload.productToSubscribe};default:return t}},"productToSubscribe"),At=n((t={},e)=>{switch(e.type){case Me:return{...t,name:ve,apiUrl:"https://staging.offers.ordergroove.com",legoUrl:"https://staging.restapi.ordergroove.com"};case je:return{...t,name:Wt,apiUrl:"https://dev.offers.ordergroove.com",legoUrl:"https://dev.restapi.ordergroove.com"};case $e:return{...t,name:Te,apiUrl:"https://offers.ordergroove.com",legoUrl:"https://restapi.ordergroove.com"};default:return t}},"environment"),fn=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 Vt:return{...t,...e.payload};default:return t}},"locale"),sp=n((t={offerType:"radio"},e)=>{switch(e.type){case He:return{...t,...e.payload,defaultFrequency:e.payload.defaultFrequency?ft(e.payload.defaultFrequency):t.defaultFrequency,frequenciesEveryPeriod:[],frequencies:e.payload.frequencies?e.payload.frequencies.map(ft):t.frequencies};default:return t}},"config"),hn=n((t=!1,e)=>{switch(e.type){case it:return e.payload;default:return t}},"previewStandardOffer"),mn=n((t=!1,e)=>{switch(e.type){case at:return e.payload;default:return t}},"previewUpsellOffer");var gn=n((t=[],e)=>{switch(e.type){case R:return{...t,...e.payload.autoship_by_default};default:return t}},"autoshipByDefault"),yn=n((t=[],e)=>{switch(e.type){case R:return{...t,...e.payload.default_frequencies};default:return t}},"defaultFrequencies"),bn=n((t=[],e)=>{switch(e.type){case Gt:return[...e.payload||[]];case Ht:return[e.payload,...t];default:return t}},"templates"),ip=n((t={},e)=>{switch(e.type){case B:return Qe(e.payload);default:return t}},"productPlans"),_n=n((t={},e)=>{switch(e.type){case re:return e.payload.prepaidShipments?{...t,[e.payload.product.id]:e.payload.prepaidShipments}:t;default:return t}},"prepaidShipmentsSelected"),Ir=It({optedin:Nr,optedout:tn,nextUpcomingOrder:rn,autoshipEligible:ep,inStock:tp,eligibilityGroups:on,incentives:nn,frequency:rp,auth:sn,merchantId:an,authUrl:cn,offer:op,offerId:ln,sessionId:pn,productOffer:np,firstOrderPlaceDate:un,productToSubscribe:dn,environment:At,locale:fn,config:sp,previewStandardOffer:hn,previewUpsellOffer:mn,autoshipByDefault:gn,defaultFrequencies:yn,templates:bn,productPlans:ip,prepaidShipmentsSelected:_n});j();O();U();F();var Sn=class extends A(M){static get properties(){return{...super.properties,regular:{type:Boolean,reflect:!0},subscription:{type:Boolean,reflect:!0},discount:{type:Boolean,reflect:!0},payAsYouGo:{type:Boolean,reflect:!0,attribute:"pay-as-you-go"},frequency:{type:Object},productPlans:{type:Object}}}get value(){var l;let e=w(this.product),r=this.frequency||this.configDefaultFrequency||((l=this.offer)==null?void 0:l.defaultFrequency),o=this.productPlans[e]||[];if(this.payAsYouGo){let p=o.find(f=>f.prepaidShipments===null||f.prepaidShipments===void 0);return p?p.subscriptionPrice:""}let s=o.find(p=>p.frequency===r);if(!s)return"";let{regularPrice:i,discountRate:a,subscriptionPrice:c}=s;return c===i?"":this.regular?i:this.discount?a:c}render(){let e=this.value;return e?d`
|
|
933
933
|
<slot name="prepend"></slot>
|
|
934
934
|
${e}
|
|
935
935
|
<slot name="append"></slot>
|
|
936
936
|
`:d`
|
|
937
937
|
<slot name="fallback"></slot>
|
|
938
|
-
`}};n(Sn,"Price");var cp=n((t,e)=>{var r;return{productPlans:t.productPlans,configDefaultFrequency:(r=t.config)==null?void 0:r.defaultFrequency,frequency:X(e.product)(t)}},"mapStateToProps"),sa=g(cp)(Sn);F();function En(t){oa(),Js(t);try{customElements.define("og-when",Ni),customElements.define("og-text",$i),customElements.define("og-incentive-text",Bi),customElements.define("og-offer",Zi),customElements.define("og-select-frequency",zi),customElements.define("og-optout-button",Di),customElements.define("og-optin-toggle",ji),customElements.define("og-optin-status",ki),customElements.define("og-optin-button",qi),customElements.define("og-optin-select",Ui),customElements.define("og-upsell-button",Li),customElements.define("og-frequency-status",Fi),customElements.define("og-modal",wr),customElements.define("og-select",Cr),customElements.define("og-tooltip",Rr),customElements.define("og-upsell-modal",Mi),customElements.define("og-next-upcoming-order",Yi),customElements.define("og-price",sa),customElements.define("og-prepaid-toggle",Xi),customElements.define("og-prepaid-data",ea)}catch{console.info("OG WebComponents already registered, skipping.")}let e=!1,r={store:t,isReady:()=>e,setEnvironment(o){return t.dispatch(ro(o)),this},setMerchantId(o){return t.dispatch(Es(o)),this},setAuthUrl(o){return t.dispatch(xs(o)),this},getProductsForPurchasePost(o=[]){return ao(t.getState(),o)},getOptins(o=[]){return ao(t.getState(),o)},clear(){t.dispatch(Ps())},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(Rs(o)),this},setLocale(o){return t.dispatch(Cs(o)),this},addTemplate(o,s,i){return t.dispatch(As(o,s,i)),this},setTemplates(o){return t.dispatch(Ns(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}=At({},ro(s)),{sessionId:p}=a.getState();p&&c.forEach(f=>{let u=w(f);ue.fetchOffer(l,o,p,`${u}`,xe)}),i.product_discounts&&typeof i.product_discounts=="object"&&a.dispatch({type:B,payload:i.product_discounts})}},initialize(o,s,i){var c;e?console.warn("og.offers has been initialized already. Skipping."):r.resolveSettings(o,s,window.og_settings,t);let a=t.getState();return o&&o!==a.merchantId&&r.setMerchantId(o),s&&s!==((c=a.environment)==null?void 0:c.name)&&r.setEnvironment(s),i&&r.setAuthUrl(i),e=!0,this}};return window.OG=window.OG||{},Object.assign(window.OG,r),Object.assign(r.initialize,r),io(window.opener,r),r}n(En,"makeApi");j();F();var ae=n(t=>t===null?"":`$${t.toString().replace(/(\d\d)$/,".$1")}`,"money"),kr=n(t=>`${t}%`,"percentage");var qr=n(t=>{var e,r;return Array.isArray((e=t.selling_plan)==null?void 0:e.options)&&((r=t.selling_plan)==null?void 0:r.options.some(o=>(o==null?void 0:o.name)==="Shipment amount"))},"isPrepaidAllocation"),Dr=n(t=>{if(t&&t.length>1){let e=t.find(r=>(r==null?void 0:r.name)==="Shipment amount").value.split(" ");return e.length>0?+e[0]:null}return null},"getPrepaidShipmentsNumberFromOptions"),lp=n(t=>{var e;return(t.selling_plan_id||((e=t.selling_plan)==null?void 0:e.id)).toString()},"getAllocationFrequency"),pp=n(t=>ae(t.compare_at_price),"getAllocationRegularPrice"),up=n(t=>{var e;if(qr(t)){let r=Dr((e=t.selling_plan)==null?void 0:e.options),o=t.price/r;return ae(o)}return ae(t.price)},"getAllocationSubscriptionPrice"),ia=n((t,e)=>Math.round((t.compare_at_price-e)*100/t.compare_at_price),"getPrepaidPercentage"),dp=n(t=>{var r,o,s;if(qr(t)){let i=Dr((r=t.selling_plan)==null?void 0:r.options),a=t.price/i,c=ia(t,a);return kr(c)}let e="";return((o=t.price_adjustments[0])==null?void 0:o.value_type)==="percentage"?e=kr(t.price_adjustments[0].value):((s=t.price_adjustments[0])==null?void 0:s.value)?e=ae(t.price_adjustments[0].value):t.compare_at_price&&(e=ae(t.compare_at_price-t.price)),e},"getAllocationDiscountRate"),fp=n(t=>{var e;return qr(t)?Dr((e=t.selling_plan)==null?void 0:e.options):null},"getAllocationNumberOfShipments"),hp=n((t,e,r)=>{var p,f;let o=Dr((p=t.selling_plan)==null?void 0:p.options),s=t.price/o,i=t.compare_at_price-s,a=ia(t,s),c=(f=r==null?void 0:r.price_adjustments)==null?void 0:f[0],l=c&&c.value_type==="percentage"?c.value:null;return e.regularPrepaidPrice=ae(t.price),e.prepaidSavingsPerShipment=ae(Math.round(i)),e.prepaidSavingsTotal=ae(Math.round(i*o)),l&&a&&(e.prepaidExtraSavingsPercentage=kr(a-l)),e},"addPrepaidPriceAndSavings"),xn="Subscribe and Save",mp=n((t,e=[])=>{t.selling_plan||(t.selling_plan=e.find(o=>o.id===t.selling_plan_id));let r={frequency:lp(t),regularPrice:pp(t),subscriptionPrice:up(t),discountRate:dp(t),prepaidShipments:fp(t)};if(qr(t)){let o=e.find(s=>s.group_name===xn&&s.options.length===1);return hp(t,r,o)}return r},"mapSellingPlanToDiscount"),vn=n((t,e,r=[])=>[...t,mp(e,r)],"sellingPlanAllocationsReducer"),aa=n(t=>t.selling_plan_groups.reduce((e,r)=>[...e,...r.selling_plans.map(o=>({...o,group_name:r.name}))],[]),"getSellingPlans");var ca=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"),la=n((t,e,r)=>{if(!r)return null;if(!We(r))return r;if(sr(t,e)){let o=ee(t,e,r);return o||we(t)}return r},"getDefaultSellingPlan"),gp=n((t,e)=>t.map(r=>{var o,s,i,a,c,l,p;return We(r==null?void 0:r.frequency)?{...r,frequency:sr((o=e==null?void 0:e.config)==null?void 0:o.frequencies,(s=e==null?void 0:e.config)==null?void 0:s.frequenciesEveryPeriod)?ee((i=e==null?void 0:e.config)==null?void 0:i.frequencies,(a=e==null?void 0:e.config)==null?void 0:a.frequenciesEveryPeriod,r.frequency)||ee((c=e==null?void 0:e.config)==null?void 0:c.frequencies,(l=e==null?void 0:e.config)==null?void 0:l.frequenciesEveryPeriod,e.defaultFrequency)||we((p=e==null?void 0:e.config)==null?void 0:p.frequencies):r.frequency}:r}),"mapExistingOptinsFromOfferResponse"),yp=n(({autoship:t={},autoship_by_default:e={},default_frequencies:r={},in_stock:o={}},s,i)=>Object.keys(t).reduce((a,c)=>{if(!s.some(l=>l.id===c)){if(!(t[c]&&e[c]&&o[c]))return a;let{config:{frequencies:l,frequenciesEveryPeriod:p}={},defaultFrequency:f}=i,u=r[c],h;return r[c]&&sr(l,p)?h=ee(l,p,`${u.every}_${u.every_period}`)||la(l,p,f)||we(l):r[c]?h=`${u.every}_${u.every_period}`:h=la(l,p,f)||"_",a.concat({id:c,frequency:h})}return a},[]),"reduceNewOptinsFromOfferResponse"),pa=n(t=>t==null?void 0:t.selling_plan_groups.find(r=>r.name===xn),"getOGSellingPlanGroup"),bp=n((t,e)=>({...ca(t,e.id,e.available),[e.id]:e.available}),"productOrVariantInStockReducer"),ua=n((t,[e])=>({...t,[e]:!0}),"productTrue"),da=n((t,e)=>{let r=w(e.key);return{...t,[e.key]:t[r]||null}},"reduceProductCartLine"),_p=n((t={},e)=>{if(B===e.type)return Object.entries(e.payload).reduce(ua,t);if(pe===e.type){let{payload:r}=e;return r.items.reduce(da,t)}if(Q===e.type){let{payload:{product:r}}=e;return[r,...(r==null?void 0:r.variants)||[]].reduce((o,s)=>{var i,a;return{...ca(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 Sp(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(Sp,"textToFreq");function fa(t){var e;return(e=t==null?void 0:t.selling_plans)==null?void 0:e.map(({options:r})=>r||[]).flat().map(({value:r})=>Sp(r))}n(fa,"sellingPlansToEveryPeriod");function ha(t){var e;return(e=t==null?void 0:t.selling_plans)==null?void 0:e.map(({id:r})=>`${r}`)}n(ha,"sellingPlansToFrequencies");function ma(t){var r;let e=(r=t==null?void 0:t.options.find(({name:o})=>o==="Shipment amount"))==null?void 0:r.value.split(" ")[0];return e?Number(e):void 0}n(ma,"getPrepaidShipments");function Ep(t){return t.reduce((e,r)=>{let o=r.name.split("-")[1],s=r.selling_plans.map(i=>({numberShipments:ma(i),sellingPlan:String(i.id)}));return{...e,[o]:s}},{})}n(Ep,"getPrepaidSellingPlans");var xp=n((t={frequencies:[],offerType:"radio",frequenciesEveryPeriod:[]},e)=>{var r,o;if(B===e.type){let s=[...new Set(Object.values(e.payload).map(Object.keys).flat())];return{...t,frequencies:s}}if(Q===e.type){let{payload:{offer:s,product:i}}=e,a={},c=pa(i),l=ha(c);if(l==null?void 0:l.length){let f=fa(c),u=((o=(r=c.options)==null?void 0:r[0])==null?void 0:o.values)||l,h=t.defaultFrequency;h&&We(h)&&(h=ee(l,f,h)||we(l)||h),a={frequencies:l,frequenciesEveryPeriod:f,frequenciesText:u,...h?{defaultFrequency:h}:{}}}let p=i==null?void 0:i.selling_plan_groups.filter(f=>/^Prepaid-.*/.test(f.name));return p.length&&(a={...a,prepaidSellingPlans:Ep(p)}),{...t,...a}}if(R===e.type){let{payload:{offer:s}}=e,{defaultFrequency:i,config:{frequencies:a,frequenciesEveryPeriod:c}={}}=s;return We(i)?{...t,defaultFrequency:ee(a,c,i)||we(a)||i}:{...t,defaultFrequency:i}}return t},"config"),vp=n((t={},e)=>{if(B===e.type)return Object.entries(e.payload).reduce(ua,t);if(pe===e.type)return e.payload.items.reduce(da,t);if(Q===e.type){let{payload:{product:r}}=e;return[r,...r==null?void 0:r.variants].reduce(bp,t)||t}return J===e.type&&e.payload.product===null?{...t}:t},"inStock"),Tp=n((t={},e)=>t,"offer");function Op({prepaidShipments:t,offer:e,product:r}){var o;if(t){let s=r.id,i=(o=e.config.prepaidSellingPlans[s])==null?void 0:o.find(a=>a.numberShipments===t);return i?i.sellingPlan:null}return e.config.frequencies[0]}n(Op,"getFrequencyForPrepaidShipments");function Pp(t){let e=ma(t.selling_plan_allocation.selling_plan),r={id:t.key,frequency:`${t.selling_plan_allocation.selling_plan.id}`};return e&&(r.prepaidShipments=e),r}n(Pp,"getOptedInItem");var wp=n((t=[],e)=>{if(pe===e.type){let r=e.payload;return t.filter(o=>!o.id.includes(":")).concat(r.items.reduce((o,s)=>s.selling_plan_allocation?[...o,Pp(s)]:o,[]))}if(R===e.type){let{offer:r={},...o}=e.payload,s=gp(t,r),i=yp(o,s,r);return[...s,...i]}if(Q===e.type){let{product:r}=e.payload,o=pa(r),s=ha(o),i=fa(o);return t.map(a=>We(a.frequency)?{...a,frequency:ee(s,i,a.frequency)||we(s)}:a)}if(re===e.type){let{payload:r}=e,o=Nr(t,e),[s,i]=Ye(o,r.product);return i.concat({...s,...r.product,frequency:Op(r)})}return Nr(t,e)},"optedin"),Cp=n((t={},e)=>t,"productOffer"),Rp=n((t={},e)=>{if(Q===e.type){let{payload:{product:r}}=e,o=aa(r);return[r,...r==null?void 0:r.variants].reduce((s,i)=>{var a;return{...s,[i.id]:(a=i.selling_plan_allocations)==null?void 0:a.reduce((c,l)=>vn(c,l,o),[])}},t)||t}return pe===e.type?e.payload.items.reduce((o,s)=>s.selling_plan_allocation?{...o,[s.key]:vn([],s.selling_plan_allocation)}:o,t)||t:B===e.type?Qe(e.payload):t},"productPlans"),Ap=It({auth:sn,authUrl:cn,autoshipByDefault:gn,autoshipEligible:_p,config:xp,defaultFrequencies:yn,eligibilityGroups:on,environment:At,firstOrderPlaceDate:un,incentives:nn,inStock:vp,locale:fn,merchantId:an,nextUpcomingOrder:rn,offer:Tp,offerId:ln,optedin:wp,optedout:tn,previewStandardOffer:hn,previewUpsellOffer:mn,productOffer:Cp,productPlans:Rp,productToSubscribe:dn,sessionId:pn,templates:bn,prepaidShipmentsSelected:_n});function Tn(t,e){return window.og&&window.og.previewMode?Ir(t,e):Ap(t,e)}n(Tn,"shopifyReducer");var ya=ce(lt()),ba=ce(qt());j();U();F();j();function ga(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(ga,"updateTrackingInputs");function On(){return`og__${Math.ceil(new Date().getTime()/1e3)}`}n(On,"getTrackingKey");function Np(t,e){var f,u,h,P;if(!((f=t.payload.offer)==null?void 0:f.autoshipByDefault))return;let o=(u=t.payload.offer)==null?void 0:u.product.id,s=On(),i=((h=t.payload.offer)==null?void 0:h.location)||"",a=((P=t.payload.offer)==null?void 0:P.variationId)||"",c=Cn(o,e),p=[o,N.toLowerCase(),i,c,a].join(",");ga(o,s,p)}n(Np,"addDefaultToSubTracking");function Pn(t){return e=>r=>{switch(e(r),r.type){case N:case q:case D:let o=r.payload.offer,s=wn(r);o&&!o.isCart&&ga(o.product.id,s[0],s[1]);break;case R:Np(r,t);break;default:}}}n(Pn,"shopifyTrackingMiddleware");var va,Ta,_a=((Ta=(va=window.Shopify)==null?void 0:va.routes)==null?void 0:Ta.root)||"/",Ip="/cart",kp=`${_a}cart.js`,qp=`${_a}products/`,Dp='[id^="shopify-section-"][id$=__cart-items], [id^="shopify-section-"][id$="__cart-footer"],#cart-live-region-text,#cart-icon-bubble',Sa=(0,ba.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 Fp(t,e){let r=Up(e);if(r)try{let s=await xa(r);t.dispatch({type:Q,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=>Sa(o,e)),new MutationObserver(()=>Sa(o,e)).observe(o,{subtree:!0,childList:!0})):console.info("no /cart/add form found for og-offer",e)}n(Fp,"setupPdp");var Ea=n(async()=>await(await fetch(kp)).json(),"getCart");function Up(t){return[()=>t==null?void 0:t.dataset.shopifyProductHandle,()=>{var e,r;return(((r=(e=document.querySelector('[href$=".oembed"]'))==null?void 0:e.getAttribute("href"))==null?void 0:r.match(/\/([^\/]+)\.oembed$/))||[])[1]},()=>{var e,r;return(document.querySelector('meta[property="og:type"][content="product"]')&&((r=(e=document.querySelector('meta[property="og:url"][content]'))==null?void 0:e.getAttribute("content"))==null?void 0:r.match(/\/([^\/]+)$/))||[])[1]},()=>{var e;return(e=[...document.querySelectorAll("[type$=json]")].map(r=>JSON.parse(r.textContent||"{}")).find(r=>r.handle&&r.price))==null?void 0:e.handle}].reduce((e,r)=>e||r(),"")}n(Up,"guessProductHandle");var xa=(0,ya.default)(async t=>(await fetch(`${qp}${t}.js`)).json());async function Lp(t,e){let r=await Ea(),{items:o}=r;t.dispatch({type:pe,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(xa))).forEach(a=>t.dispatch({type:Q,payload:{product:a,offer:e}}))}n(Lp,"setupCart");async function Mp(t,e){var i,a;let r=t.payload.offer,o=t.payload.frequency||null,s=wn(t);if(!!(r==null?void 0:r.isCart))try{r.style.pointerEvents="none",r.style.opacity=".7";let c=Array.from(document.querySelectorAll(Dp)),l=t.payload.product.id,p=await Ea(),f=(i=p==null?void 0:p.items)==null?void 0:i.findIndex(y=>y.key===l),u=p.items[f],h=u.quantity,P=w(l),_=await fetch("/cart/change.js",{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:l,quantity:h,attributes:Object.fromEntries([s]),properties:u.properties,selling_plan:o||null,sections:c.map(y=>y.id.replace(/^shopify-section-/,""))})});if(_.status!==200)throw new Error("Cart not updated");let m=await _.json(),x=p.items.length===m.items.length?m.items[f].key:(a=m.items.find(y=>y.quantity===h&&y.product_id===P&&(!o&&!y.selling_plan_allocation||(y==null?void 0:y.selling_plan_allocation.selling_plan.id)===o)))==null?void 0:a.key;x&&r.setAttribute("product",x),e.dispatch({type:pe,payload:m});let C=new CustomEvent(Kn,{bubbles:!0,cancelable:!0});if(r.dispatchEvent(C),C.defaultPrevented)return;let b=m.sections;Object.values(b).length?c.forEach(y=>{let Nt=y.id.replace(/^shopify-section-/,"");if(!(Nt in b))return;let Aa=b[Nt],An=new DOMParser().parseFromString(Aa.toString()||"","text/html").getElementById(y.id);An&&(y.innerHTML=An.innerHTML)}):window.location.pathname.startsWith(Ip)&&window.location.reload()}catch(c){console.log("OG Error updating cart",c)}finally{r.style.pointerEvents="auto",r.style.opacity="1"}}n(Mp,"synchronizeCartOptin");function wn(t){var a,c;let e=t.payload.product.id;if(!e)return[];let r=On(),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 J:case q:i.push(""),i.push(s);break;case N:case D:i.push(t.payload.frequency),i.push(s);break;default:return[]}return[r,i.join(",")]}n(wn,"getTrackingEvent");function Cn(t,e){var s;return(s=er({id:t})(e.getState()))==null?void 0:s.frequency}n(Cn,"getSubscribedFrequency");function jp(t,e){e.isCart||[...document.querySelectorAll('form[action$="/cart/add"] [name=id]')].forEach(r=>{let o=r.value,s=Cn(o,t);ys(r.form,"selling_plan",s)})}n(jp,"synchronizeSellingPlan");function Rn(t){return e=>r=>{var o;switch(r.type){case N:case q:case D:break;case J:((o=r.payload.offer)==null?void 0:o.isCart)?Lp(t,r.payload.offer):Fp(t,r.payload.offer);break;default:}switch(e(r),r.type){case N:case q:case D:Mp(r,t);case re:case J:case R:case Q:jp(t,r.payload.offer);break;default:}}}n(Rn,"shopifyMiddleware");ht();F();k();F();var $p="/apps/subscriptions/auth/",Oa="og_auth_begin",Vp="og_auth_end",Hp=n(t=>{let[e,r,o,s]=atob(t).split("|");return{id:e,signature:o,timestamp:r,email:s}},"parseIntegrationTempAuth");async function Pa({store:t}){var s;let[e]=Kr(),r=mt(),o=(r==null?void 0:r.dataset.customer)?Hp(r.dataset.customer):(s=window.ogShopifyConfig)==null?void 0:s.customer;if(o){let i=await Bp(o);if(i){let[a,c,l]=i.split("|");t.dispatch(yt(e,a,Number(c),l))}}else ms("og_auth")}n(Pa,"authorizeShopifyCustomer");async function Gp(t){try{let r=await(await fetch(`${$p}?customer=${t.id}&customer_signature=${t.signature}&customer_timestamp=${t.timestamp}`)).text(),o=r.lastIndexOf(Oa);if(o<0)throw"Invalid response from OG auth endpoint";return JSON.parse(r.substring(o+Oa.length,r.lastIndexOf(Vp)))}catch(e){console.error(e)}}n(Gp,"fetchOGSignature");async function Bp(t){let e=gs("og_auth");if(e)return e;let{customerId:r,timestamp:o,signature:s}=await Gp(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(Bp,"getOrCreateAuthCookie");var Ca,wa=Bs(...((Ca=L)==null?void 0:Ca.shopify_selling_plans)?[Tn,Rn]:[Ir],L.shopify&&Pn),T=En(wa),zp=T.isReady,Wp=T.addOptinChangedCallback,Yp=T.addTemplate,Jp=T.clear,Qp=T.config,Kp=T.disableOptinChangedCallbacks,Zp=T.getOptins,Xp=T.getProductsForPurchasePost,eu=T.initialize,tu=T.previewMode,ru=T.register,ou=T.resolveSettings,nu=T.setAuthUrl,su=T.setEnvironment,iu=T.setLocale,au=T.setMerchantId,cu=T.setPublicPath,lu=T.setTemplates,pu=T.setupCart,uu=T.setupProduct,du=T.setupProducts,fu=n(()=>hs(T),"autoInit");var hu=T.initialize,Ra;((Ra=L)==null?void 0:Ra.shopify_selling_plans)&&nr(()=>Pa(T));return mu;})();
|
|
938
|
+
`}};n(Sn,"Price");var ap=n((t,e)=>{var r;return{productPlans:t.productPlans,configDefaultFrequency:(r=t.config)==null?void 0:r.defaultFrequency,frequency:X(e.product)(t)}},"mapStateToProps"),sa=g(ap)(Sn);F();function En(t){oa(),Js(t);try{customElements.define("og-when",Ni),customElements.define("og-text",$i),customElements.define("og-incentive-text",Bi),customElements.define("og-offer",Zi),customElements.define("og-select-frequency",zi),customElements.define("og-optout-button",Di),customElements.define("og-optin-toggle",ji),customElements.define("og-optin-status",ki),customElements.define("og-optin-button",qi),customElements.define("og-optin-select",Ui),customElements.define("og-upsell-button",Li),customElements.define("og-frequency-status",Fi),customElements.define("og-modal",wr),customElements.define("og-select",Cr),customElements.define("og-tooltip",Rr),customElements.define("og-upsell-modal",Mi),customElements.define("og-next-upcoming-order",Yi),customElements.define("og-price",sa),customElements.define("og-prepaid-toggle",Xi),customElements.define("og-prepaid-data",ea)}catch{console.info("OG WebComponents already registered, skipping.")}let e=!1,r={store:t,isReady:()=>e,setEnvironment(o){return t.dispatch(ro(o)),this},setMerchantId(o){return t.dispatch(Es(o)),this},setAuthUrl(o){return t.dispatch(xs(o)),this},getProductsForPurchasePost(o=[]){return ao(t.getState(),o)},getOptins(o=[]){return ao(t.getState(),o)},clear(){t.dispatch(Ps())},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(Rs(o)),this},setLocale(o){return t.dispatch(Cs(o)),this},addTemplate(o,s,i){return t.dispatch(As(o,s,i)),this},setTemplates(o){return t.dispatch(Ns(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}=At({},ro(s)),{sessionId:p}=a.getState();p&&c.forEach(f=>{let u=w(f);ue.fetchOffer(l,o,p,`${u}`,xe)}),i.product_discounts&&typeof i.product_discounts=="object"&&a.dispatch({type:B,payload:i.product_discounts})}},initialize(o,s,i){var c;e?console.warn("og.offers has been initialized already. Skipping."):r.resolveSettings(o,s,window.og_settings,t);let a=t.getState();return o&&o!==a.merchantId&&r.setMerchantId(o),s&&s!==((c=a.environment)==null?void 0:c.name)&&r.setEnvironment(s),i&&r.setAuthUrl(i),e=!0,this}};return window.OG=window.OG||{},Object.assign(window.OG,r),Object.assign(r.initialize,r),io(window.opener,r),r}n(En,"makeApi");j();F();var ae=n(t=>t===null?"":`$${t.toString().replace(/(\d\d)$/,".$1")}`,"money"),kr=n(t=>`${t}%`,"percentage");var qr=n(t=>{var e,r;return Array.isArray((e=t.selling_plan)==null?void 0:e.options)&&((r=t.selling_plan)==null?void 0:r.options.some(o=>(o==null?void 0:o.name)==="Shipment amount"))},"isPrepaidAllocation"),Dr=n(t=>{if(t&&t.length>1){let e=t.find(r=>(r==null?void 0:r.name)==="Shipment amount").value.split(" ");return e.length>0?+e[0]:null}return null},"getPrepaidShipmentsNumberFromOptions"),cp=n(t=>{var e;return(t.selling_plan_id||((e=t.selling_plan)==null?void 0:e.id)).toString()},"getAllocationFrequency"),lp=n(t=>ae(t.compare_at_price),"getAllocationRegularPrice"),pp=n(t=>{var e;if(qr(t)){let r=Dr((e=t.selling_plan)==null?void 0:e.options),o=t.price/r;return ae(o)}return ae(t.price)},"getAllocationSubscriptionPrice"),ia=n((t,e)=>Math.round((t.compare_at_price-e)*100/t.compare_at_price),"getPrepaidPercentage"),up=n(t=>{var r,o,s;if(qr(t)){let i=Dr((r=t.selling_plan)==null?void 0:r.options),a=t.price/i,c=ia(t,a);return kr(c)}let e="";return((o=t.price_adjustments[0])==null?void 0:o.value_type)==="percentage"?e=kr(t.price_adjustments[0].value):((s=t.price_adjustments[0])==null?void 0:s.value)?e=ae(t.price_adjustments[0].value):t.compare_at_price&&(e=ae(t.compare_at_price-t.price)),e},"getAllocationDiscountRate"),dp=n(t=>{var e;return qr(t)?Dr((e=t.selling_plan)==null?void 0:e.options):null},"getAllocationNumberOfShipments"),fp=n((t,e,r)=>{var p,f;let o=Dr((p=t.selling_plan)==null?void 0:p.options),s=t.price/o,i=t.compare_at_price-s,a=ia(t,s),c=(f=r==null?void 0:r.price_adjustments)==null?void 0:f[0],l=c&&c.value_type==="percentage"?c.value:null;return e.regularPrepaidPrice=ae(t.price),e.prepaidSavingsPerShipment=ae(Math.round(i)),e.prepaidSavingsTotal=ae(Math.round(i*o)),l&&a&&(e.prepaidExtraSavingsPercentage=kr(a-l)),e},"addPrepaidPriceAndSavings"),xn="Subscribe and Save",hp=n((t,e=[])=>{t.selling_plan||(t.selling_plan=e.find(o=>o.id===t.selling_plan_id));let r={frequency:cp(t),regularPrice:lp(t),subscriptionPrice:pp(t),discountRate:up(t),prepaidShipments:dp(t)};if(qr(t)){let o=e.find(s=>s.group_name===xn&&s.options.length===1);return fp(t,r,o)}return r},"mapSellingPlanToDiscount"),vn=n((t,e,r=[])=>[...t,hp(e,r)],"sellingPlanAllocationsReducer"),aa=n(t=>t.selling_plan_groups.reduce((e,r)=>[...e,...r.selling_plans.map(o=>({...o,group_name:r.name}))],[]),"getSellingPlans");var ca=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"),la=n((t,e,r)=>{if(!r)return null;if(!We(r))return r;if(sr(t,e)){let o=ee(t,e,r);return o||we(t)}return r},"getDefaultSellingPlan"),mp=n((t,e)=>t.map(r=>{var o,s,i,a,c,l,p;return We(r==null?void 0:r.frequency)?{...r,frequency:sr((o=e==null?void 0:e.config)==null?void 0:o.frequencies,(s=e==null?void 0:e.config)==null?void 0:s.frequenciesEveryPeriod)?ee((i=e==null?void 0:e.config)==null?void 0:i.frequencies,(a=e==null?void 0:e.config)==null?void 0:a.frequenciesEveryPeriod,r.frequency)||ee((c=e==null?void 0:e.config)==null?void 0:c.frequencies,(l=e==null?void 0:e.config)==null?void 0:l.frequenciesEveryPeriod,e.defaultFrequency)||we((p=e==null?void 0:e.config)==null?void 0:p.frequencies):r.frequency}:r}),"mapExistingOptinsFromOfferResponse"),gp=n(({autoship:t={},autoship_by_default:e={},default_frequencies:r={},in_stock:o={}},s,i)=>Object.keys(t).reduce((a,c)=>{if(!s.some(l=>l.id===c)){if(!(t[c]&&e[c]&&o[c]))return a;let{config:{frequencies:l,frequenciesEveryPeriod:p}={},defaultFrequency:f}=i,u=r[c],h;return r[c]&&sr(l,p)?h=ee(l,p,`${u.every}_${u.every_period}`)||la(l,p,f)||we(l):r[c]?h=`${u.every}_${u.every_period}`:h=la(l,p,f)||"_",a.concat({id:c,frequency:h})}return a},[]),"reduceNewOptinsFromOfferResponse"),pa=n(t=>t==null?void 0:t.selling_plan_groups.find(r=>r.name===xn),"getOGSellingPlanGroup"),yp=n((t,e)=>({...ca(t,e.id,e.available),[e.id]:e.available}),"productOrVariantInStockReducer"),ua=n((t,[e])=>({...t,[e]:!0}),"productTrue"),da=n((t,e)=>{let r=w(e.key);return{...t,[e.key]:t[r]||null}},"reduceProductCartLine"),bp=n((t={},e)=>{if(B===e.type)return Object.entries(e.payload).reduce(ua,t);if(pe===e.type){let{payload:r}=e;return r.items.reduce(da,t)}if(Q===e.type){let{payload:{product:r}}=e;return[r,...(r==null?void 0:r.variants)||[]].reduce((o,s)=>{var i,a;return{...ca(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 _p(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(_p,"textToFreq");function fa(t){var e;return(e=t==null?void 0:t.selling_plans)==null?void 0:e.map(({options:r})=>r||[]).flat().map(({value:r})=>_p(r))}n(fa,"sellingPlansToEveryPeriod");function ha(t){var e;return(e=t==null?void 0:t.selling_plans)==null?void 0:e.map(({id:r})=>`${r}`)}n(ha,"sellingPlansToFrequencies");function ma(t){var r;let e=(r=t==null?void 0:t.options.find(({name:o})=>o==="Shipment amount"))==null?void 0:r.value.split(" ")[0];return e?Number(e):void 0}n(ma,"getPrepaidShipments");function Sp(t){return t.reduce((e,r)=>{let o=r.name.split("-")[1],s=r.selling_plans.map(i=>({numberShipments:ma(i),sellingPlan:String(i.id)}));return{...e,[o]:s}},{})}n(Sp,"getPrepaidSellingPlans");var Ep=n((t={frequencies:[],offerType:"radio",frequenciesEveryPeriod:[]},e)=>{var r,o;if(B===e.type){let s=[...new Set(Object.values(e.payload).map(Object.keys).flat())];return{...t,frequencies:s}}if(Q===e.type){let{payload:{offer:s,product:i}}=e,a={},c=pa(i),l=ha(c);if(l==null?void 0:l.length){let f=fa(c),u=((o=(r=c.options)==null?void 0:r[0])==null?void 0:o.values)||l,h=t.defaultFrequency;h&&We(h)&&(h=ee(l,f,h)||we(l)||h),a={frequencies:l,frequenciesEveryPeriod:f,frequenciesText:u,...h?{defaultFrequency:h}:{}}}let p=i==null?void 0:i.selling_plan_groups.filter(f=>/^Prepaid-.*/.test(f.name));return p.length&&(a={...a,prepaidSellingPlans:Sp(p)}),{...t,...a}}if(R===e.type){let{payload:{offer:s}}=e,{defaultFrequency:i,config:{frequencies:a,frequenciesEveryPeriod:c}={}}=s;return We(i)?{...t,defaultFrequency:ee(a,c,i)||we(a)||i}:{...t,defaultFrequency:i}}return t},"config"),xp=n((t={},e)=>{if(B===e.type)return Object.entries(e.payload).reduce(ua,t);if(pe===e.type)return e.payload.items.reduce(da,t);if(Q===e.type){let{payload:{product:r}}=e;return[r,...r==null?void 0:r.variants].reduce(yp,t)||t}return J===e.type&&e.payload.product===null?{...t}:t},"inStock"),vp=n((t={},e)=>t,"offer");function Tp({prepaidShipments:t,offer:e,product:r}){var o;if(t){let s=r.id,i=(o=e.config.prepaidSellingPlans[s])==null?void 0:o.find(a=>a.numberShipments===t);return i?i.sellingPlan:null}return e.config.frequencies[0]}n(Tp,"getFrequencyForPrepaidShipments");function Op(t){let e=ma(t.selling_plan_allocation.selling_plan),r={id:t.key,frequency:`${t.selling_plan_allocation.selling_plan.id}`};return e&&(r.prepaidShipments=e),r}n(Op,"getOptedInItem");var Pp=n((t=[],e)=>{if(pe===e.type){let r=e.payload;return t.filter(o=>!o.id.includes(":")).concat(r.items.reduce((o,s)=>s.selling_plan_allocation?[...o,Op(s)]:o,[]))}if(R===e.type){let{offer:r={},...o}=e.payload,s=mp(t,r),i=gp(o,s,r);return[...s,...i]}if(Q===e.type){let{product:r}=e.payload,o=pa(r),s=ha(o),i=fa(o);return t.map(a=>We(a.frequency)?{...a,frequency:ee(s,i,a.frequency)||we(s)}:a)}if(re===e.type){let{payload:r}=e,o=Nr(t,e),[s,i]=Ye(o,r.product);return i.concat({...s,...r.product,frequency:Tp(r)})}return Nr(t,e)},"optedin"),wp=n((t={},e)=>t,"productOffer"),Cp=n((t={},e)=>{if(Q===e.type){let{payload:{product:r}}=e,o=aa(r);return[r,...r==null?void 0:r.variants].reduce((s,i)=>{var a;return{...s,[i.id]:(a=i.selling_plan_allocations)==null?void 0:a.reduce((c,l)=>vn(c,l,o),[])}},t)||t}return pe===e.type?e.payload.items.reduce((o,s)=>s.selling_plan_allocation?{...o,[s.key]:vn([],s.selling_plan_allocation)}:o,t)||t:B===e.type?Qe(e.payload):t},"productPlans"),Rp=It({auth:sn,authUrl:cn,autoshipByDefault:gn,autoshipEligible:bp,config:Ep,defaultFrequencies:yn,eligibilityGroups:on,environment:At,firstOrderPlaceDate:un,incentives:nn,inStock:xp,locale:fn,merchantId:an,nextUpcomingOrder:rn,offer:vp,offerId:ln,optedin:Pp,optedout:tn,previewStandardOffer:hn,previewUpsellOffer:mn,productOffer:wp,productPlans:Cp,productToSubscribe:dn,sessionId:pn,templates:bn,prepaidShipmentsSelected:_n});function Tn(t,e){return window.og&&window.og.previewMode?Ir(t,e):Rp(t,e)}n(Tn,"shopifyReducer");var ya=ce(lt()),ba=ce(qt());j();U();F();j();function ga(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(ga,"updateTrackingInputs");function On(){return`og__${Math.ceil(new Date().getTime()/1e3)}`}n(On,"getTrackingKey");function Ap(t,e){var f,u,h,P;if(!((f=t.payload.offer)==null?void 0:f.autoshipByDefault))return;let o=(u=t.payload.offer)==null?void 0:u.product.id,s=On(),i=((h=t.payload.offer)==null?void 0:h.location)||"",a=((P=t.payload.offer)==null?void 0:P.variationId)||"",c=Cn(o,e),p=[o,N.toLowerCase(),i,c,a].join(",");ga(o,s,p)}n(Ap,"addDefaultToSubTracking");function Pn(t){return e=>r=>{switch(e(r),r.type){case N:case q:case D:let o=r.payload.offer,s=wn(r);o&&!o.isCart&&ga(o.product.id,s[0],s[1]);break;case R:Ap(r,t);break;default:}}}n(Pn,"shopifyTrackingMiddleware");var xa,va,_a=((va=(xa=window.Shopify)==null?void 0:xa.routes)==null?void 0:va.root)||"/",Np="/cart",Ip=`${_a}cart.js`,kp=`${_a}products/`,qp='[id^="shopify-section-"][id$=__cart-items], [id^="shopify-section-"][id$="__cart-footer"],#cart-live-region-text,#cart-icon-bubble',Dp=n(t=>(0,ba.debounce)(100,!1,function(e){let{id:r}=Object.fromEntries([...new FormData(e).entries()]);r?t.setAttribute("product",r):t.removeAttribute("product")}),"makeSyncProductId");async function Fp(t,e){let r=Up(e);if(r)try{let s=await Ea(r);t.dispatch({type:Q,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}if(o){let s=Dp(e);o.addEventListener("change",a=>s(o)),new MutationObserver(()=>s(o)).observe(o,{subtree:!0,childList:!0})}else console.info("no /cart/add form found for og-offer",e)}n(Fp,"setupPdp");var Sa=n(async()=>await(await fetch(Ip)).json(),"getCart");function Up(t){return[()=>t==null?void 0:t.dataset.shopifyProductHandle,()=>{var e,r;return(((r=(e=document.querySelector('[href$=".oembed"]'))==null?void 0:e.getAttribute("href"))==null?void 0:r.match(/\/([^\/]+)\.oembed$/))||[])[1]},()=>{var e,r;return(document.querySelector('meta[property="og:type"][content="product"]')&&((r=(e=document.querySelector('meta[property="og:url"][content]'))==null?void 0:e.getAttribute("content"))==null?void 0:r.match(/\/([^\/]+)$/))||[])[1]},()=>{var e;return(e=[...document.querySelectorAll("[type$=json]")].map(r=>JSON.parse(r.textContent||"{}")).find(r=>r.handle&&r.price))==null?void 0:e.handle}].reduce((e,r)=>e||r(),"")}n(Up,"guessProductHandle");var Ea=(0,ya.default)(async t=>(await fetch(`${kp}${t}.js`)).json());async function Lp(t,e){let r=await Sa(),{items:o}=r;t.dispatch({type:pe,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(Ea))).forEach(a=>t.dispatch({type:Q,payload:{product:a,offer:e}}))}n(Lp,"setupCart");async function Mp(t,e){var i,a;let r=t.payload.offer,o=t.payload.frequency||null,s=wn(t);if(!!(r==null?void 0:r.isCart))try{r.style.pointerEvents="none",r.style.opacity=".7";let c=Array.from(document.querySelectorAll(qp)),l=t.payload.product.id,p=await Sa(),f=(i=p==null?void 0:p.items)==null?void 0:i.findIndex(y=>y.key===l),u=p.items[f],h=u.quantity,P=w(l),_=await fetch("/cart/change.js",{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:l,quantity:h,attributes:Object.fromEntries([s]),properties:u.properties,selling_plan:o||null,sections:c.map(y=>y.id.replace(/^shopify-section-/,""))})});if(_.status!==200)throw new Error("Cart not updated");let m=await _.json(),x=p.items.length===m.items.length?m.items[f].key:(a=m.items.find(y=>y.quantity===h&&y.product_id===P&&(!o&&!y.selling_plan_allocation||(y==null?void 0:y.selling_plan_allocation.selling_plan.id)===o)))==null?void 0:a.key;x&&r.setAttribute("product",x),e.dispatch({type:pe,payload:m});let C=new CustomEvent(Kn,{bubbles:!0,cancelable:!0});if(r.dispatchEvent(C),C.defaultPrevented)return;let b=m.sections;Object.values(b).length?c.forEach(y=>{let Nt=y.id.replace(/^shopify-section-/,"");if(!(Nt in b))return;let Ra=b[Nt],An=new DOMParser().parseFromString(Ra.toString()||"","text/html").getElementById(y.id);An&&(y.innerHTML=An.innerHTML)}):window.location.pathname.startsWith(Np)&&window.location.reload()}catch(c){console.log("OG Error updating cart",c)}finally{r.style.pointerEvents="auto",r.style.opacity="1"}}n(Mp,"synchronizeCartOptin");function wn(t){var a,c;let e=t.payload.product.id;if(!e)return[];let r=On(),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 J:case q:i.push(""),i.push(s);break;case N:case D:i.push(t.payload.frequency),i.push(s);break;default:return[]}return[r,i.join(",")]}n(wn,"getTrackingEvent");function Cn(t,e){var s;return(s=er({id:t})(e.getState()))==null?void 0:s.frequency}n(Cn,"getSubscribedFrequency");function jp(t,e){e.isCart||[...document.querySelectorAll('form[action$="/cart/add"] [name=id]')].forEach(r=>{let o=r.value,s=Cn(o,t);ys(r.form,"selling_plan",s)})}n(jp,"synchronizeSellingPlan");function Rn(t){return e=>r=>{var o;switch(r.type){case N:case q:case D:break;case J:((o=r.payload.offer)==null?void 0:o.isCart)?Lp(t,r.payload.offer):Fp(t,r.payload.offer);break;default:}switch(e(r),r.type){case N:case q:case D:Mp(r,t);case re:case J:case R:case Q:jp(t,r.payload.offer);break;default:}}}n(Rn,"shopifyMiddleware");ht();F();k();F();var $p="/apps/subscriptions/auth/",Ta="og_auth_begin",Vp="og_auth_end",Hp=n(t=>{let[e,r,o,s]=atob(t).split("|");return{id:e,signature:o,timestamp:r,email:s}},"parseIntegrationTempAuth");async function Oa({store:t}){var s;let[e]=Kr(),r=mt(),o=(r==null?void 0:r.dataset.customer)?Hp(r.dataset.customer):(s=window.ogShopifyConfig)==null?void 0:s.customer;if(o){let i=await Bp(o);if(i){let[a,c,l]=i.split("|");t.dispatch(yt(e,a,Number(c),l))}}else ms("og_auth")}n(Oa,"authorizeShopifyCustomer");async function Gp(t){try{let r=await(await fetch(`${$p}?customer=${t.id}&customer_signature=${t.signature}&customer_timestamp=${t.timestamp}`)).text(),o=r.lastIndexOf(Ta);if(o<0)throw"Invalid response from OG auth endpoint";return JSON.parse(r.substring(o+Ta.length,r.lastIndexOf(Vp)))}catch(e){console.error(e)}}n(Gp,"fetchOGSignature");async function Bp(t){let e=gs("og_auth");if(e)return e;let{customerId:r,timestamp:o,signature:s}=await Gp(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(Bp,"getOrCreateAuthCookie");var wa,Pa=Bs(...((wa=L)==null?void 0:wa.shopify_selling_plans)?[Tn,Rn]:[Ir],L.shopify&&Pn),T=En(Pa),zp=T.isReady,Wp=T.addOptinChangedCallback,Yp=T.addTemplate,Jp=T.clear,Qp=T.config,Kp=T.disableOptinChangedCallbacks,Zp=T.getOptins,Xp=T.getProductsForPurchasePost,eu=T.initialize,tu=T.previewMode,ru=T.register,ou=T.resolveSettings,nu=T.setAuthUrl,su=T.setEnvironment,iu=T.setLocale,au=T.setMerchantId,cu=T.setPublicPath,lu=T.setTemplates,pu=T.setupCart,uu=T.setupProduct,du=T.setupProducts,fu=n(()=>hs(T),"autoInit");var hu=T.initialize,Ca;((Ca=L)==null?void 0:Ca.shopify_selling_plans)&&nr(()=>Oa(T));return mu;})();
|
|
939
939
|
; return lib; });
|
|
940
940
|
//# sourceMappingURL=offers.js.map
|