'use strict';

var _rollupPluginBabelHelpers = require('./_rollupPluginBabelHelpers-ea66c137.js');
var React = require('react');
var withSendbird = require('./withSendbird.js');
var cssVars = require('css-vars-ponyfill');
var index_module = require('./index.module-15d2b97f.js');
var actionTypes = require('./actionTypes-5bdd7ab3.js');
var SendbirdChat = require('@sendbird/chat');
var uuid = require('./uuid-f1d9be11.js');
var openChannel = require('@sendbird/chat/openChannel');
var groupChannel = require('@sendbird/chat/groupChannel');
var index = require('./index-86e680cb.js');
var uikitTools = require('@sendbird/uikit-tools');
var VoicePlayer_context = require('./index-ce276e22.js');
var VoiceRecorder_context = require('./VoiceRecorder/context.js');
var LocalizationContext = require('./LocalizationContext-6adf6aa8.js');
var MediaQueryContext = require('./MediaQueryContext-1dd78ce3.js');
var stringSet = require('./stringSet-5157206d.js');
var consts = require('./consts-a6f34df8.js');
var resolvedReplyType = require('./resolvedReplyType-fb851d3a.js');
require('./utils/message/getOutgoingMessageState.js');
require('./useSendbirdStateContext.js');
require('./ui/Modal.js');
require('react-dom');
require('./index-f84d188a.js');
require('./ui/Button.js');
require('./index-bff918b2.js');
require('prop-types');
require('./ui/Icon.js');
require('./ui/IconButton.js');
require('./index-6a7f94de.js');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
var cssVars__default = /*#__PURE__*/_interopDefaultLegacy(cssVars);
var SendbirdChat__default = /*#__PURE__*/_interopDefaultLegacy(SendbirdChat);

const isEmpty = obj => {
  if (obj === null || obj === undefined) {
    return true;
  }
  for (const prop in obj) {
    if (obj.hasOwnProperty(prop)) {
      return false;
    }
  }
  return JSON.stringify(obj) === JSON.stringify({});
};
const useTheme = overrides => {
  React.useLayoutEffect(() => {
    if (!isEmpty(overrides)) {
      cssVars__default["default"]({
        variables: _rollupPluginBabelHelpers._objectSpread2(_rollupPluginBabelHelpers._objectSpread2({}, {
          '--sendbird-dark-primary-500': '#4d2aa6',
          '--sendbird-dark-primary-400': '#6440C4',
          '--sendbird-dark-primary-300': '#7B53EF',
          '--sendbird-dark-primary-200': '#9E8CF5',
          '--sendbird-dark-primary-100': '#E2DFFF',
          '--sendbird-dark-secondary-500': '#007A7A',
          '--sendbird-dark-secondary-400': '#189A8D',
          '--sendbird-dark-secondary-300': '#2EBA9F',
          '--sendbird-dark-secondary-200': '#6FD6BE',
          '--sendbird-dark-secondary-100': '#AEF2DC',
          '--sendbird-dark-information-100': '#b2d9ff',
          '--sendbird-dark-error-500': '#A30E2D',
          '--sendbird-dark-error-400': '#C11F41',
          '--sendbird-dark-error-300': '#E53157',
          '--sendbird-dark-error-200': '#FF6183',
          '--sendbird-dark-error-100': '#FFABBD',
          '--sendbird-dark-background-700': '#000000',
          '--sendbird-dark-background-600': '#161616',
          '--sendbird-dark-background-500': '#2C2C2C',
          '--sendbird-dark-background-400': '#393939',
          '--sendbird-dark-background-300': '#A8A8A8',
          '--sendbird-dark-background-200': '#D9D9D9',
          '--sendbird-dark-background-100': '#F0F0F0',
          '--sendbird-dark-background-50': '#FFFFFF',
          '--sendbird-dark-overlay': 'rgba(0, 0, 0, 0.32)',
          '--sendbird-dark-onlight-01': 'rgba(0, 0, 0, 0.88)',
          '--sendbird-dark-onlight-02': 'rgba(0, 0, 0, 0.50)',
          '--sendbird-dark-onlight-03': 'rgba(0, 0, 0, 0.38)',
          '--sendbird-dark-onlight-04': 'rgba(0, 0, 0, 0.12)',
          '--sendbird-dark-ondark-01': 'rgba(255, 255, 255, 0.88)',
          '--sendbird-dark-ondark-02': 'rgba(255, 255, 255, 0.50)',
          '--sendbird-dark-ondark-03': 'rgba(255, 255, 255, 0.38)',
          '--sendbird-dark-ondark-04': 'rgba(255, 255, 255, 0.12)',
          '--sendbird-dark-shadow-01': '0 1px 5px 0 rgba(33, 34, 66, 0.04), 0 0 3px 0 rgba(0, 0, 0, 0.08), 0 2px 1px 0 rgba(0, 0, 0, 0.12)',
          '--sendbird-dark-shadow-02': '0 3px 5px -3px rgba(33, 34, 66, 0.04), 0 3px 14px 2px rgba(0, 0, 0, 0.08), 0 8px 10px 1px rgba(0, 0, 0, 0.12)',
          '--sendbird-dark-shadow-03': '0 6px 10px -5px rgba(0, 0, 0, 0.04), 0 6px 30px 5px rgba(0, 0, 0, 0.08), 0 16px 24px 2px rgba(0, 0, 0, 0.12)',
          '--sendbird-dark-shadow-04': '0 9px 15px -7px rgba(0, 0, 0, 0.04), 0 9px 46px 8px rgba(0, 0, 0, 0.08), 0 24px 38px 3px rgba(0, 0, 0, 0.12)',
          '--sendbird-dark-shadow-message-input': '0 1px 5px 0 rgba(33, 34, 66, 0.12), 0 0 1px 0 rgba(33, 34, 66, 0.16), 0 2px 1px 0 rgba(33, 34, 66, 0.08), 0 1px 5px 0 rgba(0, 0, 0, 0.12)',
          '--sendbird-light-primary-500': '#4d2aa6',
          '--sendbird-light-primary-400': '#6440C4',
          '--sendbird-light-primary-300': '#7B53EF',
          '--sendbird-light-primary-200': '#9E8CF5',
          '--sendbird-light-primary-100': '#E2DFFF',
          '--sendbird-light-secondary-500': '#007A7A',
          '--sendbird-light-secondary-400': '#189A8D',
          '--sendbird-light-secondary-300': '#2EBA9F',
          '--sendbird-light-secondary-200': '#6FD6BE',
          '--sendbird-light-secondary-100': '#AEF2DC',
          '--sendbird-light-information-100': '#b2d9ff',
          '--sendbird-light-error-500': '#A30E2D',
          '--sendbird-light-error-400': '#C11F41',
          '--sendbird-light-error-300': '#E53157',
          '--sendbird-light-error-200': '#FF6183',
          '--sendbird-light-error-100': '#FFABBD',
          '--sendbird-light-background-700': '#000000',
          '--sendbird-light-background-600': '#161616',
          '--sendbird-light-background-500': '#2C2C2C',
          '--sendbird-light-background-400': '#393939',
          '--sendbird-light-background-300': '#A8A8A8',
          '--sendbird-light-background-200': '#D9D9D9',
          '--sendbird-light-background-100': '#F0F0F0',
          '--sendbird-light-background-50': ' #FFFFFF',
          '--sendbird-light-overlay': 'rgba(0, 0, 0, 0.32)',
          '--sendbird-light-onlight-01': 'rgba(0, 0, 0, 0.88)',
          '--sendbird-light-onlight-02': 'rgba(0, 0, 0, 0.50)',
          '--sendbird-light-onlight-03': 'rgba(0, 0, 0, 0.38)',
          '--sendbird-light-onlight-04': 'rgba(0, 0, 0, 0.12)',
          '--sendbird-light-ondark-01': 'rgba(255, 255, 255, 0.88)',
          '--sendbird-light-ondark-02': 'rgba(255, 255, 255, 0.50)',
          '--sendbird-light-ondark-03': 'rgba(255, 255, 255, 0.38)',
          '--sendbird-light-ondark-04': 'rgba(255, 255, 255, 0.12)',
          '--sendbird-light-shadow-01': '0 1px 5px 0 rgba(33, 34, 66, 0.04), 0 0 3px 0 rgba(0, 0, 0, 0.08), 0 2px 1px 0 rgba(0, 0, 0, 0.12)',
          '--sendbird-light-shadow-02': '0 3px 5px -3px rgba(33, 34, 66, 0.04), 0 3px 14px 2px rgba(0, 0, 0, 0.08), 0 8px 10px 1px rgba(0, 0, 0, 0.12)',
          '--sendbird-light-shadow-03': '0 6px 10px -5px rgba(0, 0, 0, 0.04), 0 6px 30px 5px rgba(0, 0, 0, 0.08), 0 16px 24px 2px rgba(0, 0, 0, 0.12)',
          '--sendbird-light-shadow-04': '0 9px 15px -7px rgba(0, 0, 0, 0.04), 0 9px 46px 8px rgba(0, 0, 0, 0.08), 0 24px 38px 3px rgba(0, 0, 0, 0.12)',
          '--sendbird-light-shadow-message-input': '0 1px 5px 0 rgba(33, 34, 66, 0.12), 0 0 1px 0 rgba(33, 34, 66, 0.16), 0 2px 1px 0 rgba(33, 34, 66, 0.08), 0 1px 5px 0 rgba(0, 0, 0, 0.12)'
        }), overrides)
      });
    }
  }, [overrides]);
};

