import { h as e } from "./p-9b9ccd0c.js";

/* STENCIL IMPORTS */
/**
 * @param gxOptions An array of GxOptions's
 * @returns The value of the selected item, or the first item, if no one is selected.
 */ const getSelectedItem = e => {
  const t = e.find((e => e.selected));
  if (t) {
    return t.id;
  } else {
    return e[0].id;
  }
};

const setSelectedItem = (e, t) => e.map((e => Object.assign(Object.assign({}, e), {
  selected: e.id === t
})))
// Dots animation used in ch-chat code-render (or other components)
;

const ANIMATION_DOTS = (t = "regular", a = "primary", i = "dynamic", r = "1s") => {
  const n = t === "regular" ? 1.5 : 4;
  let c, l, s;
  if (a === "nexa") {
    c = "#5ba7ff";
    l = "#00CCFF";
    s = "#CF7AFF";
  } else if (a === "on-surface") {
    c = l = s = "var(--color-text-neutral-strawberry)";
  } else {
    // primary
    c = l = s = "var(--color-primary-600)";
 // mer token
    }
  const animateRadiusSize = (t = "0") => e("animate", {
    attributeName: "r",
    values: `${2 / n};${4 / n};${2 / n}`,
    dur: r,
    begin: t,
    repeatCount: "indefinite"
  });
  return e("svg", {
    width: 36 / n,
    height: 8 / n,
    fill: "transparent"
  }, e("circle", {
    cx: 4 / n,
    cy: 4 / n,
    r: 4 / n,
    opacity: "0",
    fill: c
  }, e("animate", {
    attributeName: "opacity",
    values: "0;1;0",
    dur: r,
    repeatCount: "indefinite"
  }), i === "dynamic" ? animateRadiusSize("0") : null), e("circle", {
    cx: 18 / n,
    cy: 4 / n,
    r: 4 / n,
    opacity: "0",
    fill: l
  }, e("animate", {
    attributeName: "opacity",
    values: "0;1;0",
    dur: r,
    begin: "0.15s",
    repeatCount: "indefinite"
  }), i === "dynamic" ? animateRadiusSize("0.33s") : null), e("circle", {
    cx: 32 / n,
    cy: 4 / n,
    r: 4 / n,
    opacity: "0",
    fill: s
  }, e("animate", {
    attributeName: "opacity",
    values: "0;1;0",
    dur: r,
    begin: "0.30s",
    repeatCount: "indefinite"
  }), i === "dynamic" ? animateRadiusSize("0.66s") : null));
};

export { ANIMATION_DOTS as A, getSelectedItem as g, setSelectedItem as s };
//# sourceMappingURL=p-91e2ebb0.js.map