import{R as g}from"./index.1ec44e23.js";import{M as R}from"./8abb1004.js";import{f as A}from"./3c10424c.js";import"./f8e98c27.js";import"./a66d801c.js";import"./2d3554bc.js";import"./8bce3399.js";function C(d){var o,l,p,u,s,f,P,V;const{priceType:x="regular",variantId:t,valueType:a="min",data:e,...c}=d;if(e==null)throw new Error("<ProductPrice/> requires a product as the 'data' prop");let r,n;const i=t&&(l=A((o=e==null?void 0:e.variants)!=null?o:{}).find(m=>(m==null?void 0:m.id)===t))!=null?l:null;if(x==="compareAt")if(t&&i){if(((p=i.compareAtPriceV2)==null?void 0:p.amount)===((u=i.priceV2)==null?void 0:u.amount))return null;r=i.compareAtPriceV2}else a==="max"?r=(s=e==null?void 0:e.compareAtPriceRange)==null?void 0:s.maxVariantPrice:r=(f=e==null?void 0:e.compareAtPriceRange)==null?void 0:f.minVariantPrice;else t&&i?(r=i.priceV2,a==="unit"&&(r=i.unitPrice,n=i.unitPriceMeasurement)):a==="max"?r=(P=e.priceRange)==null?void 0:P.maxVariantPrice:r=(V=e.priceRange)==null?void 0:V.minVariantPrice;return r?n?g.createElement(R,{...c,data:r,measurement:n}):g.createElement(R,{...c,data:r}):null}export{C as ProductPrice}; //# sourceMappingURL=b3acf7c8.js.map