/**
 * AUTO-GENERATED FILE - DO NOT EDIT.
 * Generated from custom-elements manifest.
 */

'use strict';

const React = require('react');
const { AiActivityHalo: AiActivityHaloWC } = require('./esm/components/activity-halo/activity-halo.js');
const { AgentPicker: AgentPickerWC } = require('./esm/components/agent-picker/agent-picker.js');
const { AiChatBubble: AiChatBubbleWC } = require('./esm/components/chat-bubble/chat-bubble.js');
const { AiChatInteractionWrapper: AiChatInteractionWrapperWC } = require('./esm/components/chat-interaction-wrapper/chat-interaction-wrapper.js');
const { AiChatMarkdown: AiChatMarkdownWC } = require('./esm/components/chat-markdown/chat-markdown.js');
const { AiFlowingWavesIndicator: AiFlowingWavesIndicatorWC } = require('./esm/components/flowing-waves-indicator.js');
const { AiHaloOverlay: AiHaloOverlayWC } = require('./esm/components/halo-overlay.js');
const { AiPlasmaOrbIndicator: AiPlasmaOrbIndicatorWC } = require('./esm/components/plasma-orb-indicator.js');
const { FoundationAiPopoutManager: FoundationAiPopoutManagerWC } = require('./esm/components/popout-manager/popout-manager.js');
const { AiWavesIndicator: AiWavesIndicatorWC } = require('./esm/components/waves-indicator.js');
const { FoundationAiAssistant: FoundationAiAssistantWC } = require('./esm/main/main.js');
const { ChatSuggestions: ChatSuggestionsWC } = require('./esm/suggestions/chat-suggestions.js');

function _mergeRefs(...refs) {
  return (value) => {
    for (const ref of refs) {
      if (typeof ref === 'function') ref(value);
      else if (ref != null) ref.current = value;
    }
  };
}

const AiFlowingWavesIndicator = React.forwardRef(function AiFlowingWavesIndicator(props, ref) {
  const { children, ...rest } = props;
  return React.createElement(customElements.getName(AiFlowingWavesIndicatorWC) ?? 'ai-flowing-waves-indicator', { ...rest, ref }, children);
});

const AiHaloOverlay = React.forwardRef(function AiHaloOverlay(props, ref) {
  const { children, ...rest } = props;
  return React.createElement(customElements.getName(AiHaloOverlayWC) ?? 'ai-halo-overlay', { ...rest, ref }, children);
});

const AiPlasmaOrbIndicator = React.forwardRef(function AiPlasmaOrbIndicator(props, ref) {
  const { children, ...rest } = props;
  return React.createElement(customElements.getName(AiPlasmaOrbIndicatorWC) ?? 'ai-plasma-orb-indicator', { ...rest, ref }, children);
});

const AiWavesIndicator = React.forwardRef(function AiWavesIndicator(props, ref) {
  const { children, ...rest } = props;
  return React.createElement(customElements.getName(AiWavesIndicatorWC) ?? 'ai-waves-indicator', { ...rest, ref }, children);
});

const FoundationAiAssistant = React.forwardRef(function FoundationAiAssistant(props, ref) {
  const { onChatHeaderMousedown, onSessionCleared, children, ...rest } = props;
  const _innerRef = React.useRef(null);
  const _onChatHeaderMousedownRef = React.useRef(onChatHeaderMousedown);
  _onChatHeaderMousedownRef.current = onChatHeaderMousedown;
  const _onSessionClearedRef = React.useRef(onSessionCleared);
  _onSessionClearedRef.current = onSessionCleared;
  React.useLayoutEffect(() => {
    const el = _innerRef.current;
    if (!el) return;
    const _onChatHeaderMousedownFn = (e) => _onChatHeaderMousedownRef.current?.(e);
    el.addEventListener('chat-header-mousedown', _onChatHeaderMousedownFn);
    const _onSessionClearedFn = (e) => _onSessionClearedRef.current?.(e);
    el.addEventListener('session-cleared', _onSessionClearedFn);
    return () => {
      el.removeEventListener('chat-header-mousedown', _onChatHeaderMousedownFn);
      el.removeEventListener('session-cleared', _onSessionClearedFn);
    };
  }, []);
  return React.createElement(customElements.getName(FoundationAiAssistantWC) ?? 'foundation-ai-assistant', { ...rest, ref: _mergeRefs(_innerRef, ref) }, children);
});

