@buildcores/render-client 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/hooks/useSpriteScrubbing.ts","../node_modules/framer-motion/dist/es/context/MotionConfigContext.mjs","../node_modules/motion-utils/dist/es/noop.mjs","../node_modules/motion-utils/dist/es/errors.mjs","../node_modules/framer-motion/dist/es/frameloop/render-step.mjs","../node_modules/framer-motion/dist/es/frameloop/batcher.mjs","../node_modules/framer-motion/dist/es/frameloop/frame.mjs","../node_modules/framer-motion/dist/es/utils/use-animation-frame.mjs","../src/hooks/useProgressOneSecond.ts","../src/api.ts","../src/types.ts","../src/hooks/useBuildRender.ts","../src/hooks/useSpriteRender.ts","../src/components/LoadingErrorOverlay.tsx","../src/components/DragIcon.tsx","../src/components/InstructionTooltip.tsx","../src/BuildRender.tsx","../src/hooks/useVideoScrubbing.ts","../src/BuildRenderVideo.tsx"],"sourcesContent":["import {\n useState,\n useRef,\n useEffect,\n useCallback,\n type RefObject,\n} from \"react\";\n\n// Helper to extract clientX from mouse or touch events\nconst getClientX = (e: MouseEvent | TouchEvent): number => {\n return \"touches\" in e ? e.touches[0].clientX : e.clientX;\n};\n\n// Helper to calculate new frame with circular wrapping\nexport const calculateCircularFrame = (\n startFrame: number,\n deltaX: number,\n sensitivity: number,\n totalFrames: number\n): number => {\n const frameDelta = deltaX * sensitivity;\n let newFrame = startFrame + frameDelta;\n\n // Make it circular - wrap around when going past boundaries\n newFrame = newFrame % totalFrames;\n if (newFrame < 0) {\n newFrame += totalFrames;\n }\n\n return newFrame;\n};\n\ninterface UseSpiteScrubbingOptions {\n mouseSensitivity?: number;\n touchSensitivity?: number;\n onFrameChange?: (frame: number) => void;\n}\n\nexport const useSpriteScrubbing = (\n canvasRef: RefObject<HTMLCanvasElement | null>,\n totalFrames: number,\n options: UseSpiteScrubbingOptions = {}\n) => {\n const {\n mouseSensitivity = 0.1,\n touchSensitivity = 0.1,\n onFrameChange,\n } = options;\n\n const [isDragging, setIsDragging] = useState(false);\n const [dragStartX, setDragStartX] = useState(0);\n const [dragStartFrame, setDragStartFrame] = useState(0);\n const hasDragged = useRef(false);\n const currentFrame = useRef(0);\n\n // Helper to start dragging (common logic for mouse and touch)\n const startDrag = useCallback(\n (clientX: number, event: Event) => {\n if (!canvasRef.current) return;\n\n setIsDragging(true);\n setDragStartX(clientX);\n setDragStartFrame(currentFrame.current);\n hasDragged.current = true;\n event.preventDefault();\n },\n [canvasRef]\n );\n\n // Helper to handle drag movement (common logic for mouse and touch)\n const handleDragMove = useCallback(\n (clientX: number, sensitivity: number) => {\n if (!isDragging || !canvasRef.current) return;\n\n const deltaX = clientX - dragStartX;\n\n const newFrame = calculateCircularFrame(\n dragStartFrame,\n deltaX, // Positive for natural \"spin right\" feel\n sensitivity,\n totalFrames\n );\n\n currentFrame.current = newFrame;\n\n // Call the frame change callback if provided\n if (onFrameChange) {\n onFrameChange(newFrame);\n }\n\n return newFrame;\n },\n [isDragging, dragStartX, dragStartFrame, totalFrames, onFrameChange]\n );\n\n // Helper to end dragging (common logic for mouse and touch)\n const endDrag = useCallback(() => {\n setIsDragging(false);\n }, []);\n\n const handleMouseDown = useCallback(\n (e: React.MouseEvent) => {\n startDrag(e.clientX, e.nativeEvent);\n },\n [startDrag]\n );\n\n const handleTouchStart = useCallback(\n (e: React.TouchEvent) => {\n startDrag(e.touches[0].clientX, e.nativeEvent);\n },\n [startDrag]\n );\n\n const handleDocumentMouseMove = useCallback(\n (e: MouseEvent) => {\n return handleDragMove(getClientX(e), mouseSensitivity);\n },\n [handleDragMove, mouseSensitivity]\n );\n\n const handleDocumentTouchMove = useCallback(\n (e: TouchEvent) => {\n return handleDragMove(getClientX(e), touchSensitivity);\n },\n [handleDragMove, touchSensitivity]\n );\n\n const handleDocumentMouseUp = useCallback(() => {\n endDrag();\n }, [endDrag]);\n\n const handleDocumentTouchEnd = useCallback(() => {\n endDrag();\n }, [endDrag]);\n\n // Add document-level event listeners when dragging starts\n useEffect(() => {\n if (isDragging) {\n document.addEventListener(\"mousemove\", handleDocumentMouseMove);\n document.addEventListener(\"mouseup\", handleDocumentMouseUp);\n document.addEventListener(\"touchmove\", handleDocumentTouchMove);\n document.addEventListener(\"touchend\", handleDocumentTouchEnd);\n\n return () => {\n document.removeEventListener(\"mousemove\", handleDocumentMouseMove);\n document.removeEventListener(\"mouseup\", handleDocumentMouseUp);\n document.removeEventListener(\"touchmove\", handleDocumentTouchMove);\n document.removeEventListener(\"touchend\", handleDocumentTouchEnd);\n };\n }\n }, [\n isDragging,\n handleDocumentMouseMove,\n handleDocumentMouseUp,\n handleDocumentTouchMove,\n handleDocumentTouchEnd,\n ]);\n\n return {\n isDragging,\n handleMouseDown,\n handleTouchStart,\n hasDragged,\n currentFrame: currentFrame.current,\n setCurrentFrame: (frame: number) => {\n currentFrame.current = frame;\n },\n };\n};\n","\"use client\";\nimport { createContext } from 'react';\n\n/**\n * @public\n */\nconst MotionConfigContext = createContext({\n transformPagePoint: (p) => p,\n isStatic: false,\n reducedMotion: \"never\",\n});\n\nexport { MotionConfigContext };\n","/*#__NO_SIDE_EFFECTS__*/\nconst noop = (any) => any;\n\nexport { noop };\n","import { noop } from './noop.mjs';\n\nlet warning = noop;\nlet invariant = noop;\nif (process.env.NODE_ENV !== \"production\") {\n warning = (check, message) => {\n if (!check && typeof console !== \"undefined\") {\n console.warn(message);\n }\n };\n invariant = (check, message) => {\n if (!check) {\n throw new Error(message);\n }\n };\n}\n\nexport { invariant, warning };\n","function createRenderStep(runNextFrame) {\n /**\n * We create and reuse two queues, one to queue jobs for the current frame\n * and one for the next. We reuse to avoid triggering GC after x frames.\n */\n let thisFrame = new Set();\n let nextFrame = new Set();\n /**\n * Track whether we're currently processing jobs in this step. This way\n * we can decide whether to schedule new jobs for this frame or next.\n */\n let isProcessing = false;\n let flushNextFrame = false;\n /**\n * A set of processes which were marked keepAlive when scheduled.\n */\n const toKeepAlive = new WeakSet();\n let latestFrameData = {\n delta: 0.0,\n timestamp: 0.0,\n isProcessing: false,\n };\n function triggerCallback(callback) {\n if (toKeepAlive.has(callback)) {\n step.schedule(callback);\n runNextFrame();\n }\n callback(latestFrameData);\n }\n const step = {\n /**\n * Schedule a process to run on the next frame.\n */\n schedule: (callback, keepAlive = false, immediate = false) => {\n const addToCurrentFrame = immediate && isProcessing;\n const queue = addToCurrentFrame ? thisFrame : nextFrame;\n if (keepAlive)\n toKeepAlive.add(callback);\n if (!queue.has(callback))\n queue.add(callback);\n return callback;\n },\n /**\n * Cancel the provided callback from running on the next frame.\n */\n cancel: (callback) => {\n nextFrame.delete(callback);\n toKeepAlive.delete(callback);\n },\n /**\n * Execute all schedule callbacks.\n */\n process: (frameData) => {\n latestFrameData = frameData;\n /**\n * If we're already processing we've probably been triggered by a flushSync\n * inside an existing process. Instead of executing, mark flushNextFrame\n * as true and ensure we flush the following frame at the end of this one.\n */\n if (isProcessing) {\n flushNextFrame = true;\n return;\n }\n isProcessing = true;\n [thisFrame, nextFrame] = [nextFrame, thisFrame];\n // Execute this frame\n thisFrame.forEach(triggerCallback);\n // Clear the frame so no callbacks remain. This is to avoid\n // memory leaks should this render step not run for a while.\n thisFrame.clear();\n isProcessing = false;\n if (flushNextFrame) {\n flushNextFrame = false;\n step.process(frameData);\n }\n },\n };\n return step;\n}\n\nexport { createRenderStep };\n","import { MotionGlobalConfig } from '../utils/GlobalConfig.mjs';\nimport { createRenderStep } from './render-step.mjs';\n\nconst stepsOrder = [\n \"read\", // Read\n \"resolveKeyframes\", // Write/Read/Write/Read\n \"update\", // Compute\n \"preRender\", // Compute\n \"render\", // Write\n \"postRender\", // Compute\n];\nconst maxElapsed = 40;\nfunction createRenderBatcher(scheduleNextBatch, allowKeepAlive) {\n let runNextFrame = false;\n let useDefaultElapsed = true;\n const state = {\n delta: 0.0,\n timestamp: 0.0,\n isProcessing: false,\n };\n const flagRunNextFrame = () => (runNextFrame = true);\n const steps = stepsOrder.reduce((acc, key) => {\n acc[key] = createRenderStep(flagRunNextFrame);\n return acc;\n }, {});\n const { read, resolveKeyframes, update, preRender, render, postRender } = steps;\n const processBatch = () => {\n const timestamp = MotionGlobalConfig.useManualTiming\n ? state.timestamp\n : performance.now();\n runNextFrame = false;\n state.delta = useDefaultElapsed\n ? 1000 / 60\n : Math.max(Math.min(timestamp - state.timestamp, maxElapsed), 1);\n state.timestamp = timestamp;\n state.isProcessing = true;\n // Unrolled render loop for better per-frame performance\n read.process(state);\n resolveKeyframes.process(state);\n update.process(state);\n preRender.process(state);\n render.process(state);\n postRender.process(state);\n state.isProcessing = false;\n if (runNextFrame && allowKeepAlive) {\n useDefaultElapsed = false;\n scheduleNextBatch(processBatch);\n }\n };\n const wake = () => {\n runNextFrame = true;\n useDefaultElapsed = true;\n if (!state.isProcessing) {\n scheduleNextBatch(processBatch);\n }\n };\n const schedule = stepsOrder.reduce((acc, key) => {\n const step = steps[key];\n acc[key] = (process, keepAlive = false, immediate = false) => {\n if (!runNextFrame)\n wake();\n return step.schedule(process, keepAlive, immediate);\n };\n return acc;\n }, {});\n const cancel = (process) => {\n for (let i = 0; i < stepsOrder.length; i++) {\n steps[stepsOrder[i]].cancel(process);\n }\n };\n return { schedule, cancel, state, steps };\n}\n\nexport { createRenderBatcher, stepsOrder };\n","import { noop } from 'motion-utils';\nimport { createRenderBatcher } from './batcher.mjs';\n\nconst { schedule: frame, cancel: cancelFrame, state: frameData, steps: frameSteps, } = createRenderBatcher(typeof requestAnimationFrame !== \"undefined\" ? requestAnimationFrame : noop, true);\n\nexport { cancelFrame, frame, frameData, frameSteps };\n","import { useRef, useContext, useEffect } from 'react';\nimport { MotionConfigContext } from '../context/MotionConfigContext.mjs';\nimport { frame, cancelFrame } from '../frameloop/frame.mjs';\n\nfunction useAnimationFrame(callback) {\n const initialTimestamp = useRef(0);\n const { isStatic } = useContext(MotionConfigContext);\n useEffect(() => {\n if (isStatic)\n return;\n const provideTimeSinceStart = ({ timestamp, delta }) => {\n if (!initialTimestamp.current)\n initialTimestamp.current = timestamp;\n callback(timestamp - initialTimestamp.current, delta);\n };\n frame.update(provideTimeSinceStart, true);\n return () => cancelFrame(provideTimeSinceStart);\n }, [callback]);\n}\n\nexport { useAnimationFrame };\n","import { useAnimationFrame } from \"framer-motion\";\nimport { useRef, useState } from \"react\";\n\nexport function useBouncePatternProgress(enabled = true) {\n const [value, setValue] = useState(0);\n const [isBouncing, setIsBouncing] = useState(false);\n const start = useRef<number | null>(null);\n\n useAnimationFrame((t) => {\n if (!enabled) {\n // Reset animation when disabled\n if (start.current !== null) {\n start.current = null;\n setValue(0);\n setIsBouncing(false);\n }\n return;\n }\n\n if (start.current === null) start.current = t;\n\n const elapsed = (t - start.current) % 3000; // 3s full cycle\n\n let progress = 0;\n const bouncing = elapsed < 1000; // Bouncing during first 1 second\n\n if (elapsed < 500) {\n // 0 → 1\n progress = elapsed / 500;\n } else if (elapsed < 1000) {\n // 1 → 0\n progress = 1 - (elapsed - 500) / 500;\n } else {\n // Pause at 0 for 2 seconds\n progress = 0;\n }\n\n setValue(progress);\n setIsBouncing(bouncing);\n });\n\n return { value, isBouncing };\n}\n","import { RenderBuildRequest, AvailablePartsResponse, ApiConfig, PartCategory, GetAvailablePartsOptions } from \"./types\";\n\n// API Configuration\nconst API_BASE_URL = \"https://www.renderapi.buildcores.com\";\n\n// API Endpoints\nexport const API_ENDPOINTS = {\n RENDER_BUILD_EXPERIMENTAL: \"/render-build-experimental\",\n RENDER_BUILD: \"/render-build\",\n AVAILABLE_PARTS: \"/available-parts\",\n} as const;\n\n// API Response Types\nexport interface RenderBuildResponse {\n /**\n * The rendered MP4 video as a Blob (when format is \"video\")\n */\n video: Blob;\n /**\n * Optional metadata about the render\n */\n metadata?: {\n duration?: number;\n size?: number;\n format?: string;\n };\n}\n\n// Async render job types (new endpoints)\nexport interface RenderJobCreateResponse {\n job_id: string;\n status: \"queued\" | \"processing\" | \"completed\" | \"error\";\n}\n\nexport interface RenderJobStatusResponse {\n job_id: string;\n status: \"queued\" | \"processing\" | \"completed\" | \"error\";\n url?: string | null;\n video_url?: string | null;\n sprite_url?: string | null;\n error?: string | null;\n end_time?: string | null;\n}\n\nexport interface RenderBuildAsyncResponse {\n /** Final URL to the rendered MP4 (or sprite) asset */\n videoUrl: string;\n}\n\nexport interface RenderSpriteResponse {\n /**\n * The rendered sprite sheet as a Blob (when format is \"sprite\")\n */\n sprite: Blob;\n /**\n * Sprite sheet metadata\n */\n metadata?: {\n cols?: number;\n rows?: number;\n totalFrames?: number;\n size?: number;\n format?: string;\n };\n}\n\n// API Functions (definitions only - not implemented yet)\nexport interface RenderAPIService {\n /**\n * Submit a render build request\n * @param parts - The parts configuration for the build\n * @param config - API configuration (environment, auth token) - required\n * @returns Promise with the rendered MP4 video\n */\n renderBuildExperimental(\n parts: RenderBuildRequest,\n config: ApiConfig\n ): Promise<RenderBuildResponse>;\n\n /**\n * Get available parts for building\n * @param config - API configuration (environment, auth token) - required\n * @returns Promise with available parts by category\n */\n getAvailableParts(\n category: PartCategory,\n config: ApiConfig,\n options?: GetAvailablePartsOptions\n ): Promise<AvailablePartsResponse>;\n}\n\n// API URL helpers\nexport const buildApiUrl = (endpoint: string, config: ApiConfig): string => {\n const baseUrl = `${API_BASE_URL}${endpoint}`;\n if (config.environment) {\n const separator = endpoint.includes(\"?\") ? \"&\" : \"?\";\n return `${baseUrl}${separator}environment=${config.environment}`;\n }\n return baseUrl;\n};\n\n// Helper to build request headers with auth token\nexport const buildHeaders = (config: ApiConfig): Record<string, string> => {\n const headers: Record<string, string> = {\n \"Content-Type\": \"application/json\",\n accept: \"application/json\",\n };\n\n if (config.authToken) {\n headers[\"Authorization\"] = `Bearer ${config.authToken}`;\n }\n\n return headers;\n};\n\nconst sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));\n\n// API Implementation\nexport const renderBuildExperimental = async (\n request: RenderBuildRequest,\n config: ApiConfig\n): Promise<RenderBuildResponse> => {\n const requestWithFormat = {\n ...request,\n format: request.format || \"video\", // Default to video format\n };\n\n const response = await fetch(\n buildApiUrl(API_ENDPOINTS.RENDER_BUILD_EXPERIMENTAL, config),\n {\n method: \"POST\",\n headers: buildHeaders(config),\n body: JSON.stringify(requestWithFormat),\n }\n );\n\n if (!response.ok) {\n throw new Error(\n `Render build failed: ${response.status} ${response.statusText}`\n );\n }\n\n const video = await response.blob();\n\n return {\n video,\n metadata: {\n size: video.size,\n format: \"video/mp4\",\n },\n };\n};\n\n// New async endpoints implementation\nexport const createRenderBuildJob = async (\n request: RenderBuildRequest,\n config: ApiConfig\n): Promise<RenderJobCreateResponse> => {\n const body = {\n parts: request.parts,\n // If provided, forward format; default handled server-side but we keep explicit default\n ...(request.format ? { format: request.format } : {}),\n };\n\n const response = await fetch(buildApiUrl(API_ENDPOINTS.RENDER_BUILD, config), {\n method: \"POST\",\n headers: buildHeaders(config),\n body: JSON.stringify(body),\n });\n\n if (!response.ok) {\n throw new Error(`Create render job failed: ${response.status} ${response.statusText}`);\n }\n\n const data = (await response.json()) as RenderJobCreateResponse;\n if (!data?.job_id) {\n throw new Error(\"Create render job failed: missing job_id in response\");\n }\n return data;\n};\n\nexport const getRenderBuildStatus = async (\n jobId: string,\n config: ApiConfig\n): Promise<RenderJobStatusResponse> => {\n const url = buildApiUrl(`${API_ENDPOINTS.RENDER_BUILD}/${encodeURIComponent(jobId)}`, config);\n const response = await fetch(url, {\n method: \"GET\",\n headers: buildHeaders(config),\n });\n\n if (response.status === 404) {\n throw new Error(\"Render job not found\");\n }\n if (!response.ok) {\n throw new Error(`Get render job status failed: ${response.status} ${response.statusText}`);\n }\n\n return (await response.json()) as RenderJobStatusResponse;\n};\n\nexport const renderBuild = async (\n request: RenderBuildRequest,\n config: ApiConfig,\n options?: { pollIntervalMs?: number; timeoutMs?: number }\n): Promise<RenderBuildAsyncResponse> => {\n const pollIntervalMs = options?.pollIntervalMs ?? 1500;\n const timeoutMs = options?.timeoutMs ?? 120_000; // 2 minutes default\n\n const { job_id } = await createRenderBuildJob(request, config);\n\n const start = Date.now();\n // Poll until completed or error or timeout\n for (;;) {\n const status = await getRenderBuildStatus(job_id, config);\n if (status.status === \"completed\") {\n const requestedFormat = request.format ?? \"video\";\n const finalUrl =\n (requestedFormat === \"sprite\"\n ? status.sprite_url || status.url || undefined\n : status.video_url || status.url || undefined);\n if (!finalUrl) {\n throw new Error(\"Render job completed but no URL returned\");\n }\n return { videoUrl: finalUrl };\n }\n if (status.status === \"error\") {\n throw new Error(status.error || \"Render job failed\");\n }\n\n if (Date.now() - start > timeoutMs) {\n throw new Error(\"Timed out waiting for render job to complete\");\n }\n\n await sleep(pollIntervalMs);\n }\n};\n\nexport const renderSpriteExperimental = async (\n request: RenderBuildRequest,\n config: ApiConfig\n): Promise<RenderSpriteResponse> => {\n const requestWithFormat = {\n ...request,\n format: \"sprite\",\n };\n\n const response = await fetch(\n buildApiUrl(API_ENDPOINTS.RENDER_BUILD_EXPERIMENTAL, config),\n {\n method: \"POST\",\n headers: buildHeaders(config),\n body: JSON.stringify(requestWithFormat),\n }\n );\n\n if (!response.ok) {\n throw new Error(\n `Render sprite failed: ${response.status} ${response.statusText}`\n );\n }\n\n const sprite = await response.blob();\n\n return {\n sprite,\n metadata: {\n cols: 12, // Default sprite grid - could be returned from API\n rows: 6,\n totalFrames: 72,\n size: sprite.size,\n format: \"image/webp\",\n },\n };\n};\n\nexport const getAvailableParts = async (\n category: PartCategory,\n config: ApiConfig,\n options?: GetAvailablePartsOptions\n): Promise<AvailablePartsResponse> => {\n const base = buildApiUrl(API_ENDPOINTS.AVAILABLE_PARTS, config);\n const params = new URLSearchParams();\n params.set(\"category\", category);\n if (typeof options?.limit === \"number\") params.set(\"limit\", String(options.limit));\n if (typeof options?.skip === \"number\") params.set(\"skip\", String(options.skip));\n const separator = base.includes(\"?\") ? \"&\" : \"?\";\n const url = `${base}${separator}${params.toString()}`;\n\n const response = await fetch(url, {\n method: \"GET\",\n headers: buildHeaders(config),\n });\n\n if (!response.ok) {\n throw new Error(\n `Get available parts failed: ${response.status} ${response.statusText}`\n );\n }\n\n return (await response.json()) as AvailablePartsResponse;\n};\n\n// Export the base URL for external use\nexport { API_BASE_URL };\n","export interface BuildRenderVideoProps {\n /**\n * Parts configuration for the build render.\n *\n * This object defines which PC components should be included in the 3D render.\n * Each part category contains an array with a single part ID that will be rendered.\n *\n * **Current Limitation**: Only 1 part per category is supported. Arrays must contain\n * exactly one part ID per category. Future versions will support multiple parts per category.\n *\n * @example\n * ```tsx\n * const parts = {\n * parts: {\n * CPU: [\"7xjqsomhr\"], // AMD Ryzen 7 9800X3D\n * GPU: [\"z7pyphm9k\"], // ASUS GeForce RTX 5080 ASTRAL\n * RAM: [\"dpl1iyvb5\"], // PNY DDR5\n * Motherboard: [\"iwin2u9vx\"], // Asus ROG STRIX X870E-E GAMING WIFI\n * PSU: [\"m4kilv190\"], // LIAN LI 1300W\n * Storage: [\"0bkvs17po\"], // SAMSUNG 990 EVO\n * PCCase: [\"qq9jamk7c\"], // MONTECH KING 95 PRO\n * CPUCooler: [\"62d8zelr5\"], // ARCTIC LIQUID FREEZER 360\n * }\n * };\n *\n * <BuildRender parts={parts} size={300} />\n * ```\n *\n * @example Minimal build (only required components)\n * ```tsx\n * const parts = {\n * parts: {\n * CPU: [\"7xjqsomhr\"], // Single CPU required\n * Motherboard: [\"iwin2u9vx\"], // Single motherboard required\n * PCCase: [\"qq9jamk7c\"], // Single case required\n * }\n * };\n * ```\n *\n * Note: Part IDs must correspond to valid components in the BuildCores database.\n * Use the available parts API to get valid part IDs for each category.\n */\n parts: RenderBuildRequest;\n\n /**\n * Width and height in pixels. If only `size` is provided, both width and height use it.\n * If `width`/`height` are provided, they override `size` individually.\n */\n width?: number;\n height?: number;\n size?: number;\n\n /**\n * API configuration for environment and authentication.\n * This is required to make API calls to the BuildCores rendering service.\n *\n * @example\n * ```tsx\n * <BuildRender\n * parts={parts}\n * size={300}\n * apiConfig={{\n * environment: 'staging',\n * authToken: 'your-auth-token'\n * }}\n * />\n * ```\n */\n apiConfig: ApiConfig;\n\n /**\n * Options to configure the internal useBuildRender hook\n * (e.g., choose async vs experimental rendering flow)\n */\n useBuildRenderOptions?: {\n mode?: \"async\" | \"experimental\";\n };\n\n /**\n * Optional mouse sensitivity for dragging (default: 0.005).\n *\n * Controls how responsive the 3D model rotation is to mouse movements.\n * Lower values make rotation slower and more precise, higher values make it faster.\n *\n * @example\n * ```tsx\n * <BuildRender\n * parts={parts}\n * size={300}\n * mouseSensitivity={0.003} // Slower, more precise\n * />\n *\n * <BuildRender\n * parts={parts}\n * size={300}\n * mouseSensitivity={0.01} // Faster rotation\n * />\n * ```\n *\n * @default 0.005\n */\n mouseSensitivity?: number;\n\n /**\n * Optional touch sensitivity for dragging (default: 0.01).\n *\n * Controls how responsive the 3D model rotation is to touch gestures on mobile devices.\n * Generally set higher than mouseSensitivity for better touch experience.\n *\n * @example\n * ```tsx\n * <BuildRender\n * parts={parts}\n * size={300}\n * touchSensitivity={0.008} // Slower touch rotation\n * />\n *\n * <BuildRender\n * parts={parts}\n * size={300}\n * touchSensitivity={0.015} // Faster touch rotation\n * />\n * ```\n *\n * @default 0.01\n */\n touchSensitivity?: number;\n}\n\nexport interface BuildRenderProps {\n /**\n * Parts configuration for the sprite render.\n *\n * This object defines which PC components should be included in the 3D sprite render.\n * Each part category contains an array with a single part ID that will be rendered.\n *\n * **Current Limitation**: Only 1 part per category is supported. Arrays must contain\n * exactly one part ID per category. Future versions will support multiple parts per category.\n *\n * @example\n * ```tsx\n * const parts = {\n * parts: {\n * CPU: [\"7xjqsomhr\"], // AMD Ryzen 7 9800X3D\n * GPU: [\"z7pyphm9k\"], // ASUS GeForce RTX 5080 ASTRAL\n * RAM: [\"dpl1iyvb5\"], // PNY DDR5\n * Motherboard: [\"iwin2u9vx\"], // Asus ROG STRIX X870E-E GAMING WIFI\n * PSU: [\"m4kilv190\"], // LIAN LI 1300W\n * Storage: [\"0bkvs17po\"], // SAMSUNG 990 EVO\n * PCCase: [\"qq9jamk7c\"], // MONTECH KING 95 PRO\n * CPUCooler: [\"62d8zelr5\"], // ARCTIC LIQUID FREEZER 360\n * }\n * };\n *\n * <SpriteRender parts={parts} size={300} />\n * ```\n */\n parts: RenderBuildRequest;\n\n /**\n * Width and height in pixels. If only `size` is provided, both width and height use it.\n * If `width`/`height` are provided, they override `size` individually.\n */\n width?: number;\n height?: number;\n size?: number;\n\n /**\n * API configuration for environment and authentication.\n * This is required to make API calls to the BuildCores rendering service.\n *\n * @example\n * ```tsx\n * <SpriteRender\n * parts={parts}\n * size={300}\n * apiConfig={{\n * environment: 'staging',\n * authToken: 'your-auth-token'\n * }}\n * />\n * ```\n */\n apiConfig: ApiConfig;\n\n /**\n * Options to configure the internal useSpriteRender hook\n * (e.g., choose async vs experimental rendering flow)\n */\n useSpriteRenderOptions?: {\n mode?: \"async\" | \"experimental\";\n };\n\n /**\n * Optional mouse sensitivity for dragging (default: 0.05).\n *\n * Controls how responsive the 3D model rotation is to mouse movements.\n * Lower values make rotation slower and more precise, higher values make it faster.\n *\n * @default 0.2\n */\n mouseSensitivity?: number;\n\n /**\n * Optional touch sensitivity for dragging (default: 0.02).\n *\n * Controls how responsive the 3D model rotation is to touch gestures on mobile devices.\n * Generally set similar to mouseSensitivity for consistent experience.\n *\n * @default 0.2\n */\n touchSensitivity?: number;\n}\n\n// API Types\n\n/**\n * API configuration for environment and authentication\n */\nexport interface ApiConfig {\n /**\n * Environment to use for API requests\n * - 'staging': Development/testing environment\n * - 'prod': Production environment\n *\n * @example\n * ```tsx\n * const config: ApiConfig = {\n * environment: 'staging',\n * authToken: 'your-bearer-token'\n * };\n * ```\n */\n environment?: \"staging\" | \"prod\";\n\n /**\n * Bearer token for API authentication\n *\n * @example\n * ```tsx\n * const config: ApiConfig = {\n * environment: 'prod',\n * authToken: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'\n * };\n * ```\n */\n authToken?: string;\n}\n\n/**\n * Enum defining all available PC part categories that can be rendered.\n *\n * Each category represents a different type of computer component that can be\n * included in the 3D build visualization.\n *\n * @example\n * ```tsx\n * // All available categories\n * const categories = [\n * PartCategory.CPU, // \"CPU\"\n * PartCategory.GPU, // \"GPU\"\n * PartCategory.RAM, // \"RAM\"\n * PartCategory.Motherboard,// \"Motherboard\"\n * PartCategory.PSU, // \"PSU\"\n * PartCategory.Storage, // \"Storage\"\n * PartCategory.PCCase, // \"PCCase\"\n * PartCategory.CPUCooler, // \"CPUCooler\"\n * ];\n * ```\n */\nexport enum PartCategory {\n /** Central Processing Unit - The main processor */\n CPU = \"CPU\",\n /** Graphics Processing Unit - Video card for rendering */\n GPU = \"GPU\",\n /** Random Access Memory - System memory modules */\n RAM = \"RAM\",\n /** Main circuit board that connects all components */\n Motherboard = \"Motherboard\",\n /** Power Supply Unit - Provides power to all components */\n PSU = \"PSU\",\n /** Storage devices like SSDs, HDDs, NVMe drives */\n Storage = \"Storage\",\n /** PC Case - The enclosure that houses all components */\n PCCase = \"PCCase\",\n /** CPU Cooler - Air or liquid cooling for the processor */\n CPUCooler = \"CPUCooler\",\n}\n\n/**\n * Request structure for rendering a PC build.\n *\n * This interface defines the parts configuration that will be sent to the\n * rendering service to generate a 3D visualization of a PC build.\n *\n * **Current Limitation**: Only one part per category is supported. Each category\n * array must contain exactly one part ID. Future versions will support multiple\n * parts per category for comparison views.\n *\n * @example Basic build configuration\n * ```tsx\n * const buildRequest: RenderBuildRequest = {\n * parts: {\n * CPU: [\"7xjqsomhr\"], // AMD Ryzen 7 9800X3D\n * GPU: [\"z7pyphm9k\"], // ASUS GeForce RTX 5080 ASTRAL\n * RAM: [\"dpl1iyvb5\"], // PNY DDR5\n * Motherboard: [\"iwin2u9vx\"], // Asus ROG STRIX X870E-E GAMING WIFI\n * PSU: [\"m4kilv190\"], // LIAN LI 1300W\n * Storage: [\"0bkvs17po\"], // SAMSUNG 990 EVO\n * PCCase: [\"qq9jamk7c\"], // MONTECH KING 95 PRO\n * CPUCooler: [\"62d8zelr5\"], // ARCTIC LIQUID FREEZER 360\n * },\n * format: \"video\" // Request video format\n * };\n * ```\n *\n * @example Sprite format request\n * ```tsx\n * const spriteRequest: RenderBuildRequest = {\n * parts: {\n * CPU: [\"7xjqsomhr\"], // AMD Ryzen 7 9800X3D\n * GPU: [\"z7pyphm9k\"], // ASUS GeForce RTX 5080 ASTRAL\n * RAM: [\"dpl1iyvb5\"], // PNY DDR5\n * Motherboard: [\"iwin2u9vx\"], // Asus ROG STRIX X870E-E GAMING WIFI\n * },\n * format: \"sprite\" // Request sprite sheet format\n * };\n * ```\n */\nexport interface RenderBuildRequest {\n /**\n * Object mapping part categories to arrays of part IDs.\n *\n * **Current Requirements**:\n * - Keys are part categories (CPU, GPU, RAM, etc.)\n * - Values are arrays containing exactly one part ID string\n * - All categories are optional - include only the parts you want to render\n * - Part IDs must be valid identifiers from the BuildCores parts database\n *\n * **Future Enhancement**: Multiple parts per category will be supported for comparison views.\n *\n * @see PartCategory for all available categories\n * @see AvailablePartsResponse for getting valid part IDs\n */\n parts: {\n [K in PartCategory]?: string[];\n };\n\n /**\n * Output format for the rendered build.\n *\n * - \"video\": Returns an MP4 video file for video-based 360° rotation\n * - \"sprite\": Returns a sprite sheet image for frame-based 360° rotation\n *\n * @default \"video\"\n */\n format?: \"video\" | \"sprite\";\n}\n\n/**\n * Response structure containing all available parts for each category.\n *\n * This type represents the response from the available parts API endpoint,\n * providing arrays of valid part IDs for each component category.\n *\n * @example Using available parts response\n * ```tsx\n * const availableParts: AvailablePartsResponse = {\n * CPU: [\n * { id: \"7xjqsomhr\", name: \"AMD Ryzen 7 9800X3D\", image: \"https://...\" },\n * { id: \"x2thvstj3\", name: \"AMD Ryzen 7 9700X\", image: \"https://...\" },\n * ],\n * GPU: [\n * { id: \"z7pyphm9k\", name: \"ASUS GeForce RTX 5080 ASTRAL\", image: \"https://...\" },\n * { id: \"4a0mjb360\", name: \"PNY GeForce RTX 5060 Ti 16GB\", image: \"https://...\" },\n * ],\n * // ... all other categories\n * };\n *\n * // Select one part per category for current build request\n * const buildRequest: RenderBuildRequest = {\n * parts: {\n * CPU: [availableParts.CPU[0].id], // Select first available CPU ID\n * GPU: [availableParts.GPU[1].id], // Select second available GPU ID\n * RAM: [availableParts.RAM[0].id], // Select first available RAM ID\n * }\n * };\n * ```\n *\n * @example Dynamic part selection\n * ```tsx\n * // Function to create build with user-selected parts\n * const createBuild = (selectedPartIds: Record<string, string>) => {\n * const buildRequest: RenderBuildRequest = {\n * parts: {\n * CPU: [selectedPartIds.cpu], // Single selected CPU ID\n * GPU: [selectedPartIds.gpu], // Single selected GPU ID\n * RAM: [selectedPartIds.ram], // Single selected RAM ID\n * // ... other single selections\n * }\n * };\n * return buildRequest;\n * };\n * ```\n */\n/**\n * Individual part information with details\n */\nexport interface PartDetails {\n /** Unique part identifier */\n id: string;\n /** Human-readable part name */\n name: string;\n /** URL to part image */\n image: string;\n}\n\n/**\n * Pagination metadata for available parts responses\n */\nexport interface AvailablePartsPagination {\n /** Total number of parts available for this category */\n total: number;\n /** Number of parts returned in this response */\n limit: number;\n /** Number of parts skipped */\n skip: number;\n /** Whether there are more parts available */\n hasNext: boolean;\n /** Whether there are previous parts available */\n hasPrev: boolean;\n}\n\n/**\n * Response envelope for the available parts endpoint.\n * Returns parts for the requested category under `data` keyed by category name.\n */\nexport interface AvailablePartsResponse {\n /**\n * Parts grouped by category. Only the requested category key is expected\n * to be present in the response.\n */\n data: Partial<Record<PartCategory, PartDetails[]>>;\n /** The requested category */\n category: PartCategory;\n /** Optional pagination information */\n pagination?: AvailablePartsPagination;\n}\n\n/**\n * Query options for fetching available parts\n */\nexport interface GetAvailablePartsOptions {\n /** Number of parts to return (default 20, min 1, max 100) */\n limit?: number;\n /** Number of parts to skip for pagination (default 0) */\n skip?: number;\n}\n","import { useState, useEffect, useCallback, useRef } from \"react\";\nimport { RenderBuildRequest, PartCategory, ApiConfig } from \"../types\";\nimport { renderBuild, renderBuildExperimental } from \"../api\";\n\n/**\n * Compares two RenderBuildRequest objects for equality by checking if the same IDs\n * are present in each category array, regardless of order.\n */\nexport const arePartsEqual = (\n parts1: RenderBuildRequest,\n parts2: RenderBuildRequest\n): boolean => {\n const categories = Object.values(PartCategory);\n\n for (const category of categories) {\n const arr1 = parts1.parts[category] || [];\n const arr2 = parts2.parts[category] || [];\n\n // Check if arrays have the same length\n if (arr1.length !== arr2.length) {\n return false;\n }\n\n // Check if arrays contain the same elements (order doesn't matter)\n const set1 = new Set(arr1);\n const set2 = new Set(arr2);\n\n if (set1.size !== set2.size) {\n return false;\n }\n\n for (const id of set1) {\n if (!set2.has(id)) {\n return false;\n }\n }\n }\n\n return true;\n};\n\nexport interface UseBuildRenderReturn {\n videoSrc: string | null;\n isRenderingBuild: boolean;\n renderError: string | null;\n}\n\nexport interface UseBuildRenderOptions {\n /**\n * Choose which backend flow to use\n * - 'async' (default): uses /render-build and polls /render-build/{jobId}\n * - 'experimental': uses /render-build-experimental and returns Blob\n */\n mode?: \"async\" | \"experimental\";\n}\n\nexport const useBuildRender = (\n parts: RenderBuildRequest,\n apiConfig: ApiConfig,\n onLoadStart?: () => void,\n options?: UseBuildRenderOptions\n): UseBuildRenderReturn => {\n const [videoSrc, setVideoSrc] = useState<string | null>(null);\n const [isRenderingBuild, setIsRenderingBuild] = useState(false);\n const [renderError, setRenderError] = useState<string | null>(null);\n const previousPartsRef = useRef<RenderBuildRequest | null>(null);\n\n const fetchRenderBuild = useCallback(\n async (currentParts: RenderBuildRequest) => {\n try {\n setIsRenderingBuild(true);\n setRenderError(null);\n onLoadStart?.();\n\n const mode = options?.mode ?? \"async\";\n if (mode === \"experimental\") {\n const response = await renderBuildExperimental(currentParts, apiConfig);\n const objectUrl = URL.createObjectURL(response.video);\n setVideoSrc((prevSrc: string | null) => {\n if (prevSrc && prevSrc.startsWith(\"blob:\")) {\n URL.revokeObjectURL(prevSrc);\n }\n return objectUrl;\n });\n } else {\n const { videoUrl } = await renderBuild(currentParts, apiConfig);\n // Clean up previous object URL (if any) before setting new one\n setVideoSrc((prevSrc: string | null) => {\n if (prevSrc && prevSrc.startsWith(\"blob:\")) {\n URL.revokeObjectURL(prevSrc);\n }\n return videoUrl;\n });\n }\n } catch (error) {\n setRenderError(\n error instanceof Error ? error.message : \"Failed to render build\"\n );\n } finally {\n setIsRenderingBuild(false);\n }\n },\n [apiConfig, onLoadStart, options?.mode]\n );\n\n // Effect to call API when parts content changes (using custom equality check)\n useEffect(() => {\n const shouldFetch =\n previousPartsRef.current === null ||\n !arePartsEqual(previousPartsRef.current, parts);\n\n if (shouldFetch) {\n previousPartsRef.current = parts;\n fetchRenderBuild(parts);\n }\n }, [parts, fetchRenderBuild]);\n\n // Cleanup effect for component unmount\n useEffect(() => {\n return () => {\n if (videoSrc && videoSrc.startsWith(\"blob:\")) {\n URL.revokeObjectURL(videoSrc);\n }\n };\n }, [videoSrc]);\n\n return {\n videoSrc,\n isRenderingBuild,\n renderError,\n };\n};\n","import { useState, useEffect, useCallback, useRef } from \"react\";\nimport { RenderBuildRequest, ApiConfig } from \"../types\";\nimport { renderSpriteExperimental, renderBuild } from \"../api\";\nimport { arePartsEqual } from \"./useBuildRender\";\n\nexport interface UseSpriteRenderReturn {\n spriteSrc: string | null;\n isRenderingSprite: boolean;\n renderError: string | null;\n spriteMetadata: {\n cols: number;\n rows: number;\n totalFrames: number;\n } | null;\n}\n\nexport interface UseSpriteRenderOptions {\n /**\n * Choose which backend flow to use\n * - 'async' (default): uses /render-build and polls /render-build/{jobId} with format 'sprite'\n * - 'experimental': uses /render-build-experimental and returns Blob\n */\n mode?: \"async\" | \"experimental\";\n}\n\nexport const useSpriteRender = (\n parts: RenderBuildRequest,\n apiConfig: ApiConfig,\n onLoadStart?: () => void,\n options?: UseSpriteRenderOptions\n): UseSpriteRenderReturn => {\n const [spriteSrc, setSpriteSrc] = useState<string | null>(null);\n const [isRenderingSprite, setIsRenderingSprite] = useState(false);\n const [renderError, setRenderError] = useState<string | null>(null);\n const [spriteMetadata, setSpriteMetadata] = useState<{\n cols: number;\n rows: number;\n totalFrames: number;\n } | null>(null);\n const previousPartsRef = useRef<RenderBuildRequest | null>(null);\n\n const fetchRenderSprite = useCallback(\n async (currentParts: RenderBuildRequest) => {\n try {\n setIsRenderingSprite(true);\n setRenderError(null);\n onLoadStart?.();\n\n const mode = options?.mode ?? \"async\";\n if (mode === \"experimental\") {\n const response = await renderSpriteExperimental(\n currentParts,\n apiConfig\n );\n const objectUrl = URL.createObjectURL(response.sprite);\n\n // Clean up previous sprite URL before setting new one\n setSpriteSrc((prevSrc) => {\n if (prevSrc && prevSrc.startsWith(\"blob:\")) {\n URL.revokeObjectURL(prevSrc);\n }\n return objectUrl;\n });\n\n // Set sprite metadata\n setSpriteMetadata({\n cols: response.metadata?.cols || 12,\n rows: response.metadata?.rows || 6,\n totalFrames: response.metadata?.totalFrames || 72,\n });\n } else {\n // Async job-based flow: request sprite format and use returned URL\n const { videoUrl: spriteUrl } = await renderBuild(\n { ...currentParts, format: \"sprite\" },\n apiConfig\n );\n\n setSpriteSrc((prevSrc) => {\n if (prevSrc && prevSrc.startsWith(\"blob:\")) {\n URL.revokeObjectURL(prevSrc);\n }\n return spriteUrl;\n });\n\n // No metadata from async endpoint; keep defaults\n setSpriteMetadata({ cols: 12, rows: 6, totalFrames: 72 });\n }\n } catch (error) {\n setRenderError(\n error instanceof Error ? error.message : \"Failed to render sprite\"\n );\n } finally {\n setIsRenderingSprite(false);\n }\n },\n [apiConfig, onLoadStart, options?.mode]\n );\n\n // Effect to call API when parts content changes (using custom equality check)\n useEffect(() => {\n const shouldFetch =\n previousPartsRef.current === null ||\n !arePartsEqual(previousPartsRef.current, parts);\n\n if (shouldFetch) {\n previousPartsRef.current = parts;\n fetchRenderSprite(parts);\n }\n }, [parts, fetchRenderSprite]);\n\n // Cleanup effect for component unmount\n useEffect(() => {\n return () => {\n if (spriteSrc && spriteSrc.startsWith(\"blob:\")) {\n URL.revokeObjectURL(spriteSrc);\n }\n };\n }, [spriteSrc]);\n\n return {\n spriteSrc,\n isRenderingSprite,\n renderError,\n spriteMetadata,\n };\n};\n","import React from \"react\";\n\ninterface LoadingErrorOverlayProps {\n isVisible: boolean;\n renderError?: string;\n size: number;\n}\n\nexport const LoadingErrorOverlay: React.FC<LoadingErrorOverlayProps> = ({\n isVisible,\n renderError,\n size,\n}) => {\n if (!isVisible) return null;\n\n return (\n <div\n style={{\n position: \"absolute\",\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n backgroundColor: \"rgba(0, 0, 0, 1)\",\n display: \"flex\",\n flexDirection: \"column\",\n alignItems: \"center\",\n justifyContent: \"center\",\n color: \"white\",\n zIndex: 10,\n }}\n >\n {renderError ? (\n <>\n <div\n style={{ marginBottom: \"20px\", fontSize: \"18px\", color: \"white\" }}\n >\n Render Failed\n </div>\n <div\n style={{\n fontSize: \"14px\",\n textAlign: \"center\",\n maxWidth: size * 0.8,\n color: \"white\",\n }}\n >\n {renderError}\n </div>\n </>\n ) : (\n <>\n <div\n style={{ marginBottom: \"20px\", fontSize: \"18px\", color: \"white\" }}\n >\n {\"Loading Build...\"}\n </div>\n </>\n )}\n </div>\n );\n};\n","import React from \"react\";\n\ninterface DragIconProps {\n width?: number;\n height?: number;\n className?: string;\n style?: React.CSSProperties;\n}\n\nexport const DragIcon: React.FC<DragIconProps> = ({\n width = 24,\n height = 24,\n className,\n style,\n ...props\n}) => {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n id=\"Layer_1\"\n width={width}\n height={height}\n data-name=\"Layer 1\"\n viewBox=\"0 0 24 24\"\n className={className}\n style={style}\n {...props}\n >\n <defs>\n <style>\n {\n \".cls-1{fill:none;stroke:currentColor;stroke-miterlimit:10;stroke-width:1.91px}\"\n }\n </style>\n </defs>\n <path\n d=\"m11.05 22.5-5.14-5.14a2 2 0 0 1-.59-1.43 2 2 0 0 1 2-2 2 2 0 0 1 1.43.59l1.32 1.32V6.38a2 2 0 0 1 1.74-2 1.89 1.89 0 0 1 1.52.56 1.87 1.87 0 0 1 .56 1.34V12l5 .72a1.91 1.91 0 0 1 1.64 1.89 17.18 17.18 0 0 1-1.82 7.71l-.09.18M19.64 7.23l2.86-2.87-2.86-2.86M15.82 4.36h6.68M4.36 7.23 1.5 4.36 4.36 1.5M8.18 4.36H1.5\"\n className=\"cls-1\"\n />\n </svg>\n );\n};\n","import React from \"react\";\nimport { DragIcon } from \"./DragIcon\";\n\ninterface InstructionTooltipProps {\n isVisible: boolean;\n progressValue: number;\n instructionIcon?: string;\n}\n\nexport const InstructionTooltip: React.FC<InstructionTooltipProps> = ({\n isVisible,\n progressValue,\n instructionIcon,\n}) => {\n if (!isVisible) {\n return null;\n }\n\n return (\n <div\n style={{\n position: \"absolute\",\n top: \"50%\",\n left: \"50%\",\n transform: `translate(-50%, -50%) translateX(${progressValue * 50}px)`,\n backgroundColor: \"rgba(0, 0, 0, 0.8)\",\n color: \"white\",\n padding: \"12px\",\n borderRadius: \"8px\",\n pointerEvents: \"none\",\n zIndex: 5,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n }}\n >\n {instructionIcon ? (\n <img\n src={instructionIcon}\n alt=\"drag to view 360\"\n style={{\n width: \"24px\",\n height: \"24px\",\n filter: \"invert(1)\", // Makes the icon white\n }}\n />\n ) : (\n <DragIcon\n width={24}\n height={24}\n style={{\n color: \"white\",\n }}\n />\n )}\n </div>\n );\n};\n","import { useRef, useState, useCallback, useEffect } from \"react\";\nimport { useSpriteScrubbing } from \"./hooks/useSpriteScrubbing\";\nimport { useBouncePatternProgress } from \"./hooks/useProgressOneSecond\";\nimport { useSpriteRender } from \"./hooks/useSpriteRender\";\nimport { BuildRenderProps } from \"./types\";\nimport { LoadingErrorOverlay } from \"./components/LoadingErrorOverlay\";\nimport { InstructionTooltip } from \"./components/InstructionTooltip\";\n\nexport const BuildRender: React.FC<BuildRenderProps> = ({\n parts,\n width,\n height,\n size,\n apiConfig,\n useSpriteRenderOptions,\n mouseSensitivity = 0.2,\n touchSensitivity = 0.2,\n}) => {\n const canvasRef = useRef<HTMLCanvasElement | null>(null);\n const [img, setImg] = useState<HTMLImageElement | null>(null);\n const [isLoading, setIsLoading] = useState(true);\n const [bouncingAllowed, setBouncingAllowed] = useState(false);\n\n const displayW = width ?? size ?? 300;\n const displayH = height ?? size ?? 300;\n\n // Use custom hook for sprite rendering\n const { spriteSrc, isRenderingSprite, renderError, spriteMetadata } =\n useSpriteRender(parts, apiConfig, undefined, useSpriteRenderOptions);\n\n const { value: progressValue, isBouncing } =\n useBouncePatternProgress(bouncingAllowed);\n\n const total = spriteMetadata ? spriteMetadata.totalFrames : 72;\n const cols = spriteMetadata ? spriteMetadata.cols : 12;\n const rows = spriteMetadata ? spriteMetadata.rows : 6;\n const frameRef = useRef(0);\n\n // Image/frame sizes\n const frameW = img ? img.width / cols : 0;\n const frameH = img ? img.height / rows : 0;\n\n // ---- Load sprite image ----\n useEffect(() => {\n if (!spriteSrc) {\n setImg(null);\n setIsLoading(true);\n return;\n }\n\n setIsLoading(true);\n const i = new Image();\n i.decoding = \"async\";\n i.loading = \"eager\";\n i.src = spriteSrc;\n i.onload = () => {\n setImg(i);\n setIsLoading(false);\n // Start bouncing animation after delay\n setTimeout(() => {\n setBouncingAllowed(true);\n }, 2000);\n };\n i.onerror = () => {\n setImg(null);\n setIsLoading(false);\n };\n }, [spriteSrc]);\n\n // ---- Drawing function ----\n const draw = useCallback(\n (frameIndex: number) => {\n const cnv = canvasRef.current;\n if (!cnv || !img || !frameW || !frameH) return;\n\n const ctx = cnv.getContext(\"2d\");\n if (!ctx) return;\n\n // Backing store sized for HiDPI; CSS size stays `size`\n const dpr = Math.max(1, window.devicePixelRatio || 1);\n const targetW = Math.round(displayW * dpr);\n const targetH = Math.round(displayH * dpr);\n if (cnv.width !== targetW || cnv.height !== targetH) {\n cnv.width = targetW;\n cnv.height = targetH;\n }\n\n // Snap to integer frame (never between tiles)\n let n = Math.round(frameIndex) % total;\n if (n < 0) n += total;\n\n const r = Math.floor(n / cols);\n const c = n % cols;\n\n // Use integer source rects to avoid sampling bleed across tiles\n const sx = Math.round(c * frameW);\n const sy = Math.round(r * frameH);\n const sw = Math.round(frameW);\n const sh = Math.round(frameH);\n\n ctx.clearRect(0, 0, targetW, targetH);\n ctx.imageSmoothingEnabled = true;\n ctx.imageSmoothingQuality = \"high\";\n ctx.drawImage(img, sx, sy, sw, sh, 0, 0, targetW, targetH);\n },\n [img, frameW, frameH, displayW, displayH, cols, total]\n );\n\n const { isDragging, handleMouseDown, handleTouchStart, hasDragged } =\n useSpriteScrubbing(canvasRef, total, {\n mouseSensitivity,\n touchSensitivity,\n onFrameChange: (newFrame: number) => {\n frameRef.current = newFrame;\n draw(newFrame);\n },\n });\n\n const handleLoadStartInternal = useCallback(() => {\n setIsLoading(true);\n setBouncingAllowed(false);\n }, []);\n\n // Auto-rotate when bouncing is allowed and not dragged\n useEffect(() => {\n if (hasDragged.current || !img) return;\n\n // Calculate frame based on progress value (similar to video time calculation)\n const frame = ((progressValue / 5) * total) % total;\n frameRef.current = frame;\n draw(frame);\n }, [progressValue, hasDragged, img, total, draw]);\n\n // Initial draw once image is ready\n useEffect(() => {\n if (img && !isLoading) {\n draw(frameRef.current);\n }\n }, [img, isLoading, draw]);\n\n return (\n <div\n style={{\n position: \"relative\",\n width: displayW,\n height: displayH,\n backgroundColor: \"black\",\n }}\n >\n {img && (\n <canvas\n ref={canvasRef}\n onMouseDown={handleMouseDown}\n onTouchStart={handleTouchStart}\n style={{\n width: displayW,\n height: displayH,\n cursor: isDragging ? \"grabbing\" : \"grab\",\n touchAction: \"none\", // Prevents default touch behaviors like scrolling\n display: \"block\",\n userSelect: \"none\",\n WebkitUserSelect: \"none\",\n WebkitTouchCallout: \"none\",\n }}\n role=\"img\"\n aria-label=\"360° viewer\"\n onContextMenu={(e) => e.preventDefault()}\n />\n )}\n\n <LoadingErrorOverlay\n isVisible={isLoading || isRenderingSprite || !!renderError}\n renderError={renderError || undefined}\n size={Math.min(displayW, displayH)}\n />\n\n <InstructionTooltip\n isVisible={\n !isLoading &&\n !isRenderingSprite &&\n !renderError &&\n isBouncing &&\n !hasDragged.current\n }\n progressValue={progressValue}\n />\n </div>\n );\n};\n","import {\n useState,\n useRef,\n useEffect,\n useCallback,\n type RefObject,\n} from \"react\";\n\n// Helper to extract clientX from mouse or touch events\nconst getClientX = (e: MouseEvent | TouchEvent): number => {\n return \"touches\" in e ? e.touches[0].clientX : e.clientX;\n};\n\n// Helper to calculate new video time with circular wrapping\nexport const calculateCircularTime = (\n startTime: number,\n deltaX: number,\n sensitivity: number,\n duration: number\n): number => {\n const timeDelta = deltaX * sensitivity;\n let newTime = startTime + timeDelta;\n\n // Make it circular - wrap around when going past boundaries\n newTime = newTime % duration;\n if (newTime < 0) {\n newTime += duration;\n }\n\n return newTime;\n};\n\ninterface UseVideoScrubbingOptions {\n mouseSensitivity?: number;\n touchSensitivity?: number;\n progressSensitivity?: number;\n useProgressScrubbing?: boolean;\n}\n\nexport const useVideoScrubbing = (\n videoRef: RefObject<HTMLVideoElement | null>,\n options: UseVideoScrubbingOptions = {}\n) => {\n const { mouseSensitivity = 0.01, touchSensitivity = 0.01 } = options;\n\n const [isDragging, setIsDragging] = useState(false);\n const [dragStartX, setDragStartX] = useState(0);\n const [dragStartTime, setDragStartTime] = useState(0);\n const hasDragged = useRef(false);\n\n // Helper to start dragging (common logic for mouse and touch)\n const startDrag = useCallback(\n (clientX: number, event: Event) => {\n if (!videoRef.current) return;\n\n setIsDragging(true);\n setDragStartX(clientX);\n setDragStartTime(videoRef.current.currentTime);\n hasDragged.current = true;\n event.preventDefault();\n },\n [videoRef]\n );\n\n // Helper to handle drag movement (common logic for mouse and touch)\n const handleDragMove = useCallback(\n (clientX: number, sensitivity: number) => {\n if (!isDragging || !videoRef.current) return;\n\n const deltaX = clientX - dragStartX;\n const duration = videoRef.current.duration || 0;\n\n if (duration > 0) {\n const newTime = calculateCircularTime(\n dragStartTime,\n deltaX,\n sensitivity,\n duration\n );\n videoRef.current.currentTime = newTime;\n }\n },\n [isDragging, dragStartX, dragStartTime, videoRef]\n );\n\n // Helper to end dragging (common logic for mouse and touch)\n const endDrag = useCallback(() => {\n setIsDragging(false);\n }, []);\n\n const handleMouseDown = useCallback(\n (e: React.MouseEvent) => {\n startDrag(e.clientX, e.nativeEvent);\n },\n [startDrag]\n );\n\n const handleTouchStart = useCallback(\n (e: React.TouchEvent) => {\n startDrag(e.touches[0].clientX, e.nativeEvent);\n },\n [startDrag]\n );\n\n const handleDocumentMouseMove = useCallback(\n (e: MouseEvent) => {\n handleDragMove(getClientX(e), mouseSensitivity);\n },\n [handleDragMove, mouseSensitivity]\n );\n\n const handleDocumentTouchMove = useCallback(\n (e: TouchEvent) => {\n handleDragMove(getClientX(e), touchSensitivity);\n },\n [handleDragMove, touchSensitivity]\n );\n\n const handleDocumentMouseUp = useCallback(() => {\n endDrag();\n }, [endDrag]);\n\n const handleDocumentTouchEnd = useCallback(() => {\n endDrag();\n }, [endDrag]);\n\n // Add document-level event listeners when dragging starts\n useEffect(() => {\n if (isDragging) {\n document.addEventListener(\"mousemove\", handleDocumentMouseMove);\n document.addEventListener(\"mouseup\", handleDocumentMouseUp);\n document.addEventListener(\"touchmove\", handleDocumentTouchMove);\n document.addEventListener(\"touchend\", handleDocumentTouchEnd);\n\n return () => {\n document.removeEventListener(\"mousemove\", handleDocumentMouseMove);\n document.removeEventListener(\"mouseup\", handleDocumentMouseUp);\n document.removeEventListener(\"touchmove\", handleDocumentTouchMove);\n document.removeEventListener(\"touchend\", handleDocumentTouchEnd);\n };\n }\n }, [\n isDragging,\n handleDocumentMouseMove,\n handleDocumentMouseUp,\n handleDocumentTouchMove,\n handleDocumentTouchEnd,\n ]);\n\n return {\n isDragging,\n handleMouseDown,\n handleTouchStart,\n hasDragged,\n };\n};\n","import { useRef, useState, useCallback, useEffect } from \"react\";\nimport {\n calculateCircularTime,\n useVideoScrubbing,\n} from \"./hooks/useVideoScrubbing\";\nimport { useBouncePatternProgress } from \"./hooks/useProgressOneSecond\";\nimport { useBuildRender } from \"./hooks/useBuildRender\";\nimport { BuildRenderVideoProps } from \"./types\";\nimport { LoadingErrorOverlay } from \"./components/LoadingErrorOverlay\";\nimport { InstructionTooltip } from \"./components/InstructionTooltip\";\n\nexport const BuildRenderVideo: React.FC<BuildRenderVideoProps> = ({\n parts,\n width,\n height,\n size,\n apiConfig,\n useBuildRenderOptions,\n mouseSensitivity = 0.01,\n touchSensitivity = 0.01,\n}) => {\n const videoRef = useRef<HTMLVideoElement | null>(null);\n const [isLoading, setIsLoading] = useState(true);\n const [bouncingAllowed, setBouncingAllowed] = useState(false);\n\n const displayW = width ?? size ?? 300;\n const displayH = height ?? size ?? 300;\n\n // Use custom hook for build rendering\n const { videoSrc, isRenderingBuild, renderError } = useBuildRender(\n parts,\n apiConfig,\n undefined,\n useBuildRenderOptions\n );\n\n const { value: progressValue, isBouncing } =\n useBouncePatternProgress(bouncingAllowed);\n\n const { isDragging, handleMouseDown, handleTouchStart, hasDragged } =\n useVideoScrubbing(videoRef, {\n mouseSensitivity,\n touchSensitivity,\n });\n\n const handleLoadStartInternal = useCallback(() => {\n setIsLoading(true);\n setBouncingAllowed(false);\n }, []);\n\n const handleCanPlayInternal = useCallback(() => {\n setIsLoading(false);\n // Start bouncing animation after delay\n setTimeout(() => {\n setBouncingAllowed(true);\n }, 2000);\n }, []);\n\n useEffect(() => {\n if (hasDragged.current || !videoRef.current) return;\n\n const duration = videoRef.current.duration;\n if (!isFinite(duration)) return;\n\n const time = calculateCircularTime(0, progressValue, 0.5, duration);\n\n if (isFinite(time)) {\n videoRef.current.currentTime = time;\n }\n }, [progressValue, hasDragged]);\n\n return (\n <div style={{ position: \"relative\", width: displayW, height: displayH }}>\n {videoSrc && (\n <video\n key={videoSrc} // Force React to recreate video element when src changes\n ref={videoRef}\n src={videoSrc} // Set src directly on video element\n width={displayW}\n height={displayH}\n autoPlay={true}\n preload=\"metadata\"\n muted\n playsInline\n controls={false}\n disablePictureInPicture\n controlsList=\"nodownload nofullscreen noremoteplayback\"\n {...({ \"x-webkit-airplay\": \"deny\" } as any)}\n onMouseDown={handleMouseDown}\n onTouchStart={handleTouchStart}\n onLoadStart={handleLoadStartInternal}\n onCanPlay={handleCanPlayInternal}\n onLoadedData={() => {\n if (videoRef.current) {\n videoRef.current.pause();\n }\n }}\n style={\n {\n cursor: isDragging ? \"grabbing\" : \"grab\",\n touchAction: \"none\", // Prevents default touch behaviors like scrolling\n display: \"block\",\n // Completely hide video controls on all browsers including mobile\n WebkitMediaControls: \"none\",\n MozMediaControls: \"none\",\n OMediaControls: \"none\",\n msMediaControls: \"none\",\n mediaControls: \"none\",\n // Additional iOS-specific properties\n WebkitTouchCallout: \"none\",\n WebkitUserSelect: \"none\",\n userSelect: \"none\",\n } as React.CSSProperties\n }\n >\n Your browser does not support the video tag.\n </video>\n )}\n\n <LoadingErrorOverlay\n isVisible={isLoading || isRenderingBuild || !!renderError}\n renderError={renderError || undefined}\n size={Math.min(displayW, displayH)}\n />\n\n <InstructionTooltip\n isVisible={\n !isLoading &&\n !isRenderingBuild &&\n !renderError &&\n isBouncing &&\n !hasDragged.current\n }\n progressValue={progressValue}\n />\n </div>\n );\n};\n"],"names":["getClientX","useState","useRef","useCallback","useEffect","createContext","useContext","PartCategory","_jsx","_jsxs","_Fragment"],"mappings":";;;;;AAQA;AACA,MAAMA,YAAU,GAAG,CAAC,CAA0B,KAAY;IACxD,OAAO,SAAS,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,OAAO;AAC1D,CAAC;AAED;AACO,MAAM,sBAAsB,GAAG,CACpC,UAAkB,EAClB,MAAc,EACd,WAAmB,EACnB,WAAmB,KACT;AACV,IAAA,MAAM,UAAU,GAAG,MAAM,GAAG,WAAW;AACvC,IAAA,IAAI,QAAQ,GAAG,UAAU,GAAG,UAAU;;AAGtC,IAAA,QAAQ,GAAG,QAAQ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,QAAQ,CAAC,OAAO,EAAE;AACpB,wBAAA,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE;oBAC1B;gBACF,CAAC,EACD,KAAK,EACH;oBACE,MAAM,EAAE,UAAU,GAAG,UAAU,GAAG,MAAM;oBACxC,WAAW,EAAE,MAAM;AACnB,oBAAA,OAAO,EAAE,OAAO;;AAEhB,oBAAA,mBAAmB,EAAE,MAAM;AAC3B,oBAAA,gBAAgB,EAAE,MAAM;AACxB,oBAAA,cAAc,EAAE,MAAM;AACtB,oBAAA,eAAe,EAAE,MAAM;AACvB,oBAAA,aAAa,EAAE,MAAM;;AAErB,oBAAA,kBAAkB,EAAE,MAAM;AAC1B,oBAAA,gBAAgB,EAAE,MAAM;AACxB,oBAAA,UAAU,EAAE,MAAM;AACI,iBAAA,EAAA,QAAA,EAAA,8CAAA,EAAA,EArCrB,QAAQ,CAyCP,CACT,EAEDA,cAAA,CAAC,mBAAmB,IAClB,SAAS,EAAE,SAAS,IAAI,gBAAgB,IAAI,CAAC,CAAC,WAAW,EACzD,WAAW,EAAE,WAAW,IAAI,SAAS,EACrC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAAA,CAClC,EAEFA,cAAA,CAAC,kBAAkB,IACjB,SAAS,EACP,CAAC,SAAS;AACV,oBAAA,CAAC,gBAAgB;AACjB,oBAAA,CAAC,WAAW;oBACZ,UAAU;oBACV,CAAC,UAAU,CAAC,OAAO,EAErB,aAAa,EAAE,aAAa,EAAA,CAC5B,CAAA,EAAA,CACE;AAEV;;;;;;;;;;;;;;;;;;;;;;;","x_google_ignoreList":[1,2,3,4,5,6,7]}
1
+ {"version":3,"file":"index.js","sources":["../src/hooks/useSpriteScrubbing.ts","../src/hooks/useProgressOneSecond.ts","../src/api.ts","../src/types.ts","../src/hooks/useBuildRender.ts","../src/hooks/useSpriteRender.ts","../src/components/LoadingErrorOverlay.tsx","../src/components/DragIcon.tsx","../src/components/InstructionTooltip.tsx","../src/BuildRender.tsx","../src/hooks/useVideoScrubbing.ts","../src/BuildRenderVideo.tsx"],"sourcesContent":["import {\n useState,\n useRef,\n useEffect,\n useCallback,\n type RefObject,\n} from \"react\";\n\n// Helper to extract clientX from mouse or touch events\nconst getClientX = (e: MouseEvent | TouchEvent): number => {\n return \"touches\" in e ? e.touches[0].clientX : e.clientX;\n};\n\n// Helper to calculate new frame with circular wrapping\nexport const calculateCircularFrame = (\n startFrame: number,\n deltaX: number,\n sensitivity: number,\n totalFrames: number\n): number => {\n const frameDelta = deltaX * sensitivity;\n let newFrame = startFrame + frameDelta;\n\n // Make it circular - wrap around when going past boundaries\n newFrame = newFrame % totalFrames;\n if (newFrame < 0) {\n newFrame += totalFrames;\n }\n\n return newFrame;\n};\n\ninterface UseSpiteScrubbingOptions {\n mouseSensitivity?: number;\n touchSensitivity?: number;\n onFrameChange?: (frame: number) => void;\n}\n\nexport const useSpriteScrubbing = (\n canvasRef: RefObject<HTMLCanvasElement | null>,\n totalFrames: number,\n options: UseSpiteScrubbingOptions = {}\n) => {\n const {\n mouseSensitivity = 0.1,\n touchSensitivity = 0.1,\n onFrameChange,\n } = options;\n\n const [isDragging, setIsDragging] = useState(false);\n const [dragStartX, setDragStartX] = useState(0);\n const [dragStartFrame, setDragStartFrame] = useState(0);\n const hasDragged = useRef(false);\n const currentFrame = useRef(0);\n\n // Helper to start dragging (common logic for mouse and touch)\n const startDrag = useCallback(\n (clientX: number, event: Event) => {\n if (!canvasRef.current) return;\n\n setIsDragging(true);\n setDragStartX(clientX);\n setDragStartFrame(currentFrame.current);\n hasDragged.current = true;\n event.preventDefault();\n },\n [canvasRef]\n );\n\n // Helper to handle drag movement (common logic for mouse and touch)\n const handleDragMove = useCallback(\n (clientX: number, sensitivity: number) => {\n if (!isDragging || !canvasRef.current) return;\n\n const deltaX = clientX - dragStartX;\n\n const newFrame = calculateCircularFrame(\n dragStartFrame,\n deltaX, // Positive for natural \"spin right\" feel\n sensitivity,\n totalFrames\n );\n\n currentFrame.current = newFrame;\n\n // Call the frame change callback if provided\n if (onFrameChange) {\n onFrameChange(newFrame);\n }\n\n return newFrame;\n },\n [isDragging, dragStartX, dragStartFrame, totalFrames, onFrameChange]\n );\n\n // Helper to end dragging (common logic for mouse and touch)\n const endDrag = useCallback(() => {\n setIsDragging(false);\n }, []);\n\n const handleMouseDown = useCallback(\n (e: React.MouseEvent) => {\n startDrag(e.clientX, e.nativeEvent);\n },\n [startDrag]\n );\n\n const handleTouchStart = useCallback(\n (e: React.TouchEvent) => {\n startDrag(e.touches[0].clientX, e.nativeEvent);\n },\n [startDrag]\n );\n\n const handleDocumentMouseMove = useCallback(\n (e: MouseEvent) => {\n return handleDragMove(getClientX(e), mouseSensitivity);\n },\n [handleDragMove, mouseSensitivity]\n );\n\n const handleDocumentTouchMove = useCallback(\n (e: TouchEvent) => {\n return handleDragMove(getClientX(e), touchSensitivity);\n },\n [handleDragMove, touchSensitivity]\n );\n\n const handleDocumentMouseUp = useCallback(() => {\n endDrag();\n }, [endDrag]);\n\n const handleDocumentTouchEnd = useCallback(() => {\n endDrag();\n }, [endDrag]);\n\n // Add document-level event listeners when dragging starts\n useEffect(() => {\n if (isDragging) {\n document.addEventListener(\"mousemove\", handleDocumentMouseMove);\n document.addEventListener(\"mouseup\", handleDocumentMouseUp);\n document.addEventListener(\"touchmove\", handleDocumentTouchMove);\n document.addEventListener(\"touchend\", handleDocumentTouchEnd);\n\n return () => {\n document.removeEventListener(\"mousemove\", handleDocumentMouseMove);\n document.removeEventListener(\"mouseup\", handleDocumentMouseUp);\n document.removeEventListener(\"touchmove\", handleDocumentTouchMove);\n document.removeEventListener(\"touchend\", handleDocumentTouchEnd);\n };\n }\n }, [\n isDragging,\n handleDocumentMouseMove,\n handleDocumentMouseUp,\n handleDocumentTouchMove,\n handleDocumentTouchEnd,\n ]);\n\n return {\n isDragging,\n handleMouseDown,\n handleTouchStart,\n hasDragged,\n currentFrame: currentFrame.current,\n setCurrentFrame: (frame: number) => {\n currentFrame.current = frame;\n },\n };\n};\n","import { useAnimationFrame } from \"framer-motion\";\nimport { useRef, useState } from \"react\";\n\nexport function useBouncePatternProgress(enabled = true) {\n const [value, setValue] = useState(0);\n const [isBouncing, setIsBouncing] = useState(false);\n const start = useRef<number | null>(null);\n\n useAnimationFrame((t) => {\n if (!enabled) {\n // Reset animation when disabled\n if (start.current !== null) {\n start.current = null;\n setValue(0);\n setIsBouncing(false);\n }\n return;\n }\n\n if (start.current === null) start.current = t;\n\n const elapsed = (t - start.current) % 3000; // 3s full cycle\n\n let progress = 0;\n const bouncing = elapsed < 1000; // Bouncing during first 1 second\n\n if (elapsed < 500) {\n // 0 → 1\n progress = elapsed / 500;\n } else if (elapsed < 1000) {\n // 1 → 0\n progress = 1 - (elapsed - 500) / 500;\n } else {\n // Pause at 0 for 2 seconds\n progress = 0;\n }\n\n setValue(progress);\n setIsBouncing(bouncing);\n });\n\n return { value, isBouncing };\n}\n","import { RenderBuildRequest, AvailablePartsResponse, ApiConfig, PartCategory, GetAvailablePartsOptions } from \"./types\";\n\n// API Configuration\nconst API_BASE_URL = \"https://www.renderapi.buildcores.com\";\n\n// API Endpoints\nexport const API_ENDPOINTS = {\n RENDER_BUILD_EXPERIMENTAL: \"/render-build-experimental\",\n RENDER_BUILD: \"/render-build\",\n AVAILABLE_PARTS: \"/available-parts\",\n} as const;\n\n// API Response Types\nexport interface RenderBuildResponse {\n /**\n * The rendered MP4 video as a Blob (when format is \"video\")\n */\n video: Blob;\n /**\n * Optional metadata about the render\n */\n metadata?: {\n duration?: number;\n size?: number;\n format?: string;\n };\n}\n\n// Async render job types (new endpoints)\nexport interface RenderJobCreateResponse {\n job_id: string;\n status: \"queued\" | \"processing\" | \"completed\" | \"error\";\n}\n\nexport interface RenderJobStatusResponse {\n job_id: string;\n status: \"queued\" | \"processing\" | \"completed\" | \"error\";\n url?: string | null;\n video_url?: string | null;\n sprite_url?: string | null;\n error?: string | null;\n end_time?: string | null;\n}\n\nexport interface RenderBuildAsyncResponse {\n /** Final URL to the rendered MP4 (or sprite) asset */\n videoUrl: string;\n}\n\nexport interface RenderSpriteResponse {\n /**\n * The rendered sprite sheet as a Blob (when format is \"sprite\")\n */\n sprite: Blob;\n /**\n * Sprite sheet metadata\n */\n metadata?: {\n cols?: number;\n rows?: number;\n totalFrames?: number;\n size?: number;\n format?: string;\n };\n}\n\n// API Functions (definitions only - not implemented yet)\nexport interface RenderAPIService {\n /**\n * Submit a render build request\n * @param parts - The parts configuration for the build\n * @param config - API configuration (environment, auth token) - required\n * @returns Promise with the rendered MP4 video\n */\n renderBuildExperimental(\n parts: RenderBuildRequest,\n config: ApiConfig\n ): Promise<RenderBuildResponse>;\n\n /**\n * Get available parts for building\n * @param config - API configuration (environment, auth token) - required\n * @returns Promise with available parts by category\n */\n getAvailableParts(\n category: PartCategory,\n config: ApiConfig,\n options?: GetAvailablePartsOptions\n ): Promise<AvailablePartsResponse>;\n}\n\n// API URL helpers\nexport const buildApiUrl = (endpoint: string, config: ApiConfig): string => {\n const baseUrl = `${API_BASE_URL}${endpoint}`;\n if (config.environment) {\n const separator = endpoint.includes(\"?\") ? \"&\" : \"?\";\n return `${baseUrl}${separator}environment=${config.environment}`;\n }\n return baseUrl;\n};\n\n// Helper to build request headers with auth token\nexport const buildHeaders = (config: ApiConfig): Record<string, string> => {\n const headers: Record<string, string> = {\n \"Content-Type\": \"application/json\",\n accept: \"application/json\",\n };\n\n if (config.authToken) {\n headers[\"Authorization\"] = `Bearer ${config.authToken}`;\n }\n\n return headers;\n};\n\nconst sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));\n\n// API Implementation\nexport const renderBuildExperimental = async (\n request: RenderBuildRequest,\n config: ApiConfig\n): Promise<RenderBuildResponse> => {\n const requestWithFormat = {\n ...request,\n format: request.format || \"video\", // Default to video format\n // Include width and height if provided\n ...(request.width !== undefined ? { width: request.width } : {}),\n ...(request.height !== undefined ? { height: request.height } : {}),\n };\n\n const response = await fetch(\n buildApiUrl(API_ENDPOINTS.RENDER_BUILD_EXPERIMENTAL, config),\n {\n method: \"POST\",\n headers: buildHeaders(config),\n body: JSON.stringify(requestWithFormat),\n }\n );\n\n if (!response.ok) {\n throw new Error(\n `Render build failed: ${response.status} ${response.statusText}`\n );\n }\n\n const video = await response.blob();\n\n return {\n video,\n metadata: {\n size: video.size,\n format: \"video/mp4\",\n },\n };\n};\n\n// New async endpoints implementation\nexport const createRenderBuildJob = async (\n request: RenderBuildRequest,\n config: ApiConfig\n): Promise<RenderJobCreateResponse> => {\n const body = {\n parts: request.parts,\n // If provided, forward format; default handled server-side but we keep explicit default\n ...(request.format ? { format: request.format } : {}),\n // Include width and height if provided\n ...(request.width !== undefined ? { width: request.width } : {}),\n ...(request.height !== undefined ? { height: request.height } : {}),\n };\n\n const response = await fetch(buildApiUrl(API_ENDPOINTS.RENDER_BUILD, config), {\n method: \"POST\",\n headers: buildHeaders(config),\n body: JSON.stringify(body),\n });\n\n if (!response.ok) {\n throw new Error(`Create render job failed: ${response.status} ${response.statusText}`);\n }\n\n const data = (await response.json()) as RenderJobCreateResponse;\n if (!data?.job_id) {\n throw new Error(\"Create render job failed: missing job_id in response\");\n }\n return data;\n};\n\nexport const getRenderBuildStatus = async (\n jobId: string,\n config: ApiConfig\n): Promise<RenderJobStatusResponse> => {\n const url = buildApiUrl(`${API_ENDPOINTS.RENDER_BUILD}/${encodeURIComponent(jobId)}`, config);\n const response = await fetch(url, {\n method: \"GET\",\n headers: buildHeaders(config),\n });\n\n if (response.status === 404) {\n throw new Error(\"Render job not found\");\n }\n if (!response.ok) {\n throw new Error(`Get render job status failed: ${response.status} ${response.statusText}`);\n }\n\n return (await response.json()) as RenderJobStatusResponse;\n};\n\nexport const renderBuild = async (\n request: RenderBuildRequest,\n config: ApiConfig,\n options?: { pollIntervalMs?: number; timeoutMs?: number }\n): Promise<RenderBuildAsyncResponse> => {\n const pollIntervalMs = options?.pollIntervalMs ?? 1500;\n const timeoutMs = options?.timeoutMs ?? 120_000; // 2 minutes default\n\n const { job_id } = await createRenderBuildJob(request, config);\n\n const start = Date.now();\n // Poll until completed or error or timeout\n for (;;) {\n const status = await getRenderBuildStatus(job_id, config);\n if (status.status === \"completed\") {\n const requestedFormat = request.format ?? \"video\";\n const finalUrl =\n (requestedFormat === \"sprite\"\n ? status.sprite_url || status.url || undefined\n : status.video_url || status.url || undefined);\n if (!finalUrl) {\n throw new Error(\"Render job completed but no URL returned\");\n }\n return { videoUrl: finalUrl };\n }\n if (status.status === \"error\") {\n throw new Error(status.error || \"Render job failed\");\n }\n\n if (Date.now() - start > timeoutMs) {\n throw new Error(\"Timed out waiting for render job to complete\");\n }\n\n await sleep(pollIntervalMs);\n }\n};\n\nexport const renderSpriteExperimental = async (\n request: RenderBuildRequest,\n config: ApiConfig\n): Promise<RenderSpriteResponse> => {\n const requestWithFormat = {\n ...request,\n format: \"sprite\",\n // Include width and height if provided\n ...(request.width !== undefined ? { width: request.width } : {}),\n ...(request.height !== undefined ? { height: request.height } : {}),\n };\n\n const response = await fetch(\n buildApiUrl(API_ENDPOINTS.RENDER_BUILD_EXPERIMENTAL, config),\n {\n method: \"POST\",\n headers: buildHeaders(config),\n body: JSON.stringify(requestWithFormat),\n }\n );\n\n if (!response.ok) {\n throw new Error(\n `Render sprite failed: ${response.status} ${response.statusText}`\n );\n }\n\n const sprite = await response.blob();\n\n return {\n sprite,\n metadata: {\n cols: 12, // Default sprite grid - could be returned from API\n rows: 6,\n totalFrames: 72,\n size: sprite.size,\n format: \"image/webp\",\n },\n };\n};\n\nexport const getAvailableParts = async (\n category: PartCategory,\n config: ApiConfig,\n options?: GetAvailablePartsOptions\n): Promise<AvailablePartsResponse> => {\n const base = buildApiUrl(API_ENDPOINTS.AVAILABLE_PARTS, config);\n const params = new URLSearchParams();\n params.set(\"category\", category);\n if (typeof options?.limit === \"number\") params.set(\"limit\", String(options.limit));\n if (typeof options?.skip === \"number\") params.set(\"skip\", String(options.skip));\n const separator = base.includes(\"?\") ? \"&\" : \"?\";\n const url = `${base}${separator}${params.toString()}`;\n\n const response = await fetch(url, {\n method: \"GET\",\n headers: buildHeaders(config),\n });\n\n if (!response.ok) {\n throw new Error(\n `Get available parts failed: ${response.status} ${response.statusText}`\n );\n }\n\n return (await response.json()) as AvailablePartsResponse;\n};\n\n// Export the base URL for external use\nexport { API_BASE_URL };\n","export interface BuildRenderVideoProps {\n /**\n * Parts configuration for the build render.\n *\n * This object defines which PC components should be included in the 3D render.\n * Each part category contains an array with a single part ID that will be rendered.\n *\n * **Current Limitation**: Only 1 part per category is supported. Arrays must contain\n * exactly one part ID per category. Future versions will support multiple parts per category.\n *\n * @example\n * ```tsx\n * const parts = {\n * parts: {\n * CPU: [\"7xjqsomhr\"], // AMD Ryzen 7 9800X3D\n * GPU: [\"z7pyphm9k\"], // ASUS GeForce RTX 5080 ASTRAL\n * RAM: [\"dpl1iyvb5\"], // PNY DDR5\n * Motherboard: [\"iwin2u9vx\"], // Asus ROG STRIX X870E-E GAMING WIFI\n * PSU: [\"m4kilv190\"], // LIAN LI 1300W\n * Storage: [\"0bkvs17po\"], // SAMSUNG 990 EVO\n * PCCase: [\"qq9jamk7c\"], // MONTECH KING 95 PRO\n * CPUCooler: [\"62d8zelr5\"], // ARCTIC LIQUID FREEZER 360\n * }\n * };\n *\n * <BuildRender parts={parts} size={300} />\n * ```\n *\n * @example Minimal build (only required components)\n * ```tsx\n * const parts = {\n * parts: {\n * CPU: [\"7xjqsomhr\"], // Single CPU required\n * Motherboard: [\"iwin2u9vx\"], // Single motherboard required\n * PCCase: [\"qq9jamk7c\"], // Single case required\n * }\n * };\n * ```\n *\n * Note: Part IDs must correspond to valid components in the BuildCores database.\n * Use the available parts API to get valid part IDs for each category.\n */\n parts: RenderBuildRequest;\n\n /**\n * Width and height in pixels. If only `size` is provided, both width and height use it.\n * If `width`/`height` are provided, they override `size` individually.\n */\n width?: number;\n height?: number;\n size?: number;\n\n /**\n * API configuration for environment and authentication.\n * This is required to make API calls to the BuildCores rendering service.\n *\n * @example\n * ```tsx\n * <BuildRender\n * parts={parts}\n * size={300}\n * apiConfig={{\n * environment: 'staging',\n * authToken: 'your-auth-token'\n * }}\n * />\n * ```\n */\n apiConfig: ApiConfig;\n\n /**\n * Options to configure the internal useBuildRender hook\n * (e.g., choose async vs experimental rendering flow)\n */\n useBuildRenderOptions?: {\n mode?: \"async\" | \"experimental\";\n };\n\n /**\n * Optional mouse sensitivity for dragging (default: 0.005).\n *\n * Controls how responsive the 3D model rotation is to mouse movements.\n * Lower values make rotation slower and more precise, higher values make it faster.\n *\n * @example\n * ```tsx\n * <BuildRender\n * parts={parts}\n * size={300}\n * mouseSensitivity={0.003} // Slower, more precise\n * />\n *\n * <BuildRender\n * parts={parts}\n * size={300}\n * mouseSensitivity={0.01} // Faster rotation\n * />\n * ```\n *\n * @default 0.005\n */\n mouseSensitivity?: number;\n\n /**\n * Optional touch sensitivity for dragging (default: 0.01).\n *\n * Controls how responsive the 3D model rotation is to touch gestures on mobile devices.\n * Generally set higher than mouseSensitivity for better touch experience.\n *\n * @example\n * ```tsx\n * <BuildRender\n * parts={parts}\n * size={300}\n * touchSensitivity={0.008} // Slower touch rotation\n * />\n *\n * <BuildRender\n * parts={parts}\n * size={300}\n * touchSensitivity={0.015} // Faster touch rotation\n * />\n * ```\n *\n * @default 0.01\n */\n touchSensitivity?: number;\n}\n\nexport interface BuildRenderProps {\n /**\n * Parts configuration for the sprite render.\n *\n * This object defines which PC components should be included in the 3D sprite render.\n * Each part category contains an array with a single part ID that will be rendered.\n *\n * **Current Limitation**: Only 1 part per category is supported. Arrays must contain\n * exactly one part ID per category. Future versions will support multiple parts per category.\n *\n * @example\n * ```tsx\n * const parts = {\n * parts: {\n * CPU: [\"7xjqsomhr\"], // AMD Ryzen 7 9800X3D\n * GPU: [\"z7pyphm9k\"], // ASUS GeForce RTX 5080 ASTRAL\n * RAM: [\"dpl1iyvb5\"], // PNY DDR5\n * Motherboard: [\"iwin2u9vx\"], // Asus ROG STRIX X870E-E GAMING WIFI\n * PSU: [\"m4kilv190\"], // LIAN LI 1300W\n * Storage: [\"0bkvs17po\"], // SAMSUNG 990 EVO\n * PCCase: [\"qq9jamk7c\"], // MONTECH KING 95 PRO\n * CPUCooler: [\"62d8zelr5\"], // ARCTIC LIQUID FREEZER 360\n * }\n * };\n *\n * <SpriteRender parts={parts} size={300} />\n * ```\n */\n parts: RenderBuildRequest;\n\n /**\n * Width and height in pixels. If only `size` is provided, both width and height use it.\n * If `width`/`height` are provided, they override `size` individually.\n */\n width?: number;\n height?: number;\n size?: number;\n\n /**\n * API configuration for environment and authentication.\n * This is required to make API calls to the BuildCores rendering service.\n *\n * @example\n * ```tsx\n * <SpriteRender\n * parts={parts}\n * size={300}\n * apiConfig={{\n * environment: 'staging',\n * authToken: 'your-auth-token'\n * }}\n * />\n * ```\n */\n apiConfig: ApiConfig;\n\n /**\n * Options to configure the internal useSpriteRender hook\n * (e.g., choose async vs experimental rendering flow)\n */\n useSpriteRenderOptions?: {\n mode?: \"async\" | \"experimental\";\n };\n\n /**\n * Optional mouse sensitivity for dragging (default: 0.05).\n *\n * Controls how responsive the 3D model rotation is to mouse movements.\n * Lower values make rotation slower and more precise, higher values make it faster.\n *\n * @default 0.2\n */\n mouseSensitivity?: number;\n\n /**\n * Optional touch sensitivity for dragging (default: 0.02).\n *\n * Controls how responsive the 3D model rotation is to touch gestures on mobile devices.\n * Generally set similar to mouseSensitivity for consistent experience.\n *\n * @default 0.2\n */\n touchSensitivity?: number;\n}\n\n// API Types\n\n/**\n * API configuration for environment and authentication\n */\nexport interface ApiConfig {\n /**\n * Environment to use for API requests\n * - 'staging': Development/testing environment\n * - 'prod': Production environment\n *\n * @example\n * ```tsx\n * const config: ApiConfig = {\n * environment: 'staging',\n * authToken: 'your-bearer-token'\n * };\n * ```\n */\n environment?: \"staging\" | \"prod\";\n\n /**\n * Bearer token for API authentication\n *\n * @example\n * ```tsx\n * const config: ApiConfig = {\n * environment: 'prod',\n * authToken: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'\n * };\n * ```\n */\n authToken?: string;\n}\n\n/**\n * Enum defining all available PC part categories that can be rendered.\n *\n * Each category represents a different type of computer component that can be\n * included in the 3D build visualization.\n *\n * @example\n * ```tsx\n * // All available categories\n * const categories = [\n * PartCategory.CPU, // \"CPU\"\n * PartCategory.GPU, // \"GPU\"\n * PartCategory.RAM, // \"RAM\"\n * PartCategory.Motherboard,// \"Motherboard\"\n * PartCategory.PSU, // \"PSU\"\n * PartCategory.Storage, // \"Storage\"\n * PartCategory.PCCase, // \"PCCase\"\n * PartCategory.CPUCooler, // \"CPUCooler\"\n * ];\n * ```\n */\nexport enum PartCategory {\n /** Central Processing Unit - The main processor */\n CPU = \"CPU\",\n /** Graphics Processing Unit - Video card for rendering */\n GPU = \"GPU\",\n /** Random Access Memory - System memory modules */\n RAM = \"RAM\",\n /** Main circuit board that connects all components */\n Motherboard = \"Motherboard\",\n /** Power Supply Unit - Provides power to all components */\n PSU = \"PSU\",\n /** Storage devices like SSDs, HDDs, NVMe drives */\n Storage = \"Storage\",\n /** PC Case - The enclosure that houses all components */\n PCCase = \"PCCase\",\n /** CPU Cooler - Air or liquid cooling for the processor */\n CPUCooler = \"CPUCooler\",\n}\n\n/**\n * Request structure for rendering a PC build.\n *\n * This interface defines the parts configuration that will be sent to the\n * rendering service to generate a 3D visualization of a PC build.\n *\n * **Current Limitation**: Only one part per category is supported. Each category\n * array must contain exactly one part ID. Future versions will support multiple\n * parts per category for comparison views.\n *\n * @example Basic build configuration\n * ```tsx\n * const buildRequest: RenderBuildRequest = {\n * parts: {\n * CPU: [\"7xjqsomhr\"], // AMD Ryzen 7 9800X3D\n * GPU: [\"z7pyphm9k\"], // ASUS GeForce RTX 5080 ASTRAL\n * RAM: [\"dpl1iyvb5\"], // PNY DDR5\n * Motherboard: [\"iwin2u9vx\"], // Asus ROG STRIX X870E-E GAMING WIFI\n * PSU: [\"m4kilv190\"], // LIAN LI 1300W\n * Storage: [\"0bkvs17po\"], // SAMSUNG 990 EVO\n * PCCase: [\"qq9jamk7c\"], // MONTECH KING 95 PRO\n * CPUCooler: [\"62d8zelr5\"], // ARCTIC LIQUID FREEZER 360\n * },\n * format: \"video\" // Request video format\n * };\n * ```\n *\n * @example Sprite format request\n * ```tsx\n * const spriteRequest: RenderBuildRequest = {\n * parts: {\n * CPU: [\"7xjqsomhr\"], // AMD Ryzen 7 9800X3D\n * GPU: [\"z7pyphm9k\"], // ASUS GeForce RTX 5080 ASTRAL\n * RAM: [\"dpl1iyvb5\"], // PNY DDR5\n * Motherboard: [\"iwin2u9vx\"], // Asus ROG STRIX X870E-E GAMING WIFI\n * },\n * format: \"sprite\" // Request sprite sheet format\n * };\n * ```\n */\nexport interface RenderBuildRequest {\n /**\n * Object mapping part categories to arrays of part IDs.\n *\n * **Current Requirements**:\n * - Keys are part categories (CPU, GPU, RAM, etc.)\n * - Values are arrays containing exactly one part ID string\n * - All categories are optional - include only the parts you want to render\n * - Part IDs must be valid identifiers from the BuildCores parts database\n *\n * **Future Enhancement**: Multiple parts per category will be supported for comparison views.\n *\n * @see PartCategory for all available categories\n * @see AvailablePartsResponse for getting valid part IDs\n */\n parts: {\n [K in PartCategory]?: string[];\n };\n\n /**\n * Output format for the rendered build.\n *\n * - \"video\": Returns an MP4 video file for video-based 360° rotation\n * - \"sprite\": Returns a sprite sheet image for frame-based 360° rotation\n *\n * @default \"video\"\n */\n format?: \"video\" | \"sprite\";\n\n /**\n * Desired canvas pixel width (256-2000).\n * Must be provided together with height.\n *\n * @example\n * ```tsx\n * const request: RenderBuildRequest = {\n * parts: { CPU: [\"7xjqsomhr\"] },\n * width: 1920,\n * height: 1080\n * };\n * ```\n */\n width?: number;\n\n /**\n * Desired canvas pixel height (256-2000).\n * Must be provided together with width.\n *\n * @example\n * ```tsx\n * const request: RenderBuildRequest = {\n * parts: { CPU: [\"7xjqsomhr\"] },\n * width: 1920,\n * height: 1080\n * };\n * ```\n */\n height?: number;\n}\n\n/**\n * Response structure containing all available parts for each category.\n *\n * This type represents the response from the available parts API endpoint,\n * providing arrays of valid part IDs for each component category.\n *\n * @example Using available parts response\n * ```tsx\n * const availableParts: AvailablePartsResponse = {\n * CPU: [\n * { id: \"7xjqsomhr\", name: \"AMD Ryzen 7 9800X3D\", image: \"https://...\" },\n * { id: \"x2thvstj3\", name: \"AMD Ryzen 7 9700X\", image: \"https://...\" },\n * ],\n * GPU: [\n * { id: \"z7pyphm9k\", name: \"ASUS GeForce RTX 5080 ASTRAL\", image: \"https://...\" },\n * { id: \"4a0mjb360\", name: \"PNY GeForce RTX 5060 Ti 16GB\", image: \"https://...\" },\n * ],\n * // ... all other categories\n * };\n *\n * // Select one part per category for current build request\n * const buildRequest: RenderBuildRequest = {\n * parts: {\n * CPU: [availableParts.CPU[0].id], // Select first available CPU ID\n * GPU: [availableParts.GPU[1].id], // Select second available GPU ID\n * RAM: [availableParts.RAM[0].id], // Select first available RAM ID\n * }\n * };\n * ```\n *\n * @example Dynamic part selection\n * ```tsx\n * // Function to create build with user-selected parts\n * const createBuild = (selectedPartIds: Record<string, string>) => {\n * const buildRequest: RenderBuildRequest = {\n * parts: {\n * CPU: [selectedPartIds.cpu], // Single selected CPU ID\n * GPU: [selectedPartIds.gpu], // Single selected GPU ID\n * RAM: [selectedPartIds.ram], // Single selected RAM ID\n * // ... other single selections\n * }\n * };\n * return buildRequest;\n * };\n * ```\n */\n/**\n * Individual part information with details\n */\nexport interface PartDetails {\n /** Unique part identifier */\n id: string;\n /** Human-readable part name */\n name: string;\n /** URL to part image */\n image: string;\n}\n\n/**\n * Pagination metadata for available parts responses\n */\nexport interface AvailablePartsPagination {\n /** Total number of parts available for this category */\n total: number;\n /** Number of parts returned in this response */\n limit: number;\n /** Number of parts skipped */\n skip: number;\n /** Whether there are more parts available */\n hasNext: boolean;\n /** Whether there are previous parts available */\n hasPrev: boolean;\n}\n\n/**\n * Response envelope for the available parts endpoint.\n * Returns parts for the requested category under `data` keyed by category name.\n */\nexport interface AvailablePartsResponse {\n /**\n * Parts grouped by category. Only the requested category key is expected\n * to be present in the response.\n */\n data: Partial<Record<PartCategory, PartDetails[]>>;\n /** The requested category */\n category: PartCategory;\n /** Optional pagination information */\n pagination?: AvailablePartsPagination;\n}\n\n/**\n * Query options for fetching available parts\n */\nexport interface GetAvailablePartsOptions {\n /** Number of parts to return (default 20, min 1, max 100) */\n limit?: number;\n /** Number of parts to skip for pagination (default 0) */\n skip?: number;\n}\n","import { useState, useEffect, useCallback, useRef } from \"react\";\nimport { RenderBuildRequest, PartCategory, ApiConfig } from \"../types\";\nimport { renderBuild, renderBuildExperimental } from \"../api\";\n\n/**\n * Compares two RenderBuildRequest objects for equality by checking if the same IDs\n * are present in each category array, regardless of order.\n */\nexport const arePartsEqual = (\n parts1: RenderBuildRequest,\n parts2: RenderBuildRequest\n): boolean => {\n const categories = Object.values(PartCategory);\n\n for (const category of categories) {\n const arr1 = parts1.parts[category] || [];\n const arr2 = parts2.parts[category] || [];\n\n // Check if arrays have the same length\n if (arr1.length !== arr2.length) {\n return false;\n }\n\n // Check if arrays contain the same elements (order doesn't matter)\n const set1 = new Set(arr1);\n const set2 = new Set(arr2);\n\n if (set1.size !== set2.size) {\n return false;\n }\n\n for (const id of set1) {\n if (!set2.has(id)) {\n return false;\n }\n }\n }\n\n return true;\n};\n\nexport interface UseBuildRenderReturn {\n videoSrc: string | null;\n isRenderingBuild: boolean;\n renderError: string | null;\n}\n\nexport interface UseBuildRenderOptions {\n /**\n * Choose which backend flow to use\n * - 'async' (default): uses /render-build and polls /render-build/{jobId}\n * - 'experimental': uses /render-build-experimental and returns Blob\n */\n mode?: \"async\" | \"experimental\";\n}\n\nexport const useBuildRender = (\n parts: RenderBuildRequest,\n apiConfig: ApiConfig,\n onLoadStart?: () => void,\n options?: UseBuildRenderOptions\n): UseBuildRenderReturn => {\n const [videoSrc, setVideoSrc] = useState<string | null>(null);\n const [isRenderingBuild, setIsRenderingBuild] = useState(false);\n const [renderError, setRenderError] = useState<string | null>(null);\n const previousPartsRef = useRef<RenderBuildRequest | null>(null);\n\n const fetchRenderBuild = useCallback(\n async (currentParts: RenderBuildRequest) => {\n try {\n setIsRenderingBuild(true);\n setRenderError(null);\n onLoadStart?.();\n\n const mode = options?.mode ?? \"async\";\n if (mode === \"experimental\") {\n const response = await renderBuildExperimental(currentParts, apiConfig);\n const objectUrl = URL.createObjectURL(response.video);\n setVideoSrc((prevSrc: string | null) => {\n if (prevSrc && prevSrc.startsWith(\"blob:\")) {\n URL.revokeObjectURL(prevSrc);\n }\n return objectUrl;\n });\n } else {\n const { videoUrl } = await renderBuild(currentParts, apiConfig);\n // Clean up previous object URL (if any) before setting new one\n setVideoSrc((prevSrc: string | null) => {\n if (prevSrc && prevSrc.startsWith(\"blob:\")) {\n URL.revokeObjectURL(prevSrc);\n }\n return videoUrl;\n });\n }\n } catch (error) {\n setRenderError(\n error instanceof Error ? error.message : \"Failed to render build\"\n );\n } finally {\n setIsRenderingBuild(false);\n }\n },\n [apiConfig, onLoadStart, options?.mode]\n );\n\n // Effect to call API when parts content changes (using custom equality check)\n useEffect(() => {\n const shouldFetch =\n previousPartsRef.current === null ||\n !arePartsEqual(previousPartsRef.current, parts);\n\n if (shouldFetch) {\n previousPartsRef.current = parts;\n fetchRenderBuild(parts);\n }\n }, [parts, fetchRenderBuild]);\n\n // Cleanup effect for component unmount\n useEffect(() => {\n return () => {\n if (videoSrc && videoSrc.startsWith(\"blob:\")) {\n URL.revokeObjectURL(videoSrc);\n }\n };\n }, [videoSrc]);\n\n return {\n videoSrc,\n isRenderingBuild,\n renderError,\n };\n};\n","import { useState, useEffect, useCallback, useRef } from \"react\";\nimport { RenderBuildRequest, ApiConfig } from \"../types\";\nimport { renderSpriteExperimental, renderBuild } from \"../api\";\nimport { arePartsEqual } from \"./useBuildRender\";\n\nexport interface UseSpriteRenderReturn {\n spriteSrc: string | null;\n isRenderingSprite: boolean;\n renderError: string | null;\n spriteMetadata: {\n cols: number;\n rows: number;\n totalFrames: number;\n } | null;\n}\n\nexport interface UseSpriteRenderOptions {\n /**\n * Choose which backend flow to use\n * - 'async' (default): uses /render-build and polls /render-build/{jobId} with format 'sprite'\n * - 'experimental': uses /render-build-experimental and returns Blob\n */\n mode?: \"async\" | \"experimental\";\n}\n\nexport const useSpriteRender = (\n parts: RenderBuildRequest,\n apiConfig: ApiConfig,\n onLoadStart?: () => void,\n options?: UseSpriteRenderOptions\n): UseSpriteRenderReturn => {\n const [spriteSrc, setSpriteSrc] = useState<string | null>(null);\n const [isRenderingSprite, setIsRenderingSprite] = useState(false);\n const [renderError, setRenderError] = useState<string | null>(null);\n const [spriteMetadata, setSpriteMetadata] = useState<{\n cols: number;\n rows: number;\n totalFrames: number;\n } | null>(null);\n const previousPartsRef = useRef<RenderBuildRequest | null>(null);\n\n const fetchRenderSprite = useCallback(\n async (currentParts: RenderBuildRequest) => {\n try {\n setIsRenderingSprite(true);\n setRenderError(null);\n onLoadStart?.();\n\n const mode = options?.mode ?? \"async\";\n if (mode === \"experimental\") {\n const response = await renderSpriteExperimental(\n currentParts,\n apiConfig\n );\n const objectUrl = URL.createObjectURL(response.sprite);\n\n // Clean up previous sprite URL before setting new one\n setSpriteSrc((prevSrc) => {\n if (prevSrc && prevSrc.startsWith(\"blob:\")) {\n URL.revokeObjectURL(prevSrc);\n }\n return objectUrl;\n });\n\n // Set sprite metadata\n setSpriteMetadata({\n cols: response.metadata?.cols || 12,\n rows: response.metadata?.rows || 6,\n totalFrames: response.metadata?.totalFrames || 72,\n });\n } else {\n // Async job-based flow: request sprite format and use returned URL\n const { videoUrl: spriteUrl } = await renderBuild(\n { ...currentParts, format: \"sprite\" },\n apiConfig\n );\n\n setSpriteSrc((prevSrc) => {\n if (prevSrc && prevSrc.startsWith(\"blob:\")) {\n URL.revokeObjectURL(prevSrc);\n }\n return spriteUrl;\n });\n\n // No metadata from async endpoint; keep defaults\n setSpriteMetadata({ cols: 12, rows: 6, totalFrames: 72 });\n }\n } catch (error) {\n setRenderError(\n error instanceof Error ? error.message : \"Failed to render sprite\"\n );\n } finally {\n setIsRenderingSprite(false);\n }\n },\n [apiConfig, onLoadStart, options?.mode]\n );\n\n // Effect to call API when parts content changes (using custom equality check)\n useEffect(() => {\n const shouldFetch =\n previousPartsRef.current === null ||\n !arePartsEqual(previousPartsRef.current, parts);\n\n if (shouldFetch) {\n previousPartsRef.current = parts;\n fetchRenderSprite(parts);\n }\n }, [parts, fetchRenderSprite]);\n\n // Cleanup effect for component unmount\n useEffect(() => {\n return () => {\n if (spriteSrc && spriteSrc.startsWith(\"blob:\")) {\n URL.revokeObjectURL(spriteSrc);\n }\n };\n }, [spriteSrc]);\n\n return {\n spriteSrc,\n isRenderingSprite,\n renderError,\n spriteMetadata,\n };\n};\n","import React from \"react\";\n\ninterface LoadingErrorOverlayProps {\n isVisible: boolean;\n renderError?: string;\n size: number;\n}\n\nexport const LoadingErrorOverlay: React.FC<LoadingErrorOverlayProps> = ({\n isVisible,\n renderError,\n size,\n}) => {\n if (!isVisible) return null;\n\n return (\n <div\n style={{\n position: \"absolute\",\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n backgroundColor: \"rgba(0, 0, 0, 1)\",\n display: \"flex\",\n flexDirection: \"column\",\n alignItems: \"center\",\n justifyContent: \"center\",\n color: \"white\",\n zIndex: 10,\n }}\n >\n {renderError ? (\n <>\n <div\n style={{ marginBottom: \"20px\", fontSize: \"18px\", color: \"white\" }}\n >\n Render Failed\n </div>\n <div\n style={{\n fontSize: \"14px\",\n textAlign: \"center\",\n maxWidth: size * 0.8,\n color: \"white\",\n }}\n >\n {renderError}\n </div>\n </>\n ) : (\n <>\n <div\n style={{ marginBottom: \"20px\", fontSize: \"18px\", color: \"white\" }}\n >\n {\"Loading Build...\"}\n </div>\n </>\n )}\n </div>\n );\n};\n","import React from \"react\";\n\ninterface DragIconProps {\n width?: number;\n height?: number;\n className?: string;\n style?: React.CSSProperties;\n}\n\nexport const DragIcon: React.FC<DragIconProps> = ({\n width = 24,\n height = 24,\n className,\n style,\n ...props\n}) => {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n id=\"Layer_1\"\n width={width}\n height={height}\n data-name=\"Layer 1\"\n viewBox=\"0 0 24 24\"\n className={className}\n style={style}\n {...props}\n >\n <defs>\n <style>\n {\n \".cls-1{fill:none;stroke:currentColor;stroke-miterlimit:10;stroke-width:1.91px}\"\n }\n </style>\n </defs>\n <path\n d=\"m11.05 22.5-5.14-5.14a2 2 0 0 1-.59-1.43 2 2 0 0 1 2-2 2 2 0 0 1 1.43.59l1.32 1.32V6.38a2 2 0 0 1 1.74-2 1.89 1.89 0 0 1 1.52.56 1.87 1.87 0 0 1 .56 1.34V12l5 .72a1.91 1.91 0 0 1 1.64 1.89 17.18 17.18 0 0 1-1.82 7.71l-.09.18M19.64 7.23l2.86-2.87-2.86-2.86M15.82 4.36h6.68M4.36 7.23 1.5 4.36 4.36 1.5M8.18 4.36H1.5\"\n className=\"cls-1\"\n />\n </svg>\n );\n};\n","import React from \"react\";\nimport { DragIcon } from \"./DragIcon\";\n\ninterface InstructionTooltipProps {\n isVisible: boolean;\n progressValue: number;\n instructionIcon?: string;\n}\n\nexport const InstructionTooltip: React.FC<InstructionTooltipProps> = ({\n isVisible,\n progressValue,\n instructionIcon,\n}) => {\n if (!isVisible) {\n return null;\n }\n\n return (\n <div\n style={{\n position: \"absolute\",\n top: \"50%\",\n left: \"50%\",\n transform: `translate(-50%, -50%) translateX(${progressValue * 50}px)`,\n backgroundColor: \"rgba(0, 0, 0, 0.8)\",\n color: \"white\",\n padding: \"12px\",\n borderRadius: \"8px\",\n pointerEvents: \"none\",\n zIndex: 5,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n }}\n >\n {instructionIcon ? (\n <img\n src={instructionIcon}\n alt=\"drag to view 360\"\n style={{\n width: \"24px\",\n height: \"24px\",\n filter: \"invert(1)\", // Makes the icon white\n }}\n />\n ) : (\n <DragIcon\n width={24}\n height={24}\n style={{\n color: \"white\",\n }}\n />\n )}\n </div>\n );\n};\n","import { useRef, useState, useCallback, useEffect } from \"react\";\nimport { useSpriteScrubbing } from \"./hooks/useSpriteScrubbing\";\nimport { useBouncePatternProgress } from \"./hooks/useProgressOneSecond\";\nimport { useSpriteRender } from \"./hooks/useSpriteRender\";\nimport { BuildRenderProps } from \"./types\";\nimport { LoadingErrorOverlay } from \"./components/LoadingErrorOverlay\";\nimport { InstructionTooltip } from \"./components/InstructionTooltip\";\n\nexport const BuildRender: React.FC<BuildRenderProps> = ({\n parts,\n width,\n height,\n size,\n apiConfig,\n useSpriteRenderOptions,\n mouseSensitivity = 0.2,\n touchSensitivity = 0.2,\n}) => {\n const canvasRef = useRef<HTMLCanvasElement | null>(null);\n const [img, setImg] = useState<HTMLImageElement | null>(null);\n const [isLoading, setIsLoading] = useState(true);\n const [bouncingAllowed, setBouncingAllowed] = useState(false);\n\n const displayW = width ?? size ?? 300;\n const displayH = height ?? size ?? 300;\n\n // Use custom hook for sprite rendering\n const { spriteSrc, isRenderingSprite, renderError, spriteMetadata } =\n useSpriteRender(parts, apiConfig, undefined, useSpriteRenderOptions);\n\n const { value: progressValue, isBouncing } =\n useBouncePatternProgress(bouncingAllowed);\n\n const total = spriteMetadata ? spriteMetadata.totalFrames : 72;\n const cols = spriteMetadata ? spriteMetadata.cols : 12;\n const rows = spriteMetadata ? spriteMetadata.rows : 6;\n const frameRef = useRef(0);\n\n // Image/frame sizes\n const frameW = img ? img.width / cols : 0;\n const frameH = img ? img.height / rows : 0;\n\n // ---- Load sprite image ----\n useEffect(() => {\n if (!spriteSrc) {\n setImg(null);\n setIsLoading(true);\n return;\n }\n\n setIsLoading(true);\n const i = new Image();\n i.decoding = \"async\";\n i.loading = \"eager\";\n i.src = spriteSrc;\n i.onload = () => {\n setImg(i);\n setIsLoading(false);\n // Start bouncing animation after delay\n setTimeout(() => {\n setBouncingAllowed(true);\n }, 2000);\n };\n i.onerror = () => {\n setImg(null);\n setIsLoading(false);\n };\n }, [spriteSrc]);\n\n // ---- Drawing function ----\n const draw = useCallback(\n (frameIndex: number) => {\n const cnv = canvasRef.current;\n if (!cnv || !img || !frameW || !frameH) return;\n\n const ctx = cnv.getContext(\"2d\");\n if (!ctx) return;\n\n // Backing store sized for HiDPI; CSS size stays `size`\n const dpr = Math.max(1, window.devicePixelRatio || 1);\n const targetW = Math.round(displayW * dpr);\n const targetH = Math.round(displayH * dpr);\n if (cnv.width !== targetW || cnv.height !== targetH) {\n cnv.width = targetW;\n cnv.height = targetH;\n }\n\n // Snap to integer frame (never between tiles)\n let n = Math.round(frameIndex) % total;\n if (n < 0) n += total;\n\n const r = Math.floor(n / cols);\n const c = n % cols;\n\n // Use integer source rects to avoid sampling bleed across tiles\n const sx = Math.round(c * frameW);\n const sy = Math.round(r * frameH);\n const sw = Math.round(frameW);\n const sh = Math.round(frameH);\n\n ctx.clearRect(0, 0, targetW, targetH);\n ctx.imageSmoothingEnabled = true;\n ctx.imageSmoothingQuality = \"high\";\n ctx.drawImage(img, sx, sy, sw, sh, 0, 0, targetW, targetH);\n },\n [img, frameW, frameH, displayW, displayH, cols, total]\n );\n\n const { isDragging, handleMouseDown, handleTouchStart, hasDragged } =\n useSpriteScrubbing(canvasRef, total, {\n mouseSensitivity,\n touchSensitivity,\n onFrameChange: (newFrame: number) => {\n frameRef.current = newFrame;\n draw(newFrame);\n },\n });\n\n const handleLoadStartInternal = useCallback(() => {\n setIsLoading(true);\n setBouncingAllowed(false);\n }, []);\n\n // Auto-rotate when bouncing is allowed and not dragged\n useEffect(() => {\n if (hasDragged.current || !img) return;\n\n // Calculate frame based on progress value (similar to video time calculation)\n const frame = ((progressValue / 5) * total) % total;\n frameRef.current = frame;\n draw(frame);\n }, [progressValue, hasDragged, img, total, draw]);\n\n // Initial draw once image is ready\n useEffect(() => {\n if (img && !isLoading) {\n draw(frameRef.current);\n }\n }, [img, isLoading, draw]);\n\n return (\n <div\n style={{\n position: \"relative\",\n width: displayW,\n height: displayH,\n backgroundColor: \"black\",\n }}\n >\n {img && (\n <canvas\n ref={canvasRef}\n onMouseDown={handleMouseDown}\n onTouchStart={handleTouchStart}\n style={{\n width: displayW,\n height: displayH,\n cursor: isDragging ? \"grabbing\" : \"grab\",\n touchAction: \"none\", // Prevents default touch behaviors like scrolling\n display: \"block\",\n userSelect: \"none\",\n WebkitUserSelect: \"none\",\n WebkitTouchCallout: \"none\",\n }}\n role=\"img\"\n aria-label=\"360° viewer\"\n onContextMenu={(e) => e.preventDefault()}\n />\n )}\n\n <LoadingErrorOverlay\n isVisible={isLoading || isRenderingSprite || !!renderError}\n renderError={renderError || undefined}\n size={Math.min(displayW, displayH)}\n />\n\n <InstructionTooltip\n isVisible={\n !isLoading &&\n !isRenderingSprite &&\n !renderError &&\n isBouncing &&\n !hasDragged.current\n }\n progressValue={progressValue}\n />\n </div>\n );\n};\n","import {\n useState,\n useRef,\n useEffect,\n useCallback,\n type RefObject,\n} from \"react\";\n\n// Helper to extract clientX from mouse or touch events\nconst getClientX = (e: MouseEvent | TouchEvent): number => {\n return \"touches\" in e ? e.touches[0].clientX : e.clientX;\n};\n\n// Helper to calculate new video time with circular wrapping\nexport const calculateCircularTime = (\n startTime: number,\n deltaX: number,\n sensitivity: number,\n duration: number\n): number => {\n const timeDelta = deltaX * sensitivity;\n let newTime = startTime + timeDelta;\n\n // Make it circular - wrap around when going past boundaries\n newTime = newTime % duration;\n if (newTime < 0) {\n newTime += duration;\n }\n\n return newTime;\n};\n\ninterface UseVideoScrubbingOptions {\n mouseSensitivity?: number;\n touchSensitivity?: number;\n progressSensitivity?: number;\n useProgressScrubbing?: boolean;\n}\n\nexport const useVideoScrubbing = (\n videoRef: RefObject<HTMLVideoElement | null>,\n options: UseVideoScrubbingOptions = {}\n) => {\n const { mouseSensitivity = 0.01, touchSensitivity = 0.01 } = options;\n\n const [isDragging, setIsDragging] = useState(false);\n const [dragStartX, setDragStartX] = useState(0);\n const [dragStartTime, setDragStartTime] = useState(0);\n const hasDragged = useRef(false);\n\n // Helper to start dragging (common logic for mouse and touch)\n const startDrag = useCallback(\n (clientX: number, event: Event) => {\n if (!videoRef.current) return;\n\n setIsDragging(true);\n setDragStartX(clientX);\n setDragStartTime(videoRef.current.currentTime);\n hasDragged.current = true;\n event.preventDefault();\n },\n [videoRef]\n );\n\n // Helper to handle drag movement (common logic for mouse and touch)\n const handleDragMove = useCallback(\n (clientX: number, sensitivity: number) => {\n if (!isDragging || !videoRef.current) return;\n\n const deltaX = clientX - dragStartX;\n const duration = videoRef.current.duration || 0;\n\n if (duration > 0) {\n const newTime = calculateCircularTime(\n dragStartTime,\n deltaX,\n sensitivity,\n duration\n );\n videoRef.current.currentTime = newTime;\n }\n },\n [isDragging, dragStartX, dragStartTime, videoRef]\n );\n\n // Helper to end dragging (common logic for mouse and touch)\n const endDrag = useCallback(() => {\n setIsDragging(false);\n }, []);\n\n const handleMouseDown = useCallback(\n (e: React.MouseEvent) => {\n startDrag(e.clientX, e.nativeEvent);\n },\n [startDrag]\n );\n\n const handleTouchStart = useCallback(\n (e: React.TouchEvent) => {\n startDrag(e.touches[0].clientX, e.nativeEvent);\n },\n [startDrag]\n );\n\n const handleDocumentMouseMove = useCallback(\n (e: MouseEvent) => {\n handleDragMove(getClientX(e), mouseSensitivity);\n },\n [handleDragMove, mouseSensitivity]\n );\n\n const handleDocumentTouchMove = useCallback(\n (e: TouchEvent) => {\n handleDragMove(getClientX(e), touchSensitivity);\n },\n [handleDragMove, touchSensitivity]\n );\n\n const handleDocumentMouseUp = useCallback(() => {\n endDrag();\n }, [endDrag]);\n\n const handleDocumentTouchEnd = useCallback(() => {\n endDrag();\n }, [endDrag]);\n\n // Add document-level event listeners when dragging starts\n useEffect(() => {\n if (isDragging) {\n document.addEventListener(\"mousemove\", handleDocumentMouseMove);\n document.addEventListener(\"mouseup\", handleDocumentMouseUp);\n document.addEventListener(\"touchmove\", handleDocumentTouchMove);\n document.addEventListener(\"touchend\", handleDocumentTouchEnd);\n\n return () => {\n document.removeEventListener(\"mousemove\", handleDocumentMouseMove);\n document.removeEventListener(\"mouseup\", handleDocumentMouseUp);\n document.removeEventListener(\"touchmove\", handleDocumentTouchMove);\n document.removeEventListener(\"touchend\", handleDocumentTouchEnd);\n };\n }\n }, [\n isDragging,\n handleDocumentMouseMove,\n handleDocumentMouseUp,\n handleDocumentTouchMove,\n handleDocumentTouchEnd,\n ]);\n\n return {\n isDragging,\n handleMouseDown,\n handleTouchStart,\n hasDragged,\n };\n};\n","import { useRef, useState, useCallback, useEffect } from \"react\";\nimport {\n calculateCircularTime,\n useVideoScrubbing,\n} from \"./hooks/useVideoScrubbing\";\nimport { useBouncePatternProgress } from \"./hooks/useProgressOneSecond\";\nimport { useBuildRender } from \"./hooks/useBuildRender\";\nimport { BuildRenderVideoProps } from \"./types\";\nimport { LoadingErrorOverlay } from \"./components/LoadingErrorOverlay\";\nimport { InstructionTooltip } from \"./components/InstructionTooltip\";\n\nexport const BuildRenderVideo: React.FC<BuildRenderVideoProps> = ({\n parts,\n width,\n height,\n size,\n apiConfig,\n useBuildRenderOptions,\n mouseSensitivity = 0.01,\n touchSensitivity = 0.01,\n}) => {\n const videoRef = useRef<HTMLVideoElement | null>(null);\n const [isLoading, setIsLoading] = useState(true);\n const [bouncingAllowed, setBouncingAllowed] = useState(false);\n\n const displayW = width ?? size ?? 300;\n const displayH = height ?? size ?? 300;\n\n // Use custom hook for build rendering\n const { videoSrc, isRenderingBuild, renderError } = useBuildRender(\n parts,\n apiConfig,\n undefined,\n useBuildRenderOptions\n );\n\n const { value: progressValue, isBouncing } =\n useBouncePatternProgress(bouncingAllowed);\n\n const { isDragging, handleMouseDown, handleTouchStart, hasDragged } =\n useVideoScrubbing(videoRef, {\n mouseSensitivity,\n touchSensitivity,\n });\n\n const handleLoadStartInternal = useCallback(() => {\n setIsLoading(true);\n setBouncingAllowed(false);\n }, []);\n\n const handleCanPlayInternal = useCallback(() => {\n setIsLoading(false);\n // Start bouncing animation after delay\n setTimeout(() => {\n setBouncingAllowed(true);\n }, 2000);\n }, []);\n\n useEffect(() => {\n if (hasDragged.current || !videoRef.current) return;\n\n const duration = videoRef.current.duration;\n if (!isFinite(duration)) return;\n\n const time = calculateCircularTime(0, progressValue, 0.5, duration);\n\n if (isFinite(time)) {\n videoRef.current.currentTime = time;\n }\n }, [progressValue, hasDragged]);\n\n return (\n <div style={{ position: \"relative\", width: displayW, height: displayH }}>\n {videoSrc && (\n <video\n key={videoSrc} // Force React to recreate video element when src changes\n ref={videoRef}\n src={videoSrc} // Set src directly on video element\n width={displayW}\n height={displayH}\n autoPlay={true}\n preload=\"metadata\"\n muted\n playsInline\n controls={false}\n disablePictureInPicture\n controlsList=\"nodownload nofullscreen noremoteplayback\"\n {...({ \"x-webkit-airplay\": \"deny\" } as any)}\n onMouseDown={handleMouseDown}\n onTouchStart={handleTouchStart}\n onLoadStart={handleLoadStartInternal}\n onCanPlay={handleCanPlayInternal}\n onLoadedData={() => {\n if (videoRef.current) {\n videoRef.current.pause();\n }\n }}\n style={\n {\n cursor: isDragging ? \"grabbing\" : \"grab\",\n touchAction: \"none\", // Prevents default touch behaviors like scrolling\n display: \"block\",\n // Completely hide video controls on all browsers including mobile\n WebkitMediaControls: \"none\",\n MozMediaControls: \"none\",\n OMediaControls: \"none\",\n msMediaControls: \"none\",\n mediaControls: \"none\",\n // Additional iOS-specific properties\n WebkitTouchCallout: \"none\",\n WebkitUserSelect: \"none\",\n userSelect: \"none\",\n } as React.CSSProperties\n }\n >\n Your browser does not support the video tag.\n </video>\n )}\n\n <LoadingErrorOverlay\n isVisible={isLoading || isRenderingBuild || !!renderError}\n renderError={renderError || undefined}\n size={Math.min(displayW, displayH)}\n />\n\n <InstructionTooltip\n isVisible={\n !isLoading &&\n !isRenderingBuild &&\n !renderError &&\n isBouncing &&\n !hasDragged.current\n }\n progressValue={progressValue}\n />\n </div>\n );\n};\n"],"names":["getClientX","useState","useRef","useCallback","useEffect","useAnimationFrame","PartCategory","_jsx","_jsxs","_Fragment"],"mappings":";;;;;;AAQA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AuB,EACpC,SAAS,EAAE,qBAAqB,EAChC,YAAY,EAAE,MAAK;AACjB,oBAAA,IAAI,QAAQ,CAAC,OAAO,EAAE;AACpB,wBAAA,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE;oBAC1B;gBACF,CAAC,EACD,KAAK,EACH;oBACE,MAAM,EAAE,UAAU,GAAG,UAAU,GAAG,MAAM;oBACxC,WAAW,EAAE,MAAM;AACnB,oBAAA,OAAO,EAAE,OAAO;;AAEhB,oBAAA,mBAAmB,EAAE,MAAM;AAC3B,oBAAA,gBAAgB,EAAE,MAAM;AACxB,oBAAA,cAAc,EAAE,MAAM;AACtB,oBAAA,eAAe,EAAE,MAAM;AACvB,oBAAA,aAAa,EAAE,MAAM;;AAErB,oBAAA,kBAAkB,EAAE,MAAM;AAC1B,oBAAA,gBAAgB,EAAE,MAAM;AACxB,oBAAA,UAAU,EAAE,MAAM;AACI,iBAAA,EAAA,QAAA,EAAA,8CAAA,EAAA,EArCrB,QAAQ,CAyCP,CACT,EAEDA,cAAA,CAAC,mBAAmB,IAClB,SAAS,EAAE,SAAS,IAAI,gBAAgB,IAAI,CAAC,CAAC,WAAW,EACzD,WAAW,EAAE,WAAW,IAAI,SAAS,EACrC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAAA,CAClC,EAEFA,cAAA,CAAC,kBAAkB,IACjB,SAAS,EACP,CAAC,SAAS;AACV,oBAAA,CAAC,gBAAgB;AACjB,oBAAA,CAAC,WAAW;oBACZ,UAAU;oBACV,CAAC,UAAU,CAAC,OAAO,EAErB,aAAa,EAAE,aAAa,EAAA,CAC5B,CAAA,EAAA,CACE;AAEV;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/types.d.ts CHANGED
@@ -337,6 +337,34 @@ export interface RenderBuildRequest {
337
337
  * @default "video"
338
338
  */
339
339
  format?: "video" | "sprite";
340
+ /**
341
+ * Desired canvas pixel width (256-2000).
342
+ * Must be provided together with height.
343
+ *
344
+ * @example
345
+ * ```tsx
346
+ * const request: RenderBuildRequest = {
347
+ * parts: { CPU: ["7xjqsomhr"] },
348
+ * width: 1920,
349
+ * height: 1080
350
+ * };
351
+ * ```
352
+ */
353
+ width?: number;
354
+ /**
355
+ * Desired canvas pixel height (256-2000).
356
+ * Must be provided together with width.
357
+ *
358
+ * @example
359
+ * ```tsx
360
+ * const request: RenderBuildRequest = {
361
+ * parts: { CPU: ["7xjqsomhr"] },
362
+ * width: 1920,
363
+ * height: 1080
364
+ * };
365
+ * ```
366
+ */
367
+ height?: number;
340
368
  }
341
369
  /**
342
370
  * Response structure containing all available parts for each category.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buildcores/render-client",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "type": "module",
5
5
  "description": "React component for interactive 360-degree video rendering",
6
6
  "repository": {