const SDK_ACTIONS = {
  INIT_SDK: 'INIT_SDK',
  SET_SDK_LOADING: 'SET_SDK_LOADING',
  RESET_SDK: 'RESET_SDK',
  SDK_ERROR: 'SDK_ERROR'
};

const initialState$1 = {
  initialized: false,
  loading: false,
  sdk: {},
  error: false
};

function reducer$1(state, action) {
  return index_module.K(action).with({
    type: SDK_ACTIONS.SET_SDK_LOADING
  }, _ref => {
    let {
      payload
    } = _ref;
    return _rollupPluginBabelHelpers._objectSpread2(_rollupPluginBabelHelpers._objectSpread2({}, state), {}, {
      initialized: false,
      loading: payload
    });
  }).with({
    type: SDK_ACTIONS.SDK_ERROR
  }, () => {
    return _rollupPluginBabelHelpers._objectSpread2(_rollupPluginBabelHelpers._objectSpread2({}, state), {}, {
      initialized: false,
      loading: false,
      error: true
    });
  }).with({
    type: SDK_ACTIONS.INIT_SDK
  }, _ref2 => {
    let {
      payload
    } = _ref2;
    return {
      sdk: payload,
      initialized: true,
      loading: false,
      error: false
    };
  }).with({
    type: SDK_ACTIONS.RESET_SDK
  }, () => {
    return initialState$1;
  }).otherwise(() => {
    return state;
  });
}

const initialState = {
  initialized: false,
  loading: false,
  user: {}
};

function reducer(state, action) {
  return index_module.K(action).with({
    type: actionTypes.USER_ACTIONS.INIT_USER
  }, _ref => {
    let {
      payload
    } = _ref;
    return {
      initialized: true,
      loading: false,
      user: payload
    };
  }).with({
    type: actionTypes.USER_ACTIONS.RESET_USER
  }, () => {
    return initialState;
  }).with({
    type: actionTypes.USER_ACTIONS.UPDATE_USER_INFO
  }, _ref2 => {
    let {
      payload
    } = _ref2;
    return _rollupPluginBabelHelpers._objectSpread2(_rollupPluginBabelHelpers._objectSpread2({}, state), {}, {
      user: payload
    });
  }).otherwise(() => {
    return state;
  });
}

function useConnectionStatus(sdk, logger) {
  const [isOnline, setIsOnline] = React.useState(true);
  React.useEffect(() => {
    const uniqueHandlerId = uuid.uuidv4();
    try {
      logger.warning('sdk changed', uniqueHandlerId);
      const handler = new SendbirdChat.ConnectionHandler();
      handler.onDisconnected = () => {
        setIsOnline(false);
        logger.warning('onDisconnected', {
          isOnline
        });
      };
      handler.onReconnectStarted = () => {
        setIsOnline(false);
        logger.warning('onReconnectStarted', {
          isOnline
        });
      };
      handler.onReconnectSucceeded = () => {
        setIsOnline(true);
        logger.warning('onReconnectSucceeded', {
          isOnline
        });
      };
      handler.onReconnectFailed = () => {
        sdk.reconnect();
        logger.warning('onReconnectFailed');
      };
      logger.info('Added ConnectionHandler', uniqueHandlerId);
      // workaround -> addConnectionHandler invalidates session handler
      // provided through configureSession
      if (sdk !== null && sdk !== void 0 && sdk.addConnectionHandler) {
        sdk.addConnectionHandler(uniqueHandlerId, handler);
      }
    } catch (_unused) {
      //
    }
    return () => {
      try {
        sdk.removeConnectionHandler(uniqueHandlerId);
        logger.info('Removed ConnectionHandler', uniqueHandlerId);
      } catch (_unused2) {
        //
      }
    };
  }, [sdk]);
  React.useEffect(() => {
    const tryReconnect = () => {
      try {
        logger.warning('Try reconnecting SDK');
        if (sdk.connectionState !== 'OPEN') {
          // connection is not broken yet
          sdk.reconnect();
        }
      } catch (_unused3) {
        //
      }
    };
    // addEventListener version
    window.addEventListener('online', tryReconnect);
    return () => {
      window.removeEventListener('online', tryReconnect);
    };
  }, [sdk]);

  // add offline-class to body
  React.useEffect(() => {
    const body = document.querySelector('body');
    if (!isOnline) {
      try {
        body.classList.add('sendbird__offline');
        logger.info('Added class sendbird__offline to body');
      } catch (e) {
        //
      }
    } else {
      try {
        body.classList.remove('sendbird__offline');
        logger.info('Removed class sendbird__offline from body');
      } catch (e) {
        //
      }
    }
  }, [isOnline]);
  return isOnline;
}

