query ChatListPaginationQuery(
  $count: Int = 5
  $cursor: String
  $id: ID!
) {
  node(id: $id) {
    __typename
    ...ChatPageMain_chat_1G22uz
    id
  }
}

fragment BotImage_bot on Bot {
  displayName
  ...botHelpers_useDeletion_bot
  ...BotImage_useProfileImage_bot
}

fragment BotImage_useProfileImage_bot on Bot {
  image {
    __typename
    ... on LocalBotImage {
      localName
    }
    ... on UrlBotImage {
      url
    }
  }
  ...botHelpers_useDeletion_bot
}

fragment ChatMessageDownvotedButton_message on Message {
  ...MessageFeedbackReasonModal_message
  ...MessageFeedbackOtherModal_message
}

fragment ChatMessageDropdownMenu_message on Message {
  id
  messageId
  vote
  text
  author
  ...chatHelpers_isBotMessage
}

fragment ChatMessageFeedbackButtons_message on Message {
  id
  messageId
  vote
  voteReason
  ...ChatMessageDownvotedButton_message
}

fragment ChatMessageInputView_chat on Chat {
  id
  chatId
  defaultBotObject {
    nickname
    messageLimit {
      dailyBalance
      shouldShowRemainingMessageCount
    }
    hasClearContext
    isDown
    ...botHelpers_useDeletion_bot
    id
  }
  shouldShowDisclaimer
  ...chatHelpers_useSendMessage_chat
  ...chatHelpers_useSendChatBreak_chat
}

fragment ChatMessageInputView_edges on MessageEdge {
  node {
    ...chatHelpers_isChatBreak
    ...chatHelpers_isHumanMessage
    state
    text
    id
  }
}

fragment ChatMessageOverflowButton_message on Message {
  text
  ...ChatMessageDropdownMenu_message
  ...chatHelpers_isBotMessage
}

fragment ChatMessageSuggestedReplies_SuggestedReplyButton_chat on Chat {
  ...chatHelpers_useSendMessage_chat
}

fragment ChatMessageSuggestedReplies_SuggestedReplyButton_message on Message {
  messageId
}

fragment ChatMessageSuggestedReplies_chat on Chat {
  ...ChatWelcomeView_chat
  ...ChatMessageSuggestedReplies_SuggestedReplyButton_chat
  defaultBotObject {
    hasWelcomeTopics
    id
  }
}

fragment ChatMessageSuggestedReplies_message on Message {
  suggestedReplies
  ...ChatMessageSuggestedReplies_SuggestedReplyButton_message
}

fragment ChatMessage_chat on Chat {
  defaultBotObject {
    hasWelcomeTopics
    hasSuggestedReplies
    disclaimerText
    messageLimit {
      ...ChatPageRateLimitedBanner_messageLimit
    }
    ...ChatPageDisclaimer_bot
    id
  }
  ...ChatMessageSuggestedReplies_chat
  ...ChatWelcomeView_chat
}

fragment ChatMessage_message on Message {
  id
  messageId
  text
  author
  linkifiedText
  state
  contentType
  ...ChatMessageSuggestedReplies_message
  ...ChatMessageFeedbackButtons_message
  ...ChatMessageOverflowButton_message
  ...chatHelpers_isHumanMessage
  ...chatHelpers_isBotMessage
  ...chatHelpers_isChatBreak
  ...chatHelpers_useTimeoutLevel
  ...MarkdownLinkInner_message
  ...IdAnnotation_node
}

fragment ChatMessagesView_chat on Chat {
  ...ChatMessage_chat
  ...ChatWelcomeView_chat
  ...IdAnnotation_node
  defaultBotObject {
    hasWelcomeTopics
    messageLimit {
      ...ChatPageRateLimitedBanner_messageLimit
    }
    id
  }
}

fragment ChatMessagesView_edges on MessageEdge {
  node {
    id
    messageId
    creationTime
    ...ChatMessage_message
    ...chatHelpers_isBotMessage
    ...chatHelpers_isHumanMessage
    ...chatHelpers_isChatBreak
  }
}

fragment ChatPageDeleteFooter_chat on Chat {
  ...MessageDeleteConfirmationModal_chat
}

fragment ChatPageDisclaimer_bot on Bot {
  disclaimerText
}

