import { ap as attr_class, an as stringify, as as attr, au as escape_html, av as spread_props, at as bind_props, a6 as derived } from './index2-BLq4EEng.js';
import { B as Button, h as html } from './Button-DmE4ENkb.js';
import { c as closeSvg } from './close-DR469d4F.js';

/* empty css                                          */
function Banner($$renderer, $$props) {
  $$renderer.component(($$renderer2) => {
    let {
      text,
      icon,
      linkText,
      dismissible = false,
      visible = true,
      testId,
      rightContent,
      dismissIcon,
      onclick,
      ondismiss,
      classes
    } = $$props;
    let interactive = derived(() => typeof onclick === "function");
    function handleDismiss(event) {
      event.stopPropagation();
      visible = false;
      ondismiss?.();
    }
    if (visible) {
      $$renderer2.push("<!--[0-->");
      $$renderer2.push(`<div${attr_class(`banner ${stringify(classes ?? "")}`, "svelte-qtsowi")}${attr("role", interactive() ? "button" : null)}${attr("tabindex", interactive() ? 0 : null)}${attr("data-pw", typeof testId === "string" ? testId : null)}>`);
      if (typeof icon === "function") {
        $$renderer2.push("<!--[0-->");
        $$renderer2.push(`<div class="banner-icon svelte-qtsowi">`);
        icon($$renderer2);
        $$renderer2.push(`<!----></div>`);
      } else {
        $$renderer2.push("<!--[-1-->");
      }
      $$renderer2.push(`<!--]--> <div class="banner-text svelte-qtsowi">${escape_html(text)} `);
      if (typeof linkText === "string" && linkText.length > 0) {
        $$renderer2.push("<!--[0-->");
        $$renderer2.push(`<span class="banner-link-text svelte-qtsowi">${escape_html(linkText)}</span>`);
      } else {
        $$renderer2.push("<!--[-1-->");
      }
      $$renderer2.push(`<!--]--></div> `);
      if (typeof rightContent === "function") {
        $$renderer2.push("<!--[0-->");
        $$renderer2.push(`<div class="banner-right svelte-qtsowi">`);
        rightContent($$renderer2);
        $$renderer2.push(`<!----></div>`);
      } else {
        $$renderer2.push("<!--[-1-->");
      }
      $$renderer2.push(`<!--]--> `);
      if (dismissible) {
        $$renderer2.push("<!--[0-->");
        $$renderer2.push(`<div class="banner-dismiss svelte-qtsowi">`);
        Button($$renderer2, spread_props([
          { 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>`);
    } else {
      $$renderer2.push("<!--[-1-->");
    }
    $$renderer2.push(`<!--]-->`);
    bind_props($$props, { visible });
  });
}

export { Banner as B };
//# sourceMappingURL=Banner-8zU7JxF6.js.map