async function disconnectSdk(_ref) {
  let {
    sdkDispatcher,
    userDispatcher,
    sdk
  } = _ref;
  return new Promise(resolve => {
    sdkDispatcher({
      type: SDK_ACTIONS.SET_SDK_LOADING,
      payload: true
    });
    if (sdk !== null && sdk !== void 0 && sdk.disconnect) {
      sdk.disconnect().then(() => {
        sdkDispatcher({
          type: SDK_ACTIONS.RESET_SDK
        });
        userDispatcher({
          type: actionTypes.USER_ACTIONS.RESET_USER
        });
      }).finally(() => {
        resolve(true);
      });
    } else {
      resolve(true);
    }
  });
}

const APP_VERSION_STRING = '3.6.6-rc-0';
const {
  INIT_SDK,
  SET_SDK_LOADING,
  RESET_SDK,
  SDK_ERROR
} = SDK_ACTIONS;
const {
  INIT_USER,
  UPDATE_USER_INFO,
  RESET_USER
} = actionTypes.USER_ACTIONS;
function getMissingParamError(_ref) {
  let {
    userId,
    appId
  } = _ref;
  return `SendbirdProvider | useConnect/setupConnection/Connection failed UserId: ${userId} or appId: ${appId} missing`;
}
function getConnectSbError(error) {
  return `SendbirdProvider | useConnect/setupConnection/Connection failed. ${(error === null || error === void 0 ? void 0 : error.code) || ''} ${(error === null || error === void 0 ? void 0 : error.message) || ''}`;
}
function setUpParams(_ref2) {
  let {
    appId,
    customApiHost,
    customWebSocketHost,
    sdkInitParams
  } = _ref2;
  const params = _rollupPluginBabelHelpers._objectSpread2(_rollupPluginBabelHelpers._objectSpread2({
    modules: [new groupChannel.GroupChannelModule(), new openChannel.OpenChannelModule()],
    newInstance: true
  }, sdkInitParams !== null && sdkInitParams !== void 0 ? sdkInitParams : {}), {}, {
    // appId shouldn't be overrided
    appId
  });
  if (customApiHost) {
    params['customApiHost'] = customApiHost;
  }
  if (customWebSocketHost) {
    params['customWebSocketHost'] = customWebSocketHost;
  }
  const newSdk = SendbirdChat__default["default"].init(params);
  return newSdk;
}

