'use client';
import{jsx as e,jsxs as r}from"react/jsx-runtime";import{useCurrentVariant as t,useProduct as o,convertDecimalToNumber as p,shopifyPriceRounding as s,useProductOfferDiscount as i,useI18nStore as a,useRenderMode as c,useFormatMoney as l,cls as d}from"@gem-sdk/core";import{useMemo as m}from"react";import n from"../../text/components/Text.js";import{useDynamicProduct as g}from"../hooks/useDynamicProduct.js";import u from"../../../common/components/TooltipHover.js";let PostPurchaseProductPrice=({styles:h,style:f,builderAttrs:x,builderProps:y,children:P,setting:b})=>{let N=t(),j=o(),k=p(N?.price)??0,v=p(N?.salePrice)??0,w=parseFloat(s(i(),2)),D=k-w>0?k-w:k,{isDynamicProduct:T}=g(),{t:F}=a(),{isEditMode:$}=c(),{priceType:H,source:I}=b??{},S="compare"===H,q="offer"===H,z="price"===I,A="compare-price"===I,B=m(()=>S?z?k:v:q?D:k,[S,z,q,k,v,D]),C=l(parseFloat(s(Number(B)||0,2)),!1),E=j?.baseID?.replace("gid://shopify/Product/",""),G=m(()=>S&&(!w&&v<k||A&&!v||z&&k<=0),[S,w,k,v,A]);return(!B&&!q||G)&&$?e(u,{enable:!0,text:"Not be displayed when published",width:"205px",position:"bottom",className:"gp-arrow-left-offset-10",children:e("div",{className:"gp-h-[28px] gp-px-1.5 gp-py-1 gp-flex gp-border gp-border-light-200 gp-items-center gp-justify-center gp-rounded-lg",style:{borderStyle:"dashed",strokeDasharray:"2,2"},children:e("span",{className:"gp-text-dark-400 gp-text-[12px] gp-leading-5",children:F("No compare price")})})}):G&&!$?null:r("div",{...x,className:d(y?.uid),style:{...f},id:`shopify-text-element-${y?.uid}`,"data-product-id":E,children:[e(n,{styles:h,setting:{text:T?"$???":C},className:d({"gp-money":q,"gp-product-compare-price":S,"gp-line-through":S&&h?.lineThrough})}),P]})};export{PostPurchaseProductPrice as default};
