UNPKG

@motion-core/motion-gpu

Version:

Framework-agnostic WebGPU runtime for fullscreen WGSL shaders with explicit Svelte, React, and Vue adapter entrypoints.

774 lines (715 loc) 25.8 kB
import { createMotionGPUErrorOverlayModel } from "../core/error-overlay-model.js"; import { Portal } from "./Portal.js"; import { useEffect, useId, useRef, useState } from "react"; import { jsx, jsxs } from "react/jsx-runtime"; //#region src/lib/react/MotionGPUErrorOverlay.tsx var FOCUSABLE_SELECTOR = "a[href], button:not([disabled]), summary, input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])"; function ChevronDownIcon() { return /* @__PURE__ */ jsx("svg", { className: "motiongpu-error-details-chevron", viewBox: "0 0 18 18", fill: "none", "aria-hidden": "true", focusable: "false", children: /* @__PURE__ */ jsx("polyline", { points: "15.25 6.5 9 12.75 2.75 6.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) }); } var MOTIONGPU_ERROR_OVERLAY_STYLES = ` .motiongpu-error-overlay { --motiongpu-base-hue: var(--base-hue, 265); --motiongpu-surface-gap: 0.375rem; --motiongpu-color-background-inset: oklch(0.1913 0.0039 var(--motiongpu-base-hue)); --motiongpu-color-background: oklch(0.235 0.0056 var(--motiongpu-base-hue)); --motiongpu-color-background-muted: oklch(0.265 0.0073 var(--motiongpu-base-hue)); --motiongpu-color-foreground: oklch(0.9674 0.0013 var(--motiongpu-base-hue)); --motiongpu-color-foreground-muted: oklch(0.669 0.0107 var(--motiongpu-base-hue)); --motiongpu-color-accent: oklch(0.6996 0.181959 44.4414); --motiongpu-color-accent-secondary: oklch(0.5096 0.131959 44.4414); --motiongpu-color-warning: oklch(0.708 0.18 19.571); --motiongpu-color-white-fixed: oklch(1 0 0); --motiongpu-shadow-color: oklch(0 0.0013 var(--motiongpu-base-hue)); --motiongpu-shadow-highlight-color: oklch(1 0.013 var(--motiongpu-base-hue)); --motiongpu-guide-ink: oklch(from var(--motiongpu-shadow-highlight-color) l c h / 0.08); --motiongpu-guide-duotone-ink: var(--motiongpu-shadow-color); --motiongpu-guide-duotone-glint: oklch( from var(--motiongpu-shadow-highlight-color) l c h / 0.08 ); --motiongpu-radius-base: var(--radius-base, 0.275rem); --motiongpu-radius-xs: var(--radius-xs, calc(var(--motiongpu-radius-base) * 1)); --motiongpu-radius-sm: var(--radius-sm, calc(var(--motiongpu-radius-base) * 2)); --motiongpu-radius-md: var(--radius-md, calc(var(--motiongpu-radius-base) * 3)); --motiongpu-radius-lg: var(--radius-lg, calc(var(--motiongpu-radius-base) * 4)); --motiongpu-radius-xl: var(--radius-xl, calc(var(--motiongpu-radius-base) * 6)); --motiongpu-radius-dialog-inner: calc( var(--motiongpu-radius-xl) - var(--motiongpu-surface-gap) ); --motiongpu-radius-surface-inner: calc( var(--motiongpu-radius-lg) - var(--motiongpu-surface-gap) ); --motiongpu-shadow-inset: 0px 1px 3px 0px oklch(from var(--motiongpu-shadow-color) l c h / 0.051) inset, 0px 5px 5px -1px oklch(from var(--motiongpu-shadow-color) l c h / 0.051) inset, 0px 11px 6px -2px oklch(from var(--motiongpu-shadow-color) l c h / 0.031) inset, 0px 19px 8px -3px oklch(from var(--motiongpu-shadow-color) l c h / 0.012) inset, 0px 0px 0px 1px oklch(from var(--motiongpu-shadow-highlight-color) l c h / 0.051) inset, 0px -1px 0px 0px oklch(from var(--motiongpu-shadow-highlight-color) l c h / 0.122) inset, 0px 0px 0px 1px oklch(from var(--motiongpu-shadow-color) l c h / 0.071) inset, 0px 1px 0px 0px oklch(from var(--motiongpu-shadow-color) l c h / 0.039) inset; --motiongpu-shadow-highlight-inset: 0px 1px 3px 0px oklch(from var(--motiongpu-shadow-color) l c h / 0.051) inset, 0px 5px 5px -1px oklch(from var(--motiongpu-shadow-color) l c h / 0.051) inset, 0px 11px 6px -2px oklch(from var(--motiongpu-shadow-color) l c h / 0.031) inset, 0px 19px 8px -3px oklch(from var(--motiongpu-shadow-color) l c h / 0.012) inset, 0px 0px 0px 1px oklch(from var(--motiongpu-shadow-highlight-color) l c h / 0.051) inset, 0px 0px 0px 1px oklch(from var(--motiongpu-shadow-color) l c h / 0.071) inset, 0px 1px 0px 0px oklch(from var(--motiongpu-shadow-color) l c h / 0.039) inset; --motiongpu-shadow-md: 0px 1px 3px 0px oklch(from var(--motiongpu-shadow-color) l c h / 0.051), 0px 5px 5px -1px oklch(from var(--motiongpu-shadow-color) l c h / 0.051), 0px 11px 6px -2px oklch(from var(--motiongpu-shadow-color) l c h / 0.031), 0px 19px 8px -3px oklch(from var(--motiongpu-shadow-color) l c h / 0.012), 0px 0px 0px 1px oklch(from var(--motiongpu-shadow-highlight-color) l c h / 0.051) inset, 0px 1px 0px 0px oklch(from var(--motiongpu-shadow-highlight-color) l c h / 0.122) inset, 0px 0px 0px 1px oklch(from var(--motiongpu-shadow-color) l c h / 0.071), 0px 1px 0px 0px oklch(from var(--motiongpu-shadow-color) l c h / 0.039); --motiongpu-shadow-2xl: 0px 13px 29px 0px oklch(from var(--motiongpu-shadow-color) l c h / 0.071), 0px 53px 53px 0px oklch(from var(--motiongpu-shadow-color) l c h / 0.059), 0px 119px 71px 0px oklch(from var(--motiongpu-shadow-color) l c h / 0.031), 0px 211px 85px 0px oklch(from var(--motiongpu-shadow-color) l c h / 0.012), 0px 0px 0px 1px oklch(from var(--motiongpu-shadow-color) l c h / 0.102), 0px 1px 0px 0px oklch(from var(--motiongpu-shadow-color) l c h / 0.102), 0px 0px 0px 1px oklch(from var(--motiongpu-shadow-highlight-color) l c h / 0.051) inset, 0px 1px 0px 0px oklch(from var(--motiongpu-shadow-highlight-color) l c h / 0.122) inset; --motiongpu-font-sans: var(--font-sans, 'APK Galeria', ui-sans-serif, system-ui, sans-serif); --motiongpu-font-mono: var( --font-mono, 'Berkeley Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace ); position: fixed; inset: 0; z-index: 2147483647; display: grid; place-items: center; padding-block-start: max(clamp(0.75rem, 1.4vw, 1.5rem), env(safe-area-inset-top)); padding-block-end: max(clamp(0.75rem, 1.4vw, 1.5rem), env(safe-area-inset-bottom)); padding-inline-start: max(clamp(0.75rem, 1.4vw, 1.5rem), env(safe-area-inset-left)); padding-inline-end: max(clamp(0.75rem, 1.4vw, 1.5rem), env(safe-area-inset-right)); overscroll-behavior: contain; background: oklch(0 0 0 / 0.8); backdrop-filter: blur(10px); color: var(--motiongpu-color-foreground); color-scheme: dark; font-family: var(--motiongpu-font-sans); font-size: 0.875rem; font-weight: 400; line-height: 1.5; text-align: start; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } .motiongpu-error-overlay, .motiongpu-error-overlay * { box-sizing: border-box; } .motiongpu-error-overlay ::selection { background: var(--motiongpu-color-accent); color: var(--motiongpu-color-foreground); } .motiongpu-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; } .motiongpu-error-dialog-shell { inline-size: min(52rem, 100%); max-block-size: min(84dvh, 44rem); padding: var(--motiongpu-surface-gap); overflow: hidden; isolation: isolate; border-radius: var(--motiongpu-radius-xl); background: var(--motiongpu-color-background-inset); box-shadow: var(--motiongpu-shadow-highlight-inset), var(--motiongpu-shadow-2xl); } .motiongpu-error-dialog { inline-size: 100%; max-block-size: calc(min(84dvh, 44rem) - (2 * var(--motiongpu-surface-gap))); padding: clamp(1rem, 2vw, 1.5rem); overflow: auto; overscroll-behavior: contain; border-radius: var(--motiongpu-radius-dialog-inner); outline: none; background: var(--motiongpu-color-background); color: var(--motiongpu-color-foreground); box-shadow: var(--motiongpu-shadow-md); scrollbar-color: var(--motiongpu-color-foreground-muted) transparent; scrollbar-width: thin; } .motiongpu-error-header { position: relative; display: grid; gap: 0.75rem; padding-block-end: 1.5rem; } .motiongpu-error-header::after, .motiongpu-error-source-tabs::after, .motiongpu-error-details pre::before { position: absolute; inset-inline: 0; block-size: 1px; content: ''; background: var(--motiongpu-guide-duotone-ink); box-shadow: 0 1px var(--motiongpu-guide-duotone-glint); } .motiongpu-error-header::after, .motiongpu-error-source-tabs::after { inset-block-end: 0; } .motiongpu-error-header-top { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 1rem; } .motiongpu-error-header-copy { display: grid; gap: 0.375rem; min-inline-size: 0; } .motiongpu-error-badges { display: inline-flex; align-items: center; justify-content: flex-end; gap: 0.5rem; flex-wrap: wrap; max-inline-size: 100%; } .motiongpu-error-badge-wrap { display: inline-flex; align-items: center; inline-size: fit-content; padding: 0.1875rem; border-radius: 9999px; background: var(--motiongpu-color-background-inset); box-shadow: var(--motiongpu-shadow-inset); } .motiongpu-error-badge { display: inline-flex; align-items: center; min-block-size: 1.5rem; margin: 0; padding-inline: 0.625rem; border-radius: 9999px; font-size: 0.75rem; font-weight: 500; line-height: 1.3; letter-spacing: 0.05em; text-transform: uppercase; white-space: nowrap; color: var(--motiongpu-color-white-fixed); box-shadow: var(--motiongpu-shadow-md); } .motiongpu-error-badge-phase { background: linear-gradient( 180deg, var(--motiongpu-color-accent), var(--motiongpu-color-accent-secondary) ); } .motiongpu-error-badge-severity { background: linear-gradient( 180deg, var(--motiongpu-color-warning), color-mix(in oklab, var(--motiongpu-color-warning) 70%, var(--motiongpu-color-background) 30%) ); } .motiongpu-error-title { max-inline-size: 40ch; margin: 0; font-size: clamp(1.125rem, 1vw + 0.875rem, 1.25rem); font-weight: 500; line-height: 1.2; letter-spacing: -0.02em; text-wrap: balance; color: var(--motiongpu-color-foreground); } .motiongpu-error-recoverable { margin: 0; font-size: 0.75rem; font-weight: 400; line-height: 1.3; letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap; color: var(--motiongpu-color-foreground-muted); } .motiongpu-error-recoverable span { font-family: var(--motiongpu-font-mono); font-variant-numeric: tabular-nums; color: var(--motiongpu-color-foreground); } .motiongpu-error-body { display: grid; gap: 0.75rem; margin-block-start: 1.5rem; } .motiongpu-error-message, .motiongpu-error-hint { margin: 0; font-size: 0.875rem; font-weight: 400; line-height: 1.5; text-wrap: pretty; overflow-wrap: break-word; } .motiongpu-error-message { inline-size: 100%; padding: 0.75rem 1rem; border-inline-start: 2px solid var(--motiongpu-color-warning); border-radius: var(--motiongpu-radius-sm); background: color-mix(in oklch, var(--motiongpu-color-warning) 10%, transparent); color: var(--motiongpu-color-foreground); box-shadow: var(--motiongpu-shadow-inset); } .motiongpu-error-hint { max-inline-size: 70ch; color: var(--motiongpu-color-foreground-muted); } .motiongpu-error-source { display: grid; gap: 0.75rem; margin-block-start: 1.5rem; } .motiongpu-error-source-title { margin: 0; font-size: 0.75rem; font-weight: 500; line-height: 1.4; letter-spacing: 0.05em; text-transform: uppercase; color: var(--motiongpu-color-foreground-muted); } .motiongpu-error-source-frame { margin: 0; padding: var(--motiongpu-surface-gap); overflow: hidden; isolation: isolate; border-radius: var(--motiongpu-radius-lg); background: var(--motiongpu-color-background-inset); box-shadow: var(--motiongpu-shadow-highlight-inset); } .motiongpu-error-source-tabs { position: relative; display: flex; align-items: flex-end; min-block-size: 2.5rem; margin: 0; border-start-start-radius: var(--motiongpu-radius-surface-inner); border-start-end-radius: var(--motiongpu-radius-surface-inner); background: var(--motiongpu-color-background); box-shadow: var(--motiongpu-shadow-md); } .motiongpu-error-source-tab { display: inline-flex; align-items: center; min-inline-size: 0; padding: 0.625rem 0.75rem; font-family: var(--motiongpu-font-mono); font-size: 0.8125rem; font-weight: 400; line-height: 1.4; overflow-wrap: anywhere; color: var(--motiongpu-color-foreground-muted); } .motiongpu-error-source-tab-active { position: relative; z-index: 1; color: var(--motiongpu-color-foreground); } .motiongpu-error-source-tab-spacer { flex: 1 1 auto; } .motiongpu-error-source-snippet { display: grid; padding-block: 0.5rem; overflow: hidden; border-end-start-radius: var(--motiongpu-radius-surface-inner); border-end-end-radius: var(--motiongpu-radius-surface-inner); background: var(--motiongpu-color-background-muted); box-shadow: var(--motiongpu-shadow-md); } .motiongpu-error-source-row { position: relative; display: grid; grid-template-columns: 2.5rem minmax(0, 1fr); align-items: start; gap: 0.75rem; min-block-size: 1.75rem; padding: 0.25rem 0.75rem; } .motiongpu-error-source-row-active { background: color-mix(in oklch, var(--motiongpu-color-warning) 10%, transparent); } .motiongpu-error-source-row-active::before { position: absolute; inset-block: 0; inset-inline-start: 0; inline-size: 2px; content: ''; background: var(--motiongpu-color-warning); } .motiongpu-error-source-line, .motiongpu-error-source-code { font-family: var(--motiongpu-font-mono); font-size: 0.8125rem; font-weight: 400; line-height: 1.5; } .motiongpu-error-source-line { align-self: stretch; padding-inline-end: 0.75rem; border-inline-end: 1px solid var(--motiongpu-guide-duotone-ink); box-shadow: 1px 0 var(--motiongpu-guide-duotone-glint); font-variant-numeric: tabular-nums; text-align: end; color: var(--motiongpu-color-foreground-muted); } .motiongpu-error-source-code { min-inline-size: 0; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--motiongpu-color-foreground); } .motiongpu-error-sections { display: grid; gap: 0.75rem; margin-block-start: 1.5rem; } .motiongpu-error-sections:empty { display: none; } .motiongpu-error-details { padding: var(--motiongpu-surface-gap); overflow: hidden; isolation: isolate; border-radius: var(--motiongpu-radius-lg); background: var(--motiongpu-color-background-inset); box-shadow: var(--motiongpu-shadow-highlight-inset); } .motiongpu-error-details summary { display: flex; align-items: center; gap: 0.625rem; min-block-size: 2.75rem; padding: 0.75rem 1rem; border-radius: var(--motiongpu-radius-surface-inner); outline: none; cursor: pointer; list-style: none; font-size: 0.8125rem; font-weight: 500; line-height: 1.4; letter-spacing: 0.05em; text-transform: uppercase; color: var(--motiongpu-color-foreground); background: var(--motiongpu-color-background); box-shadow: var(--motiongpu-shadow-md); touch-action: manipulation; } .motiongpu-error-details summary::-webkit-details-marker { display: none; } .motiongpu-error-details-chevron { inline-size: 0.875rem; block-size: 0.875rem; flex: 0 0 auto; opacity: 0.72; transform: rotate(-90deg); transform-box: view-box; transform-origin: 50% 50%; } .motiongpu-error-details summary:hover { background: var(--motiongpu-color-background-muted); } .motiongpu-error-details summary:focus-visible { box-shadow: var(--motiongpu-shadow-md), inset 0 0 0 2px var(--motiongpu-color-accent); } .motiongpu-error-details[open] summary { border-end-start-radius: 0; border-end-end-radius: 0; } .motiongpu-error-details[open] .motiongpu-error-details-chevron { transform: rotate(0deg); } .motiongpu-error-details pre { position: relative; min-inline-size: 0; margin: 0; padding: 1rem; border-end-start-radius: var(--motiongpu-radius-surface-inner); border-end-end-radius: var(--motiongpu-radius-surface-inner); white-space: pre-wrap; overflow: auto; overflow-wrap: anywhere; background: var(--motiongpu-color-background-muted); font-family: var(--motiongpu-font-mono); font-size: 0.8125rem; font-weight: 400; line-height: 1.5; color: var(--motiongpu-color-foreground); scrollbar-color: var(--motiongpu-color-foreground-muted) transparent; scrollbar-width: thin; } .motiongpu-error-details pre::before { inset-block-start: 0; } @media (max-width: 42rem) { .motiongpu-error-overlay { place-items: stretch; padding-block-start: max(0.625rem, env(safe-area-inset-top)); padding-block-end: max(0.625rem, env(safe-area-inset-bottom)); padding-inline-start: max(0.625rem, env(safe-area-inset-left)); padding-inline-end: max(0.625rem, env(safe-area-inset-right)); } .motiongpu-error-dialog-shell { align-self: center; inline-size: 100%; } .motiongpu-error-dialog { padding: 1rem; } .motiongpu-error-recoverable { white-space: normal; } .motiongpu-error-source-row { grid-template-columns: 2rem minmax(0, 1fr); gap: 0.625rem; padding-inline: 0.625rem; } .motiongpu-error-source-line { padding-inline-end: 0.625rem; } } @media (max-width: 32rem) { .motiongpu-error-header-top { grid-template-columns: minmax(0, 1fr); gap: 0.75rem; } .motiongpu-error-badges { justify-content: flex-start; } } @media (forced-colors: active) { .motiongpu-error-details summary:focus-visible { outline: 2px solid Highlight; outline-offset: -2px; } } `; function MotionGPUErrorOverlay({ report }) { const model = createMotionGPUErrorOverlayModel(report); const detailsSummary = report.source ? "Additional diagnostics" : "Technical details"; const componentId = useId(); const titleId = `${componentId}-title`; const descriptionId = `${componentId}-description`; const sourceTitleId = `${componentId}-source-title`; const overlayElement = useRef(null); const [dialogElement, setDialogElement] = useState(null); const getFocusableElements = () => { if (!dialogElement) return []; return Array.from(dialogElement.querySelectorAll(FOCUSABLE_SELECTOR)).filter((element) => element.getAttribute("aria-hidden") !== "true"); }; const handleDialogKeyDown = (event) => { if (event.key !== "Tab" || !dialogElement) return; const focusableElements = getFocusableElements(); if (focusableElements.length === 0) { event.preventDefault(); dialogElement.focus({ preventScroll: true }); return; } const firstElement = focusableElements[0]; const lastElement = focusableElements[focusableElements.length - 1]; const activeElement = document.activeElement; const focusIsOutsideDialog = !(activeElement instanceof Node) || !dialogElement.contains(activeElement); if (event.shiftKey && (activeElement === firstElement || activeElement === dialogElement || focusIsOutsideDialog)) { event.preventDefault(); lastElement.focus(); return; } if (!event.shiftKey && (activeElement === lastElement || activeElement === dialogElement || focusIsOutsideDialog)) { event.preventDefault(); firstElement.focus(); } }; useEffect(() => { if (!dialogElement) return; const previouslyFocused = document.activeElement instanceof HTMLElement ? document.activeElement : null; const portalRoot = overlayElement.current?.parentElement; const inertStates = []; for (const child of document.body.children) { if (!(child instanceof HTMLElement) || child === portalRoot) continue; inertStates.push({ element: child, wasInert: child.inert }); child.inert = true; } const keepFocusInDialog = (event) => { if (!(event.target instanceof Node) || dialogElement.contains(event.target)) return; dialogElement.focus({ preventScroll: true }); }; document.addEventListener("focusin", keepFocusInDialog); queueMicrotask(() => { dialogElement.focus({ preventScroll: true }); }); return () => { document.removeEventListener("focusin", keepFocusInDialog); for (const { element, wasInert } of inertStates) if (element.isConnected) element.inert = wasInert; if (previouslyFocused?.isConnected) previouslyFocused.focus({ preventScroll: true }); }; }, [dialogElement]); return /* @__PURE__ */ jsxs(Portal, { children: [/* @__PURE__ */ jsx("style", { children: MOTIONGPU_ERROR_OVERLAY_STYLES }), /* @__PURE__ */ jsx("div", { ref: overlayElement, className: "motiongpu-error-overlay", role: "presentation", children: /* @__PURE__ */ jsx("div", { className: "motiongpu-error-dialog-shell", role: "presentation", children: /* @__PURE__ */ jsxs("div", { ref: setDialogElement, className: "motiongpu-error-dialog", role: "alertdialog", "aria-modal": "true", "aria-labelledby": titleId, "aria-describedby": descriptionId, tabIndex: -1, "data-testid": "motiongpu-error", onKeyDown: handleDialogKeyDown, children: [ /* @__PURE__ */ jsx("header", { className: "motiongpu-error-header", children: /* @__PURE__ */ jsxs("div", { className: "motiongpu-error-header-top", children: [/* @__PURE__ */ jsxs("div", { className: "motiongpu-error-header-copy", children: [/* @__PURE__ */ jsx("h2", { id: titleId, className: "motiongpu-error-title", children: report.title }), /* @__PURE__ */ jsxs("p", { className: "motiongpu-error-recoverable", children: ["Recoverable: ", /* @__PURE__ */ jsx("span", { children: report.recoverable ? "yes" : "no" })] })] }), /* @__PURE__ */ jsxs("div", { className: "motiongpu-error-badges", children: [/* @__PURE__ */ jsx("div", { className: "motiongpu-error-badge-wrap", children: /* @__PURE__ */ jsx("p", { className: "motiongpu-error-badge motiongpu-error-badge-phase", children: report.phase }) }), /* @__PURE__ */ jsx("div", { className: "motiongpu-error-badge-wrap", children: /* @__PURE__ */ jsx("p", { className: "motiongpu-error-badge motiongpu-error-badge-severity", children: report.severity }) })] })] }) }), /* @__PURE__ */ jsxs("div", { id: descriptionId, className: "motiongpu-error-body", children: [model.displayMessage.length > 0 ? /* @__PURE__ */ jsx("p", { className: "motiongpu-error-message", children: model.displayMessage }) : null, /* @__PURE__ */ jsx("p", { className: "motiongpu-error-hint", children: report.hint })] }), report.source ? /* @__PURE__ */ jsxs("section", { className: "motiongpu-error-source", "aria-labelledby": sourceTitleId, children: [/* @__PURE__ */ jsx("h3", { id: sourceTitleId, className: "motiongpu-error-source-title", children: "Source" }), /* @__PURE__ */ jsxs("figure", { className: "motiongpu-error-source-frame", children: [/* @__PURE__ */ jsxs("figcaption", { className: "motiongpu-error-source-tabs", children: [/* @__PURE__ */ jsxs("span", { className: "motiongpu-error-source-tab motiongpu-error-source-tab-active", children: [report.source.location, report.source.column ? `, col ${report.source.column}` : ""] }), /* @__PURE__ */ jsx("span", { className: "motiongpu-error-source-tab-spacer", "aria-hidden": "true" })] }), /* @__PURE__ */ jsx("div", { className: "motiongpu-error-source-snippet", role: "region", "aria-label": `Source code from ${report.source.location}`, children: report.source.snippet.map((snippetLine) => /* @__PURE__ */ jsxs("div", { className: snippetLine.highlight ? "motiongpu-error-source-row motiongpu-error-source-row-active" : "motiongpu-error-source-row", children: [/* @__PURE__ */ jsxs("span", { className: "motiongpu-error-source-line", children: [snippetLine.highlight ? /* @__PURE__ */ jsx("span", { className: "motiongpu-sr-only", children: "Error line: " }) : null, snippetLine.number] }), /* @__PURE__ */ jsx("span", { className: "motiongpu-error-source-code", children: snippetLine.code || " " })] }, `snippet-${snippetLine.number}`)) })] })] }) : null, /* @__PURE__ */ jsxs("div", { className: "motiongpu-error-sections", children: [ report.details.length > 0 ? /* @__PURE__ */ jsxs("details", { className: "motiongpu-error-details", open: true, children: [/* @__PURE__ */ jsxs("summary", { children: [/* @__PURE__ */ jsx(ChevronDownIcon, {}), /* @__PURE__ */ jsx("span", { children: detailsSummary })] }), /* @__PURE__ */ jsx("pre", { children: report.details.join("\n") })] }) : null, report.stack.length > 0 ? /* @__PURE__ */ jsxs("details", { className: "motiongpu-error-details", children: [/* @__PURE__ */ jsxs("summary", { children: [/* @__PURE__ */ jsx(ChevronDownIcon, {}), /* @__PURE__ */ jsx("span", { children: "Stack trace" })] }), /* @__PURE__ */ jsx("pre", { children: report.stack.join("\n") })] }) : null, report.context ? /* @__PURE__ */ jsxs("details", { className: "motiongpu-error-details", children: [/* @__PURE__ */ jsxs("summary", { children: [/* @__PURE__ */ jsx(ChevronDownIcon, {}), /* @__PURE__ */ jsx("span", { children: "Runtime context" })] }), /* @__PURE__ */ jsx("pre", { children: model.runtimeContextText })] }) : null ] }) ] }) }) })] }); } //#endregion export { MotionGPUErrorOverlay }; //# sourceMappingURL=MotionGPUErrorOverlay.js.map