// Steps
// 1. Check if minimum userID/appID is provided
//  1.a. If not, throw error > !reject
//  1.b. If yes, continue
// 2. Set up params with custom host if provided
// 3. Set up session handler if provided
// 4. Set up version
// 5. Connect to Sendbird -> either using user ID or (user ID + access token)
// 6. If connected, connectCbSucess
//  6.a check if nickname is to be updated -> no > !resolve immediately
//  6.b check if nickname is to be updated -> yes > update nickname > !resolve
// 7. If not connected, connectCbError > !reject
async function setUpConnection(_ref3) {
  let {
    logger,
    sdkDispatcher,
    userDispatcher,
    initDashboardConfigs,
    userId,
    appId,
    customApiHost,
    customWebSocketHost,
    configureSession,
    nickname,
    profileUrl,
    accessToken,
    isUserIdUsedForNickname,
    sdkInitParams,
    customExtensionParams,
    isMobile = false
  } = _ref3;
  return new Promise((resolve, reject) => {
    var _logger$info;
    logger === null || logger === void 0 ? void 0 : (_logger$info = logger.info) === null || _logger$info === void 0 ? void 0 : _logger$info.call(logger, 'SendbirdProvider | useConnect/setupConnection/init', {
      userId,
      appId
    });
    sdkDispatcher({
      type: SET_SDK_LOADING,
      payload: true
    });
    if (userId && appId) {
      var _logger$info3, _newSdk$addSendbirdEx, _SendbirdProduct$UIKI, _SendbirdPlatform$JS, _DeviceOsPlatform$MOB, _DeviceOsPlatform$WEB, _logger$info8;
      const newSdk = setUpParams({
        appId,
        customApiHost,
        customWebSocketHost,
        sdkInitParams
      });
      if (configureSession && typeof configureSession === 'function') {
        var _logger$info2;
        const sessionHandler = configureSession(newSdk);
        logger === null || logger === void 0 ? void 0 : (_logger$info2 = logger.info) === null || _logger$info2 === void 0 ? void 0 : _logger$info2.call(logger, 'SendbirdProvider | useConnect/setupConnection/configureSession', sessionHandler);
        newSdk.setSessionHandler(sessionHandler);
      }
      logger === null || logger === void 0 ? void 0 : (_logger$info3 = logger.info) === null || _logger$info3 === void 0 ? void 0 : _logger$info3.call(logger, 'SendbirdProvider | useConnect/setupConnection/setVersion', {
        version: APP_VERSION_STRING
      });
      /**
       * Keep optional chaining to the addSendbirdExtensions
       * for supporting the ChatSDK v4.9.5 or less
       */
      newSdk === null || newSdk === void 0 ? void 0 : (_newSdk$addSendbirdEx = newSdk.addSendbirdExtensions) === null || _newSdk$addSendbirdEx === void 0 ? void 0 : _newSdk$addSendbirdEx.call(newSdk, [{
        product: (_SendbirdProduct$UIKI = SendbirdChat.SendbirdProduct === null || SendbirdChat.SendbirdProduct === void 0 ? void 0 : SendbirdChat.SendbirdProduct.UIKIT_CHAT) !== null && _SendbirdProduct$UIKI !== void 0 ? _SendbirdProduct$UIKI : 'uikit-chat',
        version: APP_VERSION_STRING,
        platform: (_SendbirdPlatform$JS = SendbirdChat.SendbirdPlatform === null || SendbirdChat.SendbirdPlatform === void 0 ? void 0 : SendbirdChat.SendbirdPlatform.JS) !== null && _SendbirdPlatform$JS !== void 0 ? _SendbirdPlatform$JS : 'js'
      }], isMobile ? (_DeviceOsPlatform$MOB = SendbirdChat.DeviceOsPlatform === null || SendbirdChat.DeviceOsPlatform === void 0 ? void 0 : SendbirdChat.DeviceOsPlatform.MOBILE_WEB) !== null && _DeviceOsPlatform$MOB !== void 0 ? _DeviceOsPlatform$MOB : 'mobile_web' : (_DeviceOsPlatform$WEB = SendbirdChat.DeviceOsPlatform === null || SendbirdChat.DeviceOsPlatform === void 0 ? void 0 : SendbirdChat.DeviceOsPlatform.WEB) !== null && _DeviceOsPlatform$WEB !== void 0 ? _DeviceOsPlatform$WEB : 'web', customExtensionParams);
      newSdk.addExtension('sb_uikit', APP_VERSION_STRING);
      const connectCbSucess = async user => {
        var _logger$info4;
        logger === null || logger === void 0 ? void 0 : (_logger$info4 = logger.info) === null || _logger$info4 === void 0 ? void 0 : _logger$info4.call(logger, 'SendbirdProvider | useConnect/setupConnection/connectCbSucess', user);
        sdkDispatcher({
          type: INIT_SDK,
          payload: newSdk
        });
        userDispatcher({
          type: INIT_USER,
          payload: user
        });
        initDashboardConfigs(newSdk).then(config => {
          var _logger$info5;
          logger === null || logger === void 0 ? void 0 : (_logger$info5 = logger.info) === null || _logger$info5 === void 0 ? void 0 : _logger$info5.call(logger, 'SendbirdProvider | useConnect/setupConnection/getUIKitConfiguration success', {
            config
          });
        }).catch(error => {
          var _logger$error;
          logger === null || logger === void 0 ? void 0 : (_logger$error = logger.error) === null || _logger$error === void 0 ? void 0 : _logger$error.call(logger, 'SendbirdProvider | useConnect/setupConnection/getUIKitConfiguration failed', {
            error
          });
        });

        // use nickname/profileUrl if provided
        // or set userID as nickname
        if ((nickname !== user.nickname || profileUrl !== user.profileUrl) && !(index.isTextuallyNull(nickname) && index.isTextuallyNull(profileUrl))) {
          var _logger$info6;
          logger === null || logger === void 0 ? void 0 : (_logger$info6 = logger.info) === null || _logger$info6 === void 0 ? void 0 : _logger$info6.call(logger, 'SendbirdProvider | useConnect/setupConnection/updateCurrentUserInfo', {
            nickname,
            profileUrl
          });
          newSdk.updateCurrentUserInfo({
            nickname: nickname || user.nickname || (isUserIdUsedForNickname ? user.userId : ''),
            profileUrl: profileUrl || user.profileUrl
          }).then(namedUser => {
            var _logger$info7;
            logger === null || logger === void 0 ? void 0 : (_logger$info7 = logger.info) === null || _logger$info7 === void 0 ? void 0 : _logger$info7.call(logger, 'SendbirdProvider | useConnect/setupConnection/updateCurrentUserInfo success', {
              nickname,
              profileUrl
            });
            userDispatcher({
              type: UPDATE_USER_INFO,
              payload: namedUser
            });
          }).finally(() => {
            resolve();
          });
        } else {
          resolve();
        }
      };
      const connectCbError = e => {
        var _logger$error2;
        const errorMessage = getConnectSbError(e);
        logger === null || logger === void 0 ? void 0 : (_logger$error2 = logger.error) === null || _logger$error2 === void 0 ? void 0 : _logger$error2.call(logger, errorMessage, {
          e,
          appId,
          userId
        });
        sdkDispatcher({
          type: RESET_SDK
        });
        userDispatcher({
          type: RESET_USER
        });
        sdkDispatcher({
          type: SDK_ERROR
        });
        // exit promise with error
        reject(errorMessage);
      };
      logger === null || logger === void 0 ? void 0 : (_logger$info8 = logger.info) === null || _logger$info8 === void 0 ? void 0 : _logger$info8.call(logger, `SendbirdProvider | useConnect/setupConnection/connect connecting using ${accessToken !== null && accessToken !== void 0 ? accessToken : userId}`);
      newSdk.connect(userId, accessToken).then(res => connectCbSucess(res)).catch(err => connectCbError(err));
    } else {
      var _logger$error3;
      const errorMessage = getMissingParamError({
        userId,
        appId
      });
      sdkDispatcher({
        type: SDK_ERROR
      });
      logger === null || logger === void 0 ? void 0 : (_logger$error3 = logger.error) === null || _logger$error3 === void 0 ? void 0 : _logger$error3.call(logger, errorMessage);
      // exit promise with error
      reject(errorMessage);
    }
  });
}

async function connect(_ref) {
  let {
    logger,
    sdkDispatcher,
    userDispatcher,
    initDashboardConfigs,
    userId,
    appId,
    customApiHost,
    customWebSocketHost,
    configureSession,
    nickname,
    profileUrl,
    accessToken,
    sdk,
    sdkInitParams,
    customExtensionParams,
    isMobile
  } = _ref;
  await disconnectSdk({
    logger,
    sdkDispatcher,
    userDispatcher,
    sdk
  });
  await setUpConnection({
    logger,
    sdkDispatcher,
    userDispatcher,
    initDashboardConfigs,
    userId,
    appId,
    customApiHost,
    customWebSocketHost,
    configureSession,
    nickname,
    profileUrl,
    accessToken,
    sdkInitParams,
    customExtensionParams,
    isMobile
  });
}

