import{SEPARATOR as e}from"./constants.js";let LIQUID_EXPRESSION_REGEX=/^\s*\{\{[\s\S]*\}\}\s*$/,appendLiquidEscapeFilter=e=>e.replace(/\s*\}\}\s*$/," | escape }}"),escapeSingleQuoteForAttr=e=>{if(null==e)return e;let t=e.toString();return LIQUID_EXPRESSION_REGEX.test(t)?appendLiquidEscapeFilter(t):t.replaceAll("'","&#39;").replaceAll("’","&#39;")},checkIconVisibility=e=>e?.enableIcon===!0,getRenderRegularPriceSettings=e=>({lineThrough:!1,typo:removeColorFromTypo(e?.priceTypo)}),getRenderComparePriceSettings=e=>({lineThrough:!0,typo:removeColorFromTypo(e?.compareAtPriceTypo),opacityPrice:e?.opacityPrice}),getGPProductButtonState=({styles:e,setting:t,successMessage:r,errorMessage:o})=>({styles:{errorTypo:e?.errorTypo,successTypo:e?.successTypo},setting:{errorType:t?.errorType,actionEffect:t?.actionEffect,enableMessage:t?.enableMessage,label:escapeSingleQuoteForAttr(t?.label),errorMessage:escapeSingleQuoteForAttr(o??t?.errorMessage),successMessage:escapeSingleQuoteForAttr(r??t?.successMessage),outOfStockLabel:escapeSingleQuoteForAttr(t?.outOfStockLabel),customURL:{link:escapeSingleQuoteForAttr(t?.customURL?.link),target:t?.customURL?.target}},variantID:"{{variant.id}}",disabled:"{{variant.available}}",totalVariant:"{{total_combinations}}"}),renderSeparator=t=>{let r=t??"horizontal-line";return({dot:e.DOT,"vertical-line":e.VERTICAL_LINE,"horizontal-line":e.HORIZONTAL_LINE})[r]??e.HORIZONTAL_LINE},removeColorFromTypo=e=>(e?.attrs&&e?.attrs.color&&delete e.attrs.color,e);export{checkIconVisibility,getGPProductButtonState,getRenderComparePriceSettings,getRenderRegularPriceSettings,renderSeparator};
