import { jsx as r, jsxs as d } from "react/jsx-runtime";
import { useState as m, useEffect as l } from "react";
import { injectMocks as u } from "../mocks.js";
import { ImagePickerProvider as f } from "../providers/ImagePickerProvider.js";
u();
function S({ children: a }) {
  const [i, t] = m(!1);
  return l(() => {
    const n = () => window.minisSDK ? (t(!0), !0) : !1;
    if (n())
      return;
    const e = (o) => {
      const { type: c } = JSON.parse(o.data);
      c === "MINIS_SDK_READY" && t(!0);
    };
    window.addEventListener("message", e), document.addEventListener("message", e);
    const s = setInterval(() => {
      n() && clearInterval(s);
    }, 100);
    return () => {
      clearInterval(s), window.removeEventListener("message", e), document.removeEventListener("message", e);
    };
  }, []), i ? /* @__PURE__ */ r(f, { children: a }) : /* @__PURE__ */ r("div", { className: "h-screen bg-gray-50 flex items-center justify-center", children: /* @__PURE__ */ d("div", { className: "text-center", children: [
    /* @__PURE__ */ r("div", { className: "animate-spin rounded-full h-8 w-8 border-b-2 border-gray-900 mx-auto mb-4" }),
    /* @__PURE__ */ r("p", { className: "text-gray-600", children: "Loading..." })
  ] }) });
}
export {
  S as MinisContainer
};
//# sourceMappingURL=MinisContainer.js.map
