import React__default, { useState } from 'react';
import { getCreateGroupChannel } from './sendbirdSelectors.js';
import useSendbirdStateContext from './useSendbirdStateContext.js';

let CHANNEL_TYPE = /*#__PURE__*/function (CHANNEL_TYPE) {
  CHANNEL_TYPE["GROUP"] = "group";
  CHANNEL_TYPE["SUPERGROUP"] = "supergroup";
  CHANNEL_TYPE["BROADCAST"] = "broadcast";
  return CHANNEL_TYPE;
}({});

const CreateChannelContext = /*#__PURE__*/React__default.createContext(undefined);
const CreateChannelProvider = props => {
  var _store$config;
  const {
    children,
    onCreateChannel,
    onBeforeCreateChannel,
    overrideInviteUser,
    userListQuery
  } = props;
  const store = useSendbirdStateContext();
  const userListQuery_ = store === null || store === void 0 ? void 0 : (_store$config = store.config) === null || _store$config === void 0 ? void 0 : _store$config.userListQuery;
  const createChannel = getCreateGroupChannel(store);
  const [step, setStep] = useState(0);
  const [type, setType] = useState(CHANNEL_TYPE.GROUP);
  return /*#__PURE__*/React__default.createElement(CreateChannelContext.Provider, {
    value: {
      onBeforeCreateChannel,
      createChannel,
      onCreateChannel,
      overrideInviteUser,
      userListQuery: userListQuery || userListQuery_,
      step,
      setStep,
      type,
      setType
    }
  }, children);
};
const useCreateChannelContext = () => React__default.useContext(CreateChannelContext);

export { CreateChannelProvider as C, CHANNEL_TYPE as a, useCreateChannelContext as u };
//# sourceMappingURL=CreateChannelProvider-5d32c403.js.map
