import { jsx as O } from "react/jsx-runtime";
import B from "react";
import { o as A } from "./create-component-CVXl33PD.mjs";
import { _ as c, n, x as s, c as u, E as H, r as R, a as _, b as M } from "./class-map-CwiboTfb.mjs";
import "./ripple-pQcEjR05.mjs";
import { a as q } from "./animation-DjClVFum.mjs";
import { m as D } from "./delegate-BXi1gVeU.mjs";
import { i as L, d as V } from "./form-label-activation-ed0HgVsy.mjs";
import { r as F } from "./redispatch-event-taWUbWUt.mjs";
import { m as G, c as P, g as j } from "./validator-DZt1_yHv.mjs";
import { m as N } from "./element-internals-3IY9gE4L.mjs";
import { m as Z, g as K, a as U } from "./form-associated-CyYeHPMb.mjs";
import { C as W } from "./checkbox-validator-Cy4iemH_.mjs";
/**
 * @license
 * Copyright 2023 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */
const f = Symbol("dispatchHooks");
function Y(t, e) {
  const r = t[f];
  if (!r)
    throw new Error(`'${t.type}' event needs setupDispatchHooks().`);
  r.addEventListener("after", e);
}
const v = /* @__PURE__ */ new WeakMap();
function J(t, ...e) {
  let r = v.get(t);
  r || (r = /* @__PURE__ */ new Set(), v.set(t, r));
  for (const i of e) {
    if (r.has(i))
      continue;
    let d = !1;
    t.addEventListener(i, (a) => {
      if (d)
        return;
      a.stopImmediatePropagation();
      const l = Reflect.construct(a.constructor, [
        a.type,
        a
      ]), h = new EventTarget();
      l[f] = h, d = !0;
      const p = t.dispatchEvent(l);
      d = !1, p || a.preventDefault(), h.dispatchEvent(new Event("after"));
    }, {
      // Ensure this listener runs before other listeners.
      // `setupDispatchHooks()` should be called in constructors to also
      // ensure they run before any other externally-added capture listeners.
      capture: !0
    }), r.add(i);
  }
}
/**
 * @license
 * Copyright 2021 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */
const Q = D(G(Z(N(R))));
let o = class extends Q {
  constructor() {
    super(), this.selected = !1, this.icons = !1, this.showOnlySelectedIcon = !1, this.required = !1, this.value = "on", this.addEventListener("click", (e) => {
      !L(e) || !this.input || (this.focus(), V(this.input));
    }), J(this, "keydown"), this.addEventListener("keydown", (e) => {
      Y(e, () => {
        e.defaultPrevented || e.key !== "Enter" || this.disabled || !this.input || this.input.click();
      });
    });
  }
  render() {
    return s`
      
         ${this.renderHandle()}  
      
    `;
  }
  getRenderClasses() {
    return {
      selected: this.selected,
      unselected: !this.selected,
      disabled: this.disabled
    };
  }
  renderHandle() {
    const e = {
      "with-icon": this.showOnlySelectedIcon ? this.selected : this.icons
    };
    return s`
      ${this.renderTouchTarget()}
      
        
          ${this.shouldShowIcons() ? this.renderIcons() : s``}
         
       
    `;
  }
  renderIcons() {
    return s`
      
        ${this.renderOnIcon()}
        ${this.showOnlySelectedIcon ? s`` : this.renderOffIcon()}
      
    `;
  }
  /**
   * https://fonts.google.com/icons?selected=Material%20Symbols%20Outlined%3Acheck%3AFILL%400%3Bwght%40500%3BGRAD%400%3Bopsz%4024
   */
  renderOnIcon() {
    return s`
      
        
           
       
    `;
  }
  /**
   * https://fonts.google.com/icons?selected=Material%20Symbols%20Outlined%3Aclose%3AFILL%400%3Bwght%40500%3BGRAD%400%3Bopsz%4024
   */
  renderOffIcon() {
    return s`
      
        
           
       
    `;
  }
  renderTouchTarget() {
    return s`