function useConnect(triggerTypes, staticTypes) {
  var _logger$info;
  const {
    userId,
    appId,
    accessToken,
    isMobile,
    isUserIdUsedForNickname
  } = triggerTypes;
  const {
    logger,
    nickname,
    profileUrl,
    configureSession,
    customApiHost,
    customWebSocketHost,
    sdk,
    sdkDispatcher,
    userDispatcher,
    initDashboardConfigs,
    sdkInitParams,
    customExtensionParams
  } = staticTypes;
  logger === null || logger === void 0 ? void 0 : (_logger$info = logger.info) === null || _logger$info === void 0 ? void 0 : _logger$info.call(logger, 'SendbirdProvider | useConnect', _rollupPluginBabelHelpers._objectSpread2(_rollupPluginBabelHelpers._objectSpread2({}, triggerTypes), staticTypes));
  React.useEffect(() => {
    var _logger$info2;
    logger === null || logger === void 0 ? void 0 : (_logger$info2 = logger.info) === null || _logger$info2 === void 0 ? void 0 : _logger$info2.call(logger, 'SendbirdProvider | useConnect/useEffect', {
      userId,
      appId,
      accessToken
    });
    try {
      connect({
        userId,
        appId,
        accessToken,
        logger,
        nickname,
        profileUrl,
        configureSession,
        customApiHost,
        customWebSocketHost,
        sdk,
        sdkDispatcher,
        userDispatcher,
        initDashboardConfigs,
        isUserIdUsedForNickname,
        sdkInitParams,
        customExtensionParams,
        isMobile
      });
    } catch (error) {
      var _logger$error;
      logger === null || logger === void 0 ? void 0 : (_logger$error = logger.error) === null || _logger$error === void 0 ? void 0 : _logger$error.call(logger, 'SendbirdProvider | useConnect/useEffect', error);
    }
  }, [userId, appId, accessToken]);
  const reconnect = React.useCallback(() => {
    var _logger$info3;
    logger === null || logger === void 0 ? void 0 : (_logger$info3 = logger.info) === null || _logger$info3 === void 0 ? void 0 : _logger$info3.call(logger, 'SendbirdProvider | useConnect/reconnect/useCallback', {
      sdk
    });
    try {
      connect({
        userId,
        appId,
        accessToken,
        logger,
        nickname,
        profileUrl,
        configureSession,
        customApiHost,
        customWebSocketHost,
        sdk,
        sdkDispatcher,
        userDispatcher,
        initDashboardConfigs,
        isUserIdUsedForNickname,
        sdkInitParams,
        customExtensionParams,
        isMobile
      });
    } catch (error) {
      var _logger$error2;
      logger === null || logger === void 0 ? void 0 : (_logger$error2 = logger.error) === null || _logger$error2 === void 0 ? void 0 : _logger$error2.call(logger, 'SendbirdProvider | useConnect/reconnect/useCallback', error);
    }
  }, [sdk]);
  return reconnect;
}

// Logger, pretty much explains it
// in SendbirdProvider

// const [logger, setLogger] = useState(LoggerFactory(logLevel));
const LOG_LEVELS = {
  DEBUG: 'debug',
  WARNING: 'warning',
  ERROR: 'error',
  INFO: 'info',
  ALL: 'all'
};
const colorLog = level => {
  switch (level) {
    case LOG_LEVELS.WARNING:
      return 'color: Orange';
    case LOG_LEVELS.ERROR:
      return 'color: Red';
    default:
      return 'color: Gray';
  }
};
const printLog = _ref => {
  let {
    level,
    title,
    description = ''
  } = _ref;
  // eslint-disable-next-line no-console
  console.log(`%c SendbirdUIKit | ${level} | ${new Date().toISOString()} | ${title} ${description && '|'}`, colorLog(level), description);
};
const noop = () => {/* noop */};
const getDefaultLogger = () => ({
  info: noop,
  error: noop,
  warning: noop
});
const LoggerFactory = (lvl, customInterface) => {
  const logInterface = customInterface || printLog;
  const lvlArray = Array.isArray(lvl) ? lvl : [lvl];
  const applyLog = lgLvl => (title, description) => logInterface({
    level: lgLvl,
    title,
    description
  });
  const logger = lvlArray.reduce((accumulator, currentLvl) => {
    if (currentLvl === LOG_LEVELS.DEBUG || currentLvl === LOG_LEVELS.ALL) {
      return _rollupPluginBabelHelpers._objectSpread2(_rollupPluginBabelHelpers._objectSpread2({}, accumulator), {}, {
        info: applyLog(LOG_LEVELS.INFO),
        error: applyLog(LOG_LEVELS.ERROR),
        warning: applyLog(LOG_LEVELS.WARNING)
      });
    }
    if (currentLvl === LOG_LEVELS.INFO) {
      return _rollupPluginBabelHelpers._objectSpread2(_rollupPluginBabelHelpers._objectSpread2({}, accumulator), {}, {
        info: applyLog(LOG_LEVELS.INFO)
      });
    }
    if (currentLvl === LOG_LEVELS.ERROR) {
      return _rollupPluginBabelHelpers._objectSpread2(_rollupPluginBabelHelpers._objectSpread2({}, accumulator), {}, {
        error: applyLog(LOG_LEVELS.ERROR)
      });
    }
    if (currentLvl === LOG_LEVELS.WARNING) {
      return _rollupPluginBabelHelpers._objectSpread2(_rollupPluginBabelHelpers._objectSpread2({}, accumulator), {}, {
        warning: applyLog(LOG_LEVELS.WARNING)
      });
    }
    return _rollupPluginBabelHelpers._objectSpread2({}, accumulator);
  }, getDefaultLogger());
  return logger;
};

// TODO: Make this to hook, useLogger

// https://davidwalsh.name/pubsub-javascript
// we use pubsub to sync events between multiple components(example - ChannelList, Channel)
// for example, if customer sends a message from their custom component
// without pubsub,we would not be able to listen to it
// in our ChannelList or Conversation

const pubSubFactory = () => {
  const topics = {};
  const hOP = topics.hasOwnProperty;
  return {
    __getTopics: () => topics,
    subscribe: (topic, listener) => {
      // Create the topic's object if not yet created
      if (!hOP.call(topics, topic)) {
        topics[topic] = [];
      }

      // Add the listener to queue
      const index = topics[topic].push(listener) - 1;

      // Provide handle back for removal of topic
      return {
        remove: () => {
          delete topics[topic][index];
        }
      };
    },
    publish: (topic, info) => {
      // If the topic doesn't exist, or there's no listeners in queue, just leave
      if (!hOP.call(topics, topic)) {
        return;
      }

      // Cycle through topics queue, fire!
      topics[topic].forEach(item => {
        item(info !== undefined ? info : {});
      });
    }
  };
};

