import{s as P,b as p,z as m,d as S}from"./BCLrUOBx.js";function T(){const f=e=>parseInt(e==null?void 0:e.refundable)===1,u=e=>{const{t:a}=S();return parseInt(e==null?void 0:e.warranty)===1?a("productHelper.available"):a("productHelper.notAvailable")},y=e=>{const{currencyIcon:a,setting:t}=P(p()),{priceType:n}=m();return parseInt(e.type)===n.FLAT?g(a.value,e.price,t.value):`${o(e.price)}%`},o=(e,a="en-US")=>(a||(a="en-US"),parseFloat(e).toLocaleString(a,{maximumFractionDigits:2})),g=(e,a,t)=>{const{currencyPositionsIn:n}=m();return parseInt(t.currency_position)===n.PRE?e+o(a,t.decimal_format):`${o(a,t.decimal_format)}${e}`},I=(e,a)=>{let t=0;for(let n of e)a.includes(n)&&t++;return t},_=(e,a)=>{let t=null,n=-1;for(const s in a)if(Object.hasOwnProperty.call(a,s)){const c=a[s],l=I(e,c);l>n&&(n=l,t=s)}return t},h=(e,a)=>b(e,a)||(e==null?void 0:e.image),b=(e,a)=>{var l;const t={},n={};(l=e==null?void 0:e.product_images)==null||l.forEach(r=>{r==null||r.attributes.forEach(i=>{t[r==null?void 0:r.id]||(t[r.id]=[],n[r.id]=r==null?void 0:r.image),t[r.id].push(i==null?void 0:i.attribute_value_id)})});const s=a==null?void 0:a.map(r=>r==null?void 0:r.attribute_value_id),c=_(s,t);return n[c]};return{refundable:f,warranty:u,getPriceType:y,getProductImage:h}}export{T as u};
