"use strict";(self.webpackChunkui=self.webpackChunkui||[]).push([[8],{74:function(t,e,i){var n=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))((function(a,o){function r(t){try{l(n.next(t))}catch(t){o(t)}}function c(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?a(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(r,c)}l((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.initLogicOnClientSideStateRelated=e.initLogicOnClientSide=e.getLinkerParam=e.setCartTokenCookieForNativeShopifyFeatures=e.setCartTotalCookie=e.setCartQuantityCookie=e.setVariantParamInQueryString=e.initAttentionMessageTitle=e.initWeLoveYouTitle=e.changeVariantSideEffects=e.getInitialVariant=void 0;const a=i(43),o=i(4),r=i(100),c=i(101);let l;function u(t){var e;if("undefined"==typeof document)return;const i=document.title;let n=null,a=null!==(e=null==t?void 0:t.default)&&void 0!==e?e:"We miss you ❤",r=0;document.addEventListener("visibilitychange",(function(){var e;const c=!document.hidden,l=(0,o.getAssignment)("pageTabTitle");l&&t[l]&&(a=null!==(e=t[l])&&void 0!==e?e:"We miss you ❤"),c?(r>0&&(0,o.logOutcome)("returnToHiddenPage"),document.title=i,n&&clearInterval(n)):(n=setInterval((function(){document.title===a?document.title=i:document.title=a}),2e3),r++)}))}function d(t){if("undefined"!=typeof window&&"URLSearchParams"in window){const e=new URLSearchParams(window.location.search);window.location.pathname.includes("products")&&(e.set("variant",t),history.pushState(null,"",`${window.location.pathname}?${e.toString()}`))}}e.getInitialVariant=function(t,e){var i,n,a,o;const r=null!==(i=e[0])&&void 0!==i?i:{id:"",price:"",compareAtPrice:"",title:"",availableForSale:!1,quantityAvailable:0,currentlyNotInStock:!1,image:{src:"",alt:""},sellingPlan:{id:0,mode:"",pct:0},sku:"",priceCurrency:"USD",selectedOptions:[],colorId:"",cartImage:{src:"",alt:""},mediaContentCarousel:{images:[]},shippingDate:"",shippingOffset:0,specialEdition:"",allowedCountries:[],restrictedCountries:[],nutritionFactsTile:{heading:"",text:"",media:{src:"",alt:"",type:""}},description:"",bannerText:"",hideVariant:!1,quantityOption:{title:"",quantity:""},outOfStock:!1,colorData:{swatch_src:"",swatch_hex:""},bundle:null,onSale:!1};function c(t){var i,n;const a=e.findIndex((e=>e.id===t));if(-1===a){const t={initialCurrentVariantIndex:0,initialVariant:r};return d(null!==(n=null===(i=null==t?void 0:t.initialVariant)||void 0===i?void 0:i.id)&&void 0!==n?n:""),t}return{initialCurrentVariantIndex:a,initialVariant:e[a]}}if("undefined"==typeof window)return c(t);if(!("URLSearchParams"in window))return c(t);const l=new URLSearchParams(window.location.search).get("variant")||t,u=c(l);return 0===u.initialCurrentVariantIndex&&l!==(null===(n=null==u?void 0:u.initialVariant)||void 0===n?void 0:n.id)||d(null!==(o=null===(a=null==u?void 0:u.initialVariant)||void 0===a?void 0:a.id)&&void 0!==o?o:""),u},e.changeVariantSideEffects=function(t,e){var i,n;e.colorId.includes("lisa-frank")?null===(i=document.querySelector(".app"))||void 0===i||i.classList.add("lisa-frank"):null===(n=document.querySelector(".app"))||void 0===n||n.classList.remove("lisa-frank"),clearTimeout(l),l=setTimeout((()=>{a.outsmartlyDataLayer.push({event:"VIEW_PRODUCT",payload:{product:t,variant:e}}),d(e.id)}),2e3)},e.initWeLoveYouTitle=function(){if("undefined"==typeof document)return;const t=document.title,e="We miss you ❤";let i=null;document.addEventListener("visibilitychange",(function(){document.hidden?i=setInterval((function(){document.title===e?document.title=t:document.title=e}),2e3):(document.title=t,i&&clearInterval(i))}))},e.initAttentionMessageTitle=u,e.setVariantParamInQueryString=d,e.setCartQuantityCookie=function(t){document.cookie=`cart_quantity=${t}; expires=Tue, 19 Jan 2038 03:14:07 UTC`},e.setCartTotalCookie=function(t,e){document.cookie=`cart_total=${t}*display${e}; expires=Tue, 19 Jan 2038 03:14:07 UTC; path=/`},e.setCartTokenCookieForNativeShopifyFeatures=function(t){document.cookie=`cart=${t}; expires=Tue, 19 Jan 2038 03:14:07 UTC`},e.getLinkerParam=function(){return new Promise(((t,e)=>{if("undefined"==typeof window)return t("");const{ga:i}=window;if(void 0===i)return t("");const n=()=>i.getAll().forEach((e=>t(e.get("linkerParam").replace("_ga=",""))));if(i.loaded)n();else{const t=setInterval((()=>{i.loaded&&(clearInterval(t),n())}),1e3)}}))},e.initLogicOnClientSide=function(t,e){var i,o;return n(this,void 0,void 0,(function*(){const{product:n,pageTabTitlesData:l}=t;if(u(l),"undefined"!=typeof window)if(a.outsmartlyDataLayer.push({event:"PAGE_VIEW",payload:{url:window.location.href}}),window.location.pathname.includes("products"))a.outsmartlyDataLayer.push({event:"VIEW_PRODUCT",payload:{product:n,variant:Object.assign(Object.assign({},e),{image:Object.assign(Object.assign({},null==e?void 0:e.image),{src:(0,r.changeFromFastImageToShopifyCdn)(null===(i=null==e?void 0:e.image)||void 0===i?void 0:i.src)})})}});else{yield(0,c.initBentoAnalytics)({elevar:!0});const e=null===(o=t.optionalProducts)||void 0===o?void 0:o.optionalProductsData;(e?Object.values(e).flat():[]).map((t=>{const e=t.product,i=t.variant;return{id:e.id,title:e.title,description:"",handle:e.handle,vendor:e.vendor,price:i.price,quantity:t.quantity,productType:e.productType,compareAtPrice:i.compareAtPrice}})),window.location.pathname}}))},e.initLogicOnClientSideStateRelated=function(t,e){if("undefined"!=typeof window){const{searchParams:i}=new URL(window.location.href),n=i.get("discount");n&&setTimeout((()=>{t({newCheckout:Object.assign(Object.assign({},e().newCheckout),{discount:n})})}),100),window.location.search.includes("cart=true")&&setTimeout((()=>{e().setShowCart(!0)}),100)}}}}]);