'use client';
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),core=require("@gem-sdk/core"),React=require("react"),Text=require("../../text/components/Text.js"),useDynamicProduct=require("../hooks/useDynamicProduct.js");const PostPurchaseProductPrice=({styles:e,style:r,builderAttrs:c,builderProps:t,children:o})=>{let s=core.useCurrentVariant(),u=core.useProduct(),i=s?.price??0,p=s?.salePrice??0,a=parseFloat(core.shopifyPriceRounding(core.useProductOfferDiscount(),2)),{isDynamicProduct:d}=useDynamicProduct.useDynamicProduct(),n=React.useMemo(()=>a?e?.priceType==="compare"?i:i-a:e?.priceType==="compare"?p:i,[a,e?.priceType,i,p]),m=core.useFormatMoney(parseFloat(n.toFixed(2)),!1),l=u?.baseID?.replace("gid://shopify/Product/",""),y=React.useMemo(()=>e?.priceType==="compare"&&(!a&&p<i||i<=0),[a,i,p,e?.priceType]);return y?null:jsxRuntime.jsxs("div",{...c,className:core.cls(t?.uid),style:{...r},id:`shopify-text-element-${t?.uid}`,"data-product-id":l,children:[jsxRuntime.jsx(Text.default,{styles:e,setting:{text:d?"$???":m},className:core.cls({"gp-money":e?.priceType==="regular","gp-product-compare-price":e?.priceType==="compare","gp-line-through":e?.priceType==="compare"&&e?.lineThrough})}),o]})};exports.default=PostPurchaseProductPrice;
