import { n as o, C as b } from "../chunks/lib-cortex-element.CVMmyPMC.js";
import { c as u } from "../chunks/component.styles.CRO4Odto.js";
import { c as p } from "../chunks/custom-element.L4WJXn1j.js";
import { H as m } from "../chunks/slot.j5oheLJC.js";
import { w as h } from "../chunks/watch.BCJD77bD.js";
import { i as f, x as g } from "../chunks/lit-element.jLBm65_O.js";
import { r as n } from "../chunks/state.CSDxrqLd.js";
import { e as x } from "../chunks/query.BBf1UFkC.js";
import { e as v } from "../chunks/class-map.BiVq-cVR.js";
import _ from "./card.js";
import C from "./line-clamp.js";
import y from "./radio.js";
const k = f`:host{--label-color:var(--cx-input-label-color);--label-text-align:left;--description-color:var(--cx-input-label-color);--description-text-align:left;--toggle-size:var(--cx-toggle-size-large);flex-direction:column;align-items:center;width:100%;display:flex;position:relative}:host(:focus-visible){outline:0}.radio-card{--border-radius:var(--cx-border-radius-large);--box-shadow:none;--padding:var(--cx-spacing-small);--image-border-radius:var(--cx-border-radius-medium);cursor:pointer;width:var(--card-width,100%);height:var(--card-height,100%)}.radio-card--checked:not(.radio-card--grouped)::part(base){height:100%}.radio-card--grouped::part(base){border-top-width:0;border-radius:0;height:100%}.radio-card--grouped.radio-card--horizontal::part(base){border-left-width:0;border-top-width:var(--border-width)}:host(:first-child) .radio-card--grouped::part(base){border-top-left-radius:var(--border-radius);border-top-right-radius:var(--border-radius);border-top-width:var(--border-width);border-bottom-right-radius:0;border-bottom-left-radius:0}:host(:last-child) .radio-card--grouped::part(base){border-bottom-left-radius:var(--border-radius);border-bottom-right-radius:var(--border-radius);border-top-left-radius:0;border-top-right-radius:0}:host(:first-child) .radio-card--grouped.radio-card--horizontal::part(base){border-top-left-radius:var(--border-radius);border-bottom-left-radius:var(--border-radius);border-left-width:var(--border-width);border-top-right-radius:0;border-bottom-right-radius:0}:host(:last-child) .radio-card--grouped.radio-card--horizontal::part(base){border-top-right-radius:var(--border-radius);border-bottom-right-radius:var(--border-radius);border-top-left-radius:0;border-bottom-left-radius:0}.radio-card::part(image){background-color:#0000}.radio-card--compact::part(image){display:none}.radio-card--checked:not(.radio-card--grouped){--border-color:var(--cx-color-primary)}.radio-card--checked::part(base){background-color:var(--cx-color-primary-50)}.radio-card--disabled{opacity:.5;cursor:default}.radio-card__label{justify-content:space-between;align-items:center;gap:var(--cx-spacing-2x-small);text-transform:var(--cx-radio-card-label-text-transform,none);display:flex}.radio-card__description{margin-left:calc(var(--toggle-size) + .5em)}.radio-card__description>cx-line-clamp{color:var(--description-color);line-height:var(--cx-line-height-medium);text-align:var(--description-text-align)}.radio-card__label>cx-line-clamp{color:var(--label-color);text-align:var(--label-text-align);flex:auto}.radio-card--has-suffix .radio-card__label__suffix{width:3rem}.radio-card__label__suffix{justify-content:flex-end;height:fit-content;display:flex}.radio-card__image::slotted(img),.radio-card__image::slotted(svg){border-radius:var(--cx-border-radius-small);width:100%}.radio-card__image::slotted(*){flex-direction:column;display:flex}cx-radio{--toggle-size:var(--toggle-size)}cx-radio::part(base){align-items:center;width:100%}`;
var w = Object.defineProperty, A = Object.getOwnPropertyDescriptor, e = (i, a, s, d) => {
  for (var t = d > 1 ? void 0 : d ? A(a, s) : a, l = i.length - 1, c; l >= 0; l--)
    (c = i[l]) && (t = (d ? c(a, s, t) : c(t)) || t);
  return d && t && w(a, s, t), t;
};
let r = class extends b {
  constructor() {
    super(), this.hasSlotController = new m(this, "suffix"), this.checked = !1, this.hasFocus = !1, this.disabled = !1, this.hideIndicator = !1, this.disabledLineClamp = !1, this.handleBlur = this.handleBlur.bind(this), this.handleClick = this.handleClick.bind(this), this.handleFocus = this.handleFocus.bind(this), this.addEventListener("blur", this.handleBlur), this.addEventListener("click", this.handleClick), this.addEventListener("focus", this.handleFocus);
  }
  connectedCallback() {
    super.connectedCallback(), this.setInitialAttributes();
  }
  handleBlur() {
    this.hasFocus = !1, this.emit("cx-blur");
  }
  handleClick() {
    this.disabled || (this.checked = !0);
  }
  handleFocus() {
    this.hasFocus = !0, this.emit("cx-focus");
  }
  setInitialAttributes() {
    this.setAttribute("role", "radio"), this.setAttribute("tabindex", "-1"), this.setAttribute("aria-disabled", this.disabled ? "true" : "false");
  }
  handleCheckedChange() {
    this.radio.checked = this.checked, this.setAttribute("aria-checked", this.checked ? "true" : "false"), this.setAttribute("tabindex", this.checked ? "0" : "-1"), this.radio.setAttribute("aria-checked", this.checked ? "true" : "false"), this.radio.setAttribute("tabindex", this.checked ? "0" : "-1");
  }
  handleDisabledChange() {
    this.setAttribute("aria-disabled", this.disabled ? "true" : "false"), this.radio.setAttribute("aria-disabled", this.disabled ? "true" : "false");
  }
  render() {
    const i = this.parentElement?.getAttribute("compact") !== null, a = this.parentElement?.getAttribute("horizontal") !== null;
    return g`<cx-card part="base" class=${v({
      "radio-card": !0,
      "radio-card--checked": this.checked,
      "radio-card--compact": !this.querySelector('[slot="image"]'),
      "radio-card--disabled": this.disabled,
      "radio-card--focused": this.hasFocus,
      "radio-card--grouped": i,
      "radio-card--has-suffix": this.hasSlotController.test("suffix"),
      "radio-card--horizontal": a
    })}><slot name="image" slot="image" class="radio-card__image"></slot><cx-radio ?disabled=${this.disabled} ?hide-indicator=${this.hideIndicator}><div class="radio-card__label"><cx-line-clamp lines=${this.disabledLineClamp ? 0 : 1}><slot></slot></cx-line-clamp><slot name="suffix" class="radio-card__label__suffix"></slot></div></cx-radio><div class="radio-card__description"><cx-line-clamp lines=${this.disabledLineClamp ? 0 : 3}><slot name="help-text"></slot></cx-line-clamp></div></cx-card>`;
  }
};
r.styles = [u, k];
r.dependencies = {
  "cx-card": _,
  "cx-line-clamp": C,
  "cx-radio": y
};
e([
  x("cx-radio")
], r.prototype, "radio", 2);
e([
  n()
], r.prototype, "checked", 2);
e([
  n()
], r.prototype, "hasFocus", 2);
e([
  o()
], r.prototype, "value", 2);
e([
  o({ reflect: !0, type: Boolean })
], r.prototype, "disabled", 2);
e([
  o({ attribute: "hide-indicator", reflect: !0, type: Boolean })
], r.prototype, "hideIndicator", 2);
e([
  o({ attribute: "disabled-line-clamp", reflect: !0, type: Boolean })
], r.prototype, "disabledLineClamp", 2);
e([
  h("checked", { waitUntilFirstUpdate: !0 })
], r.prototype, "handleCheckedChange", 1);
e([
  h("disabled", { waitUntilFirstUpdate: !0 })
], r.prototype, "handleDisabledChange", 1);
r = e([
  p("cx-radio-card")
], r);
export {
  r as default
};
