UNPKG

@hoosei/voxweave-react

Version:

A customizable and interactive voice UI component for React applications

97 lines (96 loc) 2.68 kB
import { useState as a, useEffect as k, Suspense as x } from "react"; import { ErrorBoundary as b } from "./index12.js"; import { isAuroraAnimation as A } from "./index58.js"; import { jsxs as t, Fragment as y, jsx as r } from "react/jsx-runtime"; const w = ({ error: e }) => /* @__PURE__ */ t("div", { children: [/* @__PURE__ */ r("h2", { children: "Something went wrong:" }), /* @__PURE__ */ r("pre", { children: e.message })] }), j = ({ size: e, isListening: n, audioData: c, listeningColors: h, notListeningColors: m, agentStatus: u, agentAudioData: f, animation: o, containerPosition: l, isVertical: v }) => { const [p, E] = a(null); if (k(() => { const d = (s) => { console.error("Unhandled error:", s.error), E("An unexpected error occurred"); }; return window.addEventListener("error", d), () => { window.removeEventListener("error", d); }; }, []), p) return /* @__PURE__ */ t("div", { children: ["Error: ", p] }); if (typeof o != "string" && o !== void 0) { const d = o; return A(o) ? /* @__PURE__ */ t(y, { children: [/* @__PURE__ */ r("div", { style: { height: l === "bottom" ? e / 1.8 : e }, className: "vox:rounded-xl" }), /* @__PURE__ */ r("div", { className: "vox:w-full vox:h-full vox:absolute vox:bottom-0 vox:left-0", children: /* @__PURE__ */ r(b, { FallbackComponent: w, children: /* @__PURE__ */ r(x, { fallback: null, children: /* @__PURE__ */ r(d, { size: e, isListening: n, audioData: c, agentStatus: u, agentAudioData: f, listeningColors: h, notListeningColors: m, containerPosition: l, isVertical: v, animation: o }) }) }) })] }) : /* @__PURE__ */ r("div", { style: { width: l === "bottom" ? e / 1.6 : e, height: l === "bottom" ? e / 1.8 : e }, children: /* @__PURE__ */ r(b, { FallbackComponent: w, children: /* @__PURE__ */ r(x, { fallback: null, children: /* @__PURE__ */ r(d, { size: e, isListening: n, audioData: c, agentStatus: u, agentAudioData: f, listeningColors: h, notListeningColors: m, containerPosition: l, isVertical: v, animation: o }) }) }) }); } }; export { j as VoxweaveThreeJS, j as default }; //# sourceMappingURL=index57.js.map