import { M as isLiveStreamViewer } from './ui-store-76bb0e8e.js';

const canViewChat = (meeting) => {
    if (meeting && !meeting.chat)
        return false;
    const { chatPublic, chatPrivate } = meeting.self.permissions;
    return (chatPublic.canSend ||
        chatPublic.canReceive || // TODO(ravindra-cloudflare): add web-core equivalent of chatPublic.canReceive, remove type casting
        chatPublic.text ||
        chatPublic.files ||
        chatPrivate.canSend ||
        chatPrivate.canReceive ||
        chatPrivate.files ||
        chatPrivate.text);
};
const canViewPolls = (meeting) => {
    if (meeting && !meeting.polls)
        return false;
    const { polls } = meeting.self.permissions;
    return polls.canCreate || polls.canView || polls.canVote;
};
const canViewParticipants = (meeting) => {
    var _a;
    if (!((_a = meeting.self.permissions) === null || _a === void 0 ? void 0 : _a.showParticipantList)) {
        return false;
    }
    if (meeting && !meeting.participants)
        return false;
    const config = meeting === null || meeting === void 0 ? void 0 : meeting.self.config;
    if (config && !config.controlBar.elements.participants)
        return false;
    return true;
};
const canViewAI = (meeting) => {
    var _a, _b;
    return !!((_b = (_a = meeting === null || meeting === void 0 ? void 0 : meeting.self) === null || _a === void 0 ? void 0 : _a.permissions) === null || _b === void 0 ? void 0 : _b.transcriptionEnabled);
};
const canViewPlugins = (meeting) => {
    if (isLiveStreamViewer(meeting))
        return false;
    if (meeting && !meeting.plugins)
        return false;
    if (meeting.meta.viewType === 'LIVESTREAM')
        return meeting.stage.status === 'ON_STAGE';
    const { plugins } = meeting.self.permissions;
    return plugins.canClose || plugins.canStart;
};

export { canViewParticipants as a, canViewPlugins as b, canViewChat as c, canViewPolls as d, canViewAI as e };
