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