import{useRef as e,useEffect as l}from"react";let useSellingPlanChange=({defaultValue:t,selectedSellingPlan:r,setSelectedSellingPlan:n,sellingPlanOptions:u})=>{let a=e(!0);l(()=>{if(a.current){if(!r){let e=t||u[0]?.value||"";e&&n(e)}a.current=!1;return}if(r){let e=u.some(e=>e.value===r);if(!e&&u.length>0){let e=t||u[0]?.value||"";e&&n(e)}}},[t,u,r,n]);let i=e=>{n(e)},f=r||t||u[0]?.value||"";return{selectedValue:f,handleSellingPlanChange:i}};export{useSellingPlanChange};
