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