import { useSyncExternalStore } from 'react';
import { useStytchClient } from './useStytchClient.mjs';

const useSelf = ()=>{
    const client = useStytchClient();
    const self = useSyncExternalStore(client.self.onChange, ()=>client.self.getSync());
    return {
        self,
        isSelf: (memberId)=>memberId ? self?.member_id === memberId : false,
        fromCache: client.self.getInfo().fromCache
    };
};

export { useSelf };
//# sourceMappingURL=useSelf.mjs.map
