{"version":3,"file":"index.mjs","sources":["../src/types/courier-toast-theme.ts","../src/types/courier-toast-theme-manager.ts","../src/utils/pausable-timeout.ts","../src/utils/animation.ts","../src/components/courier-toast-item.ts","../src/datastore/toast-datastore.ts","../src/datastore/toast-datastore-listener.ts","../src/components/courier-toast.ts","../src/datastore/toast-datastore-events.ts","../src/index.ts"],"sourcesContent":["import { CourierColors, CourierIconSVGs, SystemThemeMode, CourierFontTheme, CourierIconTheme } from \"@trycourier/courier-ui-core\";\r\n\r\n// Re-export common types from core for convenience\r\n\r\n/** @public */\r\nexport type CourierToastFontTheme = CourierFontTheme;\r\n\r\n/** @public */\r\nexport type CourierToastIconTheme = CourierIconTheme & {\r\n  /**\r\n   * Whether the icon is drawn at all. Defaults to `true`; set it to `false` to\r\n   * drop the icon and the space it holds, for toasts that read better as text\r\n   * alone.\r\n   */\r\n  visible?: boolean;\r\n};\r\n\r\n/** @public */\r\nexport type CourierToastItemTheme = {\r\n  backgroundColor?: string;\r\n  hoverBackgroundColor?: string;\r\n  activeBackgroundColor?: string;\r\n  autoDismissBarColor?: string;\r\n  title?: CourierToastFontTheme;\r\n  body?: CourierToastFontTheme;\r\n  icon?: CourierToastIconTheme;\r\n  dismissIcon?: CourierToastIconTheme;\r\n  shadow?: string;\r\n  border?: string;\r\n  borderRadius?: string;\r\n  actions?: {\r\n    backgroundColor?: string;\r\n    hoverBackgroundColor?: string;\r\n    activeBackgroundColor?: string;\r\n    border?: string;\r\n    borderRadius?: string;\r\n    shadow?: string;\r\n    font?: CourierToastFontTheme;\r\n  }\r\n}\r\n\r\n/** @public */\r\nexport type CourierToastTheme = {\r\n  item?: CourierToastItemTheme;\r\n};\r\n\r\n/** @public */\r\nexport const defaultLightTheme: CourierToastTheme = {\r\n  item: {\r\n    backgroundColor: CourierColors.white[500],\r\n    hoverBackgroundColor: CourierColors.gray[200],\r\n    activeBackgroundColor: CourierColors.gray[500],\r\n    shadow: `0px 4px 8px -2px ${CourierColors.black[500_20]}`,\r\n    border: `1px solid ${CourierColors.gray[500]}`,\r\n    borderRadius: '8px',\r\n    title: {\r\n      size: '11pt',\r\n      weight: '400',\r\n      color: CourierColors.black[500],\r\n    },\r\n    body: {\r\n      size: '11pt',\r\n      weight: '400',\r\n      color: CourierColors.gray[600],\r\n    },\r\n    icon: {\r\n      color: CourierColors.black[500],\r\n      svg: CourierIconSVGs.inbox,\r\n    },\r\n    dismissIcon: {\r\n      color: CourierColors.black[500],\r\n      svg: CourierIconSVGs.remove,\r\n    },\r\n    autoDismissBarColor: CourierColors.blue[400],\r\n    actions: {\r\n      backgroundColor: 'transparent',\r\n      hoverBackgroundColor: CourierColors.gray[200],\r\n      activeBackgroundColor: CourierColors.gray[500],\r\n      border: `1px solid ${CourierColors.gray[500]}`,\r\n      borderRadius: '4px',\r\n      shadow: '0px 1px 2px 0px rgba(0, 0, 0, 0.06)',\r\n      font: {\r\n        color: CourierColors.black[500],\r\n        size: '14px',\r\n      }\r\n    }\r\n  }\r\n};\r\n\r\n/** @public */\r\nexport const defaultDarkTheme: CourierToastTheme = {\r\n  item: {\r\n    backgroundColor: CourierColors.black[500],\r\n    hoverBackgroundColor: CourierColors.gray[800],\r\n    activeBackgroundColor: CourierColors.gray[700],\r\n    shadow: `0px 4px 8px -2px ${CourierColors.gray[400]}`,\r\n    border: `1px solid ${CourierColors.gray[400]}`,\r\n    borderRadius: '8px',\r\n    title: {\r\n      size: '11pt',\r\n      weight: '400',\r\n      color: CourierColors.white[500],\r\n    },\r\n    body: {\r\n      size: '11pt',\r\n      weight: '400',\r\n      color: CourierColors.gray[500],\r\n    },\r\n    icon: {\r\n      color: CourierColors.white[500],\r\n      svg: CourierIconSVGs.inbox,\r\n    },\r\n    dismissIcon: {\r\n      color: CourierColors.white[500],\r\n      svg: CourierIconSVGs.remove,\r\n    },\r\n    autoDismissBarColor: CourierColors.blue[400],\r\n    actions: {\r\n      backgroundColor: CourierColors.black[400],\r\n      hoverBackgroundColor: CourierColors.white[500_10],\r\n      activeBackgroundColor: CourierColors.white[500_20],\r\n      border: `1px solid ${CourierColors.gray[400]}`,\r\n      borderRadius: '4px',\r\n      shadow: `0px 1px 2px 0px ${CourierColors.white[500_10]}`,\r\n      font: {\r\n        color: CourierColors.white[500],\r\n        size: '14px'\r\n      }\r\n    }\r\n  }\r\n};\r\n\r\n/**\r\n * Deep merge themes, only overwriting non-optional properties.\r\n *\r\n * @public\r\n */\r\nexport const mergeTheme = (mode: SystemThemeMode, theme: CourierToastTheme): CourierToastTheme => {\r\n  const defaultTheme = mode === 'light' ? defaultLightTheme : defaultDarkTheme;\r\n  return {\r\n    item: {\r\n      ...defaultTheme.item,\r\n      ...theme.item,\r\n      title: {\r\n        ...defaultTheme.item?.title,\r\n        ...theme.item?.title\r\n      },\r\n      body: {\r\n        ...defaultTheme.item?.body,\r\n        ...theme.item?.body\r\n      },\r\n      icon: {\r\n        ...defaultTheme.item?.icon,\r\n        ...theme.item?.icon\r\n      },\r\n      dismissIcon: {\r\n        ...defaultTheme.item?.dismissIcon,\r\n        ...theme.item?.dismissIcon\r\n      }\r\n    }\r\n  };\r\n};\r\n","import { CourierThemeManager, CourierThemeSubscription, SystemThemeMode } from \"@trycourier/courier-ui-core\";\r\nimport { CourierToastTheme, defaultDarkTheme, defaultLightTheme, mergeTheme } from \"./courier-toast-theme\";\r\n\r\n/**\r\n * @public\r\n */\r\nexport interface CourierToastThemeSubscription extends CourierThemeSubscription<CourierToastTheme> {\r\n  manager: CourierToastThemeManager;\r\n}\r\n\r\n/**\r\n * Toast-specific theme manager that extends the abstract CourierThemeManager.\r\n * Provides toast theme management with light/dark mode support.\r\n *\r\n * @public\r\n */\r\nexport class CourierToastThemeManager extends CourierThemeManager<CourierToastTheme> {\r\n\r\n  // Event ID for toast theme changes\r\n  protected readonly THEME_CHANGE_EVENT: string = 'courier_toast_theme_change';\r\n\r\n  constructor(initialTheme: CourierToastTheme) {\r\n    super(initialTheme);\r\n  }\r\n\r\n  /**\r\n   * Get the default light theme for toast\r\n   */\r\n  protected getDefaultLightTheme(): CourierToastTheme {\r\n    return defaultLightTheme;\r\n  }\r\n\r\n  /**\r\n   * Get the default dark theme for toast\r\n   */\r\n  protected getDefaultDarkTheme(): CourierToastTheme {\r\n    return defaultDarkTheme;\r\n  }\r\n\r\n  /**\r\n   * Merge the toast theme with defaults\r\n   */\r\n  protected mergeTheme(mode: SystemThemeMode, theme: CourierToastTheme): CourierToastTheme {\r\n    return mergeTheme(mode, theme);\r\n  }\r\n\r\n  /**\r\n   * Subscribe to toast theme changes\r\n   * @param callback - Function to run when the theme changes\r\n   * @returns Object with unsubscribe method to stop listening\r\n   */\r\n  public subscribe(callback: (theme: CourierToastTheme) => void): CourierToastThemeSubscription {\r\n    const baseSubscription = super.subscribe(callback);\r\n    return {\r\n      ...baseSubscription,\r\n      manager: this\r\n    };\r\n  }\r\n\r\n}\r\n","/**\n * A `setTimeout` that can be paused and resumed.\n *\n * Pausing banks the time that has already elapsed, so resuming fires the\n * callback after the *remaining* time rather than restarting the full delay.\n *\n * Used for the toast auto-dismiss countdown, which pauses while the cursor is\n * over the toast.\n */\nexport class PausableTimeout {\n  private readonly _callback: () => void;\n\n  /** Time left on the countdown, updated each time it's paused. */\n  private _remainingMs: number;\n\n  private _timerId: ReturnType<typeof setTimeout> | null = null;\n\n  /** When the currently-running countdown was (re)started. */\n  private _startedAt = 0;\n\n  private _isPaused = false;\n\n  /** Set once the callback has fired (or the countdown was cancelled). */\n  private _isDone = false;\n\n  constructor(callback: () => void, delayMs: number) {\n    this._callback = callback;\n    this._remainingMs = delayMs;\n  }\n\n  /** Whether the countdown is currently paused. */\n  public get isPaused(): boolean {\n    return this._isPaused;\n  }\n\n  /** Start the countdown for whatever time is left on it. */\n  public start(): void {\n    if (this._isDone) {\n      return;\n    }\n\n    this.clear();\n    this._isPaused = false;\n    this._startedAt = Date.now();\n    this._timerId = setTimeout(() => {\n      this._timerId = null;\n      this._isDone = true;\n      this._callback();\n    }, this._remainingMs);\n  }\n\n  /** Pause the countdown, banking the time that has already elapsed. */\n  public pause(): void {\n    if (this._isDone || this._isPaused || this._timerId === null) {\n      return;\n    }\n\n    this._remainingMs = Math.max(0, this._remainingMs - (Date.now() - this._startedAt));\n    this._isPaused = true;\n    this.clear();\n  }\n\n  /** Resume a paused countdown from where it left off. */\n  public resume(): void {\n    if (this._isDone || !this._isPaused) {\n      return;\n    }\n\n    this.start();\n  }\n\n  /** Cancel the countdown for good; it can't be started again. */\n  public cancel(): void {\n    this._isPaused = false;\n    this._isDone = true;\n    this.clear();\n  }\n\n  private clear(): void {\n    if (this._timerId !== null) {\n      clearTimeout(this._timerId);\n      this._timerId = null;\n    }\n  }\n}\n","/**\n * How long a toast's exit animation runs, in milliseconds.\n *\n * Shared by the `courier-toast-hide` keyframes in {@link CourierToast}'s styles\n * and the delay {@link CourierToastItem} waits before removing itself, so the\n * element leaves the DOM exactly as the animation lands instead of being cut off\n * partway through it.\n */\nexport const TOAST_DISMISS_ANIMATION_MS = 300;\n","import { CourierBaseElement, CourierButton, CourierIcon, registerElement } from \"@trycourier/courier-ui-core\";\nimport { CourierToastThemeManager, CourierToastThemeSubscription } from \"../types/courier-toast-theme-manager\";\nimport { CourierToastTheme } from \"../types/courier-toast-theme\";\nimport { InboxAction, InboxMessage } from \"@trycourier/courier-js\";\nimport { CourierToastItemActionClickEvent, CourierToastItemClickEvent, CourierToastItemFactoryProps } from \"../types/toast\";\nimport { PausableTimeout } from \"../utils/pausable-timeout\";\nimport { TOAST_DISMISS_ANIMATION_MS } from \"../utils/animation\";\n\n/**\n * Default implementation of a Toast item.\n *\n * @see {@link CourierToast}\n * @public\n */\nexport class CourierToastItem extends CourierBaseElement {\n  /** How long the exit animation runs before a dismissed toast's element is removed. */\n  private static readonly dismissAnimationTimeoutMs = TOAST_DISMISS_ANIMATION_MS;\n\n  private _themeManager: CourierToastThemeManager;\n  private _themeSubscription: CourierToastThemeSubscription;\n  private _message: InboxMessage;\n  private _customToastItemContent?: (props: CourierToastItemFactoryProps) => HTMLElement;\n\n  /** Whether this toast item is auto-dismissed. */\n  private readonly _autoDismiss: boolean;\n\n  /** The timeout before the toast item is auto-dismissed, applicable if _autoDismiss is true. */\n  private readonly _autoDismissTimeoutMs: number;\n\n  // Auto-dismiss countdown state. The countdown only runs while this item is the\n  // top of the stack and the cursor is away; otherwise it's paused and resumes\n  // from where it left off, so a toast is never dismissed before it's legible.\n  // Both conditions are tracked by the containing CourierToast — see\n  // CourierToast.refreshAutoDismissCountdowns.\n  private _autoDismissTimeout: PausableTimeout | null = null;\n\n  /** The progress bar element, paused/resumed alongside the countdown to stay in sync. */\n  private _autoDismissBar: HTMLElement | null = null;\n\n  // Callbacks\n  private _onItemDismissedCallback: ((props: { message: InboxMessage }) => void) | null = null;\n  private _onToastItemClickCallback: ((props: CourierToastItemClickEvent) => void) | null = null;\n  private _onToastItemActionClickCallback: ((props: CourierToastItemActionClickEvent) => void) | null = null;\n\n  constructor(props: {\n    message: InboxMessage,\n    autoDismiss: boolean,\n    autoDismissTimeoutMs: number,\n    themeManager: CourierToastThemeManager,\n  }) {\n\n    super();\n    this._message = props.message;\n    this._autoDismiss = props.autoDismiss;\n    this._autoDismissTimeoutMs = props.autoDismissTimeoutMs;\n\n    this._themeManager = props.themeManager;\n    this._themeSubscription = this._themeManager.subscribe((_: CourierToastTheme) => {\n      this.render();\n    });\n  }\n\n  /**\n   * Registers a handler called when the item is dismissed.\n   *\n   * @param handler - A function to be called when the item is dismissed.\n   */\n  public onItemDismissed(handler: (props: { message: InboxMessage }) => void): void {\n    this._onItemDismissedCallback = handler;\n  }\n\n  /**\n   * Registers a handler for item click events.\n   *\n   * @param handler - A function to be called when the item is clicked.\n   */\n  public onToastItemClick(handler: (props: CourierToastItemClickEvent) => void): void {\n    this._onToastItemClickCallback = handler;\n\n    // Re-render to set/un-set the .clickable class\n    this.render();\n  }\n\n  /**\n   * Registers a handler for item click events.\n   *\n   * @param handler - A function to be called when the item is clicked.\n   */\n  public onToastItemActionClick(handler: (props: CourierToastItemActionClickEvent) => void): void {\n    this._onToastItemActionClickCallback = handler;\n\n    // Re-render to set/un-set the .clickable class\n    this.render();\n  }\n\n\n  /**\n   * Set a custom content element for the toast item, reusing the {@link CourierToastItem}\n   * container, which provides styling, animations, and event handling.\n   *\n   * @param factory - Function that returns an `HTMLElement` to render as the content.\n   */\n  public setToastItemContent(factory?: (props: CourierToastItemFactoryProps) => HTMLElement) {\n    this._customToastItemContent = factory;\n  }\n\n  /**\n   * Dismiss the toast item.\n   *\n   * By default the toast fades out before it's removed. Set `timeoutMs` to\n   * `0` to remove the item immediately.\n   *\n   * @param timeoutMs - the animation duration to fade out the toast item\n   */\n  public dismiss(timeoutMs: number = CourierToastItem.dismissAnimationTimeoutMs) {\n    // Stop the countdown so it can't fire again after we've started dismissing.\n    this._autoDismissTimeout?.cancel();\n    this.classList.add('dismissing');\n\n    setTimeout(() => {\n      this.remove();\n\n      if (this._onItemDismissedCallback) {\n        this._onItemDismissedCallback({ message: this._message });\n      }\n    }, timeoutMs);\n  }\n\n  /**\n   * Pause the auto-dismiss countdown, banking the time already elapsed and\n   * freezing the progress bar so the two stay in sync.\n   *\n   * Called by the containing {@link CourierToast} while the cursor is over the\n   * toast stack, or while this item sits behind the top of the stack. No-op if\n   * this item doesn't auto-dismiss.\n   */\n  public pauseAutoDismiss(): void {\n    this._autoDismissTimeout?.pause();\n    this.syncAutoDismissBarPlayState();\n  }\n\n  /**\n   * Resume a paused auto-dismiss countdown from where it left off.\n   *\n   * Called by the containing {@link CourierToast} once the cursor leaves the\n   * toast stack and this item is on top of it. No-op if this item doesn't\n   * auto-dismiss.\n   */\n  public resumeAutoDismiss(): void {\n    this._autoDismissTimeout?.resume();\n    this.syncAutoDismissBarPlayState();\n  }\n\n  /** Freeze/unfreeze the progress bar to match the countdown. */\n  private syncAutoDismissBarPlayState(): void {\n    if (!this._autoDismissBar) {\n      return;\n    }\n\n    this._autoDismissBar.style.animationPlayState = this._autoDismissTimeout?.isPaused ? 'paused' : 'running';\n  }\n\n  /** @override */\n  protected onComponentMounted(): void {\n    this.render();\n\n    if (this._autoDismiss) {\n      this._autoDismissTimeout = new PausableTimeout(() => this.dismiss(), this._autoDismissTimeoutMs);\n      this._autoDismissTimeout.start();\n    }\n  }\n\n  /** @override */\n  protected onComponentUnmounted(): void {\n    this._themeSubscription.unsubscribe();\n    this._autoDismissTimeout?.cancel();\n  }\n\n  get theme(): CourierToastTheme {\n    return this._themeManager.getTheme();\n  }\n\n  /**\n   * @override\n   */\n  static get id(): string {\n    return 'courier-toast-item';\n  }\n\n  /**\n   * @override\n   */\n  static get observedAttributes(): string[] {\n    return [];\n  }\n\n  /**\n   * Render a toast item, either with default content or custom content if\n   * a content factory function is provided.\n   *\n   * Note: Styles for the toast item are set in {@link CourierToast} since\n   * toasts are ephemeral by nature and we want to avoid adding/removing/duplicating\n   * styles as {@link CourierToastItem}s enter/exit.\n   */\n  private render(): void {\n    // Reset existing content and top-level listeners\n    while (this.firstChild) {\n      this.removeChild(this.firstChild);\n    }\n    this.removeEventListener('click', this.onClick);\n\n    // Content and the auto-dismiss bar are wrapped in a container that hides overflow.\n    // The standard dismiss button overflows the toast.\n    const overflowHiddenContainer = document.createElement('div');\n    overflowHiddenContainer.classList.add('overflow-hidden-container');\n    this.appendChild(overflowHiddenContainer);\n\n    // Auto-dismiss\n    if (this._autoDismiss) {\n      const autoDismiss = document.createElement('div');\n      autoDismiss.classList.add('auto-dismiss');\n      // Keep the bar frozen if we re-render (e.g. theme change) while paused.\n      if (this._autoDismissTimeout?.isPaused) {\n        autoDismiss.style.animationPlayState = 'paused';\n      }\n      overflowHiddenContainer.append(autoDismiss);\n      this._autoDismissBar = autoDismiss;\n    }\n\n    // Content\n    if (this._customToastItemContent) {\n      overflowHiddenContainer.appendChild(this._customToastItemContent({ message: this._message, autoDismiss: this._autoDismiss, autoDismissTimeoutMs: this._autoDismissTimeoutMs }));\n    } else {\n      overflowHiddenContainer.appendChild(this.createDefaultContent());\n    }\n\n    // Click-ability\n    if (this._onToastItemClickCallback) {\n      this.classList.add('clickable');\n    }\n\n    this.addEventListener('click', this.onClick);\n\n    // Dismiss button\n    const dismiss = new CourierIcon(\n      this.theme.item?.dismissIcon?.color,\n      this.theme.item?.dismissIcon?.svg,\n    );\n    dismiss.classList.add('dismiss');\n    dismiss.addEventListener('click', (event) => {\n      event.stopPropagation();\n      this.remove();\n\n      if (this._onItemDismissedCallback) {\n        this._onItemDismissedCallback({ message: this._message });\n      }\n    });\n    this.appendChild(dismiss);\n  }\n\n  /** Create the default content for this item. */\n  private createDefaultContent(): HTMLElement {\n    const content = document.createElement('div');\n    content.classList.add('content');\n    this.append(content);\n\n    // A hidden icon is left out entirely rather than emptied, so the content\n    // row does not keep a gap where it used to be.\n    const iconTheme = this.theme.item?.icon;\n    if (iconTheme?.visible !== false) {\n      const icon = new CourierIcon(iconTheme?.color, iconTheme?.svg);\n      icon.classList.add('icon');\n      content.appendChild(icon);\n    }\n\n    const textContent = document.createElement('div');\n    textContent.classList.add('text-content');\n    content.appendChild(textContent);\n\n    const title = document.createElement('p');\n    title.classList.add('title');\n    title.textContent = this._message.title ?? '';\n    textContent.appendChild(title);\n\n    const body = document.createElement('p');\n    body.classList.add('body');\n    body.textContent = this._message.preview ?? this._message.body ?? '';\n    textContent.appendChild(body);\n\n    if (this.messageHasActions) {\n      const actionsContainer = document.createElement('div');\n      actionsContainer.classList.add('actions-container');\n      textContent.appendChild(actionsContainer);\n\n      this._message.actions?.forEach(action => {\n        const button = this.createActionButton(action);\n        actionsContainer.appendChild(button);\n      });\n    }\n\n    return content;\n  }\n\n  private get messageHasActions() {\n    return this._message.actions && this._message.actions.length > 0;\n  }\n\n  private createActionButton(action: InboxAction): CourierButton {\n    const actionsTheme = this._themeManager.getTheme().item?.actions;\n\n    return new CourierButton({\n      mode: this._themeManager.mode,\n      text: action.content,\n      variant: 'secondary',\n      backgroundColor: actionsTheme?.backgroundColor,\n      hoverBackgroundColor: actionsTheme?.hoverBackgroundColor,\n      activeBackgroundColor: actionsTheme?.activeBackgroundColor,\n      border: actionsTheme?.border,\n      borderRadius: actionsTheme?.borderRadius,\n      shadow: actionsTheme?.shadow,\n      fontFamily: actionsTheme?.font?.family,\n      fontSize: actionsTheme?.font?.size,\n      fontWeight: actionsTheme?.font?.weight,\n      textColor: actionsTheme?.font?.color,\n      onClick: () => {\n        if (this._onToastItemActionClickCallback) {\n          this._onToastItemActionClickCallback({ message: this._message, action });\n        }\n      }\n    });\n\n\n  }\n\n  private onClick(event: Event) {\n    event.stopPropagation();\n    if (this._onToastItemClickCallback) {\n      this._onToastItemClickCallback({ message: this._message });\n    }\n  }\n}\n\nregisterElement(CourierToastItem);\n","import { Courier, InboxMessage, InboxMessageEvent, InboxMessageEventEnvelope } from \"@trycourier/courier-js\";\nimport { CourierToastDatastoreListener } from \"./toast-datastore-listener\";\n\n/**\n * Shared datastore for Courier toasts.\n *\n * This datastore listens to and stores Courier Inbox messages.\n *\n * @public\n */\nexport class CourierToastDatastore {\n  /** Shared instance. Access via {@link CourierToastDatastore.shared}. */\n  private static instance: CourierToastDatastore;\n\n  /** FIFO stack of toast messages. The end of the array is index 0 of the stack. */\n  private _dataset: InboxMessage[] = [];\n\n  /** Set of listeners whose handlers will be called when the datastore changes. */\n  private _datastoreListeners: CourierToastDatastoreListener[] = [];\n\n  /** Cleanup function to remove the message event listener. */\n  private _removeMessageEventListener?: () => void;\n\n  /** The shared instance of CourierToastDatastore, used to access all public methods. */\n  public static get shared(): CourierToastDatastore {\n    if (!CourierToastDatastore.instance) {\n      CourierToastDatastore.instance = new CourierToastDatastore();\n    }\n\n    return CourierToastDatastore.instance;\n  }\n\n  /**\n   * Add a listener whose handlers are called when there are changes to the datastore.\n   *\n   * @param listener - an implementation of {@link CourierToastDatastoreListener}\n   */\n  public addDatastoreListener(listener: CourierToastDatastoreListener) {\n    this._datastoreListeners.push(listener);\n  }\n\n  /**\n   * Remove a previously added listener.\n   *\n   * Note: the `listener` param is matched by object reference, so callers must pass\n   * the same object previously passed to {@link CourierToastDatastore.addDatastoreListener}.\n   *\n   * See also: {@link CourierToastDatastoreListener.remove}\n   *\n   * @param listener - a previously added listener implementation\n   */\n  public removeDatastoreListener(listener: CourierToastDatastoreListener) {\n    this._datastoreListeners = this._datastoreListeners.filter(l => l !== listener);\n  }\n\n  /**\n   * Start listening for toast messages.\n   *\n   * Calling this method will open a WebSocket connection to the Courier backend if one\n   * is not already open.\n   *\n   * See also: {@link @trycourier/courier-js#Courier.shared.signIn} and {@link @trycourier/courier-js#Courier.shared.signOut}\n   */\n  public async listenForMessages() {\n    try {\n      const socketClient = Courier.shared.client?.inbox.socket;\n\n      if (!socketClient) {\n        Courier.shared.client?.options.logger?.info('CourierInbox socket not available');\n        return;\n      }\n\n      // Remove any existing listener before adding a new one\n      // This prevents duplicates and handles socket changes\n      if (this._removeMessageEventListener) {\n        this._removeMessageEventListener();\n      }\n\n      // Register message event listener and store the cleanup function\n      this._removeMessageEventListener = socketClient.addMessageEventListener((messageEvent: InboxMessageEventEnvelope) => {\n        if (messageEvent.event === InboxMessageEvent.NewMessage) {\n          const message: InboxMessage = messageEvent.data as InboxMessage;\n\n          this.addMessage(message);\n        }\n      });\n\n      // If the socket is already connecting or open, return early\n      if (socketClient.isConnecting || socketClient.isOpen) {\n        Courier.shared.client?.options.logger?.info(`Inbox socket already connecting or open for client ID: [${Courier.shared.client?.options.connectionId}]`);\n        return;\n      }\n\n      await socketClient.connect();\n    } catch (error: unknown) {\n      Courier.shared.client?.options.logger.error('Error listening for messages:', error);\n      this._datastoreListeners.forEach(listener => {\n        listener.events.onError?.(error as Error);\n      });\n    }\n  }\n\n  /**\n   * Find the position of an {@link @trycourier/courier-js#InboxMessage} in the toast stack.\n   *\n   * Notes:\n   *  - Since the stack is an array, with the last item being the \"top\" of the stack,\n   *    a toast's position in the underlying array is the inverse of its stack position.\n   *  - `message` is matched by {@link @trycourier/courier-js#InboxMessage.messageId}, not by object reference.\n   *\n   * @param message - the {@link @trycourier/courier-js#InboxMessage} to find in the stack\n   */\n  public toastIndexOfMessage(message: InboxMessage) {\n    const position = this._dataset.findIndex(m => m.messageId === message.messageId);\n\n    // Message not found\n    if (position < 0) {\n      return position;\n    }\n\n    // Return index from end of array (top of stack)\n    return this._dataset.length - position - 1;\n  }\n\n  /**\n   * Add an {@link @trycourier/courier-js#InboxMessage} toast item to the datastore.\n   *\n   * Calling this directly is useful to send test messages while developing with the Courier SDK.</p>\n   *\n   * @example\n   * ```\n   * CourierToastDatastore.shared.addMessage({\n   *  title: 'Lorem ipsum dolor sit',\n   *  body: 'Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet',\n   *  messageId: '1'\n   * });\n   * ```\n   *\n   * @param message - the message to add as a toast item.\n   */\n  public addMessage(message: InboxMessage) {\n    this._dataset.push(message);\n\n    this._datastoreListeners.forEach(listener => {\n      if (listener.events.onMessageAdd) {\n        listener.events.onMessageAdd(message);\n      }\n    });\n  }\n\n  /**\n   * Remove an {@link @trycourier/courier-js#InboxMessage} from the datastore.\n   *\n   * Note: `message` is matched by {@link @trycourier/courier-js#InboxMessage.messageId}, not by object reference\n   */\n  public removeMessage(message: InboxMessage) {\n    const index = this._dataset.findIndex(m => m.messageId === message.messageId);\n    if (index < 0) {\n      return;\n    }\n\n    this._dataset.splice(index, /* deleteCount */ 1);\n\n    this._datastoreListeners.forEach(listener => {\n      if (listener.events.onMessageRemove) {\n        listener.events.onMessageRemove(message);\n      }\n    });\n  }\n\n  /** Access the shared instance with {@link CourierToastDatastore.shared}. */\n  // Prevent instantiation via constructor.\n  private constructor() {}\n}\n","import { CourierToastDatastore } from \"./toast-datastore\";\nimport { CourierToastDatastoreEvents } from \"./toast-datastore-events\";\n\n/**\n * Listener containing callbacks for {@link CourierToastDatastore} events.\n *\n * @public\n */\nexport class CourierToastDatastoreListener {\n  constructor(readonly events: CourierToastDatastoreEvents) {}\n\n  /** Remove this listener. Callbacks will no longer be invoked after remove is called. */\n  remove() {\n    CourierToastDatastore.shared.removeDatastoreListener(this);\n  }\n}\n","import { CourierBaseElement, CourierComponentThemeMode, injectGlobalStyle, registerElement } from \"@trycourier/courier-ui-core\";\nimport { CourierToastThemeManager, CourierToastThemeSubscription } from \"../types/courier-toast-theme-manager\";\nimport { CourierToastTheme, defaultLightTheme } from \"../types/courier-toast-theme\";\nimport { AuthenticationListener, Courier, InboxMessage } from \"@trycourier/courier-js\";\nimport { CourierToastItem } from \"./courier-toast-item\";\nimport { CourierToastItemActionClickEvent, CourierToastItemClickEvent, CourierToastItemFactoryProps } from \"../types/toast\";\nimport { CourierToastDismissButtonOption } from \"../types/toast\";\nimport { CourierToastDatastoreListener } from \"../datastore/toast-datastore-listener\";\nimport { CourierToastDatastore } from \"../datastore/toast-datastore\";\nimport { PausableTimeout } from \"../utils/pausable-timeout\";\nimport { TOAST_DISMISS_ANIMATION_MS } from \"../utils/animation\";\n\n/** Default set of CSS properties used to layout CourierToast. */\ntype CourierToastLayoutProps = {\n  position?: string;\n  width?: string;\n  top?: string;\n  right?: string;\n  zIndex?: number;\n}\n\n/**\n * An embeddable and customizable toast component, fed by data from Courier Inbox.\n *\n * @example\n *\n * Embedding the default toast component on a webpage.\n * ```\n * <html>\n * <body>\n * <courier-toast></courier-toast>\n *\n * <script type=\"module\">\n * import { Courier } from \"@trycourier/courier-ui-toast\";\n *\n * // Authenticate the user\n * Courier.shared.signIn({ userId, jwt });\n * </script>\n * </body>\n * </html>\n * ```\n *\n * @public\n */\nexport class CourierToast extends CourierBaseElement {\n\n  // Internally-maintained state\n  private _themeManager: CourierToastThemeManager;\n  private _themeSubscription: CourierToastThemeSubscription;\n  private _toastStyle?: HTMLStyleElement;\n  private _authListener?: AuthenticationListener;\n  private _datastoreListener: CourierToastDatastoreListener;\n\n  /**\n   * Whether the cursor is currently over the toast stack.\n   *\n   * Hover is tracked here — on the container — rather than per item, because\n   * the stacked items are one hover surface: moving between them (or a new\n   * toast arriving under the cursor) must not resume anyone's countdown.\n   */\n  private _isHovered = false;\n\n  /**\n   * Auto-dismiss countdowns for custom toast items set via\n   * {@link CourierToast.setToastItem}. {@link CourierToastItem}s own their own\n   * countdown, so they're not tracked here.\n   */\n  private _customItemAutoDismissTimeouts = new WeakMap<HTMLElement, PausableTimeout>();\n\n  // Consumer-provided options\n  private _autoDismiss: boolean = false;\n  private _autoDismissTimeoutMs: number = 5000;\n  private _dismissButtonOption: CourierToastDismissButtonOption = 'auto';\n  private _customToastItem?: (props: CourierToastItemFactoryProps) => HTMLElement;\n  private _customToastItemContent?: (props: CourierToastItemFactoryProps) => HTMLElement;\n\n  // Consumer-provided callbacks\n  private _onItemClick?: ((props: CourierToastItemClickEvent) => void);\n  private _onItemActionClick?: ((props: CourierToastItemActionClickEvent) => void);\n\n  /** Default layout props. */\n  private readonly _defaultLayoutProps: CourierToastLayoutProps = {\n    position: 'fixed',\n    width: '380px',\n    top: '30px',\n    right: '30px',\n    zIndex: 999,\n  };\n\n  /**\n   * The names of all attributes for which the web component needs change notifications.\n   *\n   * @see https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements#responding_to_attribute_changes\n   */\n  static observedAttributes = [\n    'auto-dismiss',\n    'auto-dismiss-timeout-ms',\n    'dismiss-button',\n    'light-theme',\n    'dark-theme',\n    'mode',\n  ];\n\n  constructor(props: {\n    themeManager?: CourierToastThemeManager\n  }) {\n    super();\n\n    this._themeManager = props?.themeManager ?? new CourierToastThemeManager(defaultLightTheme);\n    this._themeSubscription = this._themeManager.subscribe((_: CourierToastTheme) => {\n      this.refreshStyles();\n    });\n    this._datastoreListener = new CourierToastDatastoreListener({\n      onMessageAdd: this.datastoreAddMessageListener.bind(this),\n      onMessageRemove: this.datastoreRemoveMessageListener.bind(this),\n    });\n  }\n\n  /** Set the handler invoked when a toast item is clicked. */\n  public onToastItemClick(handler?: (props: CourierToastItemClickEvent) => void): void {\n    this._onItemClick = handler;\n  }\n\n  /** Set the handler invoked when a toast item action button is clicked. */\n  public onToastItemActionClick(handler?: (props: CourierToastItemActionClickEvent) => void): void {\n    this._onItemActionClick = handler;\n  }\n\n  /** Enable auto-dismiss for toast items. */\n  public enableAutoDismiss() {\n    this._autoDismiss = true;\n  }\n\n  /** Disable auto-dismiss for toast items. */\n  public disableAutoDismiss() {\n    this._autoDismiss = false;\n  }\n\n  /**\n   * Set the timeout before auto-dismissing toasts.\n   * Only applicable if auto-dismiss is enabled.\n   * @param timeoutMs - The timeout in milliseconds before a toast is dismissed.\n   */\n  public setAutoDismissTimeoutMs(timeoutMs: number) {\n    this._autoDismissTimeoutMs = timeoutMs;\n  }\n\n  /**\n   * Set the light theme for the toast.\n   * @param theme - The light theme object to set.\n   */\n  public setLightTheme(theme: CourierToastTheme) {\n    this._themeManager.setLightTheme(theme);\n  }\n\n  /**\n   * Set the dark theme for the toast.\n   * @param theme - The dark theme object to set.\n   */\n  public setDarkTheme(theme: CourierToastTheme) {\n    this._themeManager.setDarkTheme(theme);\n  }\n\n  /**\n   * Set the dismiss button display option.\n   *\n   * @param option - a value of {@link CourierToastDismissButtonOption}\n   */\n  public setDismissButton(option: CourierToastDismissButtonOption) {\n    this._dismissButtonOption = option;\n    this.refreshStyles();\n  }\n\n  /**\n   * Set the theme mode.\n   *\n   * @param mode - The theme mode, one of \"dark\", \"light\", or \"system\".\n   */\n  public setMode(mode: CourierComponentThemeMode) {\n    this._themeManager.setMode(mode);\n  }\n\n  /**\n   * Set a factory function that renders a toast item.\n   *\n   * See {@link CourierToast.setToastItemContent} to set the content while preserving the toast item's\n   * container and stack styling.\n   */\n  public setToastItem(factory?: (props: CourierToastItemFactoryProps) => HTMLElement) {\n    this._customToastItem = factory;\n  }\n\n  /**\n   * Set a factory function that renders a toast item's content.\n   *\n   * The toast item's container, including the stack, auto-dismiss timer, and dismiss button\n   * and all events are still present when custom content is set.\n   *\n   * See {@link CourierToast.setDismissButton} to customize the dismiss button's visibility and\n   * {@link CourierToast.setToastItem} to customize the entire toast item, including\n   * its container.\n   */\n  public setToastItemContent(factory?: (props: CourierToastItemFactoryProps) => HTMLElement) {\n    this._customToastItemContent = factory;\n  }\n\n  /**\n   * Dismiss the toast item(s) associated with a particular {@link @trycourier/courier-js#InboxMessage}.\n   *\n   * Toast items are matched to messages by the field {@link @trycourier/courier-js#InboxMessage.messageId}.\n   * If the item is an instance of {@link CourierToastItem} it will be animated out\n   * before removal, otherwise custom items are removed immediately.\n   *\n   * If there are multiple toast items matching the message, all items will be dismissed.\n   *\n   * @example\n   * Using dismissToastForMessage with setToastItem to dismiss a custom element.\n   * ```ts\n   * // Get a reference to the toast component\n   * const toast = document.getElementById(\"my-toast\");\n   *\n   * toast.setToastItem((props) => {\n   *   const el = document.createElement(\"div\");\n   *   el.addEventListener(\"click\", () => toast.dismissToastForMessage(props.message));\n   *   return el;\n   * });\n   * ```\n   *\n   * @param message - the {@link @trycourier/courier-js#InboxMessage} for which toast items should be dismissed\n   */\n  private dismissToastForMessage(message: InboxMessage) {\n    this.childNodes.forEach(node => {\n      const nodeMessageId = (node as HTMLElement).dataset.courierMessageId;\n\n      if (nodeMessageId !== message.messageId) {\n        return;\n      }\n\n      if (node instanceof CourierToastItem) {\n        node.dismiss();\n      } else {\n        this._customItemAutoDismissTimeouts.get(node as HTMLElement)?.cancel();\n        node.remove();\n\n        // Custom items have no dismissed callback to hook, so resync here.\n        // CourierToastItems resync once they've finished animating out — see\n        // the onItemDismissed handler in createDefaultToastItem.\n        this.refreshAutoDismissCountdowns();\n      }\n    });\n  }\n\n  /**\n   * @override\n   */\n  protected onComponentMounted(): void {\n    this._toastStyle = injectGlobalStyle(CourierToast.id, this.getStyles(this.theme));\n\n    // Pause every countdown in the stack while the cursor is over the toast, so\n    // a user reading it is never rushed. mouseenter/mouseleave (not\n    // mouseover/mouseout) fire once for the container's whole subtree, so moving\n    // between toast items and their children doesn't resume the countdown.\n    this.addEventListener('mouseenter', this.onMouseEnter);\n    this.addEventListener('mouseleave', this.onMouseLeave);\n\n    CourierToastDatastore.shared.addDatastoreListener(this._datastoreListener);\n    Courier.shared.addAuthenticationListener(this.authChangedCallback.bind(this));\n    CourierToastDatastore.shared.listenForMessages();\n  }\n\n  /**\n   * @override\n   */\n  protected onComponentUnmounted(): void {\n    this.removeEventListener('mouseenter', this.onMouseEnter);\n    this.removeEventListener('mouseleave', this.onMouseLeave);\n\n    this._datastoreListener.remove();\n    this._authListener?.remove();\n    this._toastStyle?.remove();\n    this._themeManager.cleanup();\n    this._themeSubscription.unsubscribe();\n  }\n\n  private onMouseEnter = (): void => {\n    this._isHovered = true;\n    this.refreshAutoDismissCountdowns();\n  };\n\n  private onMouseLeave = (): void => {\n    this._isHovered = false;\n    this.refreshAutoDismissCountdowns();\n  };\n\n  /**\n   * Bring every item's countdown in line with the current stack: only the top\n   * item counts down, and nothing counts down while the cursor is over the stack.\n   *\n   * Items behind the top one are frozen where they are and pick up the rest of\n   * their countdown once they surface. Only the top toast is legible — the ones\n   * behind it are scaled down with their content transparent — so letting them\n   * all count down at once would expire the whole stack together and the user\n   * would never get to read anything but the newest toast.\n   *\n   * Call this after anything that changes which item is on top: an item arriving,\n   * an item leaving, or hover starting/ending.\n   */\n  private refreshAutoDismissCountdowns(): void {\n    const items = Array.from(this.children) as HTMLElement[];\n    const topItem = items[items.length - 1];\n\n    items.forEach(item => {\n      this.setItemAutoDismissPaused(item, /* paused= */ this._isHovered || item !== topItem);\n    });\n  }\n\n  /** Pause or resume a single item's auto-dismiss countdown. */\n  private setItemAutoDismissPaused(item: HTMLElement, paused: boolean): void {\n    if (item instanceof CourierToastItem) {\n      paused ? item.pauseAutoDismiss() : item.resumeAutoDismiss();\n      return;\n    }\n\n    const customItemTimeout = this._customItemAutoDismissTimeouts.get(item);\n    paused ? customItemTimeout?.pause() : customItemTimeout?.resume();\n  }\n\n  /**\n   * Lifecycle callback invoked when an observed attribute changes.\n   *\n   * @see https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements#responding_to_attribute_changes\n   */\n  protected attributeChangedCallback(name: string, _: string, newValue: string) {\n    switch (name) {\n      case 'auto-dismiss':\n        if (newValue === 'false') {\n          this.disableAutoDismiss();\n        } else {\n          this.enableAutoDismiss();\n        }\n        break;\n      case 'auto-dismiss-timeout-ms':\n        this.setAutoDismissTimeoutMs(parseInt(newValue, /* base= */ 10));\n        break;\n      case 'dismiss-button':\n        if (newValue && CourierToast.isDismissButtonOption(newValue)) {\n          this.setDismissButton(newValue as CourierToastDismissButtonOption);\n        } else {\n          this.setDismissButton('auto');\n        }\n        break;\n      case 'light-theme':\n        if (newValue) {\n          this.setLightTheme(JSON.parse(newValue));\n        }\n        break;\n      case 'dark-theme':\n        if (newValue) {\n          this.setDarkTheme(JSON.parse(newValue));\n        }\n        break;\n      case 'mode':\n        this._themeManager.setMode(newValue as CourierComponentThemeMode);\n        break;\n    }\n  }\n\n  private get theme(): CourierToastTheme {\n    return this._themeManager.getTheme();\n  }\n\n  /** Refresh the styles tag, if it exists, with the current theme. */\n  private refreshStyles() {\n    if (this._toastStyle) {\n      this._toastStyle.textContent = this.getStyles(this.theme);\n    }\n  }\n\n  private authChangedCallback() {\n    this.removeAllItems();\n\n    // If re-auth'ing logged the user out and closed the WebSocket connection,\n    // we'll open a new connection. If one is already open, this is a no-op.\n    CourierToastDatastore.shared.listenForMessages();\n  }\n\n  private removeAllItems(): void {\n    while (this.firstChild) {\n      this._customItemAutoDismissTimeouts.get(this.firstChild as HTMLElement)?.cancel();\n      this.removeChild(this.firstChild);\n    }\n  }\n\n  private addToastItem(message: InboxMessage): CourierToastItem | HTMLElement {\n    // Append the toast item and resize the toast container\n    // so previous toast items can stack underneath at fixed offsets\n    // from the top item.\n    const toastItem = this.createToastItem(message);\n    toastItem.dataset.courierMessageId = message.messageId;\n    this.appendChild(toastItem);\n    this.resizeContainerToHeight(this.topStackItemHeight);\n\n    // This toast is now the top of the stack, which freezes the one it just\n    // covered — and freezes this one too if it landed under the cursor, since\n    // a toast that arrives beneath the cursor hasn't been read yet either.\n    this.refreshAutoDismissCountdowns();\n\n    return toastItem;\n  }\n\n  private createToastItem(message: InboxMessage): CourierToastItem | HTMLElement {\n    if (this._customToastItem) {\n      return this.createCustomToastItem(message);\n    }\n\n    return this.createDefaultToastItem(message);\n  }\n\n  private createDefaultToastItem(message: InboxMessage) {\n    const item = new CourierToastItem({\n      message,\n      autoDismiss: this._autoDismiss,\n      autoDismissTimeoutMs: this._autoDismissTimeoutMs,\n      themeManager: this._themeManager\n    });\n\n    item.onItemDismissed((_) => {\n      this.resizeContainerToHeight(this.topStackItemHeight);\n\n      // Whatever was behind this item is now on top, so its countdown starts.\n      this.refreshAutoDismissCountdowns();\n    });\n\n    if (this._customToastItemContent) {\n      item.setToastItemContent(this._customToastItemContent);\n    }\n\n    if (this._onItemClick) {\n      item.onToastItemClick(this._onItemClick);\n    }\n\n    if (this._onItemActionClick) {\n      item.onToastItemActionClick(this._onItemActionClick);\n    }\n\n    // The auto-dismiss countdown (and its hover-to-pause behavior) is owned by\n    // the CourierToastItem itself, started when it mounts — see\n    // CourierToastItem.onComponentMounted.\n\n    return item;\n  }\n\n  private createCustomToastItem(message: InboxMessage) {\n    if (!this._customToastItem) {\n      throw Error(\"Attempted to create customToastItem, but none is set\");\n    }\n\n    const customItem = this._customToastItem({\n      message,\n      autoDismiss: this._autoDismiss,\n      autoDismissTimeoutMs: this._autoDismissTimeoutMs,\n    });\n\n    if (this._autoDismiss) {\n      // Custom items have no countdown of their own, so the container owns it —\n      // including pausing it while the cursor is over the toast.\n      const autoDismissTimeout = new PausableTimeout(() => {\n        customItem.remove();\n        this.refreshAutoDismissCountdowns();\n      }, this._autoDismissTimeoutMs);\n      this._customItemAutoDismissTimeouts.set(customItem, autoDismissTimeout);\n      autoDismissTimeout.start();\n    }\n\n    customItem.addEventListener('click', () => {\n      if (this._onItemClick) {\n        this._onItemClick({ message });\n      }\n    });\n\n    return customItem;\n  }\n\n  private datastoreAddMessageListener(message: InboxMessage) {\n    this.addToastItem(message);\n  }\n\n  private datastoreRemoveMessageListener(message: InboxMessage) {\n    this.dismissToastForMessage(message);\n  }\n\n  private getStyles(theme: CourierToastTheme): string {\n    const item = theme.item;\n\n    // Styles for the top-level toast container.\n    const toastStyles = `\n      ${CourierToast.id} {\n        position: ${this._defaultLayoutProps.position};\n        z-index: ${this._defaultLayoutProps.zIndex};\n        top: ${this._defaultLayoutProps.top};\n        right: ${this._defaultLayoutProps.right};\n        width: ${this._defaultLayoutProps.width};\n      }\n    `;\n\n    // Stack the three most recently shown toast items and hide all others.\n    // Content is transparent for all but the most recent (top) toast item\n    // since it otherwise peeks out in the visible stack items.\n    const toastStackStyles = `\n      ${CourierToastItem.id}:last-child {\n        top: 0;\n        right: 0;\n      }\n\n      ${CourierToastItem.id}:nth-last-child(2) {\n        top: 12px;\n        bottom: -12px;\n        --scale: 0.95\n      }\n\n      ${CourierToastItem.id}:nth-last-child(3) {\n        top: 24px;\n        bottom: -24px;\n        --scale: 0.9;\n      }\n\n      ${CourierToastItem.id}:nth-last-child(n+4) {\n        top: 24px;\n        bottom: -24px;\n        --scale: 0.9;\n        visibility: hidden;\n      }\n\n      ${CourierToastItem.id}:nth-last-child(n+2) > .overflow-hidden-container {\n        opacity: 0;\n      }\n    `;\n\n    // Styles for the visible toast item.\n    // `opacity` and `transform` are the initial states before\n    // the keyframed `animation` show is applied.\n    // The class `dismissing` is added to trigger the `animation` hide\n    // before removing an item.\n    // Only the top item is clickable.\n    const toastItemStyles = `\n      ${CourierToastItem.id} {\n        position: absolute;\n        box-sizing: border-box;\n        width: 100%;\n        background-color: ${item?.backgroundColor};\n        box-shadow: ${item?.shadow};\n        border: ${item?.border};\n        border-radius: ${item?.borderRadius};\n        transition: 0.2s ease-in-out;\n        cursor: default;\n\n        opacity: 0;\n        transform: translate(0, -10px) scaleX(var(--scale, 1));\n        animation: courier-toast-show 0.3s ease-in-out forwards;\n      }\n\n      ${CourierToastItem.id} > .overflow-hidden-container {\n        height: 100%;\n        width: 100%;\n        border-radius: ${item?.borderRadius};\n        overflow: hidden;\n      }\n\n      ${CourierToastItem.id}.dismissing {\n        animation: courier-toast-hide ${TOAST_DISMISS_ANIMATION_MS}ms ease-out forwards;\n      }\n\n      @keyframes courier-toast-show {\n        0% {\n          opacity: 0;\n        }\n\n        100% {\n          opacity: 1;\n          transform: scaleX(var(--scale, 1));\n        }\n      }\n\n      /* Lift the toast back out the way it came in rather than blinking it out\n         in place, which reads as the toast leaving instead of vanishing. The\n         toast is anchored to the top of the viewport, so \"out\" is up: a full\n         translateY of its own height, eased so most of the travel happens\n         early and the tail is imperceptible. */\n      /* Shrink the toast slightly as it fades so it reads as receding rather\n         than blinking out, but keep it where it sits — moving it competes with\n         the toast underneath sliding up to take its place. The stack's own\n         horizontal scale is preserved so a toast dismissed from behind the top\n         one doesn't jump to full width on its way out. */\n      @keyframes courier-toast-hide {\n        0% {\n          opacity: 1;\n          transform: scale(1) scaleX(var(--scale, 1));\n        }\n\n        100% {\n          opacity: 0;\n          transform: scale(0.92) scaleX(var(--scale, 1));\n        }\n      }\n\n      ${CourierToastItem.id}.clickable:last-child {\n        cursor: pointer;\n      }\n\n      ${CourierToastItem.id}.clickable:last-child:hover {\n        background-color: ${item?.hoverBackgroundColor};\n      }\n\n      ${CourierToastItem.id}.clickable:last-child:active {\n        background-color: ${item?.activeBackgroundColor};\n      }\n\n      ${CourierToastItem.id}.clickable:nth-last-child(n+2) {\n        pointer-events: none;\n      }\n    `;\n\n    // A dismiss icon is visible when the top toast item is in the :hover state.\n    // Auto-dismiss styles are added, but unused if the auto-dismiss progress\n    // bar  is not added in the courier-toast-item element\n    // (i.e. when auto-dismiss is disabled).\n    const dismissStyles = `\n      ${CourierToastItem.id} > .dismiss {\n        position: absolute;\n        visibility: hidden;\n        opacity: 0%;\n        top: -10px;\n        right: -10px;\n        background-color: ${item?.backgroundColor};\n        border: ${item?.border};\n        padding: 3px;\n        border-radius: 50%;\n        font-size: 12pt;\n        box-shadow: ${item?.shadow};\n        cursor: pointer;\n        transition: 0.2s ease-in-out;\n      }\n\n      ${CourierToastItem.id} > .dismiss:hover {\n        background-color: ${item?.hoverBackgroundColor};\n      }\n\n      ${CourierToastItem.id} > .dismiss:active {\n        background-color: ${item?.activeBackgroundColor};\n      }\n\n      ${CourierToastItem.id}:last-child${this.showDismissOnHover ? ':hover' : ''} > .dismiss {\n        visibility: ${this.showDismiss ? 'visible' : 'hidden'};\n        opacity: 100%;\n        transition: 0.2s ease-in-out;\n      }\n    `;\n\n    const autoDismissStyles = `\n      ${CourierToastItem.id} > .overflow-hidden-container > .auto-dismiss {\n        width: 100%;\n        height: 5px;\n        background-color: ${item?.autoDismissBarColor};\n        animation: courier-toast-auto-dismiss ${this._autoDismissTimeoutMs}ms linear forwards;\n      }\n\n      @keyframes courier-toast-auto-dismiss {\n        100% {\n          width: 0px;\n        }\n      }\n    `;\n\n    // Styles for the text and icon content.\n    const contentStyles = `\n      ${CourierToastItem.id} > .overflow-hidden-container > .content {\n        display: flex;\n        gap: 12px;\n        align-items: center;\n        align-self: stretch;\n        box-sizing: border-box;\n        padding: 12px;\n      }\n\n      ${CourierToastItem.id} > .overflow-hidden-container > .content > .text-content {\n      }\n\n      ${CourierToastItem.id} > .overflow-hidden-container > .content > .icon {\n      }\n\n      ${CourierToastItem.id} > .overflow-hidden-container > .content > .text-content > .title {\n        margin: 0;\n        /* Keep room for the dismiss button, which overhangs this corner. */\n        padding-right: 16px;\n        font-weight: ${item?.title?.weight};\n        font-size: ${item?.title?.size};\n        color: ${item?.title?.color};\n      }\n\n      ${CourierToastItem.id} > .overflow-hidden-container > .content > .text-content > .body {\n        margin: 8px 0 0 0;\n        font-weight: ${item?.body?.weight};\n        font-size: ${item?.body?.size};\n        line-height: 150%;\n        color: ${item?.body?.color};\n      }\n    `;\n\n    const actionStyles = `\n      ${CourierToastItem.id} > .overflow-hidden-container > .content > .text-content > .actions-container {\n        display: flex;\n        gap: 8px;\n        margin-top: 12px;\n      }\n    `;\n\n    return [\n      toastStyles,\n      toastStackStyles,\n      toastItemStyles,\n      dismissStyles,\n      autoDismissStyles,\n      contentStyles,\n      actionStyles,\n    ].join('');\n  }\n\n  /** Get the top item's (i.e. the fully visible item's) height. */\n  private get topStackItemHeight(): string {\n    if (this.lastChild) {\n      const height = (this.lastChild as HTMLDivElement).getBoundingClientRect().height;\n      return `${height}px`;\n    }\n\n    return '0px';\n  }\n\n  private resizeContainerToHeight(height: string) {\n    this.style.height = height;\n  }\n\n  /** Whether the dismiss button should only be shown on hover. */\n  private get showDismissOnHover(): boolean {\n    // Auto-dismiss is enabled and button is using 'auto' behavior (show w/o auto-dismiss, show on hover w/ auto-dismiss).\n    if (this._autoDismiss && this._dismissButtonOption === 'auto') {\n      return true;\n    }\n\n    // Explicitly set to show on hover\n    if (this._dismissButtonOption === 'hover') {\n      return true;\n    }\n\n    return false;\n  }\n\n  /** Whether to show the dismiss button. The button is visible (either always or on hover) if not explicitly disabled. */\n  private get showDismiss(): boolean {\n    return this._dismissButtonOption !== 'hidden';\n  }\n\n  /** @override */\n  static get id() {\n    return 'courier-toast';\n  }\n\n  private static isDismissButtonOption(value: string): value is CourierToastDismissButtonOption {\n    const validOptions: CourierToastDismissButtonOption[] = ['visible', 'hidden', 'hover', 'auto'];\n    return validOptions.includes(value as CourierToastDismissButtonOption);\n  }\n}\n\nregisterElement(CourierToast);\n","import { InboxMessage } from \"@trycourier/courier-js\";\n\n/**\n * The set of {@link CourierToastDatastore} events for which listeners can be added.\n *\n * @public\n */\nexport class CourierToastDatastoreEvents {\n  public onMessageAdd?(_: InboxMessage): void { }\n  public onMessageRemove?(_: InboxMessage): void { }\n  public onError?(_: Error): void { }\n}\n","export * from './components/courier-toast';\r\nexport * from './components/courier-toast-item';\r\nexport * from './types/courier-toast-theme';\r\nexport * from './types/courier-toast-theme-manager';\r\nexport * from './types/toast';\r\nexport * from './datastore/toast-datastore';\r\nexport * from './datastore/toast-datastore-listener';\r\nexport * from './datastore/toast-datastore-events';\r\n\r\nimport { Courier } from \"@trycourier/courier-js\";\r\n\r\nCourier.shared.courierUserAgentName = \"courier-ui-toast\";\r\nCourier.shared.courierUserAgentVersion = __PACKAGE_VERSION__;\r\n\r\n// Re-export Courier from courier-js for direct import\r\nexport { Courier };\r\n\r\n// Re-export types from courier-js\r\nexport type {\n  CourierProps,\n  CourierClientOptions,\n  CourierBrand,\n  CourierApiRegion,\n  CourierApiUrls,\n  CourierUserPreferences,\r\n  CourierUserPreferencesStatus,\r\n  CourierUserPreferencesChannel,\r\n  CourierUserPreferencesPaging,\r\n  CourierUserPreferencesTopic,\r\n  CourierUserPreferencesTopicResponse,\r\n  CourierDevice,\r\n  CourierToken,\r\n  CourierGetInboxMessageResponse,\r\n  CourierGetInboxMessagesResponse,\r\n  InboxMessage,\r\n  InboxAction,\r\n  InboxMessageEventEnvelope,\n} from '@trycourier/courier-js';\n\nexport {\n  DEFAULT_COURIER_API_URLS,\n  EU_COURIER_API_URLS,\n  getCourierApiUrls,\n  getCourierApiUrlsForRegion\n} from '@trycourier/courier-js';\n\r\n// Re-export types from courier-ui-core\r\nexport type {\r\n  CourierComponentThemeMode\r\n} from '@trycourier/courier-ui-core'\r\n"],"names":["_b","_a"],"mappings":";;;;;;AA+CO,MAAM,oBAAuC;AAAA,EAClD,MAAM;AAAA,IACJ,iBAAiB,cAAc,MAAM,GAAG;AAAA,IACxC,sBAAsB,cAAc,KAAK,GAAG;AAAA,IAC5C,uBAAuB,cAAc,KAAK,GAAG;AAAA,IAC7C,QAAQ,oBAAoB,cAAc,MAAM,KAAM,CAAC;AAAA,IACvD,QAAQ,aAAa,cAAc,KAAK,GAAG,CAAC;AAAA,IAC5C,cAAc;AAAA,IACd,OAAO;AAAA,MACL,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,OAAO,cAAc,MAAM,GAAG;AAAA,IAAA;AAAA,IAEhC,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,OAAO,cAAc,KAAK,GAAG;AAAA,IAAA;AAAA,IAE/B,MAAM;AAAA,MACJ,OAAO,cAAc,MAAM,GAAG;AAAA,MAC9B,KAAK,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