'use client';
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),React=require("react"),core=require("@gem-sdk/core"),system=require("@gem-sdk/system"),getClasses=require("../helpers/product-price-breakdown/getClasses.js"),getStyles=require("../helpers/product-price-breakdown/getStyles.js"),useGetItemGapPriceBreakdown=require("../hooks/useGetItemGapPriceBreakdown.js"),useSetCollapsePrice=require("../hooks/useSetCollapsePrice.js"),MoneyLine=require("./price-breakdown/MoneyLine.js"),Text=require("../../text/components/Text.js"),useGetMoneyLines=require("../hooks/useGetMoneyLines.js");const PostPurchaseProductPriceBreakdown=({setting:e={},styles:s={},style:t,builderAttrs:r,builderProps:i,children:a})=>{let{labelStyle:l,moneyStyle:n,spacing:o,width:u,align:d,isShowPrice:c,direction:m}=s,p=core.useProduct(),x=p?.baseID?.replace("gid://shopify/Product/",""),{isCollapsePrice:y,onClickLabelPriceBreakdown:j}=useSetCollapsePrice.useSetCollapsePrice(c),{itemGap:C}=useGetItemGapPriceBreakdown.useGetItemGapPriceBreakdown(o),{getMoneyLines:g}=useGetMoneyLines.useGetMoneyLines(s,e),h=system.createStyle({...getStyles.getStyle(t)}),w=system.createAttr({...r}),P=system.createClass(getClasses.getIconCollapseClassesRotate(y)),b=system.createClass(getClasses.getContainerPriceBreakdownClasses(d,i?.uid)),R=system.createClass(getClasses.getWrapperLabelClasses(m)),k=system.createClass(getClasses.getLabelClasses()),q=system.createClass(getClasses.getDividerClasses()),L=system.createClass(getClasses.getWrapperMoneyLinesClasses()),I=system.createClass(getClasses.getWrapperBreakdownClasses()),S=system.createStyle({...getStyles.getWrapperMoneyLinesStyles(u,C)}),v=({uniqueId:e})=>"recurringTotalLabel"===e?{...n,fontWeight:"normal"}:n;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:R,onClick:j,role:"button",tabIndex:0,"aria-hidden":"true",children:[jsxRuntime.jsx(Text.default,{className:k,styles:{direction:m},setting:{text:y?e.contentHide||"Hide price breakdown":e.contentShow||"Show price breakdown",options:{isCannotEditing:!0}}}),jsxRuntime.jsx("svg",{width:"17",height:"17",viewBox:"0 0 17 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:P,children:jsxRuntime.jsx("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"})})]}),jsxRuntime.jsx("div",{className:q}),y?jsxRuntime.jsx("div",{className:I,children:jsxRuntime.jsxs("div",{...w,className:b,style:h,id:`shopify-text-element-${i?.uid}`,"data-product-id":x,children:[jsxRuntime.jsx("div",{className:L,style:S,children:g().map(e=>jsxRuntime.jsxs(React.Fragment,{children:["totalLabel"===e.uniqueId&&g().length>1&&jsxRuntime.jsx("hr",{}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx(MoneyLine.default,{uniqueId:e.uniqueId,direction:m,builderPropsUID:i?.uid,title:"totalLabel"===e.uniqueId?`<b>${e.title}</b>`:e.title,money:e.money,tooltipData:e.tooltip,labelTextStyles:{typo:{...l},direction:m},moneyTextStyles:{typo:v({uniqueId:e.uniqueId})},subTitle:e.subTitle})},e.uniqueId)]},e.uniqueId))}),a]})}):null]})};exports.default=PostPurchaseProductPriceBreakdown;