/* eslint-disable default-param-last */
function useAppendDomNode() {
  let ids = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  let rootSelector = arguments.length > 1 ? arguments[1] : undefined;
  React.useEffect(() => {
    const root = document.querySelector(rootSelector);
    ids.forEach(id => {
      const elem = document.createElement('div');
      elem.setAttribute('id', id);
      root.appendChild(elem);
    });
    return () => {
      ids.forEach(id => {
        const target = document.getElementById(id);
        if (target) {
          root.removeChild(target);
        }
      });
    };
  }, []);
}

const VoiceMessageProvider = _ref => {
  let {
    children,
    isVoiceMessageEnabled = true
  } = _ref;
  if (!isVoiceMessageEnabled) {
    return /*#__PURE__*/React__default["default"].createElement(VoicePlayer_context.VoicePlayerProvider, null, children);
  }
  return /*#__PURE__*/React__default["default"].createElement(VoiceRecorder_context.VoiceRecorderProvider, null, /*#__PURE__*/React__default["default"].createElement(VoicePlayer_context.VoicePlayerProvider, null, children));
};

function uikitConfigMapper(_ref) {
  var _uikitOptions$common$, _uikitOptions$common, _uikitOptions$groupCh, _uikitOptions$groupCh2, _uikitOptions$groupCh3, _uikitOptions$groupCh4, _uikitOptions$groupCh5, _uikitOptions$groupCh6, _uikitOptions$groupCh7, _uikitOptions$groupCh8, _uikitOptions$groupCh9, _uikitOptions$groupCh10, _uikitOptions$groupCh11, _uikitOptions$groupCh12, _uikitOptions$groupCh13, _uikitOptions$groupCh14, _uikitOptions$groupCh15, _uikitOptions$groupCh16, _uikitOptions$groupCh17, _uikitOptions$groupCh18, _uikitOptions$groupCh19, _uikitOptions$openCha, _uikitOptions$openCha2, _uikitOptions$openCha3;
  let {
    legacyConfig,
    uikitOptions = {}
  } = _ref;
  const {
    replyType,
    isMentionEnabled,
    isReactionEnabled,
    disableUserProfile,
    isVoiceMessageEnabled,
    isTypingIndicatorEnabledOnChannelList,
    isMessageReceiptStatusEnabledOnChannelList,
    showSearchIcon
  } = legacyConfig;
  return {
    common: {
      enableUsingDefaultUserProfile: (_uikitOptions$common$ = (_uikitOptions$common = uikitOptions.common) === null || _uikitOptions$common === void 0 ? void 0 : _uikitOptions$common.enableUsingDefaultUserProfile) !== null && _uikitOptions$common$ !== void 0 ? _uikitOptions$common$ : typeof disableUserProfile === 'boolean' ? !disableUserProfile : undefined
    },
    groupChannel: {
      enableOgtag: (_uikitOptions$groupCh = uikitOptions.groupChannel) === null || _uikitOptions$groupCh === void 0 ? void 0 : _uikitOptions$groupCh.enableOgtag,
      enableMention: (_uikitOptions$groupCh2 = (_uikitOptions$groupCh3 = uikitOptions.groupChannel) === null || _uikitOptions$groupCh3 === void 0 ? void 0 : _uikitOptions$groupCh3.enableMention) !== null && _uikitOptions$groupCh2 !== void 0 ? _uikitOptions$groupCh2 : isMentionEnabled,
      enableReactions: (_uikitOptions$groupCh4 = (_uikitOptions$groupCh5 = uikitOptions.groupChannel) === null || _uikitOptions$groupCh5 === void 0 ? void 0 : _uikitOptions$groupCh5.enableReactions) !== null && _uikitOptions$groupCh4 !== void 0 ? _uikitOptions$groupCh4 : isReactionEnabled,
      enableTypingIndicator: (_uikitOptions$groupCh6 = uikitOptions.groupChannel) === null || _uikitOptions$groupCh6 === void 0 ? void 0 : _uikitOptions$groupCh6.enableTypingIndicator,
      enableVoiceMessage: (_uikitOptions$groupCh7 = (_uikitOptions$groupCh8 = uikitOptions.groupChannel) === null || _uikitOptions$groupCh8 === void 0 ? void 0 : _uikitOptions$groupCh8.enableVoiceMessage) !== null && _uikitOptions$groupCh7 !== void 0 ? _uikitOptions$groupCh7 : isVoiceMessageEnabled,
      replyType: (_uikitOptions$groupCh9 = (_uikitOptions$groupCh10 = uikitOptions.groupChannel) === null || _uikitOptions$groupCh10 === void 0 ? void 0 : _uikitOptions$groupCh10.replyType) !== null && _uikitOptions$groupCh9 !== void 0 ? _uikitOptions$groupCh9 : replyType != null ? resolvedReplyType.getCaseResolvedReplyType(replyType).lowerCase : undefined,
      threadReplySelectType: (_uikitOptions$groupCh11 = uikitOptions.groupChannel) === null || _uikitOptions$groupCh11 === void 0 ? void 0 : _uikitOptions$groupCh11.threadReplySelectType,
      input: {
        enableDocument: (_uikitOptions$groupCh12 = uikitOptions.groupChannel) === null || _uikitOptions$groupCh12 === void 0 ? void 0 : (_uikitOptions$groupCh13 = _uikitOptions$groupCh12.input) === null || _uikitOptions$groupCh13 === void 0 ? void 0 : _uikitOptions$groupCh13.enableDocument
      }
    },
    groupChannelList: {
      enableTypingIndicator: (_uikitOptions$groupCh14 = (_uikitOptions$groupCh15 = uikitOptions.groupChannelList) === null || _uikitOptions$groupCh15 === void 0 ? void 0 : _uikitOptions$groupCh15.enableTypingIndicator) !== null && _uikitOptions$groupCh14 !== void 0 ? _uikitOptions$groupCh14 : isTypingIndicatorEnabledOnChannelList,
      enableMessageReceiptStatus: (_uikitOptions$groupCh16 = (_uikitOptions$groupCh17 = uikitOptions.groupChannelList) === null || _uikitOptions$groupCh17 === void 0 ? void 0 : _uikitOptions$groupCh17.enableMessageReceiptStatus) !== null && _uikitOptions$groupCh16 !== void 0 ? _uikitOptions$groupCh16 : isMessageReceiptStatusEnabledOnChannelList
    },
    groupChannelSettings: {
      enableMessageSearch: (_uikitOptions$groupCh18 = (_uikitOptions$groupCh19 = uikitOptions.groupChannelSettings) === null || _uikitOptions$groupCh19 === void 0 ? void 0 : _uikitOptions$groupCh19.enableMessageSearch) !== null && _uikitOptions$groupCh18 !== void 0 ? _uikitOptions$groupCh18 : showSearchIcon
    },
    openChannel: {
      enableOgtag: (_uikitOptions$openCha = uikitOptions.openChannel) === null || _uikitOptions$openCha === void 0 ? void 0 : _uikitOptions$openCha.enableOgtag,
      input: {
        enableDocument: (_uikitOptions$openCha2 = uikitOptions.openChannel) === null || _uikitOptions$openCha2 === void 0 ? void 0 : (_uikitOptions$openCha3 = _uikitOptions$openCha2.input) === null || _uikitOptions$openCha3 === void 0 ? void 0 : _uikitOptions$openCha3.enableDocument
      }
    }
  };
}

