import{c as C,d as p,r as u,f as d,e as g}from"./index-Csef3-wA.js";function m({fetchOnOpen:i,prices:s=[]}){const t=C(),{currency:r,currencies:o,fetchingCurrencies:a,currenciesReady:c}=p(e=>({currency:e.user.currency,currencies:e.user.currencies,fetchingCurrencies:e.user.fetchingCurrencies,currenciesReady:e.user.currenciesReady})),[n,f]=u.useState(!1),y=u.useMemo(()=>{var e;return r?null:(e=s.find(h=>h.active))==null?void 0:e.currency},[r,s]);function l(e){t(g.setCurrency(e))}return u.useEffect(()=>{c||i&&!n||t(d())},[n,c]),{currencies:o,planCurrency:y,currency:r,fetchingCurrencies:a,open:n,setOpen:f,onChange:l,currenciesReady:c}}export{m as u};