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EAASG,EACb,EAGJ,OADAva,EAAWyI,cAAcA,GAClB,KACHzI,EAAW4I,eAAeH,EAAc,CAC3C,GACF,CAACzI,EAAY4Z,EAAUC,EAAeK,IAClCN,EAAW/Z,OAAQF,CAAS,EDGjB,CAAgB8Z,GAC5Be,GAAkB,OAAmBtD,GACrCuD,EAAe,KACrB,GAAId,EAAW,CACX,IAAKc,EACD,KAAM,2DAEV,OAAOlW,OAAOyE,OAAOzE,OAAOyE,OAAO,CAAC,EAAG2Q,GAAYc,EACvD,CACA,GAAIf,EAAW,CACX,IAAKc,EACD,KAAM,sCAEV,OAAOjW,OAAOyE,OAAOzE,OAAOyE,OAAO,CAAC,EAAG0Q,GAAYc,EACvD,CACA,MAAKf,GAAiBD,EAIZ,qGAHA,iJAIV,C","sources":["file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@azure+communication-react@1.10.0_6x3ev4d3227te4dl7uene6lmqi/node_modules/@azure/communication-react/dist/dist-esm/chat-component-bindings/src/providers/ChatClientProvider.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@azure+communication-react@1.10.0_6x3ev4d3227te4dl7uene6lmqi/node_modules/@azure/communication-react/dist/dist-esm/chat-component-bindings/src/providers/ChatThreadClientProvider.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@azure+communication-react@1.10.0_6x3ev4d3227te4dl7uene6lmqi/node_modules/@azure/communication-react/dist/dist-esm/chat-stateful-client/src/ChatClientState.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@azure+communication-react@1.10.0_6x3ev4d3227te4dl7uene6lmqi/node_modules/@azure/communication-react/dist/dist-esm/chat-stateful-client/src/Constants.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@azure+communication-react@1.10.0_6x3ev4d3227te4dl7uene6lmqi/node_modules/@azure/communication-react/dist/dist-esm/chat-stateful-client/src/Logger.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@azure+communication-react@1.10.0_6x3ev4d3227te4dl7uene6lmqi/node_modules/@azure/communication-react/dist/dist-esm/chat-stateful-client/src/ChatContext.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@azure+communication-react@1.10.0_6x3ev4d3227te4dl7uene6lmqi/node_modules/@azure/communication-react/dist/dist-esm/chat-stateful-client/src/convertChatMessage.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@azure+communication-react@1.10.0_6x3ev4d3227te4dl7uene6lmqi/node_modules/@azure/communication-react/dist/dist-esm/chat-stateful-client/src/EventSubscriber.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@azure+communication-react@1.10.0_6x3ev4d3227te4dl7uene6lmqi/node_modules/@azure/communication-react/dist/dist-esm/chat-stateful-client/src/iterators/createDecoratedIterator.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@azure+communication-react@1.10.0_6x3ev4d3227te4dl7uene6lmqi/node_modules/@azure/communication-react/dist/dist-esm/chat-stateful-client/src/StatefulChatThreadClient.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@azure+communication-react@1.10.0_6x3ev4d3227te4dl7uene6lmqi/node_modules/@azure/communication-react/dist/dist-esm/chat-stateful-client/src/iterators/createDecoratedListMessages.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@azure+communication-react@1.10.0_6x3ev4d3227te4dl7uene6lmqi/node_modules/@azure/communication-react/dist/dist-esm/chat-stateful-client/src/iterators/createDecoratedListParticipants.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@azure+communication-react@1.10.0_6x3ev4d3227te4dl7uene6lmqi/node_modules/@azure/communication-react/dist/dist-esm/chat-stateful-client/src/iterators/createDecoratedListReadReceipts.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@azure+communication-react@1.10.0_6x3ev4d3227te4dl7uene6lmqi/node_modules/@azure/communication-react/dist/dist-esm/chat-stateful-client/src/StatefulChatClient.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@azure+communication-react@1.10.0_6x3ev4d3227te4dl7uene6lmqi/node_modules/@azure/communication-react/dist/dist-esm/chat-stateful-client/src/iterators/createDecoratedListThreads.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@azure+communication-react@1.10.0_6x3ev4d3227te4dl7uene6lmqi/node_modules/@azure/communication-react/dist/dist-esm/chat-component-bindings/src/baseSelectors.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@azure+communication-react@1.10.0_6x3ev4d3227te4dl7uene6lmqi/node_modules/@azure/communication-react/dist/dist-esm/chat-component-bindings/src/sendBoxSelector.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@azure+communication-react@1.10.0_6x3ev4d3227te4dl7uene6lmqi/node_modules/@azure/communication-react/dist/dist-esm/chat-component-bindings/src/utils/constants.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@azure+communication-react@1.10.0_6x3ev4d3227te4dl7uene6lmqi/node_modules/@azure/communication-react/dist/dist-esm/chat-component-bindings/src/utils/compareMessages.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@azure+communication-react@1.10.0_6x3ev4d3227te4dl7uene6lmqi/node_modules/@azure/communication-react/dist/dist-esm/chat-component-bindings/src/messageThreadSelector.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@azure+communication-react@1.10.0_6x3ev4d3227te4dl7uene6lmqi/node_modules/@azure/communication-react/dist/dist-esm/chat-component-bindings/src/utils/updateMessagesWithAttached.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@azure+communication-react@1.10.0_6x3ev4d3227te4dl7uene6lmqi/node_modules/@azure/communication-react/dist/dist-esm/chat-component-bindings/src/typingIndicatorSelector.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@azure+communication-react@1.10.0_6x3ev4d3227te4dl7uene6lmqi/node_modules/@azure/communication-react/dist/dist-esm/chat-component-bindings/src/chatParticipantListSelector.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@azure+communication-react@1.10.0_6x3ev4d3227te4dl7uene6lmqi/node_modules/@azure/communication-react/dist/dist-esm/chat-component-bindings/src/errorBarSelector.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@azure+communication-react@1.10.0_6x3ev4d3227te4dl7uene6lmqi/node_modules/@azure/communication-react/dist/dist-esm/chat-component-bindings/src/hooks/usePropsFor.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@azure+communication-react@1.10.0_6x3ev4d3227te4dl7uene6lmqi/node_modules/@azure/communication-react/dist/dist-esm/chat-component-bindings/src/handlers/createHandlers.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@azure+communication-react@1.10.0_6x3ev4d3227te4dl7uene6lmqi/node_modules/@azure/communication-react/dist/dist-esm/chat-component-bindings/src/hooks/useHandlers.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@azure+communication-react@1.10.0_6x3ev4d3227te4dl7uene6lmqi/node_modules/@azure/communication-react/dist/dist-esm/communication-react/src/mergedHooks.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@azure+communication-react@1.10.0_6x3ev4d3227te4dl7uene6lmqi/node_modules/@azure/communication-react/dist/dist-esm/chat-component-bindings/src/hooks/useSelector.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport React, { createContext, useContext } from 'react';\n/**\n * @private\n */\nexport const ChatClientContext = createContext(undefined);\n/**\n * A {@link React.Context} that stores a {@link StatefulChatClient}.\n *\n * Chat components from this package must be wrapped with a {@link ChatClientProvider}.\n *\n * @public\n */\nexport const ChatClientProvider = (props) => {\n return React.createElement(ChatClientContext.Provider, { value: props.chatClient }, props.children);\n};\n/**\n * Hook to obtain {@link StatefulChatClient} from the provider.\n *\n * Useful when implementing a custom component that utilizes the providers\n * exported from this library.\n *\n * @public\n */\nexport const useChatClient = () => {\n const chatClient = useContext(ChatClientContext);\n if (!chatClient) {\n throw 'Please wrap components with ChatClientProvider and initialize a chat client before calling the hook!';\n }\n return chatClient;\n};\n//# sourceMappingURL=ChatClientProvider.js.map","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport React, { createContext, useContext } from 'react';\n/**\n * @private\n */\nexport const ChatThreadClientContext = createContext(undefined);\n/**\n * A {@link React.Context} that stores a {@link @azure/communication-chat#ChatThreadClient}.\n *\n * Chat components from this package must be wrapped with a {@link ChatThreadClientProvider}.\n *\n * @public\n */\nexport const ChatThreadClientProvider = (props) => {\n return React.createElement(ChatThreadClientContext.Provider, { value: props.chatThreadClient }, props.children);\n};\n/**\n * Hook to obtain {@link @azure/communication-chat#ChatThreadClient} from the provider.\n *\n * Useful when implementing a custom component that utilizes the providers\n * exported from this library.\n *\n * @public\n */\nexport const useChatThreadClient = () => {\n const chatThreadClient = useContext(ChatThreadClientContext);\n if (!chatThreadClient) {\n throw 'Please wrap components with ChatThreadClientProvider and initialize a chat thread client before calling the hook.';\n }\n return chatThreadClient;\n};\n//# sourceMappingURL=ChatThreadClientProvider.js.map","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n/**\n * Error thrown from failed {@link StatefulChatClient} methods.\n *\n * @public\n */\nexport class ChatError extends Error {\n constructor(target, innerError, timestamp) {\n super();\n this.target = target;\n this.innerError = innerError;\n // Testing note: It is easier to mock Date::now() than the Date() constructor.\n this.timestamp = timestamp !== null && timestamp !== void 0 ? timestamp : new Date(Date.now());\n this.name = 'ChatError';\n this.message = `${this.target}: ${this.innerError.message}`;\n }\n}\n//# sourceMappingURL=ChatClientState.js.map","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n/**\n * @private\n */\nexport const Constants = {\n TYPING_INDICATOR_MAINTAIN_TIME: 8 * 1000,\n DUMMY_DATE: new Date(0)\n};\n//# sourceMappingURL=Constants.js.map","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport { createClientLogger } from '@azure/logger';\n/**\n * @private\n */\nexport const chatStatefulLogger = createClientLogger('communication-react:chat-stateful');\n//# sourceMappingURL=Logger.js.map","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nimport EventEmitter from 'events';\nimport produce, { enableMapSet, enablePatches } from 'immer';\nimport { ChatError } from './ChatClientState';\nimport { createClientLogger, getLogLevel } from '@azure/logger';\nimport { _safeJSONStringify, toFlatCommunicationIdentifier } from \"../../acs-ui-common/src\";\nimport { Constants } from './Constants';\nimport { chatStatefulLogger } from './Logger';\nenableMapSet();\n// Needed to generate state diff for verbose logging.\nenablePatches();\n/**\n * @private\n */\nexport class ChatContext {\n constructor(maxListeners) {\n this._state = {\n userId: {\n id: ''\n },\n displayName: '',\n threads: {},\n latestErrors: {}\n };\n this._batchMode = false;\n this.typingIndicatorInterval = undefined;\n this._logger = createClientLogger('communication-react:chat-context');\n this._emitter = new EventEmitter();\n if (maxListeners) {\n this._emitter.setMaxListeners(maxListeners);\n }\n }\n getState() {\n return this._state;\n }\n modifyState(modifier) {\n const priorState = this._state;\n this._state = produce(this._state, modifier, (patches) => {\n if (getLogLevel() === 'verbose') {\n // Log to `info` because AzureLogger.verbose() doesn't show up in console.\n this._logger.info(`State change: ${_safeJSONStringify(patches)}`);\n }\n });\n if (!this._batchMode && this._state !== priorState) {\n this._emitter.emit('stateChanged', this._state);\n }\n }\n setThread(threadId, threadState) {\n this.modifyState((draft) => {\n draft.threads[threadId] = threadState;\n });\n }\n createThread(threadId, properties) {\n this.modifyState((draft) => {\n draft.threads[threadId] = {\n chatMessages: {},\n threadId: threadId,\n properties: properties,\n participants: {},\n readReceipts: [],\n typingIndicators: [],\n latestReadTime: new Date(0)\n };\n });\n }\n updateChatConfig(userId, displayName) {\n this.modifyState((draft) => {\n draft.displayName = displayName;\n draft.userId = userId;\n });\n }\n createThreadIfNotExist(threadId, properties) {\n const exists = Object.prototype.hasOwnProperty.call(this.getState().threads, threadId);\n if (!exists) {\n this.createThread(threadId, properties);\n return true;\n }\n return false;\n }\n updateThread(threadId, properties) {\n this.modifyState((draft) => {\n const thread = draft.threads[threadId];\n if (thread) {\n thread.properties = properties;\n }\n });\n }\n updateThreadTopic(threadId, topic) {\n this.modifyState((draft) => {\n if (topic === undefined) {\n return;\n }\n const thread = draft.threads[threadId];\n if (thread && !thread.properties) {\n thread.properties = {\n topic: topic\n };\n }\n else if (thread && thread.properties) {\n thread.properties.topic = topic;\n }\n });\n }\n deleteThread(threadId) {\n this.modifyState((draft) => {\n const thread = draft.threads[threadId];\n if (thread) {\n delete draft.threads[threadId];\n }\n });\n }\n setChatMessages(threadId, messages) {\n this.modifyState((draft) => {\n const threadState = draft.threads[threadId];\n if (threadState) {\n threadState.chatMessages = messages;\n }\n // remove typing indicator when receive messages\n const thread = draft.threads[threadId];\n if (thread) {\n for (const message of Object.values(messages)) {\n this.filterTypingIndicatorForUser(thread, message.sender);\n }\n }\n });\n }\n updateChatMessageContent(threadId, messagesId, content) {\n this.modifyState((draft) => {\n var _a;\n const chatMessage = (_a = draft.threads[threadId]) === null || _a === void 0 ? void 0 : _a.chatMessages[messagesId];\n if (chatMessage) {\n if (!chatMessage.content) {\n chatMessage.content = {};\n }\n chatMessage.content.message = content;\n }\n });\n }\n deleteLocalMessage(threadId, localId) {\n let localMessageDeleted = false;\n this.modifyState((draft) => {\n var _a;\n const chatMessages = (_a = draft.threads[threadId]) === null || _a === void 0 ? void 0 : _a.chatMessages;\n const message = chatMessages ? chatMessages[localId] : undefined;\n if (chatMessages && message && message.clientMessageId) {\n delete chatMessages[message.clientMessageId];\n localMessageDeleted = true;\n }\n });\n return localMessageDeleted;\n }\n deleteMessage(threadId, id) {\n this.modifyState((draft) => {\n var _a;\n const chatMessages = (_a = draft.threads[threadId]) === null || _a === void 0 ? void 0 : _a.chatMessages;\n if (chatMessages) {\n delete chatMessages[id];\n }\n });\n }\n setParticipant(threadId, participant) {\n this.modifyState((draft) => {\n var _a;\n const participants = (_a = draft.threads[threadId]) === null || _a === void 0 ? void 0 : _a.participants;\n if (participants) {\n participants[toFlatCommunicationIdentifier(participant.id)] = participant;\n }\n });\n }\n setParticipants(threadId, participants) {\n this.modifyState((draft) => {\n var _a;\n const participantsMap = (_a = draft.threads[threadId]) === null || _a === void 0 ? void 0 : _a.participants;\n if (participantsMap) {\n for (const participant of participants) {\n participantsMap[toFlatCommunicationIdentifier(participant.id)] = participant;\n }\n }\n });\n }\n deleteParticipants(threadId, participantIds) {\n this.modifyState((draft) => {\n var _a;\n const participants = (_a = draft.threads[threadId]) === null || _a === void 0 ? void 0 : _a.participants;\n if (participants) {\n participantIds.forEach(id => {\n delete participants[toFlatCommunicationIdentifier(id)];\n });\n }\n });\n }\n deleteParticipant(threadId, participantId) {\n this.modifyState((draft) => {\n var _a;\n const participants = (_a = draft.threads[threadId]) === null || _a === void 0 ? void 0 : _a.participants;\n if (participants) {\n delete participants[toFlatCommunicationIdentifier(participantId)];\n }\n });\n }\n addReadReceipt(threadId, readReceipt) {\n this.modifyState((draft) => {\n const thread = draft.threads[threadId];\n const readReceipts = thread === null || thread === void 0 ? void 0 : thread.readReceipts;\n if (thread && readReceipts) {\n // TODO(prprabhu): Replace `this.getState()` with `draft`?\n if (readReceipt.sender !== this.getState().userId && thread.latestReadTime < readReceipt.readOn) {\n thread.latestReadTime = readReceipt.readOn;\n }\n readReceipts.push(readReceipt);\n }\n });\n }\n startTypingIndicatorCleanUp() {\n if (this.typingIndicatorInterval) {\n return;\n }\n this.typingIndicatorInterval = window.setInterval(() => {\n let isTypingActive = false;\n this.modifyState((draft) => {\n for (const thread of Object.values(draft.threads)) {\n const filteredTypingIndicators = thread.typingIndicators.filter(typingIndicator => {\n const timeGap = Date.now() - typingIndicator.receivedOn.getTime();\n return timeGap < Constants.TYPING_INDICATOR_MAINTAIN_TIME;\n });\n if (thread.typingIndicators.length !== filteredTypingIndicators.length) {\n thread.typingIndicators = filteredTypingIndicators;\n }\n if (thread.typingIndicators.length > 0) {\n isTypingActive = true;\n }\n }\n });\n if (!isTypingActive && this.typingIndicatorInterval) {\n window.clearInterval(this.typingIndicatorInterval);\n this.typingIndicatorInterval = undefined;\n }\n }, 1000);\n }\n addTypingIndicator(threadId, typingIndicator) {\n this.modifyState((draft) => {\n const thread = draft.threads[threadId];\n if (thread) {\n const typingIndicators = thread.typingIndicators;\n typingIndicators.push(typingIndicator);\n }\n });\n // Make sure we only maintain a period of typing indicator for perf purposes\n this.startTypingIndicatorCleanUp();\n }\n setChatMessage(threadId, message) {\n const { id: messageId, clientMessageId } = message;\n if (messageId || clientMessageId) {\n this.modifyState((draft) => {\n var _a;\n const threadMessages = (_a = draft.threads[threadId]) === null || _a === void 0 ? void 0 : _a.chatMessages;\n const isLocalIdInMap = threadMessages && clientMessageId && threadMessages[clientMessageId];\n const messageKey = !messageId || isLocalIdInMap ? clientMessageId : messageId;\n if (threadMessages && messageKey) {\n threadMessages[messageKey] = message;\n }\n // remove typing indicator when receive a message from a user\n const thread = draft.threads[threadId];\n if (thread) {\n this.filterTypingIndicatorForUser(thread, message.sender);\n }\n });\n }\n }\n /**\n * Tees any errors encountered in an async function to the state.\n *\n * @param f Async function to execute.\n * @param target The error target to tee error to.\n * @returns Result of calling `f`. Also re-raises any exceptions thrown from `f`.\n * @throws ChatError. Exceptions thrown from `f` are tagged with the failed `target.\n */\n withAsyncErrorTeedToState(f, target) {\n return (...args) => __awaiter(this, void 0, void 0, function* () {\n try {\n return yield f(...args);\n }\n catch (error) {\n const chatError = toChatError(target, error);\n this.setLatestError(target, chatError);\n throw chatError;\n }\n });\n }\n /**\n * Tees any errors encountered in an function to the state.\n *\n * @param f Function to execute.\n * @param target The error target to tee error to.\n * @returns Result of calling `f`. Also re-raises any exceptions thrown from `f`.\n * @throws ChatError. Exceptions thrown from `f` are tagged with the failed `target.\n */\n withErrorTeedToState(f, target) {\n return (...args) => {\n try {\n chatStatefulLogger.info(`Chat stateful client target function called: ${target}`);\n return f(...args);\n }\n catch (error) {\n const chatError = toChatError(target, error);\n this.setLatestError(target, chatError);\n throw chatError;\n }\n };\n }\n setLatestError(target, error) {\n this.modifyState((draft) => {\n draft.latestErrors[target] = error;\n });\n }\n // This is a mutating function, only use it inside of a produce() function\n filterTypingIndicatorForUser(thread, userId) {\n if (!userId) {\n return;\n }\n const typingIndicators = thread.typingIndicators;\n const userIdAsKey = toFlatCommunicationIdentifier(userId);\n const filteredTypingIndicators = typingIndicators.filter(typingIndicator => toFlatCommunicationIdentifier(typingIndicator.sender) !== userIdAsKey);\n if (filteredTypingIndicators.length !== typingIndicators.length) {\n thread.typingIndicators = filteredTypingIndicators;\n }\n }\n /**\n * Batch updates to minimize `stateChanged` events across related operations.\n *\n * - A maximum of one `stateChanged` event is emitted, at the end of the operations.\n * - No `stateChanged` event is emitted if the state did not change through the operations.\n * - In case of an exception, state is reset to the prior value and no `stateChanged` event is emitted.\n *\n * All operations finished in this batch should be synchronous.\n * This function is not reentrant -- do not call batch() from within another batch().\n */\n batch(operations) {\n if (this._batchMode) {\n throw new Error('batch() called from within another batch()');\n }\n this._batchMode = true;\n const priorState = this._state;\n try {\n operations();\n if (this._state !== priorState) {\n this._emitter.emit('stateChanged', this._state);\n }\n }\n catch (e) {\n this._state = priorState;\n if (getLogLevel() === 'verbose') {\n this._logger.warning(`State rollback to: ${_safeJSONStringify(priorState)}`);\n }\n throw e;\n }\n finally {\n this._batchMode = false;\n }\n }\n onStateChange(handler) {\n this._emitter.on('stateChanged', handler);\n }\n offStateChange(handler) {\n this._emitter.off('stateChanged', handler);\n }\n}\nconst toChatError = (target, error) => {\n if (error instanceof Error) {\n return new ChatError(target, error);\n }\n return new ChatError(target, new Error(`${error}`));\n};\n//# sourceMappingURL=ChatContext.js.map","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n/**\n * @private\n */\nexport const convertChatMessage = (message, status = 'delivered', clientMessageId) => {\n return Object.assign(Object.assign({}, message), { clientMessageId: clientMessageId, status });\n};\n//# sourceMappingURL=convertChatMessage.js.map","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __asyncValues = (this && this.__asyncValues) || function (o) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator], i;\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\n};\nimport { toFlatCommunicationIdentifier } from \"../../acs-ui-common/src\";\nimport { convertChatMessage } from './convertChatMessage';\n// TODO: When we can get messageId of event from SDK, remove this\n// Maximum time to look back message list when we receive a system event\nconst maxSyncTimeInMs = 10 * 1000;\n/**\n * @private\n */\nexport class EventSubscriber {\n constructor(chatClient, chatContext) {\n this.convertEventToChatMessage = (event) => {\n return convertChatMessage({\n id: event.id,\n version: event.version,\n content: {\n message: event.message\n },\n type: this.convertEventType(event.type),\n sender: event.sender,\n senderDisplayName: event.senderDisplayName,\n sequenceId: '',\n // Note: there is a bug in chatMessageReceived event that it is missing sequenceId\n createdOn: new Date(event.createdOn),\n editedOn: 'editedOn' in event ? event.editedOn : undefined,\n metadata: event.metadata\n });\n };\n // convert event type to chatMessage type, only possible type is 'html' and 'text' in chat event\n this.convertEventType = (type) => {\n const lowerCaseType = type.toLowerCase();\n if (lowerCaseType === 'richtext/html' || lowerCaseType === 'html') {\n return 'html';\n }\n else {\n return 'text';\n }\n };\n this.onChatMessageReceived = (event) => {\n var _a;\n // Today we are avoiding how to render these messages. In the future we can\n // remove this condition and handle this message appropriately.\n const messageEventType = event.type.toLowerCase();\n if (messageEventType !== 'text' && messageEventType !== 'richtext/html' && messageEventType !== 'html') {\n return;\n }\n const newMessage = this.convertEventToChatMessage(event);\n // Because of bug in chatMessageReceived event, if we already have that particular message in context, we want to\n // make sure to not overwrite the sequenceId when calling setChatMessage.\n const existingMessage = (_a = this.chatContext.getState().threads[event.threadId]) === null || _a === void 0 ? void 0 : _a.chatMessages[event.id];\n if (existingMessage) {\n newMessage.sequenceId = existingMessage.sequenceId;\n }\n this.chatContext.batch(() => {\n this.chatContext.createThreadIfNotExist(event.threadId);\n this.chatContext.setChatMessage(event.threadId, newMessage);\n });\n };\n this.onChatMessageDeleted = (event) => {\n this.chatContext.deleteMessage(event.threadId, event.id);\n };\n this.onChatMessageEdited = (event) => {\n const editedMessage = this.convertEventToChatMessage(event);\n this.chatContext.setChatMessage(event.threadId, convertChatMessage(editedMessage));\n };\n this.onParticipantsAdded = (event) => {\n const participantsToAdd = event.participantsAdded.map(participant => (Object.assign(Object.assign({}, participant), { shareHistoryTime: participant.shareHistoryTime ? new Date(participant.shareHistoryTime) : undefined })));\n this.chatContext.batch(() => {\n this.chatContext.createThreadIfNotExist(event.threadId);\n this.chatContext.setParticipants(event.threadId, participantsToAdd);\n });\n this.fetchLastParticipantMessage(event.threadId, 'participantAdded');\n };\n // This is a temporary fix that no participant message is received for onChatMessageReceived event, which should be handled by JS SDK.\n // Without the temporary fix, there are missing 'participant joined' and 'participant left' system messages in the chat thread.\n this.fetchLastParticipantMessage = (threadId, actionType) => __awaiter(this, void 0, void 0, function* () {\n var e_1, _a;\n try {\n for (var _b = __asyncValues(this.chatClient.getChatThreadClient(threadId).listMessages({\n startTime: new Date(Date.now() - maxSyncTimeInMs)\n })), _c; _c = yield _b.next(), !_c.done;) {\n const message = _c.value;\n if (message.type === actionType) {\n this.chatContext.setChatMessage(threadId, Object.assign(Object.assign({}, message), { status: 'delivered' }));\n }\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) yield _a.call(_b);\n }\n finally { if (e_1) throw e_1.error; }\n }\n });\n this.onParticipantsRemoved = (event) => {\n const participantIds = event.participantsRemoved.map(participant => {\n return participant.id;\n });\n this.chatContext.deleteParticipants(event.threadId, participantIds);\n // If the current user is removed from the thread, do not fetch the last participant message\n // as they no longer have access to the thread.\n const currentUserId = toFlatCommunicationIdentifier(this.chatContext.getState().userId);\n const wasCurrentUserRemoved = participantIds.find(id => toFlatCommunicationIdentifier(id) === currentUserId);\n if (!wasCurrentUserRemoved) {\n this.fetchLastParticipantMessage(event.threadId, 'participantRemoved');\n }\n };\n this.onReadReceiptReceived = (event) => {\n const readReceipt = Object.assign(Object.assign({}, event), { sender: event.sender, readOn: new Date(event.readOn) });\n this.chatContext.batch(() => {\n this.chatContext.createThreadIfNotExist(event.threadId);\n this.chatContext.addReadReceipt(event.threadId, readReceipt);\n });\n };\n this.onTypingIndicatorReceived = (typingIndicator) => {\n this.chatContext.batch(() => {\n this.chatContext.createThreadIfNotExist(typingIndicator.threadId);\n this.chatContext.addTypingIndicator(typingIndicator.threadId, typingIndicator);\n });\n };\n this.onChatThreadCreated = (event) => {\n const properties = {\n topic: event.properties.topic\n };\n if (!this.chatContext.createThreadIfNotExist(event.threadId, properties)) {\n this.chatContext.updateThread(event.threadId, properties);\n }\n };\n this.onChatThreadDeleted = (event) => {\n this.chatContext.deleteThread(event.threadId);\n };\n this.onChatThreadPropertiesUpdated = (event) => {\n this.chatContext.updateThread(event.threadId, {\n topic: event.properties.topic\n });\n };\n this.subscribe = () => {\n this.chatClient.on('chatMessageReceived', this.onChatMessageReceived);\n this.chatClient.on('chatMessageDeleted', this.onChatMessageDeleted);\n this.chatClient.on('chatMessageEdited', this.onChatMessageEdited);\n this.chatClient.on('participantsAdded', this.onParticipantsAdded);\n this.chatClient.on('participantsRemoved', this.onParticipantsRemoved);\n this.chatClient.on('readReceiptReceived', this.onReadReceiptReceived);\n this.chatClient.on('typingIndicatorReceived', this.onTypingIndicatorReceived);\n this.chatClient.on('chatThreadCreated', this.onChatThreadCreated);\n this.chatClient.on('chatThreadDeleted', this.onChatThreadDeleted);\n this.chatClient.on('chatThreadPropertiesUpdated', this.onChatThreadPropertiesUpdated);\n };\n this.unsubscribe = () => {\n this.chatClient.off('chatMessageReceived', this.onChatMessageReceived);\n this.chatClient.off('chatMessageDeleted', this.onChatMessageDeleted);\n this.chatClient.off('chatMessageEdited', this.onChatMessageEdited);\n this.chatClient.off('participantsAdded', this.onParticipantsAdded);\n this.chatClient.off('participantsRemoved', this.onParticipantsRemoved);\n this.chatClient.off('readReceiptReceived', this.onReadReceiptReceived);\n this.chatClient.off('typingIndicatorReceived', this.onTypingIndicatorReceived);\n this.chatClient.off('chatThreadCreated', this.onChatThreadCreated);\n this.chatClient.off('chatThreadDeleted', this.onChatThreadDeleted);\n this.chatClient.off('chatThreadPropertiesUpdated', this.onChatThreadPropertiesUpdated);\n };\n this.chatClient = chatClient;\n this.chatContext = chatContext;\n this.subscribe();\n }\n}\n//# sourceMappingURL=EventSubscriber.js.map","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\n/**\n * Create a decorated iterator\n * returned iterators.\n *\n * @param iteratorCreator the function to create the original iterator\n * @param context chatContext\n * @param decorateFn the function for the decorating behavior\n */\nexport const createDecoratedIterator = (iteratorCreator, context, decorateFn) => {\n return (...args) => {\n const threadsIterator = iteratorCreator(...args);\n return {\n next() {\n return __awaiter(this, void 0, void 0, function* () {\n const result = yield threadsIterator.next();\n if (!result.done && result.value) {\n decorateFn(result.value, context);\n }\n return result;\n });\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: (settings = {}) => {\n const pages = threadsIterator.byPage(settings);\n return {\n next() {\n return __awaiter(this, void 0, void 0, function* () {\n const result = yield pages.next();\n const page = result.value;\n if (!result.done && result.value) {\n context.batch(() => {\n for (const item of page) {\n decorateFn(item, context);\n }\n });\n }\n return result;\n });\n },\n [Symbol.asyncIterator]() {\n return this;\n }\n };\n }\n };\n };\n};\n/**\n *\n * @param iteratorCreator Function that creates the base iteartor\n * @param context The ChatContext that stores all internal state.\n * @param target See {@link ChatContext.asyncTeeErrorToState}.\n * @returns A function to create an iterator that handles errors when iterting over the iterator from `iteratorCreator`.\n */\nexport const createErrorHandlingIterator = (iteratorCreator, context, target) => {\n return (...args) => {\n const innerIter = iteratorCreator(...args);\n return {\n next: context.withAsyncErrorTeedToState(innerIter.next.bind(innerIter), target),\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: (settings = {}) => {\n const pages = innerIter.byPage(settings);\n return {\n next: context.withAsyncErrorTeedToState(pages.next.bind(pages), target),\n [Symbol.asyncIterator]() {\n return this;\n }\n };\n }\n };\n };\n};\n//# sourceMappingURL=createDecoratedIterator.js.map","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nimport { getIdentifierKind } from '@azure/communication-common';\nimport { nanoid } from 'nanoid';\nimport { createDecoratedListMessages } from './iterators/createDecoratedListMessages';\nimport { createDecoratedListReadReceipts } from './iterators/createDecoratedListReadReceipts';\nimport { createDecoratedListParticipants } from './iterators/createDecoratedListParticipants';\nimport { convertChatMessage } from './convertChatMessage';\nclass ProxyChatThreadClient {\n constructor(context) {\n this._context = context;\n }\n get(chatThreadClient, prop) {\n switch (prop) {\n case 'listMessages':\n {\n return createDecoratedListMessages(chatThreadClient, this._context);\n }\n case 'getMessage':\n {\n return this._context.withAsyncErrorTeedToState((...args) => __awaiter(this, void 0, void 0, function* () {\n const message = yield chatThreadClient.getMessage(...args);\n this._context.setChatMessage(chatThreadClient.threadId, convertChatMessage(message));\n return message;\n }), 'ChatThreadClient.getMessage');\n }\n case 'sendMessage':\n {\n return this._context.withAsyncErrorTeedToState((...args) => __awaiter(this, void 0, void 0, function* () {\n var _a;\n // Retry logic?\n const [request, options] = args;\n const { content } = request;\n const clientMessageId = nanoid(); // Generate a local short uuid for message\n const newMessage = {\n content: {\n message: content\n },\n clientMessageId,\n id: '',\n type: (_a = options === null || options === void 0 ? void 0 : options.type) !== null && _a !== void 0 ? _a : 'text',\n sequenceId: '',\n version: '',\n createdOn: new Date(),\n status: 'sending',\n senderDisplayName: this._context.getState().displayName,\n sender: this._context.getState().userId,\n metadata: options === null || options === void 0 ? void 0 : options.metadata\n };\n this._context.setChatMessage(chatThreadClient.threadId, newMessage);\n let result = undefined;\n try {\n result = yield chatThreadClient.sendMessage(...args);\n }\n catch (e) {\n this._context.setChatMessage(chatThreadClient.threadId, Object.assign(Object.assign({}, newMessage), { status: 'failed' }));\n throw e;\n }\n if (result === null || result === void 0 ? void 0 : result.id) {\n this._context.batch(() => {\n if (!result) {\n return;\n }\n this._context.setChatMessage(chatThreadClient.threadId, Object.assign(Object.assign({}, newMessage), { clientMessageId: undefined, status: 'delivered', id: result.id }));\n this._context.deleteLocalMessage(chatThreadClient.threadId, clientMessageId);\n });\n }\n return result;\n }), 'ChatThreadClient.sendMessage');\n }\n case 'addParticipants':\n {\n return this._context.withAsyncErrorTeedToState((...args) => __awaiter(this, void 0, void 0, function* () {\n const result = yield chatThreadClient.addParticipants(...args);\n const [addRequest] = args;\n const participantsToAdd = addRequest.participants;\n this._context.setParticipants(chatThreadClient.threadId, participantsToAdd);\n return result;\n }), 'ChatThreadClient.addParticipants');\n }\n case 'deleteMessage':\n {\n return this._context.withAsyncErrorTeedToState((...args) => __awaiter(this, void 0, void 0, function* () {\n // DeleteMessage is able to either delete local one(for failed message) or synced message\n const [messageId] = args;\n if (this._context.deleteLocalMessage(chatThreadClient.threadId, messageId)) {\n return {};\n }\n const result = yield chatThreadClient.deleteMessage(...args);\n this._context.deleteMessage(chatThreadClient.threadId, messageId);\n return result;\n }), 'ChatThreadClient.deleteMessage');\n }\n case 'listParticipants':\n {\n return createDecoratedListParticipants(chatThreadClient, this._context);\n }\n case 'listReadReceipts':\n {\n return createDecoratedListReadReceipts(chatThreadClient, this._context);\n }\n case 'sendTypingNotification':\n {\n return this._context.withAsyncErrorTeedToState((...args) => __awaiter(this, void 0, void 0, function* () {\n return yield chatThreadClient.sendTypingNotification(...args);\n }), 'ChatThreadClient.sendTypingNotification');\n }\n case 'removeParticipant':\n {\n return this._context.withAsyncErrorTeedToState((...args) => __awaiter(this, void 0, void 0, function* () {\n const result = yield chatThreadClient.removeParticipant(...args);\n const [removeIdentifier] = args;\n this._context.deleteParticipant(chatThreadClient.threadId, getIdentifierKind(removeIdentifier));\n return result;\n }), 'ChatThreadClient.removeParticipant');\n }\n case 'updateMessage':\n {\n return this._context.withAsyncErrorTeedToState((...args) => __awaiter(this, void 0, void 0, function* () {\n const result = yield chatThreadClient.updateMessage(...args);\n const [messageId, updateOption] = args;\n this._context.updateChatMessageContent(chatThreadClient.threadId, messageId, updateOption === null || updateOption === void 0 ? void 0 : updateOption.content);\n return result;\n }), 'ChatThreadClient.updateMessage');\n }\n case 'updateTopic':\n {\n return this._context.withAsyncErrorTeedToState((...args) => __awaiter(this, void 0, void 0, function* () {\n const result = yield chatThreadClient.updateTopic(...args);\n const [topic] = args;\n this._context.updateThreadTopic(chatThreadClient.threadId, topic);\n return result;\n }), 'ChatThreadClient.updateTopic');\n }\n case 'getProperties':\n {\n return this._context.withAsyncErrorTeedToState((...args) => __awaiter(this, void 0, void 0, function* () {\n const result = yield chatThreadClient.getProperties(...args);\n this._context.updateThread(chatThreadClient.threadId, result);\n return result;\n }), 'ChatThreadClient.getProperties');\n }\n default:\n return Reflect.get(chatThreadClient, prop);\n }\n }\n}\n/**\n * @private\n */\nexport const chatThreadClientDeclaratify = (chatThreadClient, context) => {\n context.createThreadIfNotExist(chatThreadClient.threadId);\n return new Proxy(chatThreadClient, new ProxyChatThreadClient(context));\n};\n//# sourceMappingURL=StatefulChatThreadClient.js.map","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport { convertChatMessage } from '../convertChatMessage';\nimport { createDecoratedIterator, createErrorHandlingIterator } from './createDecoratedIterator';\n/**\n * @private\n */\nexport const createDecoratedListMessages = (chatThreadClient, context) => {\n const setMessage = (message, context) => {\n context.setChatMessage(chatThreadClient.threadId, convertChatMessage(message));\n };\n return createDecoratedIterator(createErrorHandlingIterator(context.withErrorTeedToState(chatThreadClient.listMessages.bind(chatThreadClient), 'ChatThreadClient.listMessages'), context, 'ChatThreadClient.listMessages'), context, setMessage);\n};\n//# sourceMappingURL=createDecoratedListMessages.js.map","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport { createDecoratedIterator, createErrorHandlingIterator } from './createDecoratedIterator';\n/**\n * @private\n */\nexport const createDecoratedListParticipants = (chatThreadClient, context) => {\n const setParticipant = (participant, context) => {\n context.setParticipant(chatThreadClient.threadId, participant);\n };\n return createDecoratedIterator(createErrorHandlingIterator(context.withErrorTeedToState(chatThreadClient.listParticipants.bind(chatThreadClient), 'ChatThreadClient.listParticipants'), context, 'ChatThreadClient.listParticipants'), context, setParticipant);\n};\n//# sourceMappingURL=createDecoratedListParticipants.js.map","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport { createDecoratedIterator, createErrorHandlingIterator } from './createDecoratedIterator';\n/**\n * @private\n */\nexport const createDecoratedListReadReceipts = (chatThreadClient, context) => {\n const setReadReceipt = (readReceipt, context) => {\n context.addReadReceipt(chatThreadClient.threadId, Object.assign({}, readReceipt));\n };\n return createDecoratedIterator(createErrorHandlingIterator(context.withErrorTeedToState(chatThreadClient.listReadReceipts.bind(chatThreadClient), 'ChatThreadClient.listReadReceipts'), context, 'ChatThreadClient.listReadReceipts'), context, setReadReceipt);\n};\n//# sourceMappingURL=createDecoratedListReadReceipts.js.map","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nimport { ChatClient } from '@azure/communication-chat';\nimport { _getApplicationId } from \"../../acs-ui-common/src\";\nimport { ChatContext } from './ChatContext';\nimport { EventSubscriber } from './EventSubscriber';\nimport { chatThreadClientDeclaratify } from './StatefulChatThreadClient';\nimport { createDecoratedListThreads } from './iterators/createDecoratedListThreads';\nimport { getIdentifierKind } from '@azure/communication-common';\nimport { chatStatefulLogger } from './Logger';\nconst proxyChatClient = {\n get: function (chatClient, prop, receiver) {\n // skip receiver.context call to avoid recursive bugs\n if (prop === 'context') {\n return Reflect.get(chatClient, prop);\n }\n const context = receiver.context;\n switch (prop) {\n case 'createChatThread':\n {\n return context.withAsyncErrorTeedToState(function (...args) {\n return __awaiter(this, void 0, void 0, function* () {\n const result = yield chatClient.createChatThread(...args);\n const thread = result.chatThread;\n if (thread) {\n const [request] = args;\n context.createThread(thread.id, {\n topic: request.topic\n });\n }\n return result;\n });\n }, 'ChatClient.createChatThread');\n }\n case 'deleteChatThread':\n {\n return context.withAsyncErrorTeedToState(function (...args) {\n return __awaiter(this, void 0, void 0, function* () {\n const result = yield chatClient.deleteChatThread(...args);\n context.deleteThread(args[0]);\n return result;\n });\n }, 'ChatClient.deleteChatThread');\n }\n case 'listChatThreads':\n {\n return createDecoratedListThreads(chatClient, context);\n }\n case 'getChatThreadClient':\n {\n return function (...args) {\n const chatThreadClient = chatClient.getChatThreadClient(...args);\n // TODO(prprabhu): Ensure that thread properties are fetched into the ChatContext at this point.\n // A new thread might be created here, but the properties will never be fetched.\n return chatThreadClientDeclaratify(chatThreadClient, context);\n };\n }\n case 'startRealtimeNotifications':\n {\n return context.withAsyncErrorTeedToState(function (...args) {\n return __awaiter(this, void 0, void 0, function* () {\n const ret = yield chatClient.startRealtimeNotifications(...args);\n if (!receiver.eventSubscriber) {\n receiver.eventSubscriber = new EventSubscriber(chatClient, context);\n }\n return ret;\n });\n }, 'ChatClient.startRealtimeNotifications');\n }\n case 'stopRealtimeNotifications':\n {\n return context.withAsyncErrorTeedToState(function (...args) {\n return __awaiter(this, void 0, void 0, function* () {\n const ret = yield chatClient.stopRealtimeNotifications(...args);\n if (receiver.eventSubscriber) {\n receiver.eventSubscriber.unsubscribe();\n receiver.eventSubscriber = undefined;\n }\n return ret;\n });\n }, 'ChatClient.stopRealtimeNotifications');\n }\n default:\n return Reflect.get(chatClient, prop);\n }\n }\n};\n/**\n * Creates a stateful ChatClient {@link StatefulChatClient} by proxying ChatClient\n * {@link @azure/communication-chat#ChatClient} with ProxyChatClient {@link ProxyChatClient} which then allows access\n * to state in a declarative way.\n *\n * @public\n */\nexport const createStatefulChatClient = (args, options) => {\n chatStatefulLogger.info(`Creating chat stateful client using library version: ${_getApplicationId()}`);\n const tweakedOptions = Object.assign(Object.assign({}, options), { chatClientOptions: Object.assign(Object.assign({}, options === null || options === void 0 ? void 0 : options.chatClientOptions), { userAgentOptions: {\n userAgentPrefix: _getApplicationId()\n } }) });\n return _createStatefulChatClientWithDeps(new ChatClient(args.endpoint, args.credential, tweakedOptions.chatClientOptions), args, tweakedOptions);\n};\n/**\n * Internal implementation of {@link createStatefulChatClient} for dependency injection.\n *\n * Used by tests. Should not be exported out of this package.\n * @internal\n */\nexport const _createStatefulChatClientWithDeps = (chatClient, args, options) => {\n const context = new ChatContext(options === null || options === void 0 ? void 0 : options.maxStateChangeListeners);\n let eventSubscriber;\n context.updateChatConfig(getIdentifierKind(args.userId), args.displayName);\n const proxy = new Proxy(chatClient, proxyChatClient);\n Object.defineProperty(proxy, 'context', {\n configurable: false,\n get: () => context\n });\n Object.defineProperty(proxy, 'eventSubscriber', {\n configurable: false,\n get: () => eventSubscriber,\n set: (val) => {\n eventSubscriber = val;\n }\n });\n Object.defineProperty(proxy, 'getState', {\n configurable: false,\n value: () => context === null || context === void 0 ? void 0 : context.getState()\n });\n Object.defineProperty(proxy, 'onStateChange', {\n configurable: false,\n value: (handler) => context === null || context === void 0 ? void 0 : context.onStateChange(handler)\n });\n Object.defineProperty(proxy, 'offStateChange', {\n configurable: false,\n value: (handler) => context === null || context === void 0 ? void 0 : context.offStateChange(handler)\n });\n return proxy;\n};\n//# sourceMappingURL=StatefulChatClient.js.map","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport { createDecoratedIterator, createErrorHandlingIterator } from './createDecoratedIterator';\n/**\n * @private\n */\nexport const createDecoratedListThreads = (chatClient, context) => {\n const setThreadProperties = (chatThreadItem, context) => {\n const properties = {\n topic: chatThreadItem.topic\n };\n if (!context.createThreadIfNotExist(chatThreadItem.id, properties)) {\n context.updateThread(chatThreadItem.id, properties);\n }\n };\n return createDecoratedIterator(createErrorHandlingIterator(context.withErrorTeedToState(chatClient.listChatThreads.bind(chatClient), 'ChatClient.listChatThreads'), context, 'ChatClient.listChatThreads'), context, setThreadProperties);\n};\n//# sourceMappingURL=createDecoratedListThreads.js.map","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport { toFlatCommunicationIdentifier } from \"../../acs-ui-common/src\";\n/**\n * @private\n */\nexport const getUserId = (state) => toFlatCommunicationIdentifier(state.userId);\n/**\n * @private\n */\nexport const getDisplayName = (state) => state.displayName;\n/**\n * @private\n */\nexport const getChatMessages = (state, props) => { var _a; return props.threadId && ((_a = state.threads[props.threadId]) === null || _a === void 0 ? void 0 : _a.chatMessages) || {}; };\n/**\n * @private\n */\nexport const getParticipants = (state, props) => { var _a; return props.threadId && ((_a = state.threads[props.threadId]) === null || _a === void 0 ? void 0 : _a.participants) || {}; };\n/**\n * @private\n */\nexport const getReadReceipts = (state, props) => {\n var _a;\n return (_a = state.threads[props === null || props === void 0 ? void 0 : props.threadId]) === null || _a === void 0 ? void 0 : _a.readReceipts;\n};\n/**\n * @private\n */\nexport const getIsLargeGroup = (state, props) => {\n var _a;\n const participants = (_a = state.threads[props.threadId]) === null || _a === void 0 ? void 0 : _a.participants;\n return !!participants && Object.values(participants).length > 20;\n};\n/**\n * @private\n */\nexport const getLatestReadTime = (state, props) => { var _a; return props.threadId && ((_a = state.threads[props.threadId]) === null || _a === void 0 ? void 0 : _a.latestReadTime) || new Date(0); };\n/**\n * @private\n */\nexport const getTypingIndicators = (state, props) => {\n var _a;\n return props.threadId && ((_a = state.threads[props.threadId]) === null || _a === void 0 ? void 0 : _a.typingIndicators) || [];\n};\n/**\n * @private\n */\nexport const getLatestErrors = (state) => state.latestErrors;\n//# sourceMappingURL=baseSelectors.js.map","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport { createSelector } from 'reselect';\nimport { getDisplayName, getUserId } from './baseSelectors';\n/**\n * Selector for {@link SendBox} component.\n *\n * @public\n */\nexport const sendBoxSelector = createSelector([getUserId, getDisplayName], (userId, displayName) => ({\n displayName: displayName,\n userId: userId\n}));\n//# sourceMappingURL=sendBoxSelector.js.map","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n/**\n * @private\n */\nexport const MINIMUM_TYPING_INTERVAL_IN_MILLISECONDS = 8000;\n/**\n * @private\n */\nexport const PARTICIPANTS_THRESHOLD = 20;\n/**\n * @private\n */\nexport const MINUTE_IN_MS = 1000 * 60;\n/**\n * @private\n */\nexport const DEFAULT_DATA_LOSS_PREVENTION_POLICY_URL = 'https://go.microsoft.com/fwlink/?LinkId=2132837';\n/**\n * @private\n *\n * TODO: Import enum from @azure/communication-chat when ChatMessageType shows up in new release version\n * (or define our type to decouple)\n */\nexport const ACSKnownMessageType = {\n text: 'text',\n html: 'html',\n richtextHtml: 'richtext/html',\n topicUpdated: 'topicUpdated',\n participantAdded: 'participantAdded',\n participantRemoved: 'participantRemoved'\n};\n//# sourceMappingURL=constants.js.map","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n/**\n * @private\n */\nexport const compareMessages = (firstMessage, secondMessage) => {\n if (firstMessage.createdOn === undefined) {\n return 1;\n }\n if (secondMessage.createdOn === undefined) {\n return -1;\n }\n const firstDate = new Date(firstMessage.createdOn).getTime();\n const secondDate = new Date(secondMessage.createdOn).getTime();\n // Workaround to get a stable order of message before we can get sequenceId from chat service.\n // MessageIds are generated by time order the message persist, a good candidate other than time\n const idDelta = firstMessage.messageId && secondMessage.messageId ? Number.parseInt(firstMessage.messageId) - Number.parseInt(secondMessage.messageId) : 0;\n return firstDate - secondDate === 0 ? idDelta : firstDate - secondDate;\n};\n//# sourceMappingURL=compareMessages.js.map","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport { getChatMessages, getIsLargeGroup, getLatestReadTime, getParticipants, getReadReceipts, getUserId } from './baseSelectors';\nimport { toFlatCommunicationIdentifier } from \"../../acs-ui-common/src\";\nimport { memoizeFnAll } from \"../../acs-ui-common/src\";\nimport { createSelector } from 'reselect';\nimport { ACSKnownMessageType } from './utils/constants';\nimport { updateMessagesWithAttached } from './utils/updateMessagesWithAttached';\nconst memoizedAllConvertChatMessage = memoizeFnAll((_key, chatMessage, userId, isSeen, isLargeGroup) => {\n const messageType = chatMessage.type.toLowerCase();\n if (messageType === ACSKnownMessageType.text || messageType === ACSKnownMessageType.richtextHtml || messageType === ACSKnownMessageType.html) {\n return convertToUiChatMessage(chatMessage, userId, isSeen, isLargeGroup);\n }\n else {\n return convertToUiSystemMessage(chatMessage);\n }\n});\nconst processChatMessageContent = (message) => {\n var _a;\n return (_a = message.content) === null || _a === void 0 ? void 0 : _a.message;\n};\nconst convertToUiChatMessage = (message, userId, isSeen, isLargeGroup) => {\n const messageSenderId = message.sender !== undefined ? toFlatCommunicationIdentifier(message.sender) : userId;\n return {\n messageType: 'chat',\n createdOn: message.createdOn,\n content: processChatMessageContent(message),\n contentType: sanitizedMessageContentType(message.type),\n status: !isLargeGroup && message.status === 'delivered' && isSeen ? 'seen' : message.status,\n senderDisplayName: message.senderDisplayName,\n senderId: messageSenderId,\n messageId: message.id,\n clientMessageId: message.clientMessageId,\n editedOn: message.editedOn,\n deletedOn: message.deletedOn,\n mine: messageSenderId === userId,\n metadata: message.metadata\n };\n};\nconst convertToUiSystemMessage = (message) => {\n var _a, _b, _c, _d, _e;\n const systemMessageType = message.type;\n if (systemMessageType === 'participantAdded' || systemMessageType === 'participantRemoved') {\n return {\n messageType: 'system',\n systemMessageType,\n createdOn: message.createdOn,\n participants: (_c = (_b = (_a = message.content) === null || _a === void 0 ? void 0 : _a.participants) === null || _b === void 0 ? void 0 : _b.filter(participant => participant.displayName && participant.displayName !== '').map((participant) => ({\n userId: toFlatCommunicationIdentifier(participant.id),\n displayName: participant.displayName\n }))) !== null && _c !== void 0 ? _c : [],\n messageId: message.id,\n iconName: systemMessageType === 'participantAdded' ? 'PeopleAdd' : 'PeopleBlock'\n };\n }\n else {\n // Only topic updated type left, according to ACSKnown type\n return {\n messageType: 'system',\n systemMessageType: 'topicUpdated',\n createdOn: message.createdOn,\n topic: (_e = (_d = message.content) === null || _d === void 0 ? void 0 : _d.topic) !== null && _e !== void 0 ? _e : '',\n messageId: message.id,\n iconName: 'Edit'\n };\n }\n};\n/** Returns `true` if the message has participants and at least one participant has a display name. */\nconst hasValidParticipant = (chatMessage) => { var _a; return !!((_a = chatMessage.content) === null || _a === void 0 ? void 0 : _a.participants) && chatMessage.content.participants.some(p => !!p.displayName); };\n/**\n *\n * @private\n */\nexport const messageThreadSelectorWithThread = () => createSelector([getUserId, getChatMessages, getLatestReadTime, getIsLargeGroup, getReadReceipts, getParticipants], (userId, chatMessages, latestReadTime, isLargeGroup, readReceipts, participants) => {\n // We can't get displayName in teams meeting interop for now, disable rr feature when it is teams interop\n const isTeamsInterop = Object.values(participants).find(p => 'microsoftTeamsUserId' in p.id) !== undefined;\n // get number of participants\n // filter out the non valid participants (no display name)\n // Read Receipt details will be disabled when participant count is 0\n const participantCount = isTeamsInterop ? undefined : Object.values(participants).filter(p => p.displayName && p.displayName !== '').length;\n // creating key value pairs of senderID: last read message information\n const readReceiptsBySenderId = {};\n // readReceiptsBySenderId[senderID] gets updated every time a new message is read by this sender\n // in this way we can make sure that we are only saving the latest read message id and read on time for each sender\n readReceipts.filter(r => r.sender && toFlatCommunicationIdentifier(r.sender) !== userId).forEach(r => {\n var _a, _b;\n readReceiptsBySenderId[toFlatCommunicationIdentifier(r.sender)] = {\n lastReadMessage: r.chatMessageId,\n displayName: (_b = (_a = participants[toFlatCommunicationIdentifier(r.sender)]) === null || _a === void 0 ? void 0 : _a.displayName) !== null && _b !== void 0 ? _b : ''\n };\n });\n // A function takes parameter above and generate return value\n const convertedMessages = memoizedAllConvertChatMessage(memoizedFn => Object.values(chatMessages).filter(message => message.type.toLowerCase() === ACSKnownMessageType.text || message.type.toLowerCase() === ACSKnownMessageType.richtextHtml || message.type.toLowerCase() === ACSKnownMessageType.html || message.type === ACSKnownMessageType.participantAdded && hasValidParticipant(message) || message.type === ACSKnownMessageType.participantRemoved && hasValidParticipant(message) ||\n // TODO: Add support for topicUpdated system messages in MessageThread component.\n // message.type === ACSKnownMessageType.topicUpdated ||\n message.clientMessageId !== undefined).filter(isMessageValidToRender).map(message => {\n var _a;\n return memoizedFn((_a = message.id) !== null && _a !== void 0 ? _a : message.clientMessageId, message, userId, message.createdOn <= latestReadTime, isLargeGroup);\n }));\n updateMessagesWithAttached(convertedMessages);\n return {\n userId,\n showMessageStatus: true,\n messages: convertedMessages,\n participantCount,\n readReceiptsBySenderId\n };\n});\nconst sanitizedMessageContentType = (type) => {\n const lowerCaseType = type.toLowerCase();\n return lowerCaseType === 'text' || lowerCaseType === 'html' || lowerCaseType === 'richtext/html' ? lowerCaseType : 'unknown';\n};\nconst isMessageValidToRender = (message) => {\n var _a, _b;\n if (message.deletedOn) {\n return false;\n }\n if ((_a = message.metadata) === null || _a === void 0 ? void 0 : _a['fileSharingMetadata']) {\n return true;\n }\n return !!(message.content && ((_b = message.content) === null || _b === void 0 ? void 0 : _b.message) !== '');\n};\n/**\n * Selector for {@link MessageThread} component.\n *\n * @public\n */\nexport const messageThreadSelector = messageThreadSelectorWithThread();\n//# sourceMappingURL=messageThreadSelector.js.map","import { compareMessages } from './compareMessages';\nimport { MINUTE_IN_MS } from './constants';\n/**\n * @private\n */\nexport const updateMessagesWithAttached = (chatMessagesWithStatus) => {\n chatMessagesWithStatus.sort(compareMessages);\n chatMessagesWithStatus.forEach((message, index, messages) => {\n var _a, _b;\n if (message.messageType === 'chat') {\n /**\n * Attached === true means it is within a group of messages in the current order\n * Attached === top/bottom means it is on the top/bottom boundary\n * Attached === false means it is just a single message\n * A group of messages: continuous messages that belong to the same sender and not intercepted by other senders.\n */\n let attached = false;\n const previousMessage = index > 0 ? messages[index - 1] : undefined;\n const nextMessage = index === messages.length - 1 ? undefined : messages[index + 1];\n const previousSenderId = (previousMessage === null || previousMessage === void 0 ? void 0 : previousMessage.messageType) === 'chat' ? previousMessage.senderId : undefined;\n const nextSenderId = (nextMessage === null || nextMessage === void 0 ? void 0 : nextMessage.messageType) === 'chat' ? nextMessage.senderId : undefined;\n const timediff = new Date((_a = message === null || message === void 0 ? void 0 : message.createdOn) !== null && _a !== void 0 ? _a : '').getTime() - new Date((_b = previousMessage === null || previousMessage === void 0 ? void 0 : previousMessage.createdOn) !== null && _b !== void 0 ? _b : '').getTime();\n const diffMins = Math.round(timediff / MINUTE_IN_MS); // minutes\n if (previousSenderId !== message.senderId) {\n attached = message.senderId === nextSenderId ? 'top' : false;\n }\n else if (diffMins && diffMins >= 5) {\n // if there are more than or equal to 5 mins time gap between messages do not attach and show time stamp\n attached = false;\n }\n else {\n attached = message.senderId === nextSenderId ? true : 'bottom';\n }\n message.attached = attached;\n }\n });\n};\n//# sourceMappingURL=updateMessagesWithAttached.js.map","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport { getTypingIndicators, getParticipants, getUserId } from './baseSelectors';\nimport { createSelector } from 'reselect';\nimport { toFlatCommunicationIdentifier } from \"../../acs-ui-common/src\";\nimport { MINIMUM_TYPING_INTERVAL_IN_MILLISECONDS, PARTICIPANTS_THRESHOLD } from './utils/constants';\nconst filterTypingIndicators = (typingIndicators, userId) => {\n const filteredTypingIndicators = [];\n const seen = new Set();\n const date8SecondsAgo = new Date(Date.now() - MINIMUM_TYPING_INTERVAL_IN_MILLISECONDS);\n for (let i = typingIndicators.length - 1; i >= 0; i--) {\n const typingIndicator = typingIndicators[i];\n if (toFlatCommunicationIdentifier(typingIndicator.sender) === userId) {\n continue;\n }\n if (typingIndicator.receivedOn < date8SecondsAgo) {\n continue;\n }\n if (seen.has(toFlatCommunicationIdentifier(typingIndicator.sender))) {\n continue;\n }\n seen.add(toFlatCommunicationIdentifier(typingIndicator.sender));\n filteredTypingIndicators.push(typingIndicator);\n }\n return filteredTypingIndicators;\n};\nconst convertSdkTypingIndicatorsToCommunicationParticipants = (typingIndicators, participants) => {\n return typingIndicators.map(typingIndicator => {\n var _a;\n return ({\n userId: toFlatCommunicationIdentifier(typingIndicator.sender),\n displayName: (_a = participants[toFlatCommunicationIdentifier(typingIndicator.sender)]) === null || _a === void 0 ? void 0 : _a.displayName\n });\n });\n};\n/**\n * Selector for {@link TypingIndicator} component.\n *\n * @public\n */\nexport const typingIndicatorSelector = createSelector([getTypingIndicators, getParticipants, getUserId], (typingIndicators, participants, userId) => {\n // if the participant size reaches the threshold then return no typing users\n if (Object.values(participants).length >= PARTICIPANTS_THRESHOLD) {\n return {\n typingUsers: []\n };\n }\n // filter typing indicators to remove those that are from the duplicate users or current user as well as those older than a threshold\n const filteredTypingIndicators = filterTypingIndicators(typingIndicators, userId);\n const typingUsers = convertSdkTypingIndicatorsToCommunicationParticipants(filteredTypingIndicators, participants);\n return {\n typingUsers\n };\n});\n//# sourceMappingURL=typingIndicatorSelector.js.map","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport { getUserId, getDisplayName, getParticipants } from './baseSelectors';\nimport * as reselect from 'reselect';\nimport { toFlatCommunicationIdentifier } from \"../../acs-ui-common/src\";\nimport { getIdentifierKind } from '@azure/communication-common';\nconst convertChatParticipantsToCommunicationParticipants = (chatParticipants) => {\n return chatParticipants.map((participant) => {\n return {\n userId: toFlatCommunicationIdentifier(participant.id),\n displayName: participant.displayName,\n // ACS users can not remove Teams users.\n // Removing phone numbers or unknown types of users is undefined.\n isRemovable: getIdentifierKind(participant.id).kind === 'communicationUser'\n };\n });\n};\n/**\n * get the index of moderator to help updating its display name if they are the local user or removing them from list of participants otherwise\n */\nconst moderatorIndex = (participants) => {\n return participants.map(p => p.displayName).indexOf(undefined);\n};\n/**\n * Selector for {@link ParticipantList} component.\n *\n * @public\n */\nexport const chatParticipantListSelector = reselect.createSelector([getUserId, getParticipants, getDisplayName], (userId, chatParticipants, displayName) => {\n let participants = convertChatParticipantsToCommunicationParticipants(Object.values(chatParticipants));\n if (0 !== participants.length) {\n const moderatorIdx = moderatorIndex(participants);\n if (-1 !== moderatorIdx) {\n const userIndex = participants.map(p => p.userId).indexOf(userId);\n if (moderatorIdx === userIndex) {\n participants[moderatorIdx].displayName = displayName;\n }\n else {\n participants = participants.filter(p => p.displayName);\n }\n }\n }\n return {\n myUserId: userId,\n participants: participants\n };\n});\n//# sourceMappingURL=chatParticipantListSelector.js.map","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport { getLatestErrors } from './baseSelectors';\nimport { createSelector } from 'reselect';\n/**\n * Select the first fiew active errors from the state for the {@link ErrorBar} component.\n *\n * In case there are many errors, only a few top errors are returned to avoid\n * filling up the UI with too many errors.\n *\n * Invariants:\n * - {@link ErrorType} is never repeated in the returned errors.\n * - Errors are returned in a fixed order by {@link ErrorType}.\n *\n * @public\n */\nexport const errorBarSelector = createSelector([getLatestErrors], (latestErrors) => {\n var _a;\n // The order in which the errors are returned is significant: The `ErrorBar` shows errors on the UI in that order.\n // There are several options for the ordering:\n // - Sorted by when the errors happened (latest first / oldest first).\n // - Stable sort by error type.\n //\n // We chose to stable sort by error type: We intend to show only a small number of errors on the UI and we do not\n // have timestamps for errors.\n const activeErrorMessages = [];\n let specificSendMessageErrorSeen = false;\n {\n const error = latestUnableToReachChatServiceError(latestErrors);\n if (error !== undefined) {\n activeErrorMessages.push(error);\n }\n }\n {\n const error = latestAccessDeniedError(latestErrors);\n if (error !== undefined) {\n activeErrorMessages.push(error);\n }\n }\n const sendMessageError = latestErrors['ChatThreadClient.sendMessage'];\n {\n const error = latestNotInThisThreadError(latestErrors);\n if (error !== undefined) {\n if (sendMessageError !== undefined) {\n activeErrorMessages.push({\n type: 'sendMessageNotInChatThread',\n // Set the latest timestamp of all the errors that translated to an active error.\n timestamp: sendMessageError.timestamp > ((_a = error.timestamp) !== null && _a !== void 0 ? _a : 0) ? sendMessageError.timestamp : error.timestamp\n });\n specificSendMessageErrorSeen = true;\n }\n else {\n activeErrorMessages.push(error);\n }\n }\n }\n if (!specificSendMessageErrorSeen && sendMessageError !== undefined) {\n activeErrorMessages.push({\n type: 'sendMessageGeneric',\n timestamp: sendMessageError.timestamp\n });\n }\n // We only return the first few errors to avoid filling up the UI with too many `MessageBar`s.\n activeErrorMessages.splice(maxErrorCount);\n return {\n activeErrorMessages: activeErrorMessages\n };\n});\nconst maxErrorCount = 3;\nconst accessErrorTargets = ['ChatThreadClient.getProperties', 'ChatThreadClient.listMessages', 'ChatThreadClient.listParticipants', 'ChatThreadClient.sendMessage', 'ChatThreadClient.sendTypingNotification'];\nconst latestUnableToReachChatServiceError = (latestErrors) => {\n return latestActiveErrorSatisfying(latestErrors, 'unableToReachChatService', (error) => {\n return !!error && !!error.innerError && error.innerError['code'] === 'REQUEST_SEND_ERROR';\n });\n};\nconst latestAccessDeniedError = (latestErrors) => {\n return latestActiveErrorSatisfying(latestErrors, 'accessDenied', (error) => {\n return !!error && !!error.innerError && error.innerError['statusCode'] === 401;\n });\n};\nconst latestNotInThisThreadError = (latestErrors) => {\n return latestActiveErrorSatisfying(latestErrors, 'userNotInChatThread', (error) => {\n if (!error || !error.innerError) {\n return false;\n }\n // Explicitly ignore 400 REST error when listParticipants() is called and a BotContact MRI is found in the participants.\n // This check should be removed when the chat SDK has handled this issue. Note: The this does not stop the error being logged to the console.\n // To the best of our ability we have confirmed this to have no impact on the participantList returned (all valid participants are still returned), nor\n // does it have an impact on the participant list updating on other participants joining/leaving or on individual participant actions like removeParticipant.\n if (isErrorDueToBotContact(error)) {\n return false;\n }\n // Chat service returns 403 if a user has been removed from a thread.\n // Chat service returns either 400 or 404 if the thread ID is malformed, depending on how the thread ID is malformed.\n return [400, 403, 404].some(statusCode => error.innerError['statusCode'] === statusCode);\n });\n};\nconst botContactMRIPrefix = '28:';\nconst isErrorDueToBotContact = (error) => error.innerError['statusCode'] === 400 && error.innerError.message.includes(`Identifier format is not supported (${botContactMRIPrefix}`);\nconst latestActiveErrorSatisfying = (errors, activeErrorType, predicate) => {\n const activeErrorMessages = [];\n for (const target of accessErrorTargets) {\n const error = errors[target];\n if (predicate(error)) {\n activeErrorMessages.push({\n type: activeErrorType,\n timestamp: error.timestamp\n });\n }\n }\n if (activeErrorMessages.length === 0) {\n return undefined;\n }\n // We're actually sure that both timestamps will always exist, because we set them above.\n activeErrorMessages.sort((a, b) => { var _a, _b, _c, _d; return ((_b = (_a = a.timestamp) === null || _a === void 0 ? void 0 : _a.getTime()) !== null && _b !== void 0 ? _b : 0) - ((_d = (_c = b.timestamp) === null || _c === void 0 ? void 0 : _c.getTime()) !== null && _d !== void 0 ? _d : 0); });\n return activeErrorMessages[activeErrorMessages.length - 1];\n};\n//# sourceMappingURL=errorBarSelector.js.map","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport { ErrorBar, MessageThread, ParticipantList, SendBox, TypingIndicator } from \"../../../react-components/src\";\nimport { useHandlers } from './useHandlers';\nimport { useSelector } from './useSelector';\nimport { sendBoxSelector } from '../sendBoxSelector';\nimport { messageThreadSelectorWithThread } from '../messageThreadSelector';\nimport { typingIndicatorSelector } from '../typingIndicatorSelector';\nimport { chatParticipantListSelector } from '../chatParticipantListSelector';\nimport { errorBarSelector } from '../errorBarSelector';\nimport { ChatThreadClientContext } from '../providers/ChatThreadClientProvider';\nimport { useContext } from 'react';\n/**\n * Primary hook to get all hooks necessary for a chat Component.\n *\n * Most straightforward usage of chat components looks like:\n *\n * @example\n * ```\n * import { ParticipantList, usePropsFor } from '@azure/communication-react';\n *\n * const App = (): JSX.Element => {\n * // ... code to setup Providers ...\n *\n * return \n * }\n * ```\n *\n * @public\n */\nexport const usePropsFor = (component) => {\n const selector = getSelector(component);\n const props = useSelector(selector);\n const handlers = useHandlers(component);\n if (props !== undefined) {\n return Object.assign(Object.assign({}, props), handlers);\n }\n return undefined;\n};\n/**\n * Get the selector for a specified component.\n *\n * Useful when implementing a custom component that utilizes the providers\n * exported from this library.\n *\n * @public\n */\nexport const getSelector = (component) => {\n return findSelector(component);\n};\nconst messageThreadSelectorsByThread = {};\nconst findSelector = (component) => {\n // For the message thread selector we need to create a new one for each thread\n // If we have just one for the entire app, then we will have updates when not expecting due to\n // the arguments changing\n const getMessageThreadSelector = () => {\n var _a, _b;\n const threadId = (_b = (_a = useContext(ChatThreadClientContext)) === null || _a === void 0 ? void 0 : _a.threadId) !== null && _b !== void 0 ? _b : 'default-id-when-not-in-provider';\n let messageThreadSelectorImpl = messageThreadSelectorsByThread[threadId];\n if (!messageThreadSelectorImpl) {\n messageThreadSelectorsByThread[threadId] = messageThreadSelectorWithThread();\n messageThreadSelectorImpl = messageThreadSelectorsByThread[threadId];\n }\n return messageThreadSelectorImpl;\n };\n switch (component) {\n case SendBox:\n return sendBoxSelector;\n case MessageThread:\n return getMessageThreadSelector();\n case TypingIndicator:\n return typingIndicatorSelector;\n case ParticipantList:\n return chatParticipantListSelector;\n case ErrorBar:\n return errorBarSelector;\n }\n return undefined;\n};\n//# sourceMappingURL=usePropsFor.js.map","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nimport { fromFlatCommunicationIdentifier } from \"../../../acs-ui-common/src\";\nimport memoizeOne from 'memoize-one';\n/**\n * Create the default implementation of {@link ChatHandlers}.\n *\n * Useful when implementing a custom component that utilizes the providers\n * exported from this library.\n *\n * Returned object is memoized to avoid rerenders when used as props for React Components.\n *\n * @public\n */\nexport const createDefaultChatHandlers = memoizeOne((chatClient, chatThreadClient) => {\n let messageIterator = undefined;\n let readReceiptIterator = undefined;\n return {\n onSendMessage: (content, options) => __awaiter(void 0, void 0, void 0, function* () {\n const sendMessageRequest = {\n content,\n senderDisplayName: chatClient.getState().displayName\n };\n yield chatThreadClient.sendMessage(sendMessageRequest, options);\n }),\n onUpdateMessage: (messageId, content, metadata, options) => __awaiter(void 0, void 0, void 0, function* () {\n const updatedMetadata = metadata ? Object.assign({}, metadata) : {};\n updatedMetadata['fileSharingMetadata'] = JSON.stringify((options === null || options === void 0 ? void 0 : options.attachedFilesMetadata) || []);\n yield chatThreadClient.updateMessage(messageId, {\n content,\n metadata: updatedMetadata\n });\n }),\n onDeleteMessage: (messageId) => __awaiter(void 0, void 0, void 0, function* () {\n yield chatThreadClient.deleteMessage(messageId);\n }),\n // This handler is designed for chatThread to consume\n onMessageSeen: (chatMessageId) => __awaiter(void 0, void 0, void 0, function* () {\n yield chatThreadClient.sendReadReceipt({\n chatMessageId\n });\n }),\n onTyping: () => __awaiter(void 0, void 0, void 0, function* () {\n yield chatThreadClient.sendTypingNotification();\n }),\n onRemoveParticipant: (userId) => __awaiter(void 0, void 0, void 0, function* () {\n yield chatThreadClient.removeParticipant(fromFlatCommunicationIdentifier(userId));\n }),\n updateThreadTopicName: (topicName) => __awaiter(void 0, void 0, void 0, function* () {\n yield chatThreadClient.updateTopic(topicName);\n }),\n onLoadPreviousChatMessages: (messagesToLoad) => __awaiter(void 0, void 0, void 0, function* () {\n var _a, _b, _c;\n if (messageIterator === undefined) {\n // Lazy definition so that errors in the method call are reported correctly.\n // Also allows recovery via retries in case of transient errors.\n messageIterator = chatThreadClient.listMessages({\n maxPageSize: 50\n });\n }\n if (readReceiptIterator === undefined) {\n readReceiptIterator = chatThreadClient.listReadReceipts();\n }\n // get the earliest message time\n let remainingMessagesToGet = messagesToLoad;\n let isAllChatMessagesLoaded = false;\n let earliestTime = Number.MAX_SAFE_INTEGER;\n while (remainingMessagesToGet >= 1) {\n const message = yield messageIterator.next();\n if ((_a = message === null || message === void 0 ? void 0 : message.value) === null || _a === void 0 ? void 0 : _a.id) {\n if (parseInt(message.value.id) < earliestTime) {\n earliestTime = parseInt(message.value.id);\n }\n }\n if (((_b = message.value) === null || _b === void 0 ? void 0 : _b.type) && message.value.type === 'text') {\n remainingMessagesToGet--;\n }\n // We have traversed all messages in this thread\n if (message.done) {\n isAllChatMessagesLoaded = true;\n break;\n }\n }\n // keep fetching read receipts until read receipt time < earlist message time\n let readReceipt = yield readReceiptIterator.next();\n while (!readReceipt.done && parseInt((_c = readReceipt === null || readReceipt === void 0 ? void 0 : readReceipt.value) === null || _c === void 0 ? void 0 : _c.chatMessageId) >= earliestTime) {\n readReceipt = yield readReceiptIterator.next();\n }\n return isAllChatMessagesLoaded;\n })\n };\n});\n/**\n * Create a set of default handlers for given component.\n *\n * Returned object is memoized (with reference to the arguments) to avoid\n * renders when used as props for React Components.\n *\n * @public\n */\nexport const createDefaultChatHandlersForComponent = (chatClient, chatThreadClient, _) => {\n return createDefaultChatHandlers(chatClient, chatThreadClient);\n};\n//# sourceMappingURL=createHandlers.js.map","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport { createDefaultChatHandlersForComponent } from '../handlers/createHandlers';\nimport { ChatClientContext } from '../providers/ChatClientProvider';\nimport { ChatThreadClientContext } from '../providers/ChatThreadClientProvider';\nimport { useContext } from 'react';\n/**\n * Hook to obtain a handler for a specified component.\n *\n * Useful when implementing a custom component that utilizes the providers\n * exported from this library.\n *\n * @public\n */\nexport const useHandlers = (component) => {\n const chatClient = useContext(ChatClientContext);\n const chatThreadClient = useContext(ChatThreadClientContext);\n if (!chatThreadClient || !chatClient) {\n return undefined;\n }\n return createDefaultChatHandlersForComponent(chatClient, chatThreadClient, component);\n};\n//# sourceMappingURL=useHandlers.js.map","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport { getCallingSelector, useCallingHandlers, useCallingSelector } from \"../../calling-component-bindings/src\";\nimport { getChatSelector, useChatHandlers, useChatSelector } from \"../../chat-component-bindings/src\";\n/**\n * Hook to obtain a selector for a specified component.\n *\n * Useful when implementing a custom component that utilizes the providers\n * exported from this library.\n *\n * @public\n */\nexport const useSelector = (selector, selectorProps, type) => {\n // Because of react hooks rules, hooks can't be conditionally called\n // We call both call and chat hooks and detect current context\n // Return undefined and skip execution when not in that context\n const callingMode = !type || type === 'calling';\n const chatMode = !type || type === 'chat';\n const callProps = useCallingSelector(callingMode ? selector : undefined, selectorProps);\n const chatProps = useChatSelector(chatMode ? selector : undefined, selectorProps);\n return callProps !== null && callProps !== void 0 ? callProps : chatProps;\n};\n/**\n * Primary hook to get all hooks necessary for a React Component from this library.\n *\n * To call this hook, the component requires to be wrapped under these providers:\n *\n * 1. For chat components: {@link ChatClientProvider} and {@link ChatThreadClientProvider}.\n *\n * 2. For calling components: {@link CallClientProvider}, {@link CallAgentProvider} and {@link CallAgentProvider}.\n *\n * Most straightforward usage of a components looks like:\n *\n * @example\n * ```\n * import { ParticipantList, usePropsFor } from '@azure/communication-react';\n *\n * const App = (): JSX.Element => {\n * // ... code to setup Providers ...\n *\n * return \n * }\n * ```\n *\n * @public\n */\nexport const usePropsFor = (component, type) => {\n const callingSelector = type === 'calling' || !type ? getCallingSelector(component) : undefined;\n const chatSelector = type === 'chat' || !type ? getChatSelector(component) : undefined;\n const callProps = useCallingSelector(callingSelector);\n const chatProps = useChatSelector(chatSelector);\n const callingHandlers = useCallingHandlers(component);\n const chatHandlers = useChatHandlers(component);\n if (chatProps) {\n if (!chatHandlers) {\n throw 'Please initialize chatClient and chatThreadClient first!';\n }\n return Object.assign(Object.assign({}, chatProps), chatHandlers);\n }\n if (callProps) {\n if (!callingHandlers) {\n throw 'Please initialize callClient first!';\n }\n return Object.assign(Object.assign({}, callProps), callingHandlers);\n }\n if (!chatSelector && !callingSelector) {\n throw \"Can't find corresponding selector for this component. Please check the supported components from Azure Communication UI Feature Component List.\";\n }\n else {\n throw 'Could not find props for this component, ensure the component is wrapped by appropriate providers.';\n }\n};\n//# sourceMappingURL=mergedHooks.js.map","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport { ChatClientContext } from '../providers/ChatClientProvider';\nimport { useState, useEffect, useRef, useMemo, useContext } from 'react';\nimport { ChatThreadClientContext } from '../providers/ChatThreadClientProvider';\n/**\n * Hook to obtain a selector for a specified component.\n *\n * Useful when implementing a custom component that utilizes the providers\n * exported from this library.\n *\n * @public\n */\nexport const useSelector = (selector, selectorProps) => {\n var _a;\n const chatClient = useContext(ChatClientContext);\n const threadId = (_a = useContext(ChatThreadClientContext)) === null || _a === void 0 ? void 0 : _a.threadId;\n // Keeps track of whether the current component is mounted or not. If it has unmounted, make sure we do not modify the\n // state or it will cause React warnings in the console. https://skype.visualstudio.com/SPOOL/_workitems/edit/2453212\n const mounted = useRef(false);\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n });\n const threadConfigProps = useMemo(() => ({\n threadId\n }), [threadId]);\n const [props, setProps] = useState(chatClient && selector ? selector(chatClient.getState(), selectorProps !== null && selectorProps !== void 0 ? selectorProps : threadConfigProps) : undefined);\n const propRef = useRef(props);\n propRef.current = props;\n useEffect(() => {\n if (!chatClient || !selector) {\n return;\n }\n const onStateChange = (state) => {\n const newProps = selector(state, selectorProps !== null && selectorProps !== void 0 ? selectorProps : threadConfigProps);\n if (propRef.current !== newProps) {\n setProps(newProps);\n }\n };\n chatClient.onStateChange(onStateChange);\n return () => {\n chatClient.offStateChange(onStateChange);\n };\n }, [chatClient, selector, selectorProps, threadConfigProps]);\n return selector ? props : undefined;\n};\n//# sourceMappingURL=useSelector.js.map"],"names":["ChatClientContext","createContext","undefined","ChatClientProvider","props","Provider","value","chatClient","children","ChatThreadClientContext","ChatThreadClientProvider","chatThreadClient","ChatError","Error","constructor","target","innerError","timestamp","super","this","Date","now","name","message","Constants","chatStatefulLogger","createClientLogger","__awaiter","thisArg","_arguments","P","generator","Promise","resolve","reject","fulfilled","step","next","e","rejected","result","done","then","apply","ChatContext","maxListeners","_state","userId","id","displayName","threads","latestErrors","_batchMode","typingIndicatorInterval","_logger","_emitter","setMaxListeners","getState","modifyState","modifier","priorState","patches","getLogLevel","info","emit","setThread","threadId","threadState","draft","createThread","properties","chatMessages","participants","readReceipts","typingIndicators","latestReadTime","updateChatConfig","createThreadIfNotExist","Object","prototype","hasOwnProperty","call","updateThread","thread","updateThreadTopic","topic","deleteThread","setChatMessages","messages","values","filterTypingIndicatorForUser","sender","updateChatMessageContent","messagesId","content","_a","chatMessage","deleteLocalMessage","localId","localMessageDeleted","clientMessageId","deleteMessage","setParticipant","participant","setParticipants","participantsMap","deleteParticipants","participantIds","forEach","deleteParticipant","participantId","addReadReceipt","readReceipt","readOn","push","startTypingIndicatorCleanUp","window","setInterval","isTypingActive","filteredTypingIndicators","filter","typingIndicator","receivedOn","getTime","length","clearInterval","addTypingIndicator","setChatMessage","messageId","threadMessages","isLocalIdInMap","messageKey","withAsyncErrorTeedToState","f","args","error","chatError","toChatError","setLatestError","withErrorTeedToState","userIdAsKey","batch","operations","warning","onStateChange","handler","on","offStateChange","off","convertChatMessage","status","assign","__asyncValues","o","Symbol","asyncIterator","TypeError","i","m","__values","iterator","verb","n","v","d","settle","EventSubscriber","chatContext","convertEventToChatMessage","event","version","type","convertEventType","senderDisplayName","sequenceId","createdOn","editedOn","metadata","lowerCaseType","toLowerCase","onChatMessageReceived","messageEventType","newMessage","existingMessage","onChatMessageDeleted","onChatMessageEdited","editedMessage","onParticipantsAdded","participantsToAdd","participantsAdded","map","shareHistoryTime","fetchLastParticipantMessage","actionType","e_1","_c","_b","getChatThreadClient","listMessages","startTime","e_1_1","return","onParticipantsRemoved","participantsRemoved","currentUserId","find","onReadReceiptReceived","onTypingIndicatorReceived","onChatThreadCreated","onChatThreadDeleted","onChatThreadPropertiesUpdated","subscribe","unsubscribe","createDecoratedIterator","iteratorCreator","context","decorateFn","threadsIterator","byPage","settings","pages","page","item","createErrorHandlingIterator","innerIter","bind","ProxyChatThreadClient","_context","get","prop","createDecoratedListMessages","getMessage","request","options","sendMessage","addParticipants","addRequest","listParticipants","createDecoratedListParticipants","listReadReceipts","createDecoratedListReadReceipts","sendTypingNotification","removeParticipant","removeIdentifier","updateMessage","updateOption","updateTopic","getProperties","Reflect","proxyChatClient","receiver","createChatThread","chatThread","deleteChatThread","listChatThreads","chatThreadItem","createDecoratedListThreads","Proxy","chatThreadClientDeclaratify","ret","startRealtimeNotifications","eventSubscriber","stopRealtimeNotifications","createStatefulChatClient","tweakedOptions","chatClientOptions","userAgentOptions","userAgentPrefix","_createStatefulChatClientWithDeps","endpoint","credential","maxStateChangeListeners","proxy","defineProperty","configurable","set","val","getUserId","state","getDisplayName","getChatMessages","getParticipants","getReadReceipts","getIsLargeGroup","getLatestReadTime","sendBoxSelector","ACSKnownMessageType","compareMessages","firstMessage","secondMessage","firstDate","secondDate","idDelta","Number","parseInt","memoizedAllConvertChatMessage","memoizeFnAll","_key","isSeen","isLargeGroup","messageType","convertToUiChatMessage","convertToUiSystemMessage","processChatMessageContent","messageSenderId","contentType","sanitizedMessageContentType","senderId","deletedOn","mine","_d","_e","systemMessageType","iconName","hasValidParticipant","some","p","messageThreadSelectorWithThread","participantCount","readReceiptsBySenderId","r","lastReadMessage","chatMessageId","convertedMessages","memoizedFn","isMessageValidToRender","chatMessagesWithStatus","sort","index","attached","previousMessage","nextMessage","previousSenderId","nextSenderId","timediff","diffMins","Math","round","showMessageStatus","typingIndicatorSelector","typingUsers","seen","Set","date8SecondsAgo","has","add","filterTypingIndicators","convertSdkTypingIndicatorsToCommunicationParticipants","chatParticipantListSelector","chatParticipants","isRemovable","kind","convertChatParticipantsToCommunicationParticipants","moderatorIdx","indexOf","moderatorIndex","myUserId","errorBarSelector","activeErrorMessages","specificSendMessageErrorSeen","latestUnableToReachChatServiceError","latestAccessDeniedError","sendMessageError","latestNotInThisThreadError","splice","maxErrorCount","accessErrorTargets","latestActiveErrorSatisfying","isErrorDueToBotContact","statusCode","includes","errors","activeErrorType","predicate","a","b","getSelector","component","findSelector","messageThreadSelectorsByThread","SendBox","S","MessageThread","useContext","messageThreadSelectorImpl","getMessageThreadSelector","TypingIndicator","ParticipantList","ErrorBar","createDefaultChatHandlers","messageIterator","readReceiptIterator","onSendMessage","sendMessageRequest","onUpdateMessage","updatedMetadata","JSON","stringify","attachedFilesMetadata","onDeleteMessage","onMessageSeen","sendReadReceipt","onTyping","onRemoveParticipant","updateThreadTopicName","topicName","onLoadPreviousChatMessages","messagesToLoad","maxPageSize","remainingMessagesToGet","isAllChatMessagesLoaded","earliestTime","MAX_SAFE_INTEGER","_","createDefaultChatHandlersForComponent","callingSelector","chatSelector","callProps","chatProps","selector","selectorProps","mounted","useRef","useEffect","current","threadConfigProps","useMemo","setProps","useState","propRef","newProps","callingHandlers","chatHandlers"],"sourceRoot":""}