import { jsx as a } from "react/jsx-runtime";
import i, { useState as g, useRef as y } from "react";
import { Container as x } from "semantic-ui-react";
import { PostProvider as P, PostConsumer as k } from "@devgateway/wp-react-lib";
import { Parallax as R, ParallaxLayer as w } from "@react-spring/parallax";
import C from "../connected-templates/PostContent.js";
import { parse as S } from "../utils/parseUtils.js";
const v = ({ posts: r, locale: n, configuration: o }) => {
  const s = (t) => t.sticky ? {
    sticky: {
      start: t.sticky ? t.stickyStart : t.offset,
      end: t.sticky ? t.stickyEnd : t.offset
    }
  } : {
    offset: t.offset,
    speed: t.speed
  };
  return /* @__PURE__ */ a(i.Fragment, { children: r && r.map((t, e) => /* @__PURE__ */ a(i.Fragment, { children: o && o[e] && /* @__PURE__ */ a(
    w,
    {
      ...s(o[e]),
      children: /* @__PURE__ */ a(C, { as: x, fluid: !0, post: t })
    },
    "parallax_" + e
  ) })) });
}, A = (r) => {
  const [n, o] = g(Math.random() * 99998 + 1), {
    "data-width": s,
    "data-height": t,
    "data-type": e,
    "data-taxonomy": l,
    "data-categories": d,
    "data-count": z,
    "data-horizontal": F = !1,
    "data-scrolls": m,
    "data-configuration": p,
    parent: c,
    editing: L,
    component: _,
    unique: h
  } = r, f = S(p), u = y(null);
  return /* @__PURE__ */ a("div", { style: { width: "100%", height: t + "px" }, className: "parallax-container", children: /* @__PURE__ */ a(R, { ref: u, pages: m, children: /* @__PURE__ */ a(
    P,
    {
      type: e,
      taxonomy: l,
      categories: d,
      store: "parallax" + c + "_" + h,
      page: 1,
      perPage: 50,
      children: /* @__PURE__ */ a(k, { children: /* @__PURE__ */ a(v, { configuration: f }) })
    }
  ) }) });
};
export {
  A as default
};
