import {
  __decorateClass
} from "../../chunks/chunk.QU3DSPNU.js";
import { localized, msg } from "@lit/localize";
import { property } from "lit/decorators.js";
import { classMap } from "lit/directives/class-map.js";
import { GdsElement } from "../../gds-element.js";
import { tokens } from "../../tokens.style.js";
import {
  gdsCustomElement,
  html
} from "../../utils/helpers/custom-element-scoping.js";
import {
  withLayoutChildProps,
  withMarginProps,
  withSizeXProps
} from "../../utils/mixins/declarative-layout-mixins.js";
import { IconChevronLeft } from "../icon/icons/chevron-left.component.js";
import BreadcrumbsStyles from "./breadcrumbs.styles.js";
let GdsBreadcrumbs = class extends withLayoutChildProps(
  withSizeXProps(withMarginProps(GdsElement))
) {
  constructor() {
    super(...arguments);
    this.size = "large";
    this.label = msg("Breadcrumbs");
  }
  get breadcrumbItems() {
    return Array.from(
      this.querySelectorAll("[gds-element=gds-breadcrumb]")
    );
  }
  handleSlotChange() {
    const items = this.breadcrumbItems;
    items.forEach((item, index) => {
      if (index === items.length - 2) {
        item.setAttribute("return", "");
      } else {
        item.removeAttribute("return");
      }
    });
  }
  render() {
    return html`
      <nav
        role="navigation"
        aria-label=${this.label}
        class=${classMap({ "size-small": this.size === "small" })}
      >
        <div class="mobile-return">
          <gds-icon-chevron-left></gds-icon-chevron-left>
        </div>
        <div role="list" class="list">
          <slot @slotchange=${this.handleSlotChange}></slot>
        </div>
      </nav>
    `;
  }
};
GdsBreadcrumbs.styles = [tokens, BreadcrumbsStyles];
__decorateClass([
  property({ type: String })
], GdsBreadcrumbs.prototype, "size", 2);
__decorateClass([
  property({ type: String })
], GdsBreadcrumbs.prototype, "label", 2);
GdsBreadcrumbs = __decorateClass([
  gdsCustomElement("gds-breadcrumbs", {
    dependsOn: [IconChevronLeft]
  }),
  localized()
], GdsBreadcrumbs);
export {
  GdsBreadcrumbs
};