const TIMEOUT = 2000;

/*
  * This is a factory function that returns a scheduler.
  * The scheduler is a queue that calls the callback function on intervals.
  * If interval is empty, the callback function is called immediately.
  * If interval is not empty, the callback function is called after the interval.
*/
function schedulerFactory(_ref) {
  let {
    logger,
    timeout,
    cb
  } = _ref;
  let queue = [];
  let interval = null;
  const push = channel => {
    const channelPresent = queue.find(c => c.url === channel.url);
    if (!channelPresent) {
      queue.push(channel);
    } else {
      logger.info('Channel: Mark as read already in queue', {
        channel
      });
    }
    // start the interval if it's not already running
    if (interval) {
      return;
    }
    const item = queue.shift();
    if (item) {
      cb(item);
    }
    interval = setInterval(() => {
      if (queue.length === 0 && interval) {
        clearInterval(interval);
        interval = null;
        return;
      }
      const item = queue.shift();
      if (item) {
        cb(item);
      }
    }, timeout || TIMEOUT);
  };
  const clear = () => {
    queue = [];
    if (interval) {
      clearInterval(interval);
      interval = null;
    }
  };
  return {
    push,
    clear,
    getQueue: () => queue
  };
}

// this hook accepts a callback to run component is unmounted
function useUnmount(callback) {
  let deps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  React.useLayoutEffect(() => {
    return () => {
      callback();
    };
  }, deps);
}

function useMarkAsReadScheduler(_ref, _ref2) {
  let {
    isConnected
  } = _ref;
  let {
    logger
  } = _ref2;
  const markAsReadScheduler = React.useMemo(() => schedulerFactory({
    logger,
    cb: channel => {
      try {
        channel.markAsRead();
      } catch (error) {
        logger.warning('Channel: Mark as delivered failed', {
          channel,
          error
        });
      }
    }
  }), []);
  React.useEffect(() => {
    // for simplicity, we clear the queue when the connection is lost
    if (!isConnected) {
      markAsReadScheduler.clear();
    }
  }, [isConnected]);
  useUnmount(() => {
    markAsReadScheduler.clear();
  });
  return markAsReadScheduler;
}

function useMarkAsDeliveredScheduler(_ref, _ref2) {
  let {
    isConnected
  } = _ref;
  let {
    logger
  } = _ref2;
  const markAsDeliveredScheduler = React.useMemo(() => schedulerFactory({
    logger,
    cb: channel => {
      try {
        channel.markAsDelivered();
      } catch (error) {
        logger.warning('Channel: Mark as delivered failed', {
          channel,
          error
        });
      }
    }
  }), []);
  React.useEffect(() => {
    // for simplicity, we clear the queue when the connection is lost
    if (!isConnected) {
      markAsDeliveredScheduler.clear();
    }
  }, [isConnected]);
  useUnmount(() => {
    markAsDeliveredScheduler.clear();
  });
  return markAsDeliveredScheduler;
}

