import { e as c } from "./custom-element-eaccb8d2.mjs";
import { P as u, l as h, n as p } from "./plus-base-10eea8a6.mjs";
import { n as d } from "./static-5cfd1f40.mjs";
import { s as f } from "./index-975d3293.mjs";
const b = f({
  slots: {
    host: "breadcrumb flex flex-row items-center justify-start font-sans gap-2.5"
  },
  variants: {
    size: {
      sm: {
        host: ""
      },
      md: {
        host: ""
      },
      lg: {
        host: ""
      }
    }
  },
  compoundVariants: [],
  defaultVariants: {
    size: "md",
    active: !1,
    disabled: !1,
    readonly: !1
  }
});
var m = Object.defineProperty, v = Object.getOwnPropertyDescriptor, l = (t, e, a, s) => {
  for (var r = s > 1 ? void 0 : s ? v(e, a) : e, n = t.length - 1, i; n >= 0; n--)
    (i = t[n]) && (r = (s ? i(e, a, r) : i(r)) || r);
  return s && r && m(e, a, r), r;
};
let o = class extends u {
  constructor() {
    super(...arguments), this.size = "md", this.separator = "/";
  }
  handleChanges() {
    const { links: t } = this;
    t.length !== 0 && t.forEach((e, a) => {
      var s;
      if (a === t.length - 1)
        e.setAttribute("active", "true");
      else {
        let r = (s = e == null ? void 0 : e.shadowRoot) == null ? void 0 : s.querySelector('slot[name="separator"]');
        r && r.append(this.separator);
      }
      e.setAttribute("size", this.size), e.setAttribute("isBreadcrumb", "true");
    });
  }
  updated(t) {
    super.updated(t), this.handleChanges();
  }
  handleClickItem({ target: t }) {
    var e;
    if (t instanceof HTMLElement && t.tagName.toLowerCase() === "plus-link") {
      const { id: a } = t;
      (e = this.links) == null || e.forEach((s, r) => {
        s.id === a ? (s.setAttribute("active", "true"), this.emit("plus-click", { detail: { item: s } })) : s.setAttribute("active", "false");
      });
    }
  }
  render() {
    const { size: t } = this, { host: e } = b({ size: t });
    return d`
      <nav class=${e()} aria-label="Breadcrumb">
        <slot @slotchange=${() => this.handleChanges()} @click=${this.handleClickItem}></slot>
      </nav>
    `;
  }
};
l([
  h()
], o.prototype, "links", 2);
l([
  p({ type: String })
], o.prototype, "size", 2);
l([
  p({ type: String })
], o.prototype, "separator", 2);
o = l([
  c("plus-breadcrumb")
], o);
export {
  o as BreadCrumbComponent
};
