"use strict";(self.webpackChunkui=self.webpackChunkui||[]).push([[8],{23:(i,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.useLogCollection=e.setupLogViewCart=e.logViewedProduct=e.logPageView=void 0;const n=t(125),o=t(7),a=t(3);e.logPageView=()=>{if("undefined"!=typeof window)try{(0,n.initBentoAnalytics)({elevar:!0}).then((()=>{console.log("Success on initBentoAnalytics()")}))}catch(i){console.error("Error in initBentoAnalytics():",i)}},e.logViewedProduct=(i,e)=>{var t;if(!i||"undefined"==typeof window)return;const a=null!==(t=null==i?void 0:i.variants.find((i=>i.variantId===e)))&&void 0!==t?t:null==i?void 0:i.variants[0];(0,n.initBentoAnalytics)({elevar:!0}).then((()=>{var e,t,l,r,d,c,u,s,v,p,g;const _=`${window.location.origin}${null===(e=a.image)||void 0===e?void 0:e.src}`,f=null!==(l=(0,o.safeParseFloat)(null!==(t=a.price)&&void 0!==t?t:"0"))&&void 0!==l?l:0,w=null!==(c=(0,o.safeParseFloat)(null!==(d=null!==(r=a.compareAtPrice)&&void 0!==r?r:a.price)&&void 0!==d?d:"0"))&&void 0!==c?c:0;(0,n.logViewContent)({discounted_price:f,discounts:[],featured_image:{aspect_ratio:1,alt:null!==(s=null===(u=a.image)||void 0===u?void 0:u.altText)&&void 0!==s?s:"",width:0,height:0,url:_},final_line_price:f,final_price:f,gift_card:!1,grams:0,handle:i.handle,id:null!==(v=a.id)&&void 0!==v?v:i.id,image:_,inventory:a.quantityAvailable,key:a.sku,line_level_discount_allocations:[],line_level_total_discount:0,line_price:f,options_with_values:a.selectedOptions,original_line_price:w,original_price:w,price:f,product_description:i.description,product_has_only_default_variant:1===i.variants.length,product_id:null!==(p=(0,o.safeParseInt)(i.id))&&void 0!==p?p:0,product_title:i.title,product_type:i.productType,properties:{},quantity:1,requires_shipping:!0,sku:a.sku,taxable:!0,title:i.title,total_discount:0,url:window.location.href,variant_id:null!==(g=(0,o.safeParseInt)(a.variantId))&&void 0!==g?g:0,variant_options:a.selectedOptions.map((i=>i.value)),variant_title:a.title,vendor:i.vendor})}))},e.setupLogViewCart=()=>{if("undefined"==typeof window)return;const i=document.querySelector("input#cart-toggle"),e=()=>{(0,n.initBentoAnalytics)({elevar:!0}).then(n.logViewCart)};(null==i?void 0:i.checked)&&e(),null==i||i.addEventListener("change",e)},e.useLogCollection=i=>(0,a.useEffect)((()=>{"undefined"!=typeof window&&(0,n.initBentoAnalytics)({elevar:!0}).then((()=>{var e;const t={title:i.title,id:0,url:window.location.href};(0,n.logCollectionView)(Object.assign(Object.assign({},t),{title:null!==(e=t.title)&&void 0!==e?e:""}),i.products.map((i=>{var e,t,n,a,l,r,d,c,u,s,v;const p=i.variants[0],g={src:null===(e=p.image)||void 0===e?void 0:e.src,alt:null===(t=p.image)||void 0===t?void 0:t.altText,width:0,height:0,aspect_ratio:1},_=(0,o.safeParseFloat)(null!==(l=null!==(n=i.priceRange.minVariantPrice.amount)&&void 0!==n?n:null===(a=i.priceRange.maxVariantPrice)||void 0===a?void 0:a.amount)&&void 0!==l?l:"0"),f=(0,o.safeParseFloat)(null!==(v=null!==(s=null!==(c=null!==(d=null===(r=i.compareAtPriceRange.maxVariantPrice)||void 0===r?void 0:r.amount)&&void 0!==d?d:i.compareAtPriceRange.minVariantPrice.amount)&&void 0!==c?c:null===(u=i.priceRange.maxVariantPrice)||void 0===u?void 0:u.amount)&&void 0!==s?s:i.priceRange.minVariantPrice.amount)&&void 0!==v?v:"0");return{product:{compare_at_price:f,id:(0,o.safeParseInt)(i.id),selectedOptions:[],url:window.location.href,title:i.title,type:i.productType,image:g,price:_,vendor:i.vendor},selected_variant:{title:p.title,price:_,image:g,id:(0,o.safeParseInt)(p.id),compare_at_price:f,sku:p.sku,inventory_quantity:p.quantityAvailable,url:`${window.location.origin}/products/${i.handle}?variant=${p.id}`},quantity:1}})))}))}),[i])}}]);