import { h } from './index-b153bfd0.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 = (gxOptions) => {
    const found = gxOptions.find(item => item.selected);
    if (found) {
        return found.id;
    }
    else {
        return gxOptions[0].id;
    }
};
const setSelectedItem = (gxOptions, selectedItemId) => gxOptions.map(item => (Object.assign(Object.assign({}, item), { selected: item.id === selectedItemId })));
// Dots animation used in ch-chat code-render (or other components)
const ANIMATION_DOTS = (size = "regular", color = "primary", sizeType = "dynamic", duration = "1s") => {
    const n = size === "regular" ? 1.5 : 4;
    let colorDot1, colorDot2, colorDot3;
    if (color === "nexa") {
        colorDot1 = "#5ba7ff";
        colorDot2 = "#00CCFF";
        colorDot3 = "#CF7AFF";
    }
    else if (color === "on-surface") {
        colorDot1 = colorDot2 = colorDot3 = "var(--color-text-neutral-strawberry)";
    }
    else {
        // primary
        colorDot1 = colorDot2 = colorDot3 = "var(--color-primary-600)"; // mer token
    }
    const animateRadiusSize = (begin = "0") => {
        return (h("animate", { attributeName: "r", values: `${2 / n};${4 / n};${2 / n}`, dur: duration, begin: begin, repeatCount: "indefinite" }));
    };
    return (h("svg", { width: 36 / n, height: 8 / n, fill: "transparent" },
        h("circle", { cx: 4 / n, cy: 4 / n, r: 4 / n, opacity: "0", fill: colorDot1 },
            h("animate", { attributeName: "opacity", values: "0;1;0", dur: duration, repeatCount: "indefinite" }),
            sizeType === "dynamic" ? animateRadiusSize("0") : null),
        h("circle", { cx: 18 / n, cy: 4 / n, r: 4 / n, opacity: "0", fill: colorDot2 },
            h("animate", { attributeName: "opacity", values: "0;1;0", dur: duration, begin: "0.15s", repeatCount: "indefinite" }),
            sizeType === "dynamic" ? animateRadiusSize("0.33s") : null),
        h("circle", { cx: 32 / n, cy: 4 / n, r: 4 / n, opacity: "0", fill: colorDot3 },
            h("animate", { attributeName: "opacity", values: "0;1;0", dur: duration, begin: "0.30s", repeatCount: "indefinite" }),
            sizeType === "dynamic" ? animateRadiusSize("0.66s") : null)));
};

export { ANIMATION_DOTS as A, getSelectedItem as g, setSelectedItem as s };

//# sourceMappingURL=common-ceaf354a.js.map