function Sendbird(props) {
  const localConfigs = uikitConfigMapper({
    legacyConfig: {
      replyType: props.replyType,
      isMentionEnabled: props.isMentionEnabled,
      isReactionEnabled: props.isReactionEnabled,
      disableUserProfile: props.disableUserProfile,
      isVoiceMessageEnabled: props.isVoiceMessageEnabled,
      isTypingIndicatorEnabledOnChannelList: props.isTypingIndicatorEnabledOnChannelList,
      isMessageReceiptStatusEnabledOnChannelList: props.isMessageReceiptStatusEnabledOnChannelList,
      showSearchIcon: props.showSearchIcon
    },
    uikitOptions: props.uikitOptions
  });
  return /*#__PURE__*/React__default["default"].createElement(uikitTools.UIKitConfigProvider, {
    localConfigs: {
      common: localConfigs === null || localConfigs === void 0 ? void 0 : localConfigs.common,
      groupChannel: {
        channel: localConfigs === null || localConfigs === void 0 ? void 0 : localConfigs.groupChannel,
        channelList: localConfigs === null || localConfigs === void 0 ? void 0 : localConfigs.groupChannelList,
        setting: localConfigs === null || localConfigs === void 0 ? void 0 : localConfigs.groupChannelSettings
      },
      openChannel: {
        channel: localConfigs === null || localConfigs === void 0 ? void 0 : localConfigs.openChannel
      }
    }
  }, /*#__PURE__*/React__default["default"].createElement(SendbirdSDK, props));
}
const SendbirdSDK = _ref => {
  let {
    appId,
    userId,
    children,
    accessToken = '',
    customApiHost = '',
    customWebSocketHost = '',
    configureSession = null,
    theme = 'light',
    config = {},
    nickname = '',
    colorSet = null,
    stringSet: stringSet$1 = null,
    dateLocale = null,
    profileUrl = '',
    voiceRecord = {
      maxRecordingTime: consts.VOICE_RECORDER_DEFAULT_MAX,
      minRecordingTime: consts.VOICE_RECORDER_DEFAULT_MIN
    },
    userListQuery = null,
    imageCompression = {},
    allowProfileEdit = false,
    disableMarkAsDelivered = false,
    renderUserProfile = null,
    onUserProfileMessage = null,
    breakpoint = false,
    isUserIdUsedForNickname = true,
    sdkInitParams,
    customExtensionParams
  } = _ref;
  const {
    logLevel = '',
    userMention = {},
    isREMUnitEnabled = false
  } = config;
  const {
    isMobile
  } = MediaQueryContext.useMediaQueryContext();
  const [logger, setLogger] = React.useState(LoggerFactory(logLevel));
  const [pubSub] = React.useState(pubSubFactory());
  const [sdkStore, sdkDispatcher] = React.useReducer(reducer$1, initialState$1);
  const [userStore, userDispatcher] = React.useReducer(reducer, initialState);
  const {
    configs,
    configsWithAppAttr,
    initDashboardConfigs
  } = uikitTools.useUIKitConfig();
  const sdkInitialized = sdkStore.initialized;
  const sdk = sdkStore === null || sdkStore === void 0 ? void 0 : sdkStore.sdk;
  useTheme(colorSet);
  const reconnect = useConnect({
    appId,
    userId,
    accessToken,
    isUserIdUsedForNickname,
    isMobile
  }, {
    logger,
    nickname,
    profileUrl,
    configureSession,
    customApiHost,
    customWebSocketHost,
    sdkInitParams,
    customExtensionParams,
    sdk,
    sdkDispatcher,
    userDispatcher,
    initDashboardConfigs
  });
  useUnmount(() => {
    if (typeof sdk.disconnect === 'function') {
      disconnectSdk({
        logger,
        sdkDispatcher,
        userDispatcher,
        sdk
      });
    }
  }, [sdk.disconnect]);

  // to create a pubsub to communicate between parent and child
  React.useEffect(() => {
    setLogger(LoggerFactory(logLevel));
  }, [logLevel]);
  useAppendDomNode(['sendbird-modal-root', 'sendbird-dropdown-portal', 'sendbird-emoji-list-portal'], 'body');

  // should move to reducer
  const [currenttheme, setCurrenttheme] = React.useState(theme);
  React.useEffect(() => {
    setCurrenttheme(theme);
  }, [theme]);
  React.useEffect(() => {
    const body = document.querySelector('body');
    body.classList.remove('sendbird-experimental__rem__units');
    if (isREMUnitEnabled) {
      body.classList.add('sendbird-experimental__rem__units');
    }
  }, [isREMUnitEnabled]);
  // add-remove theme from body
  React.useEffect(() => {
    logger.info('Setup theme', `Theme: ${currenttheme}`);
    try {
      const body = document.querySelector('body');
      body.classList.remove('sendbird-theme--light');
      body.classList.remove('sendbird-theme--dark');
      body.classList.add(`sendbird-theme--${currenttheme || 'light'}`);
      logger.info('Finish setup theme');
      // eslint-disable-next-line no-empty
    } catch (e) {
      logger.warning('Setup theme failed', `${e}`);
    }
    return () => {
      try {
        const body = document.querySelector('body');
        body.classList.remove('sendbird-theme--light');
        body.classList.remove('sendbird-theme--dark');
        // eslint-disable-next-line no-empty
      } catch (_unused) {}
    };
  }, [currenttheme]);
  const isOnline = useConnectionStatus(sdkStore.sdk, logger);
  const markAsReadScheduler = useMarkAsReadScheduler({
    isConnected: isOnline
  }, {
    logger
  });
  const markAsDeliveredScheduler = useMarkAsDeliveredScheduler({
    isConnected: isOnline
  }, {
    logger
  });
  const localeStringSet = React__default["default"].useMemo(() => {
    if (!stringSet$1) {
      return stringSet.getStringSet('en');
    }
    return _rollupPluginBabelHelpers._objectSpread2(_rollupPluginBabelHelpers._objectSpread2({}, stringSet.getStringSet('en')), stringSet$1);
  }, [stringSet$1]);
  return /*#__PURE__*/React__default["default"].createElement(withSendbird.SendbirdSdkContext.Provider, {
    value: {
      stores: {
        sdkStore,
        userStore
      },
      dispatchers: {
        sdkDispatcher,
        userDispatcher,
        reconnect
      },
      config: {
        disableMarkAsDelivered,
        renderUserProfile,
        onUserProfileMessage,
        allowProfileEdit,
        isOnline,
        userId,
        appId,
        accessToken,
        theme: currenttheme,
        setCurrenttheme,
        userListQuery,
        logger,
        pubSub,
        imageCompression: _rollupPluginBabelHelpers._objectSpread2({
          compressionRate: 0.7
        }, imageCompression),
        voiceRecord,
        userMention: {
          maxMentionCount: (userMention === null || userMention === void 0 ? void 0 : userMention.maxMentionCount) || 10,
          maxSuggestionCount: (userMention === null || userMention === void 0 ? void 0 : userMention.maxSuggestionCount) || 15
        },
        markAsReadScheduler,
        markAsDeliveredScheduler,
        // From UIKitConfigProvider.localConfigs
        disableUserProfile: !configs.common.enableUsingDefaultUserProfile,
        isReactionEnabled: sdkInitialized && configsWithAppAttr(sdk).groupChannel.channel.enableReactions,
        isMentionEnabled: configs.groupChannel.channel.enableMention,
        isVoiceMessageEnabled: configs.groupChannel.channel.enableVoiceMessage,
        replyType: resolvedReplyType.getCaseResolvedReplyType(configs.groupChannel.channel.replyType).upperCase,
        isTypingIndicatorEnabledOnChannelList: configs.groupChannel.channelList.enableTypingIndicator,
        isMessageReceiptStatusEnabledOnChannelList: configs.groupChannel.channelList.enableMessageReceiptStatus,
        showSearchIcon: sdkInitialized && configsWithAppAttr(sdk).groupChannel.setting.enableMessageSearch,
        // Remote configs set from dashboard by UIKit feature configuration
        groupChannel: {
          enableOgtag: sdkInitialized && configsWithAppAttr(sdk).groupChannel.channel.enableOgtag,
          enableTypingIndicator: configs.groupChannel.channel.enableTypingIndicator,
          enableDocument: configs.groupChannel.channel.input.enableDocument,
          threadReplySelectType: resolvedReplyType.getCaseResolvedThreadReplySelectType(configs.groupChannel.channel.threadReplySelectType).upperCase
        },
        openChannel: {
          enableOgtag: sdkInitialized && configsWithAppAttr(sdk).openChannel.channel.enableOgtag,
          enableDocument: configs.openChannel.channel.input.enableDocument
        }
      }
    }
  }, /*#__PURE__*/React__default["default"].createElement(MediaQueryContext.MediaQueryProvider, {
    logger: logger,
    breakpoint: breakpoint
  }, /*#__PURE__*/React__default["default"].createElement(LocalizationContext.LocalizationProvider, {
    stringSet: localeStringSet,
    dateLocale: dateLocale
  }, /*#__PURE__*/React__default["default"].createElement(VoiceMessageProvider, {
    isVoiceMessageEnabled: configs.groupChannel.channel.enableVoiceMessage
  }, children))));
};

module.exports = Sendbird;
//# sourceMappingURL=SendbirdProvider.js.map