const ChatSuggestions = React.forwardRef(function ChatSuggestions(props, ref) {
  const { children, ...rest } = props;
  return React.createElement(customElements.getName(ChatSuggestionsWC) ?? 'chat-suggestions', { ...rest, ref }, children);
});

const AiActivityHalo = React.forwardRef(function AiActivityHalo(props, ref) {
  const { children, ...rest } = props;
  return React.createElement(customElements.getName(AiActivityHaloWC) ?? 'ai-activity-halo', { ...rest, ref }, children);
});

const AgentPicker = React.forwardRef(function AgentPicker(props, ref) {
  const { onAgentPinned, children, ...rest } = props;
  const _innerRef = React.useRef(null);
  const _onAgentPinnedRef = React.useRef(onAgentPinned);
  _onAgentPinnedRef.current = onAgentPinned;
  React.useLayoutEffect(() => {
    const el = _innerRef.current;
    if (!el) return;
    const _onAgentPinnedFn = (e) => _onAgentPinnedRef.current?.(e);
    el.addEventListener('agent-pinned', _onAgentPinnedFn);
    return () => {
      el.removeEventListener('agent-pinned', _onAgentPinnedFn);
    };
  }, []);
  return React.createElement(customElements.getName(AgentPickerWC) ?? 'foundation-ai-agent-picker', { ...rest, ref: _mergeRefs(_innerRef, ref) }, children);
});

const AiChatBubble = React.forwardRef(function AiChatBubble(props, ref) {
  const { children, ...rest } = props;
  return React.createElement(customElements.getName(AiChatBubbleWC) ?? 'foundation-ai-chat-bubble', { ...rest, ref }, children);
});

const AiChatInteractionWrapper = React.forwardRef(function AiChatInteractionWrapper(props, ref) {
  const { onRequestScrollToBottom, onInteractionCompleted, children, ...rest } = props;
  const _innerRef = React.useRef(null);
  const _onRequestScrollToBottomRef = React.useRef(onRequestScrollToBottom);
  _onRequestScrollToBottomRef.current = onRequestScrollToBottom;
  const _onInteractionCompletedRef = React.useRef(onInteractionCompleted);
  _onInteractionCompletedRef.current = onInteractionCompleted;
  React.useLayoutEffect(() => {
    const el = _innerRef.current;
    if (!el) return;
    const _onRequestScrollToBottomFn = (e) => _onRequestScrollToBottomRef.current?.(e);
    el.addEventListener('request-scroll-to-bottom', _onRequestScrollToBottomFn);
    const _onInteractionCompletedFn = (e) => _onInteractionCompletedRef.current?.(e);
    el.addEventListener('interaction-completed', _onInteractionCompletedFn);
    return () => {
      el.removeEventListener('request-scroll-to-bottom', _onRequestScrollToBottomFn);
      el.removeEventListener('interaction-completed', _onInteractionCompletedFn);
    };
  }, []);
  return React.createElement(customElements.getName(AiChatInteractionWrapperWC) ?? 'ai-chat-interaction-wrapper', { ...rest, ref: _mergeRefs(_innerRef, ref) }, children);
});

const AiChatMarkdown = React.forwardRef(function AiChatMarkdown(props, ref) {
  const { children, ...rest } = props;
  return React.createElement(customElements.getName(AiChatMarkdownWC) ?? 'ai-chat-markdown', { ...rest, ref }, children);
});

const FoundationAiPopoutManager = React.forwardRef(function FoundationAiPopoutManager(props, ref) {
  const { children, ...rest } = props;
  return React.createElement(customElements.getName(FoundationAiPopoutManagerWC) ?? 'foundation-ai-popout-manager', { ...rest, ref }, children);
});

module.exports = {
  AiFlowingWavesIndicator,
  AiHaloOverlay,
  AiPlasmaOrbIndicator,
  AiWavesIndicator,
  FoundationAiAssistant,
  ChatSuggestions,
  AiActivityHalo,
  AgentPicker,
  AiChatBubble,
  AiChatInteractionWrapper,
  AiChatMarkdown,
  FoundationAiPopoutManager,
};