fragment ChatPageMainFooter_chat on Chat {
  defaultBotObject {
    ...ChatPageMainFooter_useAccessMessage_bot
    id
  }
  ...ChatMessageInputView_chat
  ...ChatPageShareFooter_chat
  ...ChatPageDeleteFooter_chat
}

fragment ChatPageMainFooter_edges on MessageEdge {
  ...ChatMessageInputView_edges
}

fragment ChatPageMainFooter_useAccessMessage_bot on Bot {
  ...botHelpers_useDeletion_bot
  ...botHelpers_useViewerCanAccessPrivateBot
}

fragment ChatPageMain_chat_1G22uz on Chat {
  id
  chatId
  ...ChatPageShareFooter_chat
  ...ChatPageDeleteFooter_chat
  ...ChatMessagesView_chat
  ...MarkdownLinkInner_chat
  ...chatHelpers_useUpdateStaleChat_chat
  ...ChatSubscriptionPaywallContextWrapper_chat
  ...ChatPageMainFooter_chat
  messagesConnection(last: $count, before: $cursor) {
    edges {
      ...ChatMessagesView_edges
      ...ChatPageMainFooter_edges
      ...MarkdownLinkInner_edges
      node {
        ...chatHelpers_useUpdateStaleChat_message
        id
        __typename
      }
      cursor
      id
    }
    pageInfo {
      hasPreviousPage
      startCursor
    }
    id
  }
}

fragment ChatPageRateLimitedBanner_messageLimit on MessageLimit {
  numMessagesRemaining
}

fragment ChatPageShareFooter_chat on Chat {
  chatId
}

fragment ChatSubscriptionPaywallContextWrapper_chat on Chat {
  defaultBotObject {
    messageLimit {
      numMessagesRemaining
      shouldShowRemainingMessageCount
    }
    ...SubscriptionPaywallModal_bot
    id
  }
}

fragment ChatWelcomeView_ChatWelcomeButton_chat on Chat {
  ...chatHelpers_useSendMessage_chat
}

fragment ChatWelcomeView_chat on Chat {
  ...ChatWelcomeView_ChatWelcomeButton_chat
  defaultBotObject {
    displayName
    id
  }
}

fragment IdAnnotation_node on Node {
  __isNode: __typename
  id
}

fragment MarkdownLinkInner_chat on Chat {
  id
  chatId
  defaultBotObject {
    nickname
    id
  }
  ...chatHelpers_useSendMessage_chat
}

fragment MarkdownLinkInner_edges on MessageEdge {
  node {
    state
    id
  }
}

fragment MarkdownLinkInner_message on Message {
  messageId
}

fragment MessageDeleteConfirmationModal_chat on Chat {
  id
}

fragment MessageFeedbackOtherModal_message on Message {
  id
  messageId
}

fragment MessageFeedbackReasonModal_message on Message {
  id
  messageId
}

fragment SubscriptionPaywallModal_bot on Bot {
  displayName
  messageLimit {
    dailyLimit
    numMessagesRemaining
    shouldShowRemainingMessageCount
    resetTime
  }
  ...BotImage_bot
}

fragment botHelpers_useDeletion_bot on Bot {
  deletionState
}

fragment botHelpers_useViewerCanAccessPrivateBot on Bot {
  isPrivateBot
  viewerIsCreator
}

fragment chatHelpers_isBotMessage on Message {
  ...chatHelpers_isHumanMessage
  ...chatHelpers_isChatBreak
}

fragment chatHelpers_isChatBreak on Message {
  author
}

fragment chatHelpers_isHumanMessage on Message {
  author
}

fragment chatHelpers_useSendChatBreak_chat on Chat {
  id
  chatId
  defaultBotObject {
    nickname
    introduction
    model
    id
  }
  shouldShowDisclaimer
}

fragment chatHelpers_useSendMessage_chat on Chat {
  id
  chatId
  defaultBotObject {
    id
    nickname
  }
  shouldShowDisclaimer
}

fragment chatHelpers_useTimeoutLevel on Message {
  id
  state
  text
  messageId
  chat {
    chatId
    defaultBotNickname
    id
  }
}

fragment chatHelpers_useUpdateStaleChat_chat on Chat {
  chatId
  defaultBotObject {
    contextClearWindowSecs
    id
  }
  ...chatHelpers_useSendChatBreak_chat
}

fragment chatHelpers_useUpdateStaleChat_message on Message {
  creationTime
  ...chatHelpers_isChatBreak
}
