import{useProductBundleDiscount as e}from"@gem-sdk/core";import{useState as t,useCallback as r,useEffect as l}from"react";let a=a=>{let[c,m]=t(0),{seUseProductCompareAtPrice:s}=e(),[u,o]=t(a?.hasPreSelectItem?a?.selectItemDefault:-1),I=r(e=>u===e,[u]);return l(()=>{s(a?.useProductCompareAtPrice)},[s,a?.useProductCompareAtPrice]),l(()=>{a?.hasPreSelectItem||o(-1)},[a?.hasPreSelectItem]),l(()=>{a?.hasPreSelectItem&&o(a?.selectItemDefault)},[a?.hasPreSelectItem,a?.selectItemDefault]),l(()=>{let e;return c<10&&(e=setInterval(()=>{m(e=>e+1)},100)),()=>clearInterval(e)},[c]),{timer:c,isSelected:I,setSelected:o}};export{a as default};
