"use strict";(self.webpackChunkui=self.webpackChunkui||[]).push([[8],{17:function(i,e,t){var n=this&&this.__awaiter||function(i,e,t,n){return new(t||(t=Promise))((function(o,l){function a(i){try{c(n.next(i))}catch(i){l(i)}}function r(i){try{c(n.throw(i))}catch(i){l(i)}}function c(i){var e;i.done?o(i.value):(e=i.value,e instanceof t?e:new t((function(i){i(e)}))).then(a,r)}c((n=n.apply(i,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.useLogCollection=e.useLogViewContent=e.useLogViewCart=e.initAnalytics=void 0;const o=t(361),l=t(8),a=t(3),r=t(23);e.initAnalytics=()=>n(void 0,void 0,void 0,(function*(){if("undefined"!=typeof window)return yield(0,o.initBentoAnalytics)({elevar:!0}).catch((i=>console.error(i)))})),e.useLogViewCart=i=>(0,a.useEffect)((()=>{(void 0===i||i)&&(0,e.initAnalytics)().then((()=>{(0,o.logViewCart)()}))}),[i]),e.useLogViewContent=(i,t)=>n(void 0,void 0,void 0,(function*(){return(0,a.useEffect)((()=>{(0,e.initAnalytics)().then((()=>{(0,o.logViewContent)(((i,e)=>{var t,n,o,a,c,u,d,s,v,p,_,f,h,g;const m=null!==(t=(0,r.safeParseFloat)(e.price.amount))&&void 0!==t?t:i.price,w=(0,r.safeParseFloat)(null!==(o=null===(n=e.compareAtPrice)||void 0===n?void 0:n.amount)&&void 0!==o?o:"0")||(0,r.safeParseFloat)(null!==(d=null!==(c=null===(a=i.compareAtPrice)||void 0===a?void 0:a.maxVariantPrice.amount)&&void 0!==c?c:null===(u=i.compareAtPrice)||void 0===u?void 0:u.minVariantPrice.amount)&&void 0!==d?d:e.price.amount)||m;return{id:e.sku,vendor:(0,l.getEnvConfig)().site.title,title:i.title,handle:i.handle,price:m,sku:e.sku,image:(null===(s=e.image)||void 0===s?void 0:s.src)||"",product_type:i.productType,variant_title:e.title,variant_id:null!==(v=(0,r.safeParseInt)(e.id))&&void 0!==v?v:0,product_id:null!==(p=(0,r.safeParseInt)(i.id))&&void 0!==p?p:0,product_title:i.title,options_with_values:e.selectedOptions,grams:0,taxable:!1,url:document.referrer,product_description:i.descriptionHtml.__html,product_has_only_default_variant:!1,featured_image:{height:0,width:0,aspect_ratio:1,url:null!==(f=null===(_=e.image)||void 0===_?void 0:_.src)&&void 0!==f?f:"",alt:null!==(g=null===(h=e.image)||void 0===h?void 0:h.altText)&&void 0!==g?g:""},variant_options:[],quantity:1,key:e.sku,discounted_price:m,discounts:[],final_line_price:m,final_price:m,gift_card:!1,line_level_discount_allocations:[],line_level_total_discount:0,line_price:m,original_line_price:w,original_price:w,properties:{},requires_shipping:!0,total_discount:0}})(i,t))}))}),[i,t])})),e.useLogCollection=(i,t)=>(0,a.useEffect)((()=>{"undefined"!=typeof window&&(0,e.initAnalytics)().then((()=>{(0,o.logCollectionView)(i,t.map((e=>{var t,n,o,a;const c=e.images[0],u={src:null==c?void 0:c.src,alt:null==c?void 0:c.altText,width:null==c?void 0:c.width,height:null==c?void 0:c.height,aspect_ratio:1},d=e.price||0,s=e.oldPrice||e.price||0,v=Object.entries(null!==(t=e.colorMap)&&void 0!==t?t:{})[0],p=null!==(n=null==v?void 0:v[0])&&void 0!==n?n:"",_=null!==(o=null==v?void 0:v[1])&&void 0!==o?o:"0";return{product:{compare_at_price:s,id:null!==(a=(0,r.safeParseInt)(e.id))&&void 0!==a?a:0,selectedOptions:[],url:window.location.href,title:e.title,type:i.title,image:u,price:d,vendor:(0,l.getEnvConfig)().site.title},selected_variant:{title:p,price:d,image:u,id:(0,r.safeParseInt)(_),compare_at_price:s,sku:e.handle,inventory_quantity:e.availableForSale?1:0,url:`${window.location.origin}/products/${e.handle}?variant=${_}`},quantity:1}})))})).catch((i=>{console.error(i)}))}),[i,t])}}]);