"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@gem-sdk/core"),React=require("react");const useProductBundleDiscountState=e=>{let[t,c]=React.useState(0),{seUseProductCompareAtPrice:r}=core.useProductBundleDiscount(),[u,a]=React.useState(e?.hasPreSelectItem?e?.selectItemDefault:-1),s=React.useCallback(e=>u===e,[u]);return React.useEffect(()=>{r(e?.useProductCompareAtPrice)},[r,e?.useProductCompareAtPrice]),React.useEffect(()=>{e?.hasPreSelectItem||a(-1)},[e?.hasPreSelectItem]),React.useEffect(()=>{e?.hasPreSelectItem&&a(e?.selectItemDefault)},[e?.hasPreSelectItem,e?.selectItemDefault]),React.useEffect(()=>{let e;return t<10&&(e=setInterval(()=>{c(e=>e+1)},100)),()=>clearInterval(e)},[t]),{timer:t,isSelected:s,setSelected:a}};exports.default=useProductBundleDiscountState;
