// Boot dispatcher — the only file that decides which of the three modes // this page runs in. Keep the `?embedded=1` branch first: the host shell // iframes this same origin with that param and its behavior must never // be shadowed by app-specific modes. import { ReachyMini } from "@pollen-robotics/reachy-mini-sdk"; (window as unknown as { ReachyMini: typeof ReachyMini }).ReachyMini = ReachyMini; window.dispatchEvent(new Event("reachymini:ready")); const params = new URLSearchParams(window.location.search); const isEmbed = params.get("embedded") === "1" || params.get("embed") === "1"; if (isEmbed) { void import("./embed"); } else if (params.get("practice") === "1") { // Robot-free mode: the on-screen puppet runs the programs. No auth, // no host shell — reachable only by explicit URL. void import("./practice"); } else { // Standalone visit: the host shell owns the page (OAuth, robot picker, // top bar). Dynamically imported so practice/embed never load React/MUI. void import("@pollen-robotics/reachy-mini-sdk/host/auto").then(({ mountHost }) => { mountHost({ appName: "Reachy Blocks", appIconUrl: "/icon.svg", appEmoji: "🧩", enableMicrophone: false, devToken: import.meta.env.VITE_HF_TOKEN && import.meta.env.VITE_HF_USERNAME ? { token: import.meta.env.VITE_HF_TOKEN as string, userName: import.meta.env.VITE_HF_USERNAME as string, } : undefined, clientId: import.meta.env.VITE_HF_OAUTH_CLIENT_ID as string | undefined, }); }); }