import { ap as attr_class, as as attr, au as escape_html, av as spread_props, a6 as derived, an as stringify } from './index-CoYB03g7.js';
import { B as Button, h as html } from './Button-D0hZ7JYt.js';
import { c as closeSvg } from './close-DR469d4F.js';

/* empty css                                          */
function Pill($$renderer, $$props) {
  $$renderer.component(($$renderer2) => {
    let {
      text,
      dismissible = false,
      disabled = false,
      testId,
      dismissIcon,
      onclick,
      ondismiss,
      classes
    } = $$props;
    let interactive = derived(() => typeof onclick === "function");
    function handleDismiss(event) {
      event.stopPropagation();
      if (disabled) {
        return;
      }
      ondismiss?.();
    }
    $$renderer2.push(`<div${attr_class(`pill ${stringify(classes ?? "")}`, "svelte-71w3as", { "disabled": disabled })}${attr("role", interactive() ? "button" : null)}${attr("tabindex", interactive() ? 0 : null)}${attr("aria-disabled", interactive() && disabled ? true : null)}${attr("data-pw", typeof testId === "string" ? testId : null)}><span class="pill-text svelte-71w3as">${escape_html(text)}</span> `);
    if (dismissible) {
      $$renderer2.push("<!--[0-->");
      $$renderer2.push(`<div class="pill-dismiss svelte-71w3as">`);
      Button($$renderer2, spread_props([
        { disabled, onclick: handleDismiss, ariaLabel: "Dismiss" },
        typeof testId === "string" ? { testId: `${testId}-dismiss` } : {},
        {
          children: ($$renderer3) => {
            if (typeof dismissIcon === "function") {
              $$renderer3.push("<!--[0-->");
              dismissIcon($$renderer3);
              $$renderer3.push(`<!---->`);
            } else {
              $$renderer3.push("<!--[-1-->");
              $$renderer3.push(`${html(closeSvg)}`);
            }
            $$renderer3.push(`<!--]-->`);
          },
          $$slots: { default: true }
        }
      ]));
      $$renderer2.push(`<!----></div>`);
    } else {
      $$renderer2.push("<!--[-1-->");
    }
    $$renderer2.push(`<!--]--></div>`);
  });
}

export { Pill as P };
//# sourceMappingURL=Pill-4xJ-VhAA.js.map
