@ordergroove/offers 2.26.2 → 2.26.3-alpha-PR-593-20.20
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/build.js +3 -1
- package/dist/bundle-report.html +170 -104
- package/dist/offers.js +64 -75
- package/dist/offers.js.map +3 -3
- package/examples/cart.js +105 -0
- package/examples/index.html +2 -2
- package/examples/products/cheap-watch.js +183 -0
- package/examples/shopify-cart.html +26 -0
- package/examples/shopify-pdp.html +34 -0
- package/karma.conf.js +2 -1
- package/package.json +4 -4
- package/src/__tests__/offers.spec.js +35 -10
- package/src/components/FrequencyStatus.js +14 -11
- package/src/components/Offer.js +11 -7
- package/src/components/OptinButton.js +1 -1
- package/src/components/OptinSelect.js +2 -2
- package/src/components/OptinToggle.js +2 -2
- package/src/components/OptoutButton.js +1 -1
- package/src/components/Price.js +8 -4
- package/src/components/Select.js +3 -13
- package/src/components/SelectFrequency.js +24 -6
- package/src/components/TestWizard.js +1 -1
- package/src/components/__tests__/OG.fspec.js +24 -0
- package/src/components/__tests__/Offer.spec.js +4 -4
- package/src/components/__tests__/OptinButton.spec.js +2 -2
- package/src/components/__tests__/OptinToggle.spec.js +2 -2
- package/src/components/__tests__/OptoutButton.spec.js +1 -1
- package/src/components/__tests__/SelectFrequency.fspec.js +1 -0
- package/src/components/__tests__/SelectFrequency.spec.js +1 -1
- package/src/components/__tests__/TestWizard.spec.js +2 -2
- package/src/components/__tests__/Text.spec.js +3 -0
- package/src/core/__tests__/actions.spec.js +6 -6
- package/src/core/actions.js +12 -10
- package/src/core/constants.js +3 -0
- package/src/core/reducer.js +14 -14
- package/src/core/resolveProperties.js +2 -7
- package/src/core/selectors.js +1 -1
- package/src/core/store.js +6 -5
- package/src/index.js +57 -202
- package/src/make-api.js +190 -0
- package/src/platform.ts +5 -0
- package/src/shopify/__tests__/shopifyReducer.spec.js +477 -0
- package/src/shopify/shopifyMiddleware.ts +202 -0
- package/src/shopify/shopifyReducer.js +214 -0
- package/tsconfig.json +35 -0
- package/examples/5starnutrition-main.js +0 -3
- package/examples/single-offer.html +0 -9
- package/src/init-test.js +0 -3
package/dist/offers.js
CHANGED
|
@@ -8,12 +8,12 @@ else {
|
|
|
8
8
|
window.og['offers'] = factory();
|
|
9
9
|
}
|
|
10
10
|
})(()=>{
|
|
11
|
-
var lib=(()=>{var ei=Object.create;var ke=Object.defineProperty;var ti=Object.getOwnPropertyDescriptor;var ri=Object.getOwnPropertyNames;var oi=Object.getPrototypeOf,ni=Object.prototype.hasOwnProperty;var yo=t=>ke(t,"__esModule",{value:!0}),n=(t,e)=>ke(t,"name",{value:e,configurable:!0});var S=(t,e)=>()=>(t&&(e=t(t=0)),e);var re=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),tr=(t,e)=>{yo(t);for(var r in e)ke(t,r,{get:e[r],enumerable:!0})},si=(t,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of ri(e))!ni.call(t,o)&&o!=="default"&&ke(t,o,{get:()=>e[o],enumerable:!(r=ti(e,o))||r.enumerable});return t},ye=t=>si(yo(ke(t!=null?ei(oi(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var oe,ne,se,ot,Ao,q,qe,nt,st,No,it,_e,ko,at,ct,Io,lt,ut,pt,qo,Uo,dt,Do,ft,xe,Fo,ht,mt,Ue,De,gt,yt,ie,G,bt,_t,xt,ae=S(()=>{oe="OPTIN_PRODUCT",ne="OPTOUT_PRODUCT",se="PRODUCT_CHANGE_FREQUENCY",ot="SET_MERCHANT_ID",Ao="REQUEST_OFFER",q="RECEIVE_OFFER",qe="PRODUCT_HAS_CHANGED",nt="CREATED_SESSION_ID",st="SET_AUTH_URL",No="REQUEST_AUTH",it="AUTHORIZE",_e="UNAUTHORIZED",ko="REQUEST_ORDERS",at="RECEIVE_ORDERS",ct="RECEIVE_ORDER_ITEMS",Io="FETCH_RESPONSE_ERROR",lt="SET_ENVIRONMENT_STAGING",ut="SET_ENVIRONMENT_DEV",pt="SET_ENVIRONMENT_PROD",qo="CONCLUDE_UPSELL",Uo="REQUEST_CREATE_IU_ORDER",dt="CREATE_ONE_TIME",Do="REQUEST_CONVERT_ONE_TIME",ft="CONVERT_ONE_TIME",xe="CHECKOUT",Fo="RECEIVE_FETCH",ht="SET_LOCALE",mt="SET_CONFIG",Ue="SET_PREVIEW_STANDARD_OFFER",De="SET_PREVIEW_UPSELL_OFFER",gt="ADD_TEMPLATE",yt="SET_TEMPLATES",ie="LOCAL_STORAGE_CHANGE",G="LOCAL_STORAGE_CLEAR",bt="SET_FIRST_ORDER_PLACE_DATE",_t="SET_PRODUCT_TO_SUBSCRIBE",xt="RECEIVE_PRODUCT_PLANS"});var vt=re((Xc,zo)=>{var Ei="Expected a function",Lo="__lodash_hash_undefined__",Si="[object Function]",vi="[object GeneratorFunction]",wi=/[\\^$.*+?()[\]{}|]/g,Ti=/^\[object .+?Constructor\]$/,Oi=typeof window=="object"&&window&&window.Object===Object&&window,Ci=typeof self=="object"&&self&&self.Object===Object&&self,jo=Oi||Ci||Function("return this")();function Pi(t,e){return t==null?void 0:t[e]}n(Pi,"getValue");function Ri(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}n(Ri,"isHostObject");var Ai=Array.prototype,Ni=Function.prototype,Mo=Object.prototype,lr=jo["__core-js_shared__"],Vo=function(){var t=/[^.]+$/.exec(lr&&lr.keys&&lr.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),$o=Ni.toString,ur=Mo.hasOwnProperty,ki=Mo.toString,Ii=RegExp("^"+$o.call(ur).replace(wi,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),qi=Ai.splice,Ui=Bo(jo,"Map"),Fe=Bo(Object,"create");function ce(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(ce,"Hash");function Di(){this.__data__=Fe?Fe(null):{}}n(Di,"hashClear");function Fi(t){return this.has(t)&&delete this.__data__[t]}n(Fi,"hashDelete");function Li(t){var e=this.__data__;if(Fe){var r=e[t];return r===Lo?void 0:r}return ur.call(e,t)?e[t]:void 0}n(Li,"hashGet");function ji(t){var e=this.__data__;return Fe?e[t]!==void 0:ur.call(e,t)}n(ji,"hashHas");function Mi(t,e){var r=this.__data__;return r[t]=Fe&&e===void 0?Lo:e,this}n(Mi,"hashSet");ce.prototype.clear=Di;ce.prototype.delete=Fi;ce.prototype.get=Li;ce.prototype.has=ji;ce.prototype.set=Mi;function Se(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(Se,"ListCache");function Vi(){this.__data__=[]}n(Vi,"listCacheClear");function $i(t){var e=this.__data__,r=Et(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():qi.call(e,r,1),!0}n($i,"listCacheDelete");function Bi(t){var e=this.__data__,r=Et(e,t);return r<0?void 0:e[r][1]}n(Bi,"listCacheGet");function Hi(t){return Et(this.__data__,t)>-1}n(Hi,"listCacheHas");function zi(t,e){var r=this.__data__,o=Et(r,t);return o<0?r.push([t,e]):r[o][1]=e,this}n(zi,"listCacheSet");Se.prototype.clear=Vi;Se.prototype.delete=$i;Se.prototype.get=Bi;Se.prototype.has=Hi;Se.prototype.set=zi;function le(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}n(le,"MapCache");function Gi(){this.__data__={hash:new ce,map:new(Ui||Se),string:new ce}}n(Gi,"mapCacheClear");function Wi(t){return St(this,t).delete(t)}n(Wi,"mapCacheDelete");function Yi(t){return St(this,t).get(t)}n(Yi,"mapCacheGet");function Qi(t){return St(this,t).has(t)}n(Qi,"mapCacheHas");function Ji(t,e){return St(this,t).set(t,e),this}n(Ji,"mapCacheSet");le.prototype.clear=Gi;le.prototype.delete=Wi;le.prototype.get=Yi;le.prototype.has=Qi;le.prototype.set=Ji;function Et(t,e){for(var r=t.length;r--;)if(ta(t[r][0],e))return r;return-1}n(Et,"assocIndexOf");function Ki(t){if(!Ho(t)||Xi(t))return!1;var e=ra(t)||Ri(t)?Ii:Ti;return e.test(ea(t))}n(Ki,"baseIsNative");function St(t,e){var r=t.__data__;return Zi(e)?r[typeof e=="string"?"string":"hash"]:r.map}n(St,"getMapData");function Bo(t,e){var r=Pi(t,e);return Ki(r)?r:void 0}n(Bo,"getNative");function Zi(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}n(Zi,"isKeyable");function Xi(t){return!!Vo&&Vo in t}n(Xi,"isMasked");function ea(t){if(t!=null){try{return $o.call(t)}catch{}try{return t+""}catch{}}return""}n(ea,"toSource");function pr(t,e){if(typeof t!="function"||e&&typeof e!="function")throw new TypeError(Ei);var r=n(function(){var o=arguments,s=e?e.apply(this,o):o[0],i=r.cache;if(i.has(s))return i.get(s);var a=t.apply(this,o);return r.cache=i.set(s,a),a},"memoized");return r.cache=new(pr.Cache||le),r}n(pr,"memoize");pr.Cache=le;function ta(t,e){return t===e||t!==t&&e!==e}n(ta,"eq");function ra(t){var e=Ho(t)?ki.call(t):"";return e==Si||e==vi}n(ra,"isFunction");function Ho(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}n(Ho,"isObject");zo.exports=pr});var wt,dr,Le,je,Tt,Go,Wo,oa,na,sa,ia,aa,Me,fr,ca,Yo,Ve,la,W,Y=S(()=>{wt=ye(vt()),dr=n((...t)=>JSON.stringify(t),"memoizeKey"),Le=n(t=>(...e)=>fetch(...t(...e)).then(r=>r.json()),"withFetchJson"),je=n(t=>(e,...r)=>{if(!e)throw Error("host required");let[o,s={}]=t(...r);return[`${e.replace(/\/+$/,"")}${o}`,s]},"withHost"),Tt=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"),Go=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"),Wo=n((t=[])=>(Array.isArray(t)?t:Object.entries(t)).map(([e,r])=>[e,encodeURIComponent(r)].join("=")).join("&"),"toQuery"),oa=n(t=>JSON.stringify([].concat(t).map(e=>typeof e=="object"?e.id:e).filter(e=>e)),"toProductId"),na=(0,wt.default)(Le(je((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=Wo([["session_id",e],["page_type",1],["p",oa(r)],["module_view",JSON.stringify(["regular"])]]);return[`/offer/${t}/${o}?${s}`]})),dr),sa=(0,wt.default)(Le(je(Tt((t=1,e="place")=>[`/orders/?${Wo([["status",t],["ordering",e]])}`]))),dr),ia=(0,wt.default)(Le(je(Tt(t=>{if(!t)throw Error("orderId required");return[`/items/?order=${t}`]}))),dr),aa=Le(je(Tt(Go((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}}]})))),Me=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"),fr=n(t=>t.match(/^\d+_\d$/),"isFrequencyValid"),ca=n((t,e)=>String.prototype.localeCompare.call(t&&t.split("_").reverse().join("_"),e&&e.split("_").reverse().join("_")),"compareFrequencies"),Yo=n(t=>[...new Set(t&&t.split(/\s+/))].filter(fr).sort(ca),"parseFrequenciesList"),Ve=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"),la=Le(je(Tt(Go((t,e,r)=>{if(!t)throw Error("item required");if(!e)throw Error("frequency required");let o=Me(e);if(!o)throw Error("invalid frequency");return["/subscriptions/create_from_item/",{body:{item:t.public_id,offer:r,...o}}]})))),W={fetchOffer:na,fetchOrders:sa,fetchItems:ia,createOneTime:aa,convertOneTimeToSubscription:la}});var yr=re((Rt,Xo)=>{(function(t,e){typeof Rt=="object"&&typeof Xo!="undefined"?e(Rt):typeof define=="function"&&define.amd?define(["exports"],e):(t=t||self,e(t.throttleDebounce={}))})(Rt,function(t){"use strict";function e(o,s,i,a){var c,l=!1,d=0;function g(){c&&clearTimeout(c)}n(g,"clearExistingTimeout");function p(){g(),l=!0}n(p,"cancel"),typeof s!="boolean"&&(a=i,i=s,s=void 0);function m(){for(var E=arguments.length,y=new Array(E),f=0;f<E;f++)y[f]=arguments[f];var T=this,O=Date.now()-d;if(l)return;function b(){d=Date.now(),i.apply(T,y)}n(b,"exec");function P(){c=void 0}n(P,"clear"),a&&!c&&b(),g(),a===void 0&&O>o?b():s!==!0&&(c=setTimeout(a?P:b,a===void 0?o-O:o))}return n(m,"wrapper"),m.cancel=p,m}n(e,"throttle");function r(o,s,i){return i===void 0?e(o,s,!1):e(o,i,s!==!1)}n(r,"debounce"),t.debounce=r,t.throttle=e,Object.defineProperty(t,"__esModule",{value:!0})})});function tn(){return typeof window.og_auth!="undefined"?At(window.og_auth):null}async function ja(t=100){return new Promise(e=>{setTimeout(()=>e(tn()),t)})}async function rn(t,e=Da,r=Fa){let o;if(o=At(tn())||At(e()),o)return o;if(t&&typeof t=="string"){let s=await fetch(t);s.status>=200&&s.status<300&&(o=e()||await(La(s)?s.json():Promise.resolve(r(t)).then(e)))}else o||(o=await ja());if(o=At(o),o)return o;throw new Error("Unauthorized")}var en,Da,At,Fa,La,on=S(()=>{en=/^og_auth=/,Da=n((t=en)=>(document.cookie.split(/;\s*/).find(e=>e.match(t))||"").replace(en,""),"c"),At=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"),Fa=n(t=>new Promise((e,r)=>{let o=document.createElement("iframe");o.style.setProperty("display","none","important"),document.body.appendChild(o),o.onload=e,o.onerror=r,o.src=t}),"p"),La=n(t=>(t.headers.get("content-type")||"").indexOf("application/json")!==-1,"d");n(tn,"a");n(ja,"f");n(rn,"u")});var Q,we,nn,Nt,sn,an,Ma,Va,br,J,cn,kt,ln,$a,_r,xr,It,Er,qt,Te,Sr,Ba,un,pn,Ha,za,Ga,Wa,dn,fn,hn,mn,gn,yn,bn,N=S(()=>{on();ae();Y();Q=n((t,e)=>({type:oe,payload:{product:t,frequency:e}}),"optinProduct"),we=n(t=>({type:ne,payload:{product:t}}),"optoutProduct"),nn=n((t,e)=>({type:qe,payload:{newProduct:t,product:e}}),"productHasChangedComponents"),Nt=n((t,e)=>({type:se,payload:{product:t,frequency:e}}),"productChangeFrequency"),sn=n(t=>({type:qo,payload:{product:t}}),"concludeUpsell"),an=n(t=>({type:ot,payload:t}),"setMerchantId"),Ma=n(t=>({type:nt,payload:`${t}.${Math.floor(Math.random()*999999)}.${Math.round(new Date().getTime()/1e3)}`}),"createSessionId"),Va=n(t=>({type:No,payload:t}),"requestAuth"),br=n((t,e,r,o)=>({type:it,payload:{public_id:t,sig_field:e,ts:r,sig:o}}),"authorize"),J=n(t=>({type:_e,payload:t}),"unauthorized"),cn=n(t=>({type:st,payload:t}),"setAuthUrl"),kt=n(t=>({type:Fo,payload:t}),"fetchDone"),ln=n((t=rn)=>n(function(r,o){if(window.og&&window.og.previewMode)return r(J({message:"Offers are running in preview mode"}));let{merchantId:s,authUrl:i}=o(),a=Va(i);return r(a),t(i).then(({sig_field:c,ts:l,sig:d})=>r(br(s,c,l,d)),c=>r(J(c))).finally(()=>r(kt(a)))},"fetchAuthThunk"),"fetchAuth"),$a=n((t,e)=>({type:ko,payload:{status:t,ordering:e}}),"requestOrders"),_r=n(t=>({type:at,payload:t}),"receiveOrders"),xr=n(t=>({type:ct,payload:t}),"receiveItems"),It=n((t=1,e="place")=>n(function(o,s){let{environment:{legoUrl:i},auth:a}=s();if(!a)return o(J("No auth set."));let c=$a(t,e);return o(c),W.fetchOrders(i,a,t,e).then(l=>{if(l.results){o(_r(l));let d=(l.results[0]||{}).public_id;if(d)return W.fetchItems(i,a,d).then(g=>o(xr(g)))}return o(J(l.detail)),null},l=>o(J(l))).finally(()=>o(kt(c)))},"fetchOrdersThunk"),"fetchOrders"),Er=n(t=>{switch(t){case"dev":return{type:ut,payload:t};case"staging":return{type:lt,payload:t};case"prod":return{type:pt,payload:t};default:throw new Error(`${t} is not a supported environment`)}},"setEnvironment"),qt=n(()=>(t,e)=>{let{merchantId:r,sessionId:o}=e();return(!o||r&&!o.startsWith(r))&&t(Ma(r)),o},"requestSessionId"),Te=n(t=>({type:q,payload:t}),"receiveOffer"),Sr=n(t=>({type:Io,payload:t}),"fetchResponseError"),Ba=n((t,e="pdp")=>({type:Ao,payload:{product:t,module:e}}),"requestOffer"),un=n((t,e="pdp")=>n(function(o,s){let{merchantId:i,sessionId:a,environment:{apiUrl:c}}=s(),l=Ba(t,e);return o(l),W.fetchOffer(c,i,a,t,e).then(d=>o(Te(d)),d=>o(Sr(d))).finally(()=>o(kt(l)))},"fetchOfferThunk"),"fetchOffer"),pn=n(()=>({type:xe}),"checkout"),Ha=n((t,e,r,o)=>({type:Uo,payload:{product:t,order:e,quantity:r,offerId:o}}),"requestCreateOneTime"),za=n(t=>({type:dt,payload:t}),"receiveCreateOneTime"),Ga=n((t,e)=>({type:Do,payload:{item:t,frequency:e}}),"requestConvertOneTimeToSubscription"),Wa=n((t,e)=>({type:ft,payload:{response:t,product:e}}),"receiveConvertOneTime"),dn=n((t,e,r,o=!1,s=null)=>n(function(a,c){let{auth:l,environment:{legoUrl:d},previewUpsellOffer:g,offerId:p}=c();if(!l)return a(J("No auth set."));let m=Ha(t,e,r,p);return a(m),(g?Promise.resolve({legoUrl:d,product:t,order:e,quantity:r,offer:p}):W.createOneTime(d,l,t.id,e,r,p)).then(E=>(a(za(E)),o?(a(Ga(E,s)),(g?Promise.resolve({item:E,frequency:s}):W.convertOneTimeToSubscription(d,l,E,s,p)).then(y=>a(Wa(y,t)),y=>a(Sr(y)))):E),E=>a(Sr(E))).finally(()=>a(kt(m)))},"createIuThunk"),"createIu"),fn=n(t=>({type:ht,payload:t}),"setLocale"),hn=n(t=>({type:mt,payload:t}),"setConfig"),mn=n((t,e,r)=>({type:gt,payload:{selector:t,markup:e,config:r}}),"addTemplate"),gn=n(t=>({type:yt,payload:t}),"setTemplates"),yn=n((t,e)=>({type:bt,payload:{product:t,firstOrderPlaceDate:e}}),"setFirstOrderPlaceDate"),bn=n((t,e)=>({type:_t,payload:{product:t,productToSubscribe:e}}),"setProductToSubscribe")});var Tr,pe,de=S(()=>{Tr=typeof window!="undefined"&&window.customElements!=null&&window.customElements.polyfillWrapFlushCallback!==void 0,pe=n((t,e,r=null)=>{for(;e!==r;){let o=e.nextSibling;t.removeChild(e),e=o}},"removeNodes")});var U,Or,Rn,Oe,fe,An,Be,M,Ut,K=S(()=>{U=`{{lit-${String(Math.random()).slice(2)}}}`,Or=`<!--${U}-->`,Rn=new RegExp(`${U}|${Or}`),Oe="$lit$",fe=class{constructor(e,r){this.parts=[],this.element=r;let o=[],s=[],i=document.createTreeWalker(r.content,133,null,!1),a=0,c=-1,l=0,{strings:d,values:{length:g}}=e;for(;l<g;){let p=i.nextNode();if(p===null){i.currentNode=s.pop();continue}if(c++,p.nodeType===1){if(p.hasAttributes()){let m=p.attributes,{length:E}=m,y=0;for(let f=0;f<E;f++)An(m[f].name,Oe)&&y++;for(;y-- >0;){let f=d[l],T=Ut.exec(f)[2],O=T.toLowerCase()+Oe,b=p.getAttribute(O);p.removeAttribute(O);let P=b.split(Rn);this.parts.push({type:"attribute",index:c,name:T,strings:P}),l+=P.length-1}}p.tagName==="TEMPLATE"&&(s.push(p),i.currentNode=p.content)}else if(p.nodeType===3){let m=p.data;if(m.indexOf(U)>=0){let E=p.parentNode,y=m.split(Rn),f=y.length-1;for(let T=0;T<f;T++){let O,b=y[T];if(b==="")O=M();else{let P=Ut.exec(b);P!==null&&An(P[2],Oe)&&(b=b.slice(0,P.index)+P[1]+P[2].slice(0,-Oe.length)+P[3]),O=document.createTextNode(b)}E.insertBefore(O,p),this.parts.push({type:"node",index:++c})}y[f]===""?(E.insertBefore(M(),p),o.push(p)):p.data=y[f],l+=f}}else if(p.nodeType===8)if(p.data===U){let m=p.parentNode;(p.previousSibling===null||c===a)&&(c++,m.insertBefore(M(),p)),a=c,this.parts.push({type:"node",index:c}),p.nextSibling===null?p.data="":(o.push(p),c--),l++}else{let m=-1;for(;(m=p.data.indexOf(U,m+1))!==-1;)this.parts.push({type:"node",index:-1}),l++}}for(let p of o)p.parentNode.removeChild(p)}};n(fe,"Template");An=n((t,e)=>{let r=t.length-e.length;return r>=0&&t.slice(r)===e},"endsWith"),Be=n(t=>t.index!==-1,"isTemplatePartActive"),M=n(()=>document.createComment(""),"createMarker"),Ut=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/});function Pr(t,e){let{element:{content:r},parts:o}=t,s=document.createTreeWalker(r,Cr,null,!1),i=He(o),a=o[i],c=-1,l=0,d=[],g=null;for(;s.nextNode();){c++;let p=s.currentNode;for(p.previousSibling===g&&(g=null),e.has(p)&&(d.push(p),g===null&&(g=p)),g!==null&&l++;a!==void 0&&a.index===c;)a.index=g!==null?-1:a.index-l,i=He(o,i),a=o[i]}d.forEach(p=>p.parentNode.removeChild(p))}function Nn(t,e,r=null){let{element:{content:o},parts:s}=t;if(r==null){o.appendChild(e);return}let i=document.createTreeWalker(o,Cr,null,!1),a=He(s),c=0,l=-1;for(;i.nextNode();)for(l++,i.currentNode===r&&(c=Ka(e),r.parentNode.insertBefore(e,r));a!==-1&&s[a].index===l;){if(c>0){for(;a!==-1;)s[a].index+=c,a=He(s,a);return}a=He(s,a)}}var Cr,Ka,He,kn=S(()=>{K();Cr=133;n(Pr,"removeNodesFromTemplate");Ka=n(t=>{let e=t.nodeType===11?0:1,r=document.createTreeWalker(t,Cr,null,!1);for(;r.nextNode();)e++;return e},"countNodes"),He=n((t,e=-1)=>{for(let r=e+1;r<t.length;r++){let o=t[r];if(Be(o))return r}return-1},"nextActiveIndexInTemplateParts");n(Nn,"insertNodeIntoTemplate")});var Za,he,Rr=S(()=>{Za=new WeakMap,he=n(t=>typeof t=="function"&&Za.has(t),"isDirective")});var k,Dt,Ar=S(()=>{k={},Dt={}});var Z,Ft=S(()=>{de();K();Z=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=Tr?this.template.element.content.cloneNode(!0):document.importNode(this.template.element.content,!0),r=[],o=this.template.parts,s=document.createTreeWalker(e,133,null,!1),i=0,a=0,c,l=s.nextNode();for(;i<o.length;){if(c=o[i],!Be(c)){this.__parts.push(void 0),i++;continue}for(;a<c.index;)a++,l.nodeName==="TEMPLATE"&&(r.push(l),s.currentNode=l.content),(l=s.nextNode())===null&&(s.currentNode=r.pop(),l=s.nextNode());if(c.type==="node"){let d=this.processor.handleTextExpression(this.options);d.insertAfterNode(l.previousSibling),this.__parts.push(d)}else this.__parts.push(...this.processor.handleAttributeExpressions(l,c.name,c.strings,this.options));i++}return Tr&&(document.adoptNode(e),customElements.upgrade(e)),e}};n(Z,"TemplateInstance")});var In,ec,B,Lt=S(()=>{de();K();In=window.trustedTypes&&trustedTypes.createPolicy("lit-html",{createHTML:t=>t}),ec=` ${U} `,B=class{constructor(e,r,o,s){this.strings=e,this.values=r,this.type=o,this.processor=s}getHTML(){let e=this.strings.length-1,r="",o=!1;for(let s=0;s<e;s++){let i=this.strings[s],a=i.lastIndexOf("<!--");o=(a>-1||o)&&i.indexOf("-->",a+1)===-1;let c=Ut.exec(i);c===null?r+=i+(o?ec:Or):r+=i.substr(0,c.index)+c[1]+c[2]+Oe+c[3]+U}return r+=this.strings[e],r}getTemplateElement(){let e=document.createElement("template"),r=this.getHTML();return In!==void 0&&(r=In.createHTML(r)),e.innerHTML=r,e}};n(B,"TemplateResult")});var jt,Mt,Ce,ze,H,Ge,We,Vt,qn,Ye,tc,$t=S(()=>{Rr();de();Ar();Ft();Lt();K();jt=n(t=>t===null||!(typeof t=="object"||typeof t=="function"),"isPrimitive"),Mt=n(t=>Array.isArray(t)||!!(t&&t[Symbol.iterator]),"isIterable"),Ce=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 ze(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"||!Mt(i))return i}let s="";for(let i=0;i<r;i++){s+=e[i];let a=o[i];if(a!==void 0){let c=a.value;if(jt(c)||!Mt(c))s+=typeof c=="string"?c:String(c);else for(let l of c)s+=typeof l=="string"?l:String(l)}}return s+=e[r],s}commit(){this.dirty&&(this.dirty=!1,this.element.setAttribute(this.name,this._getValue()))}};n(Ce,"AttributeCommitter");ze=class{constructor(e){this.value=void 0,this.committer=e}setValue(e){e!==k&&(!jt(e)||e!==this.value)&&(this.value=e,he(e)||(this.committer.dirty=!0))}commit(){for(;he(this.value);){let e=this.value;this.value=k,e(this)}this.value!==k&&this.committer.commit()}};n(ze,"AttributePart");H=class{constructor(e){this.value=void 0,this.__pendingValue=void 0,this.options=e}appendInto(e){this.startNode=e.appendChild(M()),this.endNode=e.appendChild(M())}insertAfterNode(e){this.startNode=e,this.endNode=e.nextSibling}appendIntoPart(e){e.__insert(this.startNode=M()),e.__insert(this.endNode=M())}insertAfterPart(e){e.__insert(this.startNode=M()),this.endNode=e.endNode,e.endNode=this.startNode}setValue(e){this.__pendingValue=e}commit(){if(this.startNode.parentNode===null)return;for(;he(this.__pendingValue);){let r=this.__pendingValue;this.__pendingValue=k,r(this)}let e=this.__pendingValue;e!==k&&(jt(e)?e!==this.value&&this.__commitText(e):e instanceof B?this.__commitTemplateResult(e):e instanceof Node?this.__commitNode(e):Mt(e)?this.__commitIterable(e):e===Dt?(this.value=Dt,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 Z&&this.value.template===r)this.value.update(e.values);else{let o=new Z(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 H(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){pe(this.startNode.parentNode,e.nextSibling,this.endNode)}};n(H,"NodePart");Ge=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(;he(this.__pendingValue);){let r=this.__pendingValue;this.__pendingValue=k,r(this)}if(this.__pendingValue===k)return;let e=!!this.__pendingValue;this.value!==e&&(e?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=e),this.__pendingValue=k}};n(Ge,"BooleanAttributePart");We=class extends Ce{constructor(e,r,o){super(e,r,o);this.single=o.length===2&&o[0]===""&&o[1]===""}_createPart(){return new Vt(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}};n(We,"PropertyCommitter");Vt=class extends ze{};n(Vt,"PropertyPart");qn=!1;(()=>{try{let t={get capture(){return qn=!0,!1}};window.addEventListener("test",t,t),window.removeEventListener("test",t,t)}catch{}})();Ye=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(;he(this.__pendingValue);){let i=this.__pendingValue;this.__pendingValue=k,i(this)}if(this.__pendingValue===k)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=tc(e),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=e,this.__pendingValue=k}handleEvent(e){typeof this.value=="function"?this.value.call(this.eventContext||this.element,e):this.value.handleEvent(e)}};n(Ye,"EventPart");tc=n(t=>t&&(qn?{capture:t.capture,passive:t.passive,once:t.once}:t.capture),"getOptions")});function Nr(t){let e=me.get(t.type);e===void 0&&(e={stringsArray:new WeakMap,keyString:new Map},me.set(t.type,e));let r=e.stringsArray.get(t.strings);if(r!==void 0)return r;let o=t.strings.join(U);return r=e.keyString.get(o),r===void 0&&(r=new fe(t,t.getTemplateElement()),e.keyString.set(o,r)),e.stringsArray.set(t.strings,r),r}var me,Bt=S(()=>{K();n(Nr,"templateFactory");me=new Map});var X,kr,Ir=S(()=>{de();$t();Bt();X=new WeakMap,kr=n((t,e,r)=>{let o=X.get(e);o===void 0&&(pe(e,e.firstChild),X.set(e,o=new H(Object.assign({templateFactory:Nr},r))),o.appendInto(e)),o.setValue(t),o.commit()},"render")});var Ht,qr,Ur=S(()=>{$t();Ht=class{handleAttributeExpressions(e,r,o,s){let i=r[0];return i==="."?new We(e,r.slice(1),o).parts:i==="@"?[new Ye(e,r.slice(1),s.eventContext)]:i==="?"?[new Ge(e,r.slice(1),o)]:new Ce(e,r,o).parts}handleTextExpression(e){return new H(e)}};n(Ht,"DefaultTemplateProcessor");qr=new Ht});var u,Dr=S(()=>{Ur();Lt();Ur();Rr();de();Ar();$t();Ir();Bt();Ft();Lt();K();typeof window!="undefined"&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.3.0");u=n((t,...e)=>new B(t,e,"html",qr),"html")});var Dn,zt,oc,nc,sc,Fn,ic,Ln,jn=S(()=>{de();kn();Ir();Bt();Ft();K();Dr();Dn=n((t,e)=>`${t}--${e}`,"getTemplateCacheKey"),zt=!0;typeof window.ShadyCSS=="undefined"?zt=!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."),zt=!1);oc=n(t=>e=>{let r=Dn(e.type,t),o=me.get(r);o===void 0&&(o={stringsArray:new WeakMap,keyString:new Map},me.set(r,o));let s=o.stringsArray.get(e.strings);if(s!==void 0)return s;let i=e.strings.join(U);if(s=o.keyString.get(i),s===void 0){let a=e.getTemplateElement();zt&&window.ShadyCSS.prepareTemplateDom(a,t),s=new fe(e,a),o.keyString.set(i,s)}return o.stringsArray.set(e.strings,s),s},"shadyTemplateFactory"),nc=["html","svg"],sc=n(t=>{nc.forEach(e=>{let r=me.get(Dn(e,t));r!==void 0&&r.keyString.forEach(o=>{let{element:{content:s}}=o,i=new Set;Array.from(s.querySelectorAll("style")).forEach(a=>{i.add(a)}),Pr(o,i)})})},"removeStylesFromLitTemplates"),Fn=new Set,ic=n((t,e,r)=>{Fn.add(t);let o=r?r.element:document.createElement("template"),s=e.querySelectorAll("style"),{length:i}=s;if(i===0){window.ShadyCSS.prepareTemplateStyles(o,t);return}let a=document.createElement("style");for(let d=0;d<i;d++){let g=s[d];g.parentNode.removeChild(g),a.textContent+=g.textContent}sc(t);let c=o.content;r?Nn(r,a,c.firstChild):c.insertBefore(a,c.firstChild),window.ShadyCSS.prepareTemplateStyles(o,t);let l=c.querySelector("style");if(window.ShadyCSS.nativeShadow&&l!==null)e.insertBefore(l.cloneNode(!0),e.firstChild);else if(r){c.insertBefore(a,c.firstChild);let d=new Set;d.add(a),Pr(r,d)}},"prepareTemplateStyles"),Ln=n((t,e,r)=>{if(!r||typeof r!="object"||!r.scopeName)throw new Error("The `scopeName` option is required.");let o=r.scopeName,s=X.has(e),i=zt&&e.nodeType===11&&!!e.host,a=i&&!Fn.has(o),c=a?document.createDocumentFragment():e;if(kr(t,c,Object.assign({templateFactory:oc(o)},r)),a){let l=X.get(c);X.delete(c);let d=l.value instanceof Z?l.value.template:void 0;ic(o,c,d),pe(e,e.firstChild),e.appendChild(c),X.set(e,l)}!s&&i&&window.ShadyCSS.styleElement(e.host)},"render")});var Mn,Fr,Vn,Lr,jr,Mr,Vr,$r,Br,Qe,Hr=S(()=>{window.JSCompiler_renameProperty=(t,e)=>t;Fr={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}},Vn=n((t,e)=>e!==t&&(e===e||t===t),"notEqual"),Lr={attribute:!0,type:String,converter:Fr,reflect:!1,hasChanged:Vn},jr=1,Mr=1<<2,Vr=1<<3,$r=1<<4,Br="finalized",Qe=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=Lr){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)||Lr}static finalize(){let e=Object.getPrototypeOf(this);if(e.hasOwnProperty(Br)||e.finalize(),this[Br]=!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=Vn){return o(e,r)}static _propertyValueFromAttribute(e,r){let o=r.type,s=r.converter||Fr,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||Fr.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=Lr){let s=this.constructor,i=s._attributeNameForProperty(e,o);if(i!==void 0){let a=s._propertyValueToAttribute(r,o);if(a===void 0)return;this._updateState=this._updateState|Vr,a==null?this.removeAttribute(i):this.setAttribute(i,a),this._updateState=this._updateState&~Vr}}_attributeToProperty(e,r){if(this._updateState&Vr)return;let o=this.constructor,s=o._attributeToPropertyMap.get(e);if(s!==void 0){let i=o.getPropertyOptions(s);this._updateState=this._updateState|$r,this[s]=o._propertyValueFromAttribute(r,i),this._updateState=this._updateState&~$r}}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&$r)&&(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|Mr;try{await this._updatePromise}catch{}let e=this.performUpdate();return e!=null&&await e,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return this._updateState&Mr}get hasUpdated(){return this._updateState&jr}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&jr||(this._updateState=this._updateState|jr,this.firstUpdated(r)),this.updated(r))}_markUpdated(){this._changedProperties=new Map,this._updateState=this._updateState&~Mr}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(Qe,"UpdatingElement");Mn=Br;Qe[Mn]=!0});var $n,Cu,Bn=S(()=>{$n=Element.prototype,Cu=$n.msMatchesSelector||$n.webkitMatchesSelector});var Gt,zr,Je,Hn,ac,w,Gr=S(()=>{Gt=window.ShadowRoot&&(window.ShadyCSS===void 0||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,zr=Symbol(),Je=class{constructor(e,r){if(r!==zr)throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e}get styleSheet(){return this._styleSheet===void 0&&(Gt?(this._styleSheet=new CSSStyleSheet,this._styleSheet.replaceSync(this.cssText)):this._styleSheet=null),this._styleSheet}toString(){return this.cssText}};n(Je,"CSSResult");Hn=n(t=>new Je(String(t),zr),"unsafeCSS"),ac=n(t=>{if(t instanceof Je)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 bi=Object.create;var qe=Object.defineProperty;var _i=Object.getOwnPropertyDescriptor;var Ei=Object.getOwnPropertyNames;var xi=Object.getPrototypeOf,Si=Object.prototype.hasOwnProperty;var Bo=t=>qe(t,"__esModule",{value:!0}),n=(t,e)=>qe(t,"name",{value:e,configurable:!0});var E=(t,e)=>()=>(t&&(e=t(t=0)),e);var ae=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),ur=(t,e)=>{Bo(t);for(var r in e)qe(t,r,{get:e[r],enumerable:!0})},Ti=(t,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Ei(e))!Si.call(t,o)&&o!=="default"&&qe(t,o,{get:()=>e[o],enumerable:!(r=_i(e,o))||r.enumerable});return t},ce=t=>Ti(Bo(qe(t!=null?bi(xi(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var gr=ae((ct,Zo)=>{(function(t,e){typeof ct=="object"&&typeof Zo!="undefined"?e(ct):typeof define=="function"&&define.amd?define(["exports"],e):(t=t||self,e(t.throttleDebounce={}))})(ct,function(t){"use strict";function e(o,s,i,a){var c,l=!1,u=0;function f(){c&&clearTimeout(c)}n(f,"clearExistingTimeout");function d(){f(),l=!0}n(d,"cancel"),typeof s!="boolean"&&(a=i,i=s,s=void 0);function m(){for(var y=arguments.length,b=new Array(y),h=0;h<y;h++)b[h]=arguments[h];var w=this,O=Date.now()-u;if(l)return;function _(){u=Date.now(),i.apply(w,b)}n(_,"exec");function C(){c=void 0}n(C,"clear"),a&&!c&&_(),f(),a===void 0&&O>o?_():s!==!0&&(c=setTimeout(a?C:_,a===void 0?o-O:o))}return n(m,"wrapper"),m.cancel=d,m}n(e,"throttle");function r(o,s,i){return i===void 0?e(o,s,!1):e(o,i,s!==!1)}n(r,"debounce"),t.debounce=r,t.throttle=e,Object.defineProperty(t,"__esModule",{value:!0})})});function en(){return typeof window.og_auth!="undefined"?lt(window.og_auth):null}async function Ii(t=100){return new Promise(e=>{setTimeout(()=>e(en()),t)})}async function tn(t,e=Ai,r=Ni){let o;if(o=lt(en())||lt(e()),o)return o;if(t&&typeof t=="string"){let s=await fetch(t);s.status>=200&&s.status<300&&(o=e()||await(ki(s)?s.json():Promise.resolve(r(t)).then(e)))}else o||(o=await Ii());if(o=lt(o),o)return o;throw new Error("Unauthorized")}var Xo,Ai,lt,Ni,ki,rn=E(()=>{Xo=/^og_auth=/,Ai=n((t=Xo)=>(document.cookie.split(/;\s*/).find(e=>e.match(t))||"").replace(Xo,""),"c"),lt=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"),Ni=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"),ki=n(t=>(t.headers.get("content-type")||"").indexOf("application/json")!==-1,"d");n(en,"a");n(Ii,"f");n(tn,"u")});var D,F,L,ut,Fe,I,Le,pt,dt,on,ft,xe,nn,ht,mt,sn,gt,yt,bt,an,cn,_t,ln,Et,Se,un,xt,St,je,Me,Tt,vt,le,K,wt,Ot,H,B,ue,Ve,z=E(()=>{D="OPTIN_PRODUCT",F="OPTOUT_PRODUCT",L="PRODUCT_CHANGE_FREQUENCY",ut="SET_MERCHANT_ID",Fe="REQUEST_OFFER",I="RECEIVE_OFFER",Le="PRODUCT_HAS_CHANGED",pt="CREATED_SESSION_ID",dt="SET_AUTH_URL",on="REQUEST_AUTH",ft="AUTHORIZE",xe="UNAUTHORIZED",nn="REQUEST_ORDERS",ht="RECEIVE_ORDERS",mt="RECEIVE_ORDER_ITEMS",sn="FETCH_RESPONSE_ERROR",gt="SET_ENVIRONMENT_STAGING",yt="SET_ENVIRONMENT_DEV",bt="SET_ENVIRONMENT_PROD",an="CONCLUDE_UPSELL",cn="REQUEST_CREATE_IU_ORDER",_t="CREATE_ONE_TIME",ln="REQUEST_CONVERT_ONE_TIME",Et="CONVERT_ONE_TIME",Se="CHECKOUT",un="RECEIVE_FETCH",xt="SET_LOCALE",St="SET_CONFIG",je="SET_PREVIEW_STANDARD_OFFER",Me="SET_PREVIEW_UPSELL_OFFER",Tt="ADD_TEMPLATE",vt="SET_TEMPLATES",le="LOCAL_STORAGE_CHANGE",K="LOCAL_STORAGE_CLEAR",wt="SET_FIRST_ORDER_PLACE_DATE",Ot="SET_PRODUCT_TO_SUBSCRIBE",H="RECEIVE_PRODUCT_PLANS",B="SETUP_PRODUCT",ue="SETUP_CART",Ve="pdp"});var He=ae((Ll,bn)=>{var Ui="Expected a function",pn="__lodash_hash_undefined__",qi="[object Function]",Di="[object GeneratorFunction]",Fi=/[\\^$.*+?()[\]{}|]/g,Li=/^\[object .+?Constructor\]$/,ji=typeof window=="object"&&window&&window.Object===Object&&window,Mi=typeof self=="object"&&self&&self.Object===Object&&self,dn=ji||Mi||Function("return this")();function Vi(t,e){return t==null?void 0:t[e]}n(Vi,"getValue");function $i(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}n($i,"isHostObject");var Hi=Array.prototype,Bi=Function.prototype,fn=Object.prototype,yr=dn["__core-js_shared__"],hn=function(){var t=/[^.]+$/.exec(yr&&yr.keys&&yr.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),mn=Bi.toString,br=fn.hasOwnProperty,zi=fn.toString,Gi=RegExp("^"+mn.call(br).replace(Fi,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Wi=Hi.splice,Yi=gn(dn,"Map"),$e=gn(Object,"create");function pe(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}n(pe,"Hash");function Qi(){this.__data__=$e?$e(null):{}}n(Qi,"hashClear");function Ji(t){return this.has(t)&&delete this.__data__[t]}n(Ji,"hashDelete");function Ki(t){var e=this.__data__;if($e){var r=e[t];return r===pn?void 0:r}return br.call(e,t)?e[t]:void 0}n(Ki,"hashGet");function Zi(t){var e=this.__data__;return $e?e[t]!==void 0:br.call(e,t)}n(Zi,"hashHas");function Xi(t,e){var r=this.__data__;return r[t]=$e&&e===void 0?pn:e,this}n(Xi,"hashSet");pe.prototype.clear=Qi;pe.prototype.delete=Ji;pe.prototype.get=Ki;pe.prototype.has=Zi;pe.prototype.set=Xi;function Te(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}n(Te,"ListCache");function ea(){this.__data__=[]}n(ea,"listCacheClear");function ta(t){var e=this.__data__,r=Ct(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():Wi.call(e,r,1),!0}n(ta,"listCacheDelete");function ra(t){var e=this.__data__,r=Ct(e,t);return r<0?void 0:e[r][1]}n(ra,"listCacheGet");function oa(t){return Ct(this.__data__,t)>-1}n(oa,"listCacheHas");function na(t,e){var r=this.__data__,o=Ct(r,t);return o<0?r.push([t,e]):r[o][1]=e,this}n(na,"listCacheSet");Te.prototype.clear=ea;Te.prototype.delete=ta;Te.prototype.get=ra;Te.prototype.has=oa;Te.prototype.set=na;function de(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(de,"MapCache");function sa(){this.__data__={hash:new pe,map:new(Yi||Te),string:new pe}}n(sa,"mapCacheClear");function ia(t){return Pt(this,t).delete(t)}n(ia,"mapCacheDelete");function aa(t){return Pt(this,t).get(t)}n(aa,"mapCacheGet");function ca(t){return Pt(this,t).has(t)}n(ca,"mapCacheHas");function la(t,e){return Pt(this,t).set(t,e),this}n(la,"mapCacheSet");de.prototype.clear=sa;de.prototype.delete=ia;de.prototype.get=aa;de.prototype.has=ca;de.prototype.set=la;function Ct(t,e){for(var r=t.length;r--;)if(ha(t[r][0],e))return r;return-1}n(Ct,"assocIndexOf");function ua(t){if(!yn(t)||da(t))return!1;var e=ma(t)||$i(t)?Gi:Li;return e.test(fa(t))}n(ua,"baseIsNative");function Pt(t,e){var r=t.__data__;return pa(e)?r[typeof e=="string"?"string":"hash"]:r.map}n(Pt,"getMapData");function gn(t,e){var r=Vi(t,e);return ua(r)?r:void 0}n(gn,"getNative");function pa(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}n(pa,"isKeyable");function da(t){return!!hn&&hn in t}n(da,"isMasked");function fa(t){if(t!=null){try{return mn.call(t)}catch{}try{return t+""}catch{}}return""}n(fa,"toSource");function _r(t,e){if(typeof t!="function"||e&&typeof e!="function")throw new TypeError(Ui);var r=n(function(){var o=arguments,s=e?e.apply(this,o):o[0],i=r.cache;if(i.has(s))return i.get(s);var a=t.apply(this,o);return r.cache=i.set(s,a),a},"memoized");return r.cache=new(_r.Cache||de),r}n(_r,"memoize");_r.Cache=de;function ha(t,e){return t===e||t!==t&&e!==e}n(ha,"eq");function ma(t){var e=yn(t)?zi.call(t):"";return e==qi||e==Di}n(ma,"isFunction");function yn(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}n(yn,"isObject");bn.exports=_r});var Rt,Er,Be,ze,At,_n,En,ga,ya,ba,_a,Ea,Ge,xr,xa,xn,We,Sa,Z,X=E(()=>{Rt=ce(He()),Er=n((...t)=>JSON.stringify(t),"memoizeKey"),Be=n(t=>(...e)=>fetch(...t(...e)).then(r=>r.json()),"withFetchJson"),ze=n(t=>(e,...r)=>{if(!e)throw Error("host required");let[o,s={}]=t(...r);return[`${e.replace(/\/+$/,"")}${o}`,s]},"withHost"),At=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"),_n=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"),En=n((t=[])=>(Array.isArray(t)?t:Object.entries(t)).map(([e,r])=>[e,encodeURIComponent(r)].join("=")).join("&"),"toQuery"),ga=n(t=>JSON.stringify([].concat(t).map(e=>typeof e=="object"?e.id:e).filter(e=>e)),"toProductId"),ya=(0,Rt.default)(Be(ze((t,e,r,o="pdp")=>{if(!t)throw Error("merchantId required");if(!e)throw Error("sessionId required");if(!r)throw Error("product required");let s=En([["session_id",e],["page_type",1],["p",ga(r)],["module_view",JSON.stringify(["regular"])]]);return[`/offer/${t}/${o}?${s}`]})),Er),ba=(0,Rt.default)(Be(ze(At((t=1,e="place")=>[`/orders/?${En([["status",t],["ordering",e]])}`]))),Er),_a=(0,Rt.default)(Be(ze(At(t=>{if(!t)throw Error("orderId required");return[`/items/?order=${t}`]}))),Er),Ea=Be(ze(At(_n((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}}]})))),Ge=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"),xr=n(t=>t.match(/^\d+_\d$/),"isFrequencyValid"),xa=n((t,e)=>String.prototype.localeCompare.call(t&&t.split("_").reverse().join("_"),e&&e.split("_").reverse().join("_")),"compareFrequencies"),xn=n(t=>[...new Set(t&&t.split(/\s+/))].filter(xr).sort(xa),"parseFrequenciesList"),We=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"),Sa=Be(ze(At(_n((t,e,r)=>{if(!t)throw Error("item required");if(!e)throw Error("frequency required");let o=Ge(e);if(!o)throw Error("invalid frequency");return["/subscriptions/create_from_item/",{body:{item:t.public_id,offer:r,...o}}]})))),Z={fetchOffer:ya,fetchOrders:ba,fetchItems:_a,createOneTime:Ea,convertOneTimeToSubscription:Sa}});var Nt,Sr=E(()=>{Nt={shopify:!!window.Shopify,shopify_selling_plans:!!window.Shopify}});var ee,ve,Sn,kt,Tn,vn,Ta,va,Tr,te,wn,It,On,wa,vr,wr,Ut,Or,qt,we,Cr,Oa,Cn,Pn,Ca,Pa,Ra,Aa,Rn,An,Nn,kn,In,Un,qn,A=E(()=>{rn();z();X();Sr();ee=n((t,e,r)=>({type:D,payload:{product:t,frequency:e,offer:r}}),"optinProduct"),ve=n((t,e)=>({type:F,payload:{product:t,offer:e}}),"optoutProduct"),Sn=n((t,e)=>({type:Le,payload:{newProduct:t,product:e}}),"productHasChangedComponents"),kt=n((t,e,r)=>({type:L,payload:{product:t,frequency:e,offer:r}}),"productChangeFrequency"),Tn=n(t=>({type:an,payload:{product:t}}),"concludeUpsell"),vn=n(t=>({type:ut,payload:t}),"setMerchantId"),Ta=n(t=>({type:pt,payload:`${t}.${Math.floor(Math.random()*999999)}.${Math.round(new Date().getTime()/1e3)}`}),"createSessionId"),va=n(t=>({type:on,payload:t}),"requestAuth"),Tr=n((t,e,r,o)=>({type:ft,payload:{public_id:t,sig_field:e,ts:r,sig:o}}),"authorize"),te=n(t=>({type:xe,payload:t}),"unauthorized"),wn=n(t=>({type:dt,payload:t}),"setAuthUrl"),It=n(t=>({type:un,payload:t}),"fetchDone"),On=n((t=tn)=>n(function(r,o){if(window.og&&window.og.previewMode)return r(te({message:"Offers are running in preview mode"}));let{merchantId:s,authUrl:i}=o(),a=va(i);return r(a),t(i).then(({sig_field:c,ts:l,sig:u})=>r(Tr(s,c,l,u)),c=>r(te(c))).finally(()=>r(It(a)))},"fetchAuthThunk"),"fetchAuth"),wa=n((t,e)=>({type:nn,payload:{status:t,ordering:e}}),"requestOrders"),vr=n(t=>({type:ht,payload:t}),"receiveOrders"),wr=n(t=>({type:mt,payload:t}),"receiveItems"),Ut=n((t=1,e="place")=>n(function(o,s){let{environment:{legoUrl:i},auth:a}=s();if(!a)return o(te("No auth set."));let c=wa(t,e);return o(c),Z.fetchOrders(i,a,t,e).then(l=>{if(l.results){o(vr(l));let u=(l.results[0]||{}).public_id;if(u)return Z.fetchItems(i,a,u).then(f=>o(wr(f)))}return o(te(l.detail)),null},l=>o(te(l))).finally(()=>o(It(c)))},"fetchOrdersThunk"),"fetchOrders"),Or=n(t=>{switch(t){case"dev":return{type:yt,payload:t};case"staging":return{type:gt,payload:t};case"prod":return{type:bt,payload:t};default:throw new Error(`${t} is not a supported environment`)}},"setEnvironment"),qt=n(()=>(t,e)=>{let{merchantId:r,sessionId:o}=e();return(!o||r&&!o.startsWith(r))&&t(Ta(r)),o},"requestSessionId"),we=n(t=>({type:I,payload:t}),"receiveOffer"),Cr=n(t=>({type:sn,payload:t}),"fetchResponseError"),Oa=n((t,e=Ve,r)=>({type:Fe,payload:{product:t,module:e,offer:r}}),"requestOffer"),Cn=n((t,e=Ve,r)=>n(function(s,i){let{merchantId:a,sessionId:c,environment:{apiUrl:l}}=i(),u=Oa(t,e,r);return s(u),Nt.shopify_selling_plans?null:Z.fetchOffer(l,a,c,t,e).then(f=>s(we(f)),f=>s(Cr(f))).finally(()=>s(It(u)))},"fetchOfferThunk"),"fetchOffer"),Pn=n(()=>({type:Se}),"checkout"),Ca=n((t,e,r,o)=>({type:cn,payload:{product:t,order:e,quantity:r,offerId:o}}),"requestCreateOneTime"),Pa=n(t=>({type:_t,payload:t}),"receiveCreateOneTime"),Ra=n((t,e)=>({type:ln,payload:{item:t,frequency:e}}),"requestConvertOneTimeToSubscription"),Aa=n((t,e)=>({type:Et,payload:{response:t,product:e}}),"receiveConvertOneTime"),Rn=n((t,e,r,o=!1,s=null)=>n(function(a,c){let{auth:l,environment:{legoUrl:u},previewUpsellOffer:f,offerId:d}=c();if(!l)return a(te("No auth set."));let m=Ca(t,e,r,d);return a(m),(f?Promise.resolve({legoUrl:u,product:t,order:e,quantity:r,offer:d}):Z.createOneTime(u,l,t.id,e,r,d)).then(y=>(a(Pa(y)),o?(a(Ra(y,s)),(f?Promise.resolve({item:y,frequency:s}):Z.convertOneTimeToSubscription(u,l,y,s,d)).then(b=>a(Aa(b,t)),b=>a(Cr(b)))):y),y=>a(Cr(y))).finally(()=>a(It(m)))},"createIuThunk"),"createIu"),An=n(t=>({type:xt,payload:t}),"setLocale"),Nn=n(t=>({type:St,payload:t}),"setConfig"),kn=n((t,e,r)=>({type:Tt,payload:{selector:t,markup:e,config:r}}),"addTemplate"),In=n(t=>({type:vt,payload:t}),"setTemplates"),Un=n((t,e)=>({type:wt,payload:{product:t,firstOrderPlaceDate:e}}),"setFirstOrderPlaceDate"),qn=n((t,e)=>({type:Ot,payload:{product:t,productToSubscribe:e}}),"setProductToSubscribe")});var Ur,he,me=E(()=>{Ur=typeof window!="undefined"&&window.customElements!=null&&window.customElements.polyfillWrapFlushCallback!==void 0,he=n((t,e,r=null)=>{for(;e!==r;){let o=e.nextSibling;t.removeChild(e),e=o}},"removeNodes")});var U,qr,Kn,Pe,ge,Zn,Qe,$,$t,re=E(()=>{U=`{{lit-${String(Math.random()).slice(2)}}}`,qr=`<!--${U}-->`,Kn=new RegExp(`${U}|${qr}`),Pe="$lit$",ge=class{constructor(e,r){this.parts=[],this.element=r;let o=[],s=[],i=document.createTreeWalker(r.content,133,null,!1),a=0,c=-1,l=0,{strings:u,values:{length:f}}=e;for(;l<f;){let d=i.nextNode();if(d===null){i.currentNode=s.pop();continue}if(c++,d.nodeType===1){if(d.hasAttributes()){let m=d.attributes,{length:y}=m,b=0;for(let h=0;h<y;h++)Zn(m[h].name,Pe)&&b++;for(;b-- >0;){let h=u[l],w=$t.exec(h)[2],O=w.toLowerCase()+Pe,_=d.getAttribute(O);d.removeAttribute(O);let C=_.split(Kn);this.parts.push({type:"attribute",index:c,name:w,strings:C}),l+=C.length-1}}d.tagName==="TEMPLATE"&&(s.push(d),i.currentNode=d.content)}else if(d.nodeType===3){let m=d.data;if(m.indexOf(U)>=0){let y=d.parentNode,b=m.split(Kn),h=b.length-1;for(let w=0;w<h;w++){let O,_=b[w];if(_==="")O=$();else{let C=$t.exec(_);C!==null&&Zn(C[2],Pe)&&(_=_.slice(0,C.index)+C[1]+C[2].slice(0,-Pe.length)+C[3]),O=document.createTextNode(_)}y.insertBefore(O,d),this.parts.push({type:"node",index:++c})}b[h]===""?(y.insertBefore($(),d),o.push(d)):d.data=b[h],l+=h}}else if(d.nodeType===8)if(d.data===U){let m=d.parentNode;(d.previousSibling===null||c===a)&&(c++,m.insertBefore($(),d)),a=c,this.parts.push({type:"node",index:c}),d.nextSibling===null?d.data="":(o.push(d),c--),l++}else{let m=-1;for(;(m=d.data.indexOf(U,m+1))!==-1;)this.parts.push({type:"node",index:-1}),l++}}for(let d of o)d.parentNode.removeChild(d)}};n(ge,"Template");Zn=n((t,e)=>{let r=t.length-e.length;return r>=0&&t.slice(r)===e},"endsWith"),Qe=n(t=>t.index!==-1,"isTemplatePartActive"),$=n(()=>document.createComment(""),"createMarker"),$t=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/});function Fr(t,e){let{element:{content:r},parts:o}=t,s=document.createTreeWalker(r,Dr,null,!1),i=Je(o),a=o[i],c=-1,l=0,u=[],f=null;for(;s.nextNode();){c++;let d=s.currentNode;for(d.previousSibling===f&&(f=null),e.has(d)&&(u.push(d),f===null&&(f=d)),f!==null&&l++;a!==void 0&&a.index===c;)a.index=f!==null?-1:a.index-l,i=Je(o,i),a=o[i]}u.forEach(d=>d.parentNode.removeChild(d))}function Xn(t,e,r=null){let{element:{content:o},parts:s}=t;if(r==null){o.appendChild(e);return}let i=document.createTreeWalker(o,Dr,null,!1),a=Je(s),c=0,l=-1;for(;i.nextNode();)for(l++,i.currentNode===r&&(c=za(e),r.parentNode.insertBefore(e,r));a!==-1&&s[a].index===l;){if(c>0){for(;a!==-1;)s[a].index+=c,a=Je(s,a);return}a=Je(s,a)}}var Dr,za,Je,es=E(()=>{re();Dr=133;n(Fr,"removeNodesFromTemplate");za=n(t=>{let e=t.nodeType===11?0:1,r=document.createTreeWalker(t,Dr,null,!1);for(;r.nextNode();)e++;return e},"countNodes"),Je=n((t,e=-1)=>{for(let r=e+1;r<t.length;r++){let o=t[r];if(Qe(o))return r}return-1},"nextActiveIndexInTemplateParts");n(Xn,"insertNodeIntoTemplate")});var Ga,ye,Lr=E(()=>{Ga=new WeakMap,ye=n(t=>typeof t=="function"&&Ga.has(t),"isDirective")});var N,Ht,jr=E(()=>{N={},Ht={}});var oe,Bt=E(()=>{me();re();oe=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=Ur?this.template.element.content.cloneNode(!0):document.importNode(this.template.element.content,!0),r=[],o=this.template.parts,s=document.createTreeWalker(e,133,null,!1),i=0,a=0,c,l=s.nextNode();for(;i<o.length;){if(c=o[i],!Qe(c)){this.__parts.push(void 0),i++;continue}for(;a<c.index;)a++,l.nodeName==="TEMPLATE"&&(r.push(l),s.currentNode=l.content),(l=s.nextNode())===null&&(s.currentNode=r.pop(),l=s.nextNode());if(c.type==="node"){let u=this.processor.handleTextExpression(this.options);u.insertAfterNode(l.previousSibling),this.__parts.push(u)}else this.__parts.push(...this.processor.handleAttributeExpressions(l,c.name,c.strings,this.options));i++}return Ur&&(document.adoptNode(e),customElements.upgrade(e)),e}};n(oe,"TemplateInstance")});var ts,Ya,Y,zt=E(()=>{me();re();ts=window.trustedTypes&&trustedTypes.createPolicy("lit-html",{createHTML:t=>t}),Ya=` ${U} `,Y=class{constructor(e,r,o,s){this.strings=e,this.values=r,this.type=o,this.processor=s}getHTML(){let e=this.strings.length-1,r="",o=!1;for(let s=0;s<e;s++){let i=this.strings[s],a=i.lastIndexOf("<!--");o=(a>-1||o)&&i.indexOf("-->",a+1)===-1;let c=$t.exec(i);c===null?r+=i+(o?Ya:qr):r+=i.substr(0,c.index)+c[1]+c[2]+Pe+c[3]+U}return r+=this.strings[e],r}getTemplateElement(){let e=document.createElement("template"),r=this.getHTML();return ts!==void 0&&(r=ts.createHTML(r)),e.innerHTML=r,e}};n(Y,"TemplateResult")});var Gt,Wt,Re,Ke,Q,Ze,Xe,Yt,rs,et,Qa,Qt=E(()=>{Lr();me();jr();Bt();zt();re();Gt=n(t=>t===null||!(typeof t=="object"||typeof t=="function"),"isPrimitive"),Wt=n(t=>Array.isArray(t)||!!(t&&t[Symbol.iterator]),"isIterable"),Re=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 Ke(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"||!Wt(i))return i}let s="";for(let i=0;i<r;i++){s+=e[i];let a=o[i];if(a!==void 0){let c=a.value;if(Gt(c)||!Wt(c))s+=typeof c=="string"?c:String(c);else for(let l of c)s+=typeof l=="string"?l:String(l)}}return s+=e[r],s}commit(){this.dirty&&(this.dirty=!1,this.element.setAttribute(this.name,this._getValue()))}};n(Re,"AttributeCommitter");Ke=class{constructor(e){this.value=void 0,this.committer=e}setValue(e){e!==N&&(!Gt(e)||e!==this.value)&&(this.value=e,ye(e)||(this.committer.dirty=!0))}commit(){for(;ye(this.value);){let e=this.value;this.value=N,e(this)}this.value!==N&&this.committer.commit()}};n(Ke,"AttributePart");Q=class{constructor(e){this.value=void 0,this.__pendingValue=void 0,this.options=e}appendInto(e){this.startNode=e.appendChild($()),this.endNode=e.appendChild($())}insertAfterNode(e){this.startNode=e,this.endNode=e.nextSibling}appendIntoPart(e){e.__insert(this.startNode=$()),e.__insert(this.endNode=$())}insertAfterPart(e){e.__insert(this.startNode=$()),this.endNode=e.endNode,e.endNode=this.startNode}setValue(e){this.__pendingValue=e}commit(){if(this.startNode.parentNode===null)return;for(;ye(this.__pendingValue);){let r=this.__pendingValue;this.__pendingValue=N,r(this)}let e=this.__pendingValue;e!==N&&(Gt(e)?e!==this.value&&this.__commitText(e):e instanceof Y?this.__commitTemplateResult(e):e instanceof Node?this.__commitNode(e):Wt(e)?this.__commitIterable(e):e===Ht?(this.value=Ht,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 oe&&this.value.template===r)this.value.update(e.values);else{let o=new oe(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 Q(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){he(this.startNode.parentNode,e.nextSibling,this.endNode)}};n(Q,"NodePart");Ze=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(;ye(this.__pendingValue);){let r=this.__pendingValue;this.__pendingValue=N,r(this)}if(this.__pendingValue===N)return;let e=!!this.__pendingValue;this.value!==e&&(e?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=e),this.__pendingValue=N}};n(Ze,"BooleanAttributePart");Xe=class extends Re{constructor(e,r,o){super(e,r,o);this.single=o.length===2&&o[0]===""&&o[1]===""}_createPart(){return new Yt(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}};n(Xe,"PropertyCommitter");Yt=class extends Ke{};n(Yt,"PropertyPart");rs=!1;(()=>{try{let t={get capture(){return rs=!0,!1}};window.addEventListener("test",t,t),window.removeEventListener("test",t,t)}catch{}})();et=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(;ye(this.__pendingValue);){let i=this.__pendingValue;this.__pendingValue=N,i(this)}if(this.__pendingValue===N)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=Qa(e),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=e,this.__pendingValue=N}handleEvent(e){typeof this.value=="function"?this.value.call(this.eventContext||this.element,e):this.value.handleEvent(e)}};n(et,"EventPart");Qa=n(t=>t&&(rs?{capture:t.capture,passive:t.passive,once:t.once}:t.capture),"getOptions")});function Mr(t){let e=be.get(t.type);e===void 0&&(e={stringsArray:new WeakMap,keyString:new Map},be.set(t.type,e));let r=e.stringsArray.get(t.strings);if(r!==void 0)return r;let o=t.strings.join(U);return r=e.keyString.get(o),r===void 0&&(r=new ge(t,t.getTemplateElement()),e.keyString.set(o,r)),e.stringsArray.set(t.strings,r),r}var be,Jt=E(()=>{re();n(Mr,"templateFactory");be=new Map});var ne,Vr,$r=E(()=>{me();Qt();Jt();ne=new WeakMap,Vr=n((t,e,r)=>{let o=ne.get(e);o===void 0&&(he(e,e.firstChild),ne.set(e,o=new Q(Object.assign({templateFactory:Mr},r))),o.appendInto(e)),o.setValue(t),o.commit()},"render")});var Kt,Hr,Br=E(()=>{Qt();Kt=class{handleAttributeExpressions(e,r,o,s){let i=r[0];return i==="."?new Xe(e,r.slice(1),o).parts:i==="@"?[new et(e,r.slice(1),s.eventContext)]:i==="?"?[new Ze(e,r.slice(1),o)]:new Re(e,r,o).parts}handleTextExpression(e){return new Q(e)}};n(Kt,"DefaultTemplateProcessor");Hr=new Kt});var p,zr=E(()=>{Br();zt();Br();Lr();me();jr();Qt();$r();Jt();Bt();zt();re();typeof window!="undefined"&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.3.0");p=n((t,...e)=>new Y(t,e,"html",Hr),"html")});var ns,Zt,Ka,Za,Xa,ss,ec,is,as=E(()=>{me();es();$r();Jt();Bt();re();zr();ns=n((t,e)=>`${t}--${e}`,"getTemplateCacheKey"),Zt=!0;typeof window.ShadyCSS=="undefined"?Zt=!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."),Zt=!1);Ka=n(t=>e=>{let r=ns(e.type,t),o=be.get(r);o===void 0&&(o={stringsArray:new WeakMap,keyString:new Map},be.set(r,o));let s=o.stringsArray.get(e.strings);if(s!==void 0)return s;let i=e.strings.join(U);if(s=o.keyString.get(i),s===void 0){let a=e.getTemplateElement();Zt&&window.ShadyCSS.prepareTemplateDom(a,t),s=new ge(e,a),o.keyString.set(i,s)}return o.stringsArray.set(e.strings,s),s},"shadyTemplateFactory"),Za=["html","svg"],Xa=n(t=>{Za.forEach(e=>{let r=be.get(ns(e,t));r!==void 0&&r.keyString.forEach(o=>{let{element:{content:s}}=o,i=new Set;Array.from(s.querySelectorAll("style")).forEach(a=>{i.add(a)}),Fr(o,i)})})},"removeStylesFromLitTemplates"),ss=new Set,ec=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 a=document.createElement("style");for(let u=0;u<i;u++){let f=s[u];f.parentNode.removeChild(f),a.textContent+=f.textContent}Xa(t);let c=o.content;r?Xn(r,a,c.firstChild):c.insertBefore(a,c.firstChild),window.ShadyCSS.prepareTemplateStyles(o,t);let l=c.querySelector("style");if(window.ShadyCSS.nativeShadow&&l!==null)e.insertBefore(l.cloneNode(!0),e.firstChild);else if(r){c.insertBefore(a,c.firstChild);let u=new Set;u.add(a),Fr(r,u)}},"prepareTemplateStyles"),is=n((t,e,r)=>{if(!r||typeof r!="object"||!r.scopeName)throw new Error("The `scopeName` option is required.");let o=r.scopeName,s=ne.has(e),i=Zt&&e.nodeType===11&&!!e.host,a=i&&!ss.has(o),c=a?document.createDocumentFragment():e;if(Vr(t,c,Object.assign({templateFactory:Ka(o)},r)),a){let l=ne.get(c);ne.delete(c);let u=l.value instanceof oe?l.value.template:void 0;ec(o,c,u),he(e,e.firstChild),e.appendChild(c),ne.set(e,l)}!s&&i&&window.ShadyCSS.styleElement(e.host)},"render")});var cs,Gr,ls,Wr,Yr,Qr,Jr,Kr,Zr,tt,Xr=E(()=>{window.JSCompiler_renameProperty=(t,e)=>t;Gr={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}},ls=n((t,e)=>e!==t&&(e===e||t===t),"notEqual"),Wr={attribute:!0,type:String,converter:Gr,reflect:!1,hasChanged:ls},Yr=1,Qr=1<<2,Jr=1<<3,Kr=1<<4,Zr="finalized",tt=class extends HTMLElement{constructor(){super();this.initialize()}static get observedAttributes(){this.finalize();let e=[];return this._classProperties.forEach((r,o)=>{let s=this._attributeNameForProperty(o,r);s!==void 0&&(this._attributeToPropertyMap.set(s,o),e.push(s))}),e}static _ensureClassProperties(){if(!this.hasOwnProperty(JSCompiler_renameProperty("_classProperties",this))){this._classProperties=new Map;let e=Object.getPrototypeOf(this)._classProperties;e!==void 0&&e.forEach((r,o)=>this._classProperties.set(o,r))}}static createProperty(e,r=Wr){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)||Wr}static finalize(){let e=Object.getPrototypeOf(this);if(e.hasOwnProperty(Zr)||e.finalize(),this[Zr]=!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=ls){return o(e,r)}static _propertyValueFromAttribute(e,r){let o=r.type,s=r.converter||Gr,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||Gr.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=Wr){let s=this.constructor,i=s._attributeNameForProperty(e,o);if(i!==void 0){let a=s._propertyValueToAttribute(r,o);if(a===void 0)return;this._updateState=this._updateState|Jr,a==null?this.removeAttribute(i):this.setAttribute(i,a),this._updateState=this._updateState&~Jr}}_attributeToProperty(e,r){if(this._updateState&Jr)return;let o=this.constructor,s=o._attributeToPropertyMap.get(e);if(s!==void 0){let i=o.getPropertyOptions(s);this._updateState=this._updateState|Kr,this[s]=o._propertyValueFromAttribute(r,i),this._updateState=this._updateState&~Kr}}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&Kr)&&(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|Qr;try{await this._updatePromise}catch{}let e=this.performUpdate();return e!=null&&await e,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return this._updateState&Qr}get hasUpdated(){return this._updateState&Yr}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&Yr||(this._updateState=this._updateState|Yr,this.firstUpdated(r)),this.updated(r))}_markUpdated(){this._changedProperties=new Map,this._updateState=this._updateState&~Qr}get updateComplete(){return this._getUpdateComplete()}_getUpdateComplete(){return this._updatePromise}shouldUpdate(e){return!0}update(e){this._reflectingProperties!==void 0&&this._reflectingProperties.size>0&&(this._reflectingProperties.forEach((r,o)=>this._propertyToAttribute(o,this[o],r)),this._reflectingProperties=void 0),this._markUpdated()}updated(e){}firstUpdated(e){}};n(tt,"UpdatingElement");cs=Zr;tt[cs]=!0});var us,up,ps=E(()=>{us=Element.prototype,up=us.msMatchesSelector||us.webkitMatchesSelector});var Xt,eo,rt,ds,tc,v,to=E(()=>{Xt=window.ShadowRoot&&(window.ShadyCSS===void 0||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,eo=Symbol(),rt=class{constructor(e,r){if(r!==eo)throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e}get styleSheet(){return this._styleSheet===void 0&&(Xt?(this._styleSheet=new CSSStyleSheet,this._styleSheet.replaceSync(this.cssText)):this._styleSheet=null),this._styleSheet}toString(){return this.cssText}};n(rt,"CSSResult");ds=n(t=>new rt(String(t),eo),"unsafeCSS"),tc=n(t=>{if(t instanceof rt)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+tc(s)+t[i+1],t[0]);return new rt(r,eo)},"css")});var fs,x,T=E(()=>{as();Xr();Xr();ps();zr();to();to();(window.litElementVersions||(window.litElementVersions=[])).push("2.4.0");fs={},x=class extends tt{static getStyles(){return this.styles}static _getUniqueStyles(){if(this.hasOwnProperty(JSCompiler_renameProperty("_styles",this)))return;let e=this.getStyles();if(Array.isArray(e)){let r=n((i,a)=>i.reduceRight((c,l)=>Array.isArray(l)?r(l,c):(c.add(l),c),a),"addStyles"),o=r(e,new Set),s=[];o.forEach(i=>s.unshift(i)),this._styles=s}else this._styles=e===void 0?[]:[e];this._styles=this._styles.map(r=>{if(r instanceof CSSStyleSheet&&!Xt){let o=Array.prototype.slice.call(r.cssRules).reduce((s,i)=>s+i.cssText,"");return ds(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):Xt?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!==fs&&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 fs}};n(x,"LitElement");x.finalized=!0;x.render=is});var er=ae((xp,hs)=>{var rc={PAR_OPEN:"(".charCodeAt(0),PAR_CLOSE:")".charCodeAt(0),OP_NOT:"!".charCodeAt(0),BINARY_AND:"&".charCodeAt(0),BINARY_OR:"|".charCodeAt(0),LITERAL:"LITERAL",END:"END",LEAF:"LEAF",ATOMIC:"ATOMIC"};hs.exports=rc});var gs=ae((Sp,ms)=>{var _e=er(),oc=n(t=>{let e="",r=[];for(let o of t){let s=o.charCodeAt(0);switch(s){case _e.PAR_OPEN:case _e.PAR_CLOSE:case _e.OP_NOT:case _e.BINARY_AND:case _e.BINARY_OR:e&&(r.push({type:_e.LITERAL,value:e}),e=""),r.push({type:s,value:o});break;default:e+=o}}return e&&r.push({type:_e.LITERAL,value:e}),r},"Tokenizer");ms.exports=oc});var bs=ae((Tp,ys)=>{var se=er(),nc=n(t=>{let e=[],r=[];return t.forEach(s=>{switch(s.type){case se.LITERAL:e.unshift(s);break;case se.BINARY_AND:case se.BINARY_OR:case se.OP_NOT:case se.PAR_OPEN:r.push(s);break;case se.PAR_CLOSE:for(;r.length&&r[r.length-1].type!==se.PAR_OPEN;)e.unshift(r.pop());r.pop(),r.length&&r[r.length-1].type===se.OP_NOT&&e.unshift(r.pop());break;default:break}}),r.length&&[...r.reverse(),...e]||e},"PolishNotation"),sc=n(function*(t){for(let e=0;e<t.length-1;e++)yield t[e];return t[t.length-1]},"PolishGenerator");ys.exports={PolishNotation:nc,PolishGenerator:sc}});var Es=ae((vp,_s)=>{var k=er(),j=class{constructor(e,r,o,s){this.op=e,this.left=r,this.right=o,this.literal=s}isLeaf(){return this.op===k.LEAF}isAtomic(){return this.isLeaf()||this.op===k.OP_NOT&&this.left.isLeaf()}getLiteralValue(){return this.literal}static CreateAnd(e,r){return new j(k.BINARY_AND,e,r)}static CreateNot(e){return new j(k.OP_NOT,e)}static CreateOr(e,r){return new j(k.BINARY_OR,e,r)}static CreateLiteral(e){return new j(k.LEAF,null,null,e)}};n(j,"ExpNode");var Ae=n(t=>{let e=t.next().value;switch(e.type){case k.LITERAL:return j.CreateLiteral(e.value);case k.OP_NOT:return j.CreateNot(Ae(t));case k.BINARY_AND:{let r=Ae(t),o=Ae(t);return j.CreateAnd(r,o)}case k.BINARY_OR:{let r=Ae(t),o=Ae(t);return j.CreateOr(r,o)}}return null},"make"),Ne=n((t,e)=>{if(t.isLeaf())return e(t.getLiteralValue());if(t.op===k.OP_NOT)return!Ne(t.left,e);if(t.op===k.BINARY_OR)return Ne(t.left,e)||Ne(t.right,e);if(t.op===k.BINARY_AND)return Ne(t.left,e)&&Ne(t.right,e)},"nodeEvaluator");_s.exports={make:Ae,nodeEvaluator:Ne}});var vs=ae((wp,Ts)=>{var ic=gs(),xs=bs(),Ss=Es(),ac=n((t,e)=>{let r=ic(t),o=xs.PolishNotation(r),s=xs.PolishGenerator(o),i=Ss.make(s);return Ss.nodeEvaluator(i,e)},"parse");Ts.exports={parse:ac}});var ti={};ur(ti,{TestWizard:()=>ar,default:()=>Ac});var ar,Ac,ri=E(()=>{T();A();ar=class extends x{static get styles(){return v`
|
|
13
13
|
:host {
|
|
14
14
|
position: fixed;
|
|
15
15
|
top: 5em;
|
|
16
|
-
|
|
16
|
+
righit: 5em;
|
|
17
17
|
background-color: rgba(255, 255, 255, 0.7);
|
|
18
18
|
width: 400px;
|
|
19
19
|
padding: 1em;
|
|
@@ -67,11 +67,11 @@ var lib=(()=>{var ei=Object.create;var ke=Object.defineProperty;var ti=Object.ge
|
|
|
67
67
|
a {
|
|
68
68
|
color: white;
|
|
69
69
|
}
|
|
70
|
-
`}runTests(){this.results=[],this.disabled=!0,this.requestUpdate(),document.querySelectorAll("og-offer").forEach(r=>{let o=r.store.getState(),s=r.getAttribute("product"),i=r.getAttribute("location"),a={messages:this.getOfferAttributeMessages(s,i).concat(this.getOfferRequestMessages(s,o)),product:s};this.results.push(a)}),this.testsRan=!0,this.disabled=!1,this.requestUpdate()}getOfferAttributeMessages(e,r){let o=[];return e||o.push({name:"Offer element found but missing product attribute",type:"error"}),r||o.push({name:"Offer element found but missing location attribute",type:"warning"}),e&&r&&o.push({name:"Offer element found and properly tagged",type:"success"}),o}getOfferRequestMessages(e,r){let o=r.inStock[e],s=r.autoshipEligible[e],i=[];return e&&o===!1&&i.push({name:"This product is marked as out of stock in the OG database",type:"warning"}),e&&s===!1&&i.push({name:"This product is not eligible for autoship",type:"warning"}),e&&o===null&&s===null&&i.push({name:"This product does not exist in our database",type:"error"}),i}resultsCodeBlock(){return this.results.length===0?
|
|
70
|
+
`}runTests(){this.results=[],this.disabled=!0,this.requestUpdate(),document.querySelectorAll("og-offer").forEach(r=>{let o=r.store.getState(),s=r.getAttribute("product"),i=r.getAttribute("location"),a={messages:this.getOfferAttributeMessages(s,i).concat(this.getOfferRequestMessages(s,o)),product:s};this.results.push(a)}),this.testsRan=!0,this.disabled=!1,this.requestUpdate()}getOfferAttributeMessages(e,r){let o=[];return e||o.push({name:"Offer element found but missing product attribute",type:"error"}),r||o.push({name:"Offer element found but missing location attribute",type:"warning"}),e&&r&&o.push({name:"Offer element found and properly tagged",type:"success"}),o}getOfferRequestMessages(e,r){let o=r.inStock[e],s=r.autoshipEligible[e],i=[];return e&&o===!1&&i.push({name:"This product is marked as out of stock in the OG database",type:"warning"}),e&&s===!1&&i.push({name:"This product is not eligible for autoship",type:"warning"}),e&&o===null&&s===null&&i.push({name:"This product does not exist in our database",type:"error"}),i}resultsCodeBlock(){return this.results.length===0?p`
|
|
71
71
|
<div class="message error">No offer element found on the page</div>
|
|
72
|
-
`:this.results.map((e,r)=>
|
|
72
|
+
`:this.results.map((e,r)=>p`
|
|
73
73
|
<div>For offer tag with product = "${e.product}"</div>
|
|
74
|
-
${e.messages.map(o=>
|
|
74
|
+
${e.messages.map(o=>p`
|
|
75
75
|
<div class="message ${o.type}">
|
|
76
76
|
${o.name}
|
|
77
77
|
</div>
|
|
@@ -100,16 +100,16 @@ var lib=(()=>{var ei=Object.create;var ke=Object.defineProperty;var ti=Object.ge
|
|
|
100
100
|
upsell product is in next order
|
|
101
101
|
</button>
|
|
102
102
|
<br />
|
|
103
|
-
`)}toggleUpsellPreview(e){return r=>{r.preventDefault();let o=document.querySelectorAll("og-offer")[e];o.getAttribute("preview-upsell-offer")?o.removeAttribute("preview-upsell-offer"):o.setAttribute("preview-upsell-offer",!0),this.runTests()}}toggleProductFlags(e,{inStock:r=!0,autoship:o=!0,groups:s=["subscription","upsell"]}){return i=>{i.preventDefault();let a=document.querySelectorAll("og-offer")[e],c=a.product.id;a.store.dispatch(
|
|
103
|
+
`)}toggleUpsellPreview(e){return r=>{r.preventDefault();let o=document.querySelectorAll("og-offer")[e];o.getAttribute("preview-upsell-offer")?o.removeAttribute("preview-upsell-offer"):o.setAttribute("preview-upsell-offer",!0),this.runTests()}}toggleProductFlags(e,{inStock:r=!0,autoship:o=!0,groups:s=["subscription","upsell"]}){return i=>{i.preventDefault();let a=document.querySelectorAll("og-offer")[e],c=a.product.id;a.store.dispatch(we({in_stock:{[c]:r},eligibility_groups:{[c]:s},result:"success",autoship:{[c]:o},module_view:{regular:"58a01e9aacbe40389b5c7325d79091bb"},modifiers:{},incentives_display:{"47c01e9aacbe40389b5c7325d79091aa":{field:"sub_total",object:"order",type:"Discount Percent",value:5},e6534b9d877f41e586c37b7d8abc3a58:{field:"total_price",object:"item",type:"Discount Percent",value:5},f35e842710b24929922db4a529eecd40:{field:"total_price",object:"item",type:"Discount Percent",value:10},"5be321d7c17f4e18a757212b9a20bfcc":{field:"total_price",object:"item",type:"Discount Percent",value:1}},incentives:{[c]:{initial:["5be321d7c17f4e18a757212b9a20bfcc"],ongoing:["e6534b9d877f41e586c37b7d8abc3a58","47c01e9aacbe40389b5c7325d79091aa","f35e842710b24929922db4a529eecd40"]}}})),this.runTests()}}toggleUpsellNextOrder(e){return r=>{let o=document.querySelectorAll("og-offer")[e],s=o.product.id;r.preventDefault(),o.store.dispatch(wr({count:1,next:null,previous:null,results:[{order:"24d50352579511ea806cbc764e100cfd",offer:null,subscription:"8a076b7a0ea011e7a5bcbc764e105eda",product:s,components:[],quantity:1,public_id:"24d6901e579511ea806cbc764e100cfd",product_attribute:null,price:"14.99",extra_cost:"0.00",total_price:"13.49",one_time:!1,frozen:!1,first_placed:null}]})),this.runTests()}}render(){return p`
|
|
104
104
|
<div>
|
|
105
|
-
${this.testsRan?this.resultsCodeBlock():
|
|
105
|
+
${this.testsRan?this.resultsCodeBlock():p`
|
|
106
106
|
<div>Click the button to run tests</div>
|
|
107
107
|
`}
|
|
108
108
|
<button ?disabled=${this.disabled} @click="${this.runTests.bind(this)}" class="primary">Run Test</button>
|
|
109
109
|
</div>
|
|
110
|
-
`}};n(er,"TestWizard");Dc=er});var Mc={};tr(Mc,{addOptinChangedCallback:()=>Bs,addTemplate:()=>Qs,clear:()=>$s,config:()=>Ws,default:()=>jc,disableOptinChangedCallbacks:()=>Hs,getOptins:()=>Vs,getProductsForPurchasePost:()=>Ms,initialize:()=>go,offers:()=>_,previewMode:()=>Gs,register:()=>zs,resolveSettings:()=>Zs,setAuthUrl:()=>js,setEnvironment:()=>Fs,setLocale:()=>Ys,setMerchantId:()=>Ls,setPublicPath:()=>Ks,setTemplates:()=>Js});var ii=Object.defineProperty,tt=n((t,e)=>ii(t,"name",{value:e,configurable:!0}),"s"),ai=tt(t=>e=>t.indexOf(e.origin)>=0,"createIsMessageAllowed"),bo=["https://rc3.ordergroove.com","https://rc3.stg.ordergroove.com","http://localhost:3000",window.location.origin],_o=tt(t=>(e,r)=>{bo.forEach(o=>t.postMessage({ogType:e,...r},o))},"createBroadcastMessage");function rr(t){let e=ai(bo),r=_o(t.source);if(e(t)&&t.data.ogType==="READY"){let o="//static.ordergroove.com/@ordergroove/offers-live-editor/0.4.2/dist/";o.startsWith("//")&&(o=window.location.protocol+o),o.endsWith("/")||(o+="/"),import(`${o}client.js`).then(({initializeClient:s})=>{s(e,r),window.removeEventListener("message",rr)})}}n(rr,"c");tt(rr,"handleReady");function or(t=window.opener){t&&t!==window&&(window.addEventListener("message",rr),_o(t)("READY"))}n(or,"w");tt(or,"offersLiveEditor");function nr(t){var e,r=t.Symbol;return typeof r=="function"?r.observable?e=r.observable:(e=r("observable"),r.observable=e):e="@@observable",e}n(nr,"symbolObservablePonyfill");var be;typeof self!="undefined"?be=self:typeof window!="undefined"||typeof window!="undefined"?be=window:typeof module!="undefined"?be=module:be=Function("return this")();var ci=nr(be),sr=ci;var ir=n(function(){return Math.random().toString(36).substring(7).split("").join(".")},"randomString"),Ie={INIT:"@@redux/INIT"+ir(),REPLACE:"@@redux/REPLACE"+ir(),PROBE_UNKNOWN_ACTION:n(function(){return"@@redux/PROBE_UNKNOWN_ACTION"+ir()},"PROBE_UNKNOWN_ACTION")};function li(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(li,"isPlainObject");function ar(t,e,r){var o;if(typeof e=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error("It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function.");if(typeof e=="function"&&typeof r=="undefined"&&(r=e,e=void 0),typeof r!="undefined"){if(typeof r!="function")throw new Error("Expected the enhancer to be a function.");return r(ar)(t,e)}if(typeof t!="function")throw new Error("Expected the reducer to be a function.");var s=t,i=e,a=[],c=a,l=!1;function d(){c===a&&(c=a.slice())}n(d,"ensureCanMutateNextListeners");function g(){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(g,"getState");function p(f){if(typeof f!="function")throw new Error("Expected the listener to be a function.");if(l)throw new Error("You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api-reference/store#subscribelistener for more details.");var T=!0;return d(),c.push(f),n(function(){if(!!T){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.");T=!1,d();var b=c.indexOf(f);c.splice(b,1),a=null}},"unsubscribe")}n(p,"subscribe");function m(f){if(!li(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 T=a=c,O=0;O<T.length;O++){var b=T[O];b()}return f}n(m,"dispatch");function E(f){if(typeof f!="function")throw new Error("Expected the nextReducer to be a function.");s=f,m({type:Ie.REPLACE})}n(E,"replaceReducer");function y(){var f,T=p;return f={subscribe:n(function(b){if(typeof b!="object"||b===null)throw new TypeError("Expected the observer to be an object.");function P(){b.next&&b.next(g())}n(P,"observeState"),P();var Xs=T(P);return{unsubscribe:Xs}},"subscribe")},f[sr]=function(){return this},f}return n(y,"observable"),m({type:Ie.INIT}),o={dispatch:m,subscribe:p,getState:g,replaceReducer:E},o[sr]=y,o}n(ar,"createStore");function ui(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(ui,"getUndefinedStateErrorMessage");function pi(t){Object.keys(t).forEach(function(e){var r=t[e],o=r(void 0,{type:Ie.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:Ie.PROBE_UNKNOWN_ACTION()})=="undefined")throw new Error('Reducer "'+e+'" returned undefined when probed with a random type. '+("Don't try to handle "+Ie.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(pi,"assertReducerShape");function xo(t){for(var e=Object.keys(t),r={},o=0;o<e.length;o++){var s=e[o];typeof t[s]=="function"&&(r[s]=t[s])}var i=Object.keys(r),a,c;try{pi(r)}catch(l){c=l}return n(function(d,g){if(d===void 0&&(d={}),c)throw c;if(!1)var p;for(var m=!1,E={},y=0;y<i.length;y++){var f=i[y],T=r[f],O=d[f],b=T(O,g);if(typeof b=="undefined"){var P=ui(f,g);throw new Error(P)}E[f]=b,m=m||b!==O}return m=m||i.length!==Object.keys(d).length,m?E:d},"combination")}n(xo,"combineReducers");function Eo(t,e){return function(){return e(t.apply(this,arguments))}}n(Eo,"bindActionCreator");function So(t,e){if(typeof t=="function")return Eo(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]=Eo(s,e))}return r}n(So,"bindActionCreators");function di(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}n(di,"_defineProperty");function vo(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(vo,"ownKeys");function fi(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?vo(r,!0).forEach(function(o){di(t,o,r[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):vo(r).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(r,o))})}return t}n(fi,"_objectSpread2");function cr(){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(cr,"compose");function wo(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return function(o){return function(){var s=o.apply(void 0,arguments),i=n(function(){throw new Error("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},"dispatch"),a={getState:s.getState,dispatch:n(function(){return i.apply(void 0,arguments)},"dispatch")},c=e.map(function(l){return l(a)});return i=cr.apply(void 0,c)(s.dispatch),fi({},s,{dispatch:i})}}}n(wo,"applyMiddleware");var rt=null,hi=n(t=>({dispatch:t}),"defaultMapDispatchToProps"),To=n(t=>{if(!rt)throw new Error("Missing redux store.");return rt},"resolveStore"),mi=n((t,e)=>r=>{let{getState:o,dispatch:s}=To(r),i=t?t(o(),r):{},a=e(s,r);Object.assign(r,i,a)},"createRecalcProps"),h=n((t,e=hi)=>r=>{let s=mi(t,typeof e=="function"?e:i=>So(e,i));return class extends r{get store(){return rt}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this._storeUnsubscribe=To(this).subscribe(()=>s(this)),s(this)}attributeChangedCallback(i,a,c){super.attributeChangedCallback&&super.attributeChangedCallback(i,a,c),this._storeUnsubscribe&&a!==c&&s(this)}disconnectedCallback(){this._storeUnsubscribe(),super.disconnectedCallback&&super.disconnectedCallback()}}},"connect"),Oo=n(t=>{rt=t},"setStore");function Co(t){var e=n(function(o){var s=o.dispatch,i=o.getState;return function(a){return function(c){return typeof c=="function"?c(s,i,t):a(c)}}},"middleware");return e}n(Co,"createThunkMiddleware");var Po=Co();Po.withExtraArgument=Co;var Ro=Po;ae();function gi(t,e){return t===e}n(gi,"defaultEqualityCheck");function yi(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(yi,"areArgumentsShallowlyEqual");function bi(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:gi,r=null,o=null;return function(){return yi(e,r,arguments)||(o=t.apply(null,arguments)),r=arguments,o}}n(bi,"defaultMemoize");function _i(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(_i,"getDependencies");function xi(t){for(var e=arguments.length,r=Array(e>1?e-1:0),o=1;o<e;o++)r[o-1]=arguments[o];return function(){for(var s=arguments.length,i=Array(s),a=0;a<s;a++)i[a]=arguments[a];var c=0,l=i.pop(),d=_i(i),g=t.apply(void 0,[function(){return c++,l.apply(null,arguments)}].concat(r)),p=t(function(){for(var m=[],E=d.length,y=0;y<E;y++)m.push(d[y].apply(null,arguments));return g.apply(null,m)});return p.resultFunc=l,p.dependencies=d,p.recomputations=function(){return c},p.resetRecomputations=function(){return c=0},p}}n(xi,"createSelectorCreator");var Ee=xi(bi);var ue=ye(vt());Y();ue.default.Cache=Map;function ua(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(ua,"arraysEqual");var R=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))||ua((t.components||[]).sort(),(e.components||[]).sort()))),"isSameProduct"),Ot=n(t=>t.optedin||[],"optedinSelector"),Qo=n(t=>t.optedout||[],"optedoutSelector"),hr=n(t=>t.autoshipByDefault||{},"autoshipSelector"),pa=n(t=>t.defaultFrequencies||{},"defaultFrequenciesSelector"),V=(0,ue.default)(t=>Ee(Ot,Qo,hr,(e,r,o)=>{let s=e.find(i=>R(t,i));return s||(r.find(i=>R(t,i))?!1:t&&o[t.id]?{id:t.id}:!1)}),t=>JSON.stringify(t)),Jo=(0,ue.default)(t=>Ee(Ot,e=>{let r=e.find(o=>R(t,o));return r||!1}),t=>JSON.stringify(t)),Ct=(0,ue.default)(t=>Ee(Qo,e=>e.find(r=>R(t,r))));var j=(0,ue.default)(t=>Ee(V(t),e=>e&&e.frequency||null)),Pt=(0,ue.default)(t=>Ee(pa,e=>e[t]&&Ve(e[t])||null)),mr=n(t=>t.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase(),"kebabCase"),$=n((t,e,r,o)=>({[r]:e&&e.hasAttribute&&e.hasAttribute(mr(r))&&e[r]||e.offer&&typeof(e.offer[r]!=="undefined")&&e.offer[r]||t.config&&t.config[r]||o}),"configSelector"),ve=n(t=>({templates:t.templates||[]}),"templatesSelector");Y();var da=n((t=[],e)=>{switch(e.type){case G:return[];case ie:return e.newValue?e.newValue.optedin:t;case oe:case se:let[[r],o]=t.reduce((s,i)=>s[R(e.payload.product,i)?0:1].push(i)&&s,[[],[]]);return(o||[]).concat({...r,...e.payload.product,frequency:e.payload.frequency});case ne:return t.filter(s=>!R(e.payload.product,s));case qe:return t.map(s=>R(e.payload.product,s)?{...s,...e.payload.newProduct}:s);case ft:return t.filter(s=>!R(e.payload.product,s));case xe:return[];default:return t}},"optedin"),fa=n((t=[],e)=>{switch(e.type){case G:return[];case ie:return e.newValue?e.newValue.optedout:t;case oe:case se:return t.filter(s=>!R(e.payload.product,s));case ne:let[[r],o]=t.reduce((s,i)=>s[R(e.payload.product,i)?0:1].push(i)&&s,[[],[]]);return(o||[]).concat({...r,...e.payload.product,frequency:e.payload.frequency});case qe:return t.map(s=>R(e.payload.product,s)?{...s,...e.payload.newProduct}:s);case xe:return[];default:return t}},"optedout"),ha=n((t={},{type:e,payload:r})=>{switch(e){case at: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 dt:return{...t,...r,public_id:r.order,...r.product&&{products:(t.products||[]).concat(r.product)}};default:return t}},"nextUpcomingOrder"),ma=n((t={},e)=>{switch(e.type){case q:return{...t,...e.payload.autoship};default:return t}},"autoshipEligible"),ga=n((t={},e)=>{switch(e.type){case q:return{...t,...e.payload.in_stock};default:return t}},"inStock"),ya=n((t={},e)=>{switch(e.type){case q:return{...t,...e.payload.eligibility_groups};default:return t}},"eligibilityGroups"),Ko=n((t,e)=>t.map(r=>({...e[r],id:[r][0]})),"mapIncentive"),ba=n((t={},e)=>{switch(e.type){case q:return{...t,...[...new Set(Object.keys(e.payload.incentives||{}))].reduce((r,o)=>({...r,[o]:Object.entries(e.payload.incentives).filter(([s])=>s===o).reduce((s,[,{initial:i,ongoing:a}])=>({...s,initial:[...s.initial||[],...Ko(i,e.payload.incentives_display)],ongoing:[...s.ongoing||[],...Ko(a,e.payload.incentives_display)]}),{})}),{})};default:return t}},"incentives");var _a=n((t=!1,e)=>{switch(e.type){case it:return{...e.payload};case _e:return!1;default:return t}},"auth"),xa=n((t="",e)=>{switch(e.type){case ot:return e.payload;default:return t}},"merchantId"),Ea=n((t=null,e)=>{switch(e.type){case st:return e.payload;default:return t}},"authUrl"),Sa=n((t={},e)=>{switch(e.type){case q:return{...t,offerId:(e.payload.module_view||{}).regular,...e.payload.modifiers};default:return t}},"offer"),va=n((t="",e)=>{switch(e.type){case q:return(e.payload.module_view||{}).regular||"";default:return t}},"offerId"),wa=n((t=null,e)=>{switch(e.type){case G:return null;case nt:return e.payload;default:return t}},"sessionId"),Ta=n((t={},e)=>{switch(e.type){case q:return{...t,...Object.entries(e.payload.autoship).map(([r])=>({[r]:Object.keys(e.payload.modifiers)})).reduce((r,o)=>({...r,...o}))};case xe:return{};default:return t}},"productOffer"),Oa=n((t={},e)=>{switch(e.type){case bt:return{...t,[e.payload.product]:e.payload.firstOrderPlaceDate};default:return t}},"firstOrderPlaceDate"),Ca=n((t={},e)=>{switch(e.type){case _t:return{...t,[e.payload.product]:e.payload.productToSubscribe};default:return t}},"productToSubscribe"),gr=n((t={},e)=>{switch(e.type){case lt:return{...t,name:"staging",apiUrl:"https://staging.om.ordergroove.com",legoUrl:"https://staging.restapi.ordergroove.com"};case ut:return{...t,name:"dev",apiUrl:"https://dev.om.ordergroove.com",legoUrl:"https://dev.restapi.ordergroove.com"};case pt:return{...t,name:"prod",apiUrl:"https://om.ordergroove.com",legoUrl:"https://restapi.ordergroove.com"};default:return t}},"environment"),Pa=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 ht:return{...t,...e.payload};default:return t}},"locale"),Ra=n((t={frequencies:["1_2","1_2","1_3"],offerType:"radio"},e)=>{switch(e.type){case mt:return{...t,...e.payload,defaultFrequency:e.payload.defaultFrequency?Ve(e.payload.defaultFrequency):t.defaultFrequency,frequencies:e.payload.frequencies?e.payload.frequencies.map(Ve):t.frequencies};default:return t}},"config"),Aa=n((t=!1,e)=>{switch(e.type){case Ue:return e.payload;default:return t}},"previewStandardOffer"),Na=n((t=!1,e)=>{switch(e.type){case De:return e.payload;default:return t}},"previewUpsellOffer"),ka=n((t=[],e)=>{switch(e.type){case q:return{...t,...e.payload.autoship_by_default};default:return t}},"autoshipByDefault"),Ia=n((t=[],e)=>{switch(e.type){case q:return{...t,...e.payload.default_frequencies};default:return t}},"defaultFrequencies"),qa=n((t=[],e)=>{switch(e.type){case yt:return[...e.payload||[]];case gt:return[e.payload,...t];default:return t}},"templates"),Ua=n((t={},e)=>{switch(e.type){case xt:return{...e.payload};default:return t}},"productPlans"),Zo=xo({productPlans:Ua,environment:gr,optedin:da,optedout:fa,merchantId:xa,offer:Sa,offerId:va,productOffer:Ta,sessionId:wa,inStock:ga,eligibilityGroups:ya,autoshipByDefault:ka,autoshipEligible:ma,incentives:ba,nextUpcomingOrder:ha,auth:_a,authUrl:Ea,locale:Pa,config:Ra,previewStandardOffer:Aa,previewUpsellOffer:Na,templates:qa,defaultFrequencies:Ia,firstOrderPlaceDate:Oa,productToSubscribe:Ca});var _n=ye(yr());N();ae();var $e="OG_STATE",xn=n(t=>{try{return t===null?void 0:JSON.parse(t)}catch{return}},"safeParseState"),vr=n(()=>window.og&&window.og.previewMode,"isPreviewMode"),En=n(()=>vr()?{}:xn(localStorage.getItem($e)),"loadState"),Ya=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"),Sn=n(t=>{if(vr())return;let e=Ya(t);e&&localStorage.getItem($e)!==e&&localStorage.setItem($e,e)},"saveState"),vn=n(t=>(0,_n.throttle)(500,e=>{if(vr())return;let{key:r,newValue:o}=e;r===$e&&o===null?(t.dispatch({type:G}),setTimeout(()=>t.dispatch(qt()),0)):r===$e&&t.dispatch({type:ie,newValue:xn(o)})}),"listenLocalStorageChanges");var wn=ye(yr());ae();var Qa=n((t,e,r=document)=>r.dispatchEvent(new CustomEvent(t,{detail:e})),"dispatchEvent"),Tn=n(t=>({payload:{product:{id:e,components:r}={}}={}}={})=>setTimeout(()=>Qa("optin-changed",{productId:e,components:r,optedIn:t}),0),"dispatchOptinChangedEvent"),Ja=[{expressions:[({type:t}={})=>t===oe,({type:t}={})=>t===se],fn:Tn(!0)},{expressions:[({type:t}={})=>t===ne],fn:Tn(!1)}],On=n(t=>e=>r=>{let o=t.getState();Ja.forEach(s=>{s.expressions.some(i=>i(r,o))&&s.fn(r)}),e(r)},"dispatchMiddleware"),Cn=n(t=>e=>r=>{e(r);let o=(0,wn.throttle)(500,()=>{Sn({...t.getState()})});r.type!==ie&&o()},"localStorageMiddleware");function Pn(){if(window.og&&window.og.store)return window.og.store;let t=window.og&&window.og.previewMode,e=typeof window=="object"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({}):cr,r=[Ro,On];t||r.push(Cn);let o=e(wo(...r)),s=ar(Zo,t?{}:En(),o);return window.og=window.og||{},window.og.store=s,s}n(Pn,"getStore");Y();var wr=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],...Me(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 us=ye(rs());v();var hc=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"),os=n(t=>t.hasAttribute("product")&&{id:t.getAttribute("product"),...t.hasAttribute("product-components")&&{components:JSON.parse(t.getAttribute("product-components"))}},"buildProduct");var Wr=n(t=>{let e=os(t);if(!e){let r=t.offer;r&&(e=os(r))}return e},"resolveProduct"),mc=n(t=>{let e=t;for(;e;){if(e.tagName==="OG-OFFER")return e;e=e.nodeType===11?e.host:e.parentNode}},"resolveOffer"),Yr=n(t=>class extends t{get offer(){return mc(this)}connectedCallback(){super.connectedCallback(),this.offersChangeTemplate=this.offersChangeTemplate.bind(this),this.offer&&this.offer.addEventListener("template-changed",this.offersChangeTemplate)}disconnectedCallback(){super.disconnectedCallback(),this.offer&&this.offer.removeEventListener("template-changed",this.offersChangeTemplate)}offersChangeTemplate(){this._enqueueUpdate()}},"withOfferTemplate"),A=n(t=>class extends Yr(t){get product(){return Wr(this)}},"withProduct"),Yt=n(t=>class extends t{get childOptions(){return this._childOptions||{options:[]}}connectedCallback(){let e=[],r=null;this.querySelectorAll("option").forEach(o=>{let s=hc(o.value),i=o.innerText.trim();e.push({value:s,text:i}),!r&&o.selected&&(r=s)}),this._childOptions={options:e,isSelected:r},super.connectedCallback&&super.connectedCallback()}},"withChildOptions");var Qt={};tr(Qt,{autoshipByDefault:()=>gc,eligibilityGroups:()=>is,eligible:()=>ns,hasUpcomingOrder:()=>cs,hasUpsellGroup:()=>as,inStock:()=>Qr,optedout:()=>bc,regularEligible:()=>xc,subscribed:()=>yc,subscriptionEligible:()=>ss,upcomingOrderContainsProduct:()=>_c,upsellEligible:()=>ls});var Qr=n((t,e)=>(t.inStock||{})[(e.product||{}).id],"inStock"),ns=n((t,e)=>(t.autoshipEligible||{})[(e.product||{}).id]||!1,"eligible"),gc=n((t,e)=>(t.autoshipByDefault||{})[(e.product||{}).id]||!1,"autoshipByDefault"),ss=n((t,e)=>(t.offerId&&t.offerId!=="0"||!1)&&ns(t,e)&&Qr(t,e),"subscriptionEligible"),is=n((t,e)=>(t.eligibilityGroups||{})[(e.product||{}).id]||null,"eligibilityGroups"),as=n((t,e)=>{let r=is(t,e);return r===null||!!r.find(o=>o==="upsell"||o==="impulse_upsell")},"hasUpsellGroup"),yc=n((t,e)=>Jo(e.product)(t),"subscribed"),bc=n((t,e)=>Ct(e.product)(t),"optedout"),cs=n(t=>!!(t.nextUpcomingOrder&&t.nextUpcomingOrder.public_id),"hasUpcomingOrder"),_c=n((t,e)=>(t.nextUpcomingOrder&&t.nextUpcomingOrder.products||[]).includes((e.product||{}).id),"upcomingOrderContainsProduct"),ls=n((t,e)=>t.offerId&&t.offerId!=="0"&&t.auth&&Qr(t,e)&&cs(t)&&as(t,e),"upsellEligible"),xc=n((t,e)=>ss(t,e)&&!ls(t,e),"regularEligible");var Ec=n(t=>t.replace(/(\r\n|\n|\r|\s)+/gm,""),"removeWhitespace"),Jr=class extends A(x){static get properties(){return{...super.properties,state:{type:Object,attribute:!1},test:{type:String}}}render(){return this.test&&us.default.parse(Ec(this.test),r=>Qt[r]&&Qt[r](this.state,this))?u`
|
|
110
|
+
`}};n(ar,"TestWizard");Ac=ar});var Pl={};ur(Pl,{addOptinChangedCallback:()=>cl,addTemplate:()=>ll,clear:()=>ul,config:()=>pl,default:()=>Cl,disableOptinChangedCallbacks:()=>dl,getOptins:()=>fl,getProductsForPurchasePost:()=>hl,initialize:()=>gi,isReady:()=>mi,offers:()=>S,previewMode:()=>ml,register:()=>gl,resolveSettings:()=>yl,setAuthUrl:()=>bl,setEnvironment:()=>_l,setLocale:()=>El,setMerchantId:()=>xl,setPublicPath:()=>Sl,setTemplates:()=>Tl,setupCart:()=>vl,setupProduct:()=>wl,setupProducts:()=>Ol,store:()=>hi});function pr(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(pr,"symbolObservablePonyfill");var Ee;typeof self!="undefined"?Ee=self:typeof window!="undefined"||typeof window!="undefined"?Ee=window:typeof module!="undefined"?Ee=module:Ee=Function("return this")();var vi=pr(Ee),dr=vi;var fr=n(function(){return Math.random().toString(36).substring(7).split("").join(".")},"randomString"),De={INIT:"@@redux/INIT"+fr(),REPLACE:"@@redux/REPLACE"+fr(),PROBE_UNKNOWN_ACTION:n(function(){return"@@redux/PROBE_UNKNOWN_ACTION"+fr()},"PROBE_UNKNOWN_ACTION")};function wi(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(wi,"isPlainObject");function hr(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(hr)(t,e)}if(typeof t!="function")throw new Error("Expected the reducer to be a function.");var s=t,i=e,a=[],c=a,l=!1;function u(){c===a&&(c=a.slice())}n(u,"ensureCanMutateNextListeners");function f(){if(l)throw new Error("You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return i}n(f,"getState");function d(h){if(typeof h!="function")throw new Error("Expected the listener to be a function.");if(l)throw new Error("You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api-reference/store#subscribelistener for more details.");var w=!0;return u(),c.push(h),n(function(){if(!!w){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.");w=!1,u();var _=c.indexOf(h);c.splice(_,1),a=null}},"unsubscribe")}n(d,"subscribe");function m(h){if(!wi(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 w=a=c,O=0;O<w.length;O++){var _=w[O];_()}return h}n(m,"dispatch");function y(h){if(typeof h!="function")throw new Error("Expected the nextReducer to be a function.");s=h,m({type:De.REPLACE})}n(y,"replaceReducer");function b(){var h,w=d;return h={subscribe:n(function(_){if(typeof _!="object"||_===null)throw new TypeError("Expected the observer to be an object.");function C(){_.next&&_.next(f())}n(C,"observeState"),C();var yi=w(C);return{unsubscribe:yi}},"subscribe")},h[dr]=function(){return this},h}return n(b,"observable"),m({type:De.INIT}),o={dispatch:m,subscribe:d,getState:f,replaceReducer:y},o[dr]=b,o}n(hr,"createStore");function Oi(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(Oi,"getUndefinedStateErrorMessage");function Ci(t){Object.keys(t).forEach(function(e){var r=t[e],o=r(void 0,{type:De.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:De.PROBE_UNKNOWN_ACTION()})=="undefined")throw new Error('Reducer "'+e+'" returned undefined when probed with a random type. '+("Don't try to handle "+De.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(Ci,"assertReducerShape");function at(t){for(var e=Object.keys(t),r={},o=0;o<e.length;o++){var s=e[o];typeof t[s]=="function"&&(r[s]=t[s])}var i=Object.keys(r),a,c;try{Ci(r)}catch(l){c=l}return n(function(u,f){if(u===void 0&&(u={}),c)throw c;if(!1)var d;for(var m=!1,y={},b=0;b<i.length;b++){var h=i[b],w=r[h],O=u[h],_=w(O,f);if(typeof _=="undefined"){var C=Oi(h,f);throw new Error(C)}y[h]=_,m=m||_!==O}return m=m||i.length!==Object.keys(u).length,m?y:u},"combination")}n(at,"combineReducers");function zo(t,e){return function(){return e(t.apply(this,arguments))}}n(zo,"bindActionCreator");function Go(t,e){if(typeof t=="function")return zo(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]=zo(s,e))}return r}n(Go,"bindActionCreators");function Pi(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}n(Pi,"_defineProperty");function Wo(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(Wo,"ownKeys");function Ri(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Wo(r,!0).forEach(function(o){Pi(t,o,r[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Wo(r).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(r,o))})}return t}n(Ri,"_objectSpread2");function mr(){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(mr,"compose");function Yo(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return function(o){return function(){var s=o.apply(void 0,arguments),i=n(function(){throw new Error("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},"dispatch"),a={getState:s.getState,dispatch:n(function(){return i.apply(void 0,arguments)},"dispatch")},c=e.map(function(l){return l(a)});return i=mr.apply(void 0,c)(s.dispatch),Ri({},s,{dispatch:i})}}}n(Yo,"applyMiddleware");function Qo(t){var e=n(function(o){var s=o.dispatch,i=o.getState;return function(a){return function(c){return typeof c=="function"?c(s,i,t):a(c)}}},"middleware");return e}n(Qo,"createThunkMiddleware");var Jo=Qo();Jo.withExtraArgument=Qo;var Ko=Jo;var Dn=ce(gr());A();z();var Ye="OG_STATE",Fn=n(t=>{try{return t===null?void 0:JSON.parse(t)}catch{return}},"safeParseState"),Pr=n(()=>window.og&&window.og.previewMode,"isPreviewMode"),Ln=n(()=>Pr()?{}:Fn(localStorage.getItem(Ye)),"loadState"),Na=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"),jn=n(t=>{if(Pr())return;let e=Na(t);e&&localStorage.getItem(Ye)!==e&&localStorage.setItem(Ye,e)},"saveState"),Mn=n(t=>(0,Dn.throttle)(500,e=>{if(Pr())return;let{key:r,newValue:o}=e;r===Ye&&o===null?(t.dispatch({type:K}),setTimeout(()=>t.dispatch(qt()),0)):r===Ye&&t.dispatch({type:le,newValue:Fn(o)})}),"listenLocalStorageChanges");var $n=ce(gr());z();function ka(t,e){return t===e}n(ka,"defaultEqualityCheck");function Ia(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(Ia,"areArgumentsShallowlyEqual");function Ua(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ka,r=null,o=null;return function(){return Ia(e,r,arguments)||(o=t.apply(null,arguments)),r=arguments,o}}n(Ua,"defaultMemoize");function qa(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(qa,"getDependencies");function Da(t){for(var e=arguments.length,r=Array(e>1?e-1:0),o=1;o<e;o++)r[o-1]=arguments[o];return function(){for(var s=arguments.length,i=Array(s),a=0;a<s;a++)i[a]=arguments[a];var c=0,l=i.pop(),u=qa(i),f=t.apply(void 0,[function(){return c++,l.apply(null,arguments)}].concat(r)),d=t(function(){for(var m=[],y=u.length,b=0;b<y;b++)m.push(u[b].apply(null,arguments));return f.apply(null,m)});return d.resultFunc=l,d.dependencies=u,d.recomputations=function(){return c},d.resetRecomputations=function(){return c=0},d}}n(Da,"createSelectorCreator");var Oe=Da(Ua);var fe=ce(He());X();fe.default.Cache=Map;function Fa(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(Fa,"arraysEqual");var P=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))||Fa((t.components||[]).sort(),(e.components||[]).sort()))),"isSameProduct"),Dt=n(t=>t.optedin||[],"optedinSelector"),Vn=n(t=>t.optedout||[],"optedoutSelector"),Rr=n(t=>t.autoshipByDefault||{},"autoshipSelector"),La=n(t=>t.defaultFrequencies||{},"defaultFrequenciesSelector"),G=(0,fe.default)(t=>Oe(Dt,Vn,Rr,(e,r,o)=>{let s=e.find(i=>P(t,i));return s||(r.find(i=>P(t,i))?!1:t&&o[t.id]?{id:t.id}:!1)}),t=>JSON.stringify(t)),Ft=(0,fe.default)(t=>Oe(Dt,e=>{let r=e.find(o=>P(t,o));return r||!1}),t=>JSON.stringify(t)),Lt=(0,fe.default)(t=>Oe(Vn,e=>e.find(r=>P(t,r))));var V=(0,fe.default)(t=>Oe(G(t),e=>e&&e.frequency||null)),jt=(0,fe.default)(t=>Oe(La,e=>e[t]&&We(e[t])||null)),Ar=n(t=>t.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase(),"kebabCase"),W=n((t,e,r,o)=>({[r]:t.config&&t.config[r]||e&&e.hasAttribute&&e.hasAttribute(Ar(r))&&e[r]||e.offer&&typeof(e.offer[r]!=="undefined")&&e.offer[r]||o}),"configSelector"),Ce=n(t=>({templates:t.templates||[]}),"templatesSelector");var ja=n((t,e,r=document)=>r.dispatchEvent(new CustomEvent(t,{detail:e})),"dispatchEvent"),Hn=n(t=>({payload:{product:{id:e,components:r}={}}={}}={})=>setTimeout(()=>ja("optin-changed",{productId:e,components:r,optedIn:t}),0),"dispatchOptinChangedEvent"),Ma=[{expressions:[({type:t}={})=>t===D,({type:t}={})=>t===L],fn:Hn(!0)},{expressions:[({type:t}={})=>t===F],fn:Hn(!1)}],Bn=n(t=>e=>r=>{let o=t.getState();Ma.forEach(s=>{s.expressions.some(i=>i(r,o))&&s.fn(r)}),e(r)},"dispatchMiddleware"),zn=n(t=>e=>r=>{e(r);let o=(0,$n.throttle)(500,()=>{jn({...t.getState()})});r.type!==le&&o()},"localStorageMiddleware");function Gn(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__({}):mr,s=[Ko,Bn];r||s.push(zn);let i=o(Yo(...s,...e)),a=hr(t,r?{}:Ln(),i);return window.og=window.og||{},window.og.store=a,a}n(Gn,"makeStore");var Va=Object.defineProperty,Mt=n((t,e)=>Va(t,"name",{value:e,configurable:!0}),"s"),$a=Mt(t=>e=>t.indexOf(e.origin)>=0,"createIsMessageAllowed"),Wn=["https://rc3.ordergroove.com","https://rc3.stg.ordergroove.com","http://localhost:3000",window.location.origin],Yn=Mt(t=>(e,r)=>{Wn.forEach(o=>t.postMessage({ogType:e,...r},o))},"createBroadcastMessage");function Nr(t){let e=$a(Wn),r=Yn(t.source);if(e(t)&&t.data.ogType==="READY"){let o="//static.ordergroove.com/@ordergroove/offers-live-editor/0.4.2/dist/";o.startsWith("//")&&(o=window.location.protocol+o),o.endsWith("/")||(o+="/"),import(`${o}client.js`).then(({initializeClient:s})=>{s(e,r),window.removeEventListener("message",Nr)})}}n(Nr,"c");Mt(Nr,"handleReady");function kr(t=window.opener){t&&t!==window&&(window.addEventListener("message",Nr),Yn(t)("READY"))}n(kr,"w");Mt(kr,"offersLiveEditor");var Vt=null,Ha=n(t=>({dispatch:t}),"defaultMapDispatchToProps"),Qn=n(t=>{if(!Vt)throw new Error("Missing redux store.");return Vt},"resolveStore"),Ba=n((t,e)=>r=>{let{getState:o,dispatch:s}=Qn(r),i=t?t(o(),r):{},a=e(s,r);Object.assign(r,i,a)},"createRecalcProps"),g=n((t,e=Ha)=>r=>{let s=Ba(t,typeof e=="function"?e:i=>Go(e,i));return class extends r{get store(){return Vt}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this._storeUnsubscribe=Qn(this).subscribe(()=>s(this)),s(this)}attributeChangedCallback(i,a,c){super.attributeChangedCallback&&super.attributeChangedCallback(i,a,c),this._storeUnsubscribe&&a!==c&&s(this)}disconnectedCallback(){this._storeUnsubscribe(),super.disconnectedCallback&&super.disconnectedCallback()}}},"connect"),Jn=n(t=>{Vt=t},"setStore");X();var Ir=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],...Ge(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");A();T();var ks=ce(vs());T();var cc=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"),ws=n(t=>t.hasAttribute("product")&&{id:t.getAttribute("product"),...t.hasAttribute("product-components")&&{components:JSON.parse(t.getAttribute("product-components"))}},"buildProduct");var ro=n(t=>{let e=ws(t);if(!e){let r=t.offer;r&&(e=ws(r))}return e},"resolveProduct"),lc=n(t=>{let e=t;for(;e;){if(e.tagName==="OG-OFFER")return e;e=e.nodeType===11?e.host:e.parentNode}},"resolveOffer"),oo=n(t=>class extends t{get offer(){return lc(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"),R=n(t=>class extends oo(t){get product(){return ro(this)}},"withProduct"),tr=n(t=>class extends t{get childOptions(){let e=[],r=null;return this.querySelectorAll("option").forEach(o=>{let s=cc(o.value),i=o.innerText.trim();e.push({value:s,text:i}),!r&&o.selected&&(r=s)}),{options:e,isSelected:r}}},"withChildOptions");var rr={};ur(rr,{autoshipByDefault:()=>uc,eligibilityGroups:()=>Ps,eligible:()=>Os,hasUpcomingOrder:()=>As,hasUpsellGroup:()=>Rs,inStock:()=>no,optedout:()=>dc,regularEligible:()=>hc,subscribed:()=>pc,subscriptionEligible:()=>Cs,upcomingOrderContainsProduct:()=>fc,upsellEligible:()=>Ns});var no=n((t,e)=>(t.inStock||{})[(e.product||{}).id],"inStock"),Os=n((t,e)=>(t.autoshipEligible||{})[(e.product||{}).id]||!1,"eligible"),uc=n((t,e)=>(t.autoshipByDefault||{})[(e.product||{}).id]||!1,"autoshipByDefault"),Cs=n((t,e)=>(t.offerId&&t.offerId!=="0"||!1)&&Os(t,e)&&no(t,e),"subscriptionEligible"),Ps=n((t,e)=>(t.eligibilityGroups||{})[(e.product||{}).id]||null,"eligibilityGroups"),Rs=n((t,e)=>{let r=Ps(t,e);return r===null||!!r.find(o=>o==="upsell"||o==="impulse_upsell")},"hasUpsellGroup"),pc=n((t,e)=>Ft(e.product)(t),"subscribed"),dc=n((t,e)=>Lt(e.product)(t),"optedout"),As=n(t=>!!(t.nextUpcomingOrder&&t.nextUpcomingOrder.public_id),"hasUpcomingOrder"),fc=n((t,e)=>(t.nextUpcomingOrder&&t.nextUpcomingOrder.products||[]).includes((e.product||{}).id),"upcomingOrderContainsProduct"),Ns=n((t,e)=>t.offerId&&t.offerId!=="0"&&t.auth&&no(t,e)&&As(t)&&Rs(t,e),"upsellEligible"),hc=n((t,e)=>Cs(t,e)&&!Ns(t,e),"regularEligible");var mc=n(t=>t.replace(/(\r\n|\n|\r|\s)+/gm,""),"removeWhitespace"),so=class extends R(x){static get properties(){return{...super.properties,state:{type:Object,attribute:!1},test:{type:String}}}render(){return this.test&&ks.default.parse(mc(this.test),r=>rr[r]&&rr[r](this.state,this))?p`
|
|
111
111
|
<slot></slot>
|
|
112
|
-
`:
|
|
112
|
+
`:p``}shouldUpdate(e){return e.size&&this.product&&this.product.id in this.state.autoshipEligible&&this.product.id in this.state.inStock}};n(so,"When");var gc=n(t=>({state:t}),"mapStateToProps"),Is=g(gc)(so);T();A();T();X();var Us={type:Object,converter:{toAttribute(t){return t==null?t:JSON.stringify(t)},fromAttribute(t){return t&&t.match(/[{[]/)?JSON.parse(t):{id:t}}}},ie={type:String,attribute:"default-frequency",converter:{fromAttribute(t){return t&&xr(t)?t:null}}},or={type:Boolean,attribute:!0,reflect:!0},ke={type:Object,attribute:!1};T();var yc=n(t=>class extends t{getOption(e,r=e){let o=Ar(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"),q=yc(x);var M=class extends R(q){static get properties(){return{subscribed:or,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;
|
|
@@ -162,18 +162,18 @@ var lib=(()=>{var ei=Object.create;var ke=Object.defineProperty;var ti=Object.ge
|
|
|
162
162
|
text-align: center;
|
|
163
163
|
overflow: visible;
|
|
164
164
|
}
|
|
165
|
-
`}constructor(){super();this.addEventListener("click",this.handleClick.bind(this))}updated(e){e.has("subscribed")&&(this.frequencyMatch=this.frequency===this.defaultFrequency)}handleClick(){}render(){return this.subscribed&&!this.defaultFrequency?
|
|
165
|
+
`}constructor(){super();this.addEventListener("click",this.handleClick.bind(this))}updated(e){e.has("subscribed")&&(this.frequencyMatch=this.frequency===this.defaultFrequency)}handleClick(){}render(){return this.subscribed&&!this.defaultFrequency?p`
|
|
166
166
|
<slot name="subscribed"></slot>
|
|
167
167
|
<slot name="frequency-mismatch"></slot>
|
|
168
|
-
`:this.subscribed&&this.defaultFrequency===this.frequency?
|
|
168
|
+
`:this.subscribed&&this.defaultFrequency===this.frequency?p`
|
|
169
169
|
<slot name="subscribed"></slot>
|
|
170
170
|
<slot name="frequency-match"></slot>
|
|
171
|
-
`:this.subscribed&&this.defaultFrequency!==this.frequency?
|
|
171
|
+
`:this.subscribed&&this.defaultFrequency!==this.frequency?p`
|
|
172
172
|
<slot name="subscribed"></slot>
|
|
173
173
|
<slot name="frequency-mismatch"></slot>
|
|
174
|
-
`:
|
|
174
|
+
`:p`
|
|
175
175
|
<slot name="not-subscribed"></slot>
|
|
176
|
-
`}};n(
|
|
176
|
+
`}};n(M,"OptinStatus");var J=n((t,e={})=>({subscribed:G(e.product)(t),frequency:V(e.product)(t),...W(t,e,"defaultFrequency"),...Ce(t,e)}),"mapStateToProps"),qs=g(J)(M);var io=class extends M{static get properties(){return{...super.properties,frequency:{type:String,reflect:!0},defaultFrequency:ie,optinButtonLabel:{type:String}}}handleClick(e){this.optinProduct(ro(this),this.defaultFrequency,this.offer),e.preventDefault()}render(){return p`
|
|
177
177
|
<slot name="default">
|
|
178
178
|
<button id="action-trigger" class="btn radio ${this.subscribed?"active":""}"></button>
|
|
179
179
|
<label for="action-trigger">
|
|
@@ -182,7 +182,7 @@ var lib=(()=>{var ei=Object.create;var ke=Object.defineProperty;var ti=Object.ge
|
|
|
182
182
|
</slot>
|
|
183
183
|
</label>
|
|
184
184
|
</slot>
|
|
185
|
-
`}};n(
|
|
185
|
+
`}};n(io,"OptinButton");var Ds=g(J,{optinProduct:ee})(io);T();A();var ao=class extends M{static get properties(){return{...super.properties,label:{type:String}}}handleClick(e){this.optoutProduct(this.product,this.offer),e.preventDefault()}render(){return p`
|
|
186
186
|
<slot name="default">
|
|
187
187
|
<button id="action-trigger" class="btn radio ${this.subscribed?"":"active"}"></button>
|
|
188
188
|
<label for="action-trigger">
|
|
@@ -191,32 +191,32 @@ var lib=(()=>{var ei=Object.create;var ke=Object.defineProperty;var ti=Object.ge
|
|
|
191
191
|
</slot>
|
|
192
192
|
</label>
|
|
193
193
|
</slot>
|
|
194
|
-
`}};n(
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
194
|
+
`}};n(ao,"OptoutButton");var Fs=g(J,{optoutProduct:ve})(ao);T();A();T();X();var Ie=n((t,e)=>{let{every:r,every_period:o}=Ge(t);return r&&o?p`
|
|
195
|
+
${r}
|
|
196
|
+
<og-text key="frequencyPeriods" variant="${o}" pluralize="${r}"></og-text>
|
|
197
|
+
${e&&e===t?p`
|
|
198
|
+
<og-text key="defaultFrequencyCopy"></og-text>
|
|
199
|
+
`:""}
|
|
200
|
+
`:t},"frequencyText"),ot=class extends R(q){static get properties(){return{...super.properties,disabled:{type:Boolean},subscribed:or,frequency:{type:String},defaultFrequency:ie,productDefaultFrequency:{type:String},frequencies:{converter:{fromAttribute:xn}}}}static get styles(){return v`
|
|
201
201
|
:host[hidden] {
|
|
202
202
|
display: none;
|
|
203
203
|
}
|
|
204
204
|
:host {
|
|
205
205
|
display: inline-block;
|
|
206
206
|
}
|
|
207
|
-
`}constructor(){super();this.frequencies=[]}render(){let e=this.frequency||this.defaultFrequency;return
|
|
207
|
+
`}constructor(){super();this.frequencies=[]}render(){let e=this.frequency||this.defaultFrequency;return p`
|
|
208
208
|
<span>
|
|
209
|
-
${this.subscribed&&
|
|
210
|
-
<slot name="subscribed">${
|
|
209
|
+
${this.subscribed&&p`
|
|
210
|
+
<slot name="subscribed">${Ie(e)} </slot>
|
|
211
211
|
`||""}
|
|
212
|
-
${!this.subscribed&&
|
|
212
|
+
${!this.subscribed&&p`
|
|
213
213
|
<slot name="not-subscribed"></slot>
|
|
214
214
|
`||""}
|
|
215
|
-
${this.subscribed&&this.defaultFrequency&&this.defaultFrequency!==this.frequency&&
|
|
215
|
+
${this.subscribed&&this.defaultFrequency&&this.defaultFrequency!==this.frequency&&p`
|
|
216
216
|
<slot name="frequency-mismatch"></slot>
|
|
217
217
|
`||""}
|
|
218
218
|
</span>
|
|
219
|
-
`}};n(
|
|
219
|
+
`}};n(ot,"FrequencyStatus");var nt=n((t,e)=>{var r,o;return{subscribed:G(e.product)(t),frequency:V(e.product)(t),productDefaultFrequency:jt((e.product||{}).id)(t),configDefaultFrequency:(r=t.config)==null?void 0:r.defaultFrequency,frequenciesText:(o=t.config)==null?void 0:o.frequenciesText,...W(t,e,"frequencies"),...W(t,e,"defaultFrequency"),...Ce(t,e)}},"mapStateToProps"),Ls=g(nt)(ot);var co=class extends tr(M){static get properties(){return{...super.properties,frequencies:{type:Array,attribute:!1},frequency:{type:String},defaultFrequency:ie}}static get styles(){return v`
|
|
220
220
|
:host {
|
|
221
221
|
display: inline-block;
|
|
222
222
|
cursor: pointer;
|
|
@@ -226,26 +226,26 @@ var lib=(()=>{var ei=Object.create;var ke=Object.defineProperty;var ti=Object.ge
|
|
|
226
226
|
border-width: var(--og-select-border-width, 1px);
|
|
227
227
|
box-shadow: 0 1px 0 1px rgba(0, 0, 0, 0.04);
|
|
228
228
|
}
|
|
229
|
-
`}get isSelected(){return this.subscribed?this.frequency:"optedOut"}onOptinChange(e){e==="optedOut"?this.optoutProduct(this.product):this.productChangeFrequency(this.product,e)}render(){let{options:e,isSelected:r}=this.childOptions,o=e;return e.length||(o=[{value:"optedOut",text:
|
|
229
|
+
`}get isSelected(){return this.subscribed?this.frequency:"optedOut"}onOptinChange(e){e==="optedOut"?this.optoutProduct(this.product,this.offer):this.productChangeFrequency(this.product,e,this.offer)}render(){let{options:e,isSelected:r}=this.childOptions,o=e;return e.length||(o=[{value:"optedOut",text:p`
|
|
230
230
|
<og-text key="offerOptOutLabel"></og-text>
|
|
231
|
-
`},...(this.frequencies||[]).map(s=>({value:s,text:
|
|
231
|
+
`},...(this.frequencies||[]).map(s=>({value:s,text:Ie(s,this.defaultFrequency)}))]),p`
|
|
232
232
|
<og-select
|
|
233
233
|
.options="${o}"
|
|
234
234
|
.selected="${r}"
|
|
235
235
|
.onChange="${({target:{value:s}})=>this.onOptinChange(s)}"
|
|
236
236
|
></og-select>
|
|
237
|
-
`}};n(
|
|
237
|
+
`}};n(co,"OptinSelect");var js=g((t,e)=>({...J(t,e),...nt(t,e)}),{productChangeFrequency:kt,optoutProduct:ve})(co);T();A();var lo=class extends R(q){static get styles(){return v`
|
|
238
238
|
:host[hidden] {
|
|
239
239
|
display: none;
|
|
240
240
|
}
|
|
241
241
|
:host {
|
|
242
242
|
display: inline-block;
|
|
243
243
|
}
|
|
244
|
-
`}static get properties(){return{...super.properties,upcomingOrderDate:{type:String,attribute:!1},auth:
|
|
244
|
+
`}static get properties(){return{...super.properties,upcomingOrderDate:{type:String,attribute:!1},auth:ke,isPreview:{type:Boolean,attribute:!1},target:{type:String}}}constructor(){super();this.fetchOrders=()=>0,this.addEventListener("click",this.handleClick.bind(this))}updated(e){e.has("auth")&&this.auth&&!this.upcomingOrderDate&&!this.isPreview&&this.fetchOrders()}handleClick(){let e;if(!this.target&&this.offer)e=this.offer.querySelector("og-upsell-modal"),e||(e=this.offer.shadowRoot.querySelector("og-upsell-modal"));else if(this.target)e=document.querySelector(this.target);else throw Error("You must specify a target attribute or place this element as child of og-offer");e&&e.setAttribute("show",!0)}render(){return p`
|
|
245
245
|
<slot>
|
|
246
246
|
<og-next-upcoming-order></og-next-upcoming-order>
|
|
247
247
|
</slot>
|
|
248
|
-
`}};n(
|
|
248
|
+
`}};n(lo,"UpsellButton");var bc=n(t=>({isPreview:t.previewUpsellOffer}),"mapStateToProps"),Ms=g(bc,{fetchOrders:Ut})(lo);T();A();var uo=class extends R(q){static get properties(){return{...super.properties,defaultFrequency:ie,auth:ke,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`
|
|
249
249
|
<og-modal ?show=${this.show} @close=${()=>this.close()} @confirm=${()=>this.confirm()}>
|
|
250
250
|
<div slot="content">
|
|
251
251
|
<slot>
|
|
@@ -283,7 +283,7 @@ var lib=(()=>{var ei=Object.create;var ke=Object.defineProperty;var ti=Object.ge
|
|
|
283
283
|
</slot>
|
|
284
284
|
</span>
|
|
285
285
|
</og-modal>
|
|
286
|
-
`}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(
|
|
286
|
+
`}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(uo,"UpsellModal");var _c=n((t,e)=>({auth:t.auth,offerId:t.offerId,subscribed:G(e.product)(t),frequency:V(e.product)(t),...W(t,e,"defaultFrequency"),nextUpcomingOrder:t.previewUpsellOffer?{public_id:"preview-order-id"}:t.nextUpcomingOrder,isPreview:t.previewUpsellOffer}),"mapStateToProps"),Vs=g(_c,{concludeUpsell:Tn,createIu:Rn})(uo);T();A();var po=class extends M{static get properties(){return{...super.properties,frequency:{type:String}}}handleClick(e){this.subscribed?this.optoutProduct(this.product,this.offer):this.optinProduct(this.product,this.frequency||this.defaultFrequency,this.offer),e.preventDefault()}render(){return p`
|
|
287
287
|
<slot name="default">
|
|
288
288
|
<button id="action-trigger" class="btn checkbox ${this.subscribed?"active":""}"></button>
|
|
289
289
|
<label for="action-trigger">
|
|
@@ -292,13 +292,13 @@ var lib=(()=>{var ei=Object.create;var ke=Object.defineProperty;var ti=Object.ge
|
|
|
292
292
|
></slot>
|
|
293
293
|
</label>
|
|
294
294
|
</slot>
|
|
295
|
-
`}};n(
|
|
295
|
+
`}};n(po,"OptinToggle");var $s=g(J,{optoutProduct:ve,optinProduct:ee})(po);T();var Ec=n((t,e)=>`${t}${parseInt(e,10)>1?"s":""}`,"pluralize"),fo=class extends oo(x){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&&Ec(e,this.pluralize)}render(){return p`
|
|
296
296
|
${this.getText()}
|
|
297
|
-
`}};n(
|
|
298
|
-
${this.label} ${s?
|
|
299
|
-
`}renderFallback(){let e=this.from,r=this.value,o=this.initial?"initial":"ongoing";return
|
|
300
|
-
${
|
|
301
|
-
`}};n(
|
|
297
|
+
`}};n(fo,"Text");var xc=n(t=>({i18n:t.locale||{}}),"mapStateToProps"),Hs=g(xc)(fo);T();var Ue=class{constructor(e){this.value=e,this.className="DiscountAmount"}toString(){return`${this.value}`}};n(Ue,"DiscountAmount");var st=class extends Ue{constructor(e){super(e);this.className="DiscountPercent"}toString(){return`${super.toString()}%`}};n(st,"DiscountPercent");var ho=class extends st{constructor(e){super(e);this.className="ShippingDiscountPercent"}toString(){return this.value===100?"free shipping":super.toString()}};n(ho,"ShippingDiscountPercent");var mo="Discount Percent",go="Discount Amount",Bs="total_price",zs="shipping_total",Gs="sub_total",yo=n(({field:t,object:e,type:r,value:o})=>{let i=[[new st(o),{field:Bs,object:"item",type:mo}],[new Ue(o),{field:Bs,object:"item",type:go}],[new ho(o),{field:zs,object:"order",type:mo}],[new Ue(o),{field:zs,object:"order",type:go}],[new st(o),{field:Gs,object:"order",type:mo}],[new Ue(o),{field:Gs,object:"order",type:go}]].find(([,a])=>a.field===t&&a.object===e&&a.type===r);return i&&i[0]},"discountBuilder");function Sc(t){return!(yo(t).className!==this.incentiveClass||this.incentiveValue&&this.incentiveValue.toString()!==t.value.toString())}n(Sc,"filterIncentives");var bo=class extends R(x){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(Sc.bind({incentiveClass:e,incentiveValue:r}));return p`
|
|
298
|
+
${this.label} ${s?yo(s):this.renderFallback()}
|
|
299
|
+
`}renderFallback(){let e=this.from,r=this.value,o=this.initial?"initial":"ongoing";return p`
|
|
300
|
+
${yo({field:"sub_total",object:"order",type:"Discount Percent",value:this.value})}
|
|
301
|
+
`}};n(bo,"IncentiveText");var Tc=n((t,e)=>({incentives:(t.incentives||{})[e&&e.product&&e.product.id]||{}}),"mapStateToProps"),Ws=g(Tc)(bo);T();A();var _o=class extends tr(ot){static get properties(){return{...super.properties,defaultText:{type:String,attribute:"default-text"}}}static get styles(){return v`
|
|
302
302
|
:host {
|
|
303
303
|
display: inline-block;
|
|
304
304
|
cursor: pointer;
|
|
@@ -309,15 +309,15 @@ var lib=(()=>{var ei=Object.create;var ke=Object.defineProperty;var ti=Object.ge
|
|
|
309
309
|
box-shadow: 0 1px 0 1px rgba(0, 0, 0, 0.04);
|
|
310
310
|
z-index: 1;
|
|
311
311
|
}
|
|
312
|
-
`}set defaultFrequency(e){this._defaultFrequency=e}get defaultFrequency(){let{options:e,isSelected:r}=this.childOptions;return
|
|
312
|
+
`}set defaultFrequency(e){this._defaultFrequency=e}get defaultFrequency(){if(this.configDefaultFrequency)return this.configDefaultFrequency;if(this.productDefaultFrequency)return this.productDefaultFrequency;let{options:e,isSelected:r}=this.childOptions;return r||(e.length?e[0].value:this._defaultFrequency)}get currentFrequency(){return this.frequency?this.frequency:this.defaultFrequency}productChangeFrequency(e,r){this.frequency=r}render(){var o;let e;((o=this.frequencies)==null?void 0:o.length)?e=this.frequencies.map((s,i)=>({value:s,text:this.frequenciesText&&i in this.frequenciesText?this.frequenciesText[i]:Ie(s,this.defaultFrequency)})):{options:e}=this.childOptions,e.length||(e=(this.frequencies||[]).map(s=>({value:s,text:Ie(s,this.defaultFrequency)})));let r=this.defaultFrequency;return e=e.map(({text:s,value:i})=>({text:i===r?`${s} ${(this.defaultText||"").trim()}`:s,value:i})),p`
|
|
313
313
|
<og-select
|
|
314
314
|
.options="${e}"
|
|
315
315
|
.selected="${this.currentFrequency}"
|
|
316
|
-
.onChange="${({target:{value:
|
|
316
|
+
.onChange="${({target:{value:s}})=>{this.productChangeFrequency(this.product,s,this.offer)}}"
|
|
317
317
|
></og-select>
|
|
318
|
-
`}};n(
|
|
319
|
-
${
|
|
320
|
-
`}};n(
|
|
318
|
+
`}};n(_o,"SelectFrequency");var Ys=g(nt,{productChangeFrequency:kt})(_o);T();var vc={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 Qs=n((t,e)=>t instanceof Date?(e||"").toString().replace(/\{\{([-\w]+)\}\}/g,r=>{let o=r.replace(/[{}]/g,""),s=vc[o];if(typeof s=="undefined")return o;let a=new Intl.DateTimeFormat("en-us",s).formatToParts(t),[{value:c}]=a;return c}):t,"formatDate");var Eo=class extends x{static get properties(){return{value:{type:String,reflect:!0},format:{type:String}}}createRenderRoot(){return this}render(){return p`
|
|
319
|
+
${Qs(this.value,this.format||"{{month-long}} {{day}}, {{year-numeric}}")}
|
|
320
|
+
`}};n(Eo,"FormattedDate");var wc=n(t=>({value:t.previewUpsellOffer?new Date:t.nextUpcomingOrder.place}),"mapStateToProps"),Js=g(wc)(Eo);T();var Xs=ce(He());A();z();var Ks=n((t,e)=>n(async function(o){await o({type:je,payload:t}),await o({type:xe}),await o(we({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"),Oc=n((t,e)=>n(async function(o,s){await o({type:Me,payload:t});let{merchantId:i}=s();t?(await o(we({in_stock:{[e]:!0},module_view:{regular:"096135e6650111e9a444bc764e106cf4"},default_frequencies:{[e]:{every:1,every_period:3}},eligibility_groups:{[e]:["subscription","upsell"]},result:"success",autoship:{[e]:!0},modifiers:{}})),await o(vr({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(Tr(i,"sig_field","ts","sig"))):await o(te())},"setPreviewUpsellOfferThunk"),"setPreviewUpsellOffer"),Zs=n((t,e,r)=>async function(o,s){switch(await o({type:K}),await o({type:je,payload:!1}),await o({type:Me,payload:!1}),t){case"regular":o(Ks(!0,r.product.id));break;case"upsell":o(Oc(!0,r.product.id));break;case"subscribed":o(Ks(!0,r.product.id)),o(ee(r.product,"2_2"));break;default:}},"setPreview");A();var Cc=n((...t)=>JSON.stringify(t),"memoizeKey"),Pc=(0,Xs.default)((t,e)=>Object.assign({components:e},t),Cc),xo=class extends q{static get properties(){return{...super.properties,config:{type:Object,attribute:!1},product:Us,productComponents:{type:Array,attribute:"product-components"},offerId:{type:String,attribute:!1},auth:ke,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`
|
|
321
321
|
:host[hidden] {
|
|
322
322
|
display: none;
|
|
323
323
|
}
|
|
@@ -393,11 +393,10 @@ var lib=(()=>{var ei=Object.create;var ke=Object.defineProperty;var ti=Object.ge
|
|
|
393
393
|
</div>
|
|
394
394
|
<div>
|
|
395
395
|
<og-optin-button>
|
|
396
|
-
|
|
397
|
-
|
|
398
396
|
<og-price discount>
|
|
399
397
|
<span slot="prepend">Subscribe and get</span>
|
|
400
398
|
<span slot="append">off</span>
|
|
399
|
+
<og-text key="offerOptInLabel" slot="fallback"></og-text>
|
|
401
400
|
</og-price>
|
|
402
401
|
<og-price regular></og-price>
|
|
403
402
|
<og-price subscription></og-price>
|
|
@@ -465,9 +464,10 @@ var lib=(()=>{var ei=Object.create;var ke=Object.defineProperty;var ti=Object.ge
|
|
|
465
464
|
The product is in your next upcomming order
|
|
466
465
|
</og-when>
|
|
467
466
|
</og-when>
|
|
468
|
-
|
|
467
|
+
|
|
468
|
+
`}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),e.has("product")&&this.product.id&&!this.isPreview&&this.fetchOffer(this.product.id,"pdp",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=Pc(this.product,this.productComponents),o=Object.assign({},this.product,{components:e.get("productComponents")});P(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=>P(r,this.product))&&this.optinProduct({...this.product,...this.productComponents.length&&{components:this.productComponents}},this.defaultFrequency,this)}get isPreview(){return this.preview}render(){return p`
|
|
469
469
|
<slot></slot>
|
|
470
|
-
`}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(
|
|
470
|
+
`}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(xo,"Offer");var Rc=n((t,e)=>({config:t.config,auth:t.auth,offerId:((t.productOffer||{})[(e.product||{}).id]||[])[0],productFrequency:V(e.product)(t),productDefaultFrequency:jt((e.product||{}).id)(t),...W(t,e,"autoshipByDefault",Rr(t)[(e.product||{}).id]),...Lt(e.product)(t)&&{autoshipByDefault:!1},optedin:Dt(t),subscribed:G(e.product)(t),...Ce(t)}),"mapStateToProps"),ei=g(Rc,{fetchOffer:Cn,fetchOrders:Ut,productHasChangedComponents:Sn,optinProduct:ee,setFirstOrderPlaceDate:Un,setProductToSubscribe:qn,setPreview:Zs})(xo);T();var nr=class extends x{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`
|
|
471
471
|
:host[hidden] {
|
|
472
472
|
display: none;
|
|
473
473
|
}
|
|
@@ -579,7 +579,7 @@ var lib=(()=>{var ei=Object.create;var ke=Object.defineProperty;var ti=Object.ge
|
|
|
579
579
|
.btn {
|
|
580
580
|
cursor: pointer;
|
|
581
581
|
}
|
|
582
|
-
`}close(){this.removeAttribute("show"),this.dispatchEvent(new CustomEvent("close"))}confirm(){this.removeAttribute("show"),this.dispatchEvent(new CustomEvent("confirm"))}get confirmButton(){return this.showConfirmButton?
|
|
582
|
+
`}close(){this.removeAttribute("show"),this.dispatchEvent(new CustomEvent("close"))}confirm(){this.removeAttribute("show"),this.dispatchEvent(new CustomEvent("confirm"))}get confirmButton(){return this.showConfirmButton?p`
|
|
583
583
|
<span @click="${()=>this.confirm()}">
|
|
584
584
|
<slot name="confirm" class="btn">
|
|
585
585
|
<button class="og-modal__btn og-modal__btn-primary og-modal__confirm" @click="${()=>this.confirm()}">
|
|
@@ -587,7 +587,7 @@ var lib=(()=>{var ei=Object.create;var ke=Object.defineProperty;var ti=Object.ge
|
|
|
587
587
|
</button>
|
|
588
588
|
</slot>
|
|
589
589
|
</span>
|
|
590
|
-
`:
|
|
590
|
+
`:p``}get cancelButton(){return this.showCancelButton?p`
|
|
591
591
|
<span @click="${()=>this.close()}" class="btn">
|
|
592
592
|
<slot name="cancel">
|
|
593
593
|
<button class="og-modal__btn og-modal__cancel" @click="${()=>this.close()}">
|
|
@@ -595,7 +595,7 @@ var lib=(()=>{var ei=Object.create;var ke=Object.defineProperty;var ti=Object.ge
|
|
|
595
595
|
</button>
|
|
596
596
|
</slot>
|
|
597
597
|
</span>
|
|
598
|
-
`:
|
|
598
|
+
`:p``}render(){return this.show?p`
|
|
599
599
|
<div class="og-modal is-open" aria-hidden="true">
|
|
600
600
|
<div class="og-modal__overlay" tabindex="-1">
|
|
601
601
|
<div class="og-modal__container" role="dialog" aria-modal="true">
|
|
@@ -614,7 +614,7 @@ var lib=(()=>{var ei=Object.create;var ke=Object.defineProperty;var ti=Object.ge
|
|
|
614
614
|
</div>
|
|
615
615
|
</div>
|
|
616
616
|
</div>
|
|
617
|
-
`:
|
|
617
|
+
`:p``}};n(nr,"Modal");T();var sr=class extends x{static get styles(){return v`
|
|
618
618
|
:host {
|
|
619
619
|
display: inline-block;
|
|
620
620
|
color: inherit;
|
|
@@ -647,14 +647,7 @@ var lib=(()=>{var ei=Object.create;var ke=Object.defineProperty;var ti=Object.ge
|
|
|
647
647
|
select::-ms-expand {
|
|
648
648
|
display: none;
|
|
649
649
|
}
|
|
650
|
-
select:hover {
|
|
651
|
-
// border-color: #888;
|
|
652
|
-
}
|
|
653
650
|
select:focus {
|
|
654
|
-
// border-color: #aaa;
|
|
655
|
-
// box-shadow: 0 0 1px 3px rgba(59, 153, 252, 0.7);
|
|
656
|
-
// box-shadow: 0 0 0 3px -moz-mac-focusring;
|
|
657
|
-
// color: #222;
|
|
658
651
|
outline: none;
|
|
659
652
|
}
|
|
660
653
|
select option {
|
|
@@ -673,18 +666,14 @@ var lib=(()=>{var ei=Object.create;var ke=Object.defineProperty;var ti=Object.ge
|
|
|
673
666
|
line-height: 0.2em;
|
|
674
667
|
transform: scaleY(0.5);
|
|
675
668
|
}
|
|
676
|
-
`}static get properties(){return{options:{type:Array},selected:{type:String}}}render(){return
|
|
677
|
-
<select @change="${this.onChange
|
|
678
|
-
${this.options.map(
|
|
679
|
-
<option value="${
|
|
669
|
+
`}static get properties(){return{options:{type:Array},selected:{type:String}}}render(){return p`
|
|
670
|
+
<select @change="${n(r=>this.onChange(r),"handleOnChange")}">
|
|
671
|
+
${this.options.map(r=>p`
|
|
672
|
+
<option value="${r.value}" ?selected=${r.value===this.selected}>${r.text}</option>
|
|
680
673
|
`)}
|
|
681
674
|
</select>
|
|
682
675
|
<span>▼</span>
|
|
683
|
-
|
|
684
|
-
<path d="M10.5 15l7.5 7.5 7.5-7.5z" />
|
|
685
|
-
<path d="M0 0h36v36h-36z" fill="none" />
|
|
686
|
-
</svg> -->
|
|
687
|
-
`}};n(Zt,"Select");v();var Xt=class extends x{static get properties(){return{placement:{type:String,default:"bottom"}}}static get styles(){return w`
|
|
676
|
+
`}};n(sr,"Select");T();var ir=class extends x{static get properties(){return{placement:{type:String,default:"bottom"}}}static get styles(){return v`
|
|
688
677
|
:host[hidden] {
|
|
689
678
|
display: none;
|
|
690
679
|
}
|
|
@@ -834,7 +823,7 @@ var lib=(()=>{var ei=Object.create;var ke=Object.defineProperty;var ti=Object.ge
|
|
|
834
823
|
pointer-events: auto;
|
|
835
824
|
transform: translateY(0px);
|
|
836
825
|
}
|
|
837
|
-
`}connectedCallback(){super.connectedCallback(),this.showTooltip=this.showTooltip.bind(this),this.addEventListener("mouseenter",this.showTooltip)}showTooltip(){let r=this.shadowRoot.querySelector(".trigger").getBoundingClientRect(),o=this.shadowRoot.querySelector(".content"),s=o.getBoundingClientRect();!this.placement||this.placement==="top"||this.placement==="bottom"?o.style.left=`${(-1*s.width+r.width)/2}px`:(this.placement==="left"||this.placement==="right")&&(o.style.top=`${(-1*s.height+r.height)/2}px`)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("mouseenter",this.showTooltip),this.removeEventListener("mouseout",this.hideTooltip)}render(){return
|
|
826
|
+
`}connectedCallback(){super.connectedCallback(),this.showTooltip=this.showTooltip.bind(this),this.addEventListener("mouseenter",this.showTooltip)}showTooltip(){let r=this.shadowRoot.querySelector(".trigger").getBoundingClientRect(),o=this.shadowRoot.querySelector(".content"),s=o.getBoundingClientRect();!this.placement||this.placement==="top"||this.placement==="bottom"?o.style.left=`${(-1*s.width+r.width)/2}px`:(this.placement==="left"||this.placement==="right")&&(o.style.top=`${(-1*s.height+r.height)/2}px`)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("mouseenter",this.showTooltip),this.removeEventListener("mouseout",this.hideTooltip)}render(){return p`
|
|
838
827
|
<span class="tooltip">
|
|
839
828
|
<span class="trigger">
|
|
840
829
|
<slot name="trigger">
|
|
@@ -847,12 +836,12 @@ var lib=(()=>{var ei=Object.create;var ke=Object.defineProperty;var ti=Object.ge
|
|
|
847
836
|
</slot>
|
|
848
837
|
</div>
|
|
849
838
|
</span>
|
|
850
|
-
`}};n(
|
|
839
|
+
`}};n(ir,"Tooltip");var{TestWizard:Nc}=(ri(),ti);function So(){let t="og-test-wizard";customElements.get(t)||customElements.define(t,Nc);let e=document.createElement(t);document.body.appendChild(e)}n(So,"default");var To=[79,71,68,69,86],oi=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===To[t]){let o=To[t];setTimeout(function(){t<=o&&(t=0)},5e3),t+=1,t>=To.length&&So()}else t=0},!1)},"enable");X();z();X();var vo=n((t=[],e)=>{switch(e.type){case K:return[];case le:return e.newValue?e.newValue.optedin:t;case D:case L:let[[r],o]=t.reduce((s,i)=>s[P(e.payload.product,i)?0:1].push(i)&&s,[[],[]]);return(o||[]).concat({...r,...e.payload.product,frequency:e.payload.frequency});case F:return t.filter(s=>!P(e.payload.product,s));case Le:return t.map(s=>P(e.payload.product,s)?{...s,...e.payload.newProduct}:s);case Et:return t.filter(s=>!P(e.payload.product,s));case Se:return[];default:return t}},"optedin"),wo=n((t=[],e)=>{switch(e.type){case K:return[];case le:return e.newValue?e.newValue.optedout:t;case D:case L:return t.filter(s=>!P(e.payload.product,s));case F:let[[r],o]=t.reduce((s,i)=>s[P(e.payload.product,i)?0:1].push(i)&&s,[[],[]]);return(o||[]).concat({...r,...e.payload.product,frequency:e.payload.frequency});case Le:return t.map(s=>P(e.payload.product,s)?{...s,...e.payload.newProduct}:s);case Se:return[];default:return t}},"optedout"),Oo=n((t={},{type:e,payload:r})=>{switch(e){case ht:return r&&r.count>0?{...t,...r.results[0]&&{...r.results[0],place:new Date(Date.parse(r.results[0].place.replace(/-/gi,"/")))}}:t;case mt:return{...t,products:(r.results||[]).map(o=>o.product)};case _t:return{...t,...r,public_id:r.order,...r.product&&{products:(t.products||[]).concat(r.product)}};default:return t}},"nextUpcomingOrder"),kc=n((t={},e)=>{switch(e.type){case I:return{...t,...e.payload.autoship};default:return t}},"autoshipEligible"),Ic=n((t={},e)=>{switch(e.type){case I:return{...t,...e.payload.in_stock};default:return t}},"inStock"),Co=n((t={},e)=>{switch(e.type){case I:return{...t,...e.payload.eligibility_groups};default:return t}},"eligibilityGroups"),ni=n((t,e)=>t.map(r=>({...e[r],id:[r][0]})),"mapIncentive"),Po=n((t={},e)=>{switch(e.type){case I:return{...t,...[...new Set(Object.keys(e.payload.incentives||{}))].reduce((r,o)=>({...r,[o]:Object.entries(e.payload.incentives).filter(([s])=>s===o).reduce((s,[,{initial:i,ongoing:a}])=>({...s,initial:[...s.initial||[],...ni(i,e.payload.incentives_display)],ongoing:[...s.ongoing||[],...ni(a,e.payload.incentives_display)]}),{})}),{})};default:return t}},"incentives"),Uc=n((t={},e)=>{switch(e.type){case D:case L:return{...t,[e.payload.product]:e.payload.frequency};case F:return{...t,[e.payload.product]:void 0};default:return t}},"frequency"),Ro=n((t=!1,e)=>{switch(e.type){case ft:return{...e.payload};case xe:return!1;default:return t}},"auth"),Ao=n((t="",e)=>{switch(e.type){case ut:return e.payload;default:return t}},"merchantId"),No=n((t=null,e)=>{switch(e.type){case dt:return e.payload;default:return t}},"authUrl"),qc=n((t={},e)=>{switch(e.type){case I:return{...t,offerId:(e.payload.module_view||{}).regular,...e.payload.modifiers};default:return t}},"offer"),Dc=n((t="",e)=>{switch(e.type){case I:return(e.payload.module_view||{}).regular||"";default:return t}},"offerId"),ko=n((t=null,e)=>{switch(e.type){case K:return null;case pt:return e.payload;default:return t}},"sessionId"),Fc=n((t={},e)=>{switch(e.type){case I:return{...t,...Object.entries(e.payload.autoship).map(([r])=>({[r]:Object.keys(e.payload.modifiers)})).reduce((r,o)=>({...r,...o}))};case Se:return{};default:return t}},"productOffer"),Io=n((t={},e)=>{switch(e.type){case wt:return{...t,[e.payload.product]:e.payload.firstOrderPlaceDate};default:return t}},"firstOrderPlaceDate"),Uo=n((t={},e)=>{switch(e.type){case Ot:return{...t,[e.payload.product]:e.payload.productToSubscribe};default:return t}},"productToSubscribe"),it=n((t={},e)=>{switch(e.type){case gt:return{...t,name:"staging",apiUrl:"https://staging.om.ordergroove.com",legoUrl:"https://staging.restapi.ordergroove.com"};case yt:return{...t,name:"dev",apiUrl:"https://dev.om.ordergroove.com",legoUrl:"https://dev.restapi.ordergroove.com"};case bt:return{...t,name:"prod",apiUrl:"https://om.ordergroove.com",legoUrl:"https://restapi.ordergroove.com"};default:return t}},"environment"),qo=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 xt:return{...t,...e.payload};default:return t}},"locale"),Lc=n((t={offerType:"radio"},e)=>{switch(e.type){case St:return{...t,...e.payload,defaultFrequency:e.payload.defaultFrequency?We(e.payload.defaultFrequency):t.defaultFrequency,frequencies:e.payload.frequencies?e.payload.frequencies.map(We):t.frequencies};default:return t}},"config"),Do=n((t=!1,e)=>{switch(e.type){case je:return e.payload;default:return t}},"previewStandardOffer"),Fo=n((t=!1,e)=>{switch(e.type){case Me:return e.payload;default:return t}},"previewUpsellOffer"),Lo=n((t=[],e)=>{switch(e.type){case I:return{...t,...e.payload.autoship_by_default};default:return t}},"autoshipByDefault"),jo=n((t=[],e)=>{switch(e.type){case I:return{...t,...e.payload.default_frequencies};default:return t}},"defaultFrequencies"),Mo=n((t=[],e)=>{switch(e.type){case vt:return[...e.payload||[]];case Tt:return[e.payload,...t];default:return t}},"templates"),jc=n((t={},e)=>{switch(e.type){case H:return{...e.payload};default:return t}},"productPlans"),si=at({optedin:vo,optedout:wo,nextUpcomingOrder:Oo,autoshipEligible:kc,inStock:Ic,eligibilityGroups:Co,incentives:Po,frequency:Uc,auth:Ro,merchantId:Ao,authUrl:No,offer:qc,offerId:Dc,sessionId:ko,productOffer:Fc,firstOrderPlaceDate:Io,productToSubscribe:Uo,environment:it,locale:qo,config:Lc,previewStandardOffer:Do,previewUpsellOffer:Fo,autoshipByDefault:Lo,defaultFrequencies:jo,templates:Mo,productPlans:jc});z();T();var Vo=class extends R(q){static get properties(){return{...super.properties,regular:{type:Boolean,reflect:!0},subscription:{type:Boolean,reflect:!0},discount:{type:Boolean,reflect:!0},frequency:{type:Object},productPlans:{type:Object}}}get value(){var l,u;let e=(l=this.product.id)==null?void 0:l.split(":")[0],r=this.frequency||((u=this.offer)==null?void 0:u.defaultFrequency),s=(this.productPlans[e]||{})[r]||[];if(!s)return"";let[i,a,c]=s;return c===i?"":this.regular?i:this.discount?a:c}render(){let e=this.value;return e?p`
|
|
851
840
|
<slot name="prepend"></slot>
|
|
852
841
|
${e}
|
|
853
842
|
<slot name="append"></slot>
|
|
854
|
-
`:
|
|
855
|
-
<slot></slot>
|
|
856
|
-
`}};n(
|
|
843
|
+
`:p`
|
|
844
|
+
<slot name="fallback"></slot>
|
|
845
|
+
`}};n(Vo,"Price");var Mc=n((t,e)=>{var r;return{productPlans:t.productPlans,frequency:((r=e.offer)==null?void 0:r.frequency)||V(e.product)(t)}},"mapStateToProps"),ii=g(Mc)(Vo);try{customElements.define("og-when",Is),customElements.define("og-text",Hs),customElements.define("og-incentive-text",Ws),customElements.define("og-offer",ei),customElements.define("og-select-frequency",Ys),customElements.define("og-optout-button",Fs),customElements.define("og-optin-toggle",$s),customElements.define("og-optin-status",qs),customElements.define("og-optin-button",Ds),customElements.define("og-optin-select",js),customElements.define("og-upsell-button",Ms),customElements.define("og-frequency-status",Ls),customElements.define("og-modal",nr),customElements.define("og-select",sr),customElements.define("og-tooltip",ir),customElements.define("og-upsell-modal",Vs),customElements.define("og-next-upcoming-order",Js),customElements.define("og-price",ii)}catch{console.info("OG WebComponents already registered, skipping.")}function $o(t){oi(),Jn(t);let e=!1,r={store:t,isReady:()=>e,setEnvironment(o){return t.dispatch(Or(o)),this},setMerchantId(o){return t.dispatch(vn(o)),this},setAuthUrl(o){return t.dispatch(wn(o)),this},getProductsForPurchasePost(o=[]){return Ir(t.getState(),o)},getOptins(o=[]){return Ir(t.getState(),o)},clear(){t.dispatch(Pn())},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(Nn(o)),this},setLocale(o){return t.dispatch(An(o)),this},addTemplate(o,s,i){return t.dispatch(kn(o,s,i)),this},setTemplates(o){return t.dispatch(In(o)),this},setPublicPath(o){return this},resolveSettings(o,s,i,a=t){if(o&&s&&i){let c=[];i.product?c.push(i.product):i.cart&&Array.isArray(i.cart.products)&&(c=c.concat(i.cart.products));let{apiUrl:l}=it({},Or(s)),{sessionId:u}=a.getState();u&&c.forEach(f=>{Z.fetchOffer(l,o,u,`${f}`,Ve)}),i.product_discounts&&typeof i.product_discounts=="object"&&a.dispatch({type:H,payload:i.product_discounts})}},initialize(o,s,i){var c;e||r.resolveSettings(o,s,window.og_settings,t);let a=t.getState();return o&&o!==a.merchantId&&r.setMerchantId(o),s&&s!==((c=a.environment)==null?void 0:c.name)&&r.setEnvironment(s),i&&r.setAuthUrl(i),e?console.warn("og.offers has been initialized already. Skipping."):window.addEventListener("storage",Mn(t)),arguments.length===3&&(t.dispatch(qt()),t.dispatch(On())),e=!0,this}};return window.OG=window.OG||{},Object.assign(window.OG,r),Object.assign(r.initialize,r),kr(),r}n($o,"makeApi");z();var cr=n(t=>`$${t.toString().replace(/(\d\d)$/,".$1")}`,"money"),Vc=n(t=>`${t}%`,"percentage"),$c=n(t=>{let e="%";return(t==null?void 0:t.price_adjustments.length)>0&&(t.price_adjustments[0].value_type==="percentage"?e=Vc(t.price_adjustments[0].value):t.price_adjustments[0].value?e=cr(t.price_adjustments[0].value):e=cr(t.compare_at_price-t.price)),[cr(t.compare_at_price),e,cr(t.price)]},"mapSellingPlanToDiscount"),Hc=n((t,e)=>({...t,[e.id]:e.available}),"productOrVariantInStockReducer"),ai=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)]:$c(e)}},"sellingPlanAllocationsReducer"),Bc=n((t={},e)=>{if(H===e.type)return Object.entries(e.payload).reduce(ai,t);if(ue===e.type){let{payload:r}=e;return r.items.reduce((o,s)=>({...o,[s.key]:!0}),t)}if(B===e.type){let{payload:r}=e;return[r,...(r==null?void 0:r.variants)||[]].reduce((o,s)=>{var i;return{...o,[s.id]:((i=s.selling_plan_allocations)==null?void 0:i.length)>0}},t)||t}return t},"autoshipEligible"),zc=n((t={frequencies:[],offerType:"radio"},e)=>{var r,o,s,i,a,c,l;if(H===e.type){let u=[...new Set(Object.values(e.payload).map(Object.keys).flat())];return{...t,frequencies:u}}if(B===e.type){let u=e.payload,f=(s=(o=(r=u==null?void 0:u.selling_plan_groups)==null?void 0:r[0])==null?void 0:o.selling_plans)==null?void 0:s.map(({id:d})=>`${d}`);if(f==null?void 0:f.length){let d=((l=(c=(a=(i=u==null?void 0:u.selling_plan_groups)==null?void 0:i[0])==null?void 0:a.options)==null?void 0:c[0])==null?void 0:l.values)||f;return{...t,defaultFrequency:f[0],frequencies:f,frequenciesText:d}}}return t},"config"),Gc=n((t={},e)=>{if(H===e.type)return Object.entries(e.payload).reduce(ai,t);if(ue===e.type)return e.payload.items.reduce((o,s)=>({...o,[s.key]:!0}),t);if(B===e.type){let r=e.payload;return[r,...r==null?void 0:r.variants].reduce(Hc,t)||t}return t},"inStock"),Wc=n((t={},e)=>t,"offer"),Yc=n((t="",e)=>"native-shopify-offer","offerId"),Qc=n((t=[],e)=>ue===e.type?e.payload.items.reduce((o,s)=>s.selling_plan_allocation?[...o,{id:s.key,frequency:`${s.selling_plan_allocation.selling_plan.id}`}]:o,[]):vo(t,e),"optedin"),Jc=n((t={},e)=>t,"productOffer"),Kc=n((t={},e)=>{if(B===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 ue===e.type?e.payload.items.reduce((o,s)=>s.selling_plan_allocation?{...o,[s.key]:ci({},s.selling_plan_allocation)}:o,t)||t:H===e.type?{...e.payload}:t},"productPlans"),li=at({auth:Ro,authUrl:No,autoshipByDefault:Lo,autoshipEligible:Bc,config:zc,defaultFrequencies:jo,eligibilityGroups:Co,environment:it,firstOrderPlaceDate:Io,incentives:Po,inStock:Gc,locale:qo,merchantId:Ao,nextUpcomingOrder:Oo,offer:Wc,offerId:Yc,optedin:Qc,optedout:wo,previewStandardOffer:Do,previewUpsellOffer:Fo,productOffer:Jc,productPlans:Kc,productToSubscribe:Uo,sessionId:ko,templates:Mo});var ui=ce(He());z();var fi,lr=((fi=window.Shopify)==null?void 0:fi.routes.root)||"/",Zc=`${lr}cart`,Xc=`${lr}cart/change.js`,el=`${lr}cart.js`,tl=`${lr}products/`;async function rl(t){let e=ol();if(e)try{t.dispatch({type:B,payload:await di(e)})}catch(r){console.warn("OG: Unable to fetch product details for PDP",r)}}n(rl,"setupPdp");var pi=n(async()=>await(await fetch(el)).json(),"getCart");function ol(){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(ol,"guessProductHandle");var di=(0,ui.default)(async t=>(await fetch(`${tl}${t}.js`)).json());async function nl(t){let e=await pi();t.dispatch({type:ue,payload:e});let{items:r}=e;(await Promise.all(Array.from(new Set(r.map(({handle:s})=>s))).map(di))).forEach(s=>t.dispatch({type:B,payload:s}))}n(nl,"setupCart");async function sl(t,e){var d;let r=t.payload.offer,o=t.payload.frequency||null;if(!(r==null?void 0:r.isCart))return;let s=r.closest(".shopify-section"),i=((s==null?void 0:s.id.match(/^shopify-section-(.+)/))||[])[1],a=t.payload.product.id,l=(await pi()).items.find(m=>m.key===a),u=await fetch(Xc,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:a,quantity:l.quantity,properties:l.properties,selling_plan:o||null,sections:i?[i]:void 0})});if(u.status!==200)throw new Error("Cart not updated");let f=(d=await u.json())==null?void 0:d.sections;if(f&&i in f){let m=f[i],y=new DOMParser().parseFromString(m.toString()||"","text/html").getElementById("shopify-section-"+i);s.innerHTML=y.innerHTML}else window.location.href.endsWith(Zc)&&window.location.reload()}n(sl,"synchronizeCartOptin");function il(t,e,r){let o=t.querySelector(`[name="${e}"]`);if(o&&!r){o.remove();return}o||(o=document.createElement("input"),o.type="hidden",o.name=e,t.appendChild(o)),o.value=r}n(il,"getOrCreateHidden");function al(t,e){[...document.querySelectorAll("[name=id]")].forEach(r=>{var a;let o=r.value,i=(a=Ft({id:o})(t.getState()))==null?void 0:a.frequency;il(r.form,"selling_plan",i)})}n(al,"synchronizeSellingPlan");function Ho(t){return e=>r=>{var o;switch(r.type){case D:case F:case L:break;case Fe:((o=r.payload.offer)==null?void 0:o.isCart)?nl(t):rl(t);default:}switch(e(r),r.type){case D:case F:case L:sl(r,t);case Fe:case B:al(t,r.payload.offer);break;default:}}}n(Ho,"shopifyMiddleware");Sr();var hi=Gn(...Nt.shopify_selling_plans?[li,Ho]:[si]),S=$o(hi),mi=S.isReady,cl=S.addOptinChangedCallback,ll=S.addTemplate,ul=S.clear,pl=S.config,dl=S.disableOptinChangedCallbacks,fl=S.getOptins,hl=S.getProductsForPurchasePost,gi=S.initialize,ml=S.previewMode,gl=S.register,yl=S.resolveSettings,bl=S.setAuthUrl,_l=S.setEnvironment,El=S.setLocale,xl=S.setMerchantId,Sl=S.setPublicPath,Tl=S.setTemplates,vl=S.setupCart,wl=S.setupProduct,Ol=S.setupProducts,Cl=S.initialize;n(function t(){if(document.readyState==="loading"){window.addEventListener("DOMContentLoaded",t);return}if(mi())return;let e=document.querySelector('script[src^="https://static.ordergroove"],script[src^="https://staging.static.ordergroove"]');if(!e)return;let r=new URL(e.src),o=r.host.startsWith("staging")?"staging":"prod",s=r.pathname.split("/")[1];!o&&!s||gi(s,o)},"autoInitializeOffers")();return Pl;})();
|
|
857
846
|
; return lib; });
|
|
858
847
|
//# sourceMappingURL=offers.js.map
|