"use strict";(self.webpackChunkui=self.webpackChunkui||[]).push([[18],{27:function(a,e,t){var i=this&&this.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(e,"__esModule",{value:!0}),e.ProductCard=void 0;const n=t(0),r=(t(1),i(t(24))),s=t(3),l=t(4),o=t(22),c=t(39),d=t(18),u=t(11),g=t(2),h=t(29);e.ProductCard=function({product:a,sharedStateStore:e,collectionHandle:t}){var i,m,p,f,v;const{getHexForOptionColor:x,findProductVariantWithOption:P,EXCLUDE_TAGS:_,product_image_height:j,product_image_width:b,disable_color_swatches:O}=e((a=>({getHexForOptionColor:a.getHexForOptionColor,findProductVariantWithOption:a.findProductVariantWithOption,EXCLUDE_TAGS:a.config.exclude_tags,product_image_width:a.config.product_image_width,product_image_height:a.config.product_image_height,disable_color_swatches:a.config.disable_color_swatches}))),V=a.options.find((a=>"Color"===a.name)),C=a.priceRange.minVariantPrice.amount,I=C!==(null===(i=a.priceRange.maxVariantPrice)||void 0===i?void 0:i.amount)?`From $${(0,d.formatPrice)(C)}`:`$${(0,d.formatPrice)(C)}`,w=(null===(m=a.compareAtPriceRange.maxVariantPrice)||void 0===m?void 0:m.amount)&&parseFloat(null===(p=a.compareAtPriceRange.maxVariantPrice)||void 0===p?void 0:p.amount)>parseFloat(C),A=a.compareAtPriceRange.maxVariantPrice&&Ce.variantId===a.defaultVariantId)),[R,S]=(0,s.useState)(null!=F?F:a.variants[0]),$=(0,c.getImagesForVariant)(a.imageMap,R,g.getAssignment)[0],H=(0,h.useProductUrl)(a,R.variantId===(null==F?void 0:F.variantId)?void 0:R);if(!$)return null;const W=_&&(null==_?void 0:_.length)>0?a.tags.find((a=>!(null==_?void 0:_.includes(a)))):null,{title:k,subtitle:y}=(0,u.splitTitle)(a.title);return(0,n.jsxs)("div",Object.assign({class:r.default.box},{children:[W&&(0,n.jsx)("div",Object.assign({class:r.default.bestSeller},{children:W})),(0,n.jsxs)("a",Object.assign({href:H,class:r.default.link,"data-orly-type":t,"data-orly-handle":a.handle},{children:[(0,n.jsx)("div",Object.assign({className:r.default.heroImageContainer},{children:(0,n.jsx)(l.LazyImage,{src:$.src,initialWidth:300,cssClass:r.default.heroImage,alt:`${a.title}: ${$.model}`,height:j,width:b})})),(0,n.jsxs)("div",Object.assign({class:r.default.textWrapper},{children:[(0,n.jsx)("div",Object.assign({class:r.default.title},{children:k})),y&&(0,n.jsx)("div",Object.assign({class:r.default.subtitle},{children:y})),(0,n.jsxs)("div",Object.assign({class:r.default.price},{children:[w&&(null===(f=a.compareAtPriceRange.maxVariantPrice)||void 0===f?void 0:f.amount)&&(0,n.jsxs)("span",Object.assign({class:r.default.originalPrice},{children:["$",(0,d.formatPrice)(null===(v=a.compareAtPriceRange.maxVariantPrice)||void 0===v?void 0:v.amount)]})),(0,n.jsx)("span",Object.assign({class:A?r.default.salePrice:""},{children:I}))]}))]}))]})),(0,n.jsx)("div",Object.assign({class:r.default.colorSwatchContainer},{children:!O&&V&&(0,n.jsx)(o.ProductOption,{productHandle:a.handle,small:!0,maxItems:12,hideLabel:!0,option:V,getHexForOptionColor:x,selectedVariant:R,findProductVariantWithOption:e=>P(e,a,F),setSelectedVariantId:e=>{const t=a.variants.find((a=>a.variantId===e));t&&S(t)}})}))]}))}}}]);