import{r as i}from"./utils-B1oDxhJx.js";import{u as c,e as p}from"./use-chrome-storage-JbMOcQgl.js";const m="bloom.activeWalletGroup";function W(e){return e==null?[]:Array.isArray(e)?e:[e]}function g(){const{data:e,isLoading:a,error:o,setData:t,reloadData:s}=c(m),r=W(e),u=r.length===1?r[0]??null:null,n=i.useCallback(l=>l.length===0?t(null):l.length===1?t(l[0]??null):t(l),[t]),d=i.useCallback(l=>t(l),[t]);return{activeWalletGroupId:u,activeWalletGroupIds:r,isLoading:a,error:o,setActiveWalletGroupId:d,setActiveWalletGroupIds:n,reloadActiveWalletGroup:s}}const G="bloom.walletGroups";function v(){const{items:e,isLoading:a,error:o,addItem:t,updateItem:s,deleteItem:r,setItems:u,reloadItems:n}=p(G,"id");return{walletGroups:e,isLoading:a,error:o,addWalletGroup:t,updateWalletGroup:s,deleteWalletGroup:r,setWalletGroups:u,reloadWalletGroups:n}}const I="bloom.wallets";function E(){const{items:e,isLoading:a,error:o,addItem:t,updateItem:s,deleteItem:r,setItems:u,reloadItems:n}=p(I,"address");return{wallets:e.sort((d,l)=>(d.preferredIndex??1/0)-(l.preferredIndex??1/0)),isLoading:a,error:o,addWallet:t,updateWallet:s,deleteWallet:r,setWallets:u,reloadWallets:n}}export{v as a,g as b,E as u};
