'use client';
import{jsxs as e,Fragment as t,jsx as o}from"react/jsx-runtime";import{Fragment as i}from"react";import{useProduct as r}from"@gem-sdk/core";import{createStyle as s,createAttr as d,createClass as l}from"@gem-sdk/system";import{getIconCollapseClassesRotate as n,getContainerPriceBreakdownClasses as a,getWrapperLabelClasses as c,getLabelClasses as m,getDividerClasses as p,getWrapperMoneyLinesClasses as u,getWrapperBreakdownClasses as h}from"../helpers/product-price-breakdown/getClasses.js";import{getStyle as f,getWrapperMoneyLinesStyles as w}from"../helpers/product-price-breakdown/getStyles.js";import{useGetItemGapPriceBreakdown as y}from"../hooks/useGetItemGapPriceBreakdown.js";import{useSetCollapsePrice as b}from"../hooks/useSetCollapsePrice.js";import k from"./price-breakdown/MoneyLine.js";import g from"../../text/components/Text.js";import{useGetMoneyLines as P}from"../hooks/useGetMoneyLines.js";let PostPurchaseProductPriceBreakdown=({setting:v={},styles:x={},style:C,builderAttrs:I,builderProps:j,children:L})=>{let{labelStyle:N,moneyStyle:q,spacing:S,width:B,align:D,isShowPrice:G,direction:M}=x,T=r(),H=T?.baseID?.replace("gid://shopify/Product/",""),{isCollapsePrice:R,onClickLabelPriceBreakdown:$}=b(G),{itemGap:E}=y(S),{getMoneyLines:F}=P(x,v),U=s({...f(C)}),Z=d({...I}),z=l(n(R)),A=l(a(D,j?.uid)),J=l(c(M)),K=l(m()),O=l(p()),Q=l(u()),V=l(h()),W=s({...w(B,E)});return e(t,{children:[e("div",{className:J,onClick:$,role:"button",tabIndex:0,"aria-hidden":"true",children:[o(g,{className:K,styles:{direction:M},setting:{text:R?v.contentHide||"Hide price breakdown":v.contentShow||"Show price breakdown",options:{isCannotEditing:!0}}}),o("svg",{width:"17",height:"17",viewBox:"0 0 17 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:z,children:o("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11.0187 10.3598C10.7759 10.5853 10.3963 10.5712 10.1708 10.3284L8.01045 8.00191L5.85012 10.3284C5.62464 10.5712 5.245 10.5853 5.00218 10.3598C4.75935 10.1343 4.74529 9.75469 4.97077 9.51187L7.57077 6.71187C7.6843 6.58961 7.84361 6.52014 8.01045 6.52014C8.17729 6.52014 8.3366 6.58961 8.45012 6.71187L11.0501 9.51187C11.2756 9.75469 11.2615 10.1343 11.0187 10.3598Z",fill:"#1879B9"})})]}),o("div",{className:O}),R?o("div",{className:V,children:e("div",{...Z,className:A,style:U,id:`shopify-text-element-${j?.uid}`,"data-product-id":H,children:[o("div",{className:Q,style:W,children:F().map(t=>e(i,{children:["totalLabel"===t.uniqueId&&F().length>1&&o("hr",{}),o("div",{children:o(k,{uniqueId:t.uniqueId,direction:M,builderPropsUID:j?.uid,title:"totalLabel"===t.uniqueId?`<b>${t.title}</b>`:t.title,money:t.money,tooltipData:t.tooltip,labelTextStyles:{typo:{...N},direction:M},moneyTextStyles:{typo:q}})},t.uniqueId)]},t.uniqueId))}),L]})}):null]})};export{PostPurchaseProductPriceBreakdown as default};
