import { n, C as c } from "../chunks/lib-cortex-element.CVMmyPMC.js";
import { c as m } from "../chunks/component.styles.CRO4Odto.js";
import { c as f } from "../chunks/custom-element.L4WJXn1j.js";
import { w as u } from "../chunks/watch.BCJD77bD.js";
import { i as h, x as d } from "../chunks/lit-element.jLBm65_O.js";
import { e as x } from "../chunks/query.BBf1UFkC.js";
import { e as v } from "../chunks/class-map.BiVq-cVR.js";
import { o as w } from "../chunks/style-map.llVFPd__.js";
import g from "./step.js";
const y = h`.stepper{row-gap:var(--cx-spacing-2x-small);flex-wrap:wrap;max-width:100%;display:flex}.stepper--vertical{flex-direction:column}`;
var S = Object.defineProperty, b = Object.getOwnPropertyDescriptor, i = (s, t, o, p) => {
  for (var r = p > 1 ? void 0 : p ? b(t, o) : t, a = s.length - 1, l; a >= 0; a--)
    (l = s[a]) && (r = (p ? l(t, o, r) : l(r)) || r);
  return p && r && S(t, o, r), r;
};
let e = class extends c {
  constructor() {
    super(...arguments), this.direction = "horizontal", this.itemsPerRow = 5;
  }
  handleSlotChange() {
    const s = this.stepSlot.assignedElements();
    s.forEach((t, o) => {
      t.setAttribute("index", o.toString()), this.direction === "vertical" ? t.setAttribute("round", "") : t.removeAttribute("round"), o === s.length - 1 && t.setAttribute("last", "");
    });
  }
  render() {
    return d`<div class=${v({
      stepper: !0,
      "stepper--vertical": this.direction === "vertical"
    })} style=${w({
      "--columns": Math.max(this.itemsPerRow, 1).toString()
    })}><slot name="step" @slotchange=${this.handleSlotChange}></slot></div>`;
  }
};
e.styles = [m, y];
e.dependencies = {
  "cx-step": g
};
i([
  x('slot[name="step"]')
], e.prototype, "stepSlot", 2);
i([
  n({ reflect: !0, type: String })
], e.prototype, "direction", 2);
i([
  n({ attribute: "items-per-row", reflect: !0, type: Number })
], e.prototype, "itemsPerRow", 2);
i([
  u("direction", { waitUntilFirstUpdate: !0 })
], e.prototype, "handleSlotChange", 1);
e = i([
  f("cx-stepper")
], e);
export {
  e as default
};
