import { unsafeCSS, LitElement, html, nothing } from "lit";
import { property } from "lit/decorators.js";
import compentStyle from "./topbar-message-item.css.js";
import { classMap } from "lit/directives/class-map.js";
import { customElement } from "../../decorator.js";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __decorateClass = (decorators, target, key, kind) => {
  var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
    if (decorator = decorators[i])
      result = (kind ? decorator(target, key, result) : decorator(result)) || result;
  if (kind && result) __defProp(target, key, result);
  return result;
};
var ObcTopbarMessageItemType = /* @__PURE__ */ ((ObcTopbarMessageItemType2) => {
  ObcTopbarMessageItemType2["Simple"] = "simple";
  ObcTopbarMessageItemType2["WithButton"] = "with-button";
  ObcTopbarMessageItemType2["WithIconButton"] = "with-icon-button";
  ObcTopbarMessageItemType2["Inactive"] = "inactive";
  return ObcTopbarMessageItemType2;
})(ObcTopbarMessageItemType || {});
var ObcTopbarMessageItemSize = /* @__PURE__ */ ((ObcTopbarMessageItemSize2) => {
  ObcTopbarMessageItemSize2["Regular"] = "regular";
  ObcTopbarMessageItemSize2["Tall"] = "tall";
  return ObcTopbarMessageItemSize2;
})(ObcTopbarMessageItemSize || {});
let ObcTopbarMessageItem = class extends LitElement {
  constructor() {
    super(...arguments);
    this.type = "with-button";
    this.size = "regular";
    this.showTitle = true;
    this.showDescription = true;
    this.showTimestamp = true;
    this.hasTimestamp2 = false;
    this.hasSecondaryIcon = false;
  }
  onMessageClick() {
    this.dispatchEvent(new CustomEvent("message-click"));
  }
  onActionClick() {
    this.dispatchEvent(new CustomEvent("action-click"));
  }
  render() {
    const isInactive = this.type === "inactive";
    const isLarge = this.size === "tall";
    return html`
      <div
        class=${classMap({
      wrapper: true,
      empty: isInactive,
      large: isLarge,
      [`type-${this.type}`]: true
    })}
      >
        ${isInactive ? html`<div class="empty-message">
              <slot name="empty">No active messages</slot>
            </div>` : html`
              <button class="message-item-touch" @click=${this.onMessageClick}>
                <div class="message-item">
                  <div class="icon primary">
                    <slot name="primary-icon"></slot>
                  </div>
                  <div class="content-container">
                    ${this.hasSecondaryIcon ? html`<div class="icon secondary">
                          <slot name="secondary-icon"></slot>
                        </div>` : nothing}
                    <div class="message-container ${isLarge ? "large" : ""}">
                      <div class="title-container">
                        ${this.showTitle ? html`<div class="title">
                              <slot name="title"></slot>
                            </div>` : nothing}
                        ${isLarge ? html`
                              <div class="timestamp-container">
                                ${this.showTimestamp ? html`<div class="time">
                                      <slot name="time"></slot>
                                    </div>` : nothing}
                                ${this.hasTimestamp2 ? html`<div class="time">
                                      <slot name="time-secondary"></slot>
                                    </div>` : nothing}
                              </div>
                            ` : nothing}
                      </div>
                      ${this.showDescription ? html`<div class="description">
                            <slot name="description"></slot>
                          </div>` : nothing}
                    </div>
                  </div>
                  ${!isLarge ? html`
                        <div class="timestamp-container">
                          ${this.showTimestamp ? html`<div class="time">
                                <slot name="time"></slot>
                              </div>` : nothing}
                          ${this.hasTimestamp2 ? html`<div class="time secondary">
                                <slot name="time-secondary"></slot>
                              </div>` : nothing}
                        </div>
                      ` : nothing}
                </div>
              </button>
              ${this.type === "with-button" ? html`
                    <button
                      class="action-wrapper action-text-button"
                      @click=${this.onActionClick}
                    >
                      <div class="action">
                        <slot name="action-text"></slot>
                      </div>
                    </button>
                  ` : this.type === "with-icon-button" ? html`
                      <button
                        class="action-wrapper action-icon-button"
                        @click=${this.onActionClick}
                      >
                        <div class="action">
                          <slot name="action-icon"></slot>
                        </div>
                      </button>
                    ` : nothing}
            `}
      </div>
    `;
  }
};
ObcTopbarMessageItem.styles = unsafeCSS(compentStyle);
__decorateClass([
  property({ type: String })
], ObcTopbarMessageItem.prototype, "type", 2);
__decorateClass([
  property({ type: String })
], ObcTopbarMessageItem.prototype, "size", 2);
__decorateClass([
  property({ type: Boolean, attribute: false })
], ObcTopbarMessageItem.prototype, "showTitle", 2);
__decorateClass([
  property({ type: Boolean, attribute: false })
], ObcTopbarMessageItem.prototype, "showDescription", 2);
__decorateClass([
  property({ type: Boolean, attribute: false })
], ObcTopbarMessageItem.prototype, "showTimestamp", 2);
__decorateClass([
  property({ type: Boolean })
], ObcTopbarMessageItem.prototype, "hasTimestamp2", 2);
__decorateClass([
  property({ type: Boolean })
], ObcTopbarMessageItem.prototype, "hasSecondaryIcon", 2);
ObcTopbarMessageItem = __decorateClass([
  customElement("obc-topbar-message-item")
], ObcTopbarMessageItem);
export {
  ObcTopbarMessageItem,
  ObcTopbarMessageItemSize,
  ObcTopbarMessageItemType
};
//# sourceMappingURL=topbar-message-item.js.map
