import { jsx as e, Fragment as d } from "react/jsx-runtime";
import { sanitizeHTMLToReactNode as y } from "./index-sanitize-html.js";
import { a as f } from "./index-react-spring_web.modern.js";
import "react";
import { useSpring as u } from "./index-react-spring_core.modern.js";
const g = ({
  word: t,
  delay: r,
  duration: o
}) => {
  const a = u({
    from: {
      opacity: 0,
      transform: "translateY(20px)"
    },
    to: {
      opacity: 1,
      transform: "translateY(0)"
    },
    config: {
      duration: o
    },
    delay: r
  });
  return e(f.span, {
    style: {
      marginRight: 4,
      ...a
    },
    children: y(t).children
  });
}, S = (t, r) => {
  if (typeof t != "string" || !r)
    return t;
  const o = t.split(" "), a = r.duration ?? 300, s = r.delay ?? 75, i = r.initialDelay ?? 0;
  return e(d, {
    children: o.map((c, n) => {
      const p = i + o.slice(0, n).reduce((m, h) => m + a, s * n), l = n < o.length - 1;
      return e(g, {
        word: c + (l ? " " : ""),
        delay: p,
        duration: a
      }, n);
    })
  });
};
export {
  S as applyWordAnimation
};
