@oeave/bakery3 0.1.0 → 0.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.
Files changed (67) hide show
  1. package/README.md +10 -10
  2. package/dist/bake/index.d.ts +3 -3
  3. package/dist/bake/index.js +4 -4
  4. package/dist/{bake-DaOlenyx.d.ts → bake-DZ-CJR6f.d.ts} +8 -1
  5. package/dist/catalog/index.d.ts +5 -5
  6. package/dist/catalog/index.js +3 -3
  7. package/dist/{chunk-V3QINEEG.js → chunk-62M6XXNX.js} +58 -3
  8. package/dist/chunk-62M6XXNX.js.map +1 -0
  9. package/dist/{chunk-ARMTTZXZ.js → chunk-6FYI6AJM.js} +8 -8
  10. package/dist/chunk-6FYI6AJM.js.map +1 -0
  11. package/dist/{chunk-W6WQ5UP7.js → chunk-APWUCEEB.js} +32 -5
  12. package/dist/chunk-APWUCEEB.js.map +1 -0
  13. package/dist/{chunk-6YVQANMW.js → chunk-HNMSWQU7.js} +262 -16
  14. package/dist/chunk-HNMSWQU7.js.map +1 -0
  15. package/dist/{chunk-HQTUFVMM.js → chunk-JFYUDERE.js} +3 -3
  16. package/dist/chunk-JFYUDERE.js.map +1 -0
  17. package/dist/{chunk-TGFNQBKC.js → chunk-KNUAOILG.js} +5 -5
  18. package/dist/chunk-KNUAOILG.js.map +1 -0
  19. package/dist/chunk-KZLVTSBI.js +191 -0
  20. package/dist/chunk-KZLVTSBI.js.map +1 -0
  21. package/dist/{chunk-MD2U6S4N.js → chunk-LAKXC4WR.js} +218 -142
  22. package/dist/chunk-LAKXC4WR.js.map +1 -0
  23. package/dist/{chunk-25ZXSVQ3.js → chunk-NXBAZGNB.js} +3 -3
  24. package/dist/{chunk-25ZXSVQ3.js.map → chunk-NXBAZGNB.js.map} +1 -1
  25. package/dist/{chunk-54WJDN5R.js → chunk-QRCT5UGZ.js} +4 -4
  26. package/dist/{chunk-54WJDN5R.js.map → chunk-QRCT5UGZ.js.map} +1 -1
  27. package/dist/{chunk-APBOWWSV.js → chunk-UWBP7B54.js} +3 -3
  28. package/dist/chunk-UWBP7B54.js.map +1 -0
  29. package/dist/{chunk-WBIAFIHV.js → chunk-XK35ANPJ.js} +3 -3
  30. package/dist/{chunk-WBIAFIHV.js.map → chunk-XK35ANPJ.js.map} +1 -1
  31. package/dist/{chunk-CX4WTVGH.js → chunk-Z7IYVH22.js} +386 -97
  32. package/dist/chunk-Z7IYVH22.js.map +1 -0
  33. package/dist/devtools/index.d.ts +3 -3
  34. package/dist/devtools/index.js +9 -9
  35. package/dist/index.d.ts +39 -8
  36. package/dist/index.js +10 -10
  37. package/dist/node/index.cjs +266 -141
  38. package/dist/node/index.cjs.map +1 -1
  39. package/dist/node/index.d.cts +152 -87
  40. package/dist/node/index.d.ts +27 -6
  41. package/dist/node/index.js +52 -3
  42. package/dist/node/index.js.map +1 -1
  43. package/dist/{prepare-C5qVvaw4.d.ts → prepare-BtjY4G3q.d.ts} +1 -1
  44. package/dist/presets/index.d.ts +37 -1
  45. package/dist/presets/index.js +4 -4
  46. package/dist/presets/index.js.map +1 -1
  47. package/dist/r3f/index.d.ts +4 -4
  48. package/dist/r3f/index.js +12 -12
  49. package/dist/{room-S5TLCK4F.js → room-FS26KAPQ.js} +6 -6
  50. package/dist/{room-S5TLCK4F.js.map → room-FS26KAPQ.js.map} +1 -1
  51. package/dist/{rooms.gen-vhj6sFW5.d.ts → rooms.gen-DItzBR9k.d.ts} +112 -84
  52. package/dist/session-VCIQEO26.js +9 -0
  53. package/dist/{session-YCQS4MRH.js.map → session-VCIQEO26.js.map} +1 -1
  54. package/dist/{testRun-BIPXaVPb.d.ts → testRun-20OARnQr.d.ts} +12 -3
  55. package/package.json +1 -1
  56. package/dist/chunk-6YVQANMW.js.map +0 -1
  57. package/dist/chunk-AF5BIELI.js +0 -70
  58. package/dist/chunk-AF5BIELI.js.map +0 -1
  59. package/dist/chunk-APBOWWSV.js.map +0 -1
  60. package/dist/chunk-ARMTTZXZ.js.map +0 -1
  61. package/dist/chunk-CX4WTVGH.js.map +0 -1
  62. package/dist/chunk-HQTUFVMM.js.map +0 -1
  63. package/dist/chunk-MD2U6S4N.js.map +0 -1
  64. package/dist/chunk-TGFNQBKC.js.map +0 -1
  65. package/dist/chunk-V3QINEEG.js.map +0 -1
  66. package/dist/chunk-W6WQ5UP7.js.map +0 -1
  67. package/dist/session-YCQS4MRH.js +0 -9
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/protocol/manifest.ts","../../src/protocol/quality.ts","../../src/protocol/batch.ts","../../src/errors.ts","../../src/version.ts","../../src/warn.ts","../../src/client.ts","../../src/pollFailures.ts","../../src/batch.ts","../../src/set.ts","../../src/testRun.ts","../../src/frame.ts","../../src/presets/catalog.gen.ts","../../src/presets/rooms.gen.ts","../../src/node/renderBatch.ts","../../src/node/webhook.ts","../../src/node/index.ts"],"names":["message","who","s","abortError"],"mappings":";;;AAwCO,IAAM,gBAAA,GAAmB,KAAA;AAGzB,IAAM,qBAAA,GAAwB,KAAA;AAG9B,IAAM,yBAAA,GAA4B,KAAA;AAQlC,IAAM,sBAAA,GAAyB,KAAA;AAW/B,SAAS,mBAAmB,QAAA,EAIxB;AACT,EAAA,IAAI,QAAA,CAAS,WAAA,EAAa,GAAA,EAAK,OAAO,gBAAA;AACtC,EAAA,IAAI,QAAA,CAAS,MAAM,OAAO,qBAAA;AAC1B,EAAA,OAAO,QAAA,CAAS,YACZ,yBAAA,GACA,sBAAA;AACN;AAkTO,IAAM,aAAA,GAAgC,CAAC,KAAA,EAAO,MAAM,CAAA;AAUpD,IAAM,gBAAA,GAAmC,CAAC,cAAc,CAAA;AAGxD,SAAS,cAAc,MAAA,EAA+B;AAC3D,EAAA,OAAO,aAAA,CAAc,SAAS,MAAM,CAAA;AACtC;AAGO,SAAS,iBAAiB,MAAA,EAA+B;AAC9D,EAAA,OAAO,gBAAA,CAAiB,SAAS,MAAM,CAAA;AACzC;AAQO,SAAS,aAAa,MAAA,EAAqC;AAChE,EAAA,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A,EAAO;AAC3B,IAAA,OAAO,IAAI,KAAA,CAAM,MAAA,EAAQ,MAAM,MAAA,CAAO,QAAA,CAAS,EAAE,CAAC,CAAA;AAAA,EACpD;AACF,CAAA","file":"index.cjs","sourcesContent":["/**\n * The scene manifest: a GLB plus a versioned sidecar.\n *\n * glTF carries geometry, materials, textures, cameras, lights, skins and\n * morph targets well. What it does not carry is the state the running\n * application was in at the moment somebody pressed Render: which objects\n * were hidden, which of four cameras was live, what the renderer's tone\n * mapping was set to, which materials the SDK could not translate and what\n * the developer wants done about them. So the GLB is an asset and this is\n * the contract. `protocolVersion` is versioned independently of the SDK, of\n * the renderer and of the material translator, which is what makes a render\n * from six months ago reproducible.\n *\n * Everything here is JSON (no class instances, no functions) because it\n * travels from the browser through the control plane to the render worker\n * and is stored verbatim for replay.\n */\n\nimport type { AnimationSpec } from './animation.js';\nimport type { RoomPresetSpec } from './room.js';\nimport type { MaterialShaderSpec } from './shader.js';\n\n/**\n * Bumped only for a change a worker cannot read straight through. A worker\n * refuses a manifest whose major it does not implement rather than guessing;\n * a plausible wrong image is worse than a refusal.\n *\n * 2.0: `shaders`, node-material graphs. Without them a worker would render\n * the exporter's gray stand-in as if it were the material.\n *\n * 3.0: `animation`, baked per-frame channels. Without them a worker would\n * hand back one still of frame zero for a five-second orbit.\n *\n * 4.0: `room`, a room preset the worker rebuilds itself (see room.ts). The\n * room's geometry is deliberately not in the GLB, so a worker that ignored\n * the field would render the product floating in nothing.\n *\n * 5.0: `environment.fog`, the scene's fog traced as a volume. A worker that\n * ignored the field would hand back the scene in clear air.\n */\nexport const PROTOCOL_VERSION = '5.0';\n\n/** What a manifest with a room preset and no fog is stamped with. */\nexport const PROTOCOL_VERSION_ROOM = '4.0';\n\n/** What an animated manifest without a room preset is stamped with. */\nexport const PROTOCOL_VERSION_ANIMATED = '3.0';\n\n/**\n * What a manifest carrying no animation is stamped with. A still is still a\n * 2.0 document (every field in it means what it meant before), so stamping\n * it higher would only strand it at a worker not yet updated. See\n * `protocolVersionFor`.\n */\nexport const PROTOCOL_VERSION_STILL = '2.0';\n\n/** Every major the current worker can render faithfully. */\nexport const SUPPORTED_PROTOCOL_MAJORS = ['1', '2', '3', '4', '5'];\n\n/**\n * The version to stamp on a manifest: the lowest major that reads every\n * field in it faithfully (5.0 with fog, 4.0 with a room preset, 3.0 if\n * animated, 2.0 otherwise), so a manifest never strands itself at an older\n * worker for a field it does not carry.\n */\nexport function protocolVersionFor(manifest: {\n animation?: AnimationSpec;\n room?: RoomPresetSpec;\n environment?: { fog?: FogSpec };\n}): string {\n if (manifest.environment?.fog) return PROTOCOL_VERSION;\n if (manifest.room) return PROTOCOL_VERSION_ROOM;\n return manifest.animation\n ? PROTOCOL_VERSION_ANIMATED\n : PROTOCOL_VERSION_STILL;\n}\n\n/** `sha256:<64 hex>`: how every immutable blob is named. See asset.ts. */\nexport type AssetHash = string;\n\nexport type Vec3 = [number, number, number];\n/** glTF order: x, y, z, w. Any conversion to another order happens in the worker. */\nexport type Quat = [number, number, number, number];\nexport type Matrix4 = number[];\n\n// ---------------------------------------------------------------------------\n// Camera\n// ---------------------------------------------------------------------------\n\n/**\n * The active camera.\n *\n * Written out in full rather than referenced into the GLB by name: a live\n * R3F camera is frequently not in the scene graph the exporter walked (it\n * is held by `useThree`, or by drei's controls), so it travels as data.\n */\nexport type CameraSpec =\n | {\n type: 'perspective';\n /** Vertical FOV in degrees, matching three's `PerspectiveCamera.fov`. */\n fov: number;\n /**\n * The viewport's aspect ratio at capture time.\n *\n * The render matches vertical fov, so a wider output shows more at the\n * sides rather than cropping the top and bottom. Recorded so the\n * control plane can default the output to the viewport's own shape.\n */\n aspect?: number;\n near: number;\n far: number;\n position: Vec3;\n quaternion: Quat;\n /** three's `.zoom`, which scales the projection and is easy to forget. */\n zoom?: number;\n /** Present when the developer named a camera; only ever a label. */\n name?: string;\n /** Physical-camera extras. Depth of field is off unless `fStop` is set. */\n focus?: { fStop: number; focalDistance: number };\n }\n | {\n type: 'orthographic';\n left: number;\n right: number;\n top: number;\n bottom: number;\n near: number;\n far: number;\n position: Vec3;\n quaternion: Quat;\n zoom?: number;\n name?: string;\n };\n\n// ---------------------------------------------------------------------------\n// Runtime state: the part glTF cannot express\n// ---------------------------------------------------------------------------\n\n/**\n * What the application had done to the scene by render time.\n *\n * Visibility is an explicit hidden list rather than \"export only what is\n * visible\" on purpose: the GLB is content-addressed and cached, and a\n * configurator that toggles one part between renders would otherwise miss\n * the cache every time. Ship one GLB with every variant in it, then hide\n * per render: the first render uploads the model, the next one uploads a\n * few KB.\n */\nexport type RuntimeState = {\n /** Object ids (see `objectId` in capture) the SDK found with `visible === false`. */\n hiddenObjectIds?: string[];\n /**\n * Transform overrides, for objects the application moved after export or\n * that were exported from a shared cached GLB.\n */\n transforms?: Array<{\n objectId: string;\n position?: Vec3;\n quaternion?: Quat;\n scale?: Vec3;\n }>;\n /** Morph target influences, by object. */\n morphs?: Array<{ objectId: string; influences: number[] }>;\n /** Current skeletal pose as bone-local matrices. */\n poses?: Array<{ objectId: string; boneMatrices: Matrix4[] }>;\n /**\n * `InstancedMesh` transforms. Written here rather than baked into the GLB\n * so changing a layout does not re-upload the geometry.\n *\n * `matrices` is flat: `count * 16` numbers, column-major, exactly as three\n * stores `instanceMatrix.array`. Nested arrays would add two bytes of JSON\n * per instance, which for a large scatter is a measurable part of the\n * manifest.\n */\n instances?: Array<{ objectId: string; count: number; matrices: number[] }>;\n /**\n * Opaque application state, echoed back on the render record. Never read\n * by the renderer; it exists so a stored render can say which sofa.\n */\n productState?: Record<string, unknown>;\n};\n\n// ---------------------------------------------------------------------------\n// Environment and lighting\n// ---------------------------------------------------------------------------\n\nexport type EnvironmentSpec = {\n /** An HDRI/EXR the SDK found on `scene.environment`, content-addressed. */\n hdri?: AssetHash;\n /** three's `Scene.environmentIntensity`. */\n intensity?: number;\n /** three's `Scene.environmentRotation`, radians, XYZ euler. */\n rotation?: Vec3;\n /**\n * The scene's `AmbientLight`s as one flat term. It ADDS to the HDRI, as it\n * does in three, and like three's it lights diffuse surfaces only: a\n * mirror reflects the environment and nothing of this.\n */\n ambient?: { color: string; intensity: number };\n /**\n * Background. `transparent` is the default: a still that composites is\n * worth more to a catalog pipeline than one with a baked backdrop.\n */\n background?:\n | { type: 'transparent' }\n | { type: 'color'; color: string }\n | { type: 'environment'; blurriness?: number };\n /** The scene's fog, when it has one the renderer can trace. */\n fog?: FogSpec;\n};\n\n/**\n * three's `FogExp2`, which the renderer traces as a volume filling the scene:\n * air that scatters the light passing through it, so a lamp or an emissive\n * mesh sits in a glow and throws visible beams.\n *\n * `density` is three's own number. three fades a surface by\n * `exp(-(density · d)²)`; a real volume thins light by `exp(-σ · d)`. The\n * two cannot agree at every distance, so the renderer uses σ = `density`,\n * which makes them agree where three's fog has taken all but 1/e of the\n * surface: nearer than that the render is a little foggier than the\n * viewport, further a little clearer.\n *\n * `color` is the fog's TINT (`#rrggbb`, as three holds it): its hue colors\n * the scattered light, its brightness is ignored. How bright traced fog\n * looks is decided by the light in it, which a rasterizer's fog color has to\n * guess. A linear `Fog` has no volume it corresponds to and is not carried;\n * the compatibility report says so.\n */\nexport type FogSpec = {\n color: string;\n density: number;\n};\n\n/**\n * Lights the SDK lifted out of the scene graph.\n *\n * Exported here as well as in the GLB because glTF's punctual-lights\n * extension has no notion of three's intensity-unit drift, no area lights\n * and no IES. The sidecar is where the good version lives and the GLB copy\n * is the fallback.\n */\nexport type LightSpec = {\n objectId: string;\n type: 'directional' | 'point' | 'spot' | 'area' | 'hemisphere';\n color: string;\n /**\n * three's own value, unconverted. The worker owns the unit conversion so\n * the physics is written down in one place.\n */\n intensity: number;\n /**\n * World position. A hemisphere light's is its up axis instead (three\n * normalizes it; absent is `[0, 1, 0]`).\n */\n position?: Vec3;\n /**\n * World point a directional, spot or area light aims at, as three's\n * `light.target` (or `lookAt`) does. Absent aims a directional or spot\n * light at the origin and leaves an area light facing straight down.\n */\n target?: Vec3;\n /**\n * Hemisphere lights only: the color from below (`groundColor`). `color` is\n * the sky. Absent is black, a sky with no ground bounce.\n */\n groundColor?: string;\n distance?: number;\n decay?: number;\n angle?: number;\n penumbra?: number;\n /** Area lights only, in world units. */\n size?: { width: number; height: number };\n /** Angular diameter in degrees: the shadow-softness dial for a sun. */\n angleDeg?: number;\n /** An IES profile, content-addressed. */\n ies?: AssetHash;\n castShadow?: boolean;\n};\n\n// ---------------------------------------------------------------------------\n// Color management\n// ---------------------------------------------------------------------------\n\n/**\n * The renderer's own color settings, copied verbatim.\n *\n * This is the difference between a render that looks like the developer's\n * app and one that is subtly, unfixably wrong. three's defaults changed in\n * r152 and again in r155; reading the live renderer beats assuming any of\n * them.\n */\nexport type ColorSpec = {\n outputColorSpace: 'srgb' | 'srgb-linear' | 'display-p3';\n toneMapping:\n | 'none'\n | 'linear'\n | 'reinhard'\n | 'cineon'\n | 'aces-filmic'\n | 'agx'\n | 'neutral';\n toneMappingExposure: number;\n};\n\n// ---------------------------------------------------------------------------\n// Material fallbacks and compatibility\n// ---------------------------------------------------------------------------\n\n/**\n * What to do with a material the renderer cannot be given honestly.\n *\n * Arbitrary GLSL does not translate, and the answer is to say so rather\n * than quietly render gray. A fallback is the developer's explicit\n * override, from `<Bakery3Material render={...}>` or from\n * `material.userData.bakery3.fallback`.\n */\nexport type MaterialFallback = {\n /** The material's uuid in the exported GLB. */\n materialId: string;\n type: 'physical';\n color?: string;\n metalness?: number;\n roughness?: number;\n clearcoat?: number;\n clearcoatRoughness?: number;\n transmission?: number;\n thickness?: number;\n ior?: number;\n emissive?: string;\n emissiveIntensity?: number;\n opacity?: number;\n sheen?: number;\n sheenColor?: string;\n iridescence?: number;\n anisotropy?: number;\n};\n\nexport type CompatibilitySeverity = 'info' | 'warning' | 'error';\n\n/**\n * One thing the SDK could not promise to reproduce: what it is, where it\n * lives in the tree, why, and the fix, without opening a debugger.\n */\nexport type CompatibilityIssue = {\n code: string;\n severity: CompatibilitySeverity;\n message: string;\n /** `<Car>/<Body>/<Paint>`: the path a developer can actually find. */\n path?: string;\n objectId?: string;\n materialId?: string;\n materialName?: string;\n materialType?: string;\n /** Deep link into the docs. */\n docs?: string;\n};\n\nexport type CompatibilityReport = {\n /** 0 to 1. Objects that will render faithfully, weighted by triangle count. */\n score: number;\n issues: CompatibilityIssue[];\n /** Rolled up for the devtools panel and the render record. */\n counts: { info: number; warning: number; error: number };\n};\n\n// ---------------------------------------------------------------------------\n// Output and quality\n// ---------------------------------------------------------------------------\n\n/** Presets, not raw renderer settings. Most scenes need only these. */\nexport type QualityPreset = 'preview' | 'studio' | 'ultra';\n\nexport type OutputFormat =\n 'png' | 'jpeg' | 'webp' | 'exr' | 'mp4' | 'webm' | 'png-sequence';\n\n/**\n * H.264 in mp4, VP9 in webm: an encoded video, opaque, written by the\n * renderer's own muxer. Both require `manifest.animation`: there is no\n * sensible video of a still, and guessing at one is not the worker's job.\n */\nexport const VIDEO_FORMATS: OutputFormat[] = ['mp4', 'webm'];\n\n/**\n * Every frame of a clip as its own PNG, alpha kept, delivered as one\n * uncompressed tar (`render.tar`) with a `frames.json` index first. Each\n * frame is exactly what a `png` still of that pose would be: the same color\n * pipeline, the background and the shadow catcher in alpha as a still has\n * them, straight (unassociated) alpha. For a compositor that puts the\n * product between layers of its own, which an mp4 cannot feed.\n */\nexport const SEQUENCE_FORMATS: OutputFormat[] = ['png-sequence'];\n\n/** An encoded video container: opaque, one file, no per-frame alpha. */\nexport function isVideoFormat(format: OutputFormat): boolean {\n return VIDEO_FORMATS.includes(format);\n}\n\n/** One file per frame, packed in a tar. */\nexport function isSequenceFormat(format: OutputFormat): boolean {\n return SEQUENCE_FORMATS.includes(format);\n}\n\n/**\n * A format that renders every frame of `manifest.animation` rather than one\n * still: a video or a sequence. It needs an animation, it is priced at the\n * clip rate, and the format is part of what the trace produces (so it is in\n * the cache key, where a still's format is not).\n */\nexport function isClipFormat(format: string | undefined): boolean {\n return (\n format !== undefined &&\n (isVideoFormat(format as OutputFormat) ||\n isSequenceFormat(format as OutputFormat))\n );\n}\n\n/**\n * The result's file name, which is also its name in storage: the worker\n * writes it and the control plane signs a PUT for it before the render runs,\n * so both sides read it from here.\n */\nexport function outputFileName(format: OutputFormat): string {\n if (isSequenceFormat(format)) return 'render.tar';\n return `render.${format === 'jpeg' ? 'jpg' : format}`;\n}\n\n/**\n * Bits per channel of a PNG output, a still's or a sequence's frames, unless\n * `bitDepth` says otherwise. 16, so a sequence's frame is the very PNG a\n * still of that pose is, and a compositor grading it has the headroom a\n * still gives. 8 is for a pipeline that ends in 8 bits anyway: measured\n * 2026-10-03 at 1400 × 1504, it is 0.98 MB a frame against 2.24 MB, and the\n * same time to trace and write.\n */\nexport const PNG_BIT_DEPTH_DEFAULT = 16;\n\n/** The first file in a `png-sequence` tar: what the rest of it is. */\nexport const FRAME_SEQUENCE_INDEX = 'frames.json';\n\n/**\n * `frame_00000.png`, zero-based like `animation.frameCount`'s frames, so file\n * `k` is the pose a channel's `k`-th sample describes.\n */\nexport function frameFileName(frame: number): string {\n return `frame_${String(frame).padStart(5, '0')}.png`;\n}\n\n/** `frames.json`, at the head of a `png-sequence` tar. */\nexport type FrameSequenceIndex = {\n fps: number;\n frameCount: number;\n width: number;\n height: number;\n bitDepth: 8 | 16;\n /** In frame order, one per frame: `frameFileName(0)` onwards. */\n files: string[];\n};\n\nexport type OutputSpec = {\n width: number;\n height: number;\n format: OutputFormat;\n /** JPEG/WebP only, 1 to 100. */\n quality?: number;\n /**\n * PNG and `png-sequence` only: bits per channel, 16 unless 8 is asked\n * for (`PNG_BIT_DEPTH_DEFAULT`).\n */\n bitDepth?: 8 | 16;\n /** Force an opaque background even when the environment is transparent. */\n opaque?: boolean;\n};\n\n/**\n * Escape hatch under the presets. Present so an expert is never blocked,\n * absent from the quickstart so a beginner is never asked to become a\n * rendering expert to get one image.\n */\nexport type AdvancedRenderSettings = {\n samples?: number;\n maxBounces?: number;\n diffuseBounces?: number;\n glossyBounces?: number;\n transmissionBounces?: number;\n /** Adaptive sampling noise floor: the real cost dial once denoising is on. */\n adaptiveThreshold?: number;\n denoise?: boolean;\n denoiser?: 'OPTIX' | 'OPENIMAGEDENOISE';\n /** Pays for itself with many emitters, costs overhead with few. */\n lightTree?: boolean;\n /**\n * Light that reaches a surface through glass: the bright pool under a\n * tumbler, the focus line beneath a lens. Off by default: with no caustic\n * paths a transmissive object casts a solid shadow, which is also what the\n * viewport's shadow maps draw, and tracing them costs samples a product\n * shot rarely needs.\n *\n * `'soft'` lets the path tracer find caustic paths itself, with the glossy\n * filter and the indirect clamp (both of which exist to hide caustics)\n * switched off. Unbiased, and slow to converge: a hard light through\n * curved glass stays grainy at studio samples.\n *\n * `'sharp'` adds a dedicated shadow-caustic solver on top: every scene\n * lamp casts caustics, every transmissive mesh is a caster, and every\n * other mesh (the shadow catcher included) receives them. This is what\n * makes a glass on a table converge at normal sample counts. It handles a\n * single refractive object between a lamp and a surface; light from an\n * HDRI or an emissive mesh still goes the `'soft'` way.\n *\n * The solver takes over lamp light through a caster rather than adding to\n * the traced paths, and it only follows light that goes straight through.\n * A faceted stone, whose light leaves after internal reflections, comes\n * back under `'sharp'` with no caustic at all. Cut gems want `'soft'`.\n *\n * Absent is off. There is no boolean on purpose: `caustics: true` would\n * have to mean one of the two. Changes pixels, so it is in the cache key.\n */\n caustics?: 'soft' | 'sharp';\n /**\n * A ceiling on how bright one indirect sample may be, in scene radiance.\n * Absent is the renderer's own default, which `caustics` switches off: a\n * caustic's focus is a very bright indirect sample, and capping it dims\n * the focus. That is right for a still and wrong for a clip, because the\n * rare uncapped hit lands on different pixels every frame, the denoiser\n * smears each one into a soft patch, and the patches boil. For caustics\n * in motion, start at 30 (the pool under a lens is still its full\n * brightness there) and trace larger than you publish.\n *\n * Set, it wins over what `caustics` would have chosen. Changes pixels, so\n * it is in the cache key, present only when set.\n */\n clampIndirect?: number;\n /**\n * Multiplies the converted energy of every light lifted from the scene\n * graph (directional, point, spot, area and the ambient dome) and leaves\n * the HDRI environment alone. The worker's unit table is physics and stays\n * fixed; this dial is for the residual gap, where a viewport (legacy-lights\n * intensities, usually) reads brighter than the physically converted lamps\n * do. One scalar, so the ratio between the scene's lights is preserved.\n * Default 1. Changes pixels, so it is in the cache key.\n */\n lightScale?: number;\n /**\n * Ground the product with a traced shadow catcher. Defaults on for\n * transparent/solid output and off for a visible environment background.\n */\n shadowCatcher?: boolean;\n /** Catcher size, as a multiple of the model's largest dimension. */\n shadowPad?: number;\n /**\n * The renderer's view transform override. Changes pixels, so it is in the\n * cache key. Pinning one also switches off `toneCurveEmulation`: an\n * explicit name is a statement about what the render should look like.\n */\n viewTransform?: string;\n /**\n * Reproduce three's tone mapping exactly instead of substituting the\n * nearest native view transform. On by default, and it is what makes a\n * traced frame the same color as the viewport it came from.\n *\n * Turn it off to get the substitution: a wider, more forgiving curve for a\n * scene whose viewport was never the reference. Changes pixels, so it is\n * in the cache key.\n */\n toneCurveEmulation?: boolean;\n /** Seconds. The worker stops the render rather than billing an unbounded job. */\n timeoutSeconds?: number;\n};\n\n// ---------------------------------------------------------------------------\n// The manifest\n// ---------------------------------------------------------------------------\n\n/**\n * Everything one render needs, minus the bytes.\n *\n * Typically a few KB. The heavy things (the GLB, textures, the HDRI) are\n * `sha256:` references that the control plane resolves against storage the\n * SDK already filled (see asset.ts).\n */\nexport type SceneManifest = {\n protocolVersion: string;\n sdkVersion: string;\n /** The exported GLB. */\n sceneAsset: AssetHash;\n /**\n * Extra blobs this scene needs that are not inside the GLB: an HDRI, an\n * IES profile, a texture the SDK stripped out to keep the GLB cacheable.\n */\n assets?: AssetHash[];\n camera: CameraSpec;\n runtime?: RuntimeState;\n environment?: EnvironmentSpec;\n lights?: LightSpec[];\n color: ColorSpec;\n fallbacks?: MaterialFallback[];\n /**\n * Node materials, as portable shader graphs (see shader.ts). The GLB still\n * carries the mesh; the material the exporter wrote for it is a stand-in\n * that the worker replaces wholesale with the rebuilt graph.\n */\n shaders?: MaterialShaderSpec[];\n /**\n * Baked per-frame motion (see animation.ts). Present only for a video,\n * and its presence is what makes this a 3.0 manifest.\n *\n * Not inside `runtime` on purpose: runtime is the one state the\n * application was in when Render was pressed, and every field in it is a\n * single value. A sequence is a different kind of thing.\n */\n animation?: AnimationSpec;\n /**\n * A room preset around the product (see room.ts). Its geometry, lights\n * and sky are not in the GLB or in `lights`: the worker rebuilds all of it\n * from the published definition, so a product in a room uploads only the\n * product. Presence makes this a 4.0 manifest.\n */\n room?: RoomPresetSpec;\n compatibility?: CompatibilityReport;\n /**\n * What the scene weighs, measured by the SDK at capture. The control plane\n * prices with it (a dense scene traces slower per pixel and unwraps slower\n * per object), so the quote a job is accepted under is the same one\n * `estimate()` gave with the same numbers. Operational, not visual: it is\n * outside every cache key.\n */\n stats?: {\n triangles: number;\n /** Bytes of texture the manifest's shader graphs sample, when known. */\n textureBytes?: number;\n /**\n * Distinct materials that emit light: a standard material with a\n * non-black emissive color, an unlit material (rendered as emission), or\n * a node material with an emission graph. The worker turns its light\n * tree on from this. Only the SDK can count them, since the GLB's\n * materials are opaque to the control plane.\n */\n emitters?: number;\n /**\n * How much of the sky above the camera the scene's geometry hides, 0 for\n * an open set and 1 inside a closed room (`SceneComplexity`). Walls keep\n * light bouncing, which is most of what makes an interior slow to render,\n * so the quote reads it. A preset room's stand-in counts, though it is not\n * uploaded: it stands for the room the renderer builds.\n */\n enclosure?: number;\n /** Meshes the scene draws, instances counted: how full it is. */\n objects?: number;\n };\n /**\n * Where the scene came from. Diagnostics only, but \"which three version\"\n * is the first question every support conversation starts with.\n */\n source?: {\n three?: string;\n r3f?: string;\n renderer?: string;\n userAgent?: string;\n };\n};\n\n/** A manifest plus what to make from it. This is the render request body. */\nexport type RenderSpec = {\n manifest: SceneManifest;\n quality: QualityPreset;\n output: OutputSpec;\n advanced?: AdvancedRenderSettings;\n /**\n * Hard ceiling in USD. Exceeded at estimate time means the job is refused\n * before it is admitted: `RenderBudgetExceeded`, not a surprise bill.\n */\n maxCost?: number;\n /** Emit a low-sample preview partway through. On by default for `studio`. */\n preview?: boolean;\n /** Echoed on the render record and every webhook. */\n metadata?: Record<string, unknown>;\n /**\n * A resubmit with the same key returns the existing render while it is\n * running or once it has completed, never a second charge. This is what\n * makes the SDK's own retries safe. A key whose render failed, was\n * cancelled or expired is free again: nothing was charged, and the\n * resubmit renders.\n */\n idempotencyKey?: string;\n /**\n * `high` puts this render ahead of the account's other waiting work in\n * the same lane: the hero shot before the rest of the queue. It never\n * jumps a lane; a person waiting still goes first.\n */\n priority?: 'normal' | 'high';\n};\n","/**\n * Quality presets: three words instead of a renderer manual.\n *\n * The three names are the public surface. The numbers below are read by the\n * worker, the estimator and the cache key from this one table, so they\n * cannot drift apart. `version` is here because changing any number changes\n * pixels: it travels in the render record and in the render cache key, so a\n * catalog that re-renders a SKU never silently gets a different image.\n */\n\nimport type { QualityPreset } from './manifest.js';\n\nexport type QualitySettings = {\n /** Bumped whenever any number in this preset changes. */\n version: number;\n /** A ceiling, not a target: adaptive sampling decides when a pixel stops. */\n samples: number;\n /**\n * The real cost dial. With adaptive sampling on, this noise floor is what\n * ends a pixel; the renderer's own default is strict enough that most\n * pixels run to the ceiling anyway.\n */\n adaptiveThreshold: number;\n maxBounces: number;\n diffuseBounces: number;\n glossyBounces: number;\n transmissionBounces: number;\n denoise: boolean;\n /** Long edge, in px, when the caller gives no explicit output size. */\n defaultLongEdge: number;\n /** Emit a low-sample preview partway through. */\n preview: boolean;\n /** Samples for that preview. Small enough to arrive in about a second. */\n previewSamples: number;\n};\n\nexport const QUALITY: Record<QualityPreset, QualitySettings> = {\n /**\n * \"Show me roughly what this will look like.\" Cheap enough to sit inside a\n * click, noisy enough that nobody will ship it.\n *\n * No denoiser, since version 3 (2026-10-03): with it, 32 samples of a\n * product came out close to a studio render, so the cheapest tier was a\n * finished image at half the price. The grain says draft, every choice a\n * preview is for (framing, light, materials, color) still reads through\n * it, and most of a preview's time was the denoiser.\n */\n preview: {\n version: 3,\n samples: 32,\n adaptiveThreshold: 0.08,\n maxBounces: 4,\n diffuseBounces: 2,\n glossyBounces: 4,\n transmissionBounces: 4,\n denoise: false,\n defaultLongEdge: 1024,\n preview: false,\n previewSamples: 16,\n },\n\n /**\n * The default. Deep enough on glossy and transmission to carry glaze,\n * metal and glass, which is where a product shot lives, and shallow on\n * diffuse, which buys almost nothing on a product against a transparent\n * background. The threshold ends most pixels well before the ceiling; the\n * denoiser carries the noisiest ones.\n */\n studio: {\n version: 2,\n samples: 256,\n adaptiveThreshold: 0.02,\n maxBounces: 8,\n diffuseBounces: 3,\n glossyBounces: 8,\n transmissionBounces: 8,\n denoise: true,\n defaultLongEdge: 2048,\n preview: true,\n previewSamples: 24,\n },\n\n /**\n * For the hero image that goes on the homepage. Roughly 8x studio's sample\n * ceiling and a much stricter threshold.\n */\n ultra: {\n version: 1,\n samples: 2048,\n adaptiveThreshold: 0.005,\n maxBounces: 16,\n diffuseBounces: 6,\n glossyBounces: 16,\n transmissionBounces: 16,\n denoise: true,\n defaultLongEdge: 4096,\n preview: true,\n previewSamples: 32,\n },\n};\n\n/** The preset with any `advanced` overrides folded in. */\nexport function resolveQuality(\n preset: QualityPreset,\n advanced?: Partial<QualitySettings> & {\n samples?: number;\n maxBounces?: number;\n },\n): QualitySettings {\n const base = QUALITY[preset];\n if (!advanced) return base;\n return { ...base, ...stripUndefined(advanced) };\n}\n\nfunction stripUndefined<T extends object>(value: T): Partial<T> {\n return Object.fromEntries(\n Object.entries(value).filter(([, v]) => v !== undefined),\n ) as Partial<T>;\n}\n","/**\n * A batch: a customer's declared body of work.\n *\n * A catalog is products x finishes x cameras, a few thousand stills. The\n * customer opens a batch, adds items in pages, closes it, and reads one\n * ledger back. On the control plane every item is a render row with a\n * `batchId`, staged behind the queue proper and fed into it a page at a\n * time, so everything that holds for a render (the claim, the reservation,\n * single billing, webhooks, retention) holds for an item because it is one.\n */\n\nimport type { RenderSpec } from './manifest.js';\nimport type { BakeSpec } from './bake.js';\nimport type { RenderError } from './job.js';\n\nexport const BATCH_STATES = [\n 'open',\n 'sealed',\n 'paused',\n 'completed',\n 'cancelled',\n] as const;\nexport type BatchState = (typeof BATCH_STATES)[number];\n\n/** A page of items is at most this many. The SDK flushes at it. */\nexport const BATCH_PAGE_SIZE = 100;\n\n/**\n * And at most this many bytes of JSON. A hundred ordinary manifests are a\n * few hundred KB; a hundred manifests that each carry extracted shader\n * graphs are not, and a page is one request and one admission decision, so\n * it has to fit in both. The SDK closes a page at whichever limit comes\n * first; the route refuses a page over it by name.\n */\nexport const BATCH_PAGE_BYTES = 4 * 1024 * 1024;\n\n/**\n * One item's spec, as JSON, is at most this. The bytes belong in assets,\n * which are content addressed and uploaded once; a manifest this large is\n * carrying something inline that should have been one.\n */\nexport const BATCH_ITEM_BYTES = 900 * 1024;\n\n/**\n * How many items are in each state. `staged` items are admitted: priced,\n * reserved, waiting behind the queue proper. `queued` are in the queue and\n * `running` hold a worker. `refused` failed for a reason a retry would not\n * change (the scene's fault, or ours to explain); `failed` ran out of\n * attempts on an infrastructure failure. `adopted` were already completed\n * under the same key when they were added and cost nothing.\n */\nexport type BatchCounts = {\n staged: number;\n queued: number;\n running: number;\n completed: number;\n failed: number;\n refused: number;\n cancelled: number;\n adopted: number;\n};\n\nexport type BatchCost = {\n /** Sum of estimatedCost over admitted items. */\n estimated: number;\n /** Sum of maximumCost over admitted items: what admission reserved. */\n maximum: number;\n /** Sum of what completed items actually cost, so far. */\n actual: number;\n};\n\nexport type BatchRecord = {\n id: string;\n key: string;\n name?: string;\n kind: 'render' | 'bake';\n state: BatchState;\n lane: 'batch' | 'normal';\n maxParallel?: number;\n /** The customer's ceiling for the whole batch. */\n maxCost?: number;\n counts: BatchCounts;\n /** Every item ever admitted, adopted included. */\n total: number;\n /** How many are terminal. `done === total` once sealed is `completed`. */\n done: number;\n cost: BatchCost;\n /** Why it is paused, when it is: the breaker names the top refusal codes. */\n pausedReason?: string;\n createdAt: number;\n sealedAt?: number;\n finishedAt?: number;\n};\n\nexport type BatchOpenRequest = {\n /**\n * Stable across re-runs: the same key re-opens the same batch while it is\n * not terminal, and items already completed under their keys are adopted\n * rather than rendered again.\n */\n key: string;\n name?: string;\n kind?: 'render' | 'bake';\n /**\n * The ceiling for the whole batch, in dollars. A page that would take the\n * batch's maximum past it is refused whole.\n */\n maxCost?: number;\n /**\n * `batch` (the default) never runs ahead of a person in a configurator;\n * `normal` is the API's ordinary lane.\n */\n lane?: 'batch' | 'normal';\n /** Fewer parallel items than the plan allows, for a gentler budget. */\n maxParallel?: number;\n};\n\nexport type BatchItemRequest = {\n /**\n * The item's idempotency key, scoped to the project like every other\n * render's. `sku/finish/camera@v3` is the shape the docs suggest.\n */\n key: string;\n spec: RenderSpec | BakeSpec;\n metadata?: Record<string, unknown>;\n /** A ceiling for this one item, under the batch's. */\n maxCost?: number;\n};\n\nexport type BatchAddRequest = {\n items: BatchItemRequest[];\n /**\n * Price everything, admit nothing: the whole catalog's numbers before a\n * dollar is reserved.\n */\n dryRun?: boolean;\n};\n\nexport type BatchItemOutcome = {\n key: string;\n /** The render's id, when it was admitted or adopted. */\n id?: string;\n estimatedCost: number;\n maximumCost: number;\n /** Already completed under this key: attached at no cost. */\n adopted?: boolean;\n /**\n * Why this item, alone, was not admitted (a bad spec, an item over its own\n * maxCost). The page's other items are unaffected.\n */\n error?: RenderError;\n};\n\nexport type BatchAddResponse = {\n batch: BatchRecord;\n items: BatchItemOutcome[];\n};\n\n/** One line of `GET /v1/batches/:id/export`: the ledger, item by item. */\nexport type BatchExportLine = {\n key: string;\n id: string;\n state: string;\n resultUrl?: string;\n error?: RenderError;\n cost?: number;\n versions?: Record<string, unknown>;\n metadata?: Record<string, unknown>;\n};\n","/**\n * Errors a developer can act on.\n *\n * \"Render failed\" is a bad error. A traceback is a worse one. Every failure\n * that reaches the developer carries what went wrong, where, why, and what to\n * do about it, and `code` stays stable so the failure can also be branched on\n * in code.\n */\n\nimport type {\n BatchItemOutcome,\n BatchItemRequest,\n RenderErrorCode,\n RenderError,\n} from './protocol/index.js';\n\n/**\n * Codes the SDK can raise that the render protocol does not: a fault on the\n * way (`NetworkError`), a fault before anything left the browser\n * (`CaptureFailed`), the two refusals a batch page can meet as a whole (over\n * the batch's own ceiling, or after it was sealed), and the two ends of a job\n * that are not faults in the scene: it was cancelled (`Cancelled`), or its\n * files were deleted before it was read (`Expired`).\n */\nexport type Bakery3ErrorCode =\n | RenderErrorCode\n | 'NetworkError'\n | 'CaptureFailed'\n | 'BatchBudgetExceeded'\n | 'BatchClosed'\n | 'Cancelled'\n | 'Expired';\n\nexport class Bakery3Error extends Error {\n readonly code: Bakery3ErrorCode;\n readonly why?: string;\n readonly fix?: string;\n readonly docs?: string;\n readonly path?: string;\n readonly retryable: boolean;\n\n constructor(init: {\n code: Bakery3ErrorCode;\n message: string;\n why?: string;\n fix?: string;\n docs?: string;\n path?: string;\n retryable?: boolean;\n }) {\n super(init.message);\n this.name = 'Bakery3Error';\n this.code = init.code;\n this.why = init.why;\n this.fix = init.fix;\n this.docs = init.docs;\n this.path = init.path;\n this.retryable = init.retryable ?? false;\n showFixInStack(this);\n }\n\n static from(error: RenderError): Bakery3Error {\n return new Bakery3Error(error);\n }\n\n /**\n * The multi-line form, for a console or a devtools panel.\n *\n * `Error.message` stays one line so it reads correctly everywhere a message\n * is expected to be one: a log aggregator, a toast, a test name. `stack`\n * starts with this form, so an uncaught error prints its fix.\n */\n toDisplayString(): string {\n const lines = [this.message];\n if (this.path) lines.push('', 'Location:', this.path);\n if (this.why) lines.push('', 'Why:', this.why);\n if (this.fix) lines.push('', 'Fix:', this.fix);\n if (this.docs) lines.push('', 'Docs:', this.docs);\n return lines.join('\\n');\n }\n}\n\n/**\n * Make `stack` carry the whole error, not just its first line.\n *\n * A browser console, React's error overlay and Node all print an uncaught\n * error as its `stack`, which starts with `name: message`. The why, the fix\n * and the docs link would be invisible exactly when they are needed. So the\n * stack starts with `toDisplayString()` instead, followed by the original\n * frames, which stay lines beginning with \" at \" where the engine writes\n * them that way.\n *\n * A getter, not a value: a subclass sets its own `name` after this runs, and\n * its stack must say `RenderBudgetExceeded`, not `Bakery3Error`. Assigning to\n * `stack` still works, for a tool that rewrites it.\n */\nfunction showFixInStack(error: Bakery3Error): void {\n let raw: string | undefined;\n try {\n raw = error.stack;\n } catch {\n return;\n }\n try {\n Object.defineProperty(error, 'stack', {\n configurable: true,\n enumerable: false,\n get(this: Bakery3Error) {\n const frames = framesOf(raw, this.message);\n const head = `${this.name}: ${this.toDisplayString()}`;\n return frames ? `${head}\\n${frames}` : head;\n },\n set(this: Bakery3Error, value: unknown) {\n Object.defineProperty(this, 'stack', {\n configurable: true,\n enumerable: false,\n writable: true,\n value,\n });\n },\n });\n } catch {\n // A frozen or exotic error object keeps the engine's own stack.\n }\n}\n\n/**\n * The frames of an engine's stack, without its header.\n *\n * V8 (Chrome, Node, Edge) and Bun write `Name: message` and then one\n * \" at ...\" line per frame. Safari and Firefox write frames only\n * (`fn@file:1:2`), with no header to remove.\n */\nfunction framesOf(raw: string | undefined, message: string): string {\n if (!raw) return '';\n const lines = raw.split('\\n');\n const first = lines.findIndex((line) => /^\\s+at\\s/.test(line));\n if (first >= 0) return lines.slice(first).join('\\n');\n // No \"at\" lines: either frames in the Safari/Firefox form, or a V8 stack\n // with no frames, which is only its header.\n const header = lines[0] ?? '';\n return /^[\\w$.]*:/.test(header) && header.includes(message) ? '' : raw;\n}\n\n/** What was refused, so the refusal can say which dials bring the price down. */\nexport type BudgetedKind = 'render' | 'video' | 'bake';\n\nconst BUDGET_FIX: Record<BudgetedKind, string> = {\n render:\n 'Raise maxCost, lower the quality preset, or reduce the output resolution.',\n video:\n 'Raise maxCost, lower the quality preset or the resolution, or render fewer frames.',\n bake: 'Raise maxCost, lower the bake quality or the texture size, or bake fewer objects.',\n};\n\n/**\n * What a budget refusal can say. Every field is optional, because a refusal\n * from the API may carry fewer numbers than the SDK's own check knows.\n */\nexport type RenderBudgetInit = {\n message?: string;\n why?: string;\n fix?: string;\n docs?: string;\n /** The ceiling that was set. */\n maxCost?: number;\n estimatedCost?: number;\n maximumCost?: number;\n kind?: BudgetedKind;\n};\n\n/**\n * The budget refusal.\n *\n * Its own class because it is the one failure a developer is expected to\n * catch by type rather than by code: it is a normal, designed outcome of\n * setting `maxCost`, not a fault. Nothing was sent to a renderer and nothing\n * was charged.\n *\n * `instanceof RenderBudgetExceeded` catches both ways it is raised: the SDK's\n * own check before an upload (`new RenderBudgetExceeded(maxCost, quote,\n * kind)`, every number known), and the API's 402 (`new\n * RenderBudgetExceeded({ ... })`, with whatever numbers that answer carried,\n * for example from a browser token that has spent its allowance).\n */\nexport class RenderBudgetExceeded extends Bakery3Error {\n /** The ceiling that was set, when known. */\n readonly maxCost?: number;\n readonly estimatedCost?: number;\n /** The ceiling the job would have been accepted under: the number `maxCost` is held against. */\n readonly maximumCost?: number;\n readonly kind: BudgetedKind;\n\n constructor(\n maxCost: number,\n quote: { estimatedCost: number; maximumCost: number },\n kind?: BudgetedKind,\n );\n constructor(init: RenderBudgetInit);\n constructor(\n first: number | RenderBudgetInit,\n quote?: { estimatedCost: number; maximumCost: number },\n kind: BudgetedKind = 'render',\n ) {\n const init: RenderBudgetInit =\n typeof first === 'number'\n ? {\n maxCost: first,\n estimatedCost: quote?.estimatedCost,\n maximumCost: quote?.maximumCost,\n kind,\n }\n : first;\n const what = init.kind ?? 'render';\n super({\n code: 'RenderBudgetExceeded',\n message: init.message || budgetMessage(what, init),\n why:\n init.why ??\n `maxCost is held against the maximum a ${what} can be charged, not its estimate, so that it is a ceiling. The ${what} was refused before any GPU work started, and nothing was charged.`,\n fix: init.fix ?? BUDGET_FIX[what],\n docs: init.docs ?? 'https://bakery3.com/docs/cost',\n retryable: false,\n });\n this.name = 'RenderBudgetExceeded';\n this.maxCost = init.maxCost;\n this.estimatedCost = init.estimatedCost;\n this.maximumCost = init.maximumCost;\n this.kind = what;\n }\n}\n\n/**\n * The message quotes the maximum, because that is what was compared; the\n * estimate alone can read as under the ceiling. A number that is missing is\n * left out rather than printed as NaN.\n */\nfunction budgetMessage(kind: BudgetedKind, init: RenderBudgetInit): string {\n const usd = (n: number) => `$${n.toFixed(2)}`;\n const { maxCost, estimatedCost, maximumCost } = init;\n if (maximumCost !== undefined && maxCost !== undefined) {\n const estimate =\n estimatedCost !== undefined ? ` (estimated ${usd(estimatedCost)})` : '';\n return `This ${kind} could cost up to ${usd(maximumCost)}, which exceeds maxCost ${usd(maxCost)}${estimate}`;\n }\n if (maximumCost !== undefined)\n return `This ${kind} could cost up to ${usd(maximumCost)}, which is over its budget.`;\n return `This ${kind} is over its budget.`;\n}\n\n/**\n * A whole page of batch items was refused.\n *\n * Admission is per page: the control plane prices the page, checks it against\n * the account's balance and the batch's own `maxCost`, and either admits\n * every item or none. A `402 InsufficientBalance`, a `402 BatchBudgetExceeded`\n * or a `409 BatchClosed` means nothing in the page was admitted. The `Batch`\n * keeps those items buffered, so after a top-up (or a higher ceiling)\n * `flush()` sends exactly the same page again.\n *\n * `admitted` is what earlier pages of the same flush already got through:\n * those items are the server's now, and this error carries their outcomes so\n * a caller does not lose them because a later page was refused.\n */\nexport class BatchPageRefused extends Bakery3Error {\n /** The page that was refused whole, still in the batch's buffer. */\n readonly page: BatchItemRequest[];\n /** Outcomes of the pages this flush admitted before the refusal. */\n readonly admitted: BatchItemOutcome[];\n\n constructor(\n cause: Bakery3Error,\n page: BatchItemRequest[],\n admitted: BatchItemOutcome[],\n ) {\n super({\n code: cause.code,\n message: `${cause.message} ${page.length} item${page.length === 1 ? '' : 's'} still buffered.`,\n why:\n cause.why ??\n 'A batch page is admitted whole or not at all, so nothing in this page was priced against your balance.',\n fix:\n cause.fix ??\n (cause.code === 'BatchClosed'\n ? 'The batch is sealed; open a new one (a new key) for more items.'\n : 'Top up, or raise the ceiling, then call flush() again. The buffer is intact.'),\n docs: cause.docs ?? 'https://bakery3.com/docs/cost',\n path: cause.path,\n retryable: cause.code !== 'BatchClosed',\n });\n this.name = 'BatchPageRefused';\n this.page = page;\n this.admitted = admitted;\n }\n}\n","/** The published version. Must equal the version in package.json. */\nexport const SDK_VERSION = '0.1.0';\n","/**\n * The \"your API key is in the page\" warning.\n *\n * A secret key never belongs in browser JavaScript: every visitor can read\n * it from the network tab. But pasting a key into an app and pressing the\n * button is how a first render happens, so the key works, and the console\n * says exactly what is wrong with it and what to do before shipping.\n *\n * The warning fires once per key, not once per render, so a provider that\n * re-mounts on every hot reload cannot bury it.\n */\n\nconst warned = new Set<string>();\n\n/** Browser tokens are minted for a browser. Only the rest are a leak. */\nconst BROWSER_TOKEN_PREFIX = 'bk_pt_';\n\n/**\n * Is this a client someone else can read the bundle of?\n *\n * A DOM, a worker, or React Native: all three ship the key to a device the\n * developer does not control. Node, Deno and Bun are the server case this\n * warning points people back towards, so they stay quiet.\n */\nexport function isBrowserLike(scope: typeof globalThis = globalThis): boolean {\n const global = scope as {\n window?: { document?: unknown };\n document?: unknown;\n navigator?: { product?: string };\n importScripts?: unknown;\n process?: { versions?: { node?: string } };\n };\n\n // A bundler shim can define `window` in Node. The real thing has a document.\n if (typeof global.window === 'object' && global.window !== null) {\n if (global.window.document !== undefined) return true;\n }\n if (typeof global.importScripts === 'function') return true; // web worker\n if (global.navigator?.product === 'ReactNative') return true;\n return false;\n}\n\nfunction isProductionBuild(scope: typeof globalThis = globalThis): boolean {\n // Bundlers inline this. `false` only means \"cannot tell\", the common case\n // in a dev server, so it never weakens the warning.\n const env = (\n scope as { process?: { env?: Record<string, string | undefined> } }\n ).process?.env;\n return env?.NODE_ENV === 'production';\n}\n\n/**\n * Enough to recognize which key, useless as one: the first twelve characters,\n * exactly what the Keys page lists each key by (`prefix` in\n * apps/web/convex/keys.ts), so the developer can find the one to rotate. Six\n * characters of a long random secret are no head start on it.\n */\nexport function redact(key: string): string {\n const prefix = /^bk_[a-z]{2}_/.exec(key)?.[0] ?? '';\n const secret = key.slice(prefix.length);\n // A short secret would be half shown by its first six. Show none of it.\n return secret.length < 16 ? `${prefix}…` : `${key.slice(0, 12)}…`;\n}\n\nexport type KeyWarningContext = {\n /** Where the key was handed in, so the fix names the right thing. */\n source: 'apiKey' | 'node';\n scope?: typeof globalThis;\n log?: (message: string) => void;\n};\n\n/**\n * Warn if a long-lived key is being used from a client environment.\n *\n * Returns whether it warned, so a caller can check that a server stays quiet.\n */\nexport function warnIfKeyIsExposed(\n key: string,\n { source, scope = globalThis, log }: KeyWarningContext,\n): boolean {\n if (!key || key.startsWith(BROWSER_TOKEN_PREFIX)) return false;\n if (!isBrowserLike(scope)) return false;\n if (warned.has(key)) return false;\n warned.add(key);\n\n const warn =\n log ??\n (typeof console !== 'undefined' && typeof console.warn === 'function'\n ? (message: string) => console.warn(message)\n : () => {});\n\n warn(message(key, source, isProductionBuild(scope)));\n return true;\n}\n\nfunction message(\n key: string,\n source: KeyWarningContext['source'],\n production: boolean,\n): string {\n const lines = [\n production\n ? `[bakery3] A secret API key is in a PRODUCTION browser bundle: ${redact(key)}`\n : `[bakery3] Your secret API key is in browser JavaScript: ${redact(key)}`,\n '',\n 'Anyone who opens the network tab on this page can read it, and a bk_sk_ key',\n 'can start renders, read every render on the account, and reach billing. It',\n 'cannot be origin-restricted, spend-capped or revoked without replacing it.',\n '',\n production\n ? 'This build has NODE_ENV=production. Do not ship it. Mint a browser token'\n : 'Fine while you are testing. Before you deploy, mint a browser token',\n 'on your own server instead:',\n '',\n ' // app/api/bakery3-token/route.ts (server only)',\n \" import { Bakery3Server } from '@oeave/bakery3/node';\",\n ' const bakery3 = new Bakery3Server(process.env.BAKERY3_SECRET_KEY!);',\n ' export const POST = async () =>',\n ' Response.json(await bakery3.tokens.create({',\n ' expiresInSeconds: 300, maxCost: 1,',\n \" allowedOrigins: ['https://shop.example.com'],\",\n ' }));',\n '',\n ];\n\n if (source === 'apiKey') {\n lines.push(\n ' // browser: token instead of apiKey',\n ' createBakery3({',\n \" token: () => fetch('/api/bakery3-token', { method: 'POST' }).then((r) => r.json()),\",\n ' });',\n '',\n );\n } else {\n lines.push(\n '@oeave/bakery3/node is a server module. Importing it into a component that',\n 'runs in the browser puts the key in the bundle. Keep it behind a route',\n \"handler, a server action, or a file with 'use server'.\",\n '',\n );\n }\n\n lines.push('https://bakery3.com/docs/auth');\n return lines.join('\\n');\n}\n\n/** Clears the once-per-key memory. For tests. */\nexport function resetKeyWarnings(): void {\n warned.clear();\n}\n","/**\n * The HTTP client for the control plane.\n *\n * Small on purpose: a handful of endpoints, one auth header, one error shape.\n * The interesting work happens in the browser (capture, hashing) and on the\n * render workers; this is the thin part in between.\n *\n * The one piece of policy it carries is the retry: a 429 or a 503 is the\n * control plane saying \"not now\", and it is answered with a bounded, jittered\n * wait rather than an error the developer has to write a loop around. Only\n * requests that are safe to repeat are repeated (see `RequestOptions.retry`).\n *\n * In production no secret key reaches this file. The browser holds a\n * short-lived, project-scoped, origin-restricted, spend-capped token minted by\n * the developer's own server. `token` is a function rather than a string so\n * it can be fetched again when one expires, which for a five-minute token in\n * a long configurator session is routine.\n *\n * `apiKey` is the other door, and it is open on purpose: a key works from the\n * browser so the first render is one paste away, and `warnIfKeyIsExposed`\n * says once, with the replacement code, why it must not stay there.\n *\n * Neither is needed to construct a client: `check()` and `inspect()` never\n * touch the network, and a React tree whose environment variable is unset\n * must still mount. A missing credential is refused at the first request,\n * with what to pass instead.\n */\n\nimport type {\n AssetCheckRequest,\n AssetImportRequest,\n AssetImportResponse,\n AssetCheckResponse,\n BakeRecord,\n BakeSettings,\n BakeSpec,\n BatchAddRequest,\n BatchAddResponse,\n BatchExportLine,\n BatchOpenRequest,\n BatchRecord,\n CostEstimate,\n RenderRecord,\n RenderSpec,\n RenderState,\n} from './protocol/index.js';\nimport {\n Bakery3Error,\n RenderBudgetExceeded,\n type Bakery3ErrorCode,\n type BudgetedKind,\n} from './errors.js';\nimport { SDK_VERSION } from './version.js';\nimport { isBrowserLike, redact, warnIfKeyIsExposed } from './warn.js';\n\nexport const DEFAULT_BASE_URL = 'https://api.bakery3.com';\n\n/**\n * The header that names the SDK's version on every request, so the API can\n * warn about, or refuse, an SDK too old to read its answers.\n */\nexport const SDK_VERSION_HEADER = 'bakery3-sdk';\n\n/**\n * Whether a browser sends `SDK_VERSION_HEADER`. A custom header has to be on\n * the API's CORS `access-control-allow-headers` list (`cors()` in\n * apps/web/convex/http.ts), or the preflight fails and every request from a\n * page fails with it. It is on that list, so this is only the switch to turn\n * it off from if that ever changes.\n */\nconst VERSION_HEADER_IN_BROWSERS = true;\n\n/** What `/v1/estimate` prices: a still or a clip, or a bake. */\nexport type EstimateRequest =\n | (Pick<RenderSpec, 'quality' | 'output' | 'advanced'> & {\n /** Triangle count and texture footprint, so an estimate can be given\n * before anything has been uploaded. `room` says the scene stands in a\n * preset room, which the renderer builds around it; `enclosure` and\n * `objects` say how walled in and how full it is from the camera\n * (`SceneComplexity`), which is what makes an interior cost more. */\n scene?: {\n triangles?: number;\n textureBytes?: number;\n fog?: boolean;\n room?: boolean;\n enclosure?: number;\n objects?: number;\n };\n /** Frames in a clip; the control plane prices a video per frame. */\n frames?: number;\n })\n | {\n /** The settings a bake request would carry. Texels (objects × size²)\n * are what the control plane prices. */\n bake: Pick<\n BakeSettings,\n | 'quality'\n | 'textureSize'\n | 'include'\n | 'sizes'\n | 'atlas'\n | 'deliverGlb'\n | 'simplify'\n | 'shadow'\n > & {\n /** The scene is a room interior: a ray that misses keeps going,\n * which is most of what such a bake costs. */\n enclosed?: boolean;\n };\n /** Triangles in the objects the bake would cover: what the unwrap runs\n * over, and priced separately from the scene's own count. */\n bakedTriangles?: number;\n scene?: { triangles?: number; textureBytes?: number; fog?: boolean };\n };\n\n/** A browser token: the string, or the JSON `tokens.create()` answers with. */\nexport type MintedToken = string | { token: string; expiresAt?: number };\n\nexport type TokenProvider = () => MintedToken | Promise<MintedToken>;\n\n/**\n * One of the two, never both. Neither is allowed too, for a client that only\n * checks scenes; its first request is refused with what to pass.\n *\n * The `?: never` arms turn passing both into a type error at the call site\n * rather than a runtime throw later: the two are different integrations, and\n * a codebase carrying both is one that has not finished moving off the key.\n */\nexport type ClientAuth =\n | {\n /** Mints a browser token, usually from your own `/api/bakery3-token`. */\n token: TokenProvider;\n apiKey?: never;\n }\n | {\n /**\n * A `bk_sk_` key used directly, for local testing, a Node script, or a\n * server-rendered call.\n *\n * From a browser this ships the key to every visitor. The SDK allows it\n * so the first render is one paste away, warns about it in the console,\n * and expects `token` by the time you deploy.\n *\n * `undefined` (an environment variable that is not set) is accepted\n * here and refused at the first request, with that said.\n */\n apiKey: string | undefined;\n token?: never;\n }\n | { token?: undefined; apiKey?: undefined };\n\n/**\n * How a 429 or a 503 is waited out. Bounded: after `maxTries` the error is\n * the developer's. The defaults are the SDK's; a test shortens the delays.\n */\nexport type RetryPolicy = {\n /** Attempts in total, the first included. Default 5. */\n maxTries?: number;\n /** The first wait, before jitter and doubling. Default 500 ms. */\n baseDelayMs?: number;\n /** No single wait is longer than this, `Retry-After` included. Default 30 s. */\n maxDelayMs?: number;\n};\n\nexport type ClientOptions = ClientAuth & {\n baseUrl?: string;\n fetch?: typeof fetch;\n retry?: RetryPolicy;\n};\n\n/** Per-request knobs, for the client's own methods. */\nexport type RequestOptions = {\n /**\n * Whether a 429/503 may be answered by sending the request again.\n *\n * Every GET is. A POST is only when repeating it cannot do a second thing:\n * a batch page (its items carry keys), a batch action, a render that\n * carries an `idempotencyKey`. `POST /v1/renders` without one is not: a\n * second copy would be a second charge, which no amount of backoff is\n * worth.\n */\n retry?: boolean;\n /** Cuts a long-poll short. */\n signal?: AbortSignal;\n};\n\n/** `GET /v1/batches/:id/items`: the render record plus the item's key. */\nexport type BatchItemRecord = RenderRecord & { key: string };\n\nexport type BatchItemsPage = {\n items: BatchItemRecord[];\n cursor: string | null;\n};\n\nexport type BatchAction = 'close' | 'pause' | 'resume' | 'cancel' | 'retry';\n\nconst DEFAULT_RETRY: Required<RetryPolicy> = {\n maxTries: 5,\n baseDelayMs: 500,\n maxDelayMs: 30_000,\n};\n\n/** The two creates whose body may be a charge. Anything else is safe to repeat. */\nconst CHARGING_ROUTES = new Set(['/v1/renders', '/v1/bakes']);\n\n/** How many ids a client remembers the creating token of. A long session\n * forgets its oldest first; a forgotten one is read with the current token. */\nconst MAX_OWNERS = 1000;\n\nconst AUTH_DOCS = 'https://bakery3.com/docs/auth';\nconst TOKEN_ROUTE_DOCS = 'https://bakery3.com/docs/auth#the-token-endpoint';\nconst KEYS_URL = 'https://bakery3.com/keys';\n\n/** What a row was created as, for the message when it can no longer be read. */\ntype OwnedKind = 'render' | 'bake' | 'batch';\ntype Owner = `${OwnedKind}:${string}`;\n\n/** The credential a client has, decided once at construction. */\ntype Auth =\n | { kind: 'token'; provider: TokenProvider }\n | { kind: 'key'; key: string }\n /** No usable credential. Refused at the first request, not at construction. */\n | { kind: 'missing'; refusal: () => Bakery3Error };\n\ntype SendOptions = RequestOptions & {\n /** The row this request reads or acts on, whose creating token it uses. */\n owner?: Owner;\n};\n\nexport class Bakery3Client {\n private readonly baseUrl: string;\n private readonly auth: Auth;\n /**\n * The fetch this client sends with: the one passed in `options.fetch`, or\n * the global. Uploads and bundle reads use it too, so a test, a proxy or a\n * runtime with its own fetch sees every request the SDK makes.\n */\n readonly fetch: typeof fetch;\n /** Cached until it expires. Re-minting per render would add a round trip to\n * the developer's own server on the critical path of every click. */\n private cached: { token: string; expiresAt: number } | null = null;\n /** One token fetch at a time. React's StrictMode mounts twice, and two\n * renders at once both find the cache empty: they share this one. */\n private minting: Promise<string> | null = null;\n /**\n * The browser token each render, bake and batch was created with, by id.\n *\n * A token can only read the rows it created. Once it has spent its\n * allowance or expired, the API still lets it read and cancel those rows\n * (for 24 hours past expiry) but not create more, and a freshly minted\n * token cannot read them at all. So a job polls with the token that\n * started it, whatever the local cache thinks of that token's expiry.\n */\n private readonly owners = new Map<Owner, string>();\n private readonly retry: Required<RetryPolicy>;\n private readonly sendVersion: boolean;\n\n constructor(options: ClientOptions = {}) {\n const given = (options ?? {}) as { token?: unknown; apiKey?: unknown };\n const { token, apiKey } = given;\n\n if (token && apiKey) {\n throw new Bakery3Error({\n code: 'InvalidRequest',\n message: 'Pass either token or apiKey, not both.',\n why: 'They are two different integrations, and the SDK will not guess which one you meant.',\n fix: 'Keep `token` for anything you deploy; `apiKey` is for local testing only.',\n docs: AUTH_DOCS,\n });\n }\n\n this.auth = authOf(token, apiKey, 'apiKey' in given);\n this.baseUrl = (options.baseUrl ?? DEFAULT_BASE_URL).replace(/\\/$/, '');\n this.fetch = options.fetch ?? globalThis.fetch.bind(globalThis);\n this.retry = { ...DEFAULT_RETRY, ...options.retry };\n this.sendVersion = VERSION_HEADER_IN_BROWSERS || !isBrowserLike();\n\n if (this.auth.kind === 'key')\n warnIfKeyIsExposed(this.auth.key, { source: 'apiKey' });\n }\n\n /**\n * Why this client cannot make a request, or null when it can. The same\n * error its first request would throw, for a panel or a status line that\n * wants to say so before anyone presses Render.\n */\n credentialError(): Bakery3Error | null {\n return this.auth.kind === 'missing' ? this.auth.refusal() : null;\n }\n\n async token(force = false): Promise<string> {\n const auth = this.auth;\n // A key handed in directly is the credential. There is nothing to cache,\n // nothing to refresh, and a 401 on one means the key is wrong.\n if (auth.kind === 'key') return auth.key;\n if (auth.kind === 'missing') throw auth.refusal();\n\n // 10s of slack: a token that expires while the request is in flight is\n // indistinguishable from a bad one at the far end.\n if (!force && this.cached && this.cached.expiresAt - 10_000 > Date.now()) {\n return this.cached.token;\n }\n this.minting ??= this.mint(auth.provider).finally(() => {\n this.minting = null;\n });\n return this.minting;\n }\n\n private async mint(provider: TokenProvider): Promise<string> {\n let result: unknown;\n try {\n result = await provider();\n } catch (cause) {\n throw providerThrew(cause);\n }\n const { token, expiresAt } = readMinted(result);\n this.cached = {\n token,\n expiresAt:\n expiresAt ??\n // Unknown expiry: hold it for a minute rather than for the session,\n // so a stale one self-heals without a failed render to prompt it.\n Date.now() + 60_000,\n };\n return token;\n }\n\n async checkAssets(body: AssetCheckRequest): Promise<AssetCheckResponse> {\n return this.post<AssetCheckResponse>('/v1/assets/check', body);\n }\n\n /**\n * `POST /v1/assets/import`: have the service fetch a public URL into the\n * project's assets. Secret key only. Safe to repeat: the same bytes are the\n * same asset, and an unchanged URL is answered without a download.\n */\n async importAsset(body: AssetImportRequest): Promise<AssetImportResponse> {\n return this.post<AssetImportResponse>('/v1/assets/import', body);\n }\n\n async estimate(body: EstimateRequest): Promise<CostEstimate> {\n return this.post<CostEstimate>('/v1/estimate', body);\n }\n\n async createRender(body: RenderSpec): Promise<RenderRecord> {\n // Retried only under a key: without one a second POST is a second render.\n const { value, credential } = await this.call<RenderRecord>(\n 'POST',\n '/v1/renders',\n body,\n { retry: Boolean(body.idempotencyKey) },\n );\n this.remember('render', value.id, credential);\n return value;\n }\n\n /**\n * A render's record, with fresh signed URLs for its result and preview.\n * Read with the token that created it, when this client created it.\n */\n async getRender(\n id: string,\n options: { signal?: AbortSignal } = {},\n ): Promise<RenderRecord> {\n return this.read<RenderRecord>('GET', `/v1/renders/${segment(id)}`, {\n owner: `render:${id}`,\n signal: options.signal,\n });\n }\n\n async cancelRender(id: string): Promise<RenderRecord> {\n return this.read<RenderRecord>(\n 'POST',\n `/v1/renders/${segment(id)}/cancel`,\n { owner: `render:${id}` },\n {},\n );\n }\n\n /**\n * `POST /v1/renders/:id/retry`: one more attempt for a dead-lettered render.\n * Answers 201 with a new render linked to the old one, or 409 when the\n * render is not dead-lettered. Not repeated on a 429/503: it creates a\n * render, and a duplicate would be a duplicate charge.\n */\n async retryRender(id: string): Promise<RenderRecord> {\n const { value, credential } = await this.call<RenderRecord>(\n 'POST',\n `/v1/renders/${segment(id)}/retry`,\n {},\n { retry: false, owner: `render:${id}` },\n );\n this.remember('render', value.id, credential);\n return value;\n }\n\n async createBake(body: BakeSpec): Promise<BakeRecord> {\n const { value, credential } = await this.call<BakeRecord>(\n 'POST',\n '/v1/bakes',\n body,\n { retry: Boolean(body.idempotencyKey) },\n );\n this.remember('bake', value.id, credential);\n return value;\n }\n\n async getBake(\n id: string,\n options: { signal?: AbortSignal } = {},\n ): Promise<BakeRecord> {\n return this.read<BakeRecord>('GET', `/v1/bakes/${segment(id)}`, {\n owner: `bake:${id}`,\n signal: options.signal,\n });\n }\n\n async cancelBake(id: string): Promise<BakeRecord> {\n return this.read<BakeRecord>(\n 'POST',\n `/v1/bakes/${segment(id)}/cancel`,\n { owner: `bake:${id}` },\n {},\n );\n }\n\n // -------------------------------------------------------------------------\n // Batches\n // -------------------------------------------------------------------------\n\n /** `POST /v1/batches`. The key is the idempotency key: the same key\n * re-opens the same batch (200) while it is not terminal. */\n async openBatch(body: BatchOpenRequest): Promise<BatchRecord> {\n const { value, credential } = await this.call<BatchRecord>(\n 'POST',\n '/v1/batches',\n body,\n {},\n );\n this.remember('batch', value.id, credential);\n return value;\n }\n\n /**\n * `GET /v1/batches/:id`. With `wait`, long-polls for up to that many\n * seconds (at most 25) until the counts change: the one poll a batch needs.\n */\n async getBatch(\n id: string,\n options: { wait?: number; signal?: AbortSignal } = {},\n ): Promise<BatchRecord> {\n const wait =\n options.wait === undefined\n ? undefined\n : Math.min(25, Math.max(0, options.wait));\n const suffix = wait ? `?wait=${wait}` : '';\n return this.read<BatchRecord>(\n 'GET',\n `/v1/batches/${segment(id)}${suffix}`,\n {\n owner: `batch:${id}`,\n signal: options.signal,\n },\n );\n }\n\n /**\n * `POST /v1/batches/:id/items`: one page, at most `BATCH_PAGE_SIZE`.\n *\n * Every item carries its own key, so the page is safe to send twice: the\n * second copy adopts what the first admitted. A refusal of the whole page\n * (402 InsufficientBalance / BatchBudgetExceeded, 409 BatchClosed) throws;\n * a problem with one item comes back inside `items[i].error` with a 200.\n */\n async addBatchItems(\n id: string,\n body: BatchAddRequest,\n ): Promise<BatchAddResponse> {\n return this.read<BatchAddResponse>(\n 'POST',\n `/v1/batches/${segment(id)}/items`,\n { owner: `batch:${id}` },\n body,\n );\n }\n\n /** `GET /v1/batches/:id/items?state=&cursor=&limit=`. */\n async listBatchItems(\n id: string,\n options: { state?: RenderState; cursor?: string; limit?: number } = {},\n ): Promise<BatchItemsPage> {\n const query = new URLSearchParams();\n if (options.state) query.set('state', options.state);\n if (options.cursor) query.set('cursor', options.cursor);\n if (options.limit) query.set('limit', String(options.limit));\n const suffix = query.toString() ? `?${query}` : '';\n return this.read<BatchItemsPage>(\n 'GET',\n `/v1/batches/${segment(id)}/items${suffix}`,\n { owner: `batch:${id}` },\n );\n }\n\n /**\n * `GET /v1/batches/:id/export`: the ledger as NDJSON, one line per item,\n * yielded as it streams so a ten-thousand-item batch is never one string.\n */\n async *exportBatch(id: string): AsyncIterable<BatchExportLine> {\n const { response } = await this.send(\n 'GET',\n `/v1/batches/${segment(id)}/export`,\n undefined,\n { retry: true, owner: `batch:${id}` },\n );\n yield* ndjson<BatchExportLine>(response);\n }\n\n /** `POST /v1/batches/:id/{close,pause,resume,cancel,retry}`. Every one is a\n * state transition the control plane treats idempotently, so all repeat. */\n async batchAction(id: string, action: BatchAction): Promise<BatchRecord> {\n return this.read<BatchRecord>(\n 'POST',\n `/v1/batches/${segment(id)}/${action}`,\n { owner: `batch:${id}` },\n {},\n );\n }\n\n private post<T>(\n path: string,\n body: unknown,\n options?: RequestOptions,\n ): Promise<T> {\n return this.request<T>('POST', path, body, options);\n }\n\n /** A request about a row this client may have created, with its token. */\n private async read<T>(\n method: string,\n path: string,\n options: SendOptions,\n body?: unknown,\n ): Promise<T> {\n return (await this.call<T>(method, path, body, options)).value;\n }\n\n /** Remember which token created a row, so the row is read with it. */\n private remember(kind: OwnedKind, id: string, credential: string): void {\n // A key reads everything in its project, so there is nothing to pin.\n if (this.auth.kind !== 'token' || !id) return;\n const owner: Owner = `${kind}:${id}`;\n this.owners.delete(owner);\n this.owners.set(owner, credential);\n if (this.owners.size > MAX_OWNERS) {\n const oldest = this.owners.keys().next().value;\n if (oldest !== undefined) this.owners.delete(oldest);\n }\n }\n\n /**\n * One authenticated JSON request, with the 401 re-mint and the 429/503\n * backoff. Public for the server SDK, which shares the transport; the\n * typed methods above are the API.\n */\n async request<T>(\n method: string,\n path: string,\n body?: unknown,\n options: RequestOptions = {},\n ): Promise<T> {\n return (await this.call<T>(method, path, body, options)).value;\n }\n\n /** A JSON request, and the credential that got the answer. */\n private async call<T>(\n method: string,\n path: string,\n body: unknown,\n options: SendOptions,\n ): Promise<{ value: T; credential: string }> {\n const { response, credential, url } = await this.send(\n method,\n path,\n body,\n options,\n );\n if (response.status === 204) return { value: undefined as T, credential };\n // Read as text and parsed here, so a 200 that is not JSON (a baseUrl\n // that points at a web app, which answers every path with its HTML)\n // says so instead of throwing \"Unexpected token '<'\".\n const text = await response.text();\n if (!text.trim()) return { value: undefined as T, credential };\n try {\n return { value: JSON.parse(text) as T, credential };\n } catch {\n throw notOurs(response.status, url, undefined, text, this.baseUrl);\n }\n }\n\n private async send(\n method: string,\n path: string,\n body: unknown,\n options: SendOptions,\n ): Promise<{ response: Response; credential: string; url: string }> {\n const retry = options.retry ?? isSafeToRepeat(method, path);\n const maxTries = retry ? this.retry.maxTries : 1;\n const url = `${this.baseUrl}${path}`;\n const pinned = options.owner ? this.owners.get(options.owner) : undefined;\n // Outside the fetch's try on purpose. A token failure is an auth error\n // with its own code, fix and docs link; inside, it would become a\n // retryable NetworkError, which a job's poll loop waits out for minutes.\n let credential = pinned ?? (await this.token());\n let reminted = false;\n let leftPin = false;\n\n for (let attempt = 1; ; attempt++) {\n const response = await this.fetchOnce(\n method,\n url,\n body,\n credential,\n options.signal,\n );\n\n if (response.ok) {\n // The current token could read it after all: read with that from now.\n if (leftPin && options.owner) {\n const [kind, ...rest] = options.owner.split(':');\n this.remember(kind as OwnedKind, rest.join(':'), credential);\n }\n return { response, credential, url };\n }\n\n // One retry with a freshly minted token. A five-minute browser token\n // expiring mid-session is the expected case, not an exception. A static\n // key has nothing to re-mint, so retrying it would only turn one clear\n // 401 into two. Does not count as an attempt.\n if (response.status === 401 && !reminted && this.auth.kind === 'token') {\n await response.body?.cancel().catch(() => {});\n reminted = true;\n leftPin = pinned !== undefined;\n // The token that created the row was refused: the current one, or a\n // new one when the current one IS the refused one.\n credential = await this.token(\n !pinned || this.cached?.token === credential,\n );\n continue;\n }\n\n // The creating token is gone and the current one is a stranger to the\n // row: a token reads only what it created, so the API says 404.\n if (leftPin && response.status === 404 && options.owner) {\n await response.body?.cancel().catch(() => {});\n throw lostOwner(options.owner);\n }\n\n if (\n response.status === 401 &&\n this.auth.kind === 'key' &&\n this.auth.key.startsWith('bk_pt_')\n ) {\n await response.body?.cancel().catch(() => {});\n throw browserTokenAsKey();\n }\n\n // \"Not now\": the account is over its rate (429) or the control plane is\n // shedding load (503). Nothing about the request is wrong, so the same\n // bytes go again after a jittered wait, for a request that is safe to\n // repeat, and only so many times. Any other 4xx is a verdict.\n if (\n (response.status === 429 || response.status === 503) &&\n attempt < maxTries\n ) {\n await response.body?.cancel().catch(() => {});\n await sleep(\n this.delayFor(attempt, response.headers.get('retry-after')),\n options.signal,\n );\n continue;\n }\n\n throw await toError(response, url, path, this.baseUrl);\n }\n }\n\n private async fetchOnce(\n method: string,\n url: string,\n body: unknown,\n credential: string,\n signal: AbortSignal | undefined,\n ): Promise<Response> {\n try {\n return await this.fetch(url, {\n method,\n headers: {\n authorization: `Bearer ${credential}`,\n ...(this.sendVersion ? { [SDK_VERSION_HEADER]: SDK_VERSION } : {}),\n ...(body === undefined ? {} : { 'content-type': 'application/json' }),\n },\n ...(body === undefined ? {} : { body: JSON.stringify(body) }),\n ...(signal ? { signal } : {}),\n });\n } catch (error) {\n if (signal?.aborted) throw error;\n throw new Bakery3Error({\n code: 'NetworkError',\n message: `Could not reach the Bakery3 API: ${\n error instanceof Error ? error.message : String(error)\n }`,\n fix: 'Check the browser network tab. If you set a custom baseUrl, confirm it allows your origin.',\n retryable: true,\n });\n }\n }\n\n /**\n * Exponential with full jitter, or the server's own `Retry-After` when it\n * sent one: a server that says \"in 3 s\" knows more than a formula does.\n * Both are capped, so a header naming next Tuesday does not hang a page.\n */\n private delayFor(attempt: number, retryAfter: string | null): number {\n const { baseDelayMs, maxDelayMs } = this.retry;\n const advised = parseRetryAfter(retryAfter);\n if (advised !== null) return Math.min(maxDelayMs, advised);\n const ceiling = Math.min(maxDelayMs, baseDelayMs * 2 ** (attempt - 1));\n return Math.random() * ceiling;\n }\n}\n\n/** An id as one path segment: an id with a slash in it must not reach another route. */\nfunction segment(id: string): string {\n return encodeURIComponent(id);\n}\n\n// ---------------------------------------------------------------------------\n// Credentials\n// ---------------------------------------------------------------------------\n\n/**\n * What the constructor was given, as one of three cases. A missing, empty or\n * placeholder credential is not an error yet: a client that only checks a\n * scene never needs one.\n */\nfunction authOf(token: unknown, apiKey: unknown, keyNamed: boolean): Auth {\n if (token !== undefined && token !== null) {\n if (typeof token === 'function')\n return { kind: 'token', provider: token as TokenProvider };\n return { kind: 'missing', refusal: tokenNotAFunction };\n }\n if (typeof apiKey === 'string' && apiKey.trim()) {\n const key = apiKey.trim();\n if (isPlaceholder(key))\n return { kind: 'missing', refusal: () => placeholderKey(key) };\n return { kind: 'key', key };\n }\n if (keyNamed || apiKey !== undefined)\n return { kind: 'missing', refusal: emptyKey };\n return { kind: 'missing', refusal: noCredentials };\n}\n\n/** The `bk_sk_...` of a README, pasted as it is. */\nfunction isPlaceholder(key: string): boolean {\n return key.includes('...') || key.includes('…');\n}\n\nfunction noCredentials(): Bakery3Error {\n return new Bakery3Error({\n code: 'Unauthorized',\n message: `No API key or token. Create a key at ${KEYS_URL} (sign up there first if you have no account).`,\n why: '`apiKey` is a secret key (bk_sk_) you pass directly, for testing and for servers. `token` is a function that fetches a short-lived browser token from your own server, which is what you deploy, because it keeps the key out of the page.',\n fix: \"While testing: createBakery3({ apiKey: 'bk_sk_...' }). Before you deploy: createBakery3({ token: getToken }).\",\n docs: AUTH_DOCS,\n });\n}\n\nfunction emptyKey(): Bakery3Error {\n return new Bakery3Error({\n code: 'Unauthorized',\n message:\n 'apiKey is empty. Check that the environment variable holding your key is set.',\n why: \"createBakery3({ apiKey }) was given undefined or an empty string, which is what an environment variable that is not set reads as. In a browser bundle, only variables with your framework's public prefix (NEXT_PUBLIC_, VITE_) are set.\",\n fix: `Set the variable and restart the dev server. You can copy a key from ${KEYS_URL}.`,\n docs: AUTH_DOCS,\n });\n}\n\nfunction placeholderKey(key: string): Bakery3Error {\n return new Bakery3Error({\n code: 'Unauthorized',\n message: `Replace the placeholder with your key from ${KEYS_URL}.`,\n why: `apiKey is ${redact(key)}, which looks like the example from the docs rather than a real key.`,\n fix: `Copy a secret key (bk_sk_) from ${KEYS_URL} into apiKey while testing, and switch to token before you deploy.`,\n docs: AUTH_DOCS,\n });\n}\n\nfunction tokenNotAFunction(): Bakery3Error {\n return new Bakery3Error({\n code: 'Unauthorized',\n message:\n 'token must be a function that fetches a browser token, not the token itself.',\n why: 'Browser tokens expire after minutes, so the SDK calls your function again for a new one when it needs to.',\n fix: \"createBakery3({ token: () => fetch('/api/bakery3-token', { method: 'POST' }).then((r) => r.json()) })\",\n docs: TOKEN_ROUTE_DOCS,\n });\n}\n\nfunction browserTokenAsKey(): Bakery3Error {\n return new Bakery3Error({\n code: 'TokenExpired',\n message:\n 'apiKey holds a browser token (bk_pt_), and the API refused it. It has most likely expired.',\n why: 'Browser tokens last minutes. Passed as apiKey, the SDK has no way to fetch a new one when it runs out.',\n fix: \"Pass it as token instead, as a function that fetches a fresh one: createBakery3({ token: () => fetch('/api/bakery3-token', { method: 'POST' }).then((r) => r.json()) }).\",\n docs: TOKEN_ROUTE_DOCS,\n });\n}\n\nfunction lostOwner(owner: Owner): Bakery3Error {\n const kind = owner.slice(0, owner.indexOf(':')) as OwnedKind;\n const started = kind === 'batch' ? 'opened' : 'started';\n return new Bakery3Error({\n code: 'TokenExpired',\n message: `This ${kind} was ${started} with a browser token that can no longer read it. Mint tokens with a longer expiresInSeconds, or read the ${kind} from your server with the secret key.`,\n why: `A browser token can only read the ${kind}s it ${started}. That token was refused, and a new token cannot read a ${kind} it did not start.`,\n fix: 'Pass a longer expiresInSeconds to tokens.create() on your server, or read it there with new Bakery3Server(process.env.BAKERY3_SECRET_KEY!).',\n docs: AUTH_DOCS,\n });\n}\n\n/** The provider rejected. The developer's own endpoint, not ours. */\nfunction providerThrew(cause: unknown): Bakery3Error {\n const said = cause instanceof Error ? cause.message : String(cause);\n // `r.json()` on an HTML page: a 404 for a route that is not where the\n // fetch says, or a 500 from a route that threw. A verdict, not a blink.\n if (\n cause instanceof SyntaxError ||\n (cause as { name?: unknown } | null)?.name === 'SyntaxError'\n ) {\n return new Bakery3Error({\n code: 'Unauthorized',\n message:\n 'Your token endpoint did not return JSON. It probably answered 404 or 500 with an HTML page.',\n why: `Reading its answer as JSON failed: ${said}`,\n fix: 'Open your token route in the network tab. It must answer 200 with the JSON from tokens.create(). On a 500, check your server log: BAKERY3_SECRET_KEY may be unset.',\n docs: TOKEN_ROUTE_DOCS,\n });\n }\n // Retryable, because a token route that blinks mid-render should not lose\n // the render; named, because \"could not reach the Bakery3 API\" would point\n // at the wrong network tab entry.\n return new Bakery3Error({\n code: 'Unauthorized',\n message: `The token provider threw: ${said}`,\n why: 'createBakery3({ token }) calls your function for a browser token before each request that needs one, and it rejected.',\n fix: 'Check your /api/bakery3-token route in the network tab: it should answer 200 with the JSON from tokens.create().',\n docs: TOKEN_ROUTE_DOCS,\n retryable: true,\n });\n}\n\n/** The token out of whatever the provider resolved to, or an error that says what it was instead. */\nfunction readMinted(result: unknown): { token: string; expiresAt?: number } {\n if (isFetchResponse(result)) {\n const status = result.ok ? '' : ` (it answered ${result.status})`;\n throw new Bakery3Error({\n code: 'Unauthorized',\n message: `Your token function returned a fetch Response, not the token${status}. Add .then((r) => r.json()).`,\n why: 'createBakery3({ token }) needs the token itself: a string, or the JSON from tokens.create().',\n fix: \"token: () => fetch('/api/bakery3-token', { method: 'POST' }).then((r) => r.json())\",\n docs: TOKEN_ROUTE_DOCS,\n });\n }\n if (typeof result === 'string' && result) return { token: result };\n if (isRecord(result) && typeof result.token === 'string' && result.token) {\n return {\n token: result.token,\n ...(typeof result.expiresAt === 'number' && result.expiresAt > 0\n ? { expiresAt: result.expiresAt }\n : {}),\n };\n }\n const reported = isRecord(result) ? errorText(result) : undefined;\n if (reported) {\n throw new Bakery3Error({\n code: 'Unauthorized',\n message: `Your token endpoint answered with an error instead of a token: ${reported}`,\n why: 'createBakery3({ token }) needs { token } from your route, and the JSON it got has an error in its place.',\n fix: 'Check your server log for the request to your token route. BAKERY3_SECRET_KEY may be unset or wrong.',\n docs: TOKEN_ROUTE_DOCS,\n });\n }\n throw new Bakery3Error({\n code: 'Unauthorized',\n message: 'The token provider returned nothing.',\n why: 'createBakery3({ token }) must resolve to a string, or to { token }.',\n fix: 'Check that your /api/bakery3-token route returns the JSON from tokens.create().',\n docs: TOKEN_ROUTE_DOCS,\n });\n}\n\n/** Duck-typed, because a polyfilled or cross-realm Response fails `instanceof`. */\nfunction isFetchResponse(value: unknown): value is Response {\n if (typeof Response !== 'undefined' && value instanceof Response) return true;\n return (\n isRecord(value) &&\n typeof value.json === 'function' &&\n typeof value.status === 'number' &&\n 'headers' in value\n );\n}\n\n/** `{ error: 'text' }`, `{ error: { message } }`, or `{ message }`. */\nfunction errorText(body: Record<string, unknown>): string | undefined {\n const error = body.error;\n if (typeof error === 'string' && error) return error;\n if (isRecord(error)) {\n const message = typeof error.message === 'string' ? error.message : '';\n const code = typeof error.code === 'string' ? error.code : '';\n if (message || code)\n return code && message ? `${code}: ${message}` : message || code;\n return snippet(JSON.stringify(error));\n }\n if (typeof body.message === 'string' && body.message) return body.message;\n return undefined;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null;\n}\n\n// ---------------------------------------------------------------------------\n// Transport helpers\n// ---------------------------------------------------------------------------\n\n/** A request whose repeat cannot do a second thing. GETs always; a POST unless\n * it is one of the two creates that may charge (those opt in per body). */\nfunction isSafeToRepeat(method: string, path: string): boolean {\n if (method === 'GET' || method === 'HEAD') return true;\n return !CHARGING_ROUTES.has(path.split('?')[0]!);\n}\n\n/** Seconds, or an HTTP date; anything else is ignored. Never negative. */\nexport function parseRetryAfter(\n header: string | null,\n now = Date.now(),\n): number | null {\n if (!header) return null;\n const trimmed = header.trim();\n if (/^\\d+$/.test(trimmed)) return Number(trimmed) * 1000;\n const date = Date.parse(trimmed);\n if (Number.isNaN(date)) return null;\n return Math.max(0, date - now);\n}\n\nfunction sleep(ms: number, signal?: AbortSignal): Promise<void> {\n return new Promise((resolve, reject) => {\n if (signal?.aborted) return reject(signal.reason);\n const timer = setTimeout(() => {\n signal?.removeEventListener('abort', onAbort);\n resolve();\n }, ms);\n function onAbort() {\n clearTimeout(timer);\n reject(signal!.reason);\n }\n signal?.addEventListener('abort', onAbort, { once: true });\n });\n}\n\n/**\n * One JSON document per line, yielded as the bytes arrive. A response with\n * no stream (a test's `Response`, an old runtime) falls back to its text.\n */\nasync function* ndjson<T>(response: Response): AsyncIterable<T> {\n const decoder = new TextDecoder();\n let buffer = '';\n const emit = function* (chunk: string, flush = false) {\n buffer += chunk;\n const lines = buffer.split('\\n');\n buffer = flush ? '' : (lines.pop() ?? '');\n for (const line of lines) {\n const trimmed = line.trim();\n if (trimmed) yield JSON.parse(trimmed) as T;\n }\n };\n\n if (!response.body) {\n yield* emit(await response.text(), true);\n return;\n }\n const reader = response.body.getReader();\n for (;;) {\n const { value, done } = await reader.read();\n if (done) break;\n yield* emit(decoder.decode(value, { stream: true }));\n }\n yield* emit(decoder.decode(), true);\n}\n\n// ---------------------------------------------------------------------------\n// Errors from a response\n// ---------------------------------------------------------------------------\n\n/**\n * A refusal, as a `Bakery3Error` with its four lines intact.\n *\n * The control plane answers with the protocol's structured error shape. A\n * proxy, a gateway or a wrong `baseUrl` does not, and that is said rather\n * than shown as a bare status. The body is read once, as text: reading it as\n * JSON first and as text after fails, because a body can only be read once.\n */\nasync function toError(\n response: Response,\n url: string,\n path: string,\n baseUrl: string,\n): Promise<Bakery3Error> {\n const text = await response.text().catch(() => '');\n let payload: unknown;\n try {\n payload = text ? JSON.parse(text) : undefined;\n } catch {\n payload = undefined;\n }\n const error = isRecord(payload)\n ? isRecord(payload.error)\n ? payload.error\n : payload\n : undefined;\n\n if (!error || typeof error.code !== 'string' || !error.code) {\n return notOurs(response.status, url, error, text, baseUrl);\n }\n\n const str = (value: unknown) =>\n typeof value === 'string' && value ? value : undefined;\n const num = (value: unknown) =>\n typeof value === 'number' && Number.isFinite(value) ? value : undefined;\n const message =\n str(error.message) ?? `${response.status} ${response.statusText}`.trim();\n\n if (error.code === 'RenderBudgetExceeded') {\n return new RenderBudgetExceeded({\n message,\n why: str(error.why),\n fix: str(error.fix),\n docs: str(error.docs),\n maxCost: num(error.maxCost),\n estimatedCost: num(error.estimatedCost),\n maximumCost: num(error.maximumCost),\n kind: budgetedKind(error.kind, path),\n });\n }\n\n return new Bakery3Error({\n code: error.code as Bakery3ErrorCode,\n message,\n why: str(error.why),\n fix: str(error.fix),\n docs: str(error.docs),\n path: str(error.path),\n retryable: response.status >= 500 || response.status === 429,\n });\n}\n\nfunction budgetedKind(kind: unknown, path: string): BudgetedKind {\n if (kind === 'render' || kind === 'video' || kind === 'bake') return kind;\n return path.startsWith('/v1/bakes') ? 'bake' : 'render';\n}\n\n/**\n * An answer that did not come from the Bakery3 API: no error code, or not\n * JSON at all. Says who answered, where, and what to check.\n */\nfunction notOurs(\n status: number,\n url: string,\n body: Record<string, unknown> | undefined,\n text: string,\n baseUrl: string,\n): Bakery3Error {\n const where = `${status} from ${url.split('?')[0]}`;\n const said = (body && errorText(body)) || snippet(text);\n const answered = said ? ` It answered: ${said}` : '';\n if (status >= 500) {\n return new Bakery3Error({\n code: 'NetworkError',\n message: `${where}: the server failed before the Bakery3 API could answer.`,\n why: `The answer has no Bakery3 error in it, so a gateway or proxy in between answered.${answered}`,\n fix: `Try again in a moment. If it keeps happening, check that baseUrl (${baseUrl}) points at the Bakery3 API.`,\n retryable: true,\n });\n }\n return new Bakery3Error({\n code:\n status === 401 || status === 403\n ? 'Unauthorized'\n : status === 429\n ? 'RateLimited'\n : 'InvalidRequest',\n message: `${where}: not the Bakery3 API. Check baseUrl.`,\n why: `The answer has no Bakery3 error in it, so another server answered: a wrong baseUrl, a proxy, or a page of your own app.${answered}`,\n fix: `Leave baseUrl out to use ${DEFAULT_BASE_URL}, or point it at a proxy that forwards /v1/ requests unchanged.`,\n retryable: status === 429,\n });\n}\n\n/** A body as one short line: tags out, whitespace collapsed, cut at 160. */\nfunction snippet(text: string): string {\n const flat = text\n .replace(/<[^>]*>/g, ' ')\n .replace(/\\s+/g, ' ')\n .trim();\n return flat.length > 160 ? `${flat.slice(0, 160)}…` : flat;\n}\n","/**\n * How long a job keeps polling while every poll fails.\n *\n * A transient fault must not lose a render that is still running, so one\n * failed poll means nothing and a job rides out a dropped connection or a\n * laptop lid. But a fault that never clears (a token route that went away, a\n * base URL that stopped resolving) would leave `result()` pending for good,\n * with nothing on the page to say why. After this long with not one\n * successful poll, the job rejects with the last error, which names the\n * cause. The render itself is untouched and can still be read by its id.\n */\nexport const POLL_GIVE_UP_MS = 5 * 60_000;\n\nexport class PollFailures {\n private since: number | null = null;\n\n constructor(private readonly now: () => number = Date.now) {}\n\n /** A poll got through: whatever was failing has cleared. */\n succeeded(): void {\n this.since = null;\n }\n\n /** A poll failed. True once they have all been failing for the whole window. */\n exhausted(): boolean {\n this.since ??= this.now();\n return this.now() - this.since >= POLL_GIVE_UP_MS;\n }\n}\n","/**\n * A batch, from the customer's side.\n *\n * const batch = await bakery3.batches.open({ key: 'fall-2026-v3', maxCost: 600 });\n * for await (const item of source) await batch.write(item); // a full page sends itself\n * await batch.close(); // the tail is flushed, then sealed: the total is known\n * await batch.wait({ onProgress: (p) => console.log(`${p.completed}/${p.total}`) });\n * for await (const item of batch.items({ state: 'failed' })) console.error(item.key);\n *\n * Two things this class is careful about, because they are the whole reason\n * the batch exists rather than a loop over `render()`:\n *\n * - Memory. `write` buffers a few KB of manifest per item and sends a page\n * the moment one is full, by count or by bytes, so awaiting it is the\n * backpressure and nothing here ever holds the catalog. (`add` and\n * `flush` are the same two steps taken by hand.) A refused page stays\n * buffered: the caller tops up and flushes again, and the same items go,\n * under the same keys.\n * - One poll loop. `wait` long-polls the batch record; it never polls a\n * render. Items are read by state with a cursor when they are wanted.\n */\n\nimport type {\n BatchAddRequest,\n BatchCost,\n BatchCounts,\n BatchExportLine,\n BatchItemOutcome,\n BatchItemRequest,\n BatchRecord,\n BatchState,\n RenderState,\n} from './protocol/index.js';\nimport {\n BATCH_ITEM_BYTES,\n BATCH_PAGE_BYTES,\n BATCH_PAGE_SIZE,\n} from './protocol/index.js';\nimport type { BatchItemRecord, BatchItemsPage } from './client.js';\nimport { Bakery3Error, BatchPageRefused } from './errors.js';\nimport { POLL_GIVE_UP_MS, PollFailures } from './pollFailures.js';\n\n/** The slice of the client a batch drives: what a mock has to provide. */\nexport type BatchTransport = {\n getBatch(\n id: string,\n options?: { wait?: number; signal?: AbortSignal },\n ): Promise<BatchRecord>;\n addBatchItems(\n id: string,\n body: BatchAddRequest,\n ): Promise<{ batch: BatchRecord; items: BatchItemOutcome[] }>;\n listBatchItems(\n id: string,\n options?: { state?: RenderState; cursor?: string; limit?: number },\n ): Promise<BatchItemsPage>;\n exportBatch(id: string): AsyncIterable<BatchExportLine>;\n batchAction(\n id: string,\n action: 'close' | 'pause' | 'resume' | 'cancel' | 'retry',\n ): Promise<BatchRecord>;\n};\n\n/**\n * The counts, the cost and where the batch stands: what a status line\n * prints. Flat on purpose (`p.completed`, not `p.counts.completed`).\n */\nexport type BatchProgress = BatchCounts & {\n id: string;\n state: BatchState;\n /** Every item ever admitted, adopted included. Final once sealed. */\n total: number;\n /** How many are terminal. */\n done: number;\n cost: BatchCost;\n pausedReason?: string;\n};\n\nexport type FlushOptions = {\n /** Price the pages, admit nothing: the buffer stays for a real flush. */\n dryRun?: boolean;\n};\n\nexport type WaitOptions = {\n /** Called after every poll that returned, whether or not the counts moved. */\n onProgress?: (progress: BatchProgress) => void;\n signal?: AbortSignal;\n};\n\n/** How long each `GET ?wait=` is allowed to hang. The route's own ceiling. */\nconst LONG_POLL_SECONDS = 25;\n\n/**\n * The wait between polls while they are failing: doubling from one second to\n * half a minute. A long-poll that fails returns at once, so without a wait a\n * tab that went offline would request again as fast as each attempt failed.\n */\nconst WAIT_RETRY_MS = { first: 1_000, ceiling: 30_000 };\n/** Items per `GET /items` page while iterating. */\nconst LIST_PAGE_SIZE = 100;\n\nexport class Batch {\n readonly id: string;\n readonly key: string;\n\n private latest: BatchRecord;\n /** The flush in flight, or the last one, settled either way. */\n private flushing: Promise<unknown> = Promise.resolve();\n private readonly buffer: BatchItemRequest[] = [];\n /** `buffer[i]` as JSON is about `sizes[i]` bytes. Kept beside it so a\n * page can be closed on bytes without serializing anything twice. */\n private readonly sizes: number[] = [];\n private bytes = 0;\n private readonly client: BatchTransport;\n /** The clock `wait()` measures its patience with. A test turns it. */\n private clock: { now: () => number; sleep: typeof pause } = {\n now: () => Date.now(),\n sleep: pause,\n };\n\n /** @internal `bakery3.batches.open()` and `.get()` make these. */\n constructor(client: BatchTransport, record: BatchRecord) {\n this.client = client;\n this.latest = record;\n this.id = record.id;\n this.key = record.key;\n }\n\n /** Buffer an item. Nothing is sent until `flush()`. */\n add(item: BatchItemRequest): this {\n if (!item.key) {\n throw new Bakery3Error({\n code: 'InvalidRequest',\n message: 'A batch item needs a key.',\n why: 'The key is what lets a re-run adopt the item instead of rendering it twice, and what a failed item is reported under.',\n fix: 'Use something stable that names the picture: `${sku}/${finish}/${camera}`.',\n docs: 'https://bakery3.com/docs/api',\n });\n }\n const size = jsonBytes(item);\n if (size > BATCH_ITEM_BYTES) throw itemTooLarge(item.key, size);\n this.buffer.push(item);\n this.sizes.push(size);\n this.bytes += size;\n return this;\n }\n\n /**\n * `add`, and send a page when one is full. Awaiting it is the\n * backpressure: a loop over a file, a cursor or a generator of any length\n * holds one page at most.\n *\n * for await (const item of source) await batch.write(item);\n * await batch.close();\n */\n async write(item: BatchItemRequest): Promise<void> {\n this.add(item);\n if (this.buffer.length >= BATCH_PAGE_SIZE || this.bytes >= BATCH_PAGE_BYTES)\n await this.flush();\n }\n\n /** Items added and not yet sent. */\n get buffered(): number {\n return this.buffer.length;\n }\n\n /** About how many bytes of JSON those items are. */\n get bufferedBytes(): number {\n return this.bytes;\n }\n\n /**\n * Price items without buffering or admitting them: the estimate, the\n * maximum and any refusal, per item, in the order given. Paged like a\n * flush. An item already completed under its key is quoted as adopted, at\n * nothing, which makes this the price of a re-run too.\n */\n async quote(items: BatchItemRequest[]): Promise<BatchItemOutcome[]> {\n const outcomes: BatchItemOutcome[] = [];\n const sizes = items.map(jsonBytes);\n let offset = 0;\n while (offset < items.length) {\n const count = pageLength(sizes, offset);\n const response = await this.client.addBatchItems(this.id, {\n items: items.slice(offset, offset + count),\n dryRun: true,\n });\n outcomes.push(...response.items);\n offset += count;\n }\n return outcomes;\n }\n\n /**\n * Send the buffer in pages: `BATCH_PAGE_SIZE` items or `BATCH_PAGE_BYTES`\n * of JSON, whichever a page reaches first.\n *\n * Returns one outcome per item sent: admitted, adopted, or refused alone\n * (`outcome.error`). A page refused whole throws `BatchPageRefused` and\n * leaves that page and everything behind it in the buffer, so the caller\n * can top up and call `flush()` again; the error carries the outcomes of\n * the pages that did get through.\n */\n flush(options: FlushOptions = {}): Promise<BatchItemOutcome[]> {\n // One at a time. Two flushes running together would both read the first\n // page, and the second one's splice would remove a page that was never\n // sent: items gone with no error. `close()` flushes too, so a flush nobody\n // awaited followed by a close is enough to meet this.\n const run = this.flushing.then(() => this.flushNow(options));\n this.flushing = run.catch(() => {});\n return run;\n }\n\n private async flushNow(options: FlushOptions): Promise<BatchItemOutcome[]> {\n const outcomes: BatchItemOutcome[] = [];\n let offset = 0;\n while (offset < this.buffer.length) {\n const page = this.buffer.slice(\n offset,\n offset + pageLength(this.sizes, offset),\n );\n let response;\n try {\n response = await this.client.addBatchItems(this.id, {\n items: page,\n ...(options.dryRun ? { dryRun: true } : {}),\n });\n } catch (error) {\n if (error instanceof Bakery3Error)\n throw new BatchPageRefused(error, page, outcomes);\n throw error;\n }\n this.latest = response.batch;\n outcomes.push(...response.items);\n if (options.dryRun) {\n // Priced, not admitted: the items are still ours to send for real.\n offset += page.length;\n } else {\n this.buffer.splice(offset, page.length);\n for (const size of this.sizes.splice(offset, page.length))\n this.bytes -= size;\n }\n }\n return outcomes;\n }\n\n /** Seal: no more items. `completed` fires once the last one is terminal.\n * Anything still buffered is flushed first, because closing over unsent\n * items would quietly drop the tail of a catalog. */\n async close(): Promise<BatchRecord> {\n if (this.buffer.length) await this.flush();\n return this.apply(await this.client.batchAction(this.id, 'close'));\n }\n\n /** Stop feeding the queue; running items finish. */\n async pause(): Promise<BatchRecord> {\n return this.apply(await this.client.batchAction(this.id, 'pause'));\n }\n\n async resume(): Promise<BatchRecord> {\n return this.apply(await this.client.batchAction(this.id, 'resume'));\n }\n\n /** Cancel every non-terminal item. What completed stays completed: it rendered. */\n async cancel(): Promise<BatchRecord> {\n return this.apply(await this.client.batchAction(this.id, 'cancel'));\n }\n\n /** Re-queue every dead-lettered item, one new attempt each. */\n async retry(): Promise<BatchRecord> {\n return this.apply(await this.client.batchAction(this.id, 'retry'));\n }\n\n /** The latest record this batch has seen. No request. */\n record(): BatchRecord {\n return this.latest;\n }\n\n /** Fetch the record now. */\n async refresh(): Promise<BatchRecord> {\n return this.apply(await this.client.getBatch(this.id));\n }\n\n /** Counts and cost from the latest record. No request. */\n progress(): BatchProgress {\n return progressOf(this.latest);\n }\n\n /**\n * Wait for the batch to finish: one long-poll loop on the batch record\n * until it is `completed` or `cancelled` (or sealed with every item\n * terminal). Never a poll per render.\n *\n * A paused batch is waited on, not given up on (someone may resume it from\n * the console), and `onProgress` sees `pausedReason` meanwhile. Pass\n * `signal` to stop waiting; the batch itself is untouched.\n *\n * A fault that clears is ridden out. One that does not (five minutes with\n * not one poll through) rejects with an error that says so and carries the\n * last fault's code. The batch renders on regardless, and `wait()` can be\n * called again.\n */\n async wait(options: WaitOptions = {}): Promise<BatchRecord> {\n const { onProgress, signal } = options;\n const failures = new PollFailures(this.clock.now);\n let failed = 0;\n for (;;) {\n if (signal?.aborted) throw signal.reason ?? abortError();\n if (isFinished(this.latest)) return this.latest;\n try {\n this.apply(\n await this.client.getBatch(this.id, {\n wait: LONG_POLL_SECONDS,\n signal,\n }),\n );\n failed = 0;\n failures.succeeded();\n } catch (error) {\n if (signal?.aborted) throw signal.reason ?? abortError();\n // A transient fault must not lose a batch that is still rendering:\n // keep polling, and only give up on a declared verdict, or on a fault\n // that has outlasted every poll for minutes.\n if (error instanceof Bakery3Error && !error.retryable) throw error;\n if (failures.exhausted()) throw lostContact(this.id, error);\n await this.clock.sleep(\n Math.min(WAIT_RETRY_MS.ceiling, WAIT_RETRY_MS.first * 2 ** failed++),\n signal,\n );\n continue;\n }\n onProgress?.(this.progress());\n }\n }\n\n /** Every item, or every item in one state, walked with the cursor. */\n async *items(\n options: { state?: RenderState } = {},\n ): AsyncIterable<BatchItemRecord> {\n let cursor: string | undefined;\n do {\n const page = await this.client.listBatchItems(this.id, {\n ...(options.state ? { state: options.state } : {}),\n ...(cursor ? { cursor } : {}),\n limit: LIST_PAGE_SIZE,\n });\n yield* page.items;\n cursor = page.cursor ?? undefined;\n } while (cursor);\n }\n\n /** The ledger, line by line, as the server streams it. */\n export(): AsyncIterable<BatchExportLine> {\n return this.client.exportBatch(this.id);\n }\n\n private apply(record: BatchRecord): BatchRecord {\n this.latest = record;\n return record;\n }\n}\n\nexport function progressOf(record: BatchRecord): BatchProgress {\n return {\n ...record.counts,\n id: record.id,\n state: record.state,\n total: record.total,\n done: record.done,\n cost: record.cost,\n ...(record.pausedReason ? { pausedReason: record.pausedReason } : {}),\n };\n}\n\n/** Nothing more will happen to this batch. */\nexport function isFinished(record: BatchRecord): boolean {\n if (record.state === 'completed' || record.state === 'cancelled') return true;\n return record.state === 'sealed' && record.done >= record.total;\n}\n\n/** How many items from `offset` make one page: by count, and by bytes. Never zero. */\nfunction pageLength(sizes: number[], offset: number): number {\n let count = 0;\n let bytes = 0;\n while (offset + count < sizes.length && count < BATCH_PAGE_SIZE) {\n bytes += sizes[offset + count]!;\n if (count > 0 && bytes > BATCH_PAGE_BYTES) break;\n count++;\n }\n return count;\n}\n\n/** UTF-16 units, not bytes: a manifest is ASCII but for the names in it, and\n * the page limit leaves more room than that difference can use. */\nfunction jsonBytes(item: BatchItemRequest): number {\n return JSON.stringify(item).length;\n}\n\nfunction itemTooLarge(key: string, size: number): Bakery3Error {\n return new Bakery3Error({\n code: 'InvalidRequest',\n message: `Item \"${key}\" is ${(size / 1024).toFixed(0)} KB of JSON; an item holds at most ${BATCH_ITEM_BYTES / 1024} KB.`,\n why: 'An item is a manifest: cameras, lights and ids, a few KB. The heavy bytes are assets, uploaded once by hash and named from the manifest.',\n fix: 'Look for something large inline in the spec or its metadata (a data: URL, a geometry, a long array) and ship it as an asset, or leave it out of `metadata`.',\n path: key,\n docs: 'https://bakery3.com/docs/batches#errors',\n });\n}\n\n/** `wait()` gave up: every poll failed for `POLL_GIVE_UP_MS`. Keeps the last fault's code. */\nfunction lostContact(id: string, cause: unknown): Bakery3Error {\n const last = cause instanceof Error ? cause.message : String(cause);\n return new Bakery3Error({\n code: cause instanceof Bakery3Error ? cause.code : 'NetworkError',\n message: `Stopped waiting for batch ${id}: no poll has got through for ${POLL_GIVE_UP_MS / 60_000} minutes. The last error was: ${last}`,\n why: 'The batch keeps rendering on the server whether or not this page can reach it, so wait() rides out a dropped connection. A fault that lasts this long (a token route that is gone, a base URL that stopped resolving) will not clear by itself.',\n fix: 'Fix what the last error names, then call wait() again, or read the set later with getRenderSet(id). Nothing was lost.',\n docs: 'https://bakery3.com/docs/batches#errors',\n retryable: true,\n });\n}\n\n/** A wait that ends early, without throwing, when the signal fires: the loop's own check reports it. */\nfunction pause(ms: number, signal?: AbortSignal): Promise<void> {\n return new Promise((resolve) => {\n const timer = setTimeout(done, ms);\n function done() {\n clearTimeout(timer);\n signal?.removeEventListener('abort', done);\n resolve();\n }\n signal?.addEventListener('abort', done, { once: true });\n });\n}\n\nfunction abortError(): Error {\n const error = new Error('The wait was aborted.');\n error.name = 'AbortError';\n return error;\n}\n","/**\n * A set of pictures: what every many-pictures call hands back.\n *\n * `render({ cameras })` and `renderVariants()` in the browser, and\n * `renderBatch()` from Node, all record into a batch and return one of\n * these, so a set of three and a catalog of six thousand are the same object\n * with the same guarantees: one ceiling for all of it, one poll for all of\n * it, results walked a page at a time and never held.\n *\n * No three.js here: the server entry imports this file.\n */\n\nimport type { RenderError, RenderResult } from './protocol/index.js';\nimport type { Batch, BatchProgress, WaitOptions } from './batch.js';\nimport { Bakery3Error } from './errors.js';\n\n/** One finished picture of a set. */\nexport type RenderSetImage = {\n /** The item's key: `variant/finish/camera`, as recorded. */\n key: string;\n /** The render's id. */\n id: string;\n variant?: string;\n finish?: string;\n camera?: string;\n /** The shot this is, for a set recorded with shots. */\n shot?: string;\n /** `'video'` when the url is a clip. */\n kind?: 'image' | 'video';\n /** Signed and expiring. Copy the bytes; do not serve from it. */\n url: string;\n width: number;\n height: number;\n /** What this picture cost. Nothing, when it was adopted from an earlier run. */\n cost: number;\n metadata?: Record<string, unknown>;\n result: RenderResult;\n};\n\n/** One picture that did not render, and why. */\nexport type RenderSetFailure = {\n key: string;\n id: string;\n variant?: string;\n finish?: string;\n camera?: string;\n shot?: string;\n error: Bakery3Error;\n metadata?: Record<string, unknown>;\n};\n\n/** One picture turned down when it was submitted: it has no render and never will. */\nexport type RenderSetRefusal = {\n key: string;\n variant?: string;\n finish?: string;\n camera?: string;\n shot?: string;\n error: RenderError;\n};\n\n/** What a recording did, in numbers small enough to keep. */\nexport type Recorded = {\n variants: number;\n images: number;\n /** Already rendered under their keys in an earlier run. Cost nothing. */\n adopted: number;\n /** Turned down alone at admission (a spec that does not parse, an item over its own ceiling). */\n refused: number;\n /** The first of those, with their reasons. Capped, because a broken pipeline refuses every item. */\n refusals: RenderSetRefusal[];\n};\n\n/** What a whole run would cost, from `quoteVariants()`. Nothing was admitted. */\nexport type VariantsQuote = Recorded & {\n /** Σ estimate over the pictures that would render. */\n estimated: number;\n /** Σ maximum: what admission would reserve, and the number to set `maxCost` from. */\n maximum: number;\n};\n\nexport class RenderSet {\n /** The batch underneath: pause, resume, retry, the export. */\n readonly batch: Batch;\n readonly id: string;\n readonly key: string;\n /** What the call that made this set recorded. Empty for a set fetched by id. */\n readonly recorded: Recorded;\n /** Item key → position, for a set small enough to have asked for an order. */\n private order?: Map<string, number>;\n\n constructor(batch: Batch, recorded: Recorded = emptyRecorded()) {\n this.batch = batch;\n this.id = batch.id;\n this.key = batch.key;\n this.recorded = recorded;\n }\n\n /** Counts and cost from the latest record. No request. */\n progress(): BatchProgress {\n return this.batch.progress();\n }\n\n /**\n * Until every picture is terminal. One long-poll on the set, however many\n * pictures it has. Resolves with the final counts: pictures that failed\n * are in `failures()`, they do not reject the wait.\n */\n async wait(options: WaitOptions = {}): Promise<BatchProgress> {\n await this.batch.wait(options);\n return this.batch.progress();\n }\n\n /**\n * Every finished picture, a page at a time. Safe on a set of any size,\n * and safe to call before the set is done: it walks what has completed\n * so far.\n */\n async *images(): AsyncIterable<RenderSetImage> {\n for await (const item of this.batch.items({ state: 'completed' })) {\n if (!item.result) continue;\n yield {\n key: item.key,\n id: item.id,\n ...who(item.metadata),\n url: item.result.url,\n width: item.result.width,\n height: item.result.height,\n cost: item.result.cost,\n ...(item.metadata ? { metadata: item.metadata } : {}),\n result: item.result,\n };\n }\n }\n\n /**\n * Every picture that did not render, with the reason and the fix.\n * `error.retryable` tells the two kinds apart: false is a refusal, the\n * scene's fault and the same next time; true ran out of attempts on a\n * fault of ours, and `set.batch.retry()` queues it again.\n */\n async *failures(): AsyncIterable<RenderSetFailure> {\n for await (const item of this.batch.items({ state: 'failed' })) {\n yield {\n key: item.key,\n id: item.id,\n ...who(item.metadata),\n error: item.error\n ? Bakery3Error.from(item.error)\n : new Bakery3Error({\n code: 'WorkerFailure',\n message: 'Ended with no result and no reason.',\n retryable: true,\n }),\n ...(item.metadata ? { metadata: item.metadata } : {}),\n };\n }\n }\n\n /**\n * Wait, then every picture in one array, in camera order for a\n * `render({ cameras })`: one picture per camera, or a rejection. Rejects\n * with `RenderSetRefused` when a picture was turned down at submission\n * (it has no render, and the array would be one short with every later\n * picture in the wrong place), and otherwise with the first failure, as\n * `job.result()` does. The pictures that did render are still there:\n * walk `images()`, each named by its `camera`.\n *\n * It collects, so it is for a handful of pictures. For a catalog, walk\n * `images()`.\n */\n async result(options: WaitOptions = {}): Promise<RenderSetImage[]> {\n await this.wait(options);\n if (this.recorded.refused > 0) throw new RenderSetRefused(this.recorded);\n for await (const failure of this.failures()) throw failure.error;\n const images: RenderSetImage[] = [];\n for await (const image of this.images()) images.push(image);\n const order = this.order;\n if (order)\n images.sort((a, b) => (order.get(a.key) ?? 0) - (order.get(b.key) ?? 0));\n return images;\n }\n\n /** Cancel every picture that has not finished. What completed, completed. */\n async cancel(): Promise<void> {\n await this.batch.cancel();\n }\n\n /** @internal */\n ordered(keys: string[]): this {\n this.order = new Map(keys.map((key, index) => [key, index]));\n return this;\n }\n}\n\n/**\n * Pictures of a set were turned down when they were submitted, so the set\n * cannot give one picture per camera (or per variant) in order.\n *\n * `refusals` says which and why. Its `code` is the first refusal's. The\n * pictures that were accepted render as usual: `set.images()` walks them.\n */\nexport class RenderSetRefused extends Bakery3Error {\n /** Which pictures, and why: the first fifty when a run refused more. */\n readonly refusals: Array<\n Omit<RenderSetRefusal, 'error'> & { error: Bakery3Error }\n >;\n /** How many were refused in all. */\n readonly refused: number;\n /** How many pictures were asked for. */\n readonly requested: number;\n\n constructor(recorded: Recorded) {\n const first = recorded.refusals[0];\n const names = recorded.refusals.slice(0, 3).map(describeRefusal);\n const more = recorded.refused - names.length;\n super({\n code: first?.error.code ?? 'InvalidRequest',\n message: `${recorded.refused} of ${recorded.images} pictures ${recorded.refused === 1 ? 'was' : 'were'} refused: ${names.join('; ')}${more > 0 ? `; and ${more} more` : ''}.`,\n why: 'A picture refused when it was submitted never renders. An array of the rest would be shorter than the list you asked for, with every later picture in the wrong place, so result() gives none.',\n fix: 'Read error.refusals for each refused picture and its reason. The pictures that were accepted still render: set.images() walks them, each named by its camera.',\n docs: 'https://bakery3.com/docs/batches#errors',\n retryable: false,\n });\n this.name = 'RenderSetRefused';\n this.refusals = recorded.refusals.map(({ error, ...who }) => ({\n ...who,\n error: Bakery3Error.from(error),\n }));\n this.refused = recorded.refused;\n this.requested = recorded.images;\n }\n}\n\nfunction describeRefusal(refusal: RenderSetRefusal): string {\n const name =\n [refusal.variant, refusal.finish, refusal.camera, refusal.shot]\n .filter(Boolean)\n .join(' / ') || refusal.key;\n return `\"${name}\" (${refusal.error.message.replace(/\\.$/, '')})`;\n}\n\n/** The variant, finish, camera and shot an item was recorded under, from its metadata. */\nexport function who(\n metadata: Record<string, unknown> | undefined,\n): Pick<RenderSetImage, 'variant' | 'finish' | 'camera' | 'shot' | 'kind'> {\n const out: Pick<\n RenderSetImage,\n 'variant' | 'finish' | 'camera' | 'shot' | 'kind'\n > = {};\n if (typeof metadata?.variant === 'string') out.variant = metadata.variant;\n // The catalog recorder's own word for it.\n else if (typeof metadata?.sku === 'string') out.variant = metadata.sku;\n if (typeof metadata?.finish === 'string') out.finish = metadata.finish;\n if (typeof metadata?.camera === 'string') out.camera = metadata.camera;\n if (typeof metadata?.shot === 'string') out.shot = metadata.shot;\n if (metadata?.kind === 'video' || metadata?.kind === 'image')\n out.kind = metadata.kind;\n return out;\n}\n\nexport function emptyRecorded(): Recorded {\n return { variants: 0, images: 0, adopted: 0, refused: 0, refusals: [] };\n}\n","/**\n * The test run: a few products, every camera, small and fast.\n *\n * Before six thousand pictures are paid for, three products are worth\n * looking at: are the cameras where they were meant to be, is the room the\n * right way round, does the finish list hide what it should. A test run is\n * the real run's own options with three changes, made here so the browser\n * and the server make the same ones:\n *\n * - A sample of the products. From an array: the first, the middle and the\n * last, because a catalog is usually sorted and its ends differ most.\n * From anything else (a generator, a cursor): the first three, since a\n * list that is never collected has no middle to ask for.\n * - Preview quality at a small size, the long edge 512 unless told\n * otherwise, the aspect kept, so the framing is the real run's framing.\n * - Its own keys. A test is looked at and thrown away; if it shared the real\n * run's keys, the real run would adopt these little previews as finished\n * pictures. Every test also differs from the last one, so a test after a\n * fix shows the fix and not yesterday's frame.\n *\n * No three.js here: the server entry imports this file.\n */\n\nimport type { QualityPreset } from './protocol/index.js';\n\nexport type TestRunOptions = {\n /** How many products. Default 3. */\n products?: number;\n /** The long edge of each picture, in pixels. Default 512. */\n size?: number;\n /** The ceiling for the test, in dollars. Default 5. */\n maxCost?: number;\n};\n\nexport const TEST_DEFAULTS = { products: 3, size: 512, maxCost: 5 } as const;\n\nexport type TestSettings = {\n key: string;\n version: string;\n quality: QualityPreset;\n width: number;\n height: number;\n maxCost: number;\n lane: 'normal';\n};\n\n/** What a test changes about a run whose real pictures are `width` × `height`. */\nexport function testSettings(\n run: { key: string; width: number; height: number },\n options: TestRunOptions = {},\n now: number = Date.now(),\n): TestSettings {\n const size = Math.max(64, Math.round(options.size ?? TEST_DEFAULTS.size));\n const scale = size / Math.max(run.width, run.height);\n const stamp = now.toString(36);\n return {\n key: `${run.key}:test:${stamp}`,\n version: `test-${stamp}`,\n quality: 'preview',\n // Even, because an encoder somewhere always wants that.\n width: Math.max(2, Math.round((run.width * scale) / 2) * 2),\n height: Math.max(2, Math.round((run.height * scale) / 2) * 2),\n maxCost: options.maxCost ?? TEST_DEFAULTS.maxCost,\n lane: 'normal',\n };\n}\n\n/**\n * The key a run's quote is priced under: the run's key with `:quote` after\n * it. A quote never opens the run's own batch, because the run's batch is\n * the one opened with the run's `maxCost`, and a batch is re-opened by key.\n */\nexport function quoteKey(runKey: string): string {\n return `${runKey}:quote`;\n}\n\n/** The sample, without holding more of the list than the caller already does. */\nexport async function* sampleOf<V>(\n variants: Iterable<V> | AsyncIterable<V>,\n count: number = TEST_DEFAULTS.products,\n): AsyncIterable<V> {\n const wanted = Math.max(1, Math.floor(count));\n if (Array.isArray(variants)) {\n const length = variants.length;\n if (length <= wanted) return yield* variants as V[];\n const picked = new Set<number>();\n for (let i = 0; i < wanted; i++)\n picked.add(Math.round((i * (length - 1)) / (wanted - 1 || 1)));\n for (const index of [...picked].sort((a, b) => a - b))\n yield variants[index] as V;\n return;\n }\n let taken = 0;\n for await (const variant of variants) {\n yield variant;\n if (++taken >= wanted) return;\n }\n}\n","/**\n * Cameras without a scene graph: where to stand to photograph a box.\n *\n * In the browser a camera is an object the developer placed. From a server\n * there is a model's bounds (`GlbFacts.bounds`, read at import) and nothing\n * else, so a view is described the way a photographer would: from which\n * side, how high, how tight. `framedCamera` turns that into the same\n * `CameraSpec` a captured camera becomes.\n *\n * No three.js here: the server entry imports this file.\n */\n\nimport type { CameraSpec, Quat, Vec3 } from './protocol/index.js';\nimport { Bakery3Error } from './errors.js';\n\nexport type Bounds = { min: Vec3; max: Vec3 };\n\n/** Where to look from: degrees around the model from its front (+Z, where glTF says a model faces) toward its right (+X), and degrees above the horizon. */\nexport type Angle = { azimuthDeg: number; elevationDeg?: number };\n\n/** A view framed around the model, whatever its size and wherever it sits. */\nexport type FramedView = Angle & {\n id: string;\n /** Vertical field of view in degrees. Default 30: a product lens, little perspective. */\n fov?: number;\n /** Room around the model, as a share of its size. Default 0.12. */\n margin?: number;\n};\n\n/** A camera declared absolutely, in the model's own coordinates. */\nexport type DeclaredView = {\n id: string;\n position: Vec3;\n target: Vec3;\n fov: number;\n};\n\n/** The framings with names. */\nexport const VIEW_WORDS = {\n front: { azimuthDeg: 0, elevationDeg: 6 },\n 'three-quarter': { azimuthDeg: 35, elevationDeg: 14 },\n side: { azimuthDeg: 90, elevationDeg: 6 },\n back: { azimuthDeg: 180, elevationDeg: 6 },\n 'three-quarter-back': { azimuthDeg: 145, elevationDeg: 14 },\n top: { azimuthDeg: 0, elevationDeg: 88 },\n} as const satisfies Record<string, Omit<FramedView, 'id'>>;\n\nexport type ViewWord = keyof typeof VIEW_WORDS;\n\n/** A word or an angle, as an angle. Anything else is null. */\nexport function angleOf(view: unknown): Angle | null {\n if (typeof view === 'string')\n return view in VIEW_WORDS ? { ...VIEW_WORDS[view as ViewWord] } : null;\n if (\n view &&\n typeof view === 'object' &&\n typeof (view as Angle).azimuthDeg === 'number'\n ) {\n const { azimuthDeg, elevationDeg } = view as Angle;\n return {\n azimuthDeg,\n ...(elevationDeg !== undefined ? { elevationDeg } : {}),\n };\n }\n return null;\n}\n\n/** The angle `t` of the way from `from` to `to`, azimuth as given: 0 to 360 is a full turn, 0 to -90 goes the other way. */\nexport function angleBetween(from: Angle, to: Angle, t: number): Angle {\n const fromEl = from.elevationDeg ?? 12;\n const toEl = to.elevationDeg ?? 12;\n return {\n azimuthDeg: from.azimuthDeg + (to.azimuthDeg - from.azimuthDeg) * t,\n elevationDeg: fromEl + (toEl - fromEl) * t,\n };\n}\n\n/** The unit direction from a model's center toward a camera at this angle. */\nexport function directionOf(angle: Angle): Vec3 {\n const azimuth = (angle.azimuthDeg * Math.PI) / 180;\n const elevation = ((angle.elevationDeg ?? 12) * Math.PI) / 180;\n return [\n Math.sin(azimuth) * Math.cos(elevation),\n Math.sin(elevation),\n Math.cos(azimuth) * Math.cos(elevation),\n ];\n}\n\n/** How far a camera with this lens stands from a sphere of `radius` to fit it, with `margin` to spare. */\nexport function framedDistance(\n radius: number,\n fov: number,\n aspect: number,\n margin: number,\n): number {\n const vertical = (fov * Math.PI) / 180;\n const horizontal = 2 * Math.atan(Math.tan(vertical / 2) * aspect);\n return (radius * (1 + margin)) / Math.sin(Math.min(vertical, horizontal) / 2);\n}\n\nexport function radiusOf(bounds: Bounds): number {\n return (\n Math.hypot(\n bounds.max[0] - bounds.min[0],\n bounds.max[1] - bounds.min[1],\n bounds.max[2] - bounds.min[2],\n ) / 2 || 0.5\n );\n}\n\nexport function centerOf(bounds: Bounds): Vec3 {\n return [\n (bounds.min[0] + bounds.max[0]) / 2,\n (bounds.min[1] + bounds.max[1]) / 2,\n (bounds.min[2] + bounds.max[2]) / 2,\n ];\n}\n\n/**\n * Stand far enough back that the model's bounding sphere fits the narrower\n * of the two fields of view, with `margin` to spare. A sphere, not the box's\n * silhouette: it is a little loose on a tall thin thing and never crops.\n */\nexport function framedCamera(\n bounds: Bounds,\n view: FramedView,\n aspect: number,\n): CameraSpec {\n const fov = view.fov ?? 30;\n if (!(fov > 1 && fov < 120))\n throw badView(view.id, `fov ${fov} is outside 1 to 120 degrees`);\n const center = centerOf(bounds);\n const radius = radiusOf(bounds);\n const distance = framedDistance(radius, fov, aspect, view.margin ?? 0.12);\n return cameraAt(\n center,\n radius,\n directionOf(view),\n distance,\n fov,\n aspect,\n view.id,\n );\n}\n\n/** A camera `distance` along `direction` from `center`, looking back at it. */\nexport function cameraAt(\n center: Vec3,\n radius: number,\n direction: Vec3,\n distance: number,\n fov: number,\n aspect: number,\n name: string,\n): CameraSpec {\n const position: Vec3 = [\n center[0] + direction[0] * distance,\n center[1] + direction[1] * distance,\n center[2] + direction[2] * distance,\n ];\n return {\n type: 'perspective',\n fov,\n aspect,\n near: Math.max(0.001, (distance - radius) / 10),\n far: (distance + radius) * 10,\n position,\n quaternion: lookAt(position, center),\n name,\n };\n}\n\nexport function declaredCamera(view: DeclaredView, aspect: number): CameraSpec {\n const distance = Math.hypot(\n view.position[0] - view.target[0],\n view.position[1] - view.target[1],\n view.position[2] - view.target[2],\n );\n if (!(distance > 0)) throw badView(view.id, 'its position is on its target');\n return {\n type: 'perspective',\n fov: view.fov,\n aspect,\n near: Math.max(0.01, distance / 100),\n far: Math.max(100, distance * 100),\n position: [...view.position] as Vec3,\n quaternion: lookAt(view.position, view.target),\n name: view.id,\n };\n}\n\n/**\n * The rotation of a camera at `position` looking at `target`, +Y up, by\n * three's convention: a camera looks down its local -Z.\n */\nexport function lookAt(position: Vec3, target: Vec3): Quat {\n let z = normalize([\n position[0] - target[0],\n position[1] - target[1],\n position[2] - target[2],\n ]);\n if (!z) z = [0, 0, 1];\n // Straight down (or up): +Y up is degenerate, so face -Z as three does.\n const up: Vec3 =\n Math.abs(z[0]) < 1e-9 && Math.abs(z[2]) < 1e-9 ? [0, 0, -1] : [0, 1, 0];\n const x = normalize(cross(up, z)) ?? [1, 0, 0];\n const y = cross(z, x);\n return quaternionOf(x, y, z);\n}\n\nfunction quaternionOf(x: Vec3, y: Vec3, z: Vec3): Quat {\n const m00 = x[0],\n m10 = x[1],\n m20 = x[2];\n const m01 = y[0],\n m11 = y[1],\n m21 = y[2];\n const m02 = z[0],\n m12 = z[1],\n m22 = z[2];\n const trace = m00 + m11 + m22;\n if (trace > 0) {\n const s = 0.5 / Math.sqrt(trace + 1);\n return [(m21 - m12) * s, (m02 - m20) * s, (m10 - m01) * s, 0.25 / s];\n }\n if (m00 > m11 && m00 > m22) {\n const s = 2 * Math.sqrt(1 + m00 - m11 - m22);\n return [0.25 * s, (m01 + m10) / s, (m02 + m20) / s, (m21 - m12) / s];\n }\n if (m11 > m22) {\n const s = 2 * Math.sqrt(1 + m11 - m00 - m22);\n return [(m01 + m10) / s, 0.25 * s, (m12 + m21) / s, (m02 - m20) / s];\n }\n const s = 2 * Math.sqrt(1 + m22 - m00 - m11);\n return [(m02 + m20) / s, (m12 + m21) / s, 0.25 * s, (m10 - m01) / s];\n}\n\nfunction cross(a: Vec3, b: Vec3): Vec3 {\n return [\n a[1] * b[2] - a[2] * b[1],\n a[2] * b[0] - a[0] * b[2],\n a[0] * b[1] - a[1] * b[0],\n ];\n}\n\nfunction normalize(v: Vec3): Vec3 | null {\n const length = Math.hypot(v[0], v[1], v[2]);\n return length > 1e-12 ? [v[0] / length, v[1] / length, v[2] / length] : null;\n}\n\nfunction badView(id: string, what: string): Bakery3Error {\n return new Bakery3Error({\n code: 'InvalidRequest',\n message: `Camera \"${id}\": ${what}.`,\n docs: 'https://bakery3.com/docs/catalog#angles',\n });\n}\n","/**\n * Generated by the preset library's sync script. Do not edit.\n *\n * The catalog of presets served from the CDN: every material, pedestal and\n * environment the SDK can load, with its files and dimensions.\n */\n\nexport const PRESETS_VERSION = 1;\n\nexport type PresetMapName = 'albedo' | 'normal' | 'roughness' | 'ao' | 'height';\nexport type PresetTextureSize = '1k' | '2k' | '4k';\n\nexport type MaterialPresetInfo = {\n label: string;\n category: 'floor' | 'wall' | 'generic';\n description: string;\n /** Physical edge length, metres, of one texture tile. */\n tileMeters: number;\n metalness: number;\n normalScale: number;\n /** Metres of relief the height map's 0..1 spans. */\n heightScale: number;\n maps: readonly PresetMapName[];\n /** Filename for each map inside a material size directory. */\n files: Readonly<Record<PresetMapName, string>>;\n sizes: readonly PresetTextureSize[];\n};\n\nexport const MATERIAL_PRESETS = {\n \"oak_floor\": {\n \"label\": \"Oak Plank Floor\",\n \"category\": \"floor\",\n \"description\": \"Warm honey oak planks, satin lacquer, gentle per-plank variation.\",\n \"tileMeters\": 2.4,\n \"metalness\": 0,\n \"normalScale\": 1,\n \"heightScale\": 0.004,\n \"maps\": [\n \"albedo\",\n \"normal\",\n \"roughness\",\n \"ao\",\n \"height\"\n ],\n \"files\": {\n \"albedo\": \"albedo.png\",\n \"normal\": \"normal.png\",\n \"roughness\": \"roughness.png\",\n \"ao\": \"ao.png\",\n \"height\": \"height.png\"\n },\n \"sizes\": [\n \"4k\",\n \"2k\",\n \"1k\"\n ]\n },\n \"walnut_floor\": {\n \"label\": \"Walnut Plank Floor\",\n \"category\": \"floor\",\n \"description\": \"Dark oiled walnut boards with straight, fine grain.\",\n \"tileMeters\": 2.4,\n \"metalness\": 0,\n \"normalScale\": 1,\n \"heightScale\": 0.004,\n \"maps\": [\n \"albedo\",\n \"normal\",\n \"roughness\",\n \"ao\",\n \"height\"\n ],\n \"files\": {\n \"albedo\": \"albedo.png\",\n \"normal\": \"normal.png\",\n \"roughness\": \"roughness.png\",\n \"ao\": \"ao.png\",\n \"height\": \"height.png\"\n },\n \"sizes\": [\n \"4k\",\n \"2k\",\n \"1k\"\n ]\n },\n \"white_plaster\": {\n \"label\": \"White Plaster\",\n \"category\": \"wall\",\n \"description\": \"Hand-trowelled lime plaster, soft undulation with a fine tooth.\",\n \"tileMeters\": 1.5,\n \"metalness\": 0,\n \"normalScale\": 1,\n \"heightScale\": 0.005,\n \"maps\": [\n \"albedo\",\n \"normal\",\n \"roughness\",\n \"ao\",\n \"height\"\n ],\n \"files\": {\n \"albedo\": \"albedo.png\",\n \"normal\": \"normal.png\",\n \"roughness\": \"roughness.png\",\n \"ao\": \"ao.png\",\n \"height\": \"height.png\"\n },\n \"sizes\": [\n \"4k\",\n \"2k\",\n \"1k\"\n ]\n },\n \"matte_paint\": {\n \"label\": \"Matte Paint\",\n \"category\": \"wall\",\n \"description\": \"Near-white matte emulsion with a faint roller texture. Tint it with material.color.\",\n \"tileMeters\": 1.2,\n \"metalness\": 0,\n \"normalScale\": 0.6,\n \"heightScale\": 0.0012,\n \"maps\": [\n \"albedo\",\n \"normal\",\n \"roughness\",\n \"ao\",\n \"height\"\n ],\n \"files\": {\n \"albedo\": \"albedo.png\",\n \"normal\": \"normal.png\",\n \"roughness\": \"roughness.png\",\n \"ao\": \"ao.png\",\n \"height\": \"height.png\"\n },\n \"sizes\": [\n \"4k\",\n \"2k\",\n \"1k\"\n ]\n },\n \"polished_concrete\": {\n \"label\": \"Polished Concrete\",\n \"category\": \"floor\",\n \"description\": \"Grey power-trowelled concrete, soft mottling and sparse aggregate.\",\n \"tileMeters\": 3,\n \"metalness\": 0,\n \"normalScale\": 0.8,\n \"heightScale\": 0.002,\n \"maps\": [\n \"albedo\",\n \"normal\",\n \"roughness\",\n \"ao\",\n \"height\"\n ],\n \"files\": {\n \"albedo\": \"albedo.png\",\n \"normal\": \"normal.png\",\n \"roughness\": \"roughness.png\",\n \"ao\": \"ao.png\",\n \"height\": \"height.png\"\n },\n \"sizes\": [\n \"4k\",\n \"2k\",\n \"1k\"\n ]\n },\n \"carrara_marble\": {\n \"label\": \"Carrara Marble\",\n \"category\": \"generic\",\n \"description\": \"Polished white marble with soft grey feather veining.\",\n \"tileMeters\": 2,\n \"metalness\": 0,\n \"normalScale\": 0.5,\n \"heightScale\": 0.0008,\n \"maps\": [\n \"albedo\",\n \"normal\",\n \"roughness\",\n \"ao\",\n \"height\"\n ],\n \"files\": {\n \"albedo\": \"albedo.png\",\n \"normal\": \"normal.png\",\n \"roughness\": \"roughness.png\",\n \"ao\": \"ao.png\",\n \"height\": \"height.png\"\n },\n \"sizes\": [\n \"4k\",\n \"2k\",\n \"1k\"\n ]\n },\n \"terrazzo\": {\n \"label\": \"Terrazzo\",\n \"category\": \"floor\",\n \"description\": \"Cream cement ground with polished multi-tone stone chips.\",\n \"tileMeters\": 1.6,\n \"metalness\": 0,\n \"normalScale\": 0.6,\n \"heightScale\": 0.0012,\n \"maps\": [\n \"albedo\",\n \"normal\",\n \"roughness\",\n \"ao\",\n \"height\"\n ],\n \"files\": {\n \"albedo\": \"albedo.png\",\n \"normal\": \"normal.png\",\n \"roughness\": \"roughness.png\",\n \"ao\": \"ao.png\",\n \"height\": \"height.png\"\n },\n \"sizes\": [\n \"4k\",\n \"2k\",\n \"1k\"\n ]\n },\n \"travertine\": {\n \"label\": \"Travertine\",\n \"category\": \"generic\",\n \"description\": \"Honed beige travertine, layered banding and natural pitting.\",\n \"tileMeters\": 2,\n \"metalness\": 0,\n \"normalScale\": 1,\n \"heightScale\": 0.004,\n \"maps\": [\n \"albedo\",\n \"normal\",\n \"roughness\",\n \"ao\",\n \"height\"\n ],\n \"files\": {\n \"albedo\": \"albedo.png\",\n \"normal\": \"normal.png\",\n \"roughness\": \"roughness.png\",\n \"ao\": \"ao.png\",\n \"height\": \"height.png\"\n },\n \"sizes\": [\n \"4k\",\n \"2k\",\n \"1k\"\n ]\n },\n \"white_brick\": {\n \"label\": \"Painted Brick\",\n \"category\": \"wall\",\n \"description\": \"White-painted brick with recessed mortar joints.\",\n \"tileMeters\": 2,\n \"metalness\": 0,\n \"normalScale\": 1,\n \"heightScale\": 0.008,\n \"maps\": [\n \"albedo\",\n \"normal\",\n \"roughness\",\n \"ao\",\n \"height\"\n ],\n \"files\": {\n \"albedo\": \"albedo.png\",\n \"normal\": \"normal.png\",\n \"roughness\": \"roughness.png\",\n \"ao\": \"ao.png\",\n \"height\": \"height.png\"\n },\n \"sizes\": [\n \"4k\",\n \"2k\",\n \"1k\"\n ]\n },\n \"coated_pine\": {\n \"label\": \"Coated Pine\",\n \"category\": \"generic\",\n \"description\": \"Warm knotty pine with a glossy worn varnish.\",\n \"tileMeters\": 0.7,\n \"metalness\": 0,\n \"normalScale\": 1,\n \"heightScale\": 0.005,\n \"maps\": [\n \"albedo\",\n \"normal\",\n \"roughness\",\n \"ao\",\n \"height\"\n ],\n \"files\": {\n \"albedo\": \"albedo.jpg\",\n \"normal\": \"normal.png\",\n \"roughness\": \"arm.jpg\",\n \"ao\": \"arm.jpg\",\n \"height\": \"height.png\"\n },\n \"sizes\": [\n \"4k\",\n \"2k\",\n \"1k\"\n ]\n },\n \"laminate_floor\": {\n \"label\": \"Worn Laminate Floor\",\n \"category\": \"floor\",\n \"description\": \"Light oak laminate planks with scratches, stains and a soft gloss.\",\n \"tileMeters\": 2,\n \"metalness\": 0,\n \"normalScale\": 1,\n \"heightScale\": 0.006,\n \"maps\": [\n \"albedo\",\n \"normal\",\n \"roughness\",\n \"ao\",\n \"height\"\n ],\n \"files\": {\n \"albedo\": \"albedo.jpg\",\n \"normal\": \"normal.png\",\n \"roughness\": \"arm.jpg\",\n \"ao\": \"arm.jpg\",\n \"height\": \"height.png\"\n },\n \"sizes\": [\n \"4k\",\n \"2k\",\n \"1k\"\n ]\n },\n \"oak_veneer_05\": {\n \"label\": \"Oak Veneer\",\n \"category\": \"generic\",\n \"description\": \"Natural dark oak veneer with fine grain and a raw matte finish.\",\n \"tileMeters\": 1,\n \"metalness\": 0,\n \"normalScale\": 1,\n \"heightScale\": 0.002,\n \"maps\": [\n \"albedo\",\n \"normal\",\n \"roughness\",\n \"ao\",\n \"height\"\n ],\n \"files\": {\n \"albedo\": \"albedo.jpg\",\n \"normal\": \"normal.png\",\n \"roughness\": \"arm.jpg\",\n \"ao\": \"arm.jpg\",\n \"height\": \"height.png\"\n },\n \"sizes\": [\n \"4k\",\n \"2k\",\n \"1k\"\n ]\n },\n \"plank_flooring_04\": {\n \"label\": \"Dark Plank Flooring\",\n \"category\": \"floor\",\n \"description\": \"Dark varnished timber planks with narrow seams and satin sheen.\",\n \"tileMeters\": 2,\n \"metalness\": 0,\n \"normalScale\": 1,\n \"heightScale\": 0.006,\n \"maps\": [\n \"albedo\",\n \"normal\",\n \"roughness\",\n \"ao\",\n \"height\"\n ],\n \"files\": {\n \"albedo\": \"albedo.jpg\",\n \"normal\": \"normal.png\",\n \"roughness\": \"arm.jpg\",\n \"ao\": \"arm.jpg\",\n \"height\": \"height.png\"\n },\n \"sizes\": [\n \"4k\",\n \"2k\",\n \"1k\"\n ]\n },\n \"synthetic_wood\": {\n \"label\": \"Synthetic Wood Cladding\",\n \"category\": \"wall\",\n \"description\": \"Narrow brown wood-look boards with crisp grooves and a matte finish.\",\n \"tileMeters\": 2,\n \"metalness\": 0,\n \"normalScale\": 1,\n \"heightScale\": 0.006,\n \"maps\": [\n \"albedo\",\n \"normal\",\n \"roughness\",\n \"ao\",\n \"height\"\n ],\n \"files\": {\n \"albedo\": \"albedo.jpg\",\n \"normal\": \"normal.png\",\n \"roughness\": \"arm.jpg\",\n \"ao\": \"arm.jpg\",\n \"height\": \"height.png\"\n },\n \"sizes\": [\n \"4k\",\n \"2k\",\n \"1k\"\n ]\n },\n \"wooden_floor_02\": {\n \"label\": \"Warm Hardwood Floor\",\n \"category\": \"floor\",\n \"description\": \"Warm hardwood planks with visible grain, knots and satin sheen.\",\n \"tileMeters\": 1.9,\n \"metalness\": 0,\n \"normalScale\": 1,\n \"heightScale\": 0.006,\n \"maps\": [\n \"albedo\",\n \"normal\",\n \"roughness\",\n \"ao\",\n \"height\"\n ],\n \"files\": {\n \"albedo\": \"albedo.jpg\",\n \"normal\": \"normal.png\",\n \"roughness\": \"arm.jpg\",\n \"ao\": \"arm.jpg\",\n \"height\": \"height.png\"\n },\n \"sizes\": [\n \"4k\",\n \"2k\",\n \"1k\"\n ]\n }\n} as const;\n\nexport type MaterialPresetName = keyof typeof MATERIAL_PRESETS;\n\nexport type PedestalPresetInfo = {\n label: string;\n description: string;\n /** three.js axes, metres: x width, y height (up), z depth. */\n size: { readonly x: number; readonly y: number; readonly z: number };\n defaultMaterial: MaterialPresetName;\n};\n\nexport const PEDESTAL_PRESETS = {\n \"pedestal_block\": {\n \"label\": \"Block Pedestal\",\n \"description\": \"Clean rectangular plinth with softly bevelled edges.\",\n \"size\": {\n \"x\": 0.4,\n \"y\": 1,\n \"z\": 0.4\n },\n \"defaultMaterial\": \"carrara_marble\"\n },\n \"pedestal_plinth\": {\n \"label\": \"Low Plinth\",\n \"description\": \"Wide, low platform for larger pieces.\",\n \"size\": {\n \"x\": 0.9,\n \"y\": 0.3,\n \"z\": 0.9\n },\n \"defaultMaterial\": \"polished_concrete\"\n },\n \"pedestal_cylinder\": {\n \"label\": \"Cylinder Pedestal\",\n \"description\": \"Round column pedestal with bevelled rims.\",\n \"size\": {\n \"x\": 0.42,\n \"y\": 0.95,\n \"z\": 0.42\n },\n \"defaultMaterial\": \"travertine\"\n },\n \"pedestal_column\": {\n \"label\": \"Classical Column\",\n \"description\": \"Turned classical pedestal: stepped base, gently tapered shaft, moulded cap.\",\n \"size\": {\n \"x\": 0.45,\n \"y\": 1.05,\n \"z\": 0.45\n },\n \"defaultMaterial\": \"carrara_marble\"\n }\n} as const;\n\nexport type PedestalPresetName = keyof typeof PEDESTAL_PRESETS;\n\n/** The shelf a map sits on: a room in that lighting mode offers it; `studio` is for product probes. */\nexport type HdriPresetCategory = 'day' | 'golden' | 'overcast' | 'night' | 'studio';\n\nexport type HdriPresetInfo = {\n label: string;\n description: string;\n category: HdriPresetCategory;\n /** Metres the camera stood above the ground: the height a ground-projected dome is lifted by. */\n groundHeight: number;\n /**\n * W/m² its sky delivers to a plane facing up, as measured (the map clamped\n * so its own sun does not count). A room shows the map at its own\n * `skyIrradiance` divided by this, so a map shot darker than the room is\n * lit is not a dim poster outside the windows.\n */\n skyIrradiance: number;\n preview: { readonly file: string; readonly resolution: number };\n render: { readonly file: string; readonly resolution: number };\n};\n\nexport const HDRI_PRESETS = {\n \"pergola_walkway\": {\n \"label\": \"Pergola Walkway\",\n \"description\": \"A garden walkway under a vine-covered pergola, high sun, greenery on every side.\",\n \"category\": \"day\",\n \"groundHeight\": 1.6,\n \"skyIrradiance\": 1.7631801999999999,\n \"preview\": {\n \"file\": \"pergola_walkway_1k.hdr\",\n \"resolution\": 1024\n },\n \"render\": {\n \"file\": \"pergola_walkway_4k.exr\",\n \"resolution\": 4096\n }\n },\n \"sunny_country_road\": {\n \"label\": \"Sunny Country Road\",\n \"description\": \"A dirt road between fields under a high midday sun.\",\n \"category\": \"day\",\n \"groundHeight\": 1.6,\n \"skyIrradiance\": 1.0989418,\n \"preview\": {\n \"file\": \"sunny_country_road_1k.hdr\",\n \"resolution\": 1024\n },\n \"render\": {\n \"file\": \"sunny_country_road_4k.exr\",\n \"resolution\": 4096\n }\n },\n \"horn-koppe_spring\": {\n \"label\": \"Horn-Koppe Spring\",\n \"description\": \"Alpine meadow in spring, snow on the peaks, a high clear sun.\",\n \"category\": \"day\",\n \"groundHeight\": 1.6,\n \"skyIrradiance\": 1.4612264,\n \"preview\": {\n \"file\": \"horn-koppe_spring_1k.hdr\",\n \"resolution\": 1024\n },\n \"render\": {\n \"file\": \"horn-koppe_spring_4k.exr\",\n \"resolution\": 4096\n }\n },\n \"grasslands_sunset\": {\n \"label\": \"Grasslands Late Sun\",\n \"description\": \"Open grassland with the sun low but still white, a long afternoon.\",\n \"category\": \"day\",\n \"groundHeight\": 1.6,\n \"skyIrradiance\": 3.9029496,\n \"preview\": {\n \"file\": \"grasslands_sunset_1k.hdr\",\n \"resolution\": 1024\n },\n \"render\": {\n \"file\": \"grasslands_sunset_4k.exr\",\n \"resolution\": 4096\n }\n },\n \"je_gray_02\": {\n \"label\": \"Grey Park\",\n \"description\": \"A shaded park path, the sun low behind trees, a soft, cool day.\",\n \"category\": \"day\",\n \"groundHeight\": 1.6,\n \"skyIrradiance\": 0.21612759999999998,\n \"preview\": {\n \"file\": \"je_gray_02_1k.hdr\",\n \"resolution\": 1024\n },\n \"render\": {\n \"file\": \"je_gray_02_4k.exr\",\n \"resolution\": 4096\n }\n },\n \"qwantani_sunset\": {\n \"label\": \"Qwantani Sunset\",\n \"description\": \"Sunset over the veld: a warm horizon and a clear deep sky above.\",\n \"category\": \"golden\",\n \"groundHeight\": 1.6,\n \"skyIrradiance\": 2.3187784,\n \"preview\": {\n \"file\": \"qwantani_sunset_1k.hdr\",\n \"resolution\": 1024\n },\n \"render\": {\n \"file\": \"qwantani_sunset_4k.exr\",\n \"resolution\": 4096\n }\n },\n \"venice_sunset\": {\n \"label\": \"Venice Sunset\",\n \"description\": \"The lagoon at sunset, water and sky both gold.\",\n \"category\": \"golden\",\n \"groundHeight\": 1.6,\n \"skyIrradiance\": 2.1780174,\n \"preview\": {\n \"file\": \"venice_sunset_1k.hdr\",\n \"resolution\": 1024\n },\n \"render\": {\n \"file\": \"venice_sunset_4k.exr\",\n \"resolution\": 4096\n }\n },\n \"bambanani_sunset\": {\n \"label\": \"Bambanani Sunset\",\n \"description\": \"A township street at sunset, the sun red and low.\",\n \"category\": \"golden\",\n \"groundHeight\": 1.6,\n \"skyIrradiance\": 3.300283399999999,\n \"preview\": {\n \"file\": \"bambanani_sunset_1k.hdr\",\n \"resolution\": 1024\n },\n \"render\": {\n \"file\": \"bambanani_sunset_4k.exr\",\n \"resolution\": 4096\n }\n },\n \"umhlanga_sunrise\": {\n \"label\": \"Umhlanga Sunrise\",\n \"description\": \"Sunrise over the sea, the sun just clear of the horizon.\",\n \"category\": \"golden\",\n \"groundHeight\": 1.6,\n \"skyIrradiance\": 3.3150258000000004,\n \"preview\": {\n \"file\": \"umhlanga_sunrise_1k.hdr\",\n \"resolution\": 1024\n },\n \"render\": {\n \"file\": \"umhlanga_sunrise_4k.exr\",\n \"resolution\": 4096\n }\n },\n \"flamingo_pan\": {\n \"label\": \"Flamingo Pan\",\n \"description\": \"A salt pan at sunset, the sun on the horizon and a violet sky.\",\n \"category\": \"golden\",\n \"groundHeight\": 1.6,\n \"skyIrradiance\": 3.1940932,\n \"preview\": {\n \"file\": \"flamingo_pan_1k.hdr\",\n \"resolution\": 1024\n },\n \"render\": {\n \"file\": \"flamingo_pan_4k.exr\",\n \"resolution\": 4096\n }\n },\n \"minedump_flats\": {\n \"label\": \"Minedump Flats\",\n \"description\": \"Flat scrub at sunset under a hazy, dusty sky.\",\n \"category\": \"golden\",\n \"groundHeight\": 1.6,\n \"skyIrradiance\": 2.9883286,\n \"preview\": {\n \"file\": \"minedump_flats_1k.hdr\",\n \"resolution\": 1024\n },\n \"render\": {\n \"file\": \"minedump_flats_4k.exr\",\n \"resolution\": 4096\n }\n },\n \"sunset_fairway\": {\n \"label\": \"Sunset Fairway\",\n \"description\": \"A golf fairway at dusk, the sun already down and the sky lit from below.\",\n \"category\": \"golden\",\n \"groundHeight\": 1.6,\n \"skyIrradiance\": 2.7264117999999997,\n \"preview\": {\n \"file\": \"sunset_fairway_1k.hdr\",\n \"resolution\": 1024\n },\n \"render\": {\n \"file\": \"sunset_fairway_4k.exr\",\n \"resolution\": 4096\n }\n },\n \"the_sky_is_on_fire\": {\n \"label\": \"Sky on Fire\",\n \"description\": \"A blazing red-orange sunset over open country.\",\n \"category\": \"golden\",\n \"groundHeight\": 1.6,\n \"skyIrradiance\": 2.4784194,\n \"preview\": {\n \"file\": \"the_sky_is_on_fire_1k.hdr\",\n \"resolution\": 1024\n },\n \"render\": {\n \"file\": \"the_sky_is_on_fire_4k.exr\",\n \"resolution\": 4096\n }\n },\n \"dalkey_view\": {\n \"label\": \"Dalkey View\",\n \"description\": \"A coastal hillside under a bright overcast sky.\",\n \"category\": \"overcast\",\n \"groundHeight\": 1.6,\n \"skyIrradiance\": 4.501861400000001,\n \"preview\": {\n \"file\": \"dalkey_view_1k.hdr\",\n \"resolution\": 1024\n },\n \"render\": {\n \"file\": \"dalkey_view_4k.exr\",\n \"resolution\": 4096\n }\n },\n \"afrikaans_church_exterior\": {\n \"label\": \"Church Square\",\n \"description\": \"A quiet square under heavy cloud, a white church across it.\",\n \"category\": \"overcast\",\n \"groundHeight\": 1.6,\n \"skyIrradiance\": 4.194848599999999,\n \"preview\": {\n \"file\": \"afrikaans_church_exterior_1k.hdr\",\n \"resolution\": 1024\n },\n \"render\": {\n \"file\": \"afrikaans_church_exterior_4k.exr\",\n \"resolution\": 4096\n }\n },\n \"quarry_cloudy\": {\n \"label\": \"Cloudy Quarry\",\n \"description\": \"A stone quarry under an even grey sky.\",\n \"category\": \"overcast\",\n \"groundHeight\": 1.6,\n \"skyIrradiance\": 3.9304787999999995,\n \"preview\": {\n \"file\": \"quarry_cloudy_1k.hdr\",\n \"resolution\": 1024\n },\n \"render\": {\n \"file\": \"quarry_cloudy_4k.exr\",\n \"resolution\": 4096\n }\n },\n \"moonless_golf\": {\n \"label\": \"Moonless Golf Course\",\n \"description\": \"A moonless night over a golf course, a faint glow from the town.\",\n \"category\": \"night\",\n \"groundHeight\": 1.6,\n \"skyIrradiance\": 0.5007998,\n \"preview\": {\n \"file\": \"moonless_golf_1k.hdr\",\n \"resolution\": 1024\n },\n \"render\": {\n \"file\": \"moonless_golf_4k.exr\",\n \"resolution\": 4096\n }\n },\n \"preller_drive\": {\n \"label\": \"Preller Drive\",\n \"description\": \"A suburban street at night, sodium street lamps and dark trees.\",\n \"category\": \"night\",\n \"groundHeight\": 1.6,\n \"skyIrradiance\": 0.5283702,\n \"preview\": {\n \"file\": \"preller_drive_1k.hdr\",\n \"resolution\": 1024\n },\n \"render\": {\n \"file\": \"preller_drive_4k.exr\",\n \"resolution\": 4096\n }\n },\n \"satara_night\": {\n \"label\": \"Satara Night\",\n \"description\": \"A bush camp at night, a few lamps and a starry sky.\",\n \"category\": \"night\",\n \"groundHeight\": 1.6,\n \"skyIrradiance\": 0.25447,\n \"preview\": {\n \"file\": \"satara_night_1k.hdr\",\n \"resolution\": 1024\n },\n \"render\": {\n \"file\": \"satara_night_4k.exr\",\n \"resolution\": 4096\n }\n },\n \"ferndale_studio_11\": {\n \"label\": \"Ferndale Studio 11\",\n \"description\": \"High-contrast studio environment with broad soft sources.\",\n \"category\": \"studio\",\n \"groundHeight\": 1.2,\n \"skyIrradiance\": 1.2286402,\n \"preview\": {\n \"file\": \"ferndale_studio_11_1k.hdr\",\n \"resolution\": 1024\n },\n \"render\": {\n \"file\": \"ferndale_studio_11_4k.exr\",\n \"resolution\": 4096\n }\n },\n \"ferndale_studio_12\": {\n \"label\": \"Ferndale Studio 12\",\n \"description\": \"Balanced product studio with shaped highlights.\",\n \"category\": \"studio\",\n \"groundHeight\": 1.2,\n \"skyIrradiance\": 1.2324262000000001,\n \"preview\": {\n \"file\": \"ferndale_studio_12_1k.hdr\",\n \"resolution\": 1024\n },\n \"render\": {\n \"file\": \"ferndale_studio_12_4k.exr\",\n \"resolution\": 4096\n }\n },\n \"monochrome_studio_02\": {\n \"label\": \"Monochrome Studio 02\",\n \"description\": \"Neutral monochrome studio for material-focused renders.\",\n \"category\": \"studio\",\n \"groundHeight\": 1.2,\n \"skyIrradiance\": 0.9193722,\n \"preview\": {\n \"file\": \"monochrome_studio_02_1k.hdr\",\n \"resolution\": 1024\n },\n \"render\": {\n \"file\": \"monochrome_studio_02_4k.exr\",\n \"resolution\": 4096\n }\n },\n \"studio_kontrast_04\": {\n \"label\": \"Studio Kontrast 04\",\n \"description\": \"Directional studio contrast with crisp reflections.\",\n \"category\": \"studio\",\n \"groundHeight\": 1.2,\n \"skyIrradiance\": 2.9173432,\n \"preview\": {\n \"file\": \"studio_kontrast_04_1k.hdr\",\n \"resolution\": 1024\n },\n \"render\": {\n \"file\": \"studio_kontrast_04_4k.exr\",\n \"resolution\": 4096\n }\n },\n \"studio_small_03\": {\n \"label\": \"Small Studio 03\",\n \"description\": \"Compact studio environment with close softboxes.\",\n \"category\": \"studio\",\n \"groundHeight\": 1.2,\n \"skyIrradiance\": 13.877922599999998,\n \"preview\": {\n \"file\": \"studio_small_03_1k.hdr\",\n \"resolution\": 1024\n },\n \"render\": {\n \"file\": \"studio_small_03_4k.exr\",\n \"resolution\": 4096\n }\n }\n} as const;\n\nexport type HdriPresetName = keyof typeof HDRI_PRESETS;\n","/**\n * Generated by the preset library's sync script and by every room publish.\n * Do not edit.\n *\n * The rooms the SDK can offer. `build` is the content hash of the published\n * room definition; the manifest repeats it and the renderer refuses any\n * other, so what was framed in the browser is what gets traced.\n */\n\nexport type RoomPresetLighting = 'day' | 'golden' | 'overcast' | 'night';\n\nexport type RoomPresetSurface = { readonly material: string; readonly color: string };\n\nexport type RoomPresetInfo = {\n label: string;\n description: string;\n /** Content hash of the published record (see above). */\n build: string;\n presetsVersion: number;\n /** Metres. Floor at y = 0, centred on the origin; north is −z. */\n size: { readonly width: number; readonly height: number; readonly depth: number };\n /** The mode the room was designed under; any of the four can be asked for. */\n lighting: RoomPresetLighting;\n surfaces: {\n readonly floor: RoomPresetSurface;\n readonly walls: RoomPresetSurface;\n readonly ceiling: RoomPresetSurface;\n readonly sill: { readonly material: string };\n };\n /** What the subject stands on, where, and how high its top is. */\n stand: {\n readonly type: string | null;\n readonly material: string | null;\n readonly x: number;\n readonly z: number;\n readonly rotationDeg: number;\n readonly top: number;\n /** three.js axes, metres. `null` when the room has no stand. */\n readonly size: { readonly x: number; readonly y: number; readonly z: number } | null;\n };\n /** The published framing, in the room's own frame. */\n camera: {\n readonly position: readonly [number, number, number];\n readonly target: readonly [number, number, number];\n readonly lensMm: number;\n readonly fstop: number | null;\n };\n /** The browser stand-in on the CDN, relative to `/v<N>/`. */\n preview: {\n readonly glb: string;\n readonly bytes: number;\n readonly triangles: number;\n readonly textures: number;\n };\n /**\n * How walled in and how full the room is from its own camera (the\n * protocol's `SceneComplexity`), measured from the stand-in when the\n * room was published. The render estimator prices a room by these, as it\n * prices any scene. Null for a room published before they were measured.\n */\n complexity: { readonly enclosure: number; readonly objects: number } | null;\n /**\n * The lighting modes this room's own lightmaps are published for.\n *\n * A bake of a product standing in an UNMODIFIED preset room takes the\n * room's light from that library asset and covers only the product, the\n * stand and the shadow it casts. A mode that is not on this list has no\n * such asset, so a bake of it lights the whole room itself, which costs\n * what it always did. Empty until the room is prebaked and published.\n */\n prebaked: readonly RoomPresetLighting[];\n /** The plants the room stands, by library id. A bake stands each one in\n * for a reduced planter and a card of foliage. */\n plants: readonly string[];\n /**\n * The pictures this room hangs, in the order it hangs them: which wall,\n * and how long the image's longest side is in metres.\n *\n * `createPresetRoom({ pictures: [...] })` fills them in this order. The\n * frame does not move for a replacement: it is cropped to fill the\n * opening, the way `object-fit: cover` fills a box.\n */\n pictures: readonly { readonly wall: string; readonly size: number }[];\n /**\n * How bright the stand-in's lights are under each mode, as a multiple of\n * the mode's viewport rig, set per room so the preview reads about as\n * bright as the render, which never sees this number. Already normalised\n * to `exposure`: the stand-in and the trace agree at whatever exposure\n * the scene runs, since both scale with it alike.\n */\n previewBrightness: Record<RoomPresetLighting, number>;\n /**\n * The hue of that fill's two halves, per mode, at luminance 1: the colour\n * of the light this room's own openings and fixtures actually deliver,\n * measured off the sky the renderer builds. Applied to the mode's fill\n * colours it changes their hue and not their level, so the stand-in of a\n * skylit room reads blue like the render of it instead of cream.\n */\n previewFill: Record<RoomPresetLighting, { sky: number[]; ground: number[] }>;\n /**\n * The map outside the windows under each mode, as published: which,\n * turned how far clockwise so its sun sits at the room's, and how high\n * its camera stood (the ground-projected dome's lift). Null is a plain\n * sky and nothing outside. `createPresetRoom({ hdri })` overrides it.\n * The render's air over the distance is the renderer's own;\n * the stand-in shows the map as shot.\n */\n hdri: Record<\n RoomPresetLighting,\n { readonly name: string; readonly rotationDeg: number; readonly groundHeight: number } | null\n >;\n /**\n * W/m² the room's own sky delivers to a plane facing up, per mode: the\n * physical sky at the room's sun, or the flat sky. A map outside the windows\n * is shown at this over the map's own `skyIrradiance`, so what is seen\n * through the glass is as bright as the light coming in through it.\n */\n skyIrradiance: Record<RoomPresetLighting, number>;\n /**\n * The three.js `toneMappingExposure` the room is designed for, per mode.\n * The room is traced at this exposure and every published comparison of\n * it was judged at it. `createPresetRoom` leaves the current\n * mode's value on `userData.exposure`: a scene that sets its renderer to\n * it renders the room as bright as it was meant to be, in the viewport\n * and in the trace alike, since the manifest carries the exposure, and\n * one that keeps exposure 1 gets a faithful picture about a stop darker.\n */\n exposure: Record<RoomPresetLighting, number>;\n};\n\nexport const ROOM_PRESETS = {\n \"atelier_skylight\": {\n \"label\": \"Skylight Atelier\",\n \"description\": \"Concrete floor, tall plaster walls and two roof lights pouring foliage-broken sun straight down onto a low plinth.\",\n \"build\": \"94fc05030ebb\",\n \"presetsVersion\": 1,\n \"size\": {\n \"width\": 5.5,\n \"height\": 3.4,\n \"depth\": 5.5\n },\n \"lighting\": \"day\",\n \"surfaces\": {\n \"floor\": {\n \"material\": \"polished_concrete\",\n \"color\": \"#ffffff\"\n },\n \"walls\": {\n \"material\": \"white_plaster\",\n \"color\": \"#f2efe8\"\n },\n \"ceiling\": {\n \"material\": \"matte_paint\",\n \"color\": \"#f5f4f0\"\n },\n \"sill\": {\n \"material\": \"travertine\"\n }\n },\n \"stand\": {\n \"type\": \"pedestal_plinth\",\n \"material\": \"carrara_marble\",\n \"x\": 0,\n \"z\": -0.2,\n \"rotationDeg\": 0,\n \"top\": 0.3,\n \"size\": {\n \"x\": 0.9,\n \"y\": 0.3,\n \"z\": 0.9\n }\n },\n \"camera\": {\n \"position\": [\n -1.7918,\n 1.38,\n 1.4709\n ],\n \"target\": [\n 0,\n 0.55,\n -0.2\n ],\n \"lensMm\": 38,\n \"fstop\": 2.4000000953674316\n },\n \"preview\": {\n \"glb\": \"rooms/atelier_skylight/room.glb\",\n \"bytes\": 1590368,\n \"triangles\": 70882,\n \"textures\": 21\n },\n \"complexity\": {\n \"enclosure\": 1,\n \"objects\": 60\n },\n \"prebaked\": [],\n \"plants\": [\n \"potted_dracaena_01\",\n \"potted_monstera_01\"\n ],\n \"pictures\": [],\n \"previewBrightness\": {\n \"day\": 0.775,\n \"golden\": 0.775,\n \"overcast\": 0.723,\n \"night\": 0.7\n },\n \"previewFill\": {\n \"day\": {\n \"sky\": [\n 0.861,\n 1.012,\n 1.285\n ],\n \"ground\": [\n 0.861,\n 1.012,\n 1.285\n ]\n },\n \"golden\": {\n \"sky\": [\n 0.881,\n 1.021,\n 1.138\n ],\n \"ground\": [\n 0.881,\n 1.021,\n 1.138\n ]\n },\n \"overcast\": {\n \"sky\": [\n 0.997,\n 0.997,\n 1.041\n ],\n \"ground\": [\n 0.997,\n 0.997,\n 1.041\n ]\n },\n \"night\": {\n \"sky\": [\n 1.418,\n 0.905,\n 0.707\n ],\n \"ground\": [\n 1.418,\n 0.905,\n 0.707\n ]\n }\n },\n \"exposure\": {\n \"day\": 1.741,\n \"golden\": 1.741,\n \"overcast\": 1.866,\n \"night\": 2.144\n },\n \"hdri\": {\n \"day\": null,\n \"golden\": null,\n \"overcast\": null,\n \"night\": null\n },\n \"skyIrradiance\": {\n \"day\": 8.595,\n \"golden\": 5.273,\n \"overcast\": 3.286,\n \"night\": 0.011\n }\n },\n \"beam_loft\": {\n \"label\": \"Beam Loft\",\n \"description\": \"A tall plaster room under oak beams: three paned windows on the east side over a slatted oak ledge, dark boards, a pale modular sofa, a leather lounge chair and an opal globe on a long cord.\",\n \"build\": \"306f502d2191\",\n \"presetsVersion\": 1,\n \"size\": {\n \"width\": 9,\n \"height\": 3.7,\n \"depth\": 7.6\n },\n \"lighting\": \"day\",\n \"surfaces\": {\n \"floor\": {\n \"material\": \"plank_flooring_04\",\n \"color\": \"#b7aea4\"\n },\n \"walls\": {\n \"material\": \"white_plaster\",\n \"color\": \"#eeebe5\"\n },\n \"ceiling\": {\n \"material\": \"white_plaster\",\n \"color\": \"#f2f0eb\"\n },\n \"sill\": {\n \"material\": \"coated_pine\"\n }\n },\n \"stand\": {\n \"type\": \"coffee_table_round_01\",\n \"material\": null,\n \"x\": 0.2,\n \"z\": -1.5,\n \"rotationDeg\": 0,\n \"top\": 0.491,\n \"size\": {\n \"x\": 1.3013,\n \"y\": 0.491,\n \"z\": 1.3013\n }\n },\n \"camera\": {\n \"position\": [\n -1.7117,\n 1.3,\n 2.7937\n ],\n \"target\": [\n 0.2,\n 0.741,\n -1.5\n ],\n \"lensMm\": 21,\n \"fstop\": 5.599999904632568\n },\n \"preview\": {\n \"glb\": \"rooms/beam_loft/room.glb\",\n \"bytes\": 2350456,\n \"triangles\": 102810,\n \"textures\": 37\n },\n \"complexity\": {\n \"enclosure\": 1,\n \"objects\": 51\n },\n \"prebaked\": [],\n \"plants\": [\n \"potted_dracaena_01\",\n \"potted_plant_01\"\n ],\n \"pictures\": [],\n \"previewBrightness\": {\n \"day\": 1.877,\n \"golden\": 2.176,\n \"overcast\": 0.381,\n \"night\": 0.191\n },\n \"previewFill\": {\n \"day\": {\n \"sky\": [\n 0.976,\n 1.001,\n 1.058\n ],\n \"ground\": [\n 1.076,\n 0.986,\n 0.914\n ]\n },\n \"golden\": {\n \"sky\": [\n 1.242,\n 0.96,\n 0.686\n ],\n \"ground\": [\n 1.355,\n 0.936,\n 0.586\n ]\n },\n \"overcast\": {\n \"sky\": [\n 0.964,\n 1.004,\n 1.071\n ],\n \"ground\": [\n 1.062,\n 0.989,\n 0.925\n ]\n },\n \"night\": {\n \"sky\": [\n 1.466,\n 0.899,\n 0.627\n ],\n \"ground\": [\n 1.59,\n 0.872,\n 0.533\n ]\n }\n },\n \"exposure\": {\n \"day\": 1.741,\n \"golden\": 1.741,\n \"overcast\": 1.866,\n \"night\": 2.144\n },\n \"hdri\": {\n \"day\": {\n \"name\": \"horn-koppe_spring\",\n \"rotationDeg\": 352,\n \"groundHeight\": 1.6\n },\n \"golden\": {\n \"name\": \"umhlanga_sunrise\",\n \"rotationDeg\": 330,\n \"groundHeight\": 1.6\n },\n \"overcast\": {\n \"name\": \"dalkey_view\",\n \"rotationDeg\": 0,\n \"groundHeight\": 1.6\n },\n \"night\": {\n \"name\": \"preller_drive\",\n \"rotationDeg\": 0,\n \"groundHeight\": 1.6\n }\n },\n \"skyIrradiance\": {\n \"day\": 8.707,\n \"golden\": 5.273,\n \"overcast\": 3.286,\n \"night\": 0.011\n }\n },\n \"conservatory_day\": {\n \"label\": \"Conservatory\",\n \"description\": \"Travertine and white plaster under a foliage-broken roof light, three east windows of morning sun, and all five plants of the set standing around a vase on a marble cylinder.\",\n \"build\": \"5d7e79e6a4fc\",\n \"presetsVersion\": 1,\n \"size\": {\n \"width\": 5.6,\n \"height\": 3.4,\n \"depth\": 5.6\n },\n \"lighting\": \"day\",\n \"surfaces\": {\n \"floor\": {\n \"material\": \"travertine\",\n \"color\": \"#ffffff\"\n },\n \"walls\": {\n \"material\": \"white_plaster\",\n \"color\": \"#f9f3fa\"\n },\n \"ceiling\": {\n \"material\": \"matte_paint\",\n \"color\": \"#f5f4f0\"\n },\n \"sill\": {\n \"material\": \"travertine\"\n }\n },\n \"stand\": {\n \"type\": \"pedestal_cylinder\",\n \"material\": \"carrara_marble\",\n \"x\": 0,\n \"z\": -0.15,\n \"rotationDeg\": 0,\n \"top\": 0.95,\n \"size\": {\n \"x\": 0.42,\n \"y\": 0.95,\n \"z\": 0.42\n }\n },\n \"camera\": {\n \"position\": [\n -0.2066,\n 1.3,\n -0.9848\n ],\n \"target\": [\n 0,\n 1.2,\n -0.15\n ],\n \"lensMm\": 26,\n \"fstop\": 4\n },\n \"preview\": {\n \"glb\": \"rooms/conservatory_day/room.glb\",\n \"bytes\": 3067924,\n \"triangles\": 170081,\n \"textures\": 35\n },\n \"complexity\": {\n \"enclosure\": 1,\n \"objects\": 54\n },\n \"prebaked\": [],\n \"plants\": [\n \"potted_bird_of_paradise_01\",\n \"potted_monstera_01\",\n \"potted_monstera_02\",\n \"potted_plant_04\"\n ],\n \"pictures\": [],\n \"previewBrightness\": {\n \"day\": 1.551,\n \"golden\": 1.551,\n \"overcast\": 1.447,\n \"night\": 1.399\n },\n \"previewFill\": {\n \"day\": {\n \"sky\": [\n 0.966,\n 1,\n 1.104\n ],\n \"ground\": [\n 0.966,\n 1,\n 1.104\n ]\n },\n \"golden\": {\n \"sky\": [\n 0.966,\n 1,\n 1.104\n ],\n \"ground\": [\n 0.966,\n 1,\n 1.104\n ]\n },\n \"overcast\": {\n \"sky\": [\n 1.001,\n 0.996,\n 1.036\n ],\n \"ground\": [\n 1.001,\n 0.996,\n 1.036\n ]\n },\n \"night\": {\n \"sky\": [\n 1.467,\n 0.898,\n 0.636\n ],\n \"ground\": [\n 1.467,\n 0.898,\n 0.636\n ]\n }\n },\n \"exposure\": {\n \"day\": 1.741,\n \"golden\": 1.741,\n \"overcast\": 1.866,\n \"night\": 2.144\n },\n \"hdri\": {\n \"day\": {\n \"name\": \"grasslands_sunset\",\n \"rotationDeg\": 299.3,\n \"groundHeight\": 1.6\n },\n \"golden\": {\n \"name\": \"qwantani_sunset\",\n \"rotationDeg\": 299,\n \"groundHeight\": 1.6\n },\n \"overcast\": {\n \"name\": \"dalkey_view\",\n \"rotationDeg\": 0,\n \"groundHeight\": 1.6\n },\n \"night\": {\n \"name\": \"moonless_golf\",\n \"rotationDeg\": 0,\n \"groundHeight\": 1.6\n }\n },\n \"skyIrradiance\": {\n \"day\": 8.707,\n \"golden\": 8.707,\n \"overcast\": 3.286,\n \"night\": 0.011\n }\n },\n \"dining_golden\": {\n \"label\": \"Golden Hour Dining\",\n \"description\": \"Painted brick and dark planks, low sun through rippled cast glass, a walnut table set for four off to one side and a bird of paradise holding the light.\",\n \"build\": \"8def5bc58527\",\n \"presetsVersion\": 1,\n \"size\": {\n \"width\": 7,\n \"height\": 3.3,\n \"depth\": 5.2\n },\n \"lighting\": \"golden\",\n \"surfaces\": {\n \"floor\": {\n \"material\": \"oak_veneer_05\",\n \"color\": \"#ffffff\"\n },\n \"walls\": {\n \"material\": \"matte_paint\",\n \"color\": \"#efe6d9\"\n },\n \"ceiling\": {\n \"material\": \"matte_paint\",\n \"color\": \"#f5f4f0\"\n },\n \"sill\": {\n \"material\": \"polished_concrete\"\n }\n },\n \"stand\": {\n \"type\": \"round_wooden_table_01\",\n \"material\": null,\n \"x\": 0.69,\n \"z\": -0.38,\n \"rotationDeg\": 0,\n \"top\": 1.005,\n \"size\": {\n \"x\": 1.3993,\n \"y\": 1.005,\n \"z\": 1.3993\n }\n },\n \"camera\": {\n \"position\": [\n 0.9851,\n 1.21,\n -0.0142\n ],\n \"target\": [\n 0.69,\n 1.255,\n -0.38\n ],\n \"lensMm\": 24,\n \"fstop\": 4\n },\n \"preview\": {\n \"glb\": \"rooms/dining_golden/room.glb\",\n \"bytes\": 996512,\n \"triangles\": 28327,\n \"textures\": 24\n },\n \"complexity\": {\n \"enclosure\": 1,\n \"objects\": 53\n },\n \"prebaked\": [],\n \"plants\": [\n \"potted_bird_of_paradise_01\",\n \"potted_plant_04\"\n ],\n \"pictures\": [],\n \"previewBrightness\": {\n \"day\": 0.31,\n \"golden\": 0.31,\n \"overcast\": 0.289,\n \"night\": 0.28\n },\n \"previewFill\": {\n \"day\": {\n \"sky\": [\n 1.331,\n 0.939,\n 0.631\n ],\n \"ground\": [\n 1.331,\n 0.939,\n 0.631\n ]\n },\n \"golden\": {\n \"sky\": [\n 1.338,\n 0.937,\n 0.63\n ],\n \"ground\": [\n 1.338,\n 0.937,\n 0.63\n ]\n },\n \"overcast\": {\n \"sky\": [\n 1.297,\n 0.934,\n 0.775\n ],\n \"ground\": [\n 1.297,\n 0.934,\n 0.775\n ]\n },\n \"night\": {\n \"sky\": [\n 1.466,\n 0.899,\n 0.627\n ],\n \"ground\": [\n 1.466,\n 0.899,\n 0.627\n ]\n }\n },\n \"exposure\": {\n \"day\": 1.741,\n \"golden\": 1.741,\n \"overcast\": 1.866,\n \"night\": 2.144\n },\n \"hdri\": {\n \"day\": {\n \"name\": \"pergola_walkway\",\n \"rotationDeg\": 59.7,\n \"groundHeight\": 1.6\n },\n \"golden\": {\n \"name\": \"bambanani_sunset\",\n \"rotationDeg\": 104,\n \"groundHeight\": 1.6\n },\n \"overcast\": {\n \"name\": \"dalkey_view\",\n \"rotationDeg\": 0,\n \"groundHeight\": 1.6\n },\n \"night\": {\n \"name\": \"moonless_golf\",\n \"rotationDeg\": 0,\n \"groundHeight\": 1.6\n }\n },\n \"skyIrradiance\": {\n \"day\": 5.273,\n \"golden\": 5.273,\n \"overcast\": 3.286,\n \"night\": 0.011\n }\n },\n \"gallery_day\": {\n \"label\": \"Daylight Gallery\",\n \"description\": \"White plaster and oak, three tall west windows with foliage-dappled midday sun, shelves of ceramics behind the centerpiece.\",\n \"build\": \"833d6eaec67f\",\n \"presetsVersion\": 1,\n \"size\": {\n \"width\": 6,\n \"height\": 3.2,\n \"depth\": 5\n },\n \"lighting\": \"day\",\n \"surfaces\": {\n \"floor\": {\n \"material\": \"oak_floor\",\n \"color\": \"#ffffff\"\n },\n \"walls\": {\n \"material\": \"white_plaster\",\n \"color\": \"#f4f1ea\"\n },\n \"ceiling\": {\n \"material\": \"matte_paint\",\n \"color\": \"#f5f4f0\"\n },\n \"sill\": {\n \"material\": \"travertine\"\n }\n },\n \"stand\": {\n \"type\": \"pedestal_block\",\n \"material\": \"carrara_marble\",\n \"x\": 0.18,\n \"z\": -0.36,\n \"rotationDeg\": 0,\n \"top\": 1,\n \"size\": {\n \"x\": 0.4,\n \"y\": 1,\n \"z\": 0.4\n }\n },\n \"camera\": {\n \"position\": [\n 0.3653,\n 1.17,\n -0.0055\n ],\n \"target\": [\n 0.18,\n 1.25,\n -0.36\n ],\n \"lensMm\": 34,\n \"fstop\": 4\n },\n \"preview\": {\n \"glb\": \"rooms/gallery_day/room.glb\",\n \"bytes\": 2100876,\n \"triangles\": 118960,\n \"textures\": 21\n },\n \"complexity\": {\n \"enclosure\": 1,\n \"objects\": 67\n },\n \"prebaked\": [],\n \"plants\": [\n \"potted_plant_01\",\n \"potted_plant_04\"\n ],\n \"pictures\": [],\n \"previewBrightness\": {\n \"day\": 0.093,\n \"golden\": 0.098,\n \"overcast\": 0.043,\n \"night\": 0.093\n },\n \"previewFill\": {\n \"day\": {\n \"sky\": [\n 1.101,\n 0.978,\n 0.915\n ],\n \"ground\": [\n 1.101,\n 0.978,\n 0.915\n ]\n },\n \"golden\": {\n \"sky\": [\n 1.1,\n 0.979,\n 0.914\n ],\n \"ground\": [\n 1.1,\n 0.979,\n 0.914\n ]\n },\n \"overcast\": {\n \"sky\": [\n 1.266,\n 0.942,\n 0.791\n ],\n \"ground\": [\n 1.266,\n 0.942,\n 0.791\n ]\n },\n \"night\": {\n \"sky\": [\n 1.42,\n 0.91,\n 0.651\n ],\n \"ground\": [\n 1.42,\n 0.91,\n 0.651\n ]\n }\n },\n \"exposure\": {\n \"day\": 1.741,\n \"golden\": 1.741,\n \"overcast\": 1.866,\n \"night\": 2.144\n },\n \"hdri\": {\n \"day\": {\n \"name\": \"sunny_country_road\",\n \"rotationDeg\": 127,\n \"groundHeight\": 1.6\n },\n \"golden\": {\n \"name\": \"qwantani_sunset\",\n \"rotationDeg\": 127,\n \"groundHeight\": 1.6\n },\n \"overcast\": {\n \"name\": \"dalkey_view\",\n \"rotationDeg\": 0,\n \"groundHeight\": 1.6\n },\n \"night\": {\n \"name\": \"moonless_golf\",\n \"rotationDeg\": 0,\n \"groundHeight\": 1.6\n }\n },\n \"skyIrradiance\": {\n \"day\": 8.212,\n \"golden\": 8.212,\n \"overcast\": 3.286,\n \"night\": 0.011\n }\n },\n \"living_evening\": {\n \"label\": \"Evening Living Room\",\n \"description\": \"Warm greige and hardwood after dark: a channel-tufted sofa under a washed wall, a plaster console opposite, monstera and palm in the corners.\",\n \"build\": \"14a4e4f17110\",\n \"presetsVersion\": 1,\n \"size\": {\n \"width\": 6.4,\n \"height\": 3,\n \"depth\": 5.4\n },\n \"lighting\": \"night\",\n \"surfaces\": {\n \"floor\": {\n \"material\": \"wooden_floor_02\",\n \"color\": \"#ffffff\"\n },\n \"walls\": {\n \"material\": \"matte_paint\",\n \"color\": \"#e5ded2\"\n },\n \"ceiling\": {\n \"material\": \"matte_paint\",\n \"color\": \"#f5f4f0\"\n },\n \"sill\": {\n \"material\": \"travertine\"\n }\n },\n \"stand\": {\n \"type\": \"pedestal_cylinder\",\n \"material\": \"carrara_marble\",\n \"x\": 0.75,\n \"z\": -0.15,\n \"rotationDeg\": 0,\n \"top\": 0.95,\n \"size\": {\n \"x\": 0.42,\n \"y\": 0.95,\n \"z\": 0.42\n }\n },\n \"camera\": {\n \"position\": [\n 1.8407,\n 0.78,\n 1.0613\n ],\n \"target\": [\n 0.75,\n 1.2,\n -0.15\n ],\n \"lensMm\": 32,\n \"fstop\": 3.200000047683716\n },\n \"preview\": {\n \"glb\": \"rooms/living_evening/room.glb\",\n \"bytes\": 4354704,\n \"triangles\": 236876,\n \"textures\": 21\n },\n \"complexity\": {\n \"enclosure\": 1,\n \"objects\": 95\n },\n \"prebaked\": [],\n \"plants\": [\n \"potted_monstera_02\",\n \"potted_palm_01\"\n ],\n \"pictures\": [\n {\n \"wall\": \"north\",\n \"size\": 0.7\n }\n ],\n \"previewBrightness\": {\n \"day\": 0.114,\n \"golden\": 0.114,\n \"overcast\": 0.106,\n \"night\": 0.103\n },\n \"previewFill\": {\n \"day\": {\n \"sky\": [\n 1.177,\n 0.96,\n 0.871\n ],\n \"ground\": [\n 1.177,\n 0.96,\n 0.871\n ]\n },\n \"golden\": {\n \"sky\": [\n 1.352,\n 0.932,\n 0.631\n ],\n \"ground\": [\n 1.352,\n 0.932,\n 0.631\n ]\n },\n \"overcast\": {\n \"sky\": [\n 1.404,\n 0.911,\n 0.688\n ],\n \"ground\": [\n 1.404,\n 0.911,\n 0.688\n ]\n },\n \"night\": {\n \"sky\": [\n 1.488,\n 0.894,\n 0.615\n ],\n \"ground\": [\n 1.488,\n 0.894,\n 0.615\n ]\n }\n },\n \"exposure\": {\n \"day\": 1.741,\n \"golden\": 1.741,\n \"overcast\": 1.866,\n \"night\": 2.144\n },\n \"hdri\": {\n \"day\": {\n \"name\": \"pergola_walkway\",\n \"rotationDeg\": 79.7,\n \"groundHeight\": 1.6\n },\n \"golden\": {\n \"name\": \"qwantani_sunset\",\n \"rotationDeg\": 136,\n \"groundHeight\": 1.6\n },\n \"overcast\": {\n \"name\": \"dalkey_view\",\n \"rotationDeg\": 0,\n \"groundHeight\": 1.6\n },\n \"night\": {\n \"name\": \"moonless_golf\",\n \"rotationDeg\": 0,\n \"groundHeight\": 1.6\n }\n },\n \"skyIrradiance\": {\n \"day\": 8.595,\n \"golden\": 5.273,\n \"overcast\": 3.286,\n \"night\": 0.011\n }\n },\n \"loft_golden\": {\n \"label\": \"Golden Hour Loft\",\n \"description\": \"Painted brick and dark planks, two big steel-framed windows of rippled cast glass, low warm sun and a hint of haze.\",\n \"build\": \"4a50da011646\",\n \"presetsVersion\": 1,\n \"size\": {\n \"width\": 7,\n \"height\": 3.6,\n \"depth\": 5.5\n },\n \"lighting\": \"golden\",\n \"surfaces\": {\n \"floor\": {\n \"material\": \"plank_flooring_04\",\n \"color\": \"#ffffff\"\n },\n \"walls\": {\n \"material\": \"white_plaster\",\n \"color\": \"#f0e7da\"\n },\n \"ceiling\": {\n \"material\": \"matte_paint\",\n \"color\": \"#f5f4f0\"\n },\n \"sill\": {\n \"material\": \"polished_concrete\"\n }\n },\n \"stand\": {\n \"type\": \"pedestal_cylinder\",\n \"material\": \"carrara_marble\",\n \"x\": 0.1,\n \"z\": -0.3,\n \"rotationDeg\": 0,\n \"top\": 0.95,\n \"size\": {\n \"x\": 0.42,\n \"y\": 0.95,\n \"z\": 0.42\n }\n },\n \"camera\": {\n \"position\": [\n 0.7923,\n 1.3,\n 0.6924\n ],\n \"target\": [\n 0.1,\n 1.2,\n -0.3\n ],\n \"lensMm\": 35,\n \"fstop\": 2\n },\n \"preview\": {\n \"glb\": \"rooms/loft_golden/room.glb\",\n \"bytes\": 3545780,\n \"triangles\": 164621,\n \"textures\": 23\n },\n \"complexity\": {\n \"enclosure\": 1,\n \"objects\": 53\n },\n \"prebaked\": [],\n \"plants\": [\n \"potted_monstera_01\",\n \"potted_palm_01\"\n ],\n \"pictures\": [],\n \"previewBrightness\": {\n \"day\": 1.034,\n \"golden\": 1.034,\n \"overcast\": 0.965,\n \"night\": 0.933\n },\n \"previewFill\": {\n \"day\": {\n \"sky\": [\n 1.239,\n 0.956,\n 0.735\n ],\n \"ground\": [\n 1.239,\n 0.956,\n 0.735\n ]\n },\n \"golden\": {\n \"sky\": [\n 1.414,\n 0.896,\n 0.816\n ],\n \"ground\": [\n 1.414,\n 0.896,\n 0.816\n ]\n },\n \"overcast\": {\n \"sky\": [\n 0.953,\n 1.019,\n 0.947\n ],\n \"ground\": [\n 0.953,\n 1.019,\n 0.947\n ]\n },\n \"night\": {\n \"sky\": [\n 1.41,\n 0.915,\n 0.639\n ],\n \"ground\": [\n 1.41,\n 0.915,\n 0.639\n ]\n }\n },\n \"exposure\": {\n \"day\": 1.741,\n \"golden\": 1.741,\n \"overcast\": 1.866,\n \"night\": 2.144\n },\n \"hdri\": {\n \"day\": {\n \"name\": \"pergola_walkway\",\n \"rotationDeg\": 63.7,\n \"groundHeight\": 1.6\n },\n \"golden\": {\n \"name\": \"the_sky_is_on_fire\",\n \"rotationDeg\": 45.4,\n \"groundHeight\": 1.6\n },\n \"overcast\": {\n \"name\": \"dalkey_view\",\n \"rotationDeg\": 0,\n \"groundHeight\": 1.6\n },\n \"night\": {\n \"name\": \"moonless_golf\",\n \"rotationDeg\": 0,\n \"groundHeight\": 1.6\n }\n },\n \"skyIrradiance\": {\n \"day\": 5.273,\n \"golden\": 5.273,\n \"overcast\": 3.286,\n \"night\": 0.011\n }\n },\n \"noir_parlour\": {\n \"label\": \"Noir Parlour\",\n \"description\": \"Charcoal walls in frame mouldings above a dado rail, a pale skirting, grey oak boards, two leather lounge chairs under a pair of white pendants and a print between them.\",\n \"build\": \"c444e081de93\",\n \"presetsVersion\": 1,\n \"size\": {\n \"width\": 7.6,\n \"height\": 3.4,\n \"depth\": 6.2\n },\n \"lighting\": \"golden\",\n \"surfaces\": {\n \"floor\": {\n \"material\": \"wooden_floor_02\",\n \"color\": \"#7d7872\"\n },\n \"walls\": {\n \"material\": \"matte_paint\",\n \"color\": \"#2b2b2f\"\n },\n \"ceiling\": {\n \"material\": \"matte_paint\",\n \"color\": \"#3b3b40\"\n },\n \"sill\": {\n \"material\": \"polished_concrete\"\n }\n },\n \"stand\": {\n \"type\": \"oval_side_table\",\n \"material\": null,\n \"x\": 0,\n \"z\": -1.9,\n \"rotationDeg\": 0,\n \"top\": 0.6048,\n \"size\": {\n \"x\": 0.562,\n \"y\": 0.605,\n \"z\": 0.34\n }\n },\n \"camera\": {\n \"position\": [\n 0,\n 1.15,\n 2.5\n ],\n \"target\": [\n 0,\n 0.8548,\n -1.9\n ],\n \"lensMm\": 28,\n \"fstop\": 4\n },\n \"preview\": {\n \"glb\": \"rooms/noir_parlour/room.glb\",\n \"bytes\": 1399740,\n \"triangles\": 55172,\n \"textures\": 20\n },\n \"complexity\": {\n \"enclosure\": 1,\n \"objects\": 55\n },\n \"prebaked\": [],\n \"plants\": [\n \"potted_dracaena_01\"\n ],\n \"pictures\": [\n {\n \"wall\": \"north\",\n \"size\": 1.25\n }\n ],\n \"previewBrightness\": {\n \"day\": 0.362,\n \"golden\": 0.367,\n \"overcast\": 0.111,\n \"night\": 0.168\n },\n \"previewFill\": {\n \"day\": {\n \"sky\": [\n 1.021,\n 0.994,\n 0.999\n ],\n \"ground\": [\n 1.101,\n 0.982,\n 0.884\n ]\n },\n \"golden\": {\n \"sky\": [\n 1.22,\n 0.963,\n 0.723\n ],\n \"ground\": [\n 1.308,\n 0.945,\n 0.636\n ]\n },\n \"overcast\": {\n \"sky\": [\n 1.083,\n 0.979,\n 0.964\n ],\n \"ground\": [\n 1.167,\n 0.965,\n 0.852\n ]\n },\n \"night\": {\n \"sky\": [\n 1.486,\n 0.894,\n 0.618\n ],\n \"ground\": [\n 1.584,\n 0.873,\n 0.54\n ]\n }\n },\n \"exposure\": {\n \"day\": 1.741,\n \"golden\": 1.741,\n \"overcast\": 1.866,\n \"night\": 2.144\n },\n \"hdri\": {\n \"day\": {\n \"name\": \"horn-koppe_spring\",\n \"rotationDeg\": 114,\n \"groundHeight\": 1.6\n },\n \"golden\": {\n \"name\": \"bambanani_sunset\",\n \"rotationDeg\": 136,\n \"groundHeight\": 1.6\n },\n \"overcast\": {\n \"name\": \"dalkey_view\",\n \"rotationDeg\": 0,\n \"groundHeight\": 1.6\n },\n \"night\": {\n \"name\": \"satara_night\",\n \"rotationDeg\": 0,\n \"groundHeight\": 1.6\n }\n },\n \"skyIrradiance\": {\n \"day\": 8.34,\n \"golden\": 5.529,\n \"overcast\": 3.286,\n \"night\": 0.011\n }\n },\n \"plaster_atelier\": {\n \"label\": \"Plaster Atelier\",\n \"description\": \"Raw plaster, a concrete floor and one tall opening on the west side that lays a slab of sun across the room. A low white sofa against a travertine wall, a dome pendant, a palm in the corner.\",\n \"build\": \"6ee46115fa42\",\n \"presetsVersion\": 1,\n \"size\": {\n \"width\": 10,\n \"height\": 3.8,\n \"depth\": 7.6\n },\n \"lighting\": \"day\",\n \"surfaces\": {\n \"floor\": {\n \"material\": \"polished_concrete\",\n \"color\": \"#e2e0dc\"\n },\n \"walls\": {\n \"material\": \"white_plaster\",\n \"color\": \"#dcd7ce\"\n },\n \"ceiling\": {\n \"material\": \"white_plaster\",\n \"color\": \"#f1efea\"\n },\n \"sill\": {\n \"material\": \"polished_concrete\"\n }\n },\n \"stand\": {\n \"type\": \"pedestal_cylinder\",\n \"material\": \"travertine\",\n \"x\": -1.7,\n \"z\": -1,\n \"rotationDeg\": 0,\n \"top\": 0.95,\n \"size\": {\n \"x\": 0.42,\n \"y\": 0.95,\n \"z\": 0.42\n }\n },\n \"camera\": {\n \"position\": [\n -2.6356,\n 1.2,\n 3.4017\n ],\n \"target\": [\n -1.7,\n 1.2,\n -1\n ],\n \"lensMm\": 24,\n \"fstop\": 5.599999904632568\n },\n \"preview\": {\n \"glb\": \"rooms/plaster_atelier/room.glb\",\n \"bytes\": 3991680,\n \"triangles\": 187489,\n \"textures\": 30\n },\n \"complexity\": {\n \"enclosure\": 1,\n \"objects\": 37\n },\n \"prebaked\": [],\n \"plants\": [\n \"potted_palm_01\",\n \"potted_plant_01\"\n ],\n \"pictures\": [],\n \"previewBrightness\": {\n \"day\": 1.478,\n \"golden\": 1.742,\n \"overcast\": 0.314,\n \"night\": 0.182\n },\n \"previewFill\": {\n \"day\": {\n \"sky\": [\n 0.975,\n 1.002,\n 1.058\n ],\n \"ground\": [\n 0.993,\n 1.001,\n 1.015\n ]\n },\n \"golden\": {\n \"sky\": [\n 1.223,\n 0.964,\n 0.704\n ],\n \"ground\": [\n 1.244,\n 0.961,\n 0.674\n ]\n },\n \"overcast\": {\n \"sky\": [\n 0.964,\n 1.004,\n 1.071\n ],\n \"ground\": [\n 0.982,\n 1.003,\n 1.027\n ]\n },\n \"night\": {\n \"sky\": [\n 1.427,\n 0.909,\n 0.647\n ],\n \"ground\": [\n 1.449,\n 0.905,\n 0.618\n ]\n }\n },\n \"exposure\": {\n \"day\": 1.741,\n \"golden\": 1.741,\n \"overcast\": 1.866,\n \"night\": 2.144\n },\n \"hdri\": {\n \"day\": {\n \"name\": \"sunny_country_road\",\n \"rotationDeg\": 122,\n \"groundHeight\": 1.6\n },\n \"golden\": {\n \"name\": \"venice_sunset\",\n \"rotationDeg\": 136,\n \"groundHeight\": 1.6\n },\n \"overcast\": {\n \"name\": \"dalkey_view\",\n \"rotationDeg\": 0,\n \"groundHeight\": 1.6\n },\n \"night\": {\n \"name\": \"preller_drive\",\n \"rotationDeg\": 0,\n \"groundHeight\": 1.6\n }\n },\n \"skyIrradiance\": {\n \"day\": 8.633,\n \"golden\": 5.273,\n \"overcast\": 3.286,\n \"night\": 0.011\n }\n },\n \"slat_lounge\": {\n \"label\": \"Oak Slat Lounge\",\n \"description\": \"Oak battens either side of a charcoal wall, a low sofa under a large print, and tall windows behind sheers on the east side.\",\n \"build\": \"d4b3a554137d\",\n \"presetsVersion\": 1,\n \"size\": {\n \"width\": 8.4,\n \"height\": 3,\n \"depth\": 6.4\n },\n \"lighting\": \"day\",\n \"surfaces\": {\n \"floor\": {\n \"material\": \"wooden_floor_02\",\n \"color\": \"#e6e2dc\"\n },\n \"walls\": {\n \"material\": \"matte_paint\",\n \"color\": \"#e9e6e0\"\n },\n \"ceiling\": {\n \"material\": \"matte_paint\",\n \"color\": \"#f5f4f0\"\n },\n \"sill\": {\n \"material\": \"polished_concrete\"\n }\n },\n \"stand\": {\n \"type\": \"coffee_table_round_01\",\n \"material\": null,\n \"x\": -0.7,\n \"z\": -0.7,\n \"rotationDeg\": 0,\n \"top\": 0.491,\n \"size\": {\n \"x\": 1.3013,\n \"y\": 0.491,\n \"z\": 1.3013\n }\n },\n \"camera\": {\n \"position\": [\n -2.75,\n 1.2,\n 2.8507\n ],\n \"target\": [\n -0.7,\n 0.741,\n -0.7\n ],\n \"lensMm\": 24,\n \"fstop\": 5.599999904632568\n },\n \"preview\": {\n \"glb\": \"rooms/slat_lounge/room.glb\",\n \"bytes\": 2042948,\n \"triangles\": 122153,\n \"textures\": 30\n },\n \"complexity\": {\n \"enclosure\": 1,\n \"objects\": 77\n },\n \"prebaked\": [],\n \"plants\": [\n \"potted_bird_of_paradise_01\",\n \"potted_monstera_02\"\n ],\n \"pictures\": [\n {\n \"wall\": \"north\",\n \"size\": 1.25\n }\n ],\n \"previewBrightness\": {\n \"day\": 0.346,\n \"golden\": 0.383,\n \"overcast\": 0.121,\n \"night\": 0.191\n },\n \"previewFill\": {\n \"day\": {\n \"sky\": [\n 1.05,\n 0.987,\n 0.978\n ],\n \"ground\": [\n 1.088,\n 0.982,\n 0.915\n ]\n },\n \"golden\": {\n \"sky\": [\n 1.273,\n 0.952,\n 0.672\n ],\n \"ground\": [\n 1.314,\n 0.944,\n 0.628\n ]\n },\n \"overcast\": {\n \"sky\": [\n 1.213,\n 0.952,\n 0.844\n ],\n \"ground\": [\n 1.254,\n 0.946,\n 0.789\n ]\n },\n \"night\": {\n \"sky\": [\n 1.46,\n 0.901,\n 0.63\n ],\n \"ground\": [\n 1.504,\n 0.892,\n 0.587\n ]\n }\n },\n \"exposure\": {\n \"day\": 1.741,\n \"golden\": 1.741,\n \"overcast\": 1.866,\n \"night\": 2.144\n },\n \"hdri\": {\n \"day\": {\n \"name\": \"pergola_walkway\",\n \"rotationDeg\": 317.7,\n \"groundHeight\": 1.6\n },\n \"golden\": {\n \"name\": \"qwantani_sunset\",\n \"rotationDeg\": 332,\n \"groundHeight\": 1.6\n },\n \"overcast\": {\n \"name\": \"dalkey_view\",\n \"rotationDeg\": 0,\n \"groundHeight\": 1.6\n },\n \"night\": {\n \"name\": \"moonless_golf\",\n \"rotationDeg\": 0,\n \"groundHeight\": 1.6\n }\n },\n \"skyIrradiance\": {\n \"day\": 8.468,\n \"golden\": 5.273,\n \"overcast\": 3.286,\n \"night\": 0.011\n }\n },\n \"studio_night\": {\n \"label\": \"Night Studio\",\n \"description\": \"Warm greige walls after dark: IES downlights, a lit cove channel round the ceiling and one accent spot carrying the centerpiece.\",\n \"build\": \"029ba7cafdae\",\n \"presetsVersion\": 1,\n \"size\": {\n \"width\": 5,\n \"height\": 3,\n \"depth\": 4.4\n },\n \"lighting\": \"night\",\n \"surfaces\": {\n \"floor\": {\n \"material\": \"polished_concrete\",\n \"color\": \"#ffffff\"\n },\n \"walls\": {\n \"material\": \"matte_paint\",\n \"color\": \"#e6dfd3\"\n },\n \"ceiling\": {\n \"material\": \"matte_paint\",\n \"color\": \"#f5f4f0\"\n },\n \"sill\": {\n \"material\": \"carrara_marble\"\n }\n },\n \"stand\": {\n \"type\": null,\n \"material\": null,\n \"x\": 0,\n \"z\": 0,\n \"rotationDeg\": 0,\n \"top\": 0,\n \"size\": null\n },\n \"camera\": {\n \"position\": [\n -1.5455,\n 0.83,\n 1.2695\n ],\n \"target\": [\n 0,\n 0.25,\n 0\n ],\n \"lensMm\": 38,\n \"fstop\": 2\n },\n \"preview\": {\n \"glb\": \"rooms/studio_night/room.glb\",\n \"bytes\": 4232484,\n \"triangles\": 183407,\n \"textures\": 21\n },\n \"complexity\": {\n \"enclosure\": 1,\n \"objects\": 57\n },\n \"prebaked\": [],\n \"plants\": [\n \"potted_palm_01\",\n \"potted_plant_04\"\n ],\n \"pictures\": [],\n \"previewBrightness\": {\n \"day\": 0.517,\n \"golden\": 0.517,\n \"overcast\": 0.482,\n \"night\": 0.466\n },\n \"previewFill\": {\n \"day\": {\n \"sky\": [\n 1.318,\n 0.927,\n 0.781\n ],\n \"ground\": [\n 1.318,\n 0.927,\n 0.781\n ]\n },\n \"golden\": {\n \"sky\": [\n 1.374,\n 0.92,\n 0.69\n ],\n \"ground\": [\n 1.374,\n 0.92,\n 0.69\n ]\n },\n \"overcast\": {\n \"sky\": [\n 1.439,\n 0.904,\n 0.657\n ],\n \"ground\": [\n 1.439,\n 0.904,\n 0.657\n ]\n },\n \"night\": {\n \"sky\": [\n 1.486,\n 0.894,\n 0.616\n ],\n \"ground\": [\n 1.486,\n 0.894,\n 0.616\n ]\n }\n },\n \"exposure\": {\n \"day\": 1.741,\n \"golden\": 1.741,\n \"overcast\": 1.866,\n \"night\": 2.144\n },\n \"hdri\": {\n \"day\": {\n \"name\": \"pergola_walkway\",\n \"rotationDeg\": 79.7,\n \"groundHeight\": 1.6\n },\n \"golden\": {\n \"name\": \"qwantani_sunset\",\n \"rotationDeg\": 136,\n \"groundHeight\": 1.6\n },\n \"overcast\": {\n \"name\": \"dalkey_view\",\n \"rotationDeg\": 0,\n \"groundHeight\": 1.6\n },\n \"night\": {\n \"name\": \"satara_night\",\n \"rotationDeg\": 0,\n \"groundHeight\": 1.6\n }\n },\n \"skyIrradiance\": {\n \"day\": 8.595,\n \"golden\": 5.273,\n \"overcast\": 3.286,\n \"night\": 0.011\n }\n },\n \"walnut_salon\": {\n \"label\": \"Walnut Salon\",\n \"description\": \"A long wall of walnut veneer and slatted bays under a lit cove, a pale modular sofa in front of it, three disc pendants at different heights and a charcoal wall with a print on the east side.\",\n \"build\": \"ce8b1acc2907\",\n \"presetsVersion\": 1,\n \"size\": {\n \"width\": 10,\n \"height\": 3.2,\n \"depth\": 7\n },\n \"lighting\": \"night\",\n \"surfaces\": {\n \"floor\": {\n \"material\": \"polished_concrete\",\n \"color\": \"#cfccc6\"\n },\n \"walls\": {\n \"material\": \"matte_paint\",\n \"color\": \"#ddd7cd\"\n },\n \"ceiling\": {\n \"material\": \"matte_paint\",\n \"color\": \"#e4e1db\"\n },\n \"sill\": {\n \"material\": \"polished_concrete\"\n }\n },\n \"stand\": {\n \"type\": \"coffee_table_round_01\",\n \"material\": null,\n \"x\": 0.2,\n \"z\": -1.2,\n \"rotationDeg\": 0,\n \"top\": 0.491,\n \"size\": {\n \"x\": 1.3013,\n \"y\": 0.491,\n \"z\": 1.3013\n }\n },\n \"camera\": {\n \"position\": [\n 0.2,\n 1.45,\n 3.2\n ],\n \"target\": [\n 0.2,\n 0.741,\n -1.2\n ],\n \"lensMm\": 24,\n \"fstop\": 5.599999904632568\n },\n \"preview\": {\n \"glb\": \"rooms/walnut_salon/room.glb\",\n \"bytes\": 1958456,\n \"triangles\": 121487,\n \"textures\": 36\n },\n \"complexity\": {\n \"enclosure\": 1,\n \"objects\": 117\n },\n \"prebaked\": [],\n \"plants\": [\n \"potted_bird_of_paradise_01\",\n \"potted_monstera_02\"\n ],\n \"pictures\": [\n {\n \"wall\": \"east\",\n \"size\": 1.3\n }\n ],\n \"previewBrightness\": {\n \"day\": 0.295,\n \"golden\": 0.295,\n \"overcast\": 0.13,\n \"night\": 0.313\n },\n \"previewFill\": {\n \"day\": {\n \"sky\": [\n 1.112,\n 0.975,\n 0.922\n ],\n \"ground\": [\n 1.145,\n 0.971,\n 0.859\n ]\n },\n \"golden\": {\n \"sky\": [\n 1.301,\n 0.944,\n 0.67\n ],\n \"ground\": [\n 1.336,\n 0.938,\n 0.623\n ]\n },\n \"overcast\": {\n \"sky\": [\n 1.35,\n 0.925,\n 0.716\n ],\n \"ground\": [\n 1.386,\n 0.919,\n 0.665\n ]\n },\n \"night\": {\n \"sky\": [\n 1.427,\n 0.909,\n 0.645\n ],\n \"ground\": [\n 1.464,\n 0.902,\n 0.599\n ]\n }\n },\n \"exposure\": {\n \"day\": 1.741,\n \"golden\": 1.741,\n \"overcast\": 1.866,\n \"night\": 2.144\n },\n \"hdri\": {\n \"day\": {\n \"name\": \"pergola_walkway\",\n \"rotationDeg\": 59.7,\n \"groundHeight\": 1.6\n },\n \"golden\": {\n \"name\": \"qwantani_sunset\",\n \"rotationDeg\": 132,\n \"groundHeight\": 1.6\n },\n \"overcast\": {\n \"name\": \"dalkey_view\",\n \"rotationDeg\": 0,\n \"groundHeight\": 1.6\n },\n \"night\": {\n \"name\": \"moonless_golf\",\n \"rotationDeg\": 0,\n \"groundHeight\": 1.6\n }\n },\n \"skyIrradiance\": {\n \"day\": 8.468,\n \"golden\": 5.273,\n \"overcast\": 3.286,\n \"night\": 0.011\n }\n }\n} as const;\n\nexport type RoomPresetName = keyof typeof ROOM_PRESETS;\n","/**\n * A catalog from a server: models by URL, shots per product, no browser.\n *\n * import { Bakery3Server } from '@oeave/bakery3/node';\n * const api = new Bakery3Server(process.env.BAKERY3_SECRET_KEY!);\n *\n * const run = await api.renderBatch({\n * key: 'fall-2026',\n * products: [{ id: 'chair-aria', url: 'https://cdn.shop.com/models/chair-aria.glb' }],\n * shots: [\n * 'three-quarter',\n * { kind: 'video', from: 'three-quarter', to: 'three-quarter-back', seconds: 4 },\n * { id: 'low', azimuthDeg: -30, elevationDeg: 4 },\n * ],\n * room: { preset: 'loft_golden' },\n * maxCost: 600,\n * });\n *\n * A shot is a picture or a clip of a product from an angle: degrees around\n * the model from its front and degrees above the horizon, or a word for one.\n * The camera is framed from the model's own bounds, read when the model is\n * imported, so a vase and a sofa both fill the frame from the same word and\n * nothing is asked of the file itself. A clip is the camera carried from one\n * angle to another over `seconds`, one framed camera per frame.\n *\n * Settings come in three layers: the run's, then a product's, then a shot's,\n * the nearer winning. So one `room` at the top is every shot's room, a\n * product that wants the studio instead says `room: null, environment: {…}`,\n * and one shot in it can still be a close-up at 2048² in a jpeg.\n *\n * The model's bytes never pass through this process. Each URL is handed to\n * `POST /v1/assets/import`; the service fetches it once, stores it content\n * addressed like any upload, and answers with the hash and what the GLB says\n * about itself. A model that did not change since the last run is not\n * downloaded again. What this process sends is a few KB of manifest per shot.\n *\n * A manifest built here describes a model, cameras and light. A scene whose\n * look lives in code exists only where that code runs, so it is recorded\n * there, with `renderVariants()` in the page. Both kinds of item can share a\n * batch.\n *\n * No three.js here.\n */\n\nimport {\n protocolVersionFor,\n type AnimationSpec,\n type AssetImportKind,\n type AssetImportResponse,\n type BatchItemOutcome,\n type BatchItemRequest,\n type CameraSpec,\n type ColorSpec,\n type EnvironmentSpec,\n type GlbFacts,\n type Matrix4,\n type OutputSpec,\n type QualityPreset,\n type RenderSpec,\n type RoomPresetSpec,\n type SceneManifest,\n type Vec3,\n} from '../protocol/index.js';\nimport { QUALITY, isClipFormat, isVideoFormat } from '../protocol/index.js';\nimport type { Batch, BatchProgress } from '../batch.js';\nimport { Bakery3Error } from '../errors.js';\nimport {\n VIEW_WORDS,\n angleBetween,\n angleOf,\n cameraAt,\n centerOf,\n directionOf,\n framedCamera,\n framedDistance,\n radiusOf,\n type Angle,\n type Bounds,\n type ViewWord,\n} from '../frame.js';\nimport {\n HDRI_PRESETS,\n PEDESTAL_PRESETS,\n PRESETS_VERSION,\n type HdriPresetName,\n} from '../presets/catalog.gen.js';\nimport {\n ROOM_PRESETS,\n type RoomPresetLighting,\n type RoomPresetName,\n} from '../presets/rooms.gen.js';\nimport { emptyRecorded, type Recorded } from '../set.js';\nimport { SDK_VERSION } from '../version.js';\n\nconst DOCS = 'https://bakery3.com/docs/catalog';\nconst PRESET_LIBRARY = 'https://cdn.bakery3.com/presets';\nconst SKIPS_KEPT = 50;\n/**\n * After this many products, a run where most of them could not be imported\n * is a wrong base URL, not a bad model, and stops.\n */\nconst BREAKER_AFTER = 8;\nconst BREAKER_SHARE = 0.5;\n/** A clip is at most this long, and this many frames a second. */\nconst MAX_SECONDS = 30;\nconst MAX_FPS = 60;\n\n// ---------------------------------------------------------------------------\n// What the developer types\n// ---------------------------------------------------------------------------\n\n/**\n * Where to look from: a word, or degrees. `'room'` is the framing a preset\n * room was published with, from level or above: never looking up at the\n * product.\n */\nexport type View = ViewWord | 'room' | Angle;\n\nexport type BatchEnvironment = {\n /** A studio or a sky from the preset library. */\n preset?: HdriPresetName;\n /**\n * Or an HDRI of your own: a public https URL of a .hdr or .exr, imported\n * like the models.\n */\n url?: string;\n /** How strongly it lights the product. Default 1 (0.6 for the default studio). */\n intensity?: number;\n /** Turn the environment about the vertical, in degrees. */\n rotationDeg?: number;\n};\n\nexport type BatchRoom = {\n /** A room from the preset library. */\n preset: RoomPresetName;\n /** Default: the mode the room was designed under. */\n mode?: RoomPresetLighting;\n /**\n * What the product stands on. `'auto'` (the default) goes by its size: the\n * room's own pedestal for a small thing, the low plinth for a mid-sized\n * one, the floor for furniture and anything that would overhang. `'own'`\n * and `'floor'` say so yourself.\n */\n stand?: 'auto' | 'own' | 'floor';\n /**\n * Where the room's own camera sees the product from, in degrees from the\n * product's front. The room is turned about the product to make it so.\n * Default 30: a three-quarter view from the side the room is open to.\n */\n viewFromDeg?: number;\n};\n\n/**\n * What every shot can say about how it is taken. Set on the run for all of\n * them, on a product for its own, on a shot for that one; the nearest wins.\n */\nexport type ShotSettings = {\n /**\n * A preset room to stand in. `null` says no room, where a wider layer had\n * one.\n */\n room?: BatchRoom | null;\n /**\n * The light and backdrop when there is no room. Default: the\n * `studio_small_03` preset at 0.6.\n */\n environment?: BatchEnvironment;\n /**\n * `'transparent'` (the default, with a traced shadow), a `#rrggbb`, or\n * `'environment'`. A video has no alpha: `'transparent'` is `#f4f4f5` there\n * (a `png-sequence` keeps it).\n */\n background?: 'transparent' | 'environment' | `#${string}`;\n /** Default `'studio'`. */\n quality?: QualityPreset;\n /** Pixels. Default: the quality preset's long edge, square. */\n width?: number;\n height?: number;\n /**\n * `png` (the default), `jpeg` or `webp` for an image; `mp4` (the default),\n * `webm` or `png-sequence` (every frame a PNG with alpha, in one tar) for a\n * video.\n */\n format?: OutputSpec['format'];\n /** JPEG/WebP only, 1 to 100. */\n imageQuality?: number;\n /**\n * Vertical field of view in degrees. Default 30, or the room's own lens in\n * a room.\n */\n fov?: number;\n /**\n * Room around the model, as a share of its size. Default 0.12, or 0.9 in\n * a room.\n */\n margin?: number;\n /** Frames a second, for a video. Default 30, at most 60. */\n fps?: number;\n /** Renderer settings beyond the quality preset. */\n advanced?: RenderSpec['advanced'];\n /**\n * How the pictures are developed. Default: sRGB, ACES filmic, exposure 1\n * (a room's own exposure in a room).\n */\n color?: Partial<ColorSpec>;\n};\n\nexport type ImageShot = ShotSettings & {\n kind?: 'image';\n /** Default: the view's word, or `az35-el14` for degrees. Ends the item's key. */\n id?: string;\n /** Where from. Default `'three-quarter'`, or `'room'` in a room. */\n view?: View;\n /**\n * Instead of a view: a camera inside the model, by its node name, as the\n * file has it.\n */\n camera?: string;\n};\n\nexport type VideoShot = ShotSettings & {\n kind: 'video';\n /** Default `orbit-<from>-<to>`. */\n id?: string;\n /** The camera is carried from here. */\n from: View;\n /**\n * To here, azimuth as written: `{ azimuthDeg: 395 }` from 35 is a full\n * turn.\n */\n to: View;\n /** Default 4. At most 30. */\n seconds?: number;\n};\n\n/** A word or an angle is an image from that view. */\nexport type Shot = ViewWord | 'room' | Angle | ImageShot | VideoShot;\n\nexport type BatchProduct = ShotSettings & {\n /** Starts every shot's key. Stable across re-runs. */\n id: string;\n /** A public https URL of a binary glTF (.glb). */\n url: string;\n /** This product's shots, instead of the run's. */\n shots?: Shot[];\n /** Echoed on every shot of this product, its webhooks and the ledger. */\n metadata?: Record<string, unknown>;\n};\n\nexport type RenderBatchProgress = BatchProgress & {\n /** The product just recorded, or skipped. */\n product: string;\n /** Products recorded so far. */\n products: number;\n /** Shots recorded so far, clips included. */\n images: number;\n /** Products skipped so far. */\n skipped: number;\n};\n\n/** A product left out of a run, with the reason. */\nexport type ProductSkip = { id: string; url: string; error: Bakery3Error };\n\nexport type RenderBatchRecorded = Recorded & {\n /**\n * Products whose model could not be imported or read. The run went on\n * without them.\n */\n skipped: number;\n /** The first of those, with their reasons. */\n skips: ProductSkip[];\n};\n\nexport type RenderBatchOptions = ShotSettings & {\n /** Names the run. The same key re-opens it while it is unfinished. */\n key: string;\n /** A label for the console. Default: the key. */\n name?: string;\n /**\n * An array, a generator, a database cursor. Pulled as it is needed, never\n * collected.\n */\n products: Iterable<BatchProduct> | AsyncIterable<BatchProduct>;\n /**\n * Every product's shots, unless it has its own. Default: one image,\n * `'three-quarter'` (`'room'` in a room).\n */\n shots?: Shot[];\n /**\n * Appended to every key as `@version`. Bump it to trace again what already\n * rendered.\n */\n version?: string;\n /** The ceiling for the whole run, in USD. */\n maxCost: number;\n /** A ceiling per shot, in USD. A shot quoted above it is refused. */\n maxCostPerImage?: number;\n /**\n * `'batch'` (the default) never runs ahead of a person in a configurator;\n * `'normal'` is the API's ordinary lane.\n */\n lane?: 'batch' | 'normal';\n /** Fewer parallel shots than the plan allows, for a gentler budget. */\n maxParallel?: number;\n /** Imports in flight at once. Default 4, at most 16. */\n concurrency?: number;\n /** Called after each product is recorded or skipped. */\n onProgress?: (progress: RenderBatchProgress) => void;\n /**\n * Stops between products. What was recorded stays admitted; call again to\n * go on.\n */\n signal?: AbortSignal;\n};\n\n// ---------------------------------------------------------------------------\n// The recorder\n// ---------------------------------------------------------------------------\n\n/** The slice of the client a recording drives. */\nexport type BatchHost = {\n importAsset(body: {\n url: string;\n kind?: AssetImportKind;\n }): Promise<AssetImportResponse>;\n};\n\nexport type RenderBatchRecording = RenderBatchRecorded & {\n estimated: number;\n maximum: number;\n};\n\nexport type RecordBatchOptions = {\n /** Price, admit nothing. */\n dryRun?: boolean;\n /** Settings that beat every layer: what a test run forces. */\n force?: ShotSettings & { version?: string; seconds?: number };\n};\n\nexport async function recordBatch(\n host: BatchHost,\n batch: Batch,\n options: Omit<RenderBatchOptions, 'maxCost'>,\n { dryRun = false, force }: RecordBatchOptions = {},\n): Promise<RenderBatchRecording> {\n validateShots(options.shots ?? [], 'the run');\n const environments = new EnvironmentCache(host);\n\n const tally: RenderBatchRecording = {\n ...emptyRecorded(),\n skipped: 0,\n skips: [],\n estimated: 0,\n maximum: 0,\n };\n const seen = new Set<string>();\n let attempted = 0;\n\n const one = async (product: BatchProduct): Promise<void> => {\n let items: BatchItemRequest[];\n try {\n if (product.shots)\n validateShots(product.shots, `product \"${product.id}\"`);\n const imported = await host.importAsset({\n url: product.url,\n kind: 'scene',\n });\n items = await itemsOf(product, imported, options, environments, force);\n } catch (error) {\n // One model that will not import, or cannot be used as asked, is that\n // product's problem. A night's run does not stop for it; it is listed,\n // and the rest go on. Anything else is a verdict on the caller (the\n // plan, the key, a shot that is not a shot), would be the same for\n // every product, and stops the run.\n if (\n !(error instanceof Bakery3Error) ||\n (error.code !== 'ImportFailed' && error.code !== 'ImportRefused')\n )\n throw error;\n attempted++;\n tally.skipped++;\n if (tally.skips.length < SKIPS_KEPT)\n tally.skips.push({ id: product.id, url: product.url, error });\n if (\n attempted >= BREAKER_AFTER &&\n tally.skipped / attempted > BREAKER_SHARE\n )\n throw mostlyFailing(tally, attempted);\n report(product.id);\n return;\n }\n attempted++;\n\n let outcomes: BatchItemOutcome[];\n if (dryRun) {\n outcomes = await batch.quote(items);\n } else {\n for (const item of items) batch.add(item);\n outcomes = await batch.flush();\n }\n tally.variants++;\n tally.images += items.length;\n for (const outcome of outcomes) {\n if (outcome.error) {\n tally.refused++;\n if (tally.refusals.length < SKIPS_KEPT)\n tally.refusals.push({ key: outcome.key, error: outcome.error });\n } else if (outcome.adopted) tally.adopted++;\n else {\n tally.estimated += outcome.estimatedCost;\n tally.maximum += outcome.maximumCost;\n }\n }\n report(product.id);\n };\n\n const report = (product: string) =>\n options.onProgress?.({\n ...batch.progress(),\n product,\n products: tally.variants,\n images: tally.images,\n skipped: tally.skipped,\n });\n\n // A window of `concurrency` products in flight, refilled as each settles.\n // The list is pulled only as a slot frees, so a cursor over a million rows\n // holds `concurrency` of them here.\n const limit = Math.max(1, Math.min(16, Math.floor(options.concurrency ?? 4)));\n const flying = new Set<Promise<void>>();\n let failure: unknown;\n for await (const product of options.products) {\n if (failure) break;\n if (options.signal?.aborted) {\n failure = options.signal.reason ?? abortError();\n break;\n }\n validateProduct(product, seen);\n const task = one(product)\n .catch((error) => {\n failure ??= error;\n })\n .finally(() => flying.delete(task));\n flying.add(task);\n if (flying.size >= limit) await Promise.race(flying);\n }\n await Promise.all(flying);\n if (failure) throw failure;\n\n tally.estimated = Math.round(tally.estimated * 1e4) / 1e4;\n tally.maximum = Math.round(tally.maximum * 1e4) / 1e4;\n return tally;\n}\n\n// ---------------------------------------------------------------------------\n// One product's items: one per shot\n// ---------------------------------------------------------------------------\n\n/** A shot with every layer folded in. */\ntype ResolvedShot = ShotSettings & {\n id: string;\n kind: 'image' | 'video';\n view?: View;\n camera?: string;\n from?: View;\n to?: View;\n seconds?: number;\n};\n\nasync function itemsOf(\n product: BatchProduct,\n imported: AssetImportResponse,\n run: Omit<RenderBatchOptions, 'maxCost'>,\n environments: EnvironmentCache,\n force: RecordBatchOptions['force'],\n): Promise<BatchItemRequest[]> {\n const facts = imported.facts;\n if (!facts)\n throw unreadable(product, 'The import returned no facts about the model.');\n const blocking = facts.issues.find((issue) => issue.severity === 'error');\n if (blocking) throw unreadable(product, blocking.message);\n if (!facts.bounds)\n throw unreadable(\n product,\n 'The model has no geometry with bounds, so there is nowhere to point a camera.',\n );\n const bounds = facts.bounds;\n\n const runSettings = settingsOf(run);\n const productSettings = settingsOf(product);\n const shots = (product.shots ?? run.shots ?? []).map((shot) =>\n resolveShot(shot, runSettings, productSettings, force),\n );\n if (!shots.length) {\n const inRoom = layered('room', runSettings, productSettings, force) != null;\n shots.push(\n resolveShot(\n inRoom ? 'room' : 'three-quarter',\n runSettings,\n productSettings,\n force,\n ),\n );\n }\n\n const counts = { info: 0, warning: 0, error: 0 };\n for (const issue of facts.issues) counts[issue.severity]++;\n const version = force?.version ?? run.version;\n\n const items: BatchItemRequest[] = [];\n for (const shot of shots) {\n const quality = shot.quality ?? 'studio';\n const edge = QUALITY[quality].defaultLongEdge;\n const video = shot.kind === 'video';\n const output: OutputSpec = {\n width: shot.width ?? edge,\n height: shot.height ?? edge,\n format: shot.format ?? (video ? 'mp4' : 'png'),\n ...(shot.imageQuality !== undefined\n ? { quality: shot.imageQuality }\n : {}),\n };\n if (video !== isClipFormat(output.format)) {\n throw new Bakery3Error({\n code: 'InvalidRequest',\n message: `Shot \"${shot.id}\" of ${product.id} is ${video ? 'a video in a still' : 'an image in a video'} format (${output.format}).`,\n fix: 'A video is mp4, webm or png-sequence; an image is png, jpeg or webp. Leave `format` out for the default.',\n path: `${product.id}/${shot.id}`,\n docs: `${DOCS}#shots`,\n });\n }\n const aspect = output.width / output.height;\n\n const room = shot.room ? roomFor(shot.room, bounds) : undefined;\n // A video has no alpha, so a transparent background would show the raw\n // studio map behind the product. A video stands on a plain backdrop\n // instead, with its shadow, unless the shot says what it stands on. A\n // png-sequence keeps its alpha, as a still does.\n const background =\n isVideoFormat(output.format) &&\n (shot.background ?? 'transparent') === 'transparent'\n ? CLIP_BACKDROP\n : shot.background;\n const environment = room\n ? roomBackground()\n : await environments.get(shot.environment, background);\n const color: ColorSpec = {\n outputColorSpace: 'srgb',\n toneMapping: 'aces-filmic',\n toneMappingExposure: room ? room.exposure : 1,\n ...shot.color,\n };\n const lens = { fov: shot.fov, margin: shot.margin };\n\n let camera: CameraSpec;\n let animation: AnimationSpec | undefined;\n if (video) {\n const from = angleFor(shot.from!, room, product, shot.id);\n const to = angleFor(shot.to!, room, product, shot.id);\n const fps = Math.min(MAX_FPS, Math.max(1, Math.round(shot.fps ?? 30)));\n const seconds = Math.min(MAX_SECONDS, shot.seconds ?? 4);\n const frameCount = Math.max(2, Math.round(seconds * fps));\n const positions: number[] = [];\n const quaternions: number[] = [];\n let first: CameraSpec | undefined;\n for (let frame = 0; frame < frameCount; frame++) {\n const at = angleBetween(from, to, frame / (frameCount - 1));\n const spec = cameraForAngle(at, bounds, aspect, lens, room, shot.id);\n first ??= spec;\n positions.push(...spec.position);\n quaternions.push(...spec.quaternion);\n }\n camera = first!;\n animation = {\n fps,\n frameCount,\n channels: [\n {\n target: { type: 'camera' },\n property: 'position',\n size: 3,\n values: positions,\n },\n {\n target: { type: 'camera' },\n property: 'quaternion',\n size: 4,\n values: quaternions,\n },\n ],\n };\n } else if (shot.camera) {\n camera = ownCamera(shot.camera, facts, aspect, product, shot.id);\n } else {\n camera = cameraForAngle(\n angleFor(\n shot.view ?? (room ? 'room' : 'three-quarter'),\n room,\n product,\n shot.id,\n ),\n bounds,\n aspect,\n lens,\n room,\n shot.id,\n );\n }\n\n const manifest: SceneManifest = {\n protocolVersion: protocolVersionFor({\n ...(room ? { room: room.spec } : {}),\n ...(animation ? { animation } : {}),\n }),\n sdkVersion: SDK_VERSION,\n sceneAsset: imported.hash,\n camera,\n environment,\n color,\n ...(room ? { room: room.spec } : {}),\n ...(animation ? { animation } : {}),\n compatibility: { score: 1, issues: facts.issues, counts },\n stats: {\n triangles: facts.triangles + (room?.triangles ?? 0),\n // A room is priced by how enclosed and how full it is, measured when\n // it was published; the product adds one object to it. Without a room\n // the shot is an open set, which needs saying nothing.\n ...(room?.complexity\n ? {\n enclosure: room.complexity.enclosure,\n objects: room.complexity.objects + 1,\n }\n : {}),\n },\n source: { renderer: 'catalog' },\n };\n\n const key = `${product.id}/${shot.id}${version ? `@${version}` : ''}`;\n if (key.length > 200)\n throw unreadable(\n product,\n `The key \"${key.slice(0, 40)}…\" is over 200 characters. Use shorter ids.`,\n );\n items.push({\n key,\n spec: {\n manifest,\n quality,\n output,\n ...(shot.advanced ? { advanced: shot.advanced } : {}),\n ...(video ? { preview: false } : {}),\n },\n metadata: {\n ...product.metadata,\n variant: product.id,\n shot: shot.id,\n kind: shot.kind,\n },\n ...(run.maxCostPerImage !== undefined\n ? { maxCost: run.maxCostPerImage }\n : {}),\n });\n }\n return items;\n}\n\n// ---------------------------------------------------------------------------\n// Settings, in layers\n// ---------------------------------------------------------------------------\n\nconst SETTING_KEYS = [\n 'room',\n 'environment',\n 'background',\n 'quality',\n 'width',\n 'height',\n 'format',\n 'imageQuality',\n 'fov',\n 'margin',\n 'fps',\n 'advanced',\n 'color',\n] as const satisfies ReadonlyArray<keyof ShotSettings>;\n\nfunction settingsOf(source: ShotSettings): ShotSettings {\n const out: ShotSettings = {};\n for (const key of SETTING_KEYS)\n if (source[key] !== undefined)\n (out as Record<string, unknown>)[key] = source[key];\n return out;\n}\n\n/**\n * The nearest layer that says anything about `key`, `null` included: a\n * product's `room: null` beats the run's room.\n */\nfunction layered<K extends keyof ShotSettings>(\n key: K,\n ...layers: Array<ShotSettings | undefined>\n): ShotSettings[K] {\n for (let i = layers.length - 1; i >= 0; i--) {\n const value = layers[i]?.[key];\n if (value !== undefined) return value;\n }\n return undefined;\n}\n\n/** A word or a bare angle, as the image shot it stands for. */\nfunction shotOf(shot: Shot): ImageShot | VideoShot {\n if (typeof shot === 'string') return { view: shot };\n if (\n shot &&\n typeof shot === 'object' &&\n 'azimuthDeg' in shot &&\n !('view' in shot) &&\n !('kind' in shot) &&\n !('camera' in shot)\n ) {\n const { azimuthDeg, elevationDeg, ...rest } = shot as Angle & ImageShot;\n return {\n ...rest,\n view: {\n azimuthDeg,\n ...(elevationDeg !== undefined ? { elevationDeg } : {}),\n },\n };\n }\n return shot as ImageShot | VideoShot;\n}\n\nfunction resolveShot(\n shot: Shot,\n run: ShotSettings,\n product: ShotSettings,\n force: RecordBatchOptions['force'],\n): ResolvedShot {\n const own = shotOf(shot);\n const settings: ShotSettings = {};\n for (const key of SETTING_KEYS) {\n const value = layered(key, run, product, settingsOf(own), force);\n if (value !== undefined) (settings as Record<string, unknown>)[key] = value;\n }\n if (own.kind === 'video') {\n return {\n ...settings,\n kind: 'video',\n id: own.id ?? `orbit-${viewName(own.from)}-${viewName(own.to)}`,\n from: own.from,\n to: own.to,\n seconds:\n force?.seconds !== undefined\n ? Math.min(force.seconds, own.seconds ?? 4)\n : own.seconds,\n };\n }\n const image = own as ImageShot;\n return {\n ...settings,\n kind: 'image',\n id:\n image.id ??\n (image.camera\n ? image.camera\n : viewName(image.view ?? (settings.room ? 'room' : 'three-quarter'))),\n ...(image.view !== undefined ? { view: image.view } : {}),\n ...(image.camera !== undefined ? { camera: image.camera } : {}),\n };\n}\n\nfunction viewName(view: View): string {\n if (typeof view === 'string') return view;\n const el = view.elevationDeg;\n return `az${Math.round(view.azimuthDeg)}${el !== undefined ? `-el${Math.round(el)}` : ''}`.replace(\n '--',\n '-neg',\n );\n}\n\n// ---------------------------------------------------------------------------\n// Cameras\n// ---------------------------------------------------------------------------\n\ntype Room = ReturnType<typeof roomFor>;\n\n/** A view as an angle, the room's published direction for `'room'`. */\nfunction angleFor(\n view: View,\n room: Room | undefined,\n product: BatchProduct,\n shot: string,\n): Angle {\n if (view === 'room') {\n if (!room) {\n throw new Bakery3Error({\n code: 'InvalidRequest',\n message: `Shot \"${shot}\" of ${product.id} looks from 'room', but has no room.`,\n fix: \"Set `room: { preset: … }` on the run, the product or the shot, or use a view such as 'three-quarter'.\",\n path: `${product.id}/${shot}`,\n docs: `${DOCS}#angles`,\n });\n }\n return room.published;\n }\n const angle = angleOf(view);\n if (angle) return angle;\n throw new Bakery3Error({\n code: 'InvalidRequest',\n message: `Shot \"${shot}\" of ${product.id}: \"${typeof view === 'string' ? view : JSON.stringify(view)}\" is not a view.`,\n fix: `A view is one of ${Object.keys(VIEW_WORDS).join(', ')}, room, or \\`{ azimuthDeg, elevationDeg? }\\`. For a camera inside the model, use \\`camera: '<node name>'\\`.`,\n path: `${product.id}/${shot}`,\n docs: `${DOCS}#angles`,\n });\n}\n\nfunction cameraForAngle(\n angle: Angle,\n bounds: Bounds,\n aspect: number,\n lens: { fov?: number; margin?: number },\n room: Room | undefined,\n name: string,\n): CameraSpec {\n if (room) return room.camera(angle, aspect, lens, name);\n return framedCamera(\n bounds,\n {\n id: name,\n ...angle,\n ...(lens.fov !== undefined ? { fov: lens.fov } : {}),\n ...(lens.margin !== undefined ? { margin: lens.margin } : {}),\n },\n aspect,\n );\n}\n\n/** A camera the model carries, at the output's aspect. */\nfunction ownCamera(\n name: string,\n facts: GlbFacts,\n aspect: number,\n product: BatchProduct,\n shot: string,\n): CameraSpec {\n const own = facts.cameras.find((camera) => camera.name === name);\n if (own)\n return {\n ...own.camera,\n ...(own.camera.type === 'perspective' ? { aspect } : {}),\n name: shot,\n } as CameraSpec;\n const names = facts.cameras.map((camera) => camera.name);\n throw new Bakery3Error({\n code: 'ImportFailed',\n message: `Shot \"${shot}\": ${product.id}'s model has no camera named \"${name}\".`,\n fix: names.length\n ? `Its cameras are: ${names.slice(0, 8).join(', ')}.`\n : 'It carries no cameras. Use a view instead: an angle is framed from the model itself.',\n path: `${product.id}/${shot}`,\n docs: `${DOCS}#angles`,\n });\n}\n\n// ---------------------------------------------------------------------------\n// Light: an environment, or a room\n// ---------------------------------------------------------------------------\n\n/**\n * What a product stands in when nothing is said. `studio_small_03` at full\n * strength clips a white product to paper (a ceramic vase or a lacquered\n * table top loses its form shading); at 0.6 they keep it and a dark sofa is\n * still well lit. An environment the caller names is used at the strength\n * they give, 1 unless they say.\n */\nconst DEFAULT_ENVIRONMENT: BatchEnvironment = {\n preset: 'studio_small_03',\n intensity: 0.6,\n};\n/**\n * What a clip stands on when nothing is said: a light neutral, the same one\n * a preview is flattened onto.\n */\nconst CLIP_BACKDROP = '#f4f4f5' as const;\n\n/** One import per distinct HDRI URL, however many shots share it. */\nclass EnvironmentCache {\n private readonly hashes = new Map<string, Promise<string>>();\n constructor(private readonly host: BatchHost) {}\n\n async get(\n chosen: BatchEnvironment | undefined,\n background: ShotSettings['background'],\n ): Promise<EnvironmentSpec> {\n const environment = chosen ?? DEFAULT_ENVIRONMENT;\n if (environment.preset && environment.url) {\n throw new Bakery3Error({\n code: 'InvalidRequest',\n message: 'environment takes a `preset` or a `url`, not both.',\n docs: `${DOCS}#light`,\n });\n }\n let hdri: string;\n if (environment.url) {\n // Your own HDRI arrives at the renderer as a hash, like every other\n // asset. Only the preset library is ever named by URL.\n const url = environment.url;\n let pending = this.hashes.get(url);\n if (!pending) {\n pending = this.host\n .importAsset({ url, kind: 'hdri' })\n .then((imported) => imported.hash);\n this.hashes.set(url, pending);\n pending.catch(() => this.hashes.delete(url));\n }\n hdri = await pending;\n } else {\n const name = environment.preset ?? 'studio_small_03';\n if (!(name in HDRI_PRESETS)) {\n throw new Bakery3Error({\n code: 'InvalidRequest',\n message: `There is no environment preset \"${name}\".`,\n fix: `The presets are: ${Object.keys(HDRI_PRESETS).join(', ')}.`,\n docs: `${DOCS}#light`,\n });\n }\n hdri = `${PRESET_LIBRARY}/v${PRESETS_VERSION}/hdri/${name}/render.exr`;\n }\n return {\n hdri,\n ...(environment.intensity !== undefined\n ? { intensity: environment.intensity }\n : {}),\n ...(environment.rotationDeg\n ? {\n rotation: [0, (environment.rotationDeg * Math.PI) / 180, 0] as Vec3,\n }\n : {}),\n background: backgroundOf(background),\n };\n }\n}\n\nfunction backgroundOf(\n background: ShotSettings['background'],\n): NonNullable<EnvironmentSpec['background']> {\n const chosen = background ?? 'transparent';\n if (chosen === 'transparent') return { type: 'transparent' };\n if (chosen === 'environment') return { type: 'environment' };\n if (!/^#[0-9a-f]{6}$/i.test(chosen)) {\n throw new Bakery3Error({\n code: 'InvalidRequest',\n message: `background \"${chosen}\" is not 'transparent', 'environment' or a #rrggbb color.`,\n docs: `${DOCS}#light`,\n });\n }\n return { type: 'color', color: chosen };\n}\n\n/** In a room the room is the background; what no wall covers is transparent. */\nfunction roomBackground(): EnvironmentSpec {\n return { background: { type: 'transparent' } };\n}\n\n/**\n * What a product stands on follows its size, by the rule the rooms were\n * designed around: a small thing on the room's own pedestal, a mid-sized\n * piece on the low wide plinth, furniture and anything that would overhang\n * on the floor. A sofa on a meter-high column is a picture nobody wanted.\n */\nconst STAND_RULES = {\n fit: 0.85,\n tallFrom: 0.6,\n smallHeight: 0.6,\n plinthHeight: 1.0,\n} as const;\nconst PLINTH = 'pedestal_plinth';\n/** Room to see the room in: the product fills about half the frame. */\nconst ROOM_MARGIN = 0.9;\n/** A camera is kept this far inside the walls, the floor and the ceiling. */\nconst WALL_CLEARANCE = 0.3;\n/** The least room left around a product when a wall decides the distance. */\nconst FIT_MARGIN = 0.12;\n/** The widest lens a wall can force. */\nconst MAX_ROOM_FOV = 100;\n/**\n * The lowest the `'room'` view is taken from, in degrees above the product's\n * middle. A room's published camera is the hero shot of its own stand, and\n * three look up at it (living_evening 14 degrees, gallery_day 11,\n * dining_golden 5). Aimed at a real product along that line, the camera\n * stood below the surface a short product stands on, so the stand's top and\n * the product's base were hidden, and a sofa on the floor was shot from\n * near the floor through a wide lens. Level keeps every room's direction and\n * distance and changes only those three.\n */\nconst ROOM_MIN_ELEVATION_DEG = 0;\n\n/**\n * The vertical field of view that fits a sphere of `radius` at `distance`,\n * in the narrower of the two axes.\n */\nfunction fovToFit(radius: number, distance: number, aspect: number): number {\n const half = Math.asin(Math.min(1, radius / distance));\n const vertical = aspect >= 1 ? half : Math.atan(Math.tan(half) / aspect);\n return (2 * vertical * 180) / Math.PI;\n}\n\nfunction standFor(\n room: BatchRoom,\n info: (typeof ROOM_PRESETS)[RoomPresetName],\n bounds: Bounds,\n): { pedestal?: RoomPresetSpec['pedestal']; top: number } {\n const footprint = Math.max(\n bounds.max[0] - bounds.min[0],\n bounds.max[2] - bounds.min[2],\n );\n const height = bounds.max[1] - bounds.min[1];\n const fits = (\n size: { x: number; y: number; z: number } | null | undefined,\n ): boolean => {\n if (!size) return false;\n if (footprint > STAND_RULES.fit * Math.min(size.x, size.z)) return false;\n return (\n height <=\n (size.y >= STAND_RULES.tallFrom\n ? STAND_RULES.smallHeight\n : STAND_RULES.plinthHeight)\n );\n };\n const choice = room.stand ?? 'auto';\n if (choice === 'own' || (choice === 'auto' && fits(info.stand.size)))\n return { top: info.stand.top };\n if (choice === 'auto' && fits(PEDESTAL_PRESETS[PLINTH].size))\n return { pedestal: { type: PLINTH }, top: PEDESTAL_PRESETS[PLINTH].size.y };\n return { pedestal: null, top: 0 };\n}\n\n/**\n * Put the room around the product, since the product cannot be moved into\n * the room: a model by URL has none of the ids a transform is addressed by.\n * The room is turned about its stand so its published camera sees the\n * product from `viewFromDeg`, and placed so the stand's top (or the floor)\n * is under the product's base. What the renderer receives is one matrix.\n */\nfunction roomFor(room: BatchRoom, bounds: Bounds) {\n const info = ROOM_PRESETS[room.preset];\n if (!info) {\n throw new Bakery3Error({\n code: 'InvalidRequest',\n message: `There is no room preset \"${room.preset}\".`,\n fix: `The rooms are: ${Object.keys(ROOM_PRESETS).join(', ')}.`,\n docs: `${DOCS}#light`,\n });\n }\n const lighting = room.mode ?? info.lighting;\n const standing = standFor(room, info, bounds);\n const stand: Vec3 = [info.stand.x, standing.top, info.stand.z];\n const base: Vec3 = [\n (bounds.min[0] + bounds.max[0]) / 2,\n bounds.min[1],\n (bounds.min[2] + bounds.max[2]) / 2,\n ];\n const size: Vec3 = [\n bounds.max[0] - bounds.min[0],\n bounds.max[1] - bounds.min[1],\n bounds.max[2] - bounds.min[2],\n ];\n const radius = radiusOf(bounds);\n\n // The published line, from the stand to the camera, as an angle and a length.\n const line: Vec3 = [\n info.camera.position[0] - info.camera.target[0],\n info.camera.position[1] - info.camera.target[1],\n info.camera.position[2] - info.camera.target[2],\n ];\n const designed = Math.hypot(line[0], line[1], line[2]);\n const publishedAzimuth = Math.atan2(line[0], line[2]);\n const viewFrom = ((room.viewFromDeg ?? 30) * Math.PI) / 180;\n const theta = viewFrom - publishedAzimuth;\n const c = Math.cos(theta);\n const s = Math.sin(theta);\n /** A point in the room's frame, in the product's. */\n const place = ([x, y, z]: readonly [number, number, number]): Vec3 => {\n const dx = x - stand[0];\n const dz = z - stand[2];\n return [\n base[0] + dx * c + dz * s,\n base[1] + (y - stand[1]),\n base[2] - dx * s + dz * c,\n ];\n };\n const origin = place([0, 0, 0]);\n const matrix: Matrix4 = [\n c,\n 0,\n -s,\n 0,\n 0,\n 1,\n 0,\n 0,\n s,\n 0,\n c,\n 0,\n origin[0],\n origin[1],\n origin[2],\n 1,\n ];\n\n const spec: RoomPresetSpec = {\n name: room.preset,\n build: info.build,\n lighting,\n ...(standing.pedestal !== undefined ? { pedestal: standing.pedestal } : {}),\n matrix,\n };\n const published: Angle = {\n azimuthDeg: (viewFrom * 180) / Math.PI,\n elevationDeg: Math.max(\n ROOM_MIN_ELEVATION_DEG,\n (Math.atan2(line[1], Math.hypot(line[0], line[2])) * 180) / Math.PI,\n ),\n };\n /**\n * The room's published camera: a 36 mm horizontal sensor, so the vertical\n * FOV follows the aspect.\n */\n const lensFov = (aspect: number) =>\n (2 *\n Math.atan((aspect >= 1 ? 36 / aspect : 36) / (2 * info.camera.lensMm)) *\n 180) /\n Math.PI;\n\n return {\n spec,\n triangles: info.preview.triangles,\n complexity: info.complexity,\n exposure: info.exposure[lighting],\n published,\n /**\n * A camera in the room from any angle: framed as in the open, from as\n * far as the published camera stood when that is the view, and never\n * behind a wall, the floor or the ceiling.\n */\n camera(\n angle: Angle,\n aspect: number,\n lens: { fov?: number; margin?: number },\n name: string,\n ): CameraSpec {\n const fov = lens.fov ?? lensFov(aspect);\n const center = centerOf(bounds);\n const direction = directionOf(angle);\n const framed = framedDistance(\n radius,\n fov,\n aspect,\n lens.margin ?? ROOM_MARGIN,\n );\n const isPublished =\n Math.abs(angle.azimuthDeg - published.azimuthDeg) < 1e-6 &&\n Math.abs((angle.elevationDeg ?? 12) - published.elevationDeg!) < 1e-6;\n\n // The direction in the room's own frame, to find the wall it meets.\n const rx = direction[0] * c - direction[2] * s;\n const rz = direction[0] * s + direction[2] * c;\n const ry = direction[1];\n const from: Vec3 = [stand[0], stand[1] + size[1] / 2, stand[2]];\n const half = [\n info.size.width / 2 - WALL_CLEARANCE,\n info.size.depth / 2 - WALL_CLEARANCE,\n ];\n let reach = Infinity;\n if (rx !== 0)\n reach = Math.min(\n reach,\n ((rx > 0 ? half[0]! : -half[0]!) - from[0]) / rx,\n );\n if (rz !== 0)\n reach = Math.min(\n reach,\n ((rz > 0 ? half[1]! : -half[1]!) - from[2]) / rz,\n );\n if (ry > 0)\n reach = Math.min(\n reach,\n (info.size.height - WALL_CLEARANCE - from[1]) / ry,\n );\n if (ry < 0) reach = Math.min(reach, (WALL_CLEARANCE - from[1]) / ry);\n\n const wanted = Math.max(isPublished ? designed : 0, framed);\n const distance = Math.max(radius * 1.2, Math.min(wanted, reach));\n // A photographer with their back to the wall takes a wider lens. The\n // product still fits, with a little room, at whatever the walls allow.\n const lensFit =\n distance < framed\n ? fovToFit(radius * (1 + FIT_MARGIN), distance, aspect)\n : fov;\n return cameraAt(\n center,\n radius,\n direction,\n distance,\n Math.min(MAX_ROOM_FOV, Math.max(fov, lensFit)),\n aspect,\n name,\n );\n },\n };\n}\n\n// ---------------------------------------------------------------------------\n\nfunction validateShots(shots: Shot[], where: string): void {\n const ids = new Set<string>();\n shots.forEach((shot, index) => {\n if (!shot || (typeof shot !== 'string' && typeof shot !== 'object'))\n throw badShot(where, index, 'is not a shot');\n const own = shotOf(shot);\n if (own.kind === 'video') {\n if (angleOf(own.from) === null && own.from !== 'room')\n throw badShot(where, index, '`from` is not a view');\n if (angleOf(own.to) === null && own.to !== 'room')\n throw badShot(where, index, '`to` is not a view');\n if (\n own.seconds !== undefined &&\n !(own.seconds > 0 && own.seconds <= MAX_SECONDS)\n )\n throw badShot(\n where,\n index,\n `\\`seconds\\` is outside 0 to ${MAX_SECONDS}`,\n );\n } else if (own.kind !== undefined && own.kind !== 'image') {\n throw badShot(\n where,\n index,\n `kind \"${String(own.kind)}\" is not 'image' or 'video'`,\n );\n } else if (\n (own as ImageShot).view !== undefined &&\n (own as ImageShot).camera !== undefined\n ) {\n throw badShot(where, index, 'has both a `view` and a `camera`');\n }\n const id =\n own.id ??\n (own.kind === 'video'\n ? `orbit-${viewName(own.from)}-${viewName(own.to)}`\n : ((own as ImageShot).camera ??\n ((own as ImageShot).view !== undefined\n ? viewName((own as ImageShot).view!)\n : undefined)));\n if (id !== undefined) {\n if (!/^[A-Za-z0-9_.-]{1,60}$/.test(id))\n throw badShot(\n where,\n index,\n `id \"${id}\" is not 1 to 60 letters, digits, dots, dashes or underscores`,\n );\n if (ids.has(id)) throw badShot(where, index, `id \"${id}\" is used twice`);\n ids.add(id);\n }\n });\n}\n\nfunction badShot(where: string, index: number, what: string): Bakery3Error {\n return new Bakery3Error({\n code: 'InvalidRequest',\n message: `Shot ${index + 1} of ${where} ${what}.`,\n why: 'A shot is a word, `{ view }`, or `{ kind: \"video\", from, to }`, plus settings, and its id ends the picture’s key.',\n docs: `${DOCS}#shots`,\n });\n}\n\nfunction validateProduct(product: BatchProduct, seen: Set<string>): void {\n if (\n !product ||\n typeof product.id !== 'string' ||\n !product.id ||\n typeof product.url !== 'string' ||\n !product.url\n ) {\n throw new Bakery3Error({\n code: 'InvalidRequest',\n message: 'Every product needs an `id` and a `url`.',\n why: 'The id starts every shot’s key: it is what a re-run adopts by and what a failure is reported under.',\n docs: DOCS,\n });\n }\n if (seen.has(product.id)) {\n throw new Bakery3Error({\n code: 'InvalidRequest',\n message: `Two products are called \"${product.id}\".`,\n why: 'The second would be adopted as the first: same key, same picture.',\n fix: 'Make the ids unique.',\n path: product.id,\n docs: DOCS,\n });\n }\n seen.add(product.id);\n}\n\nfunction unreadable(product: BatchProduct, message: string): Bakery3Error {\n return new Bakery3Error({\n code: 'ImportFailed',\n message,\n path: product.id,\n docs: `${DOCS}#what-a-model-can-use`,\n });\n}\n\nfunction mostlyFailing(\n tally: RenderBatchRecorded,\n attempted: number,\n): Bakery3Error {\n const first = tally.skips[0]!;\n return new Bakery3Error({\n code: 'ImportFailed',\n message: `${tally.skipped} of the first ${attempted} models could not be imported. The first: ${first.id}: ${first.error.message}`,\n why: 'One bad model is skipped and listed. Most of them failing is something wrong with all of them: a base URL, a bucket that is not public, a format.',\n fix: 'Open one of the URLs in a private browser window. It has to download a .glb there. What was recorded stays admitted; call again with the same key to go on.',\n docs: `${DOCS}#importing-by-url`,\n });\n}\n\nfunction abortError(): Error {\n const error = new Error('The recording was aborted.');\n error.name = 'AbortError';\n return error;\n}\n","/**\n * Webhook signature verification.\n *\n * A webhook endpoint is a public URL that causes writes in the developer's\n * database. Verifying is not optional, so it is one function with no options\n * and no way to get it subtly wrong.\n *\n * const event = await verifyWebhook({\n * body: await request.text(),\n * signature: request.headers.get('bakery3-signature'),\n * secret: process.env.BAKERY3_WEBHOOK_SECRET!,\n * });\n *\n * Pass the raw body, not a parsed and re-stringified object. Re-serializing\n * JSON changes key order and whitespace and therefore the signature, and it\n * is the single most common reason a correct implementation fails.\n */\n\nimport type { WebhookPayload } from '../protocol/index.js';\nimport { Bakery3Error } from '../errors.js';\n\n/**\n * A signature older than this is refused, so a captured request cannot be\n * replayed later. Five minutes is the usual allowance for clock skew.\n */\nconst TOLERANCE_MS = 5 * 60 * 1000;\n\n/**\n * Verify a webhook request and return its payload. Throws a `Bakery3Error`\n * (`Unauthorized`) when the header is missing, malformed, older than five\n * minutes, or signed with another secret.\n */\nexport async function verifyWebhook(input: {\n /** The request body exactly as received, as text. */\n body: string;\n /**\n * The `bakery3-signature` header. `headers.get()` gives `null` when the\n * request has none, and that is refused like a bad signature.\n */\n signature: string | null | undefined;\n /** The signing secret from your webhook settings. */\n secret: string;\n /** Test seam. Never pass this in production. */\n now?: number;\n}): Promise<WebhookPayload> {\n const { body, signature, secret } = input;\n const now = input.now ?? Date.now();\n\n if (typeof secret !== 'string' || !secret) {\n throw new Bakery3Error({\n code: 'InvalidRequest',\n message: 'verifyWebhook() was given no secret.',\n fix: 'Pass the signing secret from your webhook settings, from a server-only environment variable: secret: process.env.BAKERY3_WEBHOOK_SECRET!',\n docs: 'https://bakery3.com/docs/webhooks',\n });\n }\n if (typeof signature !== 'string' || !signature) {\n throw invalid(\n 'The request has no bakery3-signature header. Pass request.headers.get(\"bakery3-signature\").',\n );\n }\n\n // `t=<ms>,v1=<hex>`: the timestamp is signed together with the body, which\n // is what makes the replay window enforceable.\n const parts = Object.fromEntries(\n signature.split(',').map((piece) => {\n const index = piece.indexOf('=');\n return [piece.slice(0, index).trim(), piece.slice(index + 1).trim()];\n }),\n );\n const timestamp = Number(parts.t);\n const provided = parts.v1;\n\n if (!timestamp || !provided) {\n throw invalid('Signature header is malformed. Expected \"t=…,v1=…\".');\n }\n if (Math.abs(now - timestamp) > TOLERANCE_MS) {\n throw invalid('Signature timestamp is outside the five-minute tolerance.');\n }\n\n const key = await crypto.subtle.importKey(\n 'raw',\n new TextEncoder().encode(secret),\n { name: 'HMAC', hash: 'SHA-256' },\n false,\n ['sign'],\n );\n const mac = await crypto.subtle.sign(\n 'HMAC',\n key,\n new TextEncoder().encode(`${timestamp}.${body}`),\n );\n\n if (!timingSafeEqual(toHex(new Uint8Array(mac)), provided)) {\n throw invalid('Signature does not match the body.');\n }\n\n return JSON.parse(body) as WebhookPayload;\n}\n\nfunction invalid(message: string): Bakery3Error {\n return new Bakery3Error({\n code: 'Unauthorized',\n message,\n why: 'The request did not carry a valid Bakery3 signature, so it may not have come from us.',\n fix: 'Pass the raw request body (not a re-serialized object) and the secret from your webhook settings.',\n docs: 'https://bakery3.com/docs/webhooks',\n });\n}\n\n/**\n * Constant time in the length-equal case, which is the only case that can\n * leak anything useful: both sides are fixed-length hex digests.\n */\nfunction timingSafeEqual(a: string, b: string): boolean {\n if (a.length !== b.length) return false;\n let diff = 0;\n for (let i = 0; i < a.length; i++) diff |= a.charCodeAt(i) ^ b.charCodeAt(i);\n return diff === 0;\n}\n\nfunction toHex(bytes: Uint8Array): string {\n let out = '';\n for (const byte of bytes) out += byte.toString(16).padStart(2, '0');\n return out;\n}\n","/**\n * @oeave/bakery3/node: the server half.\n *\n * The secret key lives here and only here. It never reaches a browser and is\n * never an argument to anything in `@oeave/bakery3`. This module mints the\n * short-lived, narrow token that goes in its place, verifies webhooks, and\n * calls the API with the secret key for the things a browser may not do.\n *\n * import { Bakery3Server } from '@oeave/bakery3/node';\n *\n * const bakery3 = new Bakery3Server(process.env.BAKERY3_SECRET_KEY!);\n *\n * export async function POST() {\n * return Response.json(\n * await bakery3.tokens.create({\n * expiresInSeconds: 300,\n * maxRenders: 1,\n * maxCost: 1,\n * allowedOrigins: ['https://shop.example.com'],\n * })\n * );\n * }\n *\n * That endpoint is the entire server-side integration.\n */\n\nimport type {\n AssetImportKind,\n AssetImportResponse,\n BatchOpenRequest,\n CostEstimate,\n RenderRecord,\n RenderSpec,\n} from '../protocol/index.js';\nimport { QUALITY } from '../protocol/index.js';\nimport { Bakery3Error } from '../errors.js';\nimport { Bakery3Client, type RetryPolicy } from '../client.js';\nimport { Batch } from '../batch.js';\nimport { RenderSet } from '../set.js';\nimport {\n quoteKey,\n sampleOf,\n testSettings,\n type TestRunOptions,\n} from '../testRun.js';\nimport {\n recordBatch,\n type RenderBatchOptions,\n type RenderBatchRecorded,\n type RenderBatchRecording,\n} from './renderBatch.js';\nimport { warnIfKeyIsExposed } from '../warn.js';\n\nexport type BrowserTokenOptions = {\n /**\n * How long the token lives, in seconds. Default 300. Keep it short: a\n * browser token is a capability handed to a page, and the shorter its life\n * the less a leaked one is worth. Five minutes is plenty, because the\n * browser SDK re-mints on a 401 without the developer writing anything.\n */\n expiresInSeconds?: number;\n /** Hard ceiling on renders this token can start. Default 5. */\n maxRenders?: number;\n /** Hard ceiling on spend across all of them, in USD. Default 2. */\n maxCost?: number;\n /**\n * Origins allowed to spend it. Set this in production: it is what stops a\n * token lifted out of one page's network tab from working anywhere else.\n */\n allowedOrigins?: string[];\n /** Your own user/session id. Shows up in the usage ledger for attribution. */\n subject?: string;\n};\n\nexport type BrowserToken = {\n /** The token itself, a `bk_pt_` string. Hand it to the browser SDK. */\n token: string;\n /** When it stops working, as a Unix timestamp in milliseconds. */\n expiresAt: number;\n /** The project the token renders into. */\n projectId: string;\n};\n\nexport type Bakery3ServerOptions = {\n /** The API's base URL. Only for a self-hosted or test deployment. */\n baseUrl?: string;\n /** A `fetch` to use instead of the global one. */\n fetch?: typeof fetch;\n /** How a 429/503 is waited out. The browser SDK's defaults otherwise. */\n retry?: RetryPolicy;\n};\n\n/** A run's pictures, plus which products were left out and why. */\nexport type RenderBatchRun = RenderSet & {\n readonly recorded: RenderBatchRecorded;\n};\n\nexport class Bakery3Server {\n readonly tokens: TokensApi;\n readonly renders: RendersApi;\n readonly batches: BatchesApi;\n readonly assets: AssetsApi;\n\n private readonly secretKey: string | undefined;\n private readonly options: Bakery3ServerOptions;\n private transport: Bakery3Client | undefined;\n\n /**\n * @param secretKey Your `bk_sk_` key, as a string, from a server-only\n * environment variable. Not the browser SDK's `{ apiKey }` object.\n *\n * The key is checked on the first request, not here. A route module that\n * builds its client at the top level is evaluated by `next build`, often\n * where the server's secrets are not set, and a constructor that threw\n * there would fail the build over a key the build never uses.\n */\n constructor(secretKey: string, options: Bakery3ServerOptions = {}) {\n // The browser SDK takes `{ apiKey }`; this constructor takes the string.\n // Said here, or it would fail as `secretKey.startsWith is not a function`.\n // An object is wrong wherever the code runs, so this one is not deferred.\n if (secretKey != null && typeof secretKey !== 'string') {\n throw new Bakery3Error({\n code: 'InvalidRequest',\n message:\n 'new Bakery3Server() takes the secret key as a string, not an options object.',\n fix: 'new Bakery3Server(process.env.BAKERY3_SECRET_KEY!, options)',\n docs: 'https://bakery3.com/docs/auth',\n });\n }\n this.secretKey = secretKey || undefined;\n this.options = options;\n\n // This module is server-only by design, but nothing stops a bundler from\n // pulling it into a client component, and the failure is silent: the key\n // ships and everything keeps working.\n if (this.secretKey) warnIfKeyIsExposed(this.secretKey, { source: 'node' });\n\n const client = () => this.client();\n // Async, so a key that fails its check rejects the call's promise\n // rather than throwing from it.\n const request: Request = async (method, path, body) =>\n client().request(method, path, body);\n this.tokens = new TokensApi(request);\n this.renders = new RendersApi(request, client);\n this.batches = new BatchesApi(client);\n this.assets = new AssetsApi(client);\n }\n\n /**\n * The same transport the browser SDK uses (one error shape, the same\n * 429/503 backoff) with the secret key as the bearer. It has nothing to\n * re-mint, so a 401 here is a 401. Made on first use, after the key is\n * checked.\n */\n private client(): Bakery3Client {\n if (this.transport) return this.transport;\n const secretKey = this.secretKey;\n if (!secretKey) {\n throw new Bakery3Error({\n code: 'Unauthorized',\n message:\n 'A secret key is required. Create one at https://bakery3.com/keys, then pass it: new Bakery3Server(process.env.BAKERY3_SECRET_KEY!).',\n docs: 'https://bakery3.com/docs/auth',\n });\n }\n // A browser token here is almost always a copy-paste mistake between the\n // two halves of the integration, and it would otherwise fail later with a\n // generic 401 from a route that looks unrelated.\n if (secretKey.startsWith('bk_pt_')) {\n throw new Bakery3Error({\n code: 'Unauthorized',\n message: 'That is a browser token, not a secret key.',\n why: 'Browser tokens (bk_pt_…) are minted by this SDK. Secret keys (bk_sk_…) create them.',\n fix: 'Use your bk_sk_ key from https://bakery3.com/keys, kept in a server-only environment variable.',\n docs: 'https://bakery3.com/docs/auth',\n });\n }\n if (!secretKey.startsWith('bk_sk_')) {\n throw new Bakery3Error({\n code: 'Unauthorized',\n message:\n 'That is not a secret key. Secret keys start with bk_sk_. Create one at https://bakery3.com/keys.',\n docs: 'https://bakery3.com/docs/auth',\n });\n }\n this.transport = new Bakery3Client({\n apiKey: secretKey,\n ...(this.options.baseUrl ? { baseUrl: this.options.baseUrl } : {}),\n ...(this.options.fetch ? { fetch: this.options.fetch } : {}),\n ...(this.options.retry ? { retry: this.options.retry } : {}),\n });\n return this.transport;\n }\n\n /**\n * Render a catalog of models that already sit on a CDN: one call, no\n * browser, and none of the models' bytes through this process. Needs a\n * plan that includes imports (see https://bakery3.com/docs/catalog#plans).\n *\n * const run = await api.renderBatch({\n * key: 'fall-2026',\n * products: [{ id: 'chair-aria', url: 'https://cdn.shop.com/models/chair-aria.glb' }],\n * shots: ['three-quarter', 'front', { kind: 'video', from: 'front', to: 'back', seconds: 4 }],\n * room: { preset: 'loft_golden' },\n * maxCost: 600,\n * });\n * await run.wait(); // or let a webhook tell you, and exit now\n *\n * Resolves once every product is recorded and the run is sealed. The\n * shots render on from there; this process does not have to stay up.\n * A product whose model cannot be imported is skipped and listed in\n * `run.recorded.skips`, and the run goes on. Calling it again with the\n * same `key` resumes a recording that stopped, re-downloads no model that\n * did not change, and adopts every shot that already rendered.\n *\n * What a model by URL cannot carry (node materials, a shader-lit set) is\n * recorded where that code runs; see `renderVariants()` in `@oeave/bakery3`.\n */\n async renderBatch(options: RenderBatchOptions): Promise<RenderBatchRun> {\n if (!(options.maxCost > 0)) {\n throw new Bakery3Error({\n code: 'InvalidRequest',\n message: 'renderBatch() needs a maxCost.',\n why: 'A run is as many renders as products times shots, and a ceiling is what makes that number safe to be wrong about: a page that would cross it is refused, never charged.',\n fix: 'Call quoteBatch() with the same options for the real number, or testBatch() to look at three products first.',\n docs: 'https://bakery3.com/docs/catalog#what-it-will-cost',\n });\n }\n const batch = await this.openRun(options);\n const recorded = await recordBatch(this.client(), batch, options);\n // Sealed only once every product is through. A recording that threw\n // leaves the run open, which is what lets the same call resume it.\n await batch.close();\n return new RenderSet(batch, recorded) as RenderBatchRun;\n }\n\n /**\n * What `renderBatch()` would cost. The models are imported (that is how\n * they are priced); nothing is rendered or charged.\n */\n async quoteBatch(\n options: Omit<RenderBatchOptions, 'maxCost'> & { maxCost?: number },\n ): Promise<RenderBatchRecording> {\n // The route that prices a page belongs to a batch, and a batch is opened\n // under a key. Never the run's own: that batch is the one\n // `renderBatch()` opens with its `maxCost`, and one opened here without\n // a ceiling would be the batch the run then re-opens. A batch of its\n // own, priced and then cancelled, holds nothing and keeps the run's key\n // free.\n const batch = await this.openRun({\n key: options.key && quoteKey(options.key),\n name: `${options.name ?? options.key} (quote)`,\n ...(options.lane ? { lane: options.lane } : {}),\n });\n try {\n return await recordBatch(this.client(), batch, options, {\n dryRun: true,\n });\n } finally {\n // Best effort: a quote batch left open holds nothing either.\n await batch.cancel().catch(() => {});\n }\n }\n\n /**\n * Look before paying: three products (the first, the middle and the last\n * of an array; the first three of anything else), every shot, at preview\n * quality and a small size, in the ordinary lane so they come back in\n * about a minute. A clip is cut to two seconds at twelve frames. Same\n * options as `renderBatch()`. The test run has keys of its own, so the\n * real run never adopts these previews as finished shots.\n *\n * const test = await api.testBatch(options);\n * for (const shot of await test.result()) console.log(shot.variant, shot.shot, shot.url);\n */\n async testBatch(\n options: Omit<RenderBatchOptions, 'maxCost'> & { maxCost?: number },\n test: TestRunOptions = {},\n ): Promise<RenderBatchRun> {\n const edge = QUALITY[options.quality ?? 'studio'].defaultLongEdge;\n const settings = testSettings(\n {\n key: options.key,\n width: options.width ?? edge,\n height: options.height ?? edge,\n },\n test,\n );\n const run: Omit<RenderBatchOptions, 'maxCost'> & { maxCost: number } = {\n ...options,\n key: settings.key,\n lane: settings.lane,\n maxCost: settings.maxCost,\n products: sampleOf(options.products, test.products),\n name: `${options.name ?? options.key} (test)`,\n };\n const batch = await this.openRun(run);\n // Forced over every layer, so a product's or a shot's own 2048² still\n // comes back small.\n const recorded = await recordBatch(this.client(), batch, run, {\n force: {\n version: settings.version,\n quality: settings.quality,\n width: settings.width,\n height: settings.height,\n fps: 12,\n seconds: 2,\n },\n });\n await batch.close();\n return new RenderSet(batch, recorded) as RenderBatchRun;\n }\n\n /**\n * A run by id, from another process, a webhook handler, or tomorrow\n * morning.\n */\n async getRenderSet(id: string): Promise<RenderSet> {\n const client = this.client();\n return new RenderSet(new Batch(client, await client.getBatch(id)));\n }\n\n private async openRun(\n options: Pick<\n RenderBatchOptions,\n 'key' | 'name' | 'lane' | 'maxParallel'\n > & { maxCost?: number },\n ): Promise<Batch> {\n if (!options.key) {\n throw new Bakery3Error({\n code: 'InvalidRequest',\n message: 'A run needs a key.',\n why: 'The key names the run. It is what lets the same call resume a recording that stopped, instead of starting a second one.',\n fix: \"Give it something stable that names this body of work: `key: 'fall-2026'`.\",\n docs: 'https://bakery3.com/docs/catalog',\n });\n }\n const client = this.client();\n return new Batch(\n client,\n await client.openBatch({\n key: options.key,\n ...(options.name ? { name: options.name } : {}),\n ...(options.maxCost !== undefined ? { maxCost: options.maxCost } : {}),\n lane: options.lane ?? 'batch',\n ...(options.maxParallel !== undefined\n ? { maxParallel: options.maxParallel }\n : {}),\n }),\n );\n }\n}\n\nclass AssetsApi {\n constructor(private readonly client: () => Bakery3Client) {}\n\n /**\n * Have the service fetch a public https URL into the project's assets,\n * and say what it found: the hash to put in a manifest, and for a model\n * its triangles, bounds, cameras and anything the renderer cannot read.\n *\n * Secret key only, which is why it is here and not in the browser SDK.\n * What is fetched is fenced on the service's side: https, public\n * addresses only, no credentials, a size limit, and the file must be a\n * model or an HDRI. An unchanged URL is answered without a download\n * (`unchanged: true`).\n */\n async import(\n url: string,\n options: { kind?: AssetImportKind } = {},\n ): Promise<AssetImportResponse> {\n return this.client().importAsset({\n url,\n ...(options.kind ? { kind: options.kind } : {}),\n });\n }\n}\n\ntype Request = <T>(method: string, path: string, body?: unknown) => Promise<T>;\n\nclass TokensApi {\n constructor(private readonly request: Request) {}\n\n /**\n * Mint a browser token.\n *\n * Everything about it is a ceiling rather than a grant: it cannot outlive\n * its expiry, cannot start more renders than `maxRenders`, cannot spend past\n * `maxCost`, cannot be used from an origin outside `allowedOrigins`, and\n * cannot perform a single billing or admin operation. That last one is not\n * a policy: those routes require a `bk_sk_` key and this is not one.\n */\n create(options: BrowserTokenOptions = {}): Promise<BrowserToken> {\n return this.request<BrowserToken>('POST', '/v1/tokens', {\n expiresInSeconds: options.expiresInSeconds ?? 300,\n maxRenders: options.maxRenders ?? 5,\n maxCost: options.maxCost ?? 2,\n ...(options.allowedOrigins\n ? { allowedOrigins: options.allowedOrigins }\n : {}),\n ...(options.subject ? { subject: options.subject } : {}),\n });\n }\n\n /** Revoke a token before its expiry. */\n revoke(token: string): Promise<void> {\n return this.request<void>('POST', '/v1/tokens/revoke', { token });\n }\n}\n\nclass RendersApi {\n constructor(\n private readonly request: Request,\n private readonly client: () => Bakery3Client,\n ) {}\n\n /**\n * Render from a manifest you already have: a batch job, a re-render, a\n * queued webhook. The browser flow is `@oeave/bakery3`; this is the API.\n * Repeated on a 429/503 only when `spec.idempotencyKey` makes that safe.\n */\n async create(spec: RenderSpec): Promise<RenderRecord> {\n return this.client().createRender(spec);\n }\n\n /** A render's record, with its state, cost and result URLs. */\n get(id: string): Promise<RenderRecord> {\n return this.request<RenderRecord>('GET', `/v1/renders/${id}`);\n }\n\n /** Cancel a render that has not finished. Already terminal is a no-op. */\n cancel(id: string): Promise<RenderRecord> {\n return this.request<RenderRecord>('POST', `/v1/renders/${id}/cancel`, {});\n }\n\n /**\n * One more attempt for a render that failed with `attemptsExhausted`.\n * Returns the new render, linked to the old one; a render that is not in\n * that state answers 409.\n */\n async retry(id: string): Promise<RenderRecord> {\n return this.client().retryRender(id);\n }\n\n /**\n * Delete a render now rather than when retention would: the result, the\n * preview, and every signed URL that pointed at them. The record survives\n * as `expired`, so the receipt is still readable. A live render is\n * cancelled first.\n */\n delete(id: string): Promise<RenderRecord> {\n return this.request<RenderRecord>('DELETE', `/v1/renders/${id}`);\n }\n\n /** The project's renders, newest first, a page at a time. */\n list(options: { limit?: number; cursor?: string } = {}): Promise<{\n renders: RenderRecord[];\n cursor: string | null;\n }> {\n const query = new URLSearchParams();\n if (options.limit) query.set('limit', String(options.limit));\n if (options.cursor) query.set('cursor', options.cursor);\n const suffix = query.toString() ? `?${query}` : '';\n return this.request('GET', `/v1/renders${suffix}`);\n }\n\n /** The quote for a spec: a likely cost and a maximum, in USD. */\n estimate(\n spec: Pick<RenderSpec, 'quality' | 'output' | 'advanced'>,\n ): Promise<CostEstimate> {\n return this.request<CostEstimate>('POST', '/v1/estimate', spec);\n }\n}\n\n/**\n * Batches from a server: manifests you already have, added by the hundred\n * and rendered behind one cost ceiling. `renderBatch()` builds on this.\n *\n * const batch = await api.batches.open({ key: 'fall-2026-v3', lane: 'batch', maxCost: 600 });\n * for await (const line of readLines('manifests.jsonl')) {\n * const item = JSON.parse(line);\n * batch.add({ key: item.key, spec: item.spec, metadata: item.metadata });\n * if (batch.buffered >= 100) await batch.flush();\n * }\n * await batch.close();\n * await batch.wait({ onProgress: (p) => console.log(`${p.completed}/${p.total}`) });\n */\nclass BatchesApi {\n constructor(private readonly client: () => Bakery3Client) {}\n\n /** Open, or re-open by key. */\n async open(request: BatchOpenRequest): Promise<Batch> {\n const client = this.client();\n return new Batch(client, await client.openBatch(request));\n }\n\n /** A batch by id, with its latest counts. */\n async get(id: string): Promise<Batch> {\n const client = this.client();\n return new Batch(client, await client.getBatch(id));\n }\n}\n\nexport { Bakery3Error, BatchPageRefused } from '../errors.js';\nexport type { Batch } from '../batch.js';\nexport type { RenderSet } from '../set.js';\nexport type { Recorded, RenderSetFailure, RenderSetImage } from '../set.js';\nexport type { TestRunOptions } from '../testRun.js';\nexport type {\n BatchEnvironment,\n BatchProduct,\n BatchRoom,\n ImageShot,\n ProductSkip,\n RenderBatchOptions,\n RenderBatchProgress,\n RenderBatchRecorded,\n Shot,\n ShotSettings,\n VideoShot,\n View,\n} from './renderBatch.js';\nexport type { Angle, ViewWord } from '../frame.js';\nexport type { BatchProgress, FlushOptions, WaitOptions } from '../batch.js';\nexport type {\n BatchItemRecord,\n BatchItemsPage,\n RetryPolicy,\n} from '../client.js';\nexport { verifyWebhook } from './webhook.js';\nexport type {\n BatchAddRequest,\n BatchAddResponse,\n BatchExportLine,\n BatchItemOutcome,\n BatchItemRequest,\n BatchOpenRequest,\n BatchRecord,\n CostEstimate,\n FrameSequenceIndex,\n RenderRecord,\n RenderSpec,\n} from '../protocol/index.js';\n"]}
1
+ {"version":3,"sources":["../../src/protocol/manifest.ts","../../src/protocol/quality.ts","../../src/protocol/asset.ts","../../src/protocol/batch.ts","../../src/errors.ts","../../src/version.ts","../../src/warn.ts","../../src/client.ts","../../src/pollFailures.ts","../../src/batch.ts","../../src/set.ts","../../src/testRun.ts","../../src/frame.ts","../../src/presets/catalog.gen.ts","../../src/presets/rooms.gen.ts","../../src/node/renderBatch.ts","../../src/node/webhook.ts","../../src/node/index.ts"],"names":["message","who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AA,CAAM,QAAA,EAAS,GAAI,CAAA,CAAA,EAAI,KAAK,CAAA,CAAA,GAAK,EAAA;AAChD,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,CAAA,WAAA,EAAc,MAAM,CAAA,CAAE,CAAA;AAAA,EACnD;AAAA;AAAA,EAGA,SACE,IAAA,EACuB;AACvB,IAAA,OAAO,IAAA,CAAK,OAAA,CAAsB,MAAA,EAAQ,cAAA,EAAgB,IAAI,CAAA;AAAA,EAChE;AACF,CAAA;AAeA,IAAM,aAAN,MAAiB;AAAA,EACf,YAA6B,MAAA,EAA6B;AAA7B,IAAA,IAAA,CAAA,MAAA,GAAA,MAAA;AAAA,EAA8B;AAAA,EAA9B,MAAA;AAAA;AAAA,EAG7B,MAAM,KAAK,OAAA,EAA2C;AACpD,IAAA,MAAM,MAAA,GAAS,KAAK,MAAA,EAAO;AAC3B,IAAA,OAAO,IAAI,KAAA,CAAM,MAAA,EAAQ,MAAM,MAAA,CAAO,SAAA,CAAU,OAAO,CAAC,CAAA;AAAA,EAC1D;AAAA;AAAA,EAGA,MAAM,IAAI,EAAA,EAA4B;AACpC,IAAA,MAAM,MAAA,GAAS,KAAK,MAAA,EAAO;AAC3B,IAAA,OAAO,IAAI,KAAA,CAAM,MAAA,EAAQ,MAAM,MAAA,CAAO,QAAA,CAAS,EAAE,CAAC,CAAA;AAAA,EACpD;AACF,CAAA","file":"index.cjs","sourcesContent":["/**\n * The scene manifest: a GLB plus a versioned sidecar.\n *\n * glTF carries geometry, materials, textures, cameras, lights, skins and\n * morph targets well. What it does not carry is the state the running\n * application was in at the moment somebody pressed Render: which objects\n * were hidden, which of four cameras was live, what the renderer's tone\n * mapping was set to, which materials the SDK could not translate and what\n * the developer wants done about them. So the GLB is an asset and this is\n * the contract. `protocolVersion` is versioned independently of the SDK, of\n * the renderer and of the material translator, which is what makes a render\n * from six months ago reproducible.\n *\n * Everything here is JSON (no class instances, no functions) because it\n * travels from the browser through the control plane to the render worker\n * and is stored verbatim for replay.\n */\n\nimport type { AnimationSpec } from './animation.js';\nimport type { RoomPresetSpec } from './room.js';\nimport type { MaterialShaderSpec } from './shader.js';\n\n/**\n * Bumped only for a change a worker cannot read straight through. A worker\n * refuses a manifest whose major it does not implement rather than guessing;\n * a plausible wrong image is worse than a refusal.\n *\n * 2.0: `shaders`, node-material graphs. Without them a worker would render\n * the exporter's gray stand-in as if it were the material.\n *\n * 3.0: `animation`, baked per-frame channels. Without them a worker would\n * hand back one still of frame zero for a five-second orbit.\n *\n * 4.0: `room`, a room preset the worker rebuilds itself (see room.ts). The\n * room's geometry is deliberately not in the GLB, so a worker that ignored\n * the field would render the product floating in nothing.\n *\n * 5.0: `environment.fog`, the scene's fog traced as a volume. A worker that\n * ignored the field would hand back the scene in clear air.\n */\nexport const PROTOCOL_VERSION = '5.0';\n\n/** What a manifest with a room preset and no fog is stamped with. */\nexport const PROTOCOL_VERSION_ROOM = '4.0';\n\n/** What an animated manifest without a room preset is stamped with. */\nexport const PROTOCOL_VERSION_ANIMATED = '3.0';\n\n/**\n * What a manifest carrying no animation is stamped with. A still is still a\n * 2.0 document (every field in it means what it meant before), so stamping\n * it higher would only strand it at a worker not yet updated. See\n * `protocolVersionFor`.\n */\nexport const PROTOCOL_VERSION_STILL = '2.0';\n\n/** Every major the current worker can render faithfully. */\nexport const SUPPORTED_PROTOCOL_MAJORS = ['1', '2', '3', '4', '5'];\n\n/**\n * The version to stamp on a manifest: the lowest major that reads every\n * field in it faithfully (5.0 with fog, 4.0 with a room preset, 3.0 if\n * animated, 2.0 otherwise), so a manifest never strands itself at an older\n * worker for a field it does not carry.\n */\nexport function protocolVersionFor(manifest: {\n animation?: AnimationSpec;\n room?: RoomPresetSpec;\n environment?: { fog?: FogSpec };\n}): string {\n if (manifest.environment?.fog) return PROTOCOL_VERSION;\n if (manifest.room) return PROTOCOL_VERSION_ROOM;\n return manifest.animation\n ? PROTOCOL_VERSION_ANIMATED\n : PROTOCOL_VERSION_STILL;\n}\n\n/** `sha256:<64 hex>`: how every immutable blob is named. See asset.ts. */\nexport type AssetHash = string;\n\nexport type Vec3 = [number, number, number];\n/** glTF order: x, y, z, w. Any conversion to another order happens in the worker. */\nexport type Quat = [number, number, number, number];\nexport type Matrix4 = number[];\n\n// ---------------------------------------------------------------------------\n// Camera\n// ---------------------------------------------------------------------------\n\n/**\n * The active camera.\n *\n * Written out in full rather than referenced into the GLB by name: a live\n * R3F camera is frequently not in the scene graph the exporter walked (it\n * is held by `useThree`, or by drei's controls), so it travels as data.\n */\nexport type CameraSpec =\n | {\n type: 'perspective';\n /** Vertical FOV in degrees, matching three's `PerspectiveCamera.fov`. */\n fov: number;\n /**\n * The viewport's aspect ratio at capture time.\n *\n * The render matches vertical fov, so a wider output shows more at the\n * sides rather than cropping the top and bottom. Recorded so the\n * control plane can default the output to the viewport's own shape.\n */\n aspect?: number;\n near: number;\n far: number;\n position: Vec3;\n quaternion: Quat;\n /** three's `.zoom`, which scales the projection and is easy to forget. */\n zoom?: number;\n /** Present when the developer named a camera; only ever a label. */\n name?: string;\n /**\n * Depth of field, off unless present. `fStop` is a full-frame f-number\n * at this `fov`; `focalDistance` is in metres along the view axis.\n * `target` is the world point it was measured to: a worker that reads\n * it keeps that point sharp on every frame of a clip, and one that\n * does not still focuses the first frame right.\n */\n focus?: { fStop: number; focalDistance: number; target?: Vec3 };\n }\n | {\n type: 'orthographic';\n left: number;\n right: number;\n top: number;\n bottom: number;\n near: number;\n far: number;\n position: Vec3;\n quaternion: Quat;\n zoom?: number;\n name?: string;\n };\n\n// ---------------------------------------------------------------------------\n// Runtime state: the part glTF cannot express\n// ---------------------------------------------------------------------------\n\n/**\n * What the application had done to the scene by render time.\n *\n * Visibility is an explicit hidden list rather than \"export only what is\n * visible\" on purpose: the GLB is content-addressed and cached, and a\n * configurator that toggles one part between renders would otherwise miss\n * the cache every time. Ship one GLB with every variant in it, then hide\n * per render: the first render uploads the model, the next one uploads a\n * few KB.\n */\nexport type RuntimeState = {\n /** Object ids (see `objectId` in capture) the SDK found with `visible === false`. */\n hiddenObjectIds?: string[];\n /**\n * Transform overrides, for objects the application moved after export or\n * that were exported from a shared cached GLB.\n */\n transforms?: Array<{\n objectId: string;\n position?: Vec3;\n quaternion?: Quat;\n scale?: Vec3;\n }>;\n /** Morph target influences, by object. */\n morphs?: Array<{ objectId: string; influences: number[] }>;\n /** Current skeletal pose as bone-local matrices. */\n poses?: Array<{ objectId: string; boneMatrices: Matrix4[] }>;\n /**\n * `InstancedMesh` transforms. Written here rather than baked into the GLB\n * so changing a layout does not re-upload the geometry.\n *\n * `matrices` is flat: `count * 16` numbers, column-major, exactly as three\n * stores `instanceMatrix.array`. Nested arrays would add two bytes of JSON\n * per instance, which for a large scatter is a measurable part of the\n * manifest.\n */\n instances?: Array<{ objectId: string; count: number; matrices: number[] }>;\n /**\n * Opaque application state, echoed back on the render record. Never read\n * by the renderer; it exists so a stored render can say which sofa.\n */\n productState?: Record<string, unknown>;\n};\n\n// ---------------------------------------------------------------------------\n// Environment and lighting\n// ---------------------------------------------------------------------------\n\nexport type EnvironmentSpec = {\n /** An HDRI/EXR the SDK found on `scene.environment`, content-addressed. */\n hdri?: AssetHash;\n /** three's `Scene.environmentIntensity`. */\n intensity?: number;\n /** three's `Scene.environmentRotation`, radians, XYZ euler. */\n rotation?: Vec3;\n /**\n * The scene's `AmbientLight`s as one flat term. It ADDS to the HDRI, as it\n * does in three, and like three's it lights diffuse surfaces only: a\n * mirror reflects the environment and nothing of this.\n */\n ambient?: { color: string; intensity: number };\n /**\n * Background. `transparent` is the default: a still that composites is\n * worth more to a catalog pipeline than one with a baked backdrop.\n */\n background?:\n | { type: 'transparent' }\n | { type: 'color'; color: string }\n | { type: 'environment'; blurriness?: number };\n /** The scene's fog, when it has one the renderer can trace. */\n fog?: FogSpec;\n};\n\n/**\n * three's `FogExp2`, which the renderer traces as a volume filling the scene:\n * air that scatters the light passing through it, so a lamp or an emissive\n * mesh sits in a glow and throws visible beams.\n *\n * `density` is three's own number. three fades a surface by\n * `exp(-(density · d)²)`; a real volume thins light by `exp(-σ · d)`. The\n * two cannot agree at every distance, so the renderer uses σ = `density`,\n * which makes them agree where three's fog has taken all but 1/e of the\n * surface: nearer than that the render is a little foggier than the\n * viewport, further a little clearer.\n *\n * `color` is the fog's TINT (`#rrggbb`, as three holds it): its hue colors\n * the scattered light, its brightness is ignored. How bright traced fog\n * looks is decided by the light in it, which a rasterizer's fog color has to\n * guess. A linear `Fog` has no volume it corresponds to and is not carried;\n * the compatibility report says so.\n */\nexport type FogSpec = {\n color: string;\n density: number;\n};\n\n/**\n * Lights the SDK lifted out of the scene graph.\n *\n * Exported here as well as in the GLB because glTF's punctual-lights\n * extension has no notion of three's intensity-unit drift, no area lights\n * and no IES. The sidecar is where the good version lives and the GLB copy\n * is the fallback.\n */\nexport type LightSpec = {\n objectId: string;\n type: 'directional' | 'point' | 'spot' | 'area' | 'hemisphere';\n color: string;\n /**\n * three's own value, unconverted. The worker owns the unit conversion so\n * the physics is written down in one place.\n */\n intensity: number;\n /**\n * World position. A hemisphere light's is its up axis instead (three\n * normalizes it; absent is `[0, 1, 0]`).\n */\n position?: Vec3;\n /**\n * World point a directional, spot or area light aims at, as three's\n * `light.target` (or `lookAt`) does. Absent aims a directional or spot\n * light at the origin and leaves an area light facing straight down.\n */\n target?: Vec3;\n /**\n * Hemisphere lights only: the color from below (`groundColor`). `color` is\n * the sky. Absent is black, a sky with no ground bounce.\n */\n groundColor?: string;\n distance?: number;\n decay?: number;\n angle?: number;\n penumbra?: number;\n /** Area lights only, in world units. */\n size?: { width: number; height: number };\n /** Angular diameter in degrees: the shadow-softness dial for a sun. */\n angleDeg?: number;\n /** An IES profile, content-addressed. */\n ies?: AssetHash;\n castShadow?: boolean;\n};\n\n// ---------------------------------------------------------------------------\n// Color management\n// ---------------------------------------------------------------------------\n\n/**\n * The renderer's own color settings, copied verbatim.\n *\n * This is the difference between a render that looks like the developer's\n * app and one that is subtly, unfixably wrong. three's defaults changed in\n * r152 and again in r155; reading the live renderer beats assuming any of\n * them.\n */\nexport type ColorSpec = {\n outputColorSpace: 'srgb' | 'srgb-linear' | 'display-p3';\n toneMapping:\n | 'none'\n | 'linear'\n | 'reinhard'\n | 'cineon'\n | 'aces-filmic'\n | 'agx'\n | 'neutral';\n toneMappingExposure: number;\n};\n\n// ---------------------------------------------------------------------------\n// Material fallbacks and compatibility\n// ---------------------------------------------------------------------------\n\n/**\n * What to do with a material the renderer cannot be given honestly.\n *\n * Arbitrary GLSL does not translate, and the answer is to say so rather\n * than quietly render gray. A fallback is the developer's explicit\n * override, from `<Bakery3Material render={...}>` or from\n * `material.userData.bakery3.fallback`.\n */\nexport type MaterialFallback = {\n /** The material's uuid in the exported GLB. */\n materialId: string;\n type: 'physical';\n color?: string;\n metalness?: number;\n roughness?: number;\n clearcoat?: number;\n clearcoatRoughness?: number;\n transmission?: number;\n thickness?: number;\n ior?: number;\n emissive?: string;\n emissiveIntensity?: number;\n opacity?: number;\n sheen?: number;\n sheenColor?: string;\n iridescence?: number;\n anisotropy?: number;\n};\n\nexport type CompatibilitySeverity = 'info' | 'warning' | 'error';\n\n/**\n * One thing the SDK could not promise to reproduce: what it is, where it\n * lives in the tree, why, and the fix, without opening a debugger.\n */\nexport type CompatibilityIssue = {\n code: string;\n severity: CompatibilitySeverity;\n message: string;\n /** `<Car>/<Body>/<Paint>`: the path a developer can actually find. */\n path?: string;\n objectId?: string;\n materialId?: string;\n materialName?: string;\n materialType?: string;\n /** Deep link into the docs. */\n docs?: string;\n};\n\nexport type CompatibilityReport = {\n /** 0 to 1. Objects that will render faithfully, weighted by triangle count. */\n score: number;\n issues: CompatibilityIssue[];\n /** Rolled up for the devtools panel and the render record. */\n counts: { info: number; warning: number; error: number };\n};\n\n// ---------------------------------------------------------------------------\n// Output and quality\n// ---------------------------------------------------------------------------\n\n/** Presets, not raw renderer settings. Most scenes need only these. */\nexport type QualityPreset = 'preview' | 'studio' | 'ultra';\n\nexport type OutputFormat =\n 'png' | 'jpeg' | 'webp' | 'exr' | 'mp4' | 'webm' | 'png-sequence';\n\n/**\n * H.264 in mp4, VP9 in webm: an encoded video, opaque, written by the\n * renderer's own muxer. Both require `manifest.animation`: there is no\n * sensible video of a still, and guessing at one is not the worker's job.\n */\nexport const VIDEO_FORMATS: OutputFormat[] = ['mp4', 'webm'];\n\n/**\n * Every frame of a clip as its own PNG, alpha kept, delivered as one\n * uncompressed tar (`render.tar`) with a `frames.json` index first. Each\n * frame is exactly what a `png` still of that pose would be: the same color\n * pipeline, the background and the shadow catcher in alpha as a still has\n * them, straight (unassociated) alpha. For a compositor that puts the\n * product between layers of its own, which an mp4 cannot feed.\n */\nexport const SEQUENCE_FORMATS: OutputFormat[] = ['png-sequence'];\n\n/** An encoded video container: opaque, one file, no per-frame alpha. */\nexport function isVideoFormat(format: OutputFormat): boolean {\n return VIDEO_FORMATS.includes(format);\n}\n\n/** One file per frame, packed in a tar. */\nexport function isSequenceFormat(format: OutputFormat): boolean {\n return SEQUENCE_FORMATS.includes(format);\n}\n\n/**\n * A format that renders every frame of `manifest.animation` rather than one\n * still: a video or a sequence. It needs an animation, it is priced at the\n * clip rate, and the format is part of what the trace produces (so it is in\n * the cache key, where a still's format is not).\n */\nexport function isClipFormat(format: string | undefined): boolean {\n return (\n format !== undefined &&\n (isVideoFormat(format as OutputFormat) ||\n isSequenceFormat(format as OutputFormat))\n );\n}\n\n/**\n * The result's file name, which is also its name in storage: the worker\n * writes it and the control plane signs a PUT for it before the render runs,\n * so both sides read it from here.\n */\nexport function outputFileName(format: OutputFormat): string {\n if (isSequenceFormat(format)) return 'render.tar';\n return `render.${format === 'jpeg' ? 'jpg' : format}`;\n}\n\n/**\n * Bits per channel of a PNG output, a still's or a sequence's frames, unless\n * `bitDepth` says otherwise. 16, so a sequence's frame is the very PNG a\n * still of that pose is, and a compositor grading it has the headroom a\n * still gives. 8 is for a pipeline that ends in 8 bits anyway: measured\n * 2026-10-03 at 1400 × 1504, it is 0.98 MB a frame against 2.24 MB, and the\n * same time to trace and write.\n */\nexport const PNG_BIT_DEPTH_DEFAULT = 16;\n\n/** The first file in a `png-sequence` tar: what the rest of it is. */\nexport const FRAME_SEQUENCE_INDEX = 'frames.json';\n\n/**\n * `frame_00000.png`, zero-based like `animation.frameCount`'s frames, so file\n * `k` is the pose a channel's `k`-th sample describes.\n */\nexport function frameFileName(frame: number): string {\n return `frame_${String(frame).padStart(5, '0')}.png`;\n}\n\n/** `frames.json`, at the head of a `png-sequence` tar. */\nexport type FrameSequenceIndex = {\n fps: number;\n frameCount: number;\n width: number;\n height: number;\n bitDepth: 8 | 16;\n /** In frame order, one per frame: `frameFileName(0)` onwards. */\n files: string[];\n};\n\nexport type OutputSpec = {\n width: number;\n height: number;\n format: OutputFormat;\n /** JPEG/WebP only, 1 to 100. */\n quality?: number;\n /**\n * PNG and `png-sequence` only: bits per channel, 16 unless 8 is asked\n * for (`PNG_BIT_DEPTH_DEFAULT`).\n */\n bitDepth?: 8 | 16;\n /** Force an opaque background even when the environment is transparent. */\n opaque?: boolean;\n};\n\n/**\n * Escape hatch under the presets. Present so an expert is never blocked,\n * absent from the quickstart so a beginner is never asked to become a\n * rendering expert to get one image.\n */\nexport type AdvancedRenderSettings = {\n samples?: number;\n maxBounces?: number;\n diffuseBounces?: number;\n glossyBounces?: number;\n transmissionBounces?: number;\n /** Adaptive sampling noise floor: the real cost dial once denoising is on. */\n adaptiveThreshold?: number;\n denoise?: boolean;\n denoiser?: 'OPTIX' | 'OPENIMAGEDENOISE';\n /** Pays for itself with many emitters, costs overhead with few. */\n lightTree?: boolean;\n /**\n * Light that reaches a surface through glass: the bright pool under a\n * tumbler, the focus line beneath a lens. Off by default: with no caustic\n * paths a transmissive object casts a solid shadow, which is also what the\n * viewport's shadow maps draw, and tracing them costs samples a product\n * shot rarely needs.\n *\n * `'soft'` lets the path tracer find caustic paths itself, with the glossy\n * filter and the indirect clamp (both of which exist to hide caustics)\n * switched off. Unbiased, and slow to converge: a hard light through\n * curved glass stays grainy at studio samples.\n *\n * `'sharp'` adds a dedicated shadow-caustic solver on top: every scene\n * lamp casts caustics, every transmissive mesh is a caster, and every\n * other mesh (the shadow catcher included) receives them. This is what\n * makes a glass on a table converge at normal sample counts. It handles a\n * single refractive object between a lamp and a surface; light from an\n * HDRI or an emissive mesh still goes the `'soft'` way.\n *\n * The solver takes over lamp light through a caster rather than adding to\n * the traced paths, and it only follows light that goes straight through.\n * A faceted stone, whose light leaves after internal reflections, comes\n * back under `'sharp'` with no caustic at all. Cut gems want `'soft'`.\n *\n * Absent is off. There is no boolean on purpose: `caustics: true` would\n * have to mean one of the two. Changes pixels, so it is in the cache key.\n */\n caustics?: 'soft' | 'sharp';\n /**\n * A ceiling on how bright one indirect sample may be, in scene radiance.\n * Absent is the renderer's own default, which `caustics` switches off: a\n * caustic's focus is a very bright indirect sample, and capping it dims\n * the focus. That is right for a still and wrong for a clip, because the\n * rare uncapped hit lands on different pixels every frame, the denoiser\n * smears each one into a soft patch, and the patches boil. For caustics\n * in motion, start at 30 (the pool under a lens is still its full\n * brightness there) and trace larger than you publish.\n *\n * Set, it wins over what `caustics` would have chosen. Changes pixels, so\n * it is in the cache key, present only when set.\n */\n clampIndirect?: number;\n /**\n * Multiplies the converted energy of every light lifted from the scene\n * graph (directional, point, spot, area and the ambient dome) and leaves\n * the HDRI environment alone. The worker's unit table is physics and stays\n * fixed; this dial is for the residual gap, where a viewport (legacy-lights\n * intensities, usually) reads brighter than the physically converted lamps\n * do. One scalar, so the ratio between the scene's lights is preserved.\n * Default 1. Changes pixels, so it is in the cache key.\n */\n lightScale?: number;\n /**\n * Ground the product with a traced shadow catcher. Defaults on for\n * transparent/solid output and off for a visible environment background.\n */\n shadowCatcher?: boolean;\n /** Catcher size, as a multiple of the model's largest dimension. */\n shadowPad?: number;\n /**\n * The renderer's view transform override. Changes pixels, so it is in the\n * cache key. Pinning one also switches off `toneCurveEmulation`: an\n * explicit name is a statement about what the render should look like.\n */\n viewTransform?: string;\n /**\n * Reproduce three's tone mapping exactly instead of substituting the\n * nearest native view transform. On by default, and it is what makes a\n * traced frame the same color as the viewport it came from.\n *\n * Turn it off to get the substitution: a wider, more forgiving curve for a\n * scene whose viewport was never the reference. Changes pixels, so it is\n * in the cache key.\n */\n toneCurveEmulation?: boolean;\n /** Seconds. The worker stops the render rather than billing an unbounded job. */\n timeoutSeconds?: number;\n};\n\n// ---------------------------------------------------------------------------\n// The manifest\n// ---------------------------------------------------------------------------\n\n/**\n * Everything one render needs, minus the bytes.\n *\n * Typically a few KB. The heavy things (the GLB, textures, the HDRI) are\n * `sha256:` references that the control plane resolves against storage the\n * SDK already filled (see asset.ts).\n */\nexport type SceneManifest = {\n protocolVersion: string;\n sdkVersion: string;\n /** The exported GLB. */\n sceneAsset: AssetHash;\n /**\n * Extra blobs this scene needs that are not inside the GLB: an HDRI, an\n * IES profile, a texture the SDK stripped out to keep the GLB cacheable.\n */\n assets?: AssetHash[];\n camera: CameraSpec;\n runtime?: RuntimeState;\n environment?: EnvironmentSpec;\n lights?: LightSpec[];\n color: ColorSpec;\n fallbacks?: MaterialFallback[];\n /**\n * Node materials, as portable shader graphs (see shader.ts). The GLB still\n * carries the mesh; the material the exporter wrote for it is a stand-in\n * that the worker replaces wholesale with the rebuilt graph.\n */\n shaders?: MaterialShaderSpec[];\n /**\n * Baked per-frame motion (see animation.ts). Present only for a video,\n * and its presence is what makes this a 3.0 manifest.\n *\n * Not inside `runtime` on purpose: runtime is the one state the\n * application was in when Render was pressed, and every field in it is a\n * single value. A sequence is a different kind of thing.\n */\n animation?: AnimationSpec;\n /**\n * A room preset around the product (see room.ts). Its geometry, lights\n * and sky are not in the GLB or in `lights`: the worker rebuilds all of it\n * from the published definition, so a product in a room uploads only the\n * product. Presence makes this a 4.0 manifest.\n */\n room?: RoomPresetSpec;\n compatibility?: CompatibilityReport;\n /**\n * What the scene weighs, measured by the SDK at capture. The control plane\n * prices with it (a dense scene traces slower per pixel and unwraps slower\n * per object), so the quote a job is accepted under is the same one\n * `estimate()` gave with the same numbers. Operational, not visual: it is\n * outside every cache key.\n */\n stats?: {\n triangles: number;\n /** Bytes of texture the manifest's shader graphs sample, when known. */\n textureBytes?: number;\n /**\n * Distinct materials that emit light: a standard material with a\n * non-black emissive color, an unlit material (rendered as emission), or\n * a node material with an emission graph. The worker turns its light\n * tree on from this. Only the SDK can count them, since the GLB's\n * materials are opaque to the control plane.\n */\n emitters?: number;\n /**\n * How much of the sky above the camera the scene's geometry hides, 0 for\n * an open set and 1 inside a closed room (`SceneComplexity`). Walls keep\n * light bouncing, which is most of what makes an interior slow to render,\n * so the quote reads it. A preset room's stand-in counts, though it is not\n * uploaded: it stands for the room the renderer builds.\n */\n enclosure?: number;\n /** Meshes the scene draws, instances counted: how full it is. */\n objects?: number;\n };\n /**\n * Where the scene came from. Diagnostics only, but \"which three version\"\n * is the first question every support conversation starts with.\n */\n source?: {\n three?: string;\n r3f?: string;\n renderer?: string;\n userAgent?: string;\n };\n};\n\n/** A manifest plus what to make from it. This is the render request body. */\nexport type RenderSpec = {\n manifest: SceneManifest;\n quality: QualityPreset;\n output: OutputSpec;\n advanced?: AdvancedRenderSettings;\n /**\n * Hard ceiling in USD. Exceeded at estimate time means the job is refused\n * before it is admitted: `RenderBudgetExceeded`, not a surprise bill.\n */\n maxCost?: number;\n /** Emit a low-sample preview partway through. On by default for `studio`. */\n preview?: boolean;\n /** Echoed on the render record and every webhook. */\n metadata?: Record<string, unknown>;\n /**\n * A resubmit with the same key returns the existing render while it is\n * running or once it has completed, never a second charge. This is what\n * makes the SDK's own retries safe. A key whose render failed, was\n * cancelled or expired is free again: nothing was charged, and the\n * resubmit renders.\n */\n idempotencyKey?: string;\n /**\n * `high` puts this render ahead of the account's other waiting work in\n * the same lane: the hero shot before the rest of the queue. It never\n * jumps a lane; a person waiting still goes first.\n */\n priority?: 'normal' | 'high';\n};\n","/**\n * Quality presets: three words instead of a renderer manual.\n *\n * The three names are the public surface. The numbers below are read by the\n * worker, the estimator and the cache key from this one table, so they\n * cannot drift apart. `version` is here because changing any number changes\n * pixels: it travels in the render record and in the render cache key, so a\n * catalog that re-renders a SKU never silently gets a different image.\n */\n\nimport type { QualityPreset } from './manifest.js';\n\nexport type QualitySettings = {\n /** Bumped whenever any number in this preset changes. */\n version: number;\n /** A ceiling, not a target: adaptive sampling decides when a pixel stops. */\n samples: number;\n /**\n * The real cost dial. With adaptive sampling on, this noise floor is what\n * ends a pixel; the renderer's own default is strict enough that most\n * pixels run to the ceiling anyway.\n */\n adaptiveThreshold: number;\n maxBounces: number;\n diffuseBounces: number;\n glossyBounces: number;\n transmissionBounces: number;\n denoise: boolean;\n /** Long edge, in px, when the caller gives no explicit output size. */\n defaultLongEdge: number;\n /** Emit a low-sample preview partway through. */\n preview: boolean;\n /** Samples for that preview. Small enough to arrive in about a second. */\n previewSamples: number;\n};\n\nexport const QUALITY: Record<QualityPreset, QualitySettings> = {\n /**\n * \"Show me roughly what this will look like.\" Cheap enough to sit inside a\n * click, noisy enough that nobody will ship it.\n *\n * No denoiser, since version 3 (2026-10-03): with it, 32 samples of a\n * product came out close to a studio render, so the cheapest tier was a\n * finished image at half the price. The grain says draft, every choice a\n * preview is for (framing, light, materials, color) still reads through\n * it, and most of a preview's time was the denoiser.\n */\n preview: {\n version: 3,\n samples: 32,\n adaptiveThreshold: 0.08,\n maxBounces: 4,\n diffuseBounces: 2,\n glossyBounces: 4,\n transmissionBounces: 4,\n denoise: false,\n defaultLongEdge: 1024,\n preview: false,\n previewSamples: 16,\n },\n\n /**\n * The default. Deep enough on glossy and transmission to carry glaze,\n * metal and glass, which is where a product shot lives, and shallow on\n * diffuse, which buys almost nothing on a product against a transparent\n * background. The threshold ends most pixels well before the ceiling; the\n * denoiser carries the noisiest ones.\n */\n studio: {\n version: 2,\n samples: 256,\n adaptiveThreshold: 0.02,\n maxBounces: 8,\n diffuseBounces: 3,\n glossyBounces: 8,\n transmissionBounces: 8,\n denoise: true,\n defaultLongEdge: 2048,\n preview: true,\n previewSamples: 24,\n },\n\n /**\n * For the hero image that goes on the homepage. Roughly 8x studio's sample\n * ceiling and a much stricter threshold.\n */\n ultra: {\n version: 1,\n samples: 2048,\n adaptiveThreshold: 0.005,\n maxBounces: 16,\n diffuseBounces: 6,\n glossyBounces: 16,\n transmissionBounces: 16,\n denoise: true,\n defaultLongEdge: 4096,\n preview: true,\n previewSamples: 32,\n },\n};\n\n/** The preset with any `advanced` overrides folded in. */\nexport function resolveQuality(\n preset: QualityPreset,\n advanced?: Partial<QualitySettings> & {\n samples?: number;\n maxBounces?: number;\n },\n): QualitySettings {\n const base = QUALITY[preset];\n if (!advanced) return base;\n return { ...base, ...stripUndefined(advanced) };\n}\n\nfunction stripUndefined<T extends object>(value: T): Partial<T> {\n return Object.fromEntries(\n Object.entries(value).filter(([, v]) => v !== undefined),\n ) as Partial<T>;\n}\n","/**\n * Content-addressed assets.\n *\n * A product scene can be hundreds of megabytes, and the second render of it\n * usually differs from the first by a camera angle. So every immutable blob\n * is named by the SHA-256 of its own bytes and uploaded at most once. The\n * flow is three round trips and no wasted bytes:\n *\n * hash locally -> POST /assets/check -> PUT only what is missing\n *\n * Nothing here knows about a bucket or a region. The control plane signs,\n * the browser puts, the worker reads by hash.\n */\n\n/** `sha256:` + 64 lowercase hex. */\nexport const ASSET_HASH_PATTERN = /^sha256:[0-9a-f]{64}$/;\n\nexport function isAssetHash(value: unknown): value is string {\n return typeof value === 'string' && ASSET_HASH_PATTERN.test(value);\n}\n\nexport type AssetKind =\n 'scene' | 'texture' | 'hdri' | 'ies' | 'geometry' | 'animation';\n\nexport type AssetDescriptor = {\n hash: string;\n kind: AssetKind;\n bytes: number;\n contentType: string;\n /** Diagnostics and the devtools' upload list; never used for addressing. */\n name?: string;\n};\n\n/** Request body for \"which of these do you already have?\". */\nexport type AssetCheckRequest = {\n assets: AssetDescriptor[];\n};\n\n/**\n * The answer, plus a signed PUT for each miss.\n *\n * The presigned URL is a capability, not a credential: one object, one\n * method, one expiry. It lets the browser upload straight to storage without\n * the control plane ever touching the bytes.\n */\nexport type AssetCheckResponse = {\n /** Hashes already in storage. Do not upload these. */\n present: string[];\n /** One signed PUT per hash that is missing. */\n uploads: Array<{\n hash: string;\n url: string;\n /**\n * Headers the signature covers. A presigned PUT is signed over an exact\n * header set, so sending more or fewer than these is a 403. Pass them\n * through verbatim.\n */\n headers?: Record<string, string>;\n expiresAt: number;\n }>;\n};\n\n/**\n * `DELETE /v1/assets/:hash`. Secret key only. The stored file and its\n * record are gone; the next render that needs it uploads it again.\n */\nexport type AssetDeleteResponse = {\n hash: string;\n /** False when the project held no file with this hash: not an error. */\n deleted: boolean;\n};\n\n/**\n * `DELETE /v1/assets`: one page of the project's files per call. Secret key\n * only. Call again while `more` is true.\n */\nexport type AssetsDeleteResponse = {\n /** Files deleted by this call. */\n deleted: number;\n /** Whether the project still holds files after this call. */\n more: boolean;\n};\n","/**\n * A batch: a customer's declared body of work.\n *\n * A catalog is products x finishes x cameras, a few thousand stills. The\n * customer opens a batch, adds items in pages, closes it, and reads one\n * ledger back. On the control plane every item is a render row with a\n * `batchId`, staged behind the queue proper and fed into it a page at a\n * time, so everything that holds for a render (the claim, the reservation,\n * single billing, webhooks, retention) holds for an item because it is one.\n */\n\nimport type { RenderSpec } from './manifest.js';\nimport type { BakeSpec } from './bake.js';\nimport type { RenderError } from './job.js';\n\nexport const BATCH_STATES = [\n 'open',\n 'sealed',\n 'paused',\n 'completed',\n 'cancelled',\n] as const;\nexport type BatchState = (typeof BATCH_STATES)[number];\n\n/** A page of items is at most this many. The SDK flushes at it. */\nexport const BATCH_PAGE_SIZE = 100;\n\n/**\n * And at most this many bytes of JSON. A hundred ordinary manifests are a\n * few hundred KB; a hundred manifests that each carry extracted shader\n * graphs are not, and a page is one request and one admission decision, so\n * it has to fit in both. The SDK closes a page at whichever limit comes\n * first; the route refuses a page over it by name.\n */\nexport const BATCH_PAGE_BYTES = 4 * 1024 * 1024;\n\n/**\n * One item's spec, as JSON, is at most this. The bytes belong in assets,\n * which are content addressed and uploaded once; a manifest this large is\n * carrying something inline that should have been one.\n */\nexport const BATCH_ITEM_BYTES = 900 * 1024;\n\n/**\n * How many items are in each state. `staged` items are admitted: priced,\n * reserved, waiting behind the queue proper. `queued` are in the queue and\n * `running` hold a worker. `refused` failed for a reason a retry would not\n * change (the scene's fault, or ours to explain); `failed` ran out of\n * attempts on an infrastructure failure. `adopted` were already completed\n * under the same key when they were added and cost nothing.\n */\nexport type BatchCounts = {\n staged: number;\n queued: number;\n running: number;\n completed: number;\n failed: number;\n refused: number;\n cancelled: number;\n adopted: number;\n};\n\nexport type BatchCost = {\n /** Sum of estimatedCost over admitted items. */\n estimated: number;\n /** Sum of maximumCost over admitted items: what admission reserved. */\n maximum: number;\n /** Sum of what completed items actually cost, so far. */\n actual: number;\n};\n\nexport type BatchRecord = {\n id: string;\n key: string;\n name?: string;\n kind: 'render' | 'bake';\n state: BatchState;\n lane: 'batch' | 'normal';\n maxParallel?: number;\n /** The customer's ceiling for the whole batch. */\n maxCost?: number;\n counts: BatchCounts;\n /** Every item ever admitted, adopted included. */\n total: number;\n /** How many are terminal. `done === total` once sealed is `completed`. */\n done: number;\n cost: BatchCost;\n /** Why it is paused, when it is: the breaker names the top refusal codes. */\n pausedReason?: string;\n createdAt: number;\n sealedAt?: number;\n finishedAt?: number;\n};\n\nexport type BatchOpenRequest = {\n /**\n * Stable across re-runs: the same key re-opens the same batch while it is\n * not terminal, and items already completed under their keys are adopted\n * rather than rendered again.\n */\n key: string;\n name?: string;\n kind?: 'render' | 'bake';\n /**\n * The ceiling for the whole batch, in dollars. A page that would take the\n * batch's maximum past it is refused whole.\n */\n maxCost?: number;\n /**\n * `batch` (the default) never runs ahead of a person in a configurator;\n * `normal` is the API's ordinary lane.\n */\n lane?: 'batch' | 'normal';\n /** Fewer parallel items than the plan allows, for a gentler budget. */\n maxParallel?: number;\n};\n\nexport type BatchItemRequest = {\n /**\n * The item's idempotency key, scoped to the project like every other\n * render's. `sku/finish/camera@v3` is the shape the docs suggest.\n */\n key: string;\n spec: RenderSpec | BakeSpec;\n metadata?: Record<string, unknown>;\n /** A ceiling for this one item, under the batch's. */\n maxCost?: number;\n};\n\nexport type BatchAddRequest = {\n items: BatchItemRequest[];\n /**\n * Price everything, admit nothing: the whole catalog's numbers before a\n * dollar is reserved.\n */\n dryRun?: boolean;\n};\n\nexport type BatchItemOutcome = {\n key: string;\n /** The render's id, when it was admitted or adopted. */\n id?: string;\n estimatedCost: number;\n maximumCost: number;\n /** Already completed under this key: attached at no cost. */\n adopted?: boolean;\n /**\n * Why this item, alone, was not admitted (a bad spec, an item over its own\n * maxCost). The page's other items are unaffected.\n */\n error?: RenderError;\n};\n\nexport type BatchAddResponse = {\n batch: BatchRecord;\n items: BatchItemOutcome[];\n};\n\n/** One line of `GET /v1/batches/:id/export`: the ledger, item by item. */\nexport type BatchExportLine = {\n key: string;\n id: string;\n state: string;\n resultUrl?: string;\n error?: RenderError;\n cost?: number;\n versions?: Record<string, unknown>;\n metadata?: Record<string, unknown>;\n};\n","/**\n * Errors a developer can act on.\n *\n * \"Render failed\" is a bad error. A traceback is a worse one. Every failure\n * that reaches the developer carries what went wrong, where, why, and what to\n * do about it, and `code` stays stable so the failure can also be branched on\n * in code.\n */\n\nimport type {\n BatchItemOutcome,\n BatchItemRequest,\n RenderErrorCode,\n RenderError,\n} from './protocol/index.js';\n\n/**\n * Codes the SDK can raise that the render protocol does not: a fault on the\n * way (`NetworkError`), a fault before anything left the browser\n * (`CaptureFailed`), the two refusals a batch page can meet as a whole (over\n * the batch's own ceiling, or after it was sealed), and the two ends of a job\n * that are not faults in the scene: it was cancelled (`Cancelled`), or its\n * files were deleted before it was read (`Expired`).\n */\nexport type Bakery3ErrorCode =\n | RenderErrorCode\n | 'NetworkError'\n | 'CaptureFailed'\n | 'BatchBudgetExceeded'\n | 'BatchClosed'\n | 'Cancelled'\n | 'Expired';\n\nexport class Bakery3Error extends Error {\n readonly code: Bakery3ErrorCode;\n readonly why?: string;\n readonly fix?: string;\n readonly docs?: string;\n readonly path?: string;\n readonly retryable: boolean;\n\n constructor(init: {\n code: Bakery3ErrorCode;\n message: string;\n why?: string;\n fix?: string;\n docs?: string;\n path?: string;\n retryable?: boolean;\n }) {\n super(init.message);\n this.name = 'Bakery3Error';\n this.code = init.code;\n this.why = init.why;\n this.fix = init.fix;\n this.docs = init.docs;\n this.path = init.path;\n this.retryable = init.retryable ?? false;\n showFixInStack(this);\n }\n\n static from(error: RenderError): Bakery3Error {\n return new Bakery3Error(error);\n }\n\n /**\n * The multi-line form, for a console or a devtools panel.\n *\n * `Error.message` stays one line so it reads correctly everywhere a message\n * is expected to be one: a log aggregator, a toast, a test name. `stack`\n * starts with this form, so an uncaught error prints its fix.\n */\n toDisplayString(): string {\n const lines = [this.message];\n if (this.path) lines.push('', 'Location:', this.path);\n if (this.why) lines.push('', 'Why:', this.why);\n if (this.fix) lines.push('', 'Fix:', this.fix);\n if (this.docs) lines.push('', 'Docs:', this.docs);\n return lines.join('\\n');\n }\n}\n\n/**\n * Make `stack` carry the whole error, not just its first line.\n *\n * A browser console, React's error overlay and Node all print an uncaught\n * error as its `stack`, which starts with `name: message`. The why, the fix\n * and the docs link would be invisible exactly when they are needed. So the\n * stack starts with `toDisplayString()` instead, followed by the original\n * frames, which stay lines beginning with \" at \" where the engine writes\n * them that way.\n *\n * A getter, not a value: a subclass sets its own `name` after this runs, and\n * its stack must say `RenderBudgetExceeded`, not `Bakery3Error`. Assigning to\n * `stack` still works, for a tool that rewrites it.\n */\nfunction showFixInStack(error: Bakery3Error): void {\n let raw: string | undefined;\n try {\n raw = error.stack;\n } catch {\n return;\n }\n try {\n Object.defineProperty(error, 'stack', {\n configurable: true,\n enumerable: false,\n get(this: Bakery3Error) {\n const frames = framesOf(raw, this.message);\n const head = `${this.name}: ${this.toDisplayString()}`;\n return frames ? `${head}\\n${frames}` : head;\n },\n set(this: Bakery3Error, value: unknown) {\n Object.defineProperty(this, 'stack', {\n configurable: true,\n enumerable: false,\n writable: true,\n value,\n });\n },\n });\n } catch {\n // A frozen or exotic error object keeps the engine's own stack.\n }\n}\n\n/**\n * The frames of an engine's stack, without its header.\n *\n * V8 (Chrome, Node, Edge) and Bun write `Name: message` and then one\n * \" at ...\" line per frame. Safari and Firefox write frames only\n * (`fn@file:1:2`), with no header to remove.\n */\nfunction framesOf(raw: string | undefined, message: string): string {\n if (!raw) return '';\n const lines = raw.split('\\n');\n const first = lines.findIndex((line) => /^\\s+at\\s/.test(line));\n if (first >= 0) return lines.slice(first).join('\\n');\n // No \"at\" lines: either frames in the Safari/Firefox form, or a V8 stack\n // with no frames, which is only its header.\n const header = lines[0] ?? '';\n return /^[\\w$.]*:/.test(header) && header.includes(message) ? '' : raw;\n}\n\n/** What was refused, so the refusal can say which dials bring the price down. */\nexport type BudgetedKind = 'render' | 'video' | 'bake';\n\nconst BUDGET_FIX: Record<BudgetedKind, string> = {\n render:\n 'Raise maxCost, lower the quality preset, or reduce the output resolution.',\n video:\n 'Raise maxCost, lower the quality preset or the resolution, or render fewer frames.',\n bake: 'Raise maxCost, lower the bake quality or the texture size, or bake fewer objects.',\n};\n\n/**\n * What a budget refusal can say. Every field is optional, because a refusal\n * from the API may carry fewer numbers than the SDK's own check knows.\n */\nexport type RenderBudgetInit = {\n message?: string;\n why?: string;\n fix?: string;\n docs?: string;\n /** The ceiling that was set. */\n maxCost?: number;\n estimatedCost?: number;\n maximumCost?: number;\n kind?: BudgetedKind;\n};\n\n/**\n * The budget refusal.\n *\n * Its own class because it is the one failure a developer is expected to\n * catch by type rather than by code: it is a normal, designed outcome of\n * setting `maxCost`, not a fault. Nothing was sent to a renderer and nothing\n * was charged.\n *\n * `instanceof RenderBudgetExceeded` catches both ways it is raised: the SDK's\n * own check before an upload (`new RenderBudgetExceeded(maxCost, quote,\n * kind)`, every number known), and the API's 402 (`new\n * RenderBudgetExceeded({ ... })`, with whatever numbers that answer carried,\n * for example from a browser token that has spent its allowance).\n */\nexport class RenderBudgetExceeded extends Bakery3Error {\n /** The ceiling that was set, when known. */\n readonly maxCost?: number;\n readonly estimatedCost?: number;\n /** The ceiling the job would have been accepted under: the number `maxCost` is held against. */\n readonly maximumCost?: number;\n readonly kind: BudgetedKind;\n\n constructor(\n maxCost: number,\n quote: { estimatedCost: number; maximumCost: number },\n kind?: BudgetedKind,\n );\n constructor(init: RenderBudgetInit);\n constructor(\n first: number | RenderBudgetInit,\n quote?: { estimatedCost: number; maximumCost: number },\n kind: BudgetedKind = 'render',\n ) {\n const init: RenderBudgetInit =\n typeof first === 'number'\n ? {\n maxCost: first,\n estimatedCost: quote?.estimatedCost,\n maximumCost: quote?.maximumCost,\n kind,\n }\n : first;\n const what = init.kind ?? 'render';\n super({\n code: 'RenderBudgetExceeded',\n message: init.message || budgetMessage(what, init),\n why:\n init.why ??\n `maxCost is held against the maximum a ${what} can be charged, not its estimate, so that it is a ceiling. The ${what} was refused before any GPU work started, and nothing was charged.`,\n fix: init.fix ?? BUDGET_FIX[what],\n docs: init.docs ?? 'https://bakery3.com/docs/cost',\n retryable: false,\n });\n this.name = 'RenderBudgetExceeded';\n this.maxCost = init.maxCost;\n this.estimatedCost = init.estimatedCost;\n this.maximumCost = init.maximumCost;\n this.kind = what;\n }\n}\n\n/**\n * The message quotes the maximum, because that is what was compared; the\n * estimate alone can read as under the ceiling. A number that is missing is\n * left out rather than printed as NaN.\n */\nfunction budgetMessage(kind: BudgetedKind, init: RenderBudgetInit): string {\n const usd = (n: number) => `$${n.toFixed(2)}`;\n const { maxCost, estimatedCost, maximumCost } = init;\n if (maximumCost !== undefined && maxCost !== undefined) {\n const estimate =\n estimatedCost !== undefined ? ` (estimated ${usd(estimatedCost)})` : '';\n return `This ${kind} could cost up to ${usd(maximumCost)}, which exceeds maxCost ${usd(maxCost)}${estimate}`;\n }\n if (maximumCost !== undefined)\n return `This ${kind} could cost up to ${usd(maximumCost)}, which is over its budget.`;\n return `This ${kind} is over its budget.`;\n}\n\n/**\n * A whole page of batch items was refused.\n *\n * Admission is per page: the control plane prices the page, checks it against\n * the account's balance and the batch's own `maxCost`, and either admits\n * every item or none. A `402 InsufficientBalance`, a `402 BatchBudgetExceeded`\n * or a `409 BatchClosed` means nothing in the page was admitted. The `Batch`\n * keeps those items buffered, so after a top-up (or a higher ceiling)\n * `flush()` sends exactly the same page again.\n *\n * `admitted` is what earlier pages of the same flush already got through:\n * those items are the server's now, and this error carries their outcomes so\n * a caller does not lose them because a later page was refused.\n */\nexport class BatchPageRefused extends Bakery3Error {\n /** The page that was refused whole, still in the batch's buffer. */\n readonly page: BatchItemRequest[];\n /** Outcomes of the pages this flush admitted before the refusal. */\n readonly admitted: BatchItemOutcome[];\n\n constructor(\n cause: Bakery3Error,\n page: BatchItemRequest[],\n admitted: BatchItemOutcome[],\n ) {\n super({\n code: cause.code,\n message: `${cause.message} ${page.length} item${page.length === 1 ? '' : 's'} still buffered.`,\n why:\n cause.why ??\n 'A batch page is admitted whole or not at all, so nothing in this page was priced against your balance.',\n fix:\n cause.fix ??\n (cause.code === 'BatchClosed'\n ? 'The batch is sealed; open a new one (a new key) for more items.'\n : 'Top up, or raise the ceiling, then call flush() again. The buffer is intact.'),\n docs: cause.docs ?? 'https://bakery3.com/docs/cost',\n path: cause.path,\n retryable: cause.code !== 'BatchClosed',\n });\n this.name = 'BatchPageRefused';\n this.page = page;\n this.admitted = admitted;\n }\n}\n","/** The published version. Must equal the version in package.json. */\nexport const SDK_VERSION = '0.2.0';\n","/**\n * The \"your API key is in the page\" warning.\n *\n * A secret key never belongs in browser JavaScript: every visitor can read\n * it from the network tab. But pasting a key into an app and pressing the\n * button is how a first render happens, so the key works, and the console\n * says exactly what is wrong with it and what to do before shipping.\n *\n * The warning fires once per key, not once per render, so a provider that\n * re-mounts on every hot reload cannot bury it.\n */\n\nconst warned = new Set<string>();\n\n/** Browser tokens are minted for a browser. Only the rest are a leak. */\nconst BROWSER_TOKEN_PREFIX = 'bk_pt_';\n\n/**\n * Is this a client someone else can read the bundle of?\n *\n * A DOM, a worker, or React Native: all three ship the key to a device the\n * developer does not control. Node, Deno and Bun are the server case this\n * warning points people back towards, so they stay quiet.\n */\nexport function isBrowserLike(scope: typeof globalThis = globalThis): boolean {\n const global = scope as {\n window?: { document?: unknown };\n document?: unknown;\n navigator?: { product?: string };\n importScripts?: unknown;\n process?: { versions?: { node?: string } };\n };\n\n // A bundler shim can define `window` in Node. The real thing has a document.\n if (typeof global.window === 'object' && global.window !== null) {\n if (global.window.document !== undefined) return true;\n }\n if (typeof global.importScripts === 'function') return true; // web worker\n if (global.navigator?.product === 'ReactNative') return true;\n return false;\n}\n\nfunction isProductionBuild(scope: typeof globalThis = globalThis): boolean {\n // Bundlers inline this. `false` only means \"cannot tell\", the common case\n // in a dev server, so it never weakens the warning.\n const env = (\n scope as { process?: { env?: Record<string, string | undefined> } }\n ).process?.env;\n return env?.NODE_ENV === 'production';\n}\n\n/**\n * Enough to recognize which key, useless as one: the first twelve characters,\n * exactly what the Keys page lists each key by (`prefix` in\n * apps/web/convex/keys.ts), so the developer can find the one to rotate. Six\n * characters of a long random secret are no head start on it.\n */\nexport function redact(key: string): string {\n const prefix = /^bk_[a-z]{2}_/.exec(key)?.[0] ?? '';\n const secret = key.slice(prefix.length);\n // A short secret would be half shown by its first six. Show none of it.\n return secret.length < 16 ? `${prefix}…` : `${key.slice(0, 12)}…`;\n}\n\nexport type KeyWarningContext = {\n /** Where the key was handed in, so the fix names the right thing. */\n source: 'apiKey' | 'node';\n scope?: typeof globalThis;\n log?: (message: string) => void;\n};\n\n/**\n * Warn if a long-lived key is being used from a client environment.\n *\n * Returns whether it warned, so a caller can check that a server stays quiet.\n */\nexport function warnIfKeyIsExposed(\n key: string,\n { source, scope = globalThis, log }: KeyWarningContext,\n): boolean {\n if (!key || key.startsWith(BROWSER_TOKEN_PREFIX)) return false;\n if (!isBrowserLike(scope)) return false;\n if (warned.has(key)) return false;\n warned.add(key);\n\n const warn =\n log ??\n (typeof console !== 'undefined' && typeof console.warn === 'function'\n ? (message: string) => console.warn(message)\n : () => {});\n\n warn(message(key, source, isProductionBuild(scope)));\n return true;\n}\n\nfunction message(\n key: string,\n source: KeyWarningContext['source'],\n production: boolean,\n): string {\n const lines = [\n production\n ? `[bakery3] A secret API key is in a PRODUCTION browser bundle: ${redact(key)}`\n : `[bakery3] Your secret API key is in browser JavaScript: ${redact(key)}`,\n '',\n 'Anyone who opens the network tab on this page can read it, and a bk_sk_ key',\n 'can start renders, read every render on the account, and reach billing. It',\n 'cannot be origin-restricted, spend-capped or revoked without replacing it.',\n '',\n production\n ? 'This build has NODE_ENV=production. Do not ship it. Mint a browser token'\n : 'Fine while you are testing. Before you deploy, mint a browser token',\n 'on your own server instead:',\n '',\n ' // app/api/bakery3-token/route.ts (server only)',\n \" import { Bakery3Server } from '@oeave/bakery3/node';\",\n ' const bakery3 = new Bakery3Server(process.env.BAKERY3_SECRET_KEY!);',\n ' export const POST = async () =>',\n ' Response.json(await bakery3.tokens.create({',\n ' expiresInSeconds: 300, maxCost: 1,',\n \" allowedOrigins: ['https://shop.example.com'],\",\n ' }));',\n '',\n ];\n\n if (source === 'apiKey') {\n lines.push(\n ' // browser: token instead of apiKey',\n ' createBakery3({',\n \" token: () => fetch('/api/bakery3-token', { method: 'POST' }).then((r) => r.json()),\",\n ' });',\n '',\n );\n } else {\n lines.push(\n '@oeave/bakery3/node is a server module. Importing it into a component that',\n 'runs in the browser puts the key in the bundle. Keep it behind a route',\n \"handler, a server action, or a file with 'use server'.\",\n '',\n );\n }\n\n lines.push('https://bakery3.com/docs/auth');\n return lines.join('\\n');\n}\n\n/** Clears the once-per-key memory. For tests. */\nexport function resetKeyWarnings(): void {\n warned.clear();\n}\n","/**\n * The HTTP client for the control plane.\n *\n * Small on purpose: a handful of endpoints, one auth header, one error shape.\n * The interesting work happens in the browser (capture, hashing) and on the\n * render workers; this is the thin part in between.\n *\n * The one piece of policy it carries is the retry: a 429 or a 503 is the\n * control plane saying \"not now\", and it is answered with a bounded, jittered\n * wait rather than an error the developer has to write a loop around. Only\n * requests that are safe to repeat are repeated (see `RequestOptions.retry`).\n *\n * In production no secret key reaches this file. The browser holds a\n * short-lived, project-scoped, origin-restricted, spend-capped token minted by\n * the developer's own server. `token` is a function rather than a string so\n * it can be fetched again when one expires, which for a five-minute token in\n * a long configurator session is routine.\n *\n * `apiKey` is the other door, and it is open on purpose: a key works from the\n * browser so the first render is one paste away, and `warnIfKeyIsExposed`\n * says once, with the replacement code, why it must not stay there.\n *\n * Neither is needed to construct a client: `check()` and `inspect()` never\n * touch the network, and a React tree whose environment variable is unset\n * must still mount. A missing credential is refused at the first request,\n * with what to pass instead.\n */\n\nimport type {\n AssetCheckRequest,\n AssetImportRequest,\n AssetImportResponse,\n AssetCheckResponse,\n BakeRecord,\n BakeSettings,\n BakeSpec,\n BatchAddRequest,\n BatchAddResponse,\n BatchExportLine,\n BatchOpenRequest,\n BatchRecord,\n CostEstimate,\n RenderRecord,\n RenderSpec,\n RenderState,\n} from './protocol/index.js';\nimport {\n Bakery3Error,\n RenderBudgetExceeded,\n type Bakery3ErrorCode,\n type BudgetedKind,\n} from './errors.js';\nimport { SDK_VERSION } from './version.js';\nimport { isBrowserLike, redact, warnIfKeyIsExposed } from './warn.js';\n\nexport const DEFAULT_BASE_URL = 'https://api.bakery3.com';\n\n/**\n * The header that names the SDK's version on every request, so the API can\n * warn about, or refuse, an SDK too old to read its answers.\n */\nexport const SDK_VERSION_HEADER = 'bakery3-sdk';\n\n/**\n * Whether a browser sends `SDK_VERSION_HEADER`. A custom header has to be on\n * the API's CORS `access-control-allow-headers` list (`cors()` in\n * apps/web/convex/http.ts), or the preflight fails and every request from a\n * page fails with it. It is on that list, so this is only the switch to turn\n * it off from if that ever changes.\n */\nconst VERSION_HEADER_IN_BROWSERS = true;\n\n/** What `/v1/estimate` prices: a still or a clip, or a bake. */\nexport type EstimateRequest =\n | (Pick<RenderSpec, 'quality' | 'output' | 'advanced'> & {\n /** Triangle count and texture footprint, so an estimate can be given\n * before anything has been uploaded. `room` says the scene stands in a\n * preset room, which the renderer builds around it; `enclosure` and\n * `objects` say how walled in and how full it is from the camera\n * (`SceneComplexity`), which is what makes an interior cost more. */\n scene?: {\n triangles?: number;\n textureBytes?: number;\n fog?: boolean;\n room?: boolean;\n enclosure?: number;\n objects?: number;\n };\n /** Frames in a clip; the control plane prices a video per frame. */\n frames?: number;\n })\n | {\n /** The settings a bake request would carry. Texels (objects × size²)\n * are what the control plane prices. */\n bake: Pick<\n BakeSettings,\n | 'quality'\n | 'textureSize'\n | 'include'\n | 'sizes'\n | 'atlas'\n | 'deliverGlb'\n | 'simplify'\n | 'shadow'\n > & {\n /** The scene is a room interior: a ray that misses keeps going,\n * which is most of what such a bake costs. */\n enclosed?: boolean;\n };\n /** Triangles in the objects the bake would cover: what the unwrap runs\n * over, and priced separately from the scene's own count. */\n bakedTriangles?: number;\n scene?: { triangles?: number; textureBytes?: number; fog?: boolean };\n };\n\n/** A browser token: the string, or the JSON `tokens.create()` answers with. */\nexport type MintedToken = string | { token: string; expiresAt?: number };\n\nexport type TokenProvider = () => MintedToken | Promise<MintedToken>;\n\n/**\n * One of the two, never both. Neither is allowed too, for a client that only\n * checks scenes; its first request is refused with what to pass.\n *\n * The `?: never` arms turn passing both into a type error at the call site\n * rather than a runtime throw later: the two are different integrations, and\n * a codebase carrying both is one that has not finished moving off the key.\n */\nexport type ClientAuth =\n | {\n /** Mints a browser token, usually from your own `/api/bakery3-token`. */\n token: TokenProvider;\n apiKey?: never;\n }\n | {\n /**\n * A `bk_sk_` key used directly, for local testing, a Node script, or a\n * server-rendered call.\n *\n * From a browser this ships the key to every visitor. The SDK allows it\n * so the first render is one paste away, warns about it in the console,\n * and expects `token` by the time you deploy.\n *\n * `undefined` (an environment variable that is not set) is accepted\n * here and refused at the first request, with that said.\n */\n apiKey: string | undefined;\n token?: never;\n }\n | { token?: undefined; apiKey?: undefined };\n\n/**\n * How a 429 or a 503 is waited out. Bounded: after `maxTries` the error is\n * the developer's. The defaults are the SDK's; a test shortens the delays.\n */\nexport type RetryPolicy = {\n /** Attempts in total, the first included. Default 5. */\n maxTries?: number;\n /** The first wait, before jitter and doubling. Default 500 ms. */\n baseDelayMs?: number;\n /** No single wait is longer than this, `Retry-After` included. Default 30 s. */\n maxDelayMs?: number;\n};\n\nexport type ClientOptions = ClientAuth & {\n baseUrl?: string;\n fetch?: typeof fetch;\n retry?: RetryPolicy;\n};\n\n/** Per-request knobs, for the client's own methods. */\nexport type RequestOptions = {\n /**\n * Whether a 429/503 may be answered by sending the request again.\n *\n * Every GET is. A POST is only when repeating it cannot do a second thing:\n * a batch page (its items carry keys), a batch action, a render that\n * carries an `idempotencyKey`. `POST /v1/renders` without one is not: a\n * second copy would be a second charge, which no amount of backoff is\n * worth.\n */\n retry?: boolean;\n /** Cuts a long-poll short. */\n signal?: AbortSignal;\n};\n\n/** `GET /v1/batches/:id/items`: the render record plus the item's key. */\nexport type BatchItemRecord = RenderRecord & { key: string };\n\nexport type BatchItemsPage = {\n items: BatchItemRecord[];\n cursor: string | null;\n};\n\nexport type BatchAction = 'close' | 'pause' | 'resume' | 'cancel' | 'retry';\n\nconst DEFAULT_RETRY: Required<RetryPolicy> = {\n maxTries: 5,\n baseDelayMs: 500,\n maxDelayMs: 30_000,\n};\n\n/** The two creates whose body may be a charge. Anything else is safe to repeat. */\nconst CHARGING_ROUTES = new Set(['/v1/renders', '/v1/bakes']);\n\n/** How many ids a client remembers the creating token of. A long session\n * forgets its oldest first; a forgotten one is read with the current token. */\nconst MAX_OWNERS = 1000;\n\nconst AUTH_DOCS = 'https://bakery3.com/docs/auth';\nconst TOKEN_ROUTE_DOCS = 'https://bakery3.com/docs/auth#the-token-endpoint';\nconst KEYS_URL = 'https://bakery3.com/keys';\n\n/** What a row was created as, for the message when it can no longer be read. */\ntype OwnedKind = 'render' | 'bake' | 'batch';\ntype Owner = `${OwnedKind}:${string}`;\n\n/** The credential a client has, decided once at construction. */\ntype Auth =\n | { kind: 'token'; provider: TokenProvider }\n | { kind: 'key'; key: string }\n /** No usable credential. Refused at the first request, not at construction. */\n | { kind: 'missing'; refusal: () => Bakery3Error };\n\ntype SendOptions = RequestOptions & {\n /** The row this request reads or acts on, whose creating token it uses. */\n owner?: Owner;\n};\n\nexport class Bakery3Client {\n private readonly baseUrl: string;\n private readonly auth: Auth;\n /**\n * The fetch this client sends with: the one passed in `options.fetch`, or\n * the global. Uploads and bundle reads use it too, so a test, a proxy or a\n * runtime with its own fetch sees every request the SDK makes.\n */\n readonly fetch: typeof fetch;\n /** Cached until it expires. Re-minting per render would add a round trip to\n * the developer's own server on the critical path of every click. */\n private cached: { token: string; expiresAt: number } | null = null;\n /** One token fetch at a time. React's StrictMode mounts twice, and two\n * renders at once both find the cache empty: they share this one. */\n private minting: Promise<string> | null = null;\n /**\n * The browser token each render, bake and batch was created with, by id.\n *\n * A token can only read the rows it created. Once it has spent its\n * allowance or expired, the API still lets it read and cancel those rows\n * (for 24 hours past expiry) but not create more, and a freshly minted\n * token cannot read them at all. So a job polls with the token that\n * started it, whatever the local cache thinks of that token's expiry.\n */\n private readonly owners = new Map<Owner, string>();\n private readonly retry: Required<RetryPolicy>;\n private readonly sendVersion: boolean;\n\n constructor(options: ClientOptions = {}) {\n const given = (options ?? {}) as { token?: unknown; apiKey?: unknown };\n const { token, apiKey } = given;\n\n if (token && apiKey) {\n throw new Bakery3Error({\n code: 'InvalidRequest',\n message: 'Pass either token or apiKey, not both.',\n why: 'They are two different integrations, and the SDK will not guess which one you meant.',\n fix: 'Keep `token` for anything you deploy; `apiKey` is for local testing only.',\n docs: AUTH_DOCS,\n });\n }\n\n this.auth = authOf(token, apiKey, 'apiKey' in given);\n this.baseUrl = (options.baseUrl ?? DEFAULT_BASE_URL).replace(/\\/$/, '');\n this.fetch = options.fetch ?? globalThis.fetch.bind(globalThis);\n this.retry = { ...DEFAULT_RETRY, ...options.retry };\n this.sendVersion = VERSION_HEADER_IN_BROWSERS || !isBrowserLike();\n\n if (this.auth.kind === 'key')\n warnIfKeyIsExposed(this.auth.key, { source: 'apiKey' });\n }\n\n /**\n * Why this client cannot make a request, or null when it can. The same\n * error its first request would throw, for a panel or a status line that\n * wants to say so before anyone presses Render.\n */\n credentialError(): Bakery3Error | null {\n return this.auth.kind === 'missing' ? this.auth.refusal() : null;\n }\n\n async token(force = false): Promise<string> {\n const auth = this.auth;\n // A key handed in directly is the credential. There is nothing to cache,\n // nothing to refresh, and a 401 on one means the key is wrong.\n if (auth.kind === 'key') return auth.key;\n if (auth.kind === 'missing') throw auth.refusal();\n\n // 10s of slack: a token that expires while the request is in flight is\n // indistinguishable from a bad one at the far end.\n if (!force && this.cached && this.cached.expiresAt - 10_000 > Date.now()) {\n return this.cached.token;\n }\n this.minting ??= this.mint(auth.provider).finally(() => {\n this.minting = null;\n });\n return this.minting;\n }\n\n private async mint(provider: TokenProvider): Promise<string> {\n let result: unknown;\n try {\n result = await provider();\n } catch (cause) {\n throw providerThrew(cause);\n }\n const { token, expiresAt } = readMinted(result);\n this.cached = {\n token,\n expiresAt:\n expiresAt ??\n // Unknown expiry: hold it for a minute rather than for the session,\n // so a stale one self-heals without a failed render to prompt it.\n Date.now() + 60_000,\n };\n return token;\n }\n\n async checkAssets(body: AssetCheckRequest): Promise<AssetCheckResponse> {\n return this.post<AssetCheckResponse>('/v1/assets/check', body);\n }\n\n /**\n * `POST /v1/assets/import`: have the service fetch a public URL into the\n * project's assets. Secret key only. Safe to repeat: the same bytes are the\n * same asset, and an unchanged URL is answered without a download.\n */\n async importAsset(body: AssetImportRequest): Promise<AssetImportResponse> {\n return this.post<AssetImportResponse>('/v1/assets/import', body);\n }\n\n async estimate(body: EstimateRequest): Promise<CostEstimate> {\n return this.post<CostEstimate>('/v1/estimate', body);\n }\n\n async createRender(body: RenderSpec): Promise<RenderRecord> {\n // Retried only under a key: without one a second POST is a second render.\n const { value, credential } = await this.call<RenderRecord>(\n 'POST',\n '/v1/renders',\n body,\n { retry: Boolean(body.idempotencyKey) },\n );\n this.remember('render', value.id, credential);\n return value;\n }\n\n /**\n * A render's record, with fresh signed URLs for its result and preview.\n * Read with the token that created it, when this client created it.\n */\n async getRender(\n id: string,\n options: { signal?: AbortSignal } = {},\n ): Promise<RenderRecord> {\n return this.read<RenderRecord>('GET', `/v1/renders/${segment(id)}`, {\n owner: `render:${id}`,\n signal: options.signal,\n });\n }\n\n async cancelRender(id: string): Promise<RenderRecord> {\n return this.read<RenderRecord>(\n 'POST',\n `/v1/renders/${segment(id)}/cancel`,\n { owner: `render:${id}` },\n {},\n );\n }\n\n /**\n * `POST /v1/renders/:id/retry`: one more attempt for a dead-lettered render.\n * Answers 201 with a new render linked to the old one, or 409 when the\n * render is not dead-lettered. Not repeated on a 429/503: it creates a\n * render, and a duplicate would be a duplicate charge.\n */\n async retryRender(id: string): Promise<RenderRecord> {\n const { value, credential } = await this.call<RenderRecord>(\n 'POST',\n `/v1/renders/${segment(id)}/retry`,\n {},\n { retry: false, owner: `render:${id}` },\n );\n this.remember('render', value.id, credential);\n return value;\n }\n\n async createBake(body: BakeSpec): Promise<BakeRecord> {\n const { value, credential } = await this.call<BakeRecord>(\n 'POST',\n '/v1/bakes',\n body,\n { retry: Boolean(body.idempotencyKey) },\n );\n this.remember('bake', value.id, credential);\n return value;\n }\n\n async getBake(\n id: string,\n options: { signal?: AbortSignal } = {},\n ): Promise<BakeRecord> {\n return this.read<BakeRecord>('GET', `/v1/bakes/${segment(id)}`, {\n owner: `bake:${id}`,\n signal: options.signal,\n });\n }\n\n async cancelBake(id: string): Promise<BakeRecord> {\n return this.read<BakeRecord>(\n 'POST',\n `/v1/bakes/${segment(id)}/cancel`,\n { owner: `bake:${id}` },\n {},\n );\n }\n\n // -------------------------------------------------------------------------\n // Batches\n // -------------------------------------------------------------------------\n\n /** `POST /v1/batches`. The key is the idempotency key: the same key\n * re-opens the same batch (200) while it is not terminal. */\n async openBatch(body: BatchOpenRequest): Promise<BatchRecord> {\n const { value, credential } = await this.call<BatchRecord>(\n 'POST',\n '/v1/batches',\n body,\n {},\n );\n this.remember('batch', value.id, credential);\n return value;\n }\n\n /**\n * `GET /v1/batches/:id`. With `wait`, long-polls for up to that many\n * seconds (at most 25) until the counts change: the one poll a batch needs.\n */\n async getBatch(\n id: string,\n options: { wait?: number; signal?: AbortSignal } = {},\n ): Promise<BatchRecord> {\n const wait =\n options.wait === undefined\n ? undefined\n : Math.min(25, Math.max(0, options.wait));\n const suffix = wait ? `?wait=${wait}` : '';\n return this.read<BatchRecord>(\n 'GET',\n `/v1/batches/${segment(id)}${suffix}`,\n {\n owner: `batch:${id}`,\n signal: options.signal,\n },\n );\n }\n\n /**\n * `POST /v1/batches/:id/items`: one page, at most `BATCH_PAGE_SIZE`.\n *\n * Every item carries its own key, so the page is safe to send twice: the\n * second copy adopts what the first admitted. A refusal of the whole page\n * (402 InsufficientBalance / BatchBudgetExceeded, 409 BatchClosed) throws;\n * a problem with one item comes back inside `items[i].error` with a 200.\n */\n async addBatchItems(\n id: string,\n body: BatchAddRequest,\n ): Promise<BatchAddResponse> {\n return this.read<BatchAddResponse>(\n 'POST',\n `/v1/batches/${segment(id)}/items`,\n { owner: `batch:${id}` },\n body,\n );\n }\n\n /** `GET /v1/batches/:id/items?state=&cursor=&limit=`. */\n async listBatchItems(\n id: string,\n options: { state?: RenderState; cursor?: string; limit?: number } = {},\n ): Promise<BatchItemsPage> {\n const query = new URLSearchParams();\n if (options.state) query.set('state', options.state);\n if (options.cursor) query.set('cursor', options.cursor);\n if (options.limit) query.set('limit', String(options.limit));\n const suffix = query.toString() ? `?${query}` : '';\n return this.read<BatchItemsPage>(\n 'GET',\n `/v1/batches/${segment(id)}/items${suffix}`,\n { owner: `batch:${id}` },\n );\n }\n\n /**\n * `GET /v1/batches/:id/export`: the ledger as NDJSON, one line per item,\n * yielded as it streams so a ten-thousand-item batch is never one string.\n */\n async *exportBatch(id: string): AsyncIterable<BatchExportLine> {\n const { response } = await this.send(\n 'GET',\n `/v1/batches/${segment(id)}/export`,\n undefined,\n { retry: true, owner: `batch:${id}` },\n );\n yield* ndjson<BatchExportLine>(response);\n }\n\n /** `POST /v1/batches/:id/{close,pause,resume,cancel,retry}`. Every one is a\n * state transition the control plane treats idempotently, so all repeat. */\n async batchAction(id: string, action: BatchAction): Promise<BatchRecord> {\n return this.read<BatchRecord>(\n 'POST',\n `/v1/batches/${segment(id)}/${action}`,\n { owner: `batch:${id}` },\n {},\n );\n }\n\n private post<T>(\n path: string,\n body: unknown,\n options?: RequestOptions,\n ): Promise<T> {\n return this.request<T>('POST', path, body, options);\n }\n\n /** A request about a row this client may have created, with its token. */\n private async read<T>(\n method: string,\n path: string,\n options: SendOptions,\n body?: unknown,\n ): Promise<T> {\n return (await this.call<T>(method, path, body, options)).value;\n }\n\n /** Remember which token created a row, so the row is read with it. */\n private remember(kind: OwnedKind, id: string, credential: string): void {\n // A key reads everything in its project, so there is nothing to pin.\n if (this.auth.kind !== 'token' || !id) return;\n const owner: Owner = `${kind}:${id}`;\n this.owners.delete(owner);\n this.owners.set(owner, credential);\n if (this.owners.size > MAX_OWNERS) {\n const oldest = this.owners.keys().next().value;\n if (oldest !== undefined) this.owners.delete(oldest);\n }\n }\n\n /**\n * One authenticated JSON request, with the 401 re-mint and the 429/503\n * backoff. Public for the server SDK, which shares the transport; the\n * typed methods above are the API.\n */\n async request<T>(\n method: string,\n path: string,\n body?: unknown,\n options: RequestOptions = {},\n ): Promise<T> {\n return (await this.call<T>(method, path, body, options)).value;\n }\n\n /** A JSON request, and the credential that got the answer. */\n private async call<T>(\n method: string,\n path: string,\n body: unknown,\n options: SendOptions,\n ): Promise<{ value: T; credential: string }> {\n const { response, credential, url } = await this.send(\n method,\n path,\n body,\n options,\n );\n if (response.status === 204) return { value: undefined as T, credential };\n // Read as text and parsed here, so a 200 that is not JSON (a baseUrl\n // that points at a web app, which answers every path with its HTML)\n // says so instead of throwing \"Unexpected token '<'\".\n const text = await response.text();\n if (!text.trim()) return { value: undefined as T, credential };\n try {\n return { value: JSON.parse(text) as T, credential };\n } catch {\n throw notOurs(response.status, url, undefined, text, this.baseUrl);\n }\n }\n\n private async send(\n method: string,\n path: string,\n body: unknown,\n options: SendOptions,\n ): Promise<{ response: Response; credential: string; url: string }> {\n const retry = options.retry ?? isSafeToRepeat(method, path);\n const maxTries = retry ? this.retry.maxTries : 1;\n const url = `${this.baseUrl}${path}`;\n const pinned = options.owner ? this.owners.get(options.owner) : undefined;\n // Outside the fetch's try on purpose. A token failure is an auth error\n // with its own code, fix and docs link; inside, it would become a\n // retryable NetworkError, which a job's poll loop waits out for minutes.\n let credential = pinned ?? (await this.token());\n let reminted = false;\n let leftPin = false;\n\n for (let attempt = 1; ; attempt++) {\n const response = await this.fetchOnce(\n method,\n url,\n body,\n credential,\n options.signal,\n );\n\n if (response.ok) {\n // The current token could read it after all: read with that from now.\n if (leftPin && options.owner) {\n const [kind, ...rest] = options.owner.split(':');\n this.remember(kind as OwnedKind, rest.join(':'), credential);\n }\n return { response, credential, url };\n }\n\n // One retry with a freshly minted token. A five-minute browser token\n // expiring mid-session is the expected case, not an exception. A static\n // key has nothing to re-mint, so retrying it would only turn one clear\n // 401 into two. Does not count as an attempt.\n if (response.status === 401 && !reminted && this.auth.kind === 'token') {\n await response.body?.cancel().catch(() => {});\n reminted = true;\n leftPin = pinned !== undefined;\n // The token that created the row was refused: the current one, or a\n // new one when the current one IS the refused one.\n credential = await this.token(\n !pinned || this.cached?.token === credential,\n );\n continue;\n }\n\n // The creating token is gone and the current one is a stranger to the\n // row: a token reads only what it created, so the API says 404.\n if (leftPin && response.status === 404 && options.owner) {\n await response.body?.cancel().catch(() => {});\n throw lostOwner(options.owner);\n }\n\n if (\n response.status === 401 &&\n this.auth.kind === 'key' &&\n this.auth.key.startsWith('bk_pt_')\n ) {\n await response.body?.cancel().catch(() => {});\n throw browserTokenAsKey();\n }\n\n // \"Not now\": the account is over its rate (429) or the control plane is\n // shedding load (503). Nothing about the request is wrong, so the same\n // bytes go again after a jittered wait, for a request that is safe to\n // repeat, and only so many times. Any other 4xx is a verdict.\n if (\n (response.status === 429 || response.status === 503) &&\n attempt < maxTries\n ) {\n await response.body?.cancel().catch(() => {});\n await sleep(\n this.delayFor(attempt, response.headers.get('retry-after')),\n options.signal,\n );\n continue;\n }\n\n throw await toError(response, url, path, this.baseUrl);\n }\n }\n\n private async fetchOnce(\n method: string,\n url: string,\n body: unknown,\n credential: string,\n signal: AbortSignal | undefined,\n ): Promise<Response> {\n try {\n return await this.fetch(url, {\n method,\n headers: {\n authorization: `Bearer ${credential}`,\n ...(this.sendVersion ? { [SDK_VERSION_HEADER]: SDK_VERSION } : {}),\n ...(body === undefined ? {} : { 'content-type': 'application/json' }),\n },\n ...(body === undefined ? {} : { body: JSON.stringify(body) }),\n ...(signal ? { signal } : {}),\n });\n } catch (error) {\n if (signal?.aborted) throw error;\n throw new Bakery3Error({\n code: 'NetworkError',\n message: `Could not reach the Bakery3 API: ${\n error instanceof Error ? error.message : String(error)\n }`,\n fix: 'Check the browser network tab. If you set a custom baseUrl, confirm it allows your origin.',\n retryable: true,\n });\n }\n }\n\n /**\n * Exponential with full jitter, or the server's own `Retry-After` when it\n * sent one: a server that says \"in 3 s\" knows more than a formula does.\n * Both are capped, so a header naming next Tuesday does not hang a page.\n */\n private delayFor(attempt: number, retryAfter: string | null): number {\n const { baseDelayMs, maxDelayMs } = this.retry;\n const advised = parseRetryAfter(retryAfter);\n if (advised !== null) return Math.min(maxDelayMs, advised);\n const ceiling = Math.min(maxDelayMs, baseDelayMs * 2 ** (attempt - 1));\n return Math.random() * ceiling;\n }\n}\n\n/** An id as one path segment: an id with a slash in it must not reach another route. */\nfunction segment(id: string): string {\n return encodeURIComponent(id);\n}\n\n// ---------------------------------------------------------------------------\n// Credentials\n// ---------------------------------------------------------------------------\n\n/**\n * What the constructor was given, as one of three cases. A missing, empty or\n * placeholder credential is not an error yet: a client that only checks a\n * scene never needs one.\n */\nfunction authOf(token: unknown, apiKey: unknown, keyNamed: boolean): Auth {\n if (token !== undefined && token !== null) {\n if (typeof token === 'function')\n return { kind: 'token', provider: token as TokenProvider };\n return { kind: 'missing', refusal: tokenNotAFunction };\n }\n if (typeof apiKey === 'string' && apiKey.trim()) {\n const key = apiKey.trim();\n if (isPlaceholder(key))\n return { kind: 'missing', refusal: () => placeholderKey(key) };\n return { kind: 'key', key };\n }\n if (keyNamed || apiKey !== undefined)\n return { kind: 'missing', refusal: emptyKey };\n return { kind: 'missing', refusal: noCredentials };\n}\n\n/** The `bk_sk_...` of a README, pasted as it is. */\nfunction isPlaceholder(key: string): boolean {\n return key.includes('...') || key.includes('…');\n}\n\nfunction noCredentials(): Bakery3Error {\n return new Bakery3Error({\n code: 'Unauthorized',\n message: `No API key or token. Create a key at ${KEYS_URL} (sign up there first if you have no account).`,\n why: '`apiKey` is a secret key (bk_sk_) you pass directly, for testing and for servers. `token` is a function that fetches a short-lived browser token from your own server, which is what you deploy, because it keeps the key out of the page.',\n fix: \"While testing: createBakery3({ apiKey: 'bk_sk_...' }). Before you deploy: createBakery3({ token: getToken }).\",\n docs: AUTH_DOCS,\n });\n}\n\nfunction emptyKey(): Bakery3Error {\n return new Bakery3Error({\n code: 'Unauthorized',\n message:\n 'apiKey is empty. Check that the environment variable holding your key is set.',\n why: \"createBakery3({ apiKey }) was given undefined or an empty string, which is what an environment variable that is not set reads as. In a browser bundle, only variables with your framework's public prefix (NEXT_PUBLIC_, VITE_) are set.\",\n fix: `Set the variable and restart the dev server. You can copy a key from ${KEYS_URL}.`,\n docs: AUTH_DOCS,\n });\n}\n\nfunction placeholderKey(key: string): Bakery3Error {\n return new Bakery3Error({\n code: 'Unauthorized',\n message: `Replace the placeholder with your key from ${KEYS_URL}.`,\n why: `apiKey is ${redact(key)}, which looks like the example from the docs rather than a real key.`,\n fix: `Copy a secret key (bk_sk_) from ${KEYS_URL} into apiKey while testing, and switch to token before you deploy.`,\n docs: AUTH_DOCS,\n });\n}\n\nfunction tokenNotAFunction(): Bakery3Error {\n return new Bakery3Error({\n code: 'Unauthorized',\n message:\n 'token must be a function that fetches a browser token, not the token itself.',\n why: 'Browser tokens expire after minutes, so the SDK calls your function again for a new one when it needs to.',\n fix: \"createBakery3({ token: () => fetch('/api/bakery3-token', { method: 'POST' }).then((r) => r.json()) })\",\n docs: TOKEN_ROUTE_DOCS,\n });\n}\n\nfunction browserTokenAsKey(): Bakery3Error {\n return new Bakery3Error({\n code: 'TokenExpired',\n message:\n 'apiKey holds a browser token (bk_pt_), and the API refused it. It has most likely expired.',\n why: 'Browser tokens last minutes. Passed as apiKey, the SDK has no way to fetch a new one when it runs out.',\n fix: \"Pass it as token instead, as a function that fetches a fresh one: createBakery3({ token: () => fetch('/api/bakery3-token', { method: 'POST' }).then((r) => r.json()) }).\",\n docs: TOKEN_ROUTE_DOCS,\n });\n}\n\nfunction lostOwner(owner: Owner): Bakery3Error {\n const kind = owner.slice(0, owner.indexOf(':')) as OwnedKind;\n const started = kind === 'batch' ? 'opened' : 'started';\n return new Bakery3Error({\n code: 'TokenExpired',\n message: `This ${kind} was ${started} with a browser token that can no longer read it. Mint tokens with a longer expiresInSeconds, or read the ${kind} from your server with the secret key.`,\n why: `A browser token can only read the ${kind}s it ${started}. That token was refused, and a new token cannot read a ${kind} it did not start.`,\n fix: 'Pass a longer expiresInSeconds to tokens.create() on your server, or read it there with new Bakery3Server(process.env.BAKERY3_SECRET_KEY!).',\n docs: AUTH_DOCS,\n });\n}\n\n/** The provider rejected. The developer's own endpoint, not ours. */\nfunction providerThrew(cause: unknown): Bakery3Error {\n const said = cause instanceof Error ? cause.message : String(cause);\n // `r.json()` on an HTML page: a 404 for a route that is not where the\n // fetch says, or a 500 from a route that threw. A verdict, not a blink.\n if (\n cause instanceof SyntaxError ||\n (cause as { name?: unknown } | null)?.name === 'SyntaxError'\n ) {\n return new Bakery3Error({\n code: 'Unauthorized',\n message:\n 'Your token endpoint did not return JSON. It probably answered 404 or 500 with an HTML page.',\n why: `Reading its answer as JSON failed: ${said}`,\n fix: 'Open your token route in the network tab. It must answer 200 with the JSON from tokens.create(). On a 500, check your server log: BAKERY3_SECRET_KEY may be unset.',\n docs: TOKEN_ROUTE_DOCS,\n });\n }\n // Retryable, because a token route that blinks mid-render should not lose\n // the render; named, because \"could not reach the Bakery3 API\" would point\n // at the wrong network tab entry.\n return new Bakery3Error({\n code: 'Unauthorized',\n message: `The token provider threw: ${said}`,\n why: 'createBakery3({ token }) calls your function for a browser token before each request that needs one, and it rejected.',\n fix: 'Check your /api/bakery3-token route in the network tab: it should answer 200 with the JSON from tokens.create().',\n docs: TOKEN_ROUTE_DOCS,\n retryable: true,\n });\n}\n\n/** The token out of whatever the provider resolved to, or an error that says what it was instead. */\nfunction readMinted(result: unknown): { token: string; expiresAt?: number } {\n if (isFetchResponse(result)) {\n const status = result.ok ? '' : ` (it answered ${result.status})`;\n throw new Bakery3Error({\n code: 'Unauthorized',\n message: `Your token function returned a fetch Response, not the token${status}. Add .then((r) => r.json()).`,\n why: 'createBakery3({ token }) needs the token itself: a string, or the JSON from tokens.create().',\n fix: \"token: () => fetch('/api/bakery3-token', { method: 'POST' }).then((r) => r.json())\",\n docs: TOKEN_ROUTE_DOCS,\n });\n }\n if (typeof result === 'string' && result) return { token: result };\n if (isRecord(result) && typeof result.token === 'string' && result.token) {\n return {\n token: result.token,\n ...(typeof result.expiresAt === 'number' && result.expiresAt > 0\n ? { expiresAt: result.expiresAt }\n : {}),\n };\n }\n const reported = isRecord(result) ? errorText(result) : undefined;\n if (reported) {\n throw new Bakery3Error({\n code: 'Unauthorized',\n message: `Your token endpoint answered with an error instead of a token: ${reported}`,\n why: 'createBakery3({ token }) needs { token } from your route, and the JSON it got has an error in its place.',\n fix: 'Check your server log for the request to your token route. BAKERY3_SECRET_KEY may be unset or wrong.',\n docs: TOKEN_ROUTE_DOCS,\n });\n }\n throw new Bakery3Error({\n code: 'Unauthorized',\n message: 'The token provider returned nothing.',\n why: 'createBakery3({ token }) must resolve to a string, or to { token }.',\n fix: 'Check that your /api/bakery3-token route returns the JSON from tokens.create().',\n docs: TOKEN_ROUTE_DOCS,\n });\n}\n\n/** Duck-typed, because a polyfilled or cross-realm Response fails `instanceof`. */\nfunction isFetchResponse(value: unknown): value is Response {\n if (typeof Response !== 'undefined' && value instanceof Response) return true;\n return (\n isRecord(value) &&\n typeof value.json === 'function' &&\n typeof value.status === 'number' &&\n 'headers' in value\n );\n}\n\n/** `{ error: 'text' }`, `{ error: { message } }`, or `{ message }`. */\nfunction errorText(body: Record<string, unknown>): string | undefined {\n const error = body.error;\n if (typeof error === 'string' && error) return error;\n if (isRecord(error)) {\n const message = typeof error.message === 'string' ? error.message : '';\n const code = typeof error.code === 'string' ? error.code : '';\n if (message || code)\n return code && message ? `${code}: ${message}` : message || code;\n return snippet(JSON.stringify(error));\n }\n if (typeof body.message === 'string' && body.message) return body.message;\n return undefined;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null;\n}\n\n// ---------------------------------------------------------------------------\n// Transport helpers\n// ---------------------------------------------------------------------------\n\n/** A request whose repeat cannot do a second thing. GETs always; a POST unless\n * it is one of the two creates that may charge (those opt in per body). */\nfunction isSafeToRepeat(method: string, path: string): boolean {\n if (method === 'GET' || method === 'HEAD') return true;\n return !CHARGING_ROUTES.has(path.split('?')[0]!);\n}\n\n/** Seconds, or an HTTP date; anything else is ignored. Never negative. */\nexport function parseRetryAfter(\n header: string | null,\n now = Date.now(),\n): number | null {\n if (!header) return null;\n const trimmed = header.trim();\n if (/^\\d+$/.test(trimmed)) return Number(trimmed) * 1000;\n const date = Date.parse(trimmed);\n if (Number.isNaN(date)) return null;\n return Math.max(0, date - now);\n}\n\nfunction sleep(ms: number, signal?: AbortSignal): Promise<void> {\n return new Promise((resolve, reject) => {\n if (signal?.aborted) return reject(signal.reason);\n const timer = setTimeout(() => {\n signal?.removeEventListener('abort', onAbort);\n resolve();\n }, ms);\n function onAbort() {\n clearTimeout(timer);\n reject(signal!.reason);\n }\n signal?.addEventListener('abort', onAbort, { once: true });\n });\n}\n\n/**\n * One JSON document per line, yielded as the bytes arrive. A response with\n * no stream (a test's `Response`, an old runtime) falls back to its text.\n */\nasync function* ndjson<T>(response: Response): AsyncIterable<T> {\n const decoder = new TextDecoder();\n let buffer = '';\n const emit = function* (chunk: string, flush = false) {\n buffer += chunk;\n const lines = buffer.split('\\n');\n buffer = flush ? '' : (lines.pop() ?? '');\n for (const line of lines) {\n const trimmed = line.trim();\n if (trimmed) yield JSON.parse(trimmed) as T;\n }\n };\n\n if (!response.body) {\n yield* emit(await response.text(), true);\n return;\n }\n const reader = response.body.getReader();\n for (;;) {\n const { value, done } = await reader.read();\n if (done) break;\n yield* emit(decoder.decode(value, { stream: true }));\n }\n yield* emit(decoder.decode(), true);\n}\n\n// ---------------------------------------------------------------------------\n// Errors from a response\n// ---------------------------------------------------------------------------\n\n/**\n * A refusal, as a `Bakery3Error` with its four lines intact.\n *\n * The control plane answers with the protocol's structured error shape. A\n * proxy, a gateway or a wrong `baseUrl` does not, and that is said rather\n * than shown as a bare status. The body is read once, as text: reading it as\n * JSON first and as text after fails, because a body can only be read once.\n */\nasync function toError(\n response: Response,\n url: string,\n path: string,\n baseUrl: string,\n): Promise<Bakery3Error> {\n const text = await response.text().catch(() => '');\n let payload: unknown;\n try {\n payload = text ? JSON.parse(text) : undefined;\n } catch {\n payload = undefined;\n }\n const error = isRecord(payload)\n ? isRecord(payload.error)\n ? payload.error\n : payload\n : undefined;\n\n if (!error || typeof error.code !== 'string' || !error.code) {\n return notOurs(response.status, url, error, text, baseUrl);\n }\n\n const str = (value: unknown) =>\n typeof value === 'string' && value ? value : undefined;\n const num = (value: unknown) =>\n typeof value === 'number' && Number.isFinite(value) ? value : undefined;\n const message =\n str(error.message) ?? `${response.status} ${response.statusText}`.trim();\n\n if (error.code === 'RenderBudgetExceeded') {\n return new RenderBudgetExceeded({\n message,\n why: str(error.why),\n fix: str(error.fix),\n docs: str(error.docs),\n maxCost: num(error.maxCost),\n estimatedCost: num(error.estimatedCost),\n maximumCost: num(error.maximumCost),\n kind: budgetedKind(error.kind, path),\n });\n }\n\n return new Bakery3Error({\n code: error.code as Bakery3ErrorCode,\n message,\n why: str(error.why),\n fix: str(error.fix),\n docs: str(error.docs),\n path: str(error.path),\n retryable: response.status >= 500 || response.status === 429,\n });\n}\n\nfunction budgetedKind(kind: unknown, path: string): BudgetedKind {\n if (kind === 'render' || kind === 'video' || kind === 'bake') return kind;\n return path.startsWith('/v1/bakes') ? 'bake' : 'render';\n}\n\n/**\n * An answer that did not come from the Bakery3 API: no error code, or not\n * JSON at all. Says who answered, where, and what to check.\n */\nfunction notOurs(\n status: number,\n url: string,\n body: Record<string, unknown> | undefined,\n text: string,\n baseUrl: string,\n): Bakery3Error {\n const where = `${status} from ${url.split('?')[0]}`;\n const said = (body && errorText(body)) || snippet(text);\n const answered = said ? ` It answered: ${said}` : '';\n if (status >= 500) {\n return new Bakery3Error({\n code: 'NetworkError',\n message: `${where}: the server failed before the Bakery3 API could answer.`,\n why: `The answer has no Bakery3 error in it, so a gateway or proxy in between answered.${answered}`,\n fix: `Try again in a moment. If it keeps happening, check that baseUrl (${baseUrl}) points at the Bakery3 API.`,\n retryable: true,\n });\n }\n return new Bakery3Error({\n code:\n status === 401 || status === 403\n ? 'Unauthorized'\n : status === 429\n ? 'RateLimited'\n : 'InvalidRequest',\n message: `${where}: not the Bakery3 API. Check baseUrl.`,\n why: `The answer has no Bakery3 error in it, so another server answered: a wrong baseUrl, a proxy, or a page of your own app.${answered}`,\n fix: `Leave baseUrl out to use ${DEFAULT_BASE_URL}, or point it at a proxy that forwards /v1/ requests unchanged.`,\n retryable: status === 429,\n });\n}\n\n/** A body as one short line: tags out, whitespace collapsed, cut at 160. */\nfunction snippet(text: string): string {\n const flat = text\n .replace(/<[^>]*>/g, ' ')\n .replace(/\\s+/g, ' ')\n .trim();\n return flat.length > 160 ? `${flat.slice(0, 160)}…` : flat;\n}\n","/**\n * How long a job keeps polling while every poll fails.\n *\n * A transient fault must not lose a render that is still running, so one\n * failed poll means nothing and a job rides out a dropped connection or a\n * laptop lid. But a fault that never clears (a token route that went away, a\n * base URL that stopped resolving) would leave `result()` pending for good,\n * with nothing on the page to say why. After this long with not one\n * successful poll, the job rejects with the last error, which names the\n * cause. The render itself is untouched and can still be read by its id.\n */\nexport const POLL_GIVE_UP_MS = 5 * 60_000;\n\nexport class PollFailures {\n private since: number | null = null;\n\n constructor(private readonly now: () => number = Date.now) {}\n\n /** A poll got through: whatever was failing has cleared. */\n succeeded(): void {\n this.since = null;\n }\n\n /** A poll failed. True once they have all been failing for the whole window. */\n exhausted(): boolean {\n this.since ??= this.now();\n return this.now() - this.since >= POLL_GIVE_UP_MS;\n }\n}\n","/**\n * A batch, from the customer's side.\n *\n * const batch = await bakery3.batches.open({ key: 'fall-2026-v3', maxCost: 600 });\n * for await (const item of source) await batch.write(item); // a full page sends itself\n * await batch.close(); // the tail is flushed, then sealed: the total is known\n * await batch.wait({ onProgress: (p) => console.log(`${p.completed}/${p.total}`) });\n * for await (const item of batch.items({ state: 'failed' })) console.error(item.key);\n *\n * Two things this class is careful about, because they are the whole reason\n * the batch exists rather than a loop over `render()`:\n *\n * - Memory. `write` buffers a few KB of manifest per item and sends a page\n * the moment one is full, by count or by bytes, so awaiting it is the\n * backpressure and nothing here ever holds the catalog. (`add` and\n * `flush` are the same two steps taken by hand.) A refused page stays\n * buffered: the caller tops up and flushes again, and the same items go,\n * under the same keys.\n * - One poll loop. `wait` long-polls the batch record; it never polls a\n * render. Items are read by state with a cursor when they are wanted.\n */\n\nimport type {\n BatchAddRequest,\n BatchCost,\n BatchCounts,\n BatchExportLine,\n BatchItemOutcome,\n BatchItemRequest,\n BatchRecord,\n BatchState,\n RenderState,\n} from './protocol/index.js';\nimport {\n BATCH_ITEM_BYTES,\n BATCH_PAGE_BYTES,\n BATCH_PAGE_SIZE,\n} from './protocol/index.js';\nimport type { BatchItemRecord, BatchItemsPage } from './client.js';\nimport { Bakery3Error, BatchPageRefused } from './errors.js';\nimport { POLL_GIVE_UP_MS, PollFailures } from './pollFailures.js';\n\n/** The slice of the client a batch drives: what a mock has to provide. */\nexport type BatchTransport = {\n getBatch(\n id: string,\n options?: { wait?: number; signal?: AbortSignal },\n ): Promise<BatchRecord>;\n addBatchItems(\n id: string,\n body: BatchAddRequest,\n ): Promise<{ batch: BatchRecord; items: BatchItemOutcome[] }>;\n listBatchItems(\n id: string,\n options?: { state?: RenderState; cursor?: string; limit?: number },\n ): Promise<BatchItemsPage>;\n exportBatch(id: string): AsyncIterable<BatchExportLine>;\n batchAction(\n id: string,\n action: 'close' | 'pause' | 'resume' | 'cancel' | 'retry',\n ): Promise<BatchRecord>;\n};\n\n/**\n * The counts, the cost and where the batch stands: what a status line\n * prints. Flat on purpose (`p.completed`, not `p.counts.completed`).\n */\nexport type BatchProgress = BatchCounts & {\n id: string;\n state: BatchState;\n /** Every item ever admitted, adopted included. Final once sealed. */\n total: number;\n /** How many are terminal. */\n done: number;\n cost: BatchCost;\n pausedReason?: string;\n};\n\nexport type FlushOptions = {\n /** Price the pages, admit nothing: the buffer stays for a real flush. */\n dryRun?: boolean;\n};\n\nexport type WaitOptions = {\n /** Called after every poll that returned, whether or not the counts moved. */\n onProgress?: (progress: BatchProgress) => void;\n signal?: AbortSignal;\n};\n\n/** How long each `GET ?wait=` is allowed to hang. The route's own ceiling. */\nconst LONG_POLL_SECONDS = 25;\n\n/**\n * The wait between polls while they are failing: doubling from one second to\n * half a minute. A long-poll that fails returns at once, so without a wait a\n * tab that went offline would request again as fast as each attempt failed.\n */\nconst WAIT_RETRY_MS = { first: 1_000, ceiling: 30_000 };\n/** Items per `GET /items` page while iterating. */\nconst LIST_PAGE_SIZE = 100;\n\nexport class Batch {\n readonly id: string;\n readonly key: string;\n\n private latest: BatchRecord;\n /** The flush in flight, or the last one, settled either way. */\n private flushing: Promise<unknown> = Promise.resolve();\n private readonly buffer: BatchItemRequest[] = [];\n /** `buffer[i]` as JSON is about `sizes[i]` bytes. Kept beside it so a\n * page can be closed on bytes without serializing anything twice. */\n private readonly sizes: number[] = [];\n private bytes = 0;\n private readonly client: BatchTransport;\n /** The clock `wait()` measures its patience with. A test turns it. */\n private clock: { now: () => number; sleep: typeof pause } = {\n now: () => Date.now(),\n sleep: pause,\n };\n\n /** @internal `bakery3.batches.open()` and `.get()` make these. */\n constructor(client: BatchTransport, record: BatchRecord) {\n this.client = client;\n this.latest = record;\n this.id = record.id;\n this.key = record.key;\n }\n\n /** Buffer an item. Nothing is sent until `flush()`. */\n add(item: BatchItemRequest): this {\n if (!item.key) {\n throw new Bakery3Error({\n code: 'InvalidRequest',\n message: 'A batch item needs a key.',\n why: 'The key is what lets a re-run adopt the item instead of rendering it twice, and what a failed item is reported under.',\n fix: 'Use something stable that names the picture: `${sku}/${finish}/${camera}`.',\n docs: 'https://bakery3.com/docs/api',\n });\n }\n const size = jsonBytes(item);\n if (size > BATCH_ITEM_BYTES) throw itemTooLarge(item.key, size);\n this.buffer.push(item);\n this.sizes.push(size);\n this.bytes += size;\n return this;\n }\n\n /**\n * `add`, and send a page when one is full. Awaiting it is the\n * backpressure: a loop over a file, a cursor or a generator of any length\n * holds one page at most.\n *\n * for await (const item of source) await batch.write(item);\n * await batch.close();\n */\n async write(item: BatchItemRequest): Promise<void> {\n this.add(item);\n if (this.buffer.length >= BATCH_PAGE_SIZE || this.bytes >= BATCH_PAGE_BYTES)\n await this.flush();\n }\n\n /** Items added and not yet sent. */\n get buffered(): number {\n return this.buffer.length;\n }\n\n /** About how many bytes of JSON those items are. */\n get bufferedBytes(): number {\n return this.bytes;\n }\n\n /**\n * Price items without buffering or admitting them: the estimate, the\n * maximum and any refusal, per item, in the order given. Paged like a\n * flush. An item already completed under its key is quoted as adopted, at\n * nothing, which makes this the price of a re-run too.\n */\n async quote(items: BatchItemRequest[]): Promise<BatchItemOutcome[]> {\n const outcomes: BatchItemOutcome[] = [];\n const sizes = items.map(jsonBytes);\n let offset = 0;\n while (offset < items.length) {\n const count = pageLength(sizes, offset);\n const response = await this.client.addBatchItems(this.id, {\n items: items.slice(offset, offset + count),\n dryRun: true,\n });\n outcomes.push(...response.items);\n offset += count;\n }\n return outcomes;\n }\n\n /**\n * Send the buffer in pages: `BATCH_PAGE_SIZE` items or `BATCH_PAGE_BYTES`\n * of JSON, whichever a page reaches first.\n *\n * Returns one outcome per item sent: admitted, adopted, or refused alone\n * (`outcome.error`). A page refused whole throws `BatchPageRefused` and\n * leaves that page and everything behind it in the buffer, so the caller\n * can top up and call `flush()` again; the error carries the outcomes of\n * the pages that did get through.\n */\n flush(options: FlushOptions = {}): Promise<BatchItemOutcome[]> {\n // One at a time. Two flushes running together would both read the first\n // page, and the second one's splice would remove a page that was never\n // sent: items gone with no error. `close()` flushes too, so a flush nobody\n // awaited followed by a close is enough to meet this.\n const run = this.flushing.then(() => this.flushNow(options));\n this.flushing = run.catch(() => {});\n return run;\n }\n\n private async flushNow(options: FlushOptions): Promise<BatchItemOutcome[]> {\n const outcomes: BatchItemOutcome[] = [];\n let offset = 0;\n while (offset < this.buffer.length) {\n const page = this.buffer.slice(\n offset,\n offset + pageLength(this.sizes, offset),\n );\n let response;\n try {\n response = await this.client.addBatchItems(this.id, {\n items: page,\n ...(options.dryRun ? { dryRun: true } : {}),\n });\n } catch (error) {\n if (error instanceof Bakery3Error)\n throw new BatchPageRefused(error, page, outcomes);\n throw error;\n }\n this.latest = response.batch;\n outcomes.push(...response.items);\n if (options.dryRun) {\n // Priced, not admitted: the items are still ours to send for real.\n offset += page.length;\n } else {\n this.buffer.splice(offset, page.length);\n for (const size of this.sizes.splice(offset, page.length))\n this.bytes -= size;\n }\n }\n return outcomes;\n }\n\n /** Seal: no more items. `completed` fires once the last one is terminal.\n * Anything still buffered is flushed first, because closing over unsent\n * items would quietly drop the tail of a catalog. */\n async close(): Promise<BatchRecord> {\n if (this.buffer.length) await this.flush();\n return this.apply(await this.client.batchAction(this.id, 'close'));\n }\n\n /** Stop feeding the queue; running items finish. */\n async pause(): Promise<BatchRecord> {\n return this.apply(await this.client.batchAction(this.id, 'pause'));\n }\n\n async resume(): Promise<BatchRecord> {\n return this.apply(await this.client.batchAction(this.id, 'resume'));\n }\n\n /** Cancel every non-terminal item. What completed stays completed: it rendered. */\n async cancel(): Promise<BatchRecord> {\n return this.apply(await this.client.batchAction(this.id, 'cancel'));\n }\n\n /** Re-queue every dead-lettered item, one new attempt each. */\n async retry(): Promise<BatchRecord> {\n return this.apply(await this.client.batchAction(this.id, 'retry'));\n }\n\n /** The latest record this batch has seen. No request. */\n record(): BatchRecord {\n return this.latest;\n }\n\n /** Fetch the record now. */\n async refresh(): Promise<BatchRecord> {\n return this.apply(await this.client.getBatch(this.id));\n }\n\n /** Counts and cost from the latest record. No request. */\n progress(): BatchProgress {\n return progressOf(this.latest);\n }\n\n /**\n * Wait for the batch to finish: one long-poll loop on the batch record\n * until it is `completed` or `cancelled` (or sealed with every item\n * terminal). Never a poll per render.\n *\n * A paused batch is waited on, not given up on (someone may resume it from\n * the console), and `onProgress` sees `pausedReason` meanwhile. Pass\n * `signal` to stop waiting; the batch itself is untouched.\n *\n * A fault that clears is ridden out. One that does not (five minutes with\n * not one poll through) rejects with an error that says so and carries the\n * last fault's code. The batch renders on regardless, and `wait()` can be\n * called again.\n */\n async wait(options: WaitOptions = {}): Promise<BatchRecord> {\n const { onProgress, signal } = options;\n const failures = new PollFailures(this.clock.now);\n let failed = 0;\n for (;;) {\n if (signal?.aborted) throw signal.reason ?? abortError();\n if (isFinished(this.latest)) return this.latest;\n try {\n this.apply(\n await this.client.getBatch(this.id, {\n wait: LONG_POLL_SECONDS,\n signal,\n }),\n );\n failed = 0;\n failures.succeeded();\n } catch (error) {\n if (signal?.aborted) throw signal.reason ?? abortError();\n // A transient fault must not lose a batch that is still rendering:\n // keep polling, and only give up on a declared verdict, or on a fault\n // that has outlasted every poll for minutes.\n if (error instanceof Bakery3Error && !error.retryable) throw error;\n if (failures.exhausted()) throw lostContact(this.id, error);\n await this.clock.sleep(\n Math.min(WAIT_RETRY_MS.ceiling, WAIT_RETRY_MS.first * 2 ** failed++),\n signal,\n );\n continue;\n }\n onProgress?.(this.progress());\n }\n }\n\n /** Every item, or every item in one state, walked with the cursor. */\n async *items(\n options: { state?: RenderState } = {},\n ): AsyncIterable<BatchItemRecord> {\n let cursor: string | undefined;\n do {\n const page = await this.client.listBatchItems(this.id, {\n ...(options.state ? { state: options.state } : {}),\n ...(cursor ? { cursor } : {}),\n limit: LIST_PAGE_SIZE,\n });\n yield* page.items;\n cursor = page.cursor ?? undefined;\n } while (cursor);\n }\n\n /** The ledger, line by line, as the server streams it. */\n export(): AsyncIterable<BatchExportLine> {\n return this.client.exportBatch(this.id);\n }\n\n private apply(record: BatchRecord): BatchRecord {\n this.latest = record;\n return record;\n }\n}\n\nexport function progressOf(record: BatchRecord): BatchProgress {\n return {\n ...record.counts,\n id: record.id,\n state: record.state,\n total: record.total,\n done: record.done,\n cost: record.cost,\n ...(record.pausedReason ? { pausedReason: record.pausedReason } : {}),\n };\n}\n\n/** Nothing more will happen to this batch. */\nexport function isFinished(record: BatchRecord): boolean {\n if (record.state === 'completed' || record.state === 'cancelled') return true;\n return record.state === 'sealed' && record.done >= record.total;\n}\n\n/** How many items from `offset` make one page: by count, and by bytes. Never zero. */\nfunction pageLength(sizes: number[], offset: number): number {\n let count = 0;\n let bytes = 0;\n while (offset + count < sizes.length && count < BATCH_PAGE_SIZE) {\n bytes += sizes[offset + count]!;\n if (count > 0 && bytes > BATCH_PAGE_BYTES) break;\n count++;\n }\n return count;\n}\n\n/** UTF-16 units, not bytes: a manifest is ASCII but for the names in it, and\n * the page limit leaves more room than that difference can use. */\nfunction jsonBytes(item: BatchItemRequest): number {\n return JSON.stringify(item).length;\n}\n\nfunction itemTooLarge(key: string, size: number): Bakery3Error {\n return new Bakery3Error({\n code: 'InvalidRequest',\n message: `Item \"${key}\" is ${(size / 1024).toFixed(0)} KB of JSON; an item holds at most ${BATCH_ITEM_BYTES / 1024} KB.`,\n why: 'An item is a manifest: cameras, lights and ids, a few KB. The heavy bytes are assets, uploaded once by hash and named from the manifest.',\n fix: 'Look for something large inline in the spec or its metadata (a data: URL, a geometry, a long array) and ship it as an asset, or leave it out of `metadata`.',\n path: key,\n docs: 'https://bakery3.com/docs/batches#errors',\n });\n}\n\n/** `wait()` gave up: every poll failed for `POLL_GIVE_UP_MS`. Keeps the last fault's code. */\nfunction lostContact(id: string, cause: unknown): Bakery3Error {\n const last = cause instanceof Error ? cause.message : String(cause);\n return new Bakery3Error({\n code: cause instanceof Bakery3Error ? cause.code : 'NetworkError',\n message: `Stopped waiting for batch ${id}: no poll has got through for ${POLL_GIVE_UP_MS / 60_000} minutes. The last error was: ${last}`,\n why: 'The batch keeps rendering on the server whether or not this page can reach it, so wait() rides out a dropped connection. A fault that lasts this long (a token route that is gone, a base URL that stopped resolving) will not clear by itself.',\n fix: 'Fix what the last error names, then call wait() again, or read the set later with getRenderSet(id). Nothing was lost.',\n docs: 'https://bakery3.com/docs/batches#errors',\n retryable: true,\n });\n}\n\n/** A wait that ends early, without throwing, when the signal fires: the loop's own check reports it. */\nfunction pause(ms: number, signal?: AbortSignal): Promise<void> {\n return new Promise((resolve) => {\n const timer = setTimeout(done, ms);\n function done() {\n clearTimeout(timer);\n signal?.removeEventListener('abort', done);\n resolve();\n }\n signal?.addEventListener('abort', done, { once: true });\n });\n}\n\nfunction abortError(): Error {\n const error = new Error('The wait was aborted.');\n error.name = 'AbortError';\n return error;\n}\n","/**\n * A set of pictures: what every many-pictures call hands back.\n *\n * `render({ cameras })` and `renderVariants()` in the browser, and\n * `renderBatch()` from Node, all record into a batch and return one of\n * these, so a set of three and a catalog of six thousand are the same object\n * with the same guarantees: one ceiling for all of it, one poll for all of\n * it, results walked a page at a time and never held.\n *\n * No three.js here: the server entry imports this file.\n */\n\nimport type { RenderError, RenderResult } from './protocol/index.js';\nimport type { Batch, BatchProgress, WaitOptions } from './batch.js';\nimport { Bakery3Error } from './errors.js';\n\n/** One finished picture of a set. */\nexport type RenderSetImage = {\n /** The item's key: `variant/finish/camera`, as recorded. */\n key: string;\n /** The render's id. */\n id: string;\n variant?: string;\n finish?: string;\n camera?: string;\n /** The shot this is, for a set recorded with shots. */\n shot?: string;\n /** `'video'` when the url is a clip. */\n kind?: 'image' | 'video';\n /** Signed and expiring. Copy the bytes; do not serve from it. */\n url: string;\n width: number;\n height: number;\n /** What this picture cost. Nothing, when it was adopted from an earlier run. */\n cost: number;\n metadata?: Record<string, unknown>;\n result: RenderResult;\n};\n\n/** One picture that did not render, and why. */\nexport type RenderSetFailure = {\n key: string;\n id: string;\n variant?: string;\n finish?: string;\n camera?: string;\n shot?: string;\n error: Bakery3Error;\n metadata?: Record<string, unknown>;\n};\n\n/** One picture turned down when it was submitted: it has no render and never will. */\nexport type RenderSetRefusal = {\n key: string;\n variant?: string;\n finish?: string;\n camera?: string;\n shot?: string;\n error: RenderError;\n};\n\n/** What a recording did, in numbers small enough to keep. */\nexport type Recorded = {\n variants: number;\n images: number;\n /** Already rendered under their keys in an earlier run. Cost nothing. */\n adopted: number;\n /** Turned down alone at admission (a spec that does not parse, an item over its own ceiling). */\n refused: number;\n /** The first of those, with their reasons. Capped, because a broken pipeline refuses every item. */\n refusals: RenderSetRefusal[];\n};\n\n/** What a whole run would cost, from `quoteVariants()`. Nothing was admitted. */\nexport type VariantsQuote = Recorded & {\n /** Σ estimate over the pictures that would render. */\n estimated: number;\n /** Σ maximum: what admission would reserve, and the number to set `maxCost` from. */\n maximum: number;\n};\n\nexport class RenderSet {\n /** The batch underneath: pause, resume, retry, the export. */\n readonly batch: Batch;\n readonly id: string;\n readonly key: string;\n /** What the call that made this set recorded. Empty for a set fetched by id. */\n readonly recorded: Recorded;\n /** Item key → position, for a set small enough to have asked for an order. */\n private order?: Map<string, number>;\n\n constructor(batch: Batch, recorded: Recorded = emptyRecorded()) {\n this.batch = batch;\n this.id = batch.id;\n this.key = batch.key;\n this.recorded = recorded;\n }\n\n /** Counts and cost from the latest record. No request. */\n progress(): BatchProgress {\n return this.batch.progress();\n }\n\n /**\n * Until every picture is terminal. One long-poll on the set, however many\n * pictures it has. Resolves with the final counts: pictures that failed\n * are in `failures()`, they do not reject the wait.\n */\n async wait(options: WaitOptions = {}): Promise<BatchProgress> {\n await this.batch.wait(options);\n return this.batch.progress();\n }\n\n /**\n * Every finished picture, a page at a time. Safe on a set of any size,\n * and safe to call before the set is done: it walks what has completed\n * so far.\n */\n async *images(): AsyncIterable<RenderSetImage> {\n for await (const item of this.batch.items({ state: 'completed' })) {\n if (!item.result) continue;\n yield {\n key: item.key,\n id: item.id,\n ...who(item.metadata),\n url: item.result.url,\n width: item.result.width,\n height: item.result.height,\n cost: item.result.cost,\n ...(item.metadata ? { metadata: item.metadata } : {}),\n result: item.result,\n };\n }\n }\n\n /**\n * Every picture that did not render, with the reason and the fix.\n * `error.retryable` tells the two kinds apart: false is a refusal, the\n * scene's fault and the same next time; true ran out of attempts on a\n * fault of ours, and `set.batch.retry()` queues it again.\n */\n async *failures(): AsyncIterable<RenderSetFailure> {\n for await (const item of this.batch.items({ state: 'failed' })) {\n yield {\n key: item.key,\n id: item.id,\n ...who(item.metadata),\n error: item.error\n ? Bakery3Error.from(item.error)\n : new Bakery3Error({\n code: 'WorkerFailure',\n message: 'Ended with no result and no reason.',\n retryable: true,\n }),\n ...(item.metadata ? { metadata: item.metadata } : {}),\n };\n }\n }\n\n /**\n * Wait, then every picture in one array, in camera order for a\n * `render({ cameras })`: one picture per camera, or a rejection. Rejects\n * with `RenderSetRefused` when a picture was turned down at submission\n * (it has no render, and the array would be one short with every later\n * picture in the wrong place), and otherwise with the first failure, as\n * `job.result()` does. The pictures that did render are still there:\n * walk `images()`, each named by its `camera`.\n *\n * It collects, so it is for a handful of pictures. For a catalog, walk\n * `images()`.\n */\n async result(options: WaitOptions = {}): Promise<RenderSetImage[]> {\n await this.wait(options);\n if (this.recorded.refused > 0) throw new RenderSetRefused(this.recorded);\n for await (const failure of this.failures()) throw failure.error;\n const images: RenderSetImage[] = [];\n for await (const image of this.images()) images.push(image);\n const order = this.order;\n if (order)\n images.sort((a, b) => (order.get(a.key) ?? 0) - (order.get(b.key) ?? 0));\n return images;\n }\n\n /** Cancel every picture that has not finished. What completed, completed. */\n async cancel(): Promise<void> {\n await this.batch.cancel();\n }\n\n /** @internal */\n ordered(keys: string[]): this {\n this.order = new Map(keys.map((key, index) => [key, index]));\n return this;\n }\n}\n\n/**\n * Pictures of a set were turned down when they were submitted, so the set\n * cannot give one picture per camera (or per variant) in order.\n *\n * `refusals` says which and why. Its `code` is the first refusal's. The\n * pictures that were accepted render as usual: `set.images()` walks them.\n */\nexport class RenderSetRefused extends Bakery3Error {\n /** Which pictures, and why: the first fifty when a run refused more. */\n readonly refusals: Array<\n Omit<RenderSetRefusal, 'error'> & { error: Bakery3Error }\n >;\n /** How many were refused in all. */\n readonly refused: number;\n /** How many pictures were asked for. */\n readonly requested: number;\n\n constructor(recorded: Recorded) {\n const first = recorded.refusals[0];\n const names = recorded.refusals.slice(0, 3).map(describeRefusal);\n const more = recorded.refused - names.length;\n super({\n code: first?.error.code ?? 'InvalidRequest',\n message: `${recorded.refused} of ${recorded.images} pictures ${recorded.refused === 1 ? 'was' : 'were'} refused: ${names.join('; ')}${more > 0 ? `; and ${more} more` : ''}.`,\n why: 'A picture refused when it was submitted never renders. An array of the rest would be shorter than the list you asked for, with every later picture in the wrong place, so result() gives none.',\n fix: 'Read error.refusals for each refused picture and its reason. The pictures that were accepted still render: set.images() walks them, each named by its camera.',\n docs: 'https://bakery3.com/docs/batches#errors',\n retryable: false,\n });\n this.name = 'RenderSetRefused';\n this.refusals = recorded.refusals.map(({ error, ...who }) => ({\n ...who,\n error: Bakery3Error.from(error),\n }));\n this.refused = recorded.refused;\n this.requested = recorded.images;\n }\n}\n\nfunction describeRefusal(refusal: RenderSetRefusal): string {\n const name =\n [refusal.variant, refusal.finish, refusal.camera, refusal.shot]\n .filter(Boolean)\n .join(' / ') || refusal.key;\n return `\"${name}\" (${refusal.error.message.replace(/\\.$/, '')})`;\n}\n\n/** The variant, finish, camera and shot an item was recorded under, from its metadata. */\nexport function who(\n metadata: Record<string, unknown> | undefined,\n): Pick<RenderSetImage, 'variant' | 'finish' | 'camera' | 'shot' | 'kind'> {\n const out: Pick<\n RenderSetImage,\n 'variant' | 'finish' | 'camera' | 'shot' | 'kind'\n > = {};\n if (typeof metadata?.variant === 'string') out.variant = metadata.variant;\n // The catalog recorder's own word for it.\n else if (typeof metadata?.sku === 'string') out.variant = metadata.sku;\n if (typeof metadata?.finish === 'string') out.finish = metadata.finish;\n if (typeof metadata?.camera === 'string') out.camera = metadata.camera;\n if (typeof metadata?.shot === 'string') out.shot = metadata.shot;\n if (metadata?.kind === 'video' || metadata?.kind === 'image')\n out.kind = metadata.kind;\n return out;\n}\n\nexport function emptyRecorded(): Recorded {\n return { variants: 0, images: 0, adopted: 0, refused: 0, refusals: [] };\n}\n","/**\n * The test run: a few products, every camera, small and fast.\n *\n * Before six thousand pictures are paid for, three products are worth\n * looking at: are the cameras where they were meant to be, is the room the\n * right way round, does the finish list hide what it should. A test run is\n * the real run's own options with three changes, made here so the browser\n * and the server make the same ones:\n *\n * - A sample of the products. From an array: the first, the middle and the\n * last, because a catalog is usually sorted and its ends differ most.\n * From anything else (a generator, a cursor): the first three, since a\n * list that is never collected has no middle to ask for.\n * - Preview quality at a small size, the long edge 512 unless told\n * otherwise, the aspect kept, so the framing is the real run's framing.\n * - Its own keys. A test is looked at and thrown away; if it shared the real\n * run's keys, the real run would adopt these little previews as finished\n * pictures. Every test also differs from the last one, so a test after a\n * fix shows the fix and not yesterday's frame.\n *\n * No three.js here: the server entry imports this file.\n */\n\nimport type { QualityPreset } from './protocol/index.js';\n\nexport type TestRunOptions = {\n /** How many products. Default 3. */\n products?: number;\n /** The long edge of each picture, in pixels. Default 512. */\n size?: number;\n /** The ceiling for the test, in dollars. Default 5. */\n maxCost?: number;\n};\n\nexport const TEST_DEFAULTS = { products: 3, size: 512, maxCost: 5 } as const;\n\nexport type TestSettings = {\n key: string;\n version: string;\n quality: QualityPreset;\n width: number;\n height: number;\n maxCost: number;\n lane: 'normal';\n};\n\n/** What a test changes about a run whose real pictures are `width` × `height`. */\nexport function testSettings(\n run: { key: string; width: number; height: number },\n options: TestRunOptions = {},\n now: number = Date.now(),\n): TestSettings {\n const size = Math.max(64, Math.round(options.size ?? TEST_DEFAULTS.size));\n const scale = size / Math.max(run.width, run.height);\n const stamp = now.toString(36);\n return {\n key: `${run.key}:test:${stamp}`,\n version: `test-${stamp}`,\n quality: 'preview',\n // Even, because an encoder somewhere always wants that.\n width: Math.max(2, Math.round((run.width * scale) / 2) * 2),\n height: Math.max(2, Math.round((run.height * scale) / 2) * 2),\n maxCost: options.maxCost ?? TEST_DEFAULTS.maxCost,\n lane: 'normal',\n };\n}\n\n/**\n * The key a run's quote is priced under: the run's key with `:quote` after\n * it. A quote never opens the run's own batch, because the run's batch is\n * the one opened with the run's `maxCost`, and a batch is re-opened by key.\n */\nexport function quoteKey(runKey: string): string {\n return `${runKey}:quote`;\n}\n\n/** The sample, without holding more of the list than the caller already does. */\nexport async function* sampleOf<V>(\n variants: Iterable<V> | AsyncIterable<V>,\n count: number = TEST_DEFAULTS.products,\n): AsyncIterable<V> {\n const wanted = Math.max(1, Math.floor(count));\n if (Array.isArray(variants)) {\n const length = variants.length;\n if (length <= wanted) return yield* variants as V[];\n const picked = new Set<number>();\n for (let i = 0; i < wanted; i++)\n picked.add(Math.round((i * (length - 1)) / (wanted - 1 || 1)));\n for (const index of [...picked].sort((a, b) => a - b))\n yield variants[index] as V;\n return;\n }\n let taken = 0;\n for await (const variant of variants) {\n yield variant;\n if (++taken >= wanted) return;\n }\n}\n","/**\n * Cameras without a scene graph: where to stand to photograph a box.\n *\n * In the browser a camera is an object the developer placed. From a server\n * there is a model's bounds (`GlbFacts.bounds`, read at import) and nothing\n * else, so a view is described the way a photographer would: from which\n * side, how high, how tight. `framedCamera` turns that into the same\n * `CameraSpec` a captured camera becomes.\n *\n * No three.js here: the server entry imports this file.\n */\n\nimport type { CameraSpec, Quat, Vec3 } from './protocol/index.js';\nimport { Bakery3Error } from './errors.js';\n\nexport type Bounds = { min: Vec3; max: Vec3 };\n\n/** Where to look from: degrees around the model from its front (+Z, where glTF says a model faces) toward its right (+X), and degrees above the horizon. */\nexport type Angle = { azimuthDeg: number; elevationDeg?: number };\n\n/** A view framed around the model, whatever its size and wherever it sits. */\nexport type FramedView = Angle & {\n id: string;\n /** Vertical field of view in degrees. Default 30: a product lens, little perspective. */\n fov?: number;\n /** Room around the model, as a share of its size. Default 0.12. */\n margin?: number;\n};\n\n/** A camera declared absolutely, in the model's own coordinates. */\nexport type DeclaredView = {\n id: string;\n position: Vec3;\n target: Vec3;\n fov: number;\n};\n\n/** The framings with names. */\nexport const VIEW_WORDS = {\n front: { azimuthDeg: 0, elevationDeg: 6 },\n 'three-quarter': { azimuthDeg: 35, elevationDeg: 14 },\n side: { azimuthDeg: 90, elevationDeg: 6 },\n back: { azimuthDeg: 180, elevationDeg: 6 },\n 'three-quarter-back': { azimuthDeg: 145, elevationDeg: 14 },\n top: { azimuthDeg: 0, elevationDeg: 88 },\n} as const satisfies Record<string, Omit<FramedView, 'id'>>;\n\nexport type ViewWord = keyof typeof VIEW_WORDS;\n\n/** A word or an angle, as an angle. Anything else is null. */\nexport function angleOf(view: unknown): Angle | null {\n if (typeof view === 'string')\n return view in VIEW_WORDS ? { ...VIEW_WORDS[view as ViewWord] } : null;\n if (\n view &&\n typeof view === 'object' &&\n typeof (view as Angle).azimuthDeg === 'number'\n ) {\n const { azimuthDeg, elevationDeg } = view as Angle;\n return {\n azimuthDeg,\n ...(elevationDeg !== undefined ? { elevationDeg } : {}),\n };\n }\n return null;\n}\n\n/** The angle `t` of the way from `from` to `to`, azimuth as given: 0 to 360 is a full turn, 0 to -90 goes the other way. */\nexport function angleBetween(from: Angle, to: Angle, t: number): Angle {\n const fromEl = from.elevationDeg ?? 12;\n const toEl = to.elevationDeg ?? 12;\n return {\n azimuthDeg: from.azimuthDeg + (to.azimuthDeg - from.azimuthDeg) * t,\n elevationDeg: fromEl + (toEl - fromEl) * t,\n };\n}\n\n/** The unit direction from a model's center toward a camera at this angle. */\nexport function directionOf(angle: Angle): Vec3 {\n const azimuth = (angle.azimuthDeg * Math.PI) / 180;\n const elevation = ((angle.elevationDeg ?? 12) * Math.PI) / 180;\n return [\n Math.sin(azimuth) * Math.cos(elevation),\n Math.sin(elevation),\n Math.cos(azimuth) * Math.cos(elevation),\n ];\n}\n\n/** How far a camera with this lens stands from a sphere of `radius` to fit it, with `margin` to spare. */\nexport function framedDistance(\n radius: number,\n fov: number,\n aspect: number,\n margin: number,\n): number {\n const vertical = (fov * Math.PI) / 180;\n const horizontal = 2 * Math.atan(Math.tan(vertical / 2) * aspect);\n return (radius * (1 + margin)) / Math.sin(Math.min(vertical, horizontal) / 2);\n}\n\nexport function radiusOf(bounds: Bounds): number {\n return (\n Math.hypot(\n bounds.max[0] - bounds.min[0],\n bounds.max[1] - bounds.min[1],\n bounds.max[2] - bounds.min[2],\n ) / 2 || 0.5\n );\n}\n\nexport function centerOf(bounds: Bounds): Vec3 {\n return [\n (bounds.min[0] + bounds.max[0]) / 2,\n (bounds.min[1] + bounds.max[1]) / 2,\n (bounds.min[2] + bounds.max[2]) / 2,\n ];\n}\n\n/**\n * Stand far enough back that the model's bounding sphere fits the narrower\n * of the two fields of view, with `margin` to spare. A sphere, not the box's\n * silhouette: it is a little loose on a tall thin thing and never crops.\n */\nexport function framedCamera(\n bounds: Bounds,\n view: FramedView,\n aspect: number,\n): CameraSpec {\n const fov = view.fov ?? 30;\n if (!(fov > 1 && fov < 120))\n throw badView(view.id, `fov ${fov} is outside 1 to 120 degrees`);\n const center = centerOf(bounds);\n const radius = radiusOf(bounds);\n const distance = framedDistance(radius, fov, aspect, view.margin ?? 0.12);\n return cameraAt(\n center,\n radius,\n directionOf(view),\n distance,\n fov,\n aspect,\n view.id,\n );\n}\n\n/** A camera `distance` along `direction` from `center`, looking back at it. */\nexport function cameraAt(\n center: Vec3,\n radius: number,\n direction: Vec3,\n distance: number,\n fov: number,\n aspect: number,\n name: string,\n): CameraSpec {\n const position: Vec3 = [\n center[0] + direction[0] * distance,\n center[1] + direction[1] * distance,\n center[2] + direction[2] * distance,\n ];\n return {\n type: 'perspective',\n fov,\n aspect,\n near: Math.max(0.001, (distance - radius) / 10),\n far: (distance + radius) * 10,\n position,\n quaternion: lookAt(position, center),\n name,\n };\n}\n\nexport function declaredCamera(view: DeclaredView, aspect: number): CameraSpec {\n const distance = Math.hypot(\n view.position[0] - view.target[0],\n view.position[1] - view.target[1],\n view.position[2] - view.target[2],\n );\n if (!(distance > 0)) throw badView(view.id, 'its position is on its target');\n return {\n type: 'perspective',\n fov: view.fov,\n aspect,\n near: Math.max(0.01, distance / 100),\n far: Math.max(100, distance * 100),\n position: [...view.position] as Vec3,\n quaternion: lookAt(view.position, view.target),\n name: view.id,\n };\n}\n\n/**\n * The rotation of a camera at `position` looking at `target`, +Y up, by\n * three's convention: a camera looks down its local -Z.\n */\nexport function lookAt(position: Vec3, target: Vec3): Quat {\n let z = normalize([\n position[0] - target[0],\n position[1] - target[1],\n position[2] - target[2],\n ]);\n if (!z) z = [0, 0, 1];\n // Straight down (or up): +Y up is degenerate, so face -Z as three does.\n const up: Vec3 =\n Math.abs(z[0]) < 1e-9 && Math.abs(z[2]) < 1e-9 ? [0, 0, -1] : [0, 1, 0];\n const x = normalize(cross(up, z)) ?? [1, 0, 0];\n const y = cross(z, x);\n return quaternionOf(x, y, z);\n}\n\nfunction quaternionOf(x: Vec3, y: Vec3, z: Vec3): Quat {\n const m00 = x[0],\n m10 = x[1],\n m20 = x[2];\n const m01 = y[0],\n m11 = y[1],\n m21 = y[2];\n const m02 = z[0],\n m12 = z[1],\n m22 = z[2];\n const trace = m00 + m11 + m22;\n if (trace > 0) {\n const s = 0.5 / Math.sqrt(trace + 1);\n return [(m21 - m12) * s, (m02 - m20) * s, (m10 - m01) * s, 0.25 / s];\n }\n if (m00 > m11 && m00 > m22) {\n const s = 2 * Math.sqrt(1 + m00 - m11 - m22);\n return [0.25 * s, (m01 + m10) / s, (m02 + m20) / s, (m21 - m12) / s];\n }\n if (m11 > m22) {\n const s = 2 * Math.sqrt(1 + m11 - m00 - m22);\n return [(m01 + m10) / s, 0.25 * s, (m12 + m21) / s, (m02 - m20) / s];\n }\n const s = 2 * Math.sqrt(1 + m22 - m00 - m11);\n return [(m02 + m20) / s, (m12 + m21) / s, 0.25 * s, (m10 - m01) / s];\n}\n\nfunction cross(a: Vec3, b: Vec3): Vec3 {\n return [\n a[1] * b[2] - a[2] * b[1],\n a[2] * b[0] - a[0] * b[2],\n a[0] * b[1] - a[1] * b[0],\n ];\n}\n\nfunction normalize(v: Vec3): Vec3 | null {\n const length = Math.hypot(v[0], v[1], v[2]);\n return length > 1e-12 ? [v[0] / length, v[1] / length, v[2] / length] : null;\n}\n\nfunction badView(id: string, what: string): Bakery3Error {\n return new Bakery3Error({\n code: 'InvalidRequest',\n message: `Camera \"${id}\": ${what}.`,\n docs: 'https://bakery3.com/docs/catalog#angles',\n });\n}\n","/**\n * Generated by the preset library's sync script. Do not edit.\n *\n * The catalog of presets served from the CDN: every material, pedestal and\n * environment the SDK can load, with its files and dimensions.\n */\n\nexport const PRESETS_VERSION = 1;\n\nexport type PresetMapName = 'albedo' | 'normal' | 'roughness' | 'ao' | 'height';\nexport type PresetTextureSize = '1k' | '2k' | '4k';\n\nexport type MaterialPresetInfo = {\n label: string;\n category: 'floor' | 'wall' | 'generic';\n description: string;\n /** Physical edge length, metres, of one texture tile. */\n tileMeters: number;\n metalness: number;\n normalScale: number;\n /** Metres of relief the height map's 0..1 spans. */\n heightScale: number;\n maps: readonly PresetMapName[];\n /** Filename for each map inside a material size directory. */\n files: Readonly<Record<PresetMapName, string>>;\n sizes: readonly PresetTextureSize[];\n};\n\nexport const MATERIAL_PRESETS = {\n \"oak_floor\": {\n \"label\": \"Oak Plank Floor\",\n \"category\": \"floor\",\n \"description\": \"Warm honey oak planks, satin lacquer, gentle per-plank variation.\",\n \"tileMeters\": 2.4,\n \"metalness\": 0,\n \"normalScale\": 1,\n \"heightScale\": 0.004,\n \"maps\": [\n \"albedo\",\n \"normal\",\n \"roughness\",\n \"ao\",\n \"height\"\n ],\n \"files\": {\n \"albedo\": \"albedo.png\",\n \"normal\": \"normal.png\",\n \"roughness\": \"roughness.png\",\n \"ao\": \"ao.png\",\n \"height\": \"height.png\"\n },\n \"sizes\": [\n \"4k\",\n \"2k\",\n \"1k\"\n ]\n },\n \"walnut_floor\": {\n \"label\": \"Walnut Plank Floor\",\n \"category\": \"floor\",\n \"description\": \"Dark oiled walnut boards with straight, fine grain.\",\n \"tileMeters\": 2.4,\n \"metalness\": 0,\n \"normalScale\": 1,\n \"heightScale\": 0.004,\n \"maps\": [\n \"albedo\",\n \"normal\",\n \"roughness\",\n \"ao\",\n \"height\"\n ],\n \"files\": {\n \"albedo\": \"albedo.png\",\n \"normal\": \"normal.png\",\n \"roughness\": \"roughness.png\",\n \"ao\": \"ao.png\",\n \"height\": \"height.png\"\n },\n \"sizes\": [\n \"4k\",\n \"2k\",\n \"1k\"\n ]\n },\n \"white_plaster\": {\n \"label\": \"White Plaster\",\n \"category\": \"wall\",\n \"description\": \"Hand-trowelled lime plaster, soft undulation with a fine tooth.\",\n \"tileMeters\": 1.5,\n \"metalness\": 0,\n \"normalScale\": 1,\n \"heightScale\": 0.005,\n \"maps\": [\n \"albedo\",\n \"normal\",\n \"roughness\",\n \"ao\",\n \"height\"\n ],\n \"files\": {\n \"albedo\": \"albedo.png\",\n \"normal\": \"normal.png\",\n \"roughness\": \"roughness.png\",\n \"ao\": \"ao.png\",\n \"height\": \"height.png\"\n },\n \"sizes\": [\n \"4k\",\n \"2k\",\n \"1k\"\n ]\n },\n \"matte_paint\": {\n \"label\": \"Matte Paint\",\n \"category\": \"wall\",\n \"description\": \"Near-white matte emulsion with a faint roller texture. Tint it with material.color.\",\n \"tileMeters\": 1.2,\n \"metalness\": 0,\n \"normalScale\": 0.6,\n \"heightScale\": 0.0012,\n \"maps\": [\n \"albedo\",\n \"normal\",\n \"roughness\",\n \"ao\",\n \"height\"\n ],\n \"files\": {\n \"albedo\": \"albedo.png\",\n \"normal\": \"normal.png\",\n \"roughness\": \"roughness.png\",\n \"ao\": \"ao.png\",\n \"height\": \"height.png\"\n },\n \"sizes\": [\n \"4k\",\n \"2k\",\n \"1k\"\n ]\n },\n \"polished_concrete\": {\n \"label\": \"Polished Concrete\",\n \"category\": \"floor\",\n \"description\": \"Grey power-trowelled concrete, soft mottling and sparse aggregate.\",\n \"tileMeters\": 3,\n \"metalness\": 0,\n \"normalScale\": 0.8,\n \"heightScale\": 0.002,\n \"maps\": [\n \"albedo\",\n \"normal\",\n \"roughness\",\n \"ao\",\n \"height\"\n ],\n \"files\": {\n \"albedo\": \"albedo.png\",\n \"normal\": \"normal.png\",\n \"roughness\": \"roughness.png\",\n \"ao\": \"ao.png\",\n \"height\": \"height.png\"\n },\n \"sizes\": [\n \"4k\",\n \"2k\",\n \"1k\"\n ]\n },\n \"carrara_marble\": {\n \"label\": \"Carrara Marble\",\n \"category\": \"generic\",\n \"description\": \"Polished white marble with soft grey feather veining.\",\n \"tileMeters\": 2,\n \"metalness\": 0,\n \"normalScale\": 0.5,\n \"heightScale\": 0.0008,\n \"maps\": [\n \"albedo\",\n \"normal\",\n \"roughness\",\n \"ao\",\n \"height\"\n ],\n \"files\": {\n \"albedo\": \"albedo.png\",\n \"normal\": \"normal.png\",\n \"roughness\": \"roughness.png\",\n \"ao\": \"ao.png\",\n \"height\": \"height.png\"\n },\n \"sizes\": [\n \"4k\",\n \"2k\",\n \"1k\"\n ]\n },\n \"terrazzo\": {\n \"label\": \"Terrazzo\",\n \"category\": \"floor\",\n \"description\": \"Cream cement ground with polished multi-tone stone chips.\",\n \"tileMeters\": 1.6,\n \"metalness\": 0,\n \"normalScale\": 0.6,\n \"heightScale\": 0.0012,\n \"maps\": [\n \"albedo\",\n \"normal\",\n \"roughness\",\n \"ao\",\n \"height\"\n ],\n \"files\": {\n \"albedo\": \"albedo.png\",\n \"normal\": \"normal.png\",\n \"roughness\": \"roughness.png\",\n \"ao\": \"ao.png\",\n \"height\": \"height.png\"\n },\n \"sizes\": [\n \"4k\",\n \"2k\",\n \"1k\"\n ]\n },\n \"travertine\": {\n \"label\": \"Travertine\",\n \"category\": \"generic\",\n \"description\": \"Honed beige travertine, layered banding and natural pitting.\",\n \"tileMeters\": 2,\n \"metalness\": 0,\n \"normalScale\": 1,\n \"heightScale\": 0.004,\n \"maps\": [\n \"albedo\",\n \"normal\",\n \"roughness\",\n \"ao\",\n \"height\"\n ],\n \"files\": {\n \"albedo\": \"albedo.png\",\n \"normal\": \"normal.png\",\n \"roughness\": \"roughness.png\",\n \"ao\": \"ao.png\",\n \"height\": \"height.png\"\n },\n \"sizes\": [\n \"4k\",\n \"2k\",\n \"1k\"\n ]\n },\n \"white_brick\": {\n \"label\": \"Painted Brick\",\n \"category\": \"wall\",\n \"description\": \"White-painted brick with recessed mortar joints.\",\n \"tileMeters\": 2,\n \"metalness\": 0,\n \"normalScale\": 1,\n \"heightScale\": 0.008,\n \"maps\": [\n \"albedo\",\n \"normal\",\n \"roughness\",\n \"ao\",\n \"height\"\n ],\n \"files\": {\n \"albedo\": \"albedo.png\",\n \"normal\": \"normal.png\",\n \"roughness\": \"roughness.png\",\n \"ao\": \"ao.png\",\n \"height\": \"height.png\"\n },\n \"sizes\": [\n \"4k\",\n \"2k\",\n \"1k\"\n ]\n },\n \"coated_pine\": {\n \"label\": \"Coated Pine\",\n \"category\": \"generic\",\n \"description\": \"Warm knotty pine with a glossy worn varnish.\",\n \"tileMeters\": 0.7,\n \"metalness\": 0,\n \"normalScale\": 1,\n \"heightScale\": 0.005,\n \"maps\": [\n \"albedo\",\n \"normal\",\n \"roughness\",\n \"ao\",\n \"height\"\n ],\n \"files\": {\n \"albedo\": \"albedo.jpg\",\n \"normal\": \"normal.png\",\n \"roughness\": \"arm.jpg\",\n \"ao\": \"arm.jpg\",\n \"height\": \"height.png\"\n },\n \"sizes\": [\n \"4k\",\n \"2k\",\n \"1k\"\n ]\n },\n \"laminate_floor\": {\n \"label\": \"Worn Laminate Floor\",\n \"category\": \"floor\",\n \"description\": \"Light oak laminate planks with scratches, stains and a soft gloss.\",\n \"tileMeters\": 2,\n \"metalness\": 0,\n \"normalScale\": 1,\n \"heightScale\": 0.006,\n \"maps\": [\n \"albedo\",\n \"normal\",\n \"roughness\",\n \"ao\",\n \"height\"\n ],\n \"files\": {\n \"albedo\": \"albedo.jpg\",\n \"normal\": \"normal.png\",\n \"roughness\": \"arm.jpg\",\n \"ao\": \"arm.jpg\",\n \"height\": \"height.png\"\n },\n \"sizes\": [\n \"4k\",\n \"2k\",\n \"1k\"\n ]\n },\n \"oak_veneer_05\": {\n \"label\": \"Oak Veneer\",\n \"category\": \"generic\",\n \"description\": \"Natural dark oak veneer with fine grain and a raw matte finish.\",\n \"tileMeters\": 1,\n \"metalness\": 0,\n \"normalScale\": 1,\n \"heightScale\": 0.002,\n \"maps\": [\n \"albedo\",\n \"normal\",\n \"roughness\",\n \"ao\",\n \"height\"\n ],\n \"files\": {\n \"albedo\": \"albedo.jpg\",\n \"normal\": \"normal.png\",\n \"roughness\": \"arm.jpg\",\n \"ao\": \"arm.jpg\",\n \"height\": \"height.png\"\n },\n \"sizes\": [\n \"4k\",\n \"2k\",\n \"1k\"\n ]\n },\n \"plank_flooring_04\": {\n \"label\": \"Dark Plank Flooring\",\n \"category\": \"floor\",\n \"description\": \"Dark varnished timber planks with narrow seams and satin sheen.\",\n \"tileMeters\": 2,\n \"metalness\": 0,\n \"normalScale\": 1,\n \"heightScale\": 0.006,\n \"maps\": [\n \"albedo\",\n \"normal\",\n \"roughness\",\n \"ao\",\n \"height\"\n ],\n \"files\": {\n \"albedo\": \"albedo.jpg\",\n \"normal\": \"normal.png\",\n \"roughness\": \"arm.jpg\",\n \"ao\": \"arm.jpg\",\n \"height\": \"height.png\"\n },\n \"sizes\": [\n \"4k\",\n \"2k\",\n \"1k\"\n ]\n },\n \"synthetic_wood\": {\n \"label\": \"Synthetic Wood Cladding\",\n \"category\": \"wall\",\n \"description\": \"Narrow brown wood-look boards with crisp grooves and a matte finish.\",\n \"tileMeters\": 2,\n \"metalness\": 0,\n \"normalScale\": 1,\n \"heightScale\": 0.006,\n \"maps\": [\n \"albedo\",\n \"normal\",\n \"roughness\",\n \"ao\",\n \"height\"\n ],\n \"files\": {\n \"albedo\": \"albedo.jpg\",\n \"normal\": \"normal.png\",\n \"roughness\": \"arm.jpg\",\n \"ao\": \"arm.jpg\",\n \"height\": \"height.png\"\n },\n \"sizes\": [\n \"4k\",\n \"2k\",\n \"1k\"\n ]\n },\n \"wooden_floor_02\": {\n \"label\": \"Warm Hardwood Floor\",\n \"category\": \"floor\",\n \"description\": \"Warm hardwood planks with visible grain, knots and satin sheen.\",\n \"tileMeters\": 1.9,\n \"metalness\": 0,\n \"normalScale\": 1,\n \"heightScale\": 0.006,\n \"maps\": [\n \"albedo\",\n \"normal\",\n \"roughness\",\n \"ao\",\n \"height\"\n ],\n \"files\": {\n \"albedo\": \"albedo.jpg\",\n \"normal\": \"normal.png\",\n \"roughness\": \"arm.jpg\",\n \"ao\": \"arm.jpg\",\n \"height\": \"height.png\"\n },\n \"sizes\": [\n \"4k\",\n \"2k\",\n \"1k\"\n ]\n }\n} as const;\n\nexport type MaterialPresetName = keyof typeof MATERIAL_PRESETS;\n\nexport type PedestalPresetInfo = {\n label: string;\n description: string;\n /** three.js axes, metres: x width, y height (up), z depth. */\n size: { readonly x: number; readonly y: number; readonly z: number };\n defaultMaterial: MaterialPresetName;\n};\n\nexport const PEDESTAL_PRESETS = {\n \"pedestal_block\": {\n \"label\": \"Block Pedestal\",\n \"description\": \"Clean rectangular plinth with softly bevelled edges.\",\n \"size\": {\n \"x\": 0.4,\n \"y\": 1,\n \"z\": 0.4\n },\n \"defaultMaterial\": \"carrara_marble\"\n },\n \"pedestal_plinth\": {\n \"label\": \"Low Plinth\",\n \"description\": \"Wide, low platform for larger pieces.\",\n \"size\": {\n \"x\": 0.9,\n \"y\": 0.3,\n \"z\": 0.9\n },\n \"defaultMaterial\": \"polished_concrete\"\n },\n \"pedestal_cylinder\": {\n \"label\": \"Cylinder Pedestal\",\n \"description\": \"Round column pedestal with bevelled rims.\",\n \"size\": {\n \"x\": 0.42,\n \"y\": 0.95,\n \"z\": 0.42\n },\n \"defaultMaterial\": \"travertine\"\n },\n \"pedestal_column\": {\n \"label\": \"Classical Column\",\n \"description\": \"Turned classical pedestal: stepped base, gently tapered shaft, moulded cap.\",\n \"size\": {\n \"x\": 0.45,\n \"y\": 1.05,\n \"z\": 0.45\n },\n \"defaultMaterial\": \"carrara_marble\"\n }\n} as const;\n\nexport type PedestalPresetName = keyof typeof PEDESTAL_PRESETS;\n\n/** The shelf a map sits on: a room in that lighting mode offers it; `studio` is for product probes. */\nexport type HdriPresetCategory = 'day' | 'golden' | 'overcast' | 'night' | 'studio';\n\nexport type HdriPresetInfo = {\n label: string;\n description: string;\n category: HdriPresetCategory;\n /** Metres the camera stood above the ground: the height a ground-projected dome is lifted by. */\n groundHeight: number;\n /**\n * W/m² its sky delivers to a plane facing up, as measured (the map clamped\n * so its own sun does not count). A room shows the map at its own\n * `skyIrradiance` divided by this, so a map shot darker than the room is\n * lit is not a dim poster outside the windows.\n */\n skyIrradiance: number;\n preview: { readonly file: string; readonly resolution: number };\n render: { readonly file: string; readonly resolution: number };\n};\n\nexport const HDRI_PRESETS = {\n \"pergola_walkway\": {\n \"label\": \"Pergola Walkway\",\n \"description\": \"A garden walkway under a vine-covered pergola, high sun, greenery on every side.\",\n \"category\": \"day\",\n \"groundHeight\": 1.6,\n \"skyIrradiance\": 1.7631801999999999,\n \"preview\": {\n \"file\": \"pergola_walkway_1k.hdr\",\n \"resolution\": 1024\n },\n \"render\": {\n \"file\": \"pergola_walkway_4k.exr\",\n \"resolution\": 4096\n }\n },\n \"sunny_country_road\": {\n \"label\": \"Sunny Country Road\",\n \"description\": \"A dirt road between fields under a high midday sun.\",\n \"category\": \"day\",\n \"groundHeight\": 1.6,\n \"skyIrradiance\": 1.0989418,\n \"preview\": {\n \"file\": \"sunny_country_road_1k.hdr\",\n \"resolution\": 1024\n },\n \"render\": {\n \"file\": \"sunny_country_road_4k.exr\",\n \"resolution\": 4096\n }\n },\n \"horn-koppe_spring\": {\n \"label\": \"Horn-Koppe Spring\",\n \"description\": \"Alpine meadow in spring, snow on the peaks, a high clear sun.\",\n \"category\": \"day\",\n \"groundHeight\": 1.6,\n \"skyIrradiance\": 1.4612264,\n \"preview\": {\n \"file\": \"horn-koppe_spring_1k.hdr\",\n \"resolution\": 1024\n },\n \"render\": {\n \"file\": \"horn-koppe_spring_4k.exr\",\n \"resolution\": 4096\n }\n },\n \"grasslands_sunset\": {\n \"label\": \"Grasslands Late Sun\",\n \"description\": \"Open grassland with the sun low but still white, a long afternoon.\",\n \"category\": \"day\",\n \"groundHeight\": 1.6,\n \"skyIrradiance\": 3.9029496,\n \"preview\": {\n \"file\": \"grasslands_sunset_1k.hdr\",\n \"resolution\": 1024\n },\n \"render\": {\n \"file\": \"grasslands_sunset_4k.exr\",\n \"resolution\": 4096\n }\n },\n \"je_gray_02\": {\n \"label\": \"Grey Park\",\n \"description\": \"A shaded park path, the sun low behind trees, a soft, cool day.\",\n \"category\": \"day\",\n \"groundHeight\": 1.6,\n \"skyIrradiance\": 0.21612759999999998,\n \"preview\": {\n \"file\": \"je_gray_02_1k.hdr\",\n \"resolution\": 1024\n },\n \"render\": {\n \"file\": \"je_gray_02_4k.exr\",\n \"resolution\": 4096\n }\n },\n \"qwantani_sunset\": {\n \"label\": \"Qwantani Sunset\",\n \"description\": \"Sunset over the veld: a warm horizon and a clear deep sky above.\",\n \"category\": \"golden\",\n \"groundHeight\": 1.6,\n \"skyIrradiance\": 2.3187784,\n \"preview\": {\n \"file\": \"qwantani_sunset_1k.hdr\",\n \"resolution\": 1024\n },\n \"render\": {\n \"file\": \"qwantani_sunset_4k.exr\",\n \"resolution\": 4096\n }\n },\n \"venice_sunset\": {\n \"label\": \"Venice Sunset\",\n \"description\": \"The lagoon at sunset, water and sky both gold.\",\n \"category\": \"golden\",\n \"groundHeight\": 1.6,\n \"skyIrradiance\": 2.1780174,\n \"preview\": {\n \"file\": \"venice_sunset_1k.hdr\",\n \"resolution\": 1024\n },\n \"render\": {\n \"file\": \"venice_sunset_4k.exr\",\n \"resolution\": 4096\n }\n },\n \"bambanani_sunset\": {\n \"label\": \"Bambanani Sunset\",\n \"description\": \"A township street at sunset, the sun red and low.\",\n \"category\": \"golden\",\n \"groundHeight\": 1.6,\n \"skyIrradiance\": 3.300283399999999,\n \"preview\": {\n \"file\": \"bambanani_sunset_1k.hdr\",\n \"resolution\": 1024\n },\n \"render\": {\n \"file\": \"bambanani_sunset_4k.exr\",\n \"resolution\": 4096\n }\n },\n \"umhlanga_sunrise\": {\n \"label\": \"Umhlanga Sunrise\",\n \"description\": \"Sunrise over the sea, the sun just clear of the horizon.\",\n \"category\": \"golden\",\n \"groundHeight\": 1.6,\n \"skyIrradiance\": 3.3150258000000004,\n \"preview\": {\n \"file\": \"umhlanga_sunrise_1k.hdr\",\n \"resolution\": 1024\n },\n \"render\": {\n \"file\": \"umhlanga_sunrise_4k.exr\",\n \"resolution\": 4096\n }\n },\n \"flamingo_pan\": {\n \"label\": \"Flamingo Pan\",\n \"description\": \"A salt pan at sunset, the sun on the horizon and a violet sky.\",\n \"category\": \"golden\",\n \"groundHeight\": 1.6,\n \"skyIrradiance\": 3.1940932,\n \"preview\": {\n \"file\": \"flamingo_pan_1k.hdr\",\n \"resolution\": 1024\n },\n \"render\": {\n \"file\": \"flamingo_pan_4k.exr\",\n \"resolution\": 4096\n }\n },\n \"minedump_flats\": {\n \"label\": \"Minedump Flats\",\n \"description\": \"Flat scrub at sunset under a hazy, dusty sky.\",\n \"category\": \"golden\",\n \"groundHeight\": 1.6,\n \"skyIrradiance\": 2.9883286,\n \"preview\": {\n \"file\": \"minedump_flats_1k.hdr\",\n \"resolution\": 1024\n },\n \"render\": {\n \"file\": \"minedump_flats_4k.exr\",\n \"resolution\": 4096\n }\n },\n \"sunset_fairway\": {\n \"label\": \"Sunset Fairway\",\n \"description\": \"A golf fairway at dusk, the sun already down and the sky lit from below.\",\n \"category\": \"golden\",\n \"groundHeight\": 1.6,\n \"skyIrradiance\": 2.7264117999999997,\n \"preview\": {\n \"file\": \"sunset_fairway_1k.hdr\",\n \"resolution\": 1024\n },\n \"render\": {\n \"file\": \"sunset_fairway_4k.exr\",\n \"resolution\": 4096\n }\n },\n \"the_sky_is_on_fire\": {\n \"label\": \"Sky on Fire\",\n \"description\": \"A blazing red-orange sunset over open country.\",\n \"category\": \"golden\",\n \"groundHeight\": 1.6,\n \"skyIrradiance\": 2.4784194,\n \"preview\": {\n \"file\": \"the_sky_is_on_fire_1k.hdr\",\n \"resolution\": 1024\n },\n \"render\": {\n \"file\": \"the_sky_is_on_fire_4k.exr\",\n \"resolution\": 4096\n }\n },\n \"dalkey_view\": {\n \"label\": \"Dalkey View\",\n \"description\": \"A coastal hillside under a bright overcast sky.\",\n \"category\": \"overcast\",\n \"groundHeight\": 1.6,\n \"skyIrradiance\": 4.501861400000001,\n \"preview\": {\n \"file\": \"dalkey_view_1k.hdr\",\n \"resolution\": 1024\n },\n \"render\": {\n \"file\": \"dalkey_view_4k.exr\",\n \"resolution\": 4096\n }\n },\n \"afrikaans_church_exterior\": {\n \"label\": \"Church Square\",\n \"description\": \"A quiet square under heavy cloud, a white church across it.\",\n \"category\": \"overcast\",\n \"groundHeight\": 1.6,\n \"skyIrradiance\": 4.194848599999999,\n \"preview\": {\n \"file\": \"afrikaans_church_exterior_1k.hdr\",\n \"resolution\": 1024\n },\n \"render\": {\n \"file\": \"afrikaans_church_exterior_4k.exr\",\n \"resolution\": 4096\n }\n },\n \"quarry_cloudy\": {\n \"label\": \"Cloudy Quarry\",\n \"description\": \"A stone quarry under an even grey sky.\",\n \"category\": \"overcast\",\n \"groundHeight\": 1.6,\n \"skyIrradiance\": 3.9304787999999995,\n \"preview\": {\n \"file\": \"quarry_cloudy_1k.hdr\",\n \"resolution\": 1024\n },\n \"render\": {\n \"file\": \"quarry_cloudy_4k.exr\",\n \"resolution\": 4096\n }\n },\n \"moonless_golf\": {\n \"label\": \"Moonless Golf Course\",\n \"description\": \"A moonless night over a golf course, a faint glow from the town.\",\n \"category\": \"night\",\n \"groundHeight\": 1.6,\n \"skyIrradiance\": 0.5007998,\n \"preview\": {\n \"file\": \"moonless_golf_1k.hdr\",\n \"resolution\": 1024\n },\n \"render\": {\n \"file\": \"moonless_golf_4k.exr\",\n \"resolution\": 4096\n }\n },\n \"preller_drive\": {\n \"label\": \"Preller Drive\",\n \"description\": \"A suburban street at night, sodium street lamps and dark trees.\",\n \"category\": \"night\",\n \"groundHeight\": 1.6,\n \"skyIrradiance\": 0.5283702,\n \"preview\": {\n \"file\": \"preller_drive_1k.hdr\",\n \"resolution\": 1024\n },\n \"render\": {\n \"file\": \"preller_drive_4k.exr\",\n \"resolution\": 4096\n }\n },\n \"satara_night\": {\n \"label\": \"Satara Night\",\n \"description\": \"A bush camp at night, a few lamps and a starry sky.\",\n \"category\": \"night\",\n \"groundHeight\": 1.6,\n \"skyIrradiance\": 0.25447,\n \"preview\": {\n \"file\": \"satara_night_1k.hdr\",\n \"resolution\": 1024\n },\n \"render\": {\n \"file\": \"satara_night_4k.exr\",\n \"resolution\": 4096\n }\n },\n \"ferndale_studio_11\": {\n \"label\": \"Ferndale Studio 11\",\n \"description\": \"High-contrast studio environment with broad soft sources.\",\n \"category\": \"studio\",\n \"groundHeight\": 1.2,\n \"skyIrradiance\": 1.2286402,\n \"preview\": {\n \"file\": \"ferndale_studio_11_1k.hdr\",\n \"resolution\": 1024\n },\n \"render\": {\n \"file\": \"ferndale_studio_11_4k.exr\",\n \"resolution\": 4096\n }\n },\n \"ferndale_studio_12\": {\n \"label\": \"Ferndale Studio 12\",\n \"description\": \"Balanced product studio with shaped highlights.\",\n \"category\": \"studio\",\n \"groundHeight\": 1.2,\n \"skyIrradiance\": 1.2324262000000001,\n \"preview\": {\n \"file\": \"ferndale_studio_12_1k.hdr\",\n \"resolution\": 1024\n },\n \"render\": {\n \"file\": \"ferndale_studio_12_4k.exr\",\n \"resolution\": 4096\n }\n },\n \"monochrome_studio_02\": {\n \"label\": \"Monochrome Studio 02\",\n \"description\": \"Neutral monochrome studio for material-focused renders.\",\n \"category\": \"studio\",\n \"groundHeight\": 1.2,\n \"skyIrradiance\": 0.9193722,\n \"preview\": {\n \"file\": \"monochrome_studio_02_1k.hdr\",\n \"resolution\": 1024\n },\n \"render\": {\n \"file\": \"monochrome_studio_02_4k.exr\",\n \"resolution\": 4096\n }\n },\n \"studio_kontrast_04\": {\n \"label\": \"Studio Kontrast 04\",\n \"description\": \"Directional studio contrast with crisp reflections.\",\n \"category\": \"studio\",\n \"groundHeight\": 1.2,\n \"skyIrradiance\": 2.9173432,\n \"preview\": {\n \"file\": \"studio_kontrast_04_1k.hdr\",\n \"resolution\": 1024\n },\n \"render\": {\n \"file\": \"studio_kontrast_04_4k.exr\",\n \"resolution\": 4096\n }\n },\n \"studio_small_03\": {\n \"label\": \"Small Studio 03\",\n \"description\": \"Compact studio environment with close softboxes.\",\n \"category\": \"studio\",\n \"groundHeight\": 1.2,\n \"skyIrradiance\": 13.877922599999998,\n \"preview\": {\n \"file\": \"studio_small_03_1k.hdr\",\n \"resolution\": 1024\n },\n \"render\": {\n \"file\": \"studio_small_03_4k.exr\",\n \"resolution\": 4096\n }\n }\n} as const;\n\nexport type HdriPresetName = keyof typeof HDRI_PRESETS;\n","/**\n * Generated by the preset library's sync script and by every room publish.\n * Do not edit.\n *\n * The rooms the SDK can offer. `build` is the content hash of the published\n * room definition; the manifest repeats it and the renderer refuses any\n * other, so what was framed in the browser is what gets traced.\n */\n\nexport type RoomPresetLighting = 'day' | 'golden' | 'overcast' | 'night';\n\nexport type RoomPresetSurface = { readonly material: string; readonly color: string };\n\nexport type RoomPresetInfo = {\n label: string;\n description: string;\n /** Content hash of the published record (see above). */\n build: string;\n presetsVersion: number;\n /** Metres. Floor at y = 0, centred on the origin; north is −z. */\n size: { readonly width: number; readonly height: number; readonly depth: number };\n /** The mode the room was designed under; any of the four can be asked for. */\n lighting: RoomPresetLighting;\n surfaces: {\n readonly floor: RoomPresetSurface;\n readonly walls: RoomPresetSurface;\n readonly ceiling: RoomPresetSurface;\n readonly sill: { readonly material: string };\n };\n /** What the subject stands on, where, and how high its top is. */\n stand: {\n readonly type: string | null;\n readonly material: string | null;\n readonly x: number;\n readonly z: number;\n readonly rotationDeg: number;\n readonly top: number;\n /** three.js axes, metres. `null` when the room has no stand. */\n readonly size: { readonly x: number; readonly y: number; readonly z: number } | null;\n };\n /** The published framing, in the room's own frame. */\n camera: {\n readonly position: readonly [number, number, number];\n readonly target: readonly [number, number, number];\n readonly lensMm: number;\n readonly fstop: number | null;\n };\n /** The browser stand-in on the CDN, relative to `/v<N>/`. */\n preview: {\n readonly glb: string;\n readonly bytes: number;\n readonly triangles: number;\n readonly textures: number;\n };\n /**\n * How walled in and how full the room is from its own camera (the\n * protocol's `SceneComplexity`), measured from the stand-in when the\n * room was published. The render estimator prices a room by these, as it\n * prices any scene. Null for a room published before they were measured.\n */\n complexity: { readonly enclosure: number; readonly objects: number } | null;\n /**\n * The lighting modes this room's own lightmaps are published for.\n *\n * A bake of a product standing in an UNMODIFIED preset room takes the\n * room's light from that library asset and covers only the product, the\n * stand and the shadow it casts. A mode that is not on this list has no\n * such asset, so a bake of it lights the whole room itself, which costs\n * what it always did. Empty until the room is prebaked and published.\n */\n prebaked: readonly RoomPresetLighting[];\n /**\n * The lighting modes this room has a BAKED version for: one optimized GLB\n * with its traced light in it. In those, `createPresetRoom()` shows the\n * baked room in the browser while a render still builds the real room, and\n * a bake covers only the product, its stand and its shadow. A baked room\n * is served whatever room build it was made from, until a newer one is\n * published. In the other modes the browser shows the stand-in.\n */\n baked: readonly RoomPresetLighting[];\n /** The room's stand as a file of its own, for a room shown baked. Null when the subject stands on the floor or the file was never cut. */\n standGlb: string | null;\n /** The plants the room stands, by library id. A bake stands each one in\n * for a reduced planter and a card of foliage. */\n plants: readonly string[];\n /**\n * The pictures this room hangs, in the order it hangs them: which wall,\n * and how long the image's longest side is in metres.\n *\n * `createPresetRoom({ pictures: [...] })` fills them in this order. The\n * frame does not move for a replacement: it is cropped to fill the\n * opening, the way `object-fit: cover` fills a box.\n */\n pictures: readonly { readonly wall: string; readonly size: number }[];\n /**\n * How bright the stand-in's lights are under each mode, as a multiple of\n * the mode's viewport rig, set per room so the preview reads about as\n * bright as the render, which never sees this number. Already normalised\n * to `exposure`: the stand-in and the trace agree at whatever exposure\n * the scene runs, since both scale with it alike.\n */\n previewBrightness: Record<RoomPresetLighting, number>;\n /**\n * The hue of that fill's two halves, per mode, at luminance 1: the colour\n * of the light this room's own openings and fixtures actually deliver,\n * measured off the sky the renderer builds. Applied to the mode's fill\n * colours it changes their hue and not their level, so the stand-in of a\n * skylit room reads blue like the render of it instead of cream.\n */\n previewFill: Record<RoomPresetLighting, { sky: number[]; ground: number[] }>;\n /**\n * The map outside the windows under each mode, as published: which,\n * turned how far clockwise so its sun sits at the room's, and how high\n * its camera stood (the ground-projected dome's lift). Null is a plain\n * sky and nothing outside. `createPresetRoom({ hdri })` overrides it.\n * The render's air over the distance is the renderer's own;\n * the stand-in shows the map as shot.\n */\n hdri: Record<\n RoomPresetLighting,\n { readonly name: string; readonly rotationDeg: number; readonly groundHeight: number } | null\n >;\n /**\n * W/m² the room's own sky delivers to a plane facing up, per mode: the\n * physical sky at the room's sun, or the flat sky. A map outside the windows\n * is shown at this over the map's own `skyIrradiance`, so what is seen\n * through the glass is as bright as the light coming in through it.\n */\n skyIrradiance: Record<RoomPresetLighting, number>;\n /**\n * The three.js `toneMappingExposure` the room is designed for, per mode.\n * The room is traced at this exposure and every published comparison of\n * it was judged at it. `createPresetRoom` leaves the current\n * mode's value on `userData.exposure`: a scene that sets its renderer to\n * it renders the room as bright as it was meant to be, in the viewport\n * and in the trace alike, since the manifest carries the exposure, and\n * one that keeps exposure 1 gets a faithful picture about a stop darker.\n */\n exposure: Record<RoomPresetLighting, number>;\n};\n\nexport const ROOM_PRESETS = {\n \"atelier_skylight\": {\n \"label\": \"Skylight Atelier\",\n \"description\": \"Concrete floor, tall plaster walls and two roof lights pouring foliage-broken sun straight down onto a low plinth.\",\n \"build\": \"6d26daeb0abb\",\n \"presetsVersion\": 1,\n \"size\": {\n \"width\": 5.5,\n \"height\": 3.4,\n \"depth\": 5.5\n },\n \"lighting\": \"day\",\n \"surfaces\": {\n \"floor\": {\n \"material\": \"polished_concrete\",\n \"color\": \"#ffffff\"\n },\n \"walls\": {\n \"material\": \"white_plaster\",\n \"color\": \"#f2efe8\"\n },\n \"ceiling\": {\n \"material\": \"matte_paint\",\n \"color\": \"#f5f4f0\"\n },\n \"sill\": {\n \"material\": \"travertine\"\n }\n },\n \"stand\": {\n \"type\": \"pedestal_plinth\",\n \"material\": \"carrara_marble\",\n \"x\": 0,\n \"z\": -0.2,\n \"rotationDeg\": 0,\n \"top\": 0.3,\n \"size\": {\n \"x\": 0.9,\n \"y\": 0.3,\n \"z\": 0.9\n }\n },\n \"camera\": {\n \"position\": [\n -1.7918,\n 1.38,\n 1.4709\n ],\n \"target\": [\n 0,\n 0.55,\n -0.2\n ],\n \"lensMm\": 38,\n \"fstop\": 2.4000000953674316\n },\n \"preview\": {\n \"glb\": \"rooms/atelier_skylight/room.glb\",\n \"bytes\": 1609624,\n \"triangles\": 71936,\n \"textures\": 21\n },\n \"complexity\": {\n \"enclosure\": 1,\n \"objects\": 64\n },\n \"prebaked\": [],\n \"baked\": [\n \"day\",\n \"golden\",\n \"night\"\n ],\n \"standGlb\": \"rooms/atelier_skylight/stand.glb\",\n \"plants\": [\n \"potted_dracaena_01\",\n \"potted_monstera_01\"\n ],\n \"pictures\": [],\n \"previewBrightness\": {\n \"day\": 0.775,\n \"golden\": 0.543,\n \"overcast\": 0.723,\n \"night\": 0.243\n },\n \"previewFill\": {\n \"day\": {\n \"sky\": [\n 0.861,\n 1.012,\n 1.285\n ],\n \"ground\": [\n 0.861,\n 1.012,\n 1.285\n ]\n },\n \"golden\": {\n \"sky\": [\n 1.154,\n 0.972,\n 0.825\n ],\n \"ground\": [\n 1.154,\n 0.972,\n 0.825\n ]\n },\n \"overcast\": {\n \"sky\": [\n 0.997,\n 0.997,\n 1.041\n ],\n \"ground\": [\n 0.997,\n 0.997,\n 1.041\n ]\n },\n \"night\": {\n \"sky\": [\n 1.488,\n 0.894,\n 0.616\n ],\n \"ground\": [\n 1.488,\n 0.894,\n 0.616\n ]\n }\n },\n \"exposure\": {\n \"day\": 1.741,\n \"golden\": 1.741,\n \"overcast\": 1.866,\n \"night\": 2.144\n },\n \"hdri\": {\n \"day\": null,\n \"golden\": null,\n \"overcast\": null,\n \"night\": {\n \"name\": \"moonless_golf\",\n \"rotationDeg\": 0,\n \"groundHeight\": 1.6\n }\n },\n \"skyIrradiance\": {\n \"day\": 8.595,\n \"golden\": 5.273,\n \"overcast\": 3.286,\n \"night\": 0.011\n }\n },\n \"beam_loft\": {\n \"label\": \"Beam Loft\",\n \"description\": \"A tall plaster room under oak beams: three paned windows on the east side over a slatted oak ledge, dark boards, a pale modular sofa, a leather lounge chair and an opal globe on a long cord.\",\n \"build\": \"306f502d2191\",\n \"presetsVersion\": 1,\n \"size\": {\n \"width\": 9,\n \"height\": 3.7,\n \"depth\": 7.6\n },\n \"lighting\": \"day\",\n \"surfaces\": {\n \"floor\": {\n \"material\": \"plank_flooring_04\",\n \"color\": \"#b7aea4\"\n },\n \"walls\": {\n \"material\": \"white_plaster\",\n \"color\": \"#eeebe5\"\n },\n \"ceiling\": {\n \"material\": \"white_plaster\",\n \"color\": \"#f2f0eb\"\n },\n \"sill\": {\n \"material\": \"coated_pine\"\n }\n },\n \"stand\": {\n \"type\": \"coffee_table_round_01\",\n \"material\": null,\n \"x\": 0.2,\n \"z\": -1.5,\n \"rotationDeg\": 0,\n \"top\": 0.491,\n \"size\": {\n \"x\": 1.3013,\n \"y\": 0.491,\n \"z\": 1.3013\n }\n },\n \"camera\": {\n \"position\": [\n -1.7117,\n 1.3,\n 2.7937\n ],\n \"target\": [\n 0.2,\n 0.741,\n -1.5\n ],\n \"lensMm\": 21,\n \"fstop\": 5.599999904632568\n },\n \"preview\": {\n \"glb\": \"rooms/beam_loft/room.glb\",\n \"bytes\": 2350456,\n \"triangles\": 102810,\n \"textures\": 37\n },\n \"complexity\": {\n \"enclosure\": 1,\n \"objects\": 51\n },\n \"prebaked\": [],\n \"baked\": [\n \"day\",\n \"golden\",\n \"night\"\n ],\n \"standGlb\": \"rooms/beam_loft/stand.glb\",\n \"plants\": [\n \"potted_dracaena_01\",\n \"potted_plant_01\"\n ],\n \"pictures\": [],\n \"previewBrightness\": {\n \"day\": 1.877,\n \"golden\": 2.176,\n \"overcast\": 0.381,\n \"night\": 0.191\n },\n \"previewFill\": {\n \"day\": {\n \"sky\": [\n 0.976,\n 1.001,\n 1.058\n ],\n \"ground\": [\n 1.076,\n 0.986,\n 0.914\n ]\n },\n \"golden\": {\n \"sky\": [\n 1.242,\n 0.96,\n 0.686\n ],\n \"ground\": [\n 1.355,\n 0.936,\n 0.586\n ]\n },\n \"overcast\": {\n \"sky\": [\n 0.964,\n 1.004,\n 1.071\n ],\n \"ground\": [\n 1.062,\n 0.989,\n 0.925\n ]\n },\n \"night\": {\n \"sky\": [\n 1.466,\n 0.899,\n 0.627\n ],\n \"ground\": [\n 1.59,\n 0.872,\n 0.533\n ]\n }\n },\n \"exposure\": {\n \"day\": 1.741,\n \"golden\": 1.741,\n \"overcast\": 1.866,\n \"night\": 2.144\n },\n \"hdri\": {\n \"day\": {\n \"name\": \"horn-koppe_spring\",\n \"rotationDeg\": 352,\n \"groundHeight\": 1.6\n },\n \"golden\": {\n \"name\": \"umhlanga_sunrise\",\n \"rotationDeg\": 330,\n \"groundHeight\": 1.6\n },\n \"overcast\": {\n \"name\": \"dalkey_view\",\n \"rotationDeg\": 0,\n \"groundHeight\": 1.6\n },\n \"night\": {\n \"name\": \"preller_drive\",\n \"rotationDeg\": 0,\n \"groundHeight\": 1.6\n }\n },\n \"skyIrradiance\": {\n \"day\": 8.707,\n \"golden\": 5.273,\n \"overcast\": 3.286,\n \"night\": 0.011\n }\n },\n \"conservatory_day\": {\n \"label\": \"Conservatory\",\n \"description\": \"Travertine and white plaster under a foliage-broken roof light, three east windows of morning sun, and all five plants of the set standing around a vase on a marble cylinder.\",\n \"build\": \"37c1bf94d793\",\n \"presetsVersion\": 1,\n \"size\": {\n \"width\": 5.6,\n \"height\": 3.4,\n \"depth\": 5.6\n },\n \"lighting\": \"day\",\n \"surfaces\": {\n \"floor\": {\n \"material\": \"travertine\",\n \"color\": \"#ffffff\"\n },\n \"walls\": {\n \"material\": \"white_plaster\",\n \"color\": \"#f9f3fa\"\n },\n \"ceiling\": {\n \"material\": \"matte_paint\",\n \"color\": \"#f5f4f0\"\n },\n \"sill\": {\n \"material\": \"travertine\"\n }\n },\n \"stand\": {\n \"type\": \"pedestal_cylinder\",\n \"material\": \"carrara_marble\",\n \"x\": 0,\n \"z\": -0.15,\n \"rotationDeg\": 0,\n \"top\": 0.95,\n \"size\": {\n \"x\": 0.42,\n \"y\": 0.95,\n \"z\": 0.42\n }\n },\n \"camera\": {\n \"position\": [\n -0.2066,\n 1.3,\n -0.9848\n ],\n \"target\": [\n 0,\n 1.2,\n -0.15\n ],\n \"lensMm\": 26,\n \"fstop\": 4\n },\n \"preview\": {\n \"glb\": \"rooms/conservatory_day/room.glb\",\n \"bytes\": 3089392,\n \"triangles\": 171145,\n \"textures\": 35\n },\n \"complexity\": {\n \"enclosure\": 1,\n \"objects\": 60\n },\n \"prebaked\": [],\n \"baked\": [\n \"day\",\n \"golden\",\n \"night\"\n ],\n \"standGlb\": \"rooms/conservatory_day/stand.glb\",\n \"plants\": [\n \"potted_bird_of_paradise_01\",\n \"potted_monstera_01\",\n \"potted_monstera_02\",\n \"potted_plant_04\"\n ],\n \"pictures\": [],\n \"previewBrightness\": {\n \"day\": 1.551,\n \"golden\": 1.292,\n \"overcast\": 1.447,\n \"night\": 0.196\n },\n \"previewFill\": {\n \"day\": {\n \"sky\": [\n 0.966,\n 1,\n 1.104\n ],\n \"ground\": [\n 0.966,\n 1,\n 1.104\n ]\n },\n \"golden\": {\n \"sky\": [\n 1.22,\n 0.961,\n 0.738\n ],\n \"ground\": [\n 1.22,\n 0.961,\n 0.738\n ]\n },\n \"overcast\": {\n \"sky\": [\n 1.001,\n 0.996,\n 1.036\n ],\n \"ground\": [\n 1.001,\n 0.996,\n 1.036\n ]\n },\n \"night\": {\n \"sky\": [\n 1.486,\n 0.894,\n 0.619\n ],\n \"ground\": [\n 1.486,\n 0.894,\n 0.619\n ]\n }\n },\n \"exposure\": {\n \"day\": 1.741,\n \"golden\": 1.741,\n \"overcast\": 1.866,\n \"night\": 2.144\n },\n \"hdri\": {\n \"day\": {\n \"name\": \"grasslands_sunset\",\n \"rotationDeg\": 299.3,\n \"groundHeight\": 1.6\n },\n \"golden\": {\n \"name\": \"qwantani_sunset\",\n \"rotationDeg\": 304,\n \"groundHeight\": 1.6\n },\n \"overcast\": {\n \"name\": \"dalkey_view\",\n \"rotationDeg\": 0,\n \"groundHeight\": 1.6\n },\n \"night\": {\n \"name\": \"moonless_golf\",\n \"rotationDeg\": 0,\n \"groundHeight\": 1.6\n }\n },\n \"skyIrradiance\": {\n \"day\": 8.707,\n \"golden\": 5.273,\n \"overcast\": 3.286,\n \"night\": 0.011\n }\n },\n \"dining_golden\": {\n \"label\": \"Golden Hour Dining\",\n \"description\": \"Painted brick and dark planks, low sun through rippled cast glass, a walnut table set for four off to one side and a bird of paradise holding the light.\",\n \"build\": \"aaf9e73a653b\",\n \"presetsVersion\": 1,\n \"size\": {\n \"width\": 7,\n \"height\": 3.3,\n \"depth\": 5.2\n },\n \"lighting\": \"golden\",\n \"surfaces\": {\n \"floor\": {\n \"material\": \"oak_veneer_05\",\n \"color\": \"#ffffff\"\n },\n \"walls\": {\n \"material\": \"matte_paint\",\n \"color\": \"#efe6d9\"\n },\n \"ceiling\": {\n \"material\": \"matte_paint\",\n \"color\": \"#f5f4f0\"\n },\n \"sill\": {\n \"material\": \"polished_concrete\"\n }\n },\n \"stand\": {\n \"type\": \"round_wooden_table_01\",\n \"material\": null,\n \"x\": 0.69,\n \"z\": -0.38,\n \"rotationDeg\": 0,\n \"top\": 1.005,\n \"size\": {\n \"x\": 1.3993,\n \"y\": 1.005,\n \"z\": 1.3993\n }\n },\n \"camera\": {\n \"position\": [\n 0.9851,\n 1.21,\n -0.0142\n ],\n \"target\": [\n 0.69,\n 1.255,\n -0.38\n ],\n \"lensMm\": 24,\n \"fstop\": 4\n },\n \"preview\": {\n \"glb\": \"rooms/dining_golden/room.glb\",\n \"bytes\": 1020424,\n \"triangles\": 29323,\n \"textures\": 24\n },\n \"complexity\": {\n \"enclosure\": 1,\n \"objects\": 60\n },\n \"prebaked\": [],\n \"baked\": [\n \"day\",\n \"golden\",\n \"night\"\n ],\n \"standGlb\": \"rooms/dining_golden/stand.glb\",\n \"plants\": [\n \"potted_bird_of_paradise_01\",\n \"potted_plant_04\"\n ],\n \"pictures\": [],\n \"previewBrightness\": {\n \"day\": 0.196,\n \"golden\": 0.31,\n \"overcast\": 0.289,\n \"night\": 0.154\n },\n \"previewFill\": {\n \"day\": {\n \"sky\": [\n 1.074,\n 0.983,\n 0.948\n ],\n \"ground\": [\n 1.074,\n 0.983,\n 0.948\n ]\n },\n \"golden\": {\n \"sky\": [\n 1.338,\n 0.937,\n 0.63\n ],\n \"ground\": [\n 1.338,\n 0.937,\n 0.63\n ]\n },\n \"overcast\": {\n \"sky\": [\n 1.297,\n 0.934,\n 0.775\n ],\n \"ground\": [\n 1.297,\n 0.934,\n 0.775\n ]\n },\n \"night\": {\n \"sky\": [\n 1.487,\n 0.894,\n 0.617\n ],\n \"ground\": [\n 1.487,\n 0.894,\n 0.617\n ]\n }\n },\n \"exposure\": {\n \"day\": 1.741,\n \"golden\": 1.741,\n \"overcast\": 1.866,\n \"night\": 2.144\n },\n \"hdri\": {\n \"day\": {\n \"name\": \"pergola_walkway\",\n \"rotationDeg\": 79.7,\n \"groundHeight\": 1.6\n },\n \"golden\": {\n \"name\": \"bambanani_sunset\",\n \"rotationDeg\": 104,\n \"groundHeight\": 1.6\n },\n \"overcast\": {\n \"name\": \"dalkey_view\",\n \"rotationDeg\": 0,\n \"groundHeight\": 1.6\n },\n \"night\": {\n \"name\": \"moonless_golf\",\n \"rotationDeg\": 0,\n \"groundHeight\": 1.6\n }\n },\n \"skyIrradiance\": {\n \"day\": 8.468,\n \"golden\": 5.273,\n \"overcast\": 3.286,\n \"night\": 0.011\n }\n },\n \"gallery_day\": {\n \"label\": \"Daylight Gallery\",\n \"description\": \"White plaster and oak, three tall west windows with foliage-dappled midday sun, shelves of ceramics behind the centerpiece.\",\n \"build\": \"4b9e7b77b32b\",\n \"presetsVersion\": 1,\n \"size\": {\n \"width\": 6,\n \"height\": 3.2,\n \"depth\": 5\n },\n \"lighting\": \"day\",\n \"surfaces\": {\n \"floor\": {\n \"material\": \"oak_floor\",\n \"color\": \"#ffffff\"\n },\n \"walls\": {\n \"material\": \"white_plaster\",\n \"color\": \"#f4f1ea\"\n },\n \"ceiling\": {\n \"material\": \"matte_paint\",\n \"color\": \"#f5f4f0\"\n },\n \"sill\": {\n \"material\": \"travertine\"\n }\n },\n \"stand\": {\n \"type\": \"pedestal_block\",\n \"material\": \"carrara_marble\",\n \"x\": 0.18,\n \"z\": -0.36,\n \"rotationDeg\": 0,\n \"top\": 1,\n \"size\": {\n \"x\": 0.4,\n \"y\": 1,\n \"z\": 0.4\n }\n },\n \"camera\": {\n \"position\": [\n 0.3653,\n 1.17,\n -0.0055\n ],\n \"target\": [\n 0.18,\n 1.25,\n -0.36\n ],\n \"lensMm\": 34,\n \"fstop\": 4\n },\n \"preview\": {\n \"glb\": \"rooms/gallery_day/room.glb\",\n \"bytes\": 2109044,\n \"triangles\": 119502,\n \"textures\": 21\n },\n \"complexity\": {\n \"enclosure\": 1,\n \"objects\": 72\n },\n \"prebaked\": [],\n \"baked\": [\n \"day\",\n \"golden\",\n \"night\"\n ],\n \"standGlb\": \"rooms/gallery_day/stand.glb\",\n \"plants\": [\n \"potted_plant_01\",\n \"potted_plant_04\"\n ],\n \"pictures\": [],\n \"previewBrightness\": {\n \"day\": 0.093,\n \"golden\": 0.15,\n \"overcast\": 0.043,\n \"night\": 0.159\n },\n \"previewFill\": {\n \"day\": {\n \"sky\": [\n 1.101,\n 0.978,\n 0.915\n ],\n \"ground\": [\n 1.101,\n 0.978,\n 0.915\n ]\n },\n \"golden\": {\n \"sky\": [\n 1.298,\n 0.947,\n 0.643\n ],\n \"ground\": [\n 1.298,\n 0.947,\n 0.643\n ]\n },\n \"overcast\": {\n \"sky\": [\n 1.266,\n 0.942,\n 0.791\n ],\n \"ground\": [\n 1.266,\n 0.942,\n 0.791\n ]\n },\n \"night\": {\n \"sky\": [\n 1.488,\n 0.894,\n 0.615\n ],\n \"ground\": [\n 1.488,\n 0.894,\n 0.615\n ]\n }\n },\n \"exposure\": {\n \"day\": 1.741,\n \"golden\": 1.741,\n \"overcast\": 1.866,\n \"night\": 2.144\n },\n \"hdri\": {\n \"day\": {\n \"name\": \"sunny_country_road\",\n \"rotationDeg\": 127,\n \"groundHeight\": 1.6\n },\n \"golden\": {\n \"name\": \"qwantani_sunset\",\n \"rotationDeg\": 124,\n \"groundHeight\": 1.6\n },\n \"overcast\": {\n \"name\": \"dalkey_view\",\n \"rotationDeg\": 0,\n \"groundHeight\": 1.6\n },\n \"night\": {\n \"name\": \"moonless_golf\",\n \"rotationDeg\": 0,\n \"groundHeight\": 1.6\n }\n },\n \"skyIrradiance\": {\n \"day\": 8.212,\n \"golden\": 5.273,\n \"overcast\": 3.286,\n \"night\": 0.011\n }\n },\n \"living_evening\": {\n \"label\": \"Evening Living Room\",\n \"description\": \"Warm greige and hardwood after dark: a channel-tufted sofa under a washed wall, a plaster console opposite, monstera and palm in the corners.\",\n \"build\": \"204a81d87141\",\n \"presetsVersion\": 1,\n \"size\": {\n \"width\": 6.4,\n \"height\": 3,\n \"depth\": 5.4\n },\n \"lighting\": \"night\",\n \"surfaces\": {\n \"floor\": {\n \"material\": \"wooden_floor_02\",\n \"color\": \"#ffffff\"\n },\n \"walls\": {\n \"material\": \"matte_paint\",\n \"color\": \"#e5ded2\"\n },\n \"ceiling\": {\n \"material\": \"matte_paint\",\n \"color\": \"#f5f4f0\"\n },\n \"sill\": {\n \"material\": \"travertine\"\n }\n },\n \"stand\": {\n \"type\": \"pedestal_cylinder\",\n \"material\": \"carrara_marble\",\n \"x\": 0.75,\n \"z\": -0.15,\n \"rotationDeg\": 0,\n \"top\": 0.95,\n \"size\": {\n \"x\": 0.42,\n \"y\": 0.95,\n \"z\": 0.42\n }\n },\n \"camera\": {\n \"position\": [\n 1.8407,\n 0.78,\n 1.0613\n ],\n \"target\": [\n 0.75,\n 1.2,\n -0.15\n ],\n \"lensMm\": 32,\n \"fstop\": 3.200000047683716\n },\n \"preview\": {\n \"glb\": \"rooms/living_evening/room.glb\",\n \"bytes\": 4367688,\n \"triangles\": 237432,\n \"textures\": 21\n },\n \"complexity\": {\n \"enclosure\": 1,\n \"objects\": 102\n },\n \"prebaked\": [],\n \"baked\": [\n \"day\",\n \"golden\",\n \"night\"\n ],\n \"standGlb\": \"rooms/living_evening/stand.glb\",\n \"plants\": [\n \"potted_monstera_02\",\n \"potted_palm_01\"\n ],\n \"pictures\": [\n {\n \"wall\": \"north\",\n \"size\": 0.7\n }\n ],\n \"previewBrightness\": {\n \"day\": 0.134,\n \"golden\": 0.398,\n \"overcast\": 0.106,\n \"night\": 0.103\n },\n \"previewFill\": {\n \"day\": {\n \"sky\": [\n 1.126,\n 0.972,\n 0.906\n ],\n \"ground\": [\n 1.126,\n 0.972,\n 0.906\n ]\n },\n \"golden\": {\n \"sky\": [\n 1.331,\n 0.938,\n 0.637\n ],\n \"ground\": [\n 1.331,\n 0.938,\n 0.637\n ]\n },\n \"overcast\": {\n \"sky\": [\n 1.404,\n 0.911,\n 0.688\n ],\n \"ground\": [\n 1.404,\n 0.911,\n 0.688\n ]\n },\n \"night\": {\n \"sky\": [\n 1.488,\n 0.894,\n 0.615\n ],\n \"ground\": [\n 1.488,\n 0.894,\n 0.615\n ]\n }\n },\n \"exposure\": {\n \"day\": 1.741,\n \"golden\": 1.741,\n \"overcast\": 1.866,\n \"night\": 2.144\n },\n \"hdri\": {\n \"day\": {\n \"name\": \"pergola_walkway\",\n \"rotationDeg\": 79.7,\n \"groundHeight\": 1.6\n },\n \"golden\": {\n \"name\": \"qwantani_sunset\",\n \"rotationDeg\": 124,\n \"groundHeight\": 1.6\n },\n \"overcast\": {\n \"name\": \"dalkey_view\",\n \"rotationDeg\": 0,\n \"groundHeight\": 1.6\n },\n \"night\": {\n \"name\": \"moonless_golf\",\n \"rotationDeg\": 0,\n \"groundHeight\": 1.6\n }\n },\n \"skyIrradiance\": {\n \"day\": 8.468,\n \"golden\": 5.273,\n \"overcast\": 3.286,\n \"night\": 0.011\n }\n },\n \"loft_golden\": {\n \"label\": \"Golden Hour Loft\",\n \"description\": \"Painted brick and dark planks, two big steel-framed windows of rippled cast glass, low warm sun and a hint of haze.\",\n \"build\": \"6688f7d07182\",\n \"presetsVersion\": 1,\n \"size\": {\n \"width\": 7,\n \"height\": 3.6,\n \"depth\": 5.5\n },\n \"lighting\": \"golden\",\n \"surfaces\": {\n \"floor\": {\n \"material\": \"plank_flooring_04\",\n \"color\": \"#ffffff\"\n },\n \"walls\": {\n \"material\": \"white_plaster\",\n \"color\": \"#f0e7da\"\n },\n \"ceiling\": {\n \"material\": \"matte_paint\",\n \"color\": \"#f5f4f0\"\n },\n \"sill\": {\n \"material\": \"polished_concrete\"\n }\n },\n \"stand\": {\n \"type\": \"pedestal_cylinder\",\n \"material\": \"carrara_marble\",\n \"x\": 0.1,\n \"z\": -0.3,\n \"rotationDeg\": 0,\n \"top\": 0.95,\n \"size\": {\n \"x\": 0.42,\n \"y\": 0.95,\n \"z\": 0.42\n }\n },\n \"camera\": {\n \"position\": [\n 0.7923,\n 1.3,\n 0.6924\n ],\n \"target\": [\n 0.1,\n 1.2,\n -0.3\n ],\n \"lensMm\": 35,\n \"fstop\": 2\n },\n \"preview\": {\n \"glb\": \"rooms/loft_golden/room.glb\",\n \"bytes\": 3578328,\n \"triangles\": 165919,\n \"textures\": 23\n },\n \"complexity\": {\n \"enclosure\": 1,\n \"objects\": 64\n },\n \"prebaked\": [],\n \"baked\": [\n \"day\",\n \"golden\",\n \"night\"\n ],\n \"standGlb\": \"rooms/loft_golden/stand.glb\",\n \"plants\": [\n \"potted_monstera_01\",\n \"potted_palm_01\"\n ],\n \"pictures\": [],\n \"previewBrightness\": {\n \"day\": 0.584,\n \"golden\": 1.034,\n \"overcast\": 0.965,\n \"night\": 0.205\n },\n \"previewFill\": {\n \"day\": {\n \"sky\": [\n 1.056,\n 0.998,\n 0.852\n ],\n \"ground\": [\n 1.056,\n 0.998,\n 0.852\n ]\n },\n \"golden\": {\n \"sky\": [\n 1.414,\n 0.896,\n 0.816\n ],\n \"ground\": [\n 1.414,\n 0.896,\n 0.816\n ]\n },\n \"overcast\": {\n \"sky\": [\n 0.953,\n 1.019,\n 0.947\n ],\n \"ground\": [\n 0.953,\n 1.019,\n 0.947\n ]\n },\n \"night\": {\n \"sky\": [\n 1.485,\n 0.895,\n 0.614\n ],\n \"ground\": [\n 1.485,\n 0.895,\n 0.614\n ]\n }\n },\n \"exposure\": {\n \"day\": 1.741,\n \"golden\": 1.741,\n \"overcast\": 1.866,\n \"night\": 2.144\n },\n \"hdri\": {\n \"day\": {\n \"name\": \"pergola_walkway\",\n \"rotationDeg\": 79.7,\n \"groundHeight\": 1.6\n },\n \"golden\": {\n \"name\": \"the_sky_is_on_fire\",\n \"rotationDeg\": 45.4,\n \"groundHeight\": 1.6\n },\n \"overcast\": {\n \"name\": \"dalkey_view\",\n \"rotationDeg\": 0,\n \"groundHeight\": 1.6\n },\n \"night\": {\n \"name\": \"moonless_golf\",\n \"rotationDeg\": 0,\n \"groundHeight\": 1.6\n }\n },\n \"skyIrradiance\": {\n \"day\": 8.468,\n \"golden\": 5.273,\n \"overcast\": 3.286,\n \"night\": 0.011\n }\n },\n \"noir_parlour\": {\n \"label\": \"Noir Parlour\",\n \"description\": \"Charcoal walls in frame mouldings above a dado rail, a pale skirting, grey oak boards, two leather lounge chairs under a pair of white pendants and a print between them.\",\n \"build\": \"c444e081de93\",\n \"presetsVersion\": 1,\n \"size\": {\n \"width\": 7.6,\n \"height\": 3.4,\n \"depth\": 6.2\n },\n \"lighting\": \"golden\",\n \"surfaces\": {\n \"floor\": {\n \"material\": \"wooden_floor_02\",\n \"color\": \"#7d7872\"\n },\n \"walls\": {\n \"material\": \"matte_paint\",\n \"color\": \"#2b2b2f\"\n },\n \"ceiling\": {\n \"material\": \"matte_paint\",\n \"color\": \"#3b3b40\"\n },\n \"sill\": {\n \"material\": \"polished_concrete\"\n }\n },\n \"stand\": {\n \"type\": \"oval_side_table\",\n \"material\": null,\n \"x\": 0,\n \"z\": -1.9,\n \"rotationDeg\": 0,\n \"top\": 0.6048,\n \"size\": {\n \"x\": 0.562,\n \"y\": 0.605,\n \"z\": 0.34\n }\n },\n \"camera\": {\n \"position\": [\n 0,\n 1.15,\n 2.5\n ],\n \"target\": [\n 0,\n 0.8548,\n -1.9\n ],\n \"lensMm\": 28,\n \"fstop\": 4\n },\n \"preview\": {\n \"glb\": \"rooms/noir_parlour/room.glb\",\n \"bytes\": 1399740,\n \"triangles\": 55172,\n \"textures\": 20\n },\n \"complexity\": {\n \"enclosure\": 1,\n \"objects\": 55\n },\n \"prebaked\": [],\n \"baked\": [\n \"day\",\n \"golden\",\n \"night\"\n ],\n \"standGlb\": \"rooms/noir_parlour/stand.glb\",\n \"plants\": [\n \"potted_dracaena_01\"\n ],\n \"pictures\": [\n {\n \"wall\": \"north\",\n \"size\": 1.25\n }\n ],\n \"previewBrightness\": {\n \"day\": 0.362,\n \"golden\": 0.367,\n \"overcast\": 0.111,\n \"night\": 0.168\n },\n \"previewFill\": {\n \"day\": {\n \"sky\": [\n 1.021,\n 0.994,\n 0.999\n ],\n \"ground\": [\n 1.101,\n 0.982,\n 0.884\n ]\n },\n \"golden\": {\n \"sky\": [\n 1.22,\n 0.963,\n 0.723\n ],\n \"ground\": [\n 1.308,\n 0.945,\n 0.636\n ]\n },\n \"overcast\": {\n \"sky\": [\n 1.083,\n 0.979,\n 0.964\n ],\n \"ground\": [\n 1.167,\n 0.965,\n 0.852\n ]\n },\n \"night\": {\n \"sky\": [\n 1.486,\n 0.894,\n 0.618\n ],\n \"ground\": [\n 1.584,\n 0.873,\n 0.54\n ]\n }\n },\n \"exposure\": {\n \"day\": 1.741,\n \"golden\": 1.741,\n \"overcast\": 1.866,\n \"night\": 2.144\n },\n \"hdri\": {\n \"day\": {\n \"name\": \"horn-koppe_spring\",\n \"rotationDeg\": 114,\n \"groundHeight\": 1.6\n },\n \"golden\": {\n \"name\": \"bambanani_sunset\",\n \"rotationDeg\": 136,\n \"groundHeight\": 1.6\n },\n \"overcast\": {\n \"name\": \"dalkey_view\",\n \"rotationDeg\": 0,\n \"groundHeight\": 1.6\n },\n \"night\": {\n \"name\": \"satara_night\",\n \"rotationDeg\": 0,\n \"groundHeight\": 1.6\n }\n },\n \"skyIrradiance\": {\n \"day\": 8.34,\n \"golden\": 5.529,\n \"overcast\": 3.286,\n \"night\": 0.011\n }\n },\n \"plaster_atelier\": {\n \"label\": \"Plaster Atelier\",\n \"description\": \"Raw plaster, a concrete floor and one tall opening on the west side that lays a slab of sun across the room. A low white sofa against a travertine wall, a dome pendant, a palm in the corner.\",\n \"build\": \"6ee46115fa42\",\n \"presetsVersion\": 1,\n \"size\": {\n \"width\": 10,\n \"height\": 3.8,\n \"depth\": 7.6\n },\n \"lighting\": \"day\",\n \"surfaces\": {\n \"floor\": {\n \"material\": \"polished_concrete\",\n \"color\": \"#e2e0dc\"\n },\n \"walls\": {\n \"material\": \"white_plaster\",\n \"color\": \"#dcd7ce\"\n },\n \"ceiling\": {\n \"material\": \"white_plaster\",\n \"color\": \"#f1efea\"\n },\n \"sill\": {\n \"material\": \"polished_concrete\"\n }\n },\n \"stand\": {\n \"type\": \"pedestal_cylinder\",\n \"material\": \"travertine\",\n \"x\": -1.7,\n \"z\": -1,\n \"rotationDeg\": 0,\n \"top\": 0.95,\n \"size\": {\n \"x\": 0.42,\n \"y\": 0.95,\n \"z\": 0.42\n }\n },\n \"camera\": {\n \"position\": [\n -2.6356,\n 1.2,\n 3.4017\n ],\n \"target\": [\n -1.7,\n 1.2,\n -1\n ],\n \"lensMm\": 24,\n \"fstop\": 5.599999904632568\n },\n \"preview\": {\n \"glb\": \"rooms/plaster_atelier/room.glb\",\n \"bytes\": 3991680,\n \"triangles\": 187489,\n \"textures\": 30\n },\n \"complexity\": {\n \"enclosure\": 1,\n \"objects\": 37\n },\n \"prebaked\": [],\n \"baked\": [\n \"day\",\n \"golden\",\n \"night\"\n ],\n \"standGlb\": \"rooms/plaster_atelier/stand.glb\",\n \"plants\": [\n \"potted_palm_01\",\n \"potted_plant_01\"\n ],\n \"pictures\": [],\n \"previewBrightness\": {\n \"day\": 1.478,\n \"golden\": 1.742,\n \"overcast\": 0.314,\n \"night\": 0.182\n },\n \"previewFill\": {\n \"day\": {\n \"sky\": [\n 0.975,\n 1.002,\n 1.058\n ],\n \"ground\": [\n 0.993,\n 1.001,\n 1.015\n ]\n },\n \"golden\": {\n \"sky\": [\n 1.223,\n 0.964,\n 0.704\n ],\n \"ground\": [\n 1.244,\n 0.961,\n 0.674\n ]\n },\n \"overcast\": {\n \"sky\": [\n 0.964,\n 1.004,\n 1.071\n ],\n \"ground\": [\n 0.982,\n 1.003,\n 1.027\n ]\n },\n \"night\": {\n \"sky\": [\n 1.427,\n 0.909,\n 0.647\n ],\n \"ground\": [\n 1.449,\n 0.905,\n 0.618\n ]\n }\n },\n \"exposure\": {\n \"day\": 1.741,\n \"golden\": 1.741,\n \"overcast\": 1.866,\n \"night\": 2.144\n },\n \"hdri\": {\n \"day\": {\n \"name\": \"sunny_country_road\",\n \"rotationDeg\": 122,\n \"groundHeight\": 1.6\n },\n \"golden\": {\n \"name\": \"venice_sunset\",\n \"rotationDeg\": 136,\n \"groundHeight\": 1.6\n },\n \"overcast\": {\n \"name\": \"dalkey_view\",\n \"rotationDeg\": 0,\n \"groundHeight\": 1.6\n },\n \"night\": {\n \"name\": \"preller_drive\",\n \"rotationDeg\": 0,\n \"groundHeight\": 1.6\n }\n },\n \"skyIrradiance\": {\n \"day\": 8.633,\n \"golden\": 5.273,\n \"overcast\": 3.286,\n \"night\": 0.011\n }\n },\n \"slat_lounge\": {\n \"label\": \"Oak Slat Lounge\",\n \"description\": \"Oak battens either side of a charcoal wall, a low sofa under a large print, and tall windows behind sheers on the east side.\",\n \"build\": \"d4b3a554137d\",\n \"presetsVersion\": 1,\n \"size\": {\n \"width\": 8.4,\n \"height\": 3,\n \"depth\": 6.4\n },\n \"lighting\": \"day\",\n \"surfaces\": {\n \"floor\": {\n \"material\": \"wooden_floor_02\",\n \"color\": \"#e6e2dc\"\n },\n \"walls\": {\n \"material\": \"matte_paint\",\n \"color\": \"#e9e6e0\"\n },\n \"ceiling\": {\n \"material\": \"matte_paint\",\n \"color\": \"#f5f4f0\"\n },\n \"sill\": {\n \"material\": \"polished_concrete\"\n }\n },\n \"stand\": {\n \"type\": \"coffee_table_round_01\",\n \"material\": null,\n \"x\": -0.7,\n \"z\": -0.7,\n \"rotationDeg\": 0,\n \"top\": 0.491,\n \"size\": {\n \"x\": 1.3013,\n \"y\": 0.491,\n \"z\": 1.3013\n }\n },\n \"camera\": {\n \"position\": [\n -2.75,\n 1.2,\n 2.8507\n ],\n \"target\": [\n -0.7,\n 0.741,\n -0.7\n ],\n \"lensMm\": 24,\n \"fstop\": 5.599999904632568\n },\n \"preview\": {\n \"glb\": \"rooms/slat_lounge/room.glb\",\n \"bytes\": 2042948,\n \"triangles\": 122153,\n \"textures\": 30\n },\n \"complexity\": {\n \"enclosure\": 1,\n \"objects\": 77\n },\n \"prebaked\": [],\n \"baked\": [\n \"day\",\n \"golden\",\n \"night\"\n ],\n \"standGlb\": \"rooms/slat_lounge/stand.glb\",\n \"plants\": [\n \"potted_bird_of_paradise_01\",\n \"potted_monstera_02\"\n ],\n \"pictures\": [\n {\n \"wall\": \"north\",\n \"size\": 1.25\n }\n ],\n \"previewBrightness\": {\n \"day\": 0.346,\n \"golden\": 0.383,\n \"overcast\": 0.121,\n \"night\": 0.191\n },\n \"previewFill\": {\n \"day\": {\n \"sky\": [\n 1.05,\n 0.987,\n 0.978\n ],\n \"ground\": [\n 1.088,\n 0.982,\n 0.915\n ]\n },\n \"golden\": {\n \"sky\": [\n 1.273,\n 0.952,\n 0.672\n ],\n \"ground\": [\n 1.314,\n 0.944,\n 0.628\n ]\n },\n \"overcast\": {\n \"sky\": [\n 1.213,\n 0.952,\n 0.844\n ],\n \"ground\": [\n 1.254,\n 0.946,\n 0.789\n ]\n },\n \"night\": {\n \"sky\": [\n 1.46,\n 0.901,\n 0.63\n ],\n \"ground\": [\n 1.504,\n 0.892,\n 0.587\n ]\n }\n },\n \"exposure\": {\n \"day\": 1.741,\n \"golden\": 1.741,\n \"overcast\": 1.866,\n \"night\": 2.144\n },\n \"hdri\": {\n \"day\": {\n \"name\": \"pergola_walkway\",\n \"rotationDeg\": 317.7,\n \"groundHeight\": 1.6\n },\n \"golden\": {\n \"name\": \"qwantani_sunset\",\n \"rotationDeg\": 332,\n \"groundHeight\": 1.6\n },\n \"overcast\": {\n \"name\": \"dalkey_view\",\n \"rotationDeg\": 0,\n \"groundHeight\": 1.6\n },\n \"night\": {\n \"name\": \"moonless_golf\",\n \"rotationDeg\": 0,\n \"groundHeight\": 1.6\n }\n },\n \"skyIrradiance\": {\n \"day\": 8.468,\n \"golden\": 5.273,\n \"overcast\": 3.286,\n \"night\": 0.011\n }\n },\n \"studio_night\": {\n \"label\": \"Night Studio\",\n \"description\": \"Warm greige walls after dark: IES downlights, a lit cove channel round the ceiling and one accent spot carrying the centerpiece.\",\n \"build\": \"a62ba8b9dc1f\",\n \"presetsVersion\": 1,\n \"size\": {\n \"width\": 5,\n \"height\": 3,\n \"depth\": 4.4\n },\n \"lighting\": \"night\",\n \"surfaces\": {\n \"floor\": {\n \"material\": \"polished_concrete\",\n \"color\": \"#ffffff\"\n },\n \"walls\": {\n \"material\": \"matte_paint\",\n \"color\": \"#e6dfd3\"\n },\n \"ceiling\": {\n \"material\": \"matte_paint\",\n \"color\": \"#f5f4f0\"\n },\n \"sill\": {\n \"material\": \"carrara_marble\"\n }\n },\n \"stand\": {\n \"type\": null,\n \"material\": null,\n \"x\": 0,\n \"z\": 0,\n \"rotationDeg\": 0,\n \"top\": 0,\n \"size\": null\n },\n \"camera\": {\n \"position\": [\n -1.5455,\n 0.83,\n 1.2695\n ],\n \"target\": [\n 0,\n 0.25,\n 0\n ],\n \"lensMm\": 38,\n \"fstop\": 2\n },\n \"preview\": {\n \"glb\": \"rooms/studio_night/room.glb\",\n \"bytes\": 4251684,\n \"triangles\": 185457,\n \"textures\": 21\n },\n \"complexity\": {\n \"enclosure\": 1,\n \"objects\": 63\n },\n \"prebaked\": [],\n \"baked\": [\n \"day\",\n \"golden\",\n \"night\"\n ],\n \"standGlb\": null,\n \"plants\": [\n \"potted_palm_01\",\n \"potted_plant_04\"\n ],\n \"pictures\": [],\n \"previewBrightness\": {\n \"day\": 0.222,\n \"golden\": 0.636,\n \"overcast\": 0.482,\n \"night\": 0.466\n },\n \"previewFill\": {\n \"day\": {\n \"sky\": [\n 1.222,\n 0.951,\n 0.829\n ],\n \"ground\": [\n 1.222,\n 0.951,\n 0.829\n ]\n },\n \"golden\": {\n \"sky\": [\n 1.37,\n 0.927,\n 0.632\n ],\n \"ground\": [\n 1.37,\n 0.927,\n 0.632\n ]\n },\n \"overcast\": {\n \"sky\": [\n 1.439,\n 0.904,\n 0.657\n ],\n \"ground\": [\n 1.439,\n 0.904,\n 0.657\n ]\n },\n \"night\": {\n \"sky\": [\n 1.486,\n 0.894,\n 0.616\n ],\n \"ground\": [\n 1.486,\n 0.894,\n 0.616\n ]\n }\n },\n \"exposure\": {\n \"day\": 1.741,\n \"golden\": 1.741,\n \"overcast\": 1.866,\n \"night\": 2.144\n },\n \"hdri\": {\n \"day\": {\n \"name\": \"pergola_walkway\",\n \"rotationDeg\": 169.7,\n \"groundHeight\": 1.6\n },\n \"golden\": {\n \"name\": \"qwantani_sunset\",\n \"rotationDeg\": 214,\n \"groundHeight\": 1.6\n },\n \"overcast\": {\n \"name\": \"dalkey_view\",\n \"rotationDeg\": 0,\n \"groundHeight\": 1.6\n },\n \"night\": {\n \"name\": \"satara_night\",\n \"rotationDeg\": 0,\n \"groundHeight\": 1.6\n }\n },\n \"skyIrradiance\": {\n \"day\": 8.468,\n \"golden\": 5.273,\n \"overcast\": 3.286,\n \"night\": 0.011\n }\n },\n \"walnut_salon\": {\n \"label\": \"Walnut Salon\",\n \"description\": \"A long wall of walnut veneer and slatted bays under a lit cove, a pale modular sofa in front of it, three disc pendants at different heights and a charcoal wall with a print on the east side.\",\n \"build\": \"ce8b1acc2907\",\n \"presetsVersion\": 1,\n \"size\": {\n \"width\": 10,\n \"height\": 3.2,\n \"depth\": 7\n },\n \"lighting\": \"night\",\n \"surfaces\": {\n \"floor\": {\n \"material\": \"polished_concrete\",\n \"color\": \"#cfccc6\"\n },\n \"walls\": {\n \"material\": \"matte_paint\",\n \"color\": \"#ddd7cd\"\n },\n \"ceiling\": {\n \"material\": \"matte_paint\",\n \"color\": \"#e4e1db\"\n },\n \"sill\": {\n \"material\": \"polished_concrete\"\n }\n },\n \"stand\": {\n \"type\": \"coffee_table_round_01\",\n \"material\": null,\n \"x\": 0.2,\n \"z\": -1.2,\n \"rotationDeg\": 0,\n \"top\": 0.491,\n \"size\": {\n \"x\": 1.3013,\n \"y\": 0.491,\n \"z\": 1.3013\n }\n },\n \"camera\": {\n \"position\": [\n 0.2,\n 1.45,\n 3.2\n ],\n \"target\": [\n 0.2,\n 0.741,\n -1.2\n ],\n \"lensMm\": 24,\n \"fstop\": 5.599999904632568\n },\n \"preview\": {\n \"glb\": \"rooms/walnut_salon/room.glb\",\n \"bytes\": 1958456,\n \"triangles\": 121487,\n \"textures\": 36\n },\n \"complexity\": {\n \"enclosure\": 1,\n \"objects\": 117\n },\n \"prebaked\": [],\n \"baked\": [\n \"day\",\n \"golden\",\n \"night\"\n ],\n \"standGlb\": \"rooms/walnut_salon/stand.glb\",\n \"plants\": [\n \"potted_bird_of_paradise_01\",\n \"potted_monstera_02\"\n ],\n \"pictures\": [\n {\n \"wall\": \"east\",\n \"size\": 1.3\n }\n ],\n \"previewBrightness\": {\n \"day\": 0.295,\n \"golden\": 0.295,\n \"overcast\": 0.13,\n \"night\": 0.313\n },\n \"previewFill\": {\n \"day\": {\n \"sky\": [\n 1.112,\n 0.975,\n 0.922\n ],\n \"ground\": [\n 1.145,\n 0.971,\n 0.859\n ]\n },\n \"golden\": {\n \"sky\": [\n 1.301,\n 0.944,\n 0.67\n ],\n \"ground\": [\n 1.336,\n 0.938,\n 0.623\n ]\n },\n \"overcast\": {\n \"sky\": [\n 1.35,\n 0.925,\n 0.716\n ],\n \"ground\": [\n 1.386,\n 0.919,\n 0.665\n ]\n },\n \"night\": {\n \"sky\": [\n 1.427,\n 0.909,\n 0.645\n ],\n \"ground\": [\n 1.464,\n 0.902,\n 0.599\n ]\n }\n },\n \"exposure\": {\n \"day\": 1.741,\n \"golden\": 1.741,\n \"overcast\": 1.866,\n \"night\": 2.144\n },\n \"hdri\": {\n \"day\": {\n \"name\": \"pergola_walkway\",\n \"rotationDeg\": 59.7,\n \"groundHeight\": 1.6\n },\n \"golden\": {\n \"name\": \"qwantani_sunset\",\n \"rotationDeg\": 132,\n \"groundHeight\": 1.6\n },\n \"overcast\": {\n \"name\": \"dalkey_view\",\n \"rotationDeg\": 0,\n \"groundHeight\": 1.6\n },\n \"night\": {\n \"name\": \"moonless_golf\",\n \"rotationDeg\": 0,\n \"groundHeight\": 1.6\n }\n },\n \"skyIrradiance\": {\n \"day\": 8.468,\n \"golden\": 5.273,\n \"overcast\": 3.286,\n \"night\": 0.011\n }\n }\n} as const;\n\nexport type RoomPresetName = keyof typeof ROOM_PRESETS;\n","/**\n * A catalog from a server: models by URL, shots per product, no browser.\n *\n * import { Bakery3Server } from '@oeave/bakery3/node';\n * const api = new Bakery3Server(process.env.BAKERY3_SECRET_KEY!);\n *\n * const run = await api.renderBatch({\n * key: 'fall-2026',\n * products: [{ id: 'chair-aria', url: 'https://cdn.shop.com/models/chair-aria.glb' }],\n * shots: [\n * 'three-quarter',\n * { kind: 'video', from: 'three-quarter', to: 'three-quarter-back', seconds: 4 },\n * { id: 'low', azimuthDeg: -30, elevationDeg: 4 },\n * ],\n * room: { preset: 'loft_golden' },\n * maxCost: 600,\n * });\n *\n * A shot is a picture or a clip of a product from an angle: degrees around\n * the model from its front and degrees above the horizon, or a word for one.\n * The camera is framed from the model's own bounds, read when the model is\n * imported, so a vase and a sofa both fill the frame from the same word and\n * nothing is asked of the file itself. A clip is the camera carried from one\n * angle to another over `seconds`, one framed camera per frame.\n *\n * Settings come in three layers: the run's, then a product's, then a shot's,\n * the nearer winning. So one `room` at the top is every shot's room, a\n * product that wants the studio instead says `room: null, environment: {…}`,\n * and one shot in it can still be a close-up at 2048² in a jpeg.\n *\n * The model's bytes never pass through this process. Each URL is handed to\n * `POST /v1/assets/import`; the service fetches it once, stores it content\n * addressed like any upload, and answers with the hash and what the GLB says\n * about itself. A model that did not change since the last run is not\n * downloaded again. What this process sends is a few KB of manifest per shot.\n *\n * A manifest built here describes a model, cameras and light. A scene whose\n * look lives in code exists only where that code runs, so it is recorded\n * there, with `renderVariants()` in the page. Both kinds of item can share a\n * batch.\n *\n * No three.js here.\n */\n\nimport {\n protocolVersionFor,\n type AnimationSpec,\n type AssetImportKind,\n type AssetImportResponse,\n type BatchItemOutcome,\n type BatchItemRequest,\n type CameraSpec,\n type ColorSpec,\n type EnvironmentSpec,\n type GlbFacts,\n type Matrix4,\n type OutputSpec,\n type QualityPreset,\n type RenderSpec,\n type RoomPresetSpec,\n type SceneManifest,\n type Vec3,\n} from '../protocol/index.js';\nimport { QUALITY, isClipFormat, isVideoFormat } from '../protocol/index.js';\nimport type { Batch, BatchProgress } from '../batch.js';\nimport { Bakery3Error } from '../errors.js';\nimport {\n VIEW_WORDS,\n angleBetween,\n angleOf,\n cameraAt,\n centerOf,\n directionOf,\n framedCamera,\n framedDistance,\n radiusOf,\n type Angle,\n type Bounds,\n type ViewWord,\n} from '../frame.js';\nimport {\n HDRI_PRESETS,\n PEDESTAL_PRESETS,\n PRESETS_VERSION,\n type HdriPresetName,\n} from '../presets/catalog.gen.js';\nimport {\n ROOM_PRESETS,\n type RoomPresetLighting,\n type RoomPresetName,\n} from '../presets/rooms.gen.js';\nimport { emptyRecorded, type Recorded } from '../set.js';\nimport { SDK_VERSION } from '../version.js';\n\nconst DOCS = 'https://bakery3.com/docs/catalog';\nconst PRESET_LIBRARY = 'https://cdn.bakery3.com/presets';\nconst SKIPS_KEPT = 50;\n/**\n * After this many products, a run where most of them could not be imported\n * is a wrong base URL, not a bad model, and stops.\n */\nconst BREAKER_AFTER = 8;\nconst BREAKER_SHARE = 0.5;\n/** A clip is at most this long, and this many frames a second. */\nconst MAX_SECONDS = 30;\nconst MAX_FPS = 60;\n\n// ---------------------------------------------------------------------------\n// What the developer types\n// ---------------------------------------------------------------------------\n\n/**\n * Where to look from: a word, or degrees. `'room'` is the framing a preset\n * room was published with, from level or above: never looking up at the\n * product.\n */\nexport type View = ViewWord | 'room' | Angle;\n\nexport type BatchEnvironment = {\n /** A studio or a sky from the preset library. */\n preset?: HdriPresetName;\n /**\n * Or an HDRI of your own: a public https URL of a .hdr or .exr, imported\n * like the models.\n */\n url?: string;\n /** How strongly it lights the product. Default 1 (0.6 for the default studio). */\n intensity?: number;\n /** Turn the environment about the vertical, in degrees. */\n rotationDeg?: number;\n};\n\nexport type BatchRoom = {\n /** A room from the preset library. */\n preset: RoomPresetName;\n /** Default: the mode the room was designed under. */\n mode?: RoomPresetLighting;\n /**\n * What the product stands on. `'auto'` (the default) goes by its size: the\n * room's own pedestal for a small thing, the low plinth for a mid-sized\n * one, the floor for furniture and anything that would overhang. `'own'`\n * and `'floor'` say so yourself.\n */\n stand?: 'auto' | 'own' | 'floor';\n /**\n * Where the room's own camera sees the product from, in degrees from the\n * product's front. The room is turned about the product to make it so.\n * Default 30: a three-quarter view from the side the room is open to.\n */\n viewFromDeg?: number;\n};\n\n/**\n * What every shot can say about how it is taken. Set on the run for all of\n * them, on a product for its own, on a shot for that one; the nearest wins.\n */\nexport type ShotSettings = {\n /**\n * A preset room to stand in. `null` says no room, where a wider layer had\n * one.\n */\n room?: BatchRoom | null;\n /**\n * The light and backdrop when there is no room. Default: the\n * `studio_small_03` preset at 0.6.\n */\n environment?: BatchEnvironment;\n /**\n * `'transparent'` (the default, with a traced shadow), a `#rrggbb`, or\n * `'environment'`. A video has no alpha: `'transparent'` is `#f4f4f5` there\n * (a `png-sequence` keeps it).\n */\n background?: 'transparent' | 'environment' | `#${string}`;\n /** Default `'studio'`. */\n quality?: QualityPreset;\n /** Pixels. Default: the quality preset's long edge, square. */\n width?: number;\n height?: number;\n /**\n * `png` (the default), `jpeg` or `webp` for an image; `mp4` (the default),\n * `webm` or `png-sequence` (every frame a PNG with alpha, in one tar) for a\n * video.\n */\n format?: OutputSpec['format'];\n /** JPEG/WebP only, 1 to 100. */\n imageQuality?: number;\n /**\n * Vertical field of view in degrees. Default 30, or the room's own lens in\n * a room.\n */\n fov?: number;\n /**\n * Room around the model, as a share of its size. Default 0.12, or 0.9 in\n * a room.\n */\n margin?: number;\n /** Frames a second, for a video. Default 30, at most 60. */\n fps?: number;\n /** Renderer settings beyond the quality preset. */\n advanced?: RenderSpec['advanced'];\n /**\n * How the pictures are developed. Default: sRGB, ACES filmic, exposure 1\n * (a room's own exposure in a room).\n */\n color?: Partial<ColorSpec>;\n};\n\nexport type ImageShot = ShotSettings & {\n kind?: 'image';\n /** Default: the view's word, or `az35-el14` for degrees. Ends the item's key. */\n id?: string;\n /** Where from. Default `'three-quarter'`, or `'room'` in a room. */\n view?: View;\n /**\n * Instead of a view: a camera inside the model, by its node name, as the\n * file has it.\n */\n camera?: string;\n};\n\nexport type VideoShot = ShotSettings & {\n kind: 'video';\n /** Default `orbit-<from>-<to>`. */\n id?: string;\n /** The camera is carried from here. */\n from: View;\n /**\n * To here, azimuth as written: `{ azimuthDeg: 395 }` from 35 is a full\n * turn.\n */\n to: View;\n /** Default 4. At most 30. */\n seconds?: number;\n};\n\n/** A word or an angle is an image from that view. */\nexport type Shot = ViewWord | 'room' | Angle | ImageShot | VideoShot;\n\nexport type BatchProduct = ShotSettings & {\n /** Starts every shot's key. Stable across re-runs. */\n id: string;\n /** A public https URL of a binary glTF (.glb). */\n url: string;\n /** This product's shots, instead of the run's. */\n shots?: Shot[];\n /** Echoed on every shot of this product, its webhooks and the ledger. */\n metadata?: Record<string, unknown>;\n};\n\nexport type RenderBatchProgress = BatchProgress & {\n /** The product just recorded, or skipped. */\n product: string;\n /** Products recorded so far. */\n products: number;\n /** Shots recorded so far, clips included. */\n images: number;\n /** Products skipped so far. */\n skipped: number;\n};\n\n/** A product left out of a run, with the reason. */\nexport type ProductSkip = { id: string; url: string; error: Bakery3Error };\n\nexport type RenderBatchRecorded = Recorded & {\n /**\n * Products whose model could not be imported or read. The run went on\n * without them.\n */\n skipped: number;\n /** The first of those, with their reasons. */\n skips: ProductSkip[];\n};\n\nexport type RenderBatchOptions = ShotSettings & {\n /** Names the run. The same key re-opens it while it is unfinished. */\n key: string;\n /** A label for the console. Default: the key. */\n name?: string;\n /**\n * An array, a generator, a database cursor. Pulled as it is needed, never\n * collected.\n */\n products: Iterable<BatchProduct> | AsyncIterable<BatchProduct>;\n /**\n * Every product's shots, unless it has its own. Default: one image,\n * `'three-quarter'` (`'room'` in a room).\n */\n shots?: Shot[];\n /**\n * Appended to every key as `@version`. Bump it to trace again what already\n * rendered.\n */\n version?: string;\n /** The ceiling for the whole run, in USD. */\n maxCost: number;\n /** A ceiling per shot, in USD. A shot quoted above it is refused. */\n maxCostPerImage?: number;\n /**\n * `'batch'` (the default) never runs ahead of a person in a configurator;\n * `'normal'` is the API's ordinary lane.\n */\n lane?: 'batch' | 'normal';\n /** Fewer parallel shots than the plan allows, for a gentler budget. */\n maxParallel?: number;\n /** Imports in flight at once. Default 4, at most 16. */\n concurrency?: number;\n /** Called after each product is recorded or skipped. */\n onProgress?: (progress: RenderBatchProgress) => void;\n /**\n * Stops between products. What was recorded stays admitted; call again to\n * go on.\n */\n signal?: AbortSignal;\n};\n\n// ---------------------------------------------------------------------------\n// The recorder\n// ---------------------------------------------------------------------------\n\n/** The slice of the client a recording drives. */\nexport type BatchHost = {\n importAsset(body: {\n url: string;\n kind?: AssetImportKind;\n }): Promise<AssetImportResponse>;\n};\n\nexport type RenderBatchRecording = RenderBatchRecorded & {\n estimated: number;\n maximum: number;\n};\n\nexport type RecordBatchOptions = {\n /** Price, admit nothing. */\n dryRun?: boolean;\n /** Settings that beat every layer: what a test run forces. */\n force?: ShotSettings & { version?: string; seconds?: number };\n};\n\nexport async function recordBatch(\n host: BatchHost,\n batch: Batch,\n options: Omit<RenderBatchOptions, 'maxCost'>,\n { dryRun = false, force }: RecordBatchOptions = {},\n): Promise<RenderBatchRecording> {\n validateShots(options.shots ?? [], 'the run');\n const environments = new EnvironmentCache(host);\n\n const tally: RenderBatchRecording = {\n ...emptyRecorded(),\n skipped: 0,\n skips: [],\n estimated: 0,\n maximum: 0,\n };\n const seen = new Set<string>();\n let attempted = 0;\n\n const one = async (product: BatchProduct): Promise<void> => {\n let items: BatchItemRequest[];\n try {\n if (product.shots)\n validateShots(product.shots, `product \"${product.id}\"`);\n const imported = await host.importAsset({\n url: product.url,\n kind: 'scene',\n });\n items = await itemsOf(product, imported, options, environments, force);\n } catch (error) {\n // One model that will not import, or cannot be used as asked, is that\n // product's problem. A night's run does not stop for it; it is listed,\n // and the rest go on. Anything else is a verdict on the caller (the\n // plan, the key, a shot that is not a shot), would be the same for\n // every product, and stops the run.\n if (\n !(error instanceof Bakery3Error) ||\n (error.code !== 'ImportFailed' && error.code !== 'ImportRefused')\n )\n throw error;\n attempted++;\n tally.skipped++;\n if (tally.skips.length < SKIPS_KEPT)\n tally.skips.push({ id: product.id, url: product.url, error });\n if (\n attempted >= BREAKER_AFTER &&\n tally.skipped / attempted > BREAKER_SHARE\n )\n throw mostlyFailing(tally, attempted);\n report(product.id);\n return;\n }\n attempted++;\n\n let outcomes: BatchItemOutcome[];\n if (dryRun) {\n outcomes = await batch.quote(items);\n } else {\n for (const item of items) batch.add(item);\n outcomes = await batch.flush();\n }\n tally.variants++;\n tally.images += items.length;\n for (const outcome of outcomes) {\n if (outcome.error) {\n tally.refused++;\n if (tally.refusals.length < SKIPS_KEPT)\n tally.refusals.push({ key: outcome.key, error: outcome.error });\n } else if (outcome.adopted) tally.adopted++;\n else {\n tally.estimated += outcome.estimatedCost;\n tally.maximum += outcome.maximumCost;\n }\n }\n report(product.id);\n };\n\n const report = (product: string) =>\n options.onProgress?.({\n ...batch.progress(),\n product,\n products: tally.variants,\n images: tally.images,\n skipped: tally.skipped,\n });\n\n // A window of `concurrency` products in flight, refilled as each settles.\n // The list is pulled only as a slot frees, so a cursor over a million rows\n // holds `concurrency` of them here.\n const limit = Math.max(1, Math.min(16, Math.floor(options.concurrency ?? 4)));\n const flying = new Set<Promise<void>>();\n let failure: unknown;\n for await (const product of options.products) {\n if (failure) break;\n if (options.signal?.aborted) {\n failure = options.signal.reason ?? abortError();\n break;\n }\n validateProduct(product, seen);\n const task = one(product)\n .catch((error) => {\n failure ??= error;\n })\n .finally(() => flying.delete(task));\n flying.add(task);\n if (flying.size >= limit) await Promise.race(flying);\n }\n await Promise.all(flying);\n if (failure) throw failure;\n\n tally.estimated = Math.round(tally.estimated * 1e4) / 1e4;\n tally.maximum = Math.round(tally.maximum * 1e4) / 1e4;\n return tally;\n}\n\n// ---------------------------------------------------------------------------\n// One product's items: one per shot\n// ---------------------------------------------------------------------------\n\n/** A shot with every layer folded in. */\ntype ResolvedShot = ShotSettings & {\n id: string;\n kind: 'image' | 'video';\n view?: View;\n camera?: string;\n from?: View;\n to?: View;\n seconds?: number;\n};\n\nasync function itemsOf(\n product: BatchProduct,\n imported: AssetImportResponse,\n run: Omit<RenderBatchOptions, 'maxCost'>,\n environments: EnvironmentCache,\n force: RecordBatchOptions['force'],\n): Promise<BatchItemRequest[]> {\n const facts = imported.facts;\n if (!facts)\n throw unreadable(product, 'The import returned no facts about the model.');\n const blocking = facts.issues.find((issue) => issue.severity === 'error');\n if (blocking) throw unreadable(product, blocking.message);\n if (!facts.bounds)\n throw unreadable(\n product,\n 'The model has no geometry with bounds, so there is nowhere to point a camera.',\n );\n const bounds = facts.bounds;\n\n const runSettings = settingsOf(run);\n const productSettings = settingsOf(product);\n const shots = (product.shots ?? run.shots ?? []).map((shot) =>\n resolveShot(shot, runSettings, productSettings, force),\n );\n if (!shots.length) {\n const inRoom = layered('room', runSettings, productSettings, force) != null;\n shots.push(\n resolveShot(\n inRoom ? 'room' : 'three-quarter',\n runSettings,\n productSettings,\n force,\n ),\n );\n }\n\n const counts = { info: 0, warning: 0, error: 0 };\n for (const issue of facts.issues) counts[issue.severity]++;\n const version = force?.version ?? run.version;\n\n const items: BatchItemRequest[] = [];\n for (const shot of shots) {\n const quality = shot.quality ?? 'studio';\n const edge = QUALITY[quality].defaultLongEdge;\n const video = shot.kind === 'video';\n const output: OutputSpec = {\n width: shot.width ?? edge,\n height: shot.height ?? edge,\n format: shot.format ?? (video ? 'mp4' : 'png'),\n ...(shot.imageQuality !== undefined\n ? { quality: shot.imageQuality }\n : {}),\n };\n if (video !== isClipFormat(output.format)) {\n throw new Bakery3Error({\n code: 'InvalidRequest',\n message: `Shot \"${shot.id}\" of ${product.id} is ${video ? 'a video in a still' : 'an image in a video'} format (${output.format}).`,\n fix: 'A video is mp4, webm or png-sequence; an image is png, jpeg or webp. Leave `format` out for the default.',\n path: `${product.id}/${shot.id}`,\n docs: `${DOCS}#shots`,\n });\n }\n const aspect = output.width / output.height;\n\n const room = shot.room ? roomFor(shot.room, bounds) : undefined;\n // A video has no alpha, so a transparent background would show the raw\n // studio map behind the product. A video stands on a plain backdrop\n // instead, with its shadow, unless the shot says what it stands on. A\n // png-sequence keeps its alpha, as a still does.\n const background =\n isVideoFormat(output.format) &&\n (shot.background ?? 'transparent') === 'transparent'\n ? CLIP_BACKDROP\n : shot.background;\n const environment = room\n ? roomBackground()\n : await environments.get(shot.environment, background);\n const color: ColorSpec = {\n outputColorSpace: 'srgb',\n toneMapping: 'aces-filmic',\n toneMappingExposure: room ? room.exposure : 1,\n ...shot.color,\n };\n const lens = { fov: shot.fov, margin: shot.margin };\n\n let camera: CameraSpec;\n let animation: AnimationSpec | undefined;\n if (video) {\n const from = angleFor(shot.from!, room, product, shot.id);\n const to = angleFor(shot.to!, room, product, shot.id);\n const fps = Math.min(MAX_FPS, Math.max(1, Math.round(shot.fps ?? 30)));\n const seconds = Math.min(MAX_SECONDS, shot.seconds ?? 4);\n const frameCount = Math.max(2, Math.round(seconds * fps));\n const positions: number[] = [];\n const quaternions: number[] = [];\n let first: CameraSpec | undefined;\n for (let frame = 0; frame < frameCount; frame++) {\n const at = angleBetween(from, to, frame / (frameCount - 1));\n const spec = cameraForAngle(at, bounds, aspect, lens, room, shot.id);\n first ??= spec;\n positions.push(...spec.position);\n quaternions.push(...spec.quaternion);\n }\n camera = first!;\n animation = {\n fps,\n frameCount,\n channels: [\n {\n target: { type: 'camera' },\n property: 'position',\n size: 3,\n values: positions,\n },\n {\n target: { type: 'camera' },\n property: 'quaternion',\n size: 4,\n values: quaternions,\n },\n ],\n };\n } else if (shot.camera) {\n camera = ownCamera(shot.camera, facts, aspect, product, shot.id);\n } else {\n camera = cameraForAngle(\n angleFor(\n shot.view ?? (room ? 'room' : 'three-quarter'),\n room,\n product,\n shot.id,\n ),\n bounds,\n aspect,\n lens,\n room,\n shot.id,\n );\n }\n\n const manifest: SceneManifest = {\n protocolVersion: protocolVersionFor({\n ...(room ? { room: room.spec } : {}),\n ...(animation ? { animation } : {}),\n }),\n sdkVersion: SDK_VERSION,\n sceneAsset: imported.hash,\n camera,\n environment,\n color,\n ...(room ? { room: room.spec } : {}),\n ...(animation ? { animation } : {}),\n compatibility: { score: 1, issues: facts.issues, counts },\n stats: {\n triangles: facts.triangles + (room?.triangles ?? 0),\n // A room is priced by how enclosed and how full it is, measured when\n // it was published; the product adds one object to it. Without a room\n // the shot is an open set, which needs saying nothing.\n ...(room?.complexity\n ? {\n enclosure: room.complexity.enclosure,\n objects: room.complexity.objects + 1,\n }\n : {}),\n },\n source: { renderer: 'catalog' },\n };\n\n const key = `${product.id}/${shot.id}${version ? `@${version}` : ''}`;\n if (key.length > 200)\n throw unreadable(\n product,\n `The key \"${key.slice(0, 40)}…\" is over 200 characters. Use shorter ids.`,\n );\n items.push({\n key,\n spec: {\n manifest,\n quality,\n output,\n ...(shot.advanced ? { advanced: shot.advanced } : {}),\n ...(video ? { preview: false } : {}),\n },\n metadata: {\n ...product.metadata,\n variant: product.id,\n shot: shot.id,\n kind: shot.kind,\n },\n ...(run.maxCostPerImage !== undefined\n ? { maxCost: run.maxCostPerImage }\n : {}),\n });\n }\n return items;\n}\n\n// ---------------------------------------------------------------------------\n// Settings, in layers\n// ---------------------------------------------------------------------------\n\nconst SETTING_KEYS = [\n 'room',\n 'environment',\n 'background',\n 'quality',\n 'width',\n 'height',\n 'format',\n 'imageQuality',\n 'fov',\n 'margin',\n 'fps',\n 'advanced',\n 'color',\n] as const satisfies ReadonlyArray<keyof ShotSettings>;\n\nfunction settingsOf(source: ShotSettings): ShotSettings {\n const out: ShotSettings = {};\n for (const key of SETTING_KEYS)\n if (source[key] !== undefined)\n (out as Record<string, unknown>)[key] = source[key];\n return out;\n}\n\n/**\n * The nearest layer that says anything about `key`, `null` included: a\n * product's `room: null` beats the run's room.\n */\nfunction layered<K extends keyof ShotSettings>(\n key: K,\n ...layers: Array<ShotSettings | undefined>\n): ShotSettings[K] {\n for (let i = layers.length - 1; i >= 0; i--) {\n const value = layers[i]?.[key];\n if (value !== undefined) return value;\n }\n return undefined;\n}\n\n/** A word or a bare angle, as the image shot it stands for. */\nfunction shotOf(shot: Shot): ImageShot | VideoShot {\n if (typeof shot === 'string') return { view: shot };\n if (\n shot &&\n typeof shot === 'object' &&\n 'azimuthDeg' in shot &&\n !('view' in shot) &&\n !('kind' in shot) &&\n !('camera' in shot)\n ) {\n const { azimuthDeg, elevationDeg, ...rest } = shot as Angle & ImageShot;\n return {\n ...rest,\n view: {\n azimuthDeg,\n ...(elevationDeg !== undefined ? { elevationDeg } : {}),\n },\n };\n }\n return shot as ImageShot | VideoShot;\n}\n\nfunction resolveShot(\n shot: Shot,\n run: ShotSettings,\n product: ShotSettings,\n force: RecordBatchOptions['force'],\n): ResolvedShot {\n const own = shotOf(shot);\n const settings: ShotSettings = {};\n for (const key of SETTING_KEYS) {\n const value = layered(key, run, product, settingsOf(own), force);\n if (value !== undefined) (settings as Record<string, unknown>)[key] = value;\n }\n if (own.kind === 'video') {\n return {\n ...settings,\n kind: 'video',\n id: own.id ?? `orbit-${viewName(own.from)}-${viewName(own.to)}`,\n from: own.from,\n to: own.to,\n seconds:\n force?.seconds !== undefined\n ? Math.min(force.seconds, own.seconds ?? 4)\n : own.seconds,\n };\n }\n const image = own as ImageShot;\n return {\n ...settings,\n kind: 'image',\n id:\n image.id ??\n (image.camera\n ? image.camera\n : viewName(image.view ?? (settings.room ? 'room' : 'three-quarter'))),\n ...(image.view !== undefined ? { view: image.view } : {}),\n ...(image.camera !== undefined ? { camera: image.camera } : {}),\n };\n}\n\nfunction viewName(view: View): string {\n if (typeof view === 'string') return view;\n const el = view.elevationDeg;\n return `az${Math.round(view.azimuthDeg)}${el !== undefined ? `-el${Math.round(el)}` : ''}`.replace(\n '--',\n '-neg',\n );\n}\n\n// ---------------------------------------------------------------------------\n// Cameras\n// ---------------------------------------------------------------------------\n\ntype Room = ReturnType<typeof roomFor>;\n\n/** A view as an angle, the room's published direction for `'room'`. */\nfunction angleFor(\n view: View,\n room: Room | undefined,\n product: BatchProduct,\n shot: string,\n): Angle {\n if (view === 'room') {\n if (!room) {\n throw new Bakery3Error({\n code: 'InvalidRequest',\n message: `Shot \"${shot}\" of ${product.id} looks from 'room', but has no room.`,\n fix: \"Set `room: { preset: … }` on the run, the product or the shot, or use a view such as 'three-quarter'.\",\n path: `${product.id}/${shot}`,\n docs: `${DOCS}#angles`,\n });\n }\n return room.published;\n }\n const angle = angleOf(view);\n if (angle) return angle;\n throw new Bakery3Error({\n code: 'InvalidRequest',\n message: `Shot \"${shot}\" of ${product.id}: \"${typeof view === 'string' ? view : JSON.stringify(view)}\" is not a view.`,\n fix: `A view is one of ${Object.keys(VIEW_WORDS).join(', ')}, room, or \\`{ azimuthDeg, elevationDeg? }\\`. For a camera inside the model, use \\`camera: '<node name>'\\`.`,\n path: `${product.id}/${shot}`,\n docs: `${DOCS}#angles`,\n });\n}\n\nfunction cameraForAngle(\n angle: Angle,\n bounds: Bounds,\n aspect: number,\n lens: { fov?: number; margin?: number },\n room: Room | undefined,\n name: string,\n): CameraSpec {\n if (room) return room.camera(angle, aspect, lens, name);\n return framedCamera(\n bounds,\n {\n id: name,\n ...angle,\n ...(lens.fov !== undefined ? { fov: lens.fov } : {}),\n ...(lens.margin !== undefined ? { margin: lens.margin } : {}),\n },\n aspect,\n );\n}\n\n/** A camera the model carries, at the output's aspect. */\nfunction ownCamera(\n name: string,\n facts: GlbFacts,\n aspect: number,\n product: BatchProduct,\n shot: string,\n): CameraSpec {\n const own = facts.cameras.find((camera) => camera.name === name);\n if (own)\n return {\n ...own.camera,\n ...(own.camera.type === 'perspective' ? { aspect } : {}),\n name: shot,\n } as CameraSpec;\n const names = facts.cameras.map((camera) => camera.name);\n throw new Bakery3Error({\n code: 'ImportFailed',\n message: `Shot \"${shot}\": ${product.id}'s model has no camera named \"${name}\".`,\n fix: names.length\n ? `Its cameras are: ${names.slice(0, 8).join(', ')}.`\n : 'It carries no cameras. Use a view instead: an angle is framed from the model itself.',\n path: `${product.id}/${shot}`,\n docs: `${DOCS}#angles`,\n });\n}\n\n// ---------------------------------------------------------------------------\n// Light: an environment, or a room\n// ---------------------------------------------------------------------------\n\n/**\n * What a product stands in when nothing is said. `studio_small_03` at full\n * strength clips a white product to paper (a ceramic vase or a lacquered\n * table top loses its form shading); at 0.6 they keep it and a dark sofa is\n * still well lit. An environment the caller names is used at the strength\n * they give, 1 unless they say.\n */\nconst DEFAULT_ENVIRONMENT: BatchEnvironment = {\n preset: 'studio_small_03',\n intensity: 0.6,\n};\n/**\n * What a clip stands on when nothing is said: a light neutral, the same one\n * a preview is flattened onto.\n */\nconst CLIP_BACKDROP = '#f4f4f5' as const;\n\n/** One import per distinct HDRI URL, however many shots share it. */\nclass EnvironmentCache {\n private readonly hashes = new Map<string, Promise<string>>();\n constructor(private readonly host: BatchHost) {}\n\n async get(\n chosen: BatchEnvironment | undefined,\n background: ShotSettings['background'],\n ): Promise<EnvironmentSpec> {\n const environment = chosen ?? DEFAULT_ENVIRONMENT;\n if (environment.preset && environment.url) {\n throw new Bakery3Error({\n code: 'InvalidRequest',\n message: 'environment takes a `preset` or a `url`, not both.',\n docs: `${DOCS}#light`,\n });\n }\n let hdri: string;\n if (environment.url) {\n // Your own HDRI arrives at the renderer as a hash, like every other\n // asset. Only the preset library is ever named by URL.\n const url = environment.url;\n let pending = this.hashes.get(url);\n if (!pending) {\n pending = this.host\n .importAsset({ url, kind: 'hdri' })\n .then((imported) => imported.hash);\n this.hashes.set(url, pending);\n pending.catch(() => this.hashes.delete(url));\n }\n hdri = await pending;\n } else {\n const name = environment.preset ?? 'studio_small_03';\n if (!(name in HDRI_PRESETS)) {\n throw new Bakery3Error({\n code: 'InvalidRequest',\n message: `There is no environment preset \"${name}\".`,\n fix: `The presets are: ${Object.keys(HDRI_PRESETS).join(', ')}.`,\n docs: `${DOCS}#light`,\n });\n }\n hdri = `${PRESET_LIBRARY}/v${PRESETS_VERSION}/hdri/${name}/render.exr`;\n }\n return {\n hdri,\n ...(environment.intensity !== undefined\n ? { intensity: environment.intensity }\n : {}),\n ...(environment.rotationDeg\n ? {\n rotation: [0, (environment.rotationDeg * Math.PI) / 180, 0] as Vec3,\n }\n : {}),\n background: backgroundOf(background),\n };\n }\n}\n\nfunction backgroundOf(\n background: ShotSettings['background'],\n): NonNullable<EnvironmentSpec['background']> {\n const chosen = background ?? 'transparent';\n if (chosen === 'transparent') return { type: 'transparent' };\n if (chosen === 'environment') return { type: 'environment' };\n if (!/^#[0-9a-f]{6}$/i.test(chosen)) {\n throw new Bakery3Error({\n code: 'InvalidRequest',\n message: `background \"${chosen}\" is not 'transparent', 'environment' or a #rrggbb color.`,\n docs: `${DOCS}#light`,\n });\n }\n return { type: 'color', color: chosen };\n}\n\n/** In a room the room is the background; what no wall covers is transparent. */\nfunction roomBackground(): EnvironmentSpec {\n return { background: { type: 'transparent' } };\n}\n\n/**\n * What a product stands on follows its size, by the rule the rooms were\n * designed around: a small thing on the room's own pedestal, a mid-sized\n * piece on the low wide plinth, furniture and anything that would overhang\n * on the floor. A sofa on a meter-high column is a picture nobody wanted.\n */\nconst STAND_RULES = {\n fit: 0.85,\n tallFrom: 0.6,\n smallHeight: 0.6,\n plinthHeight: 1.0,\n} as const;\nconst PLINTH = 'pedestal_plinth';\n/** Room to see the room in: the product fills about half the frame. */\nconst ROOM_MARGIN = 0.9;\n/** A camera is kept this far inside the walls, the floor and the ceiling. */\nconst WALL_CLEARANCE = 0.3;\n/** The least room left around a product when a wall decides the distance. */\nconst FIT_MARGIN = 0.12;\n/** The widest lens a wall can force. */\nconst MAX_ROOM_FOV = 100;\n/**\n * The lowest the `'room'` view is taken from, in degrees above the product's\n * middle. A room's published camera is the hero shot of its own stand, and\n * three look up at it (living_evening 14 degrees, gallery_day 11,\n * dining_golden 5). Aimed at a real product along that line, the camera\n * stood below the surface a short product stands on, so the stand's top and\n * the product's base were hidden, and a sofa on the floor was shot from\n * near the floor through a wide lens. Level keeps every room's direction and\n * distance and changes only those three.\n */\nconst ROOM_MIN_ELEVATION_DEG = 0;\n\n/**\n * The vertical field of view that fits a sphere of `radius` at `distance`,\n * in the narrower of the two axes.\n */\nfunction fovToFit(radius: number, distance: number, aspect: number): number {\n const half = Math.asin(Math.min(1, radius / distance));\n const vertical = aspect >= 1 ? half : Math.atan(Math.tan(half) / aspect);\n return (2 * vertical * 180) / Math.PI;\n}\n\nfunction standFor(\n room: BatchRoom,\n info: (typeof ROOM_PRESETS)[RoomPresetName],\n bounds: Bounds,\n): { pedestal?: RoomPresetSpec['pedestal']; top: number } {\n const footprint = Math.max(\n bounds.max[0] - bounds.min[0],\n bounds.max[2] - bounds.min[2],\n );\n const height = bounds.max[1] - bounds.min[1];\n const fits = (\n size: { x: number; y: number; z: number } | null | undefined,\n ): boolean => {\n if (!size) return false;\n if (footprint > STAND_RULES.fit * Math.min(size.x, size.z)) return false;\n return (\n height <=\n (size.y >= STAND_RULES.tallFrom\n ? STAND_RULES.smallHeight\n : STAND_RULES.plinthHeight)\n );\n };\n const choice = room.stand ?? 'auto';\n if (choice === 'own' || (choice === 'auto' && fits(info.stand.size)))\n return { top: info.stand.top };\n if (choice === 'auto' && fits(PEDESTAL_PRESETS[PLINTH].size))\n return { pedestal: { type: PLINTH }, top: PEDESTAL_PRESETS[PLINTH].size.y };\n return { pedestal: null, top: 0 };\n}\n\n/**\n * Put the room around the product, since the product cannot be moved into\n * the room: a model by URL has none of the ids a transform is addressed by.\n * The room is turned about its stand so its published camera sees the\n * product from `viewFromDeg`, and placed so the stand's top (or the floor)\n * is under the product's base. What the renderer receives is one matrix.\n */\nfunction roomFor(room: BatchRoom, bounds: Bounds) {\n const info = ROOM_PRESETS[room.preset];\n if (!info) {\n throw new Bakery3Error({\n code: 'InvalidRequest',\n message: `There is no room preset \"${room.preset}\".`,\n fix: `The rooms are: ${Object.keys(ROOM_PRESETS).join(', ')}.`,\n docs: `${DOCS}#light`,\n });\n }\n const lighting = room.mode ?? info.lighting;\n const standing = standFor(room, info, bounds);\n const stand: Vec3 = [info.stand.x, standing.top, info.stand.z];\n const base: Vec3 = [\n (bounds.min[0] + bounds.max[0]) / 2,\n bounds.min[1],\n (bounds.min[2] + bounds.max[2]) / 2,\n ];\n const size: Vec3 = [\n bounds.max[0] - bounds.min[0],\n bounds.max[1] - bounds.min[1],\n bounds.max[2] - bounds.min[2],\n ];\n const radius = radiusOf(bounds);\n\n // The published line, from the stand to the camera, as an angle and a length.\n const line: Vec3 = [\n info.camera.position[0] - info.camera.target[0],\n info.camera.position[1] - info.camera.target[1],\n info.camera.position[2] - info.camera.target[2],\n ];\n const designed = Math.hypot(line[0], line[1], line[2]);\n const publishedAzimuth = Math.atan2(line[0], line[2]);\n const viewFrom = ((room.viewFromDeg ?? 30) * Math.PI) / 180;\n const theta = viewFrom - publishedAzimuth;\n const c = Math.cos(theta);\n const s = Math.sin(theta);\n /** A point in the room's frame, in the product's. */\n const place = ([x, y, z]: readonly [number, number, number]): Vec3 => {\n const dx = x - stand[0];\n const dz = z - stand[2];\n return [\n base[0] + dx * c + dz * s,\n base[1] + (y - stand[1]),\n base[2] - dx * s + dz * c,\n ];\n };\n const origin = place([0, 0, 0]);\n const matrix: Matrix4 = [\n c,\n 0,\n -s,\n 0,\n 0,\n 1,\n 0,\n 0,\n s,\n 0,\n c,\n 0,\n origin[0],\n origin[1],\n origin[2],\n 1,\n ];\n\n const spec: RoomPresetSpec = {\n name: room.preset,\n build: info.build,\n lighting,\n ...(standing.pedestal !== undefined ? { pedestal: standing.pedestal } : {}),\n matrix,\n };\n const published: Angle = {\n azimuthDeg: (viewFrom * 180) / Math.PI,\n elevationDeg: Math.max(\n ROOM_MIN_ELEVATION_DEG,\n (Math.atan2(line[1], Math.hypot(line[0], line[2])) * 180) / Math.PI,\n ),\n };\n /**\n * The room's published camera: a 36 mm horizontal sensor, so the vertical\n * FOV follows the aspect.\n */\n const lensFov = (aspect: number) =>\n (2 *\n Math.atan((aspect >= 1 ? 36 / aspect : 36) / (2 * info.camera.lensMm)) *\n 180) /\n Math.PI;\n\n return {\n spec,\n triangles: info.preview.triangles,\n complexity: info.complexity,\n exposure: info.exposure[lighting],\n published,\n /**\n * A camera in the room from any angle: framed as in the open, from as\n * far as the published camera stood when that is the view, and never\n * behind a wall, the floor or the ceiling.\n */\n camera(\n angle: Angle,\n aspect: number,\n lens: { fov?: number; margin?: number },\n name: string,\n ): CameraSpec {\n const fov = lens.fov ?? lensFov(aspect);\n const center = centerOf(bounds);\n const direction = directionOf(angle);\n const framed = framedDistance(\n radius,\n fov,\n aspect,\n lens.margin ?? ROOM_MARGIN,\n );\n const isPublished =\n Math.abs(angle.azimuthDeg - published.azimuthDeg) < 1e-6 &&\n Math.abs((angle.elevationDeg ?? 12) - published.elevationDeg!) < 1e-6;\n\n // The direction in the room's own frame, to find the wall it meets.\n const rx = direction[0] * c - direction[2] * s;\n const rz = direction[0] * s + direction[2] * c;\n const ry = direction[1];\n const from: Vec3 = [stand[0], stand[1] + size[1] / 2, stand[2]];\n const half = [\n info.size.width / 2 - WALL_CLEARANCE,\n info.size.depth / 2 - WALL_CLEARANCE,\n ];\n let reach = Infinity;\n if (rx !== 0)\n reach = Math.min(\n reach,\n ((rx > 0 ? half[0]! : -half[0]!) - from[0]) / rx,\n );\n if (rz !== 0)\n reach = Math.min(\n reach,\n ((rz > 0 ? half[1]! : -half[1]!) - from[2]) / rz,\n );\n if (ry > 0)\n reach = Math.min(\n reach,\n (info.size.height - WALL_CLEARANCE - from[1]) / ry,\n );\n if (ry < 0) reach = Math.min(reach, (WALL_CLEARANCE - from[1]) / ry);\n\n const wanted = Math.max(isPublished ? designed : 0, framed);\n const distance = Math.max(radius * 1.2, Math.min(wanted, reach));\n // A photographer with their back to the wall takes a wider lens. The\n // product still fits, with a little room, at whatever the walls allow.\n const lensFit =\n distance < framed\n ? fovToFit(radius * (1 + FIT_MARGIN), distance, aspect)\n : fov;\n return cameraAt(\n center,\n radius,\n direction,\n distance,\n Math.min(MAX_ROOM_FOV, Math.max(fov, lensFit)),\n aspect,\n name,\n );\n },\n };\n}\n\n// ---------------------------------------------------------------------------\n\nfunction validateShots(shots: Shot[], where: string): void {\n const ids = new Set<string>();\n shots.forEach((shot, index) => {\n if (!shot || (typeof shot !== 'string' && typeof shot !== 'object'))\n throw badShot(where, index, 'is not a shot');\n const own = shotOf(shot);\n if (own.kind === 'video') {\n if (angleOf(own.from) === null && own.from !== 'room')\n throw badShot(where, index, '`from` is not a view');\n if (angleOf(own.to) === null && own.to !== 'room')\n throw badShot(where, index, '`to` is not a view');\n if (\n own.seconds !== undefined &&\n !(own.seconds > 0 && own.seconds <= MAX_SECONDS)\n )\n throw badShot(\n where,\n index,\n `\\`seconds\\` is outside 0 to ${MAX_SECONDS}`,\n );\n } else if (own.kind !== undefined && own.kind !== 'image') {\n throw badShot(\n where,\n index,\n `kind \"${String(own.kind)}\" is not 'image' or 'video'`,\n );\n } else if (\n (own as ImageShot).view !== undefined &&\n (own as ImageShot).camera !== undefined\n ) {\n throw badShot(where, index, 'has both a `view` and a `camera`');\n }\n const id =\n own.id ??\n (own.kind === 'video'\n ? `orbit-${viewName(own.from)}-${viewName(own.to)}`\n : ((own as ImageShot).camera ??\n ((own as ImageShot).view !== undefined\n ? viewName((own as ImageShot).view!)\n : undefined)));\n if (id !== undefined) {\n if (!/^[A-Za-z0-9_.-]{1,60}$/.test(id))\n throw badShot(\n where,\n index,\n `id \"${id}\" is not 1 to 60 letters, digits, dots, dashes or underscores`,\n );\n if (ids.has(id)) throw badShot(where, index, `id \"${id}\" is used twice`);\n ids.add(id);\n }\n });\n}\n\nfunction badShot(where: string, index: number, what: string): Bakery3Error {\n return new Bakery3Error({\n code: 'InvalidRequest',\n message: `Shot ${index + 1} of ${where} ${what}.`,\n why: 'A shot is a word, `{ view }`, or `{ kind: \"video\", from, to }`, plus settings, and its id ends the picture’s key.',\n docs: `${DOCS}#shots`,\n });\n}\n\nfunction validateProduct(product: BatchProduct, seen: Set<string>): void {\n if (\n !product ||\n typeof product.id !== 'string' ||\n !product.id ||\n typeof product.url !== 'string' ||\n !product.url\n ) {\n throw new Bakery3Error({\n code: 'InvalidRequest',\n message: 'Every product needs an `id` and a `url`.',\n why: 'The id starts every shot’s key: it is what a re-run adopts by and what a failure is reported under.',\n docs: DOCS,\n });\n }\n if (seen.has(product.id)) {\n throw new Bakery3Error({\n code: 'InvalidRequest',\n message: `Two products are called \"${product.id}\".`,\n why: 'The second would be adopted as the first: same key, same picture.',\n fix: 'Make the ids unique.',\n path: product.id,\n docs: DOCS,\n });\n }\n seen.add(product.id);\n}\n\nfunction unreadable(product: BatchProduct, message: string): Bakery3Error {\n return new Bakery3Error({\n code: 'ImportFailed',\n message,\n path: product.id,\n docs: `${DOCS}#what-a-model-can-use`,\n });\n}\n\nfunction mostlyFailing(\n tally: RenderBatchRecorded,\n attempted: number,\n): Bakery3Error {\n const first = tally.skips[0]!;\n return new Bakery3Error({\n code: 'ImportFailed',\n message: `${tally.skipped} of the first ${attempted} models could not be imported. The first: ${first.id}: ${first.error.message}`,\n why: 'One bad model is skipped and listed. Most of them failing is something wrong with all of them: a base URL, a bucket that is not public, a format.',\n fix: 'Open one of the URLs in a private browser window. It has to download a .glb there. What was recorded stays admitted; call again with the same key to go on.',\n docs: `${DOCS}#importing-by-url`,\n });\n}\n\nfunction abortError(): Error {\n const error = new Error('The recording was aborted.');\n error.name = 'AbortError';\n return error;\n}\n","/**\n * Webhook signature verification.\n *\n * A webhook endpoint is a public URL that causes writes in the developer's\n * database. Verifying is not optional, so it is one function with no options\n * and no way to get it subtly wrong.\n *\n * const event = await verifyWebhook({\n * body: await request.text(),\n * signature: request.headers.get('bakery3-signature'),\n * secret: process.env.BAKERY3_WEBHOOK_SECRET!,\n * });\n *\n * Pass the raw body, not a parsed and re-stringified object. Re-serializing\n * JSON changes key order and whitespace and therefore the signature, and it\n * is the single most common reason a correct implementation fails.\n */\n\nimport type { WebhookPayload } from '../protocol/index.js';\nimport { Bakery3Error } from '../errors.js';\n\n/**\n * A signature older than this is refused, so a captured request cannot be\n * replayed later. Five minutes is the usual allowance for clock skew.\n */\nconst TOLERANCE_MS = 5 * 60 * 1000;\n\n/**\n * Verify a webhook request and return its payload. Throws a `Bakery3Error`\n * (`Unauthorized`) when the header is missing, malformed, older than five\n * minutes, or signed with another secret.\n */\nexport async function verifyWebhook(input: {\n /** The request body exactly as received, as text. */\n body: string;\n /**\n * The `bakery3-signature` header. `headers.get()` gives `null` when the\n * request has none, and that is refused like a bad signature.\n */\n signature: string | null | undefined;\n /** The signing secret from your webhook settings. */\n secret: string;\n /** Test seam. Never pass this in production. */\n now?: number;\n}): Promise<WebhookPayload> {\n const { body, signature, secret } = input;\n const now = input.now ?? Date.now();\n\n if (typeof secret !== 'string' || !secret) {\n throw new Bakery3Error({\n code: 'InvalidRequest',\n message: 'verifyWebhook() was given no secret.',\n fix: 'Pass the signing secret from your webhook settings, from a server-only environment variable: secret: process.env.BAKERY3_WEBHOOK_SECRET!',\n docs: 'https://bakery3.com/docs/webhooks',\n });\n }\n if (typeof signature !== 'string' || !signature) {\n throw invalid(\n 'The request has no bakery3-signature header. Pass request.headers.get(\"bakery3-signature\").',\n );\n }\n\n // `t=<ms>,v1=<hex>`: the timestamp is signed together with the body, which\n // is what makes the replay window enforceable.\n const parts = Object.fromEntries(\n signature.split(',').map((piece) => {\n const index = piece.indexOf('=');\n return [piece.slice(0, index).trim(), piece.slice(index + 1).trim()];\n }),\n );\n const timestamp = Number(parts.t);\n const provided = parts.v1;\n\n if (!timestamp || !provided) {\n throw invalid('Signature header is malformed. Expected \"t=…,v1=…\".');\n }\n if (Math.abs(now - timestamp) > TOLERANCE_MS) {\n throw invalid('Signature timestamp is outside the five-minute tolerance.');\n }\n\n const key = await crypto.subtle.importKey(\n 'raw',\n new TextEncoder().encode(secret),\n { name: 'HMAC', hash: 'SHA-256' },\n false,\n ['sign'],\n );\n const mac = await crypto.subtle.sign(\n 'HMAC',\n key,\n new TextEncoder().encode(`${timestamp}.${body}`),\n );\n\n if (!timingSafeEqual(toHex(new Uint8Array(mac)), provided)) {\n throw invalid('Signature does not match the body.');\n }\n\n return JSON.parse(body) as WebhookPayload;\n}\n\nfunction invalid(message: string): Bakery3Error {\n return new Bakery3Error({\n code: 'Unauthorized',\n message,\n why: 'The request did not carry a valid Bakery3 signature, so it may not have come from us.',\n fix: 'Pass the raw request body (not a re-serialized object) and the secret from your webhook settings.',\n docs: 'https://bakery3.com/docs/webhooks',\n });\n}\n\n/**\n * Constant time in the length-equal case, which is the only case that can\n * leak anything useful: both sides are fixed-length hex digests.\n */\nfunction timingSafeEqual(a: string, b: string): boolean {\n if (a.length !== b.length) return false;\n let diff = 0;\n for (let i = 0; i < a.length; i++) diff |= a.charCodeAt(i) ^ b.charCodeAt(i);\n return diff === 0;\n}\n\nfunction toHex(bytes: Uint8Array): string {\n let out = '';\n for (const byte of bytes) out += byte.toString(16).padStart(2, '0');\n return out;\n}\n","/**\n * @oeave/bakery3/node: the server half.\n *\n * The secret key lives here and only here. It never reaches a browser and is\n * never an argument to anything in `@oeave/bakery3`. This module mints the\n * short-lived, narrow token that goes in its place, verifies webhooks, and\n * calls the API with the secret key for the things a browser may not do.\n *\n * import { Bakery3Server } from '@oeave/bakery3/node';\n *\n * const bakery3 = new Bakery3Server(process.env.BAKERY3_SECRET_KEY!);\n *\n * export async function POST() {\n * return Response.json(\n * await bakery3.tokens.create({\n * expiresInSeconds: 300,\n * maxRenders: 1,\n * maxCost: 1,\n * allowedOrigins: ['https://shop.example.com'],\n * })\n * );\n * }\n *\n * That endpoint is the entire server-side integration.\n */\n\nimport type {\n AssetDeleteResponse,\n AssetImportKind,\n AssetImportResponse,\n AssetsDeleteResponse,\n BatchOpenRequest,\n CostEstimate,\n RenderRecord,\n RenderSpec,\n} from '../protocol/index.js';\nimport { QUALITY, isAssetHash } from '../protocol/index.js';\nimport { Bakery3Error } from '../errors.js';\nimport { Bakery3Client, type RetryPolicy } from '../client.js';\nimport { Batch } from '../batch.js';\nimport { RenderSet } from '../set.js';\nimport {\n quoteKey,\n sampleOf,\n testSettings,\n type TestRunOptions,\n} from '../testRun.js';\nimport {\n recordBatch,\n type RenderBatchOptions,\n type RenderBatchRecorded,\n type RenderBatchRecording,\n} from './renderBatch.js';\nimport { warnIfKeyIsExposed } from '../warn.js';\n\nexport type BrowserTokenOptions = {\n /**\n * How long the token lives, in seconds. Default 300. Keep it short: a\n * browser token is a capability handed to a page, and the shorter its life\n * the less a leaked one is worth. Five minutes is plenty, because the\n * browser SDK re-mints on a 401 without the developer writing anything.\n */\n expiresInSeconds?: number;\n /** Hard ceiling on renders this token can start. Default 5. */\n maxRenders?: number;\n /** Hard ceiling on spend across all of them, in USD. Default 2. */\n maxCost?: number;\n /**\n * Origins allowed to spend it. Set this in production: it is what stops a\n * token lifted out of one page's network tab from working anywhere else.\n */\n allowedOrigins?: string[];\n /** Your own user/session id. Shows up in the usage ledger for attribution. */\n subject?: string;\n};\n\nexport type BrowserToken = {\n /** The token itself, a `bk_pt_` string. Hand it to the browser SDK. */\n token: string;\n /** When it stops working, as a Unix timestamp in milliseconds. */\n expiresAt: number;\n /** The project the token renders into. */\n projectId: string;\n};\n\nexport type Bakery3ServerOptions = {\n /** The API's base URL. Only for a self-hosted or test deployment. */\n baseUrl?: string;\n /** A `fetch` to use instead of the global one. */\n fetch?: typeof fetch;\n /** How a 429/503 is waited out. The browser SDK's defaults otherwise. */\n retry?: RetryPolicy;\n};\n\n/** A run's pictures, plus which products were left out and why. */\nexport type RenderBatchRun = RenderSet & {\n readonly recorded: RenderBatchRecorded;\n};\n\nexport class Bakery3Server {\n readonly tokens: TokensApi;\n readonly renders: RendersApi;\n readonly batches: BatchesApi;\n readonly assets: AssetsApi;\n\n private readonly secretKey: string | undefined;\n private readonly options: Bakery3ServerOptions;\n private transport: Bakery3Client | undefined;\n\n /**\n * @param secretKey Your `bk_sk_` key, as a string, from a server-only\n * environment variable. Not the browser SDK's `{ apiKey }` object.\n *\n * The key is checked on the first request, not here. A route module that\n * builds its client at the top level is evaluated by `next build`, often\n * where the server's secrets are not set, and a constructor that threw\n * there would fail the build over a key the build never uses.\n */\n constructor(secretKey: string, options: Bakery3ServerOptions = {}) {\n // The browser SDK takes `{ apiKey }`; this constructor takes the string.\n // Said here, or it would fail as `secretKey.startsWith is not a function`.\n // An object is wrong wherever the code runs, so this one is not deferred.\n if (secretKey != null && typeof secretKey !== 'string') {\n throw new Bakery3Error({\n code: 'InvalidRequest',\n message:\n 'new Bakery3Server() takes the secret key as a string, not an options object.',\n fix: 'new Bakery3Server(process.env.BAKERY3_SECRET_KEY!, options)',\n docs: 'https://bakery3.com/docs/auth',\n });\n }\n this.secretKey = secretKey || undefined;\n this.options = options;\n\n // This module is server-only by design, but nothing stops a bundler from\n // pulling it into a client component, and the failure is silent: the key\n // ships and everything keeps working.\n if (this.secretKey) warnIfKeyIsExposed(this.secretKey, { source: 'node' });\n\n const client = () => this.client();\n // Async, so a key that fails its check rejects the call's promise\n // rather than throwing from it.\n const request: Request = async (method, path, body) =>\n client().request(method, path, body);\n this.tokens = new TokensApi(request);\n this.renders = new RendersApi(request, client);\n this.batches = new BatchesApi(client);\n this.assets = new AssetsApi(client);\n }\n\n /**\n * The same transport the browser SDK uses (one error shape, the same\n * 429/503 backoff) with the secret key as the bearer. It has nothing to\n * re-mint, so a 401 here is a 401. Made on first use, after the key is\n * checked.\n */\n private client(): Bakery3Client {\n if (this.transport) return this.transport;\n const secretKey = this.secretKey;\n if (!secretKey) {\n throw new Bakery3Error({\n code: 'Unauthorized',\n message:\n 'A secret key is required. Create one at https://bakery3.com/keys, then pass it: new Bakery3Server(process.env.BAKERY3_SECRET_KEY!).',\n docs: 'https://bakery3.com/docs/auth',\n });\n }\n // A browser token here is almost always a copy-paste mistake between the\n // two halves of the integration, and it would otherwise fail later with a\n // generic 401 from a route that looks unrelated.\n if (secretKey.startsWith('bk_pt_')) {\n throw new Bakery3Error({\n code: 'Unauthorized',\n message: 'That is a browser token, not a secret key.',\n why: 'Browser tokens (bk_pt_…) are minted by this SDK. Secret keys (bk_sk_…) create them.',\n fix: 'Use your bk_sk_ key from https://bakery3.com/keys, kept in a server-only environment variable.',\n docs: 'https://bakery3.com/docs/auth',\n });\n }\n if (!secretKey.startsWith('bk_sk_')) {\n throw new Bakery3Error({\n code: 'Unauthorized',\n message:\n 'That is not a secret key. Secret keys start with bk_sk_. Create one at https://bakery3.com/keys.',\n docs: 'https://bakery3.com/docs/auth',\n });\n }\n this.transport = new Bakery3Client({\n apiKey: secretKey,\n ...(this.options.baseUrl ? { baseUrl: this.options.baseUrl } : {}),\n ...(this.options.fetch ? { fetch: this.options.fetch } : {}),\n ...(this.options.retry ? { retry: this.options.retry } : {}),\n });\n return this.transport;\n }\n\n /**\n * Render a catalog of models that already sit on a CDN: one call, no\n * browser, and none of the models' bytes through this process. Needs a\n * plan that includes imports (see https://bakery3.com/docs/catalog#plans).\n *\n * const run = await api.renderBatch({\n * key: 'fall-2026',\n * products: [{ id: 'chair-aria', url: 'https://cdn.shop.com/models/chair-aria.glb' }],\n * shots: ['three-quarter', 'front', { kind: 'video', from: 'front', to: 'back', seconds: 4 }],\n * room: { preset: 'loft_golden' },\n * maxCost: 600,\n * });\n * await run.wait(); // or let a webhook tell you, and exit now\n *\n * Resolves once every product is recorded and the run is sealed. The\n * shots render on from there; this process does not have to stay up.\n * A product whose model cannot be imported is skipped and listed in\n * `run.recorded.skips`, and the run goes on. Calling it again with the\n * same `key` resumes a recording that stopped, re-downloads no model that\n * did not change, and adopts every shot that already rendered.\n *\n * What a model by URL cannot carry (node materials, a shader-lit set) is\n * recorded where that code runs; see `renderVariants()` in `@oeave/bakery3`.\n */\n async renderBatch(options: RenderBatchOptions): Promise<RenderBatchRun> {\n if (!(options.maxCost > 0)) {\n throw new Bakery3Error({\n code: 'InvalidRequest',\n message: 'renderBatch() needs a maxCost.',\n why: 'A run is as many renders as products times shots, and a ceiling is what makes that number safe to be wrong about: a page that would cross it is refused, never charged.',\n fix: 'Call quoteBatch() with the same options for the real number, or testBatch() to look at three products first.',\n docs: 'https://bakery3.com/docs/catalog#what-it-will-cost',\n });\n }\n const batch = await this.openRun(options);\n const recorded = await recordBatch(this.client(), batch, options);\n // Sealed only once every product is through. A recording that threw\n // leaves the run open, which is what lets the same call resume it.\n await batch.close();\n return new RenderSet(batch, recorded) as RenderBatchRun;\n }\n\n /**\n * What `renderBatch()` would cost. The models are imported (that is how\n * they are priced); nothing is rendered or charged.\n */\n async quoteBatch(\n options: Omit<RenderBatchOptions, 'maxCost'> & { maxCost?: number },\n ): Promise<RenderBatchRecording> {\n // The route that prices a page belongs to a batch, and a batch is opened\n // under a key. Never the run's own: that batch is the one\n // `renderBatch()` opens with its `maxCost`, and one opened here without\n // a ceiling would be the batch the run then re-opens. A batch of its\n // own, priced and then cancelled, holds nothing and keeps the run's key\n // free.\n const batch = await this.openRun({\n key: options.key && quoteKey(options.key),\n name: `${options.name ?? options.key} (quote)`,\n ...(options.lane ? { lane: options.lane } : {}),\n });\n try {\n return await recordBatch(this.client(), batch, options, {\n dryRun: true,\n });\n } finally {\n // Best effort: a quote batch left open holds nothing either.\n await batch.cancel().catch(() => {});\n }\n }\n\n /**\n * Look before paying: three products (the first, the middle and the last\n * of an array; the first three of anything else), every shot, at preview\n * quality and a small size, in the ordinary lane so they come back in\n * about a minute. A clip is cut to two seconds at twelve frames. Same\n * options as `renderBatch()`. The test run has keys of its own, so the\n * real run never adopts these previews as finished shots.\n *\n * const test = await api.testBatch(options);\n * for (const shot of await test.result()) console.log(shot.variant, shot.shot, shot.url);\n */\n async testBatch(\n options: Omit<RenderBatchOptions, 'maxCost'> & { maxCost?: number },\n test: TestRunOptions = {},\n ): Promise<RenderBatchRun> {\n const edge = QUALITY[options.quality ?? 'studio'].defaultLongEdge;\n const settings = testSettings(\n {\n key: options.key,\n width: options.width ?? edge,\n height: options.height ?? edge,\n },\n test,\n );\n const run: Omit<RenderBatchOptions, 'maxCost'> & { maxCost: number } = {\n ...options,\n key: settings.key,\n lane: settings.lane,\n maxCost: settings.maxCost,\n products: sampleOf(options.products, test.products),\n name: `${options.name ?? options.key} (test)`,\n };\n const batch = await this.openRun(run);\n // Forced over every layer, so a product's or a shot's own 2048² still\n // comes back small.\n const recorded = await recordBatch(this.client(), batch, run, {\n force: {\n version: settings.version,\n quality: settings.quality,\n width: settings.width,\n height: settings.height,\n fps: 12,\n seconds: 2,\n },\n });\n await batch.close();\n return new RenderSet(batch, recorded) as RenderBatchRun;\n }\n\n /**\n * A run by id, from another process, a webhook handler, or tomorrow\n * morning.\n */\n async getRenderSet(id: string): Promise<RenderSet> {\n const client = this.client();\n return new RenderSet(new Batch(client, await client.getBatch(id)));\n }\n\n private async openRun(\n options: Pick<\n RenderBatchOptions,\n 'key' | 'name' | 'lane' | 'maxParallel'\n > & { maxCost?: number },\n ): Promise<Batch> {\n if (!options.key) {\n throw new Bakery3Error({\n code: 'InvalidRequest',\n message: 'A run needs a key.',\n why: 'The key names the run. It is what lets the same call resume a recording that stopped, instead of starting a second one.',\n fix: \"Give it something stable that names this body of work: `key: 'fall-2026'`.\",\n docs: 'https://bakery3.com/docs/catalog',\n });\n }\n const client = this.client();\n return new Batch(\n client,\n await client.openBatch({\n key: options.key,\n ...(options.name ? { name: options.name } : {}),\n ...(options.maxCost !== undefined ? { maxCost: options.maxCost } : {}),\n lane: options.lane ?? 'batch',\n ...(options.maxParallel !== undefined\n ? { maxParallel: options.maxParallel }\n : {}),\n }),\n );\n }\n}\n\nclass AssetsApi {\n constructor(private readonly client: () => Bakery3Client) {}\n\n /**\n * Have the service fetch a public https URL into the project's assets,\n * and say what it found: the hash to put in a manifest, and for a model\n * its triangles, bounds, cameras and anything the renderer cannot read.\n *\n * Secret key only, which is why it is here and not in the browser SDK.\n * What is fetched is fenced on the service's side: https, public\n * addresses only, no credentials, a size limit, and the file must be a\n * model or an HDRI. An unchanged URL is answered without a download\n * (`unchanged: true`).\n */\n async import(\n url: string,\n options: { kind?: AssetImportKind } = {},\n ): Promise<AssetImportResponse> {\n return this.client().importAsset({\n url,\n ...(options.kind ? { kind: options.kind } : {}),\n });\n }\n\n /**\n * Delete one uploaded file from the project now, rather than when\n * retention would. `deleted` is false when the project held no such file,\n * so deleting twice is not an error. The next render that needs the file\n * uploads it again; a render still queued that needs it can fail, and a\n * failed render costs nothing.\n *\n * await api.assets.delete('sha256:9f2b…');\n * // { hash: 'sha256:9f2b…', deleted: true }\n */\n async delete(hash: string): Promise<AssetDeleteResponse> {\n // Checked here and not only by the API: the hash becomes a path, and\n // `../renders/<id>` would be resolved by fetch into another route.\n if (!isAssetHash(hash)) {\n throw new Bakery3Error({\n code: 'InvalidRequest',\n message: `\"${String(hash).slice(0, 80)}\" is not an asset hash. Expected sha256: followed by 64 lowercase hex characters.`,\n fix: 'Pass the hash an import or a manifest gave you, or call assets.deleteAll() for every file.',\n docs: 'https://bakery3.com/docs/uploads#delete-your-uploaded-files',\n });\n }\n return this.client().request<AssetDeleteResponse>(\n 'DELETE',\n `/v1/assets/${hash}`,\n );\n }\n\n /**\n * Delete every uploaded file in the project, a page per request until\n * none is left. Resolves with how many were deleted.\n *\n * await api.assets.deleteAll();\n * // { deleted: 240 }\n */\n async deleteAll(): Promise<{ deleted: number }> {\n const client = this.client();\n let deleted = 0;\n for (;;) {\n const page = await client.request<AssetsDeleteResponse>(\n 'DELETE',\n '/v1/assets',\n );\n deleted += page.deleted;\n // A page that deleted nothing and still says more would loop for\n // ever; the API answers 503 instead, but a loop should not rely on it.\n if (!page.more || page.deleted === 0) return { deleted };\n }\n }\n}\n\ntype Request = <T>(method: string, path: string, body?: unknown) => Promise<T>;\n\nclass TokensApi {\n constructor(private readonly request: Request) {}\n\n /**\n * Mint a browser token.\n *\n * Everything about it is a ceiling rather than a grant: it cannot outlive\n * its expiry, cannot start more renders than `maxRenders`, cannot spend past\n * `maxCost`, cannot be used from an origin outside `allowedOrigins`, and\n * cannot perform a single billing or admin operation. That last one is not\n * a policy: those routes require a `bk_sk_` key and this is not one.\n */\n create(options: BrowserTokenOptions = {}): Promise<BrowserToken> {\n return this.request<BrowserToken>('POST', '/v1/tokens', {\n expiresInSeconds: options.expiresInSeconds ?? 300,\n maxRenders: options.maxRenders ?? 5,\n maxCost: options.maxCost ?? 2,\n ...(options.allowedOrigins\n ? { allowedOrigins: options.allowedOrigins }\n : {}),\n ...(options.subject ? { subject: options.subject } : {}),\n });\n }\n\n /** Revoke a token before its expiry. */\n revoke(token: string): Promise<void> {\n return this.request<void>('POST', '/v1/tokens/revoke', { token });\n }\n}\n\nclass RendersApi {\n constructor(\n private readonly request: Request,\n private readonly client: () => Bakery3Client,\n ) {}\n\n /**\n * Render from a manifest you already have: a batch job, a re-render, a\n * queued webhook. The browser flow is `@oeave/bakery3`; this is the API.\n * Repeated on a 429/503 only when `spec.idempotencyKey` makes that safe.\n */\n async create(spec: RenderSpec): Promise<RenderRecord> {\n return this.client().createRender(spec);\n }\n\n /** A render's record, with its state, cost and result URLs. */\n get(id: string): Promise<RenderRecord> {\n return this.request<RenderRecord>('GET', `/v1/renders/${id}`);\n }\n\n /** Cancel a render that has not finished. Already terminal is a no-op. */\n cancel(id: string): Promise<RenderRecord> {\n return this.request<RenderRecord>('POST', `/v1/renders/${id}/cancel`, {});\n }\n\n /**\n * One more attempt for a render that failed with `attemptsExhausted`.\n * Returns the new render, linked to the old one; a render that is not in\n * that state answers 409.\n */\n async retry(id: string): Promise<RenderRecord> {\n return this.client().retryRender(id);\n }\n\n /**\n * Delete a render now rather than when retention would: the result, the\n * preview, and every signed URL that pointed at them. The record survives\n * as `expired`, so the receipt is still readable. A live render is\n * cancelled first.\n */\n delete(id: string): Promise<RenderRecord> {\n return this.request<RenderRecord>('DELETE', `/v1/renders/${id}`);\n }\n\n /** The project's renders, newest first, a page at a time. */\n list(options: { limit?: number; cursor?: string } = {}): Promise<{\n renders: RenderRecord[];\n cursor: string | null;\n }> {\n const query = new URLSearchParams();\n if (options.limit) query.set('limit', String(options.limit));\n if (options.cursor) query.set('cursor', options.cursor);\n const suffix = query.toString() ? `?${query}` : '';\n return this.request('GET', `/v1/renders${suffix}`);\n }\n\n /** The quote for a spec: a likely cost and a maximum, in USD. */\n estimate(\n spec: Pick<RenderSpec, 'quality' | 'output' | 'advanced'>,\n ): Promise<CostEstimate> {\n return this.request<CostEstimate>('POST', '/v1/estimate', spec);\n }\n}\n\n/**\n * Batches from a server: manifests you already have, added by the hundred\n * and rendered behind one cost ceiling. `renderBatch()` builds on this.\n *\n * const batch = await api.batches.open({ key: 'fall-2026-v3', lane: 'batch', maxCost: 600 });\n * for await (const line of readLines('manifests.jsonl')) {\n * const item = JSON.parse(line);\n * batch.add({ key: item.key, spec: item.spec, metadata: item.metadata });\n * if (batch.buffered >= 100) await batch.flush();\n * }\n * await batch.close();\n * await batch.wait({ onProgress: (p) => console.log(`${p.completed}/${p.total}`) });\n */\nclass BatchesApi {\n constructor(private readonly client: () => Bakery3Client) {}\n\n /** Open, or re-open by key. */\n async open(request: BatchOpenRequest): Promise<Batch> {\n const client = this.client();\n return new Batch(client, await client.openBatch(request));\n }\n\n /** A batch by id, with its latest counts. */\n async get(id: string): Promise<Batch> {\n const client = this.client();\n return new Batch(client, await client.getBatch(id));\n }\n}\n\nexport { Bakery3Error, BatchPageRefused } from '../errors.js';\nexport type { Batch } from '../batch.js';\nexport type { RenderSet } from '../set.js';\nexport type { Recorded, RenderSetFailure, RenderSetImage } from '../set.js';\nexport type { TestRunOptions } from '../testRun.js';\nexport type {\n BatchEnvironment,\n BatchProduct,\n BatchRoom,\n ImageShot,\n ProductSkip,\n RenderBatchOptions,\n RenderBatchProgress,\n RenderBatchRecorded,\n Shot,\n ShotSettings,\n VideoShot,\n View,\n} from './renderBatch.js';\nexport type { Angle, ViewWord } from '../frame.js';\nexport type { BatchProgress, FlushOptions, WaitOptions } from '../batch.js';\nexport type {\n BatchItemRecord,\n BatchItemsPage,\n RetryPolicy,\n} from '../client.js';\nexport { verifyWebhook } from './webhook.js';\nexport type {\n AssetDeleteResponse,\n BatchAddRequest,\n BatchAddResponse,\n BatchExportLine,\n BatchItemOutcome,\n BatchItemRequest,\n BatchOpenRequest,\n BatchRecord,\n CostEstimate,\n FrameSequenceIndex,\n RenderRecord,\n RenderSpec,\n} from '../protocol/index.js';\